void gps_enable(appdata_t *appdata, gboolean enable) { if(appdata->settings) { gps_state_t *gps_state = appdata->gps_state; /* for location update callbacks */ gps_state->data = appdata; if(enable != appdata->gps_state->gps_is_on) { if(gps_state->device && gps_state->control #if MAEMO_VERSION_MAJOR < 5 && gps_state->control->can_control #endif ) { if(enable) { printf("starting gpsd\n"); location_gpsd_control_start(gps_state->control); } else { printf("stopping gpsd\n"); location_gpsd_control_stop(gps_state->control); } appdata->gps_state->gps_is_on = enable; } } appdata->settings->enable_gps = enable; } }
bool NokiaMaemoLocationInterfaceImpl::registerLbsClient() { //Init glib. Should probably only be done if not already initialized g_type_init(); // Check if g_thread already has been initialized. note that // all parts doing this init must check if its already initialized // i.e. WFAPITestClient does this init aswell. if (!g_thread_supported ()) g_thread_init(NULL); // Location Control setup m_control = location_gpsd_control_get_default(); // if(m_control->can_control) location_gpsd_control_start (m_control); // Location Device setup m_device = (LocationGPSDevice*)g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL); location_gps_device_reset_last_known (m_device); nav2log << "[Debug] GPS Device pointer adress: " << (unsigned int)m_device << endl; nav2log << "[Info] GPS Device object obtained\n" << endl; if (m_device == NULL) { // Could not register client nav2log << "NokiaMaemoLocationInterfaceImpl::registerLbsClient failed, invalid device id." << endl; return false; } return true; }
void gps_liblocation_state_t::setEnable(bool en) { if(en != gps_is_on) { if(device && control) { if(en) { g_debug("starting gpsd"); location_gpsd_control_start(control); } else { g_debug("stopping gpsd"); location_gpsd_control_stop(control); } gps_is_on = en; } } enabled = en; }
nsresult MaemoLocationProvider::StartControl() { if (mGPSControl) return NS_OK; mGPSControl = location_gpsd_control_get_default(); NS_ENSURE_TRUE(mGPSControl, NS_ERROR_FAILURE); mControlError = g_signal_connect(mGPSControl, "error", G_CALLBACK(ControlError), this); mControlStopped = g_signal_connect(mGPSControl, "gpsd_stopped", G_CALLBACK(ControlStopped), this); location_gpsd_control_start(mGPSControl); return NS_OK; }