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) {
38 if (gps->device->fix) {
39 if (gps->device->fix->fields) {
40 g_print("lat = %f, long = %f, eph = %f\n", gps->device->fix->latitude, gps->device->fix->longitude, gps->device->fix->eph/100.);
41 gps->latitude = gps->device->fix->latitude;
42 gps->longitude = gps->device->fix->longitude;
43 gps->accuracy = gps->device->fix->eph/100.;
45 if ( gps->usegps == 0) {
46 emit gps->getOK_acwp();
47 // if ( gps->accuracy < 100*1000 ) gps->stop();
48 if ( gps->accuracy < 640*1000 ) gps->stop();
49 } else if ( gps->usegps == 1 ) {
50 emit gps->getOK_agnss();
51 // if ( device->satellites_in_use > 0 ) gps->stop();
52 if ( gps->device->fix->mode == LOCATION_GPS_DEVICE_MODE_3D ) gps->stop();