3 GpsMaemo5::GpsMaemo5(QObject *parent) : QObject(parent) {
9 control = location_gpsd_control_get_default();
10 device = (LocationGPSDevice*) g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
11 g_signal_connect(device, "changed", G_CALLBACK(GpsMaemo5_changed), this);
14 void GpsMaemo5::get_acwp() {
15 g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_ACWP, NULL);
20 void GpsMaemo5::get_agnss() {
21 g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_AGNSS, NULL);
26 void GpsMaemo5::stop() {
27 location_gpsd_control_stop(control);
30 void GpsMaemo5::restart() {
31 location_gpsd_control_stop(control);
32 location_gpsd_control_start(control);
35 void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps) {
37 if (device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET) {
38 g_print("lat = %f, long = %f, eph = %f\n", device->fix->latitude, device->fix->longitude, device->fix->eph/100.);
39 gps->latitude = device->fix->latitude;
40 gps->longitude = device->fix->longitude;
41 gps->accuracy = device->fix->eph/100.;
43 if ( gps->usegps == 0) {
44 emit gps->getOK_acwp();
45 } else if ( gps->usegps == 1 ) {
46 if ( gps->device->satellites_in_use > 0 ) {
47 emit gps->getOK_agnss();