Home | History | Annotate | Download | only in libloc_api

Lines Matching refs:loc_eng_data

126 loc_eng_data_s_type loc_eng_data;
184 if (loc_eng_data.deferred_action_thread) {
194 memset (&loc_eng_data, 0, sizeof (loc_eng_data_s_type));
197 loc_eng_data.location_cb = callbacks->location_cb;
198 loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
199 loc_eng_data.status_cb = callbacks->status_cb;
200 loc_eng_data.nmea_cb = callbacks->nmea_cb;
201 loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
202 loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
213 loc_eng_data.client_handle = loc_open (event, loc_event_cb);
215 pthread_mutex_init (&(loc_eng_data.deferred_action_mutex), NULL);
216 pthread_cond_init (&(loc_eng_data.deferred_action_cond) , NULL);
217 pthread_mutex_init (&(loc_eng_data.deferred_stop_mutex), NULL);
219 loc_eng_data.loc_event = 0;
220 loc_eng_data.deferred_action_flags = 0;
221 memset (loc_eng_data.apn_name, 0, sizeof (loc_eng_data.apn_name));
223 loc_eng_data.aiding_data_for_deletion = 0;
224 loc_eng_data.engine_status = GPS_STATUS_NONE;
227 loc_eng_data.xtra_module_data.download_request_cb = NULL;
230 loc_eng_data.ioctl_data.cb_is_selected = FALSE;
231 loc_eng_data.ioctl_data.cb_is_waiting = FALSE;
232 loc_eng_data.ioctl_data.client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
233 memset (&(loc_eng_data.ioctl_data.cb_payload),
237 pthread_mutex_init (&(loc_eng_data.ioctl_data.cb_data_mutex), NULL);
238 pthread_cond_init(&loc_eng_data.ioctl_data.cb_arrived_cond, NULL);
240 loc_eng_data.deferred_action_thread = callbacks->create_thread_cb("loc_api",
243 ALOGD ("loc_eng_init called, client id = %d\n", (int32) loc_eng_data.client_handle);
268 if (loc_eng_data.deferred_action_thread)
271 pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
273 loc_eng_data.acquire_wakelock_cb();
274 loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_QUIT;
275 pthread_cond_signal(&loc_eng_data.deferred_action_cond);
276 pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
279 pthread_join(loc_eng_data.deferred_action_thread, &ignoredValue);
280 loc_eng_data.deferred_action_thread = NULL;
284 (void) loc_close (loc_eng_data.client_handle);
286 pthread_mutex_destroy (&loc_eng_data.deferred_action_mutex);
287 pthread_cond_destroy (&loc_eng_data.deferred_action_cond);
289 pthread_mutex_destroy (&loc_eng_data.ioctl_data.cb_data_mutex);
290 pthread_cond_destroy (&loc_eng_data.ioctl_data.cb_arrived_cond);
319 if (loc_eng_data.position_mode != GPS_POSITION_MODE_STANDALONE &&
320 loc_eng_data.agps_server_host[0] != 0 &&
321 loc_eng_data.agps_server_port != 0) {
326 ret_val = loc_start_fix (loc_eng_data.client_handle);
359 pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
362 if (loc_eng_data.agps_request_pending)
364 loc_eng_data.stop_request_pending = true;
366 pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
369 pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
371 ret_val = loc_stop_fix (loc_eng_data.client_handle);
386 (int32) loc_eng_data.client_handle, lock_type);
391 ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
429 (int32) loc_eng_data.client_handle, min_interval, mode);
431 loc_eng_data.position_mode = mode;
473 ret_val = loc_eng_ioctl(loc_eng_data.client_handle,
518 ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
560 pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
564 loc_eng_data.aiding_data_for_deletion = GPS_DELETE_ALL;
566 if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) &&
567 (loc_eng_data.aiding_data_for_deletion != 0))
570 loc_eng_data.acquire_wakelock_cb();
571 loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_DELETE_AIDING;
572 pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
577 pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
712 if (client_handle == loc_eng_data.client_handle)
714 pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
715 loc_eng_data.loc_event = loc_event;
716 memcpy(&loc_eng_data.loc_event_payload, loc_event_payload, sizeof(*loc_event_payload));
719 loc_eng_data.acquire_wakelock_cb();
720 loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_EVENT;
721 pthread_cond_signal(&loc_eng_data.deferred_action_cond);
722 pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
726 ALOGD ("loc client mismatch: received = %d, expected = %d \n", (int32) client_handle, (int32) loc_eng_data.client_handle);
801 if (loc_eng_data.location_cb != NULL)
804 loc_eng_data.location_cb (&location);
927 if ((SvStatus.num_svs != 0) && (loc_eng_data.sv_status_cb != NULL))
929 loc_eng_data.sv_status_cb(&SvStatus);
964 loc_eng_data.status_cb(&status);
970 loc_eng_data.status_cb(&status);
974 pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
975 loc_eng_data.engine_status = status.status;
978 if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) &&
979 (loc_eng_data.aiding_data_for_deletion != 0))
982 loc_eng_data.acquire_wakelock_cb();
983 loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_DELETE_AIDING;
984 pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
988 pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
993 if (loc_eng_data.nmea_cb != NULL)
1001 loc_eng_data.nmea_cb(now, nmea_report_ptr->nmea_sentences.nmea_sentences_val,
1004 loc_eng_data.nmea_cb(now, nmea_report_ptr->nmea_sentences, nmea_report_ptr->length);
1030 pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
1035 loc_eng_data.conn_handle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
1036 loc_eng_data.agps_status = GPS_REQUEST_AGPS_DATA_CONN;
1037 loc_eng_data.agps_request_pending = true;
1041 loc_eng_data.conn_handle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
1042 loc_eng_data.agps_status = GPS_RELEASE_AGPS_DATA_CONN;
1043 loc_eng_data.agps_request_pending = false;
1047 loc_eng_data.acquire_wakelock_cb();
1048 loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_STATUS;
1049 pthread_cond_signal(&loc_eng_data.deferred_action_cond);
1050 pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
1072 loc_eng_data.agps_status_cb = callbacks->status_cb;
1080 pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
1086 if (apn_len >= sizeof(loc_eng_data.apn_name))
1089 apn_len = sizeof(loc_eng_data.apn_name) - 1;
1092 memcpy (loc_eng_data.apn_name, apn, apn_len);
1093 loc_eng_data.apn_name[apn_len] = '\0';
1097 loc_eng_data.acquire_wakelock_cb();
1098 loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_SUCCESS;
1099 pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
1100 pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
1107 pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
1109 loc_eng_data.acquire_wakelock_cb();
1110 loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_CLOSED;
1111 pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
1112 pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
1120 pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
1122 loc_eng_data.acquire_wakelock_cb();
1123 loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_FAILED;
1124 pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
1125 pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
1137 if (loc_eng_data.agps_server_host[0] == 0 || loc_eng_data.agps_server_port == 0)
1140 if (loc_eng_data.agps_server_address == 0) {
1141 struct hostent* he = gethostbyname(loc_eng_data.agps_server_host);
1143 loc_eng_data.agps_server_address = *(uint32_t *)he->h_addr_list[0];
1145 if (loc_eng_data.agps_server_address == 0)
1148 b_ptr = (unsigned char*) (&loc_eng_data.agps_server_address);
1162 (loc_eng_data.agps_server_port & (0x0000ffff)));
1174 (loc_eng_data.agps_server_port & (0x0000ffff)));
1180 ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
1205 strncpy(loc_eng_data.agps_server_host, hostname, sizeof(loc_eng_data.agps_server_host) - 1);
1206 loc_eng_data.agps_server_port = port;
1238 assist_data_ptr->type = loc_eng_data.aiding_data_for_deletion;
1239 loc_eng_data.aiding_data_for_deletion = 0;
1243 ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
1277 ALOGV("loc_eng_process_atl_deferred_action, agps_status = %d\n", loc_eng_data.agps_status);
1285 conn_close_status_ptr->conn_handle = loc_eng_data.conn_handle;
1292 conn_open_status_ptr->conn_handle = loc_eng_data.conn_handle;
1297 // strcpy (&(ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status.apn_name), &(loc_eng_data.apn_name));
1299 conn_open_status_ptr->apn_name = loc_eng_data.apn_name;
1302 strncpy(conn_open_status_ptr->apn_name, loc_eng_data.apn_name,
1317 ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
1374 if (loc_eng_data.xtra_module_data.download_request_cb != NULL)
1376 loc_eng_data.xtra_module_data.download_request_cb ();
1384 (void) loc_eng_ioctl_process_cb (loc_eng_data.client_handle,
1450 pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
1454 if (loc_eng_data.deferred_action_flags == 0) {
1456 loc_eng_data.release_wakelock_cb();
1457 pthread_cond_wait(&loc_eng_data.deferred_action_cond,
1458 &loc_eng_data.deferred_action_mutex);
1461 loc_eng_data.acquire_wakelock_cb();
1464 if (loc_eng_data.deferred_action_flags & DEFERRED_ACTION_QUIT)
1466 pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
1471 loc_event = loc_eng_data.loc_event;
1473 memcpy(&loc_event_payload, &loc_eng_data.loc_event_payload, sizeof(loc_event_payload));
1474 loc_eng_data.loc_event = 0;
1477 int flags = loc_eng_data.deferred_action_flags;
1478 loc_eng_data.deferred_action_flags = 0;
1479 engine_status = loc_eng_data.agps_status;
1480 aiding_data_for_deletion = loc_eng_data.aiding_data_for_deletion;
1481 status.status = loc_eng_data.agps_status;
1482 loc_eng_data.agps_status = 0;
1485 pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
1503 pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
1506 loc_eng_data.agps_request_pending = false;
1507 if (loc_eng_data.stop_request_pending)
1510 if (loc_stop_fix(loc_eng_data.client_handle) != RPC_LOC_API_SUCCESS)
1515 pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
1518 if (status.status != 0 && loc_eng_data.agps_status_cb) {
1519 loc_eng_data.agps_status_cb(&status);
1528 loc_eng_data.release_wakelock_cb();
1530 loc_eng_data.deferred_action_thread = 0;