/*=========================================================================== FUNCTION loc_init DESCRIPTION Initialize the location engine, this include setting up global datas and registers location engien with loc api service. DEPENDENCIES None RETURN VALUE 0: success SIDE EFFECTS N/Ax ===========================================================================*/ static int loc_init(GpsCallbacks* callbacks) { ENTRY_LOG(); LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT | LOC_API_ADAPTER_BIT_SATELLITE_REPORT | LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST | LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST | LOC_API_ADAPTER_BIT_IOCTL_REPORT | LOC_API_ADAPTER_BIT_STATUS_REPORT | LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT | LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; LocCallbacks clientCallbacks = {loc_cb, /* location_cb */ callbacks->status_cb, /* status_cb */ sv_cb, /* sv_status_cb */ callbacks->nmea_cb, /* nmea_cb */ callbacks->set_capabilities_cb, /* set_capabilities_cb */ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */ callbacks->release_wakelock_cb, /* release_wakelock_cb */ callbacks->create_thread_cb, /* create_thread_cb */ NULL, /* location_ext_parser */ NULL /* sv_ext_parser */}; gps_loc_cb = callbacks->location_cb; gps_sv_cb = callbacks->sv_status_cb; if (get_target_name() == TARGET_NAME_APQ8064_STANDALONE) { gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB); gss_fd = open("/dev/gss", O_RDONLY); if (gss_fd < 0) { LOC_LOGE("GSS open failed: %s\n", strerror(errno)); return NULL; } LOC_LOGD("GSS open success! CAPABILITIES %0x\n", gps_conf.CAPABILITIES); } int retVal = -1; if (loc_eng_ulp_inf == NULL) retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL); else retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, loc_ulp_msg_sender); int ret_val1 = loc_eng_ulp_init(loc_afw_data, loc_eng_ulp_inf); LOC_LOGD("loc_eng_ulp_init returned %d\n",ret_val1); EXIT_LOG(%d, retVal); return retVal; }
/*=========================================================================== FUNCTION loc_init DESCRIPTION Initialize the location engine, this include setting up global datas and registers location engien with loc api service. DEPENDENCIES None RETURN VALUE 0: success SIDE EFFECTS N/Ax ===========================================================================*/ static int loc_init(GpsCallbacks* callbacks) { ENTRY_LOG(); LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT | LOC_API_ADAPTER_BIT_SATELLITE_REPORT | LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST | LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST | LOC_API_ADAPTER_BIT_IOCTL_REPORT | LOC_API_ADAPTER_BIT_STATUS_REPORT | LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT | LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; LocCallbacks clientCallbacks = {loc_cb, /* location_cb */ callbacks->status_cb, /* status_cb */ sv_cb, /* sv_status_cb */ callbacks->nmea_cb, /* nmea_cb */ callbacks->set_capabilities_cb, /* set_capabilities_cb */ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */ callbacks->release_wakelock_cb, /* release_wakelock_cb */ callbacks->create_thread_cb, /* create_thread_cb */ NULL, /* location_ext_parser */ NULL /* sv_ext_parser */}; gps_loc_cb = callbacks->location_cb; gps_sv_cb = callbacks->sv_status_cb; int ret_val = loc_eng_init(loc_afw_data, &clientCallbacks, event); EXIT_LOG(%d, ret_val); return ret_val; }
LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST | LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST | LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; LocCallbacks clientCallbacks = {NULL, /* location_cb */ NULL, /* status_cb */ NULL, /* sv_status_cb */ NULL, /* nmea_cb */ callbacks->set_capabilities_cb, /* set_capabilities_cb */ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */ callbacks->release_wakelock_cb, /* release_wakelock_cb */ callbacks->create_thread_cb, /* create_thread_cb */ NULL, /* location_ext_parser */ NULL, /* sv_ext_parser */ callbacks->request_utc_time_cb /* request_utc_time_cb */}; retVal = loc_eng_init(loc_prop_data, &clientCallbacks, event, NULL); loc_prop_data.adapter->mSupportsAgpsRequests = true; loc_prop_data.adapter->mSupportsPositionInjection = true; loc_prop_data.adapter->mSupportsTimeInjection = true; EXIT_LOG(%d, retVal); return retVal; } /*=========================================================================== FUNCTION loc_ext_cleanup DESCRIPTION Cleans location engine. The location client handle will be released. DEPENDENCIES