5 GpsMaemo5::GpsMaemo5(QObject *parent) : QObject(parent) {
11 control = location_gpsd_control_get_default();
12 device = (LocationGPSDevice*) g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
13 g_signal_connect(device, "changed", G_CALLBACK(GpsMaemo5_changed), this);
16 void GpsMaemo5::get_acwp() {
17 g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_ACWP, NULL);
22 void GpsMaemo5::get_agnss() {
23 g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_AGNSS, NULL);
28 void GpsMaemo5::stop() {
29 location_gpsd_control_stop(control);
32 void GpsMaemo5::restart() {
33 location_gpsd_control_stop(control);
34 location_gpsd_control_start(control);
37 void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps) {
39 if (device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET) {
40 g_print("lat = %f, long = %f, eph = %f\n", device->fix->latitude, device->fix->longitude, device->fix->eph/100.);
41 gps->latitude = device->fix->latitude;
42 gps->longitude = device->fix->longitude;
43 gps->accuracy = device->fix->eph/100.;
45 if ( gps->usegps == 0) {
46 emit gps->getOK_acwp();
47 } else if ( gps->usegps == 1 ) {
48 if ( gps->device->satellites_in_use > 0 ) {
49 emit gps->getOK_agnss();