1 /* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of Code Aurora Forum, Inc. nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30 #define LOG_NDDEBUG 0
31 #define LOG_TAG "LocSvc_afw"
32
33 #include <hardware/gps.h>
34 #include <loc_eng.h>
35 #include <loc_log.h>
36
37 static gps_location_callback gps_loc_cb = NULL;
38 static gps_sv_status_callback gps_sv_cb = NULL;
39
40 static void loc_cb(GpsLocation* location, void* locExt);
41 static void sv_cb(GpsSvStatus* sv_status, void* svExt);
42
43 // Function declarations for sLocEngInterface
44 static int loc_init(GpsCallbacks* callbacks);
45 static int loc_start();
46 static int loc_stop();
47 static void loc_cleanup();
48 static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
49 static int loc_inject_location(double latitude, double longitude, float accuracy);
50 static void loc_delete_aiding_data(GpsAidingData f);
51 static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
52 uint32_t min_interval, uint32_t preferred_accuracy,
53 uint32_t preferred_time);
54 static const void* loc_get_extension(const char* name);
55 #ifdef QCOM_FEATURE_ULP
56 static int loc_update_criteria(UlpLocationCriteria criteria);
57 #endif
58
59 // Defines the GpsInterface in gps.h
60 static const GpsInterface sLocEngInterface =
61 {
62 sizeof(GpsInterface),
63 loc_init,
64 loc_start,
65 loc_stop,
66 loc_cleanup,
67 loc_inject_time,
68 loc_inject_location,
69 loc_delete_aiding_data,
70 loc_set_position_mode,
71 loc_get_extension
72 #ifdef QCOM_FEATURE_ULP
73 ,loc_update_criteria
74 #endif
75 };
76
77 // Function declarations for sLocEngAGpsInterface
78 static void loc_agps_init(AGpsCallbacks* callbacks);
79 #ifdef QCOM_FEATURE_IPV6
80 static int loc_agps_open(AGpsType agpsType,
81 const char* apn, AGpsBearerType bearerType);
82 static int loc_agps_closed(AGpsType agpsType);
83 static int loc_agps_open_failed(AGpsType agpsType);
84 #else
85 static int loc_agps_open(const char* apn);
86 static int loc_agps_closed();
87 static int loc_agps_open_failed();
88 #endif
89 static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
90
91 static const AGpsInterface sLocEngAGpsInterface =
92 {
93 sizeof(AGpsInterface),
94 loc_agps_init,
95 loc_agps_open,
96 loc_agps_closed,
97 loc_agps_open_failed,
98 loc_agps_set_server
99 };
100
101 static int loc_xtra_init(GpsXtraCallbacks* callbacks);
102 static int loc_xtra_inject_data(char* data, int length);
103
104 static const GpsXtraInterface sLocEngXTRAInterface =
105 {
106 sizeof(GpsXtraInterface),
107 loc_xtra_init,
108 loc_xtra_inject_data
109 };
110
111 static void loc_ni_init(GpsNiCallbacks *callbacks);
112 static void loc_ni_respond(int notif_id, GpsUserResponseType user_response);
113
114 const GpsNiInterface sLocEngNiInterface =
115 {
116 sizeof(GpsNiInterface),
117 loc_ni_init,
118 loc_ni_respond,
119 };
120
121 static void loc_agps_ril_init( AGpsRilCallbacks* callbacks );
122 static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct);
123 static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid);
124 static void loc_agps_ril_ni_message(uint8_t *msg, size_t len);
125 static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info);
126 static void loc_agps_ril_update_network_availability(int avaiable, const char* apn);
127
128 static const AGpsRilInterface sLocEngAGpsRilInterface =
129 {
130 sizeof(AGpsRilInterface),
131 loc_agps_ril_init,
132 loc_agps_ril_set_ref_location,
133 loc_agps_ril_set_set_id,
134 loc_agps_ril_ni_message,
135 loc_agps_ril_update_network_state,
136 loc_agps_ril_update_network_availability
137 };
138
139 #ifdef QCOM_FEATURE_ULP
140 static bool loc_inject_raw_command(char* command, int length);
141
142 static const InjectRawCmdInterface sLocEngInjectRawCmdInterface =
143 {
144 sizeof(InjectRawCmdInterface),
145 loc_inject_raw_command
146 };
147 #endif
148
149 static loc_eng_data_s_type loc_afw_data;
150
151 /*===========================================================================
152 FUNCTION gps_get_hardware_interface
153
154 DESCRIPTION
155 Returns the GPS hardware interaface based on LOC API
156 if GPS is enabled.
157
158 DEPENDENCIES
159 None
160
161 RETURN VALUE
162 0: success
163
164 SIDE EFFECTS
165 N/A
166
167 ===========================================================================*/
gps_get_hardware_interface()168 const GpsInterface* gps_get_hardware_interface ()
169 {
170 ENTRY_LOG_CALLFLOW();
171 const GpsInterface* ret_val;
172
173 char propBuf[PROPERTY_VALUE_MAX];
174
175 // check to see if GPS should be disabled
176 property_get("gps.disable", propBuf, "");
177 if (propBuf[0] == '1')
178 {
179 LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
180 ret_val = NULL;
181 } else {
182 ret_val = &sLocEngInterface;
183 }
184
185 EXIT_LOG(%p, ret_val);
186 return ret_val;
187 }
188
189 // for gps.c
get_gps_interface()190 extern "C" const GpsInterface* get_gps_interface()
191 {
192 return &sLocEngInterface;
193 }
194 /*===========================================================================
195 FUNCTION loc_init
196
197 DESCRIPTION
198 Initialize the location engine, this include setting up global datas
199 and registers location engien with loc api service.
200
201 DEPENDENCIES
202 None
203
204 RETURN VALUE
205 0: success
206
207 SIDE EFFECTS
208 N/Ax
209
210 ===========================================================================*/
loc_init(GpsCallbacks * callbacks)211 static int loc_init(GpsCallbacks* callbacks)
212 {
213 ENTRY_LOG();
214 LOC_API_ADAPTER_EVENT_MASK_T event =
215 LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
216 LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
217 LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
218 LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
219 LOC_API_ADAPTER_BIT_IOCTL_REPORT |
220 LOC_API_ADAPTER_BIT_STATUS_REPORT |
221 LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
222 LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
223 LocCallbacks clientCallbacks = {loc_cb, /* location_cb */
224 callbacks->status_cb, /* status_cb */
225 sv_cb, /* sv_status_cb */
226 callbacks->nmea_cb, /* nmea_cb */
227 callbacks->set_capabilities_cb, /* set_capabilities_cb */
228 callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */
229 callbacks->release_wakelock_cb, /* release_wakelock_cb */
230 callbacks->create_thread_cb, /* create_thread_cb */
231 NULL, /* location_ext_parser */
232 NULL /* sv_ext_parser */};
233 gps_loc_cb = callbacks->location_cb;
234 gps_sv_cb = callbacks->sv_status_cb;
235
236 int ret_val = loc_eng_init(loc_afw_data, &clientCallbacks, event);
237
238 EXIT_LOG(%d, ret_val);
239 return ret_val;
240 }
241
242 /*===========================================================================
243 FUNCTION loc_cleanup
244
245 DESCRIPTION
246 Cleans location engine. The location client handle will be released.
247
248 DEPENDENCIES
249 None
250
251 RETURN VALUE
252 None
253
254 SIDE EFFECTS
255 N/A
256
257 ===========================================================================*/
loc_cleanup()258 static void loc_cleanup()
259 {
260 ENTRY_LOG();
261 loc_eng_cleanup(loc_afw_data);
262 gps_loc_cb = NULL;
263 gps_sv_cb = NULL;
264 EXIT_LOG(%s, VOID_RET);
265 }
266
267 /*===========================================================================
268 FUNCTION loc_start
269
270 DESCRIPTION
271 Starts the tracking session
272
273 DEPENDENCIES
274 None
275
276 RETURN VALUE
277 0: success
278
279 SIDE EFFECTS
280 N/A
281
282 ===========================================================================*/
loc_start()283 static int loc_start()
284 {
285 ENTRY_LOG();
286 int ret_val = loc_eng_start(loc_afw_data);
287
288 EXIT_LOG(%d, ret_val);
289 return ret_val;
290 }
291
292 /*===========================================================================
293 FUNCTION loc_stop
294
295 DESCRIPTION
296 Stops the tracking session
297
298 DEPENDENCIES
299 None
300
301 RETURN VALUE
302 0: success
303
304 SIDE EFFECTS
305 N/A
306
307 ===========================================================================*/
loc_stop()308 static int loc_stop()
309 {
310 ENTRY_LOG();
311 int ret_val = loc_eng_stop(loc_afw_data);
312
313 EXIT_LOG(%d, ret_val);
314 return ret_val;
315 }
316
317 /*===========================================================================
318 FUNCTION loc_set_position_mode
319
320 DESCRIPTION
321 Sets the mode and fix frequency for the tracking session.
322
323 DEPENDENCIES
324 None
325
326 RETURN VALUE
327 0: success
328
329 SIDE EFFECTS
330 N/A
331
332 ===========================================================================*/
loc_set_position_mode(GpsPositionMode mode,GpsPositionRecurrence recurrence,uint32_t min_interval,uint32_t preferred_accuracy,uint32_t preferred_time)333 static int loc_set_position_mode(GpsPositionMode mode,
334 GpsPositionRecurrence recurrence,
335 uint32_t min_interval,
336 uint32_t preferred_accuracy,
337 uint32_t preferred_time)
338 {
339 ENTRY_LOG();
340 LocPositionMode locMode;
341 switch (mode) {
342 case GPS_POSITION_MODE_MS_BASED:
343 locMode = LOC_POSITION_MODE_MS_BASED;
344 break;
345 case GPS_POSITION_MODE_MS_ASSISTED:
346 locMode = LOC_POSITION_MODE_MS_ASSISTED;
347 break;
348 default:
349 locMode = LOC_POSITION_MODE_STANDALONE;
350 break;
351 }
352 int ret_val = loc_eng_set_position_mode(loc_afw_data, locMode,
353 recurrence, min_interval,
354 preferred_accuracy, preferred_time);
355
356 EXIT_LOG(%d, ret_val);
357 return ret_val;
358 }
359
360 /*===========================================================================
361 FUNCTION loc_inject_time
362
363 DESCRIPTION
364 This is used by Java native function to do time injection.
365
366 DEPENDENCIES
367 None
368
369 RETURN VALUE
370 0
371
372 SIDE EFFECTS
373 N/A
374
375 ===========================================================================*/
loc_inject_time(GpsUtcTime time,int64_t timeReference,int uncertainty)376 static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
377 {
378 ENTRY_LOG();
379 int ret_val = loc_eng_inject_time(loc_afw_data, time, timeReference, uncertainty);
380
381 EXIT_LOG(%d, ret_val);
382 return ret_val;
383 }
384
385
386 /*===========================================================================
387 FUNCTION loc_inject_location
388
389 DESCRIPTION
390 This is used by Java native function to do location injection.
391
392 DEPENDENCIES
393 None
394
395 RETURN VALUE
396 0 : Successful
397 error code : Failure
398
399 SIDE EFFECTS
400 N/A
401 ===========================================================================*/
loc_inject_location(double latitude,double longitude,float accuracy)402 static int loc_inject_location(double latitude, double longitude, float accuracy)
403 {
404 ENTRY_LOG();
405 int ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
406
407 EXIT_LOG(%d, ret_val);
408 return ret_val;
409 }
410
411
412 /*===========================================================================
413 FUNCTION loc_delete_aiding_data
414
415 DESCRIPTION
416 This is used by Java native function to delete the aiding data. The function
417 updates the global variable for the aiding data to be deleted. If the GPS
418 engine is off, the aiding data will be deleted. Otherwise, the actual action
419 will happen when gps engine is turned off.
420
421 DEPENDENCIES
422 Assumes the aiding data type specified in GpsAidingData matches with
423 LOC API specification.
424
425 RETURN VALUE
426 None
427
428 SIDE EFFECTS
429 N/A
430
431 ===========================================================================*/
loc_delete_aiding_data(GpsAidingData f)432 static void loc_delete_aiding_data(GpsAidingData f)
433 {
434 ENTRY_LOG();
435 loc_eng_delete_aiding_data(loc_afw_data, f);
436
437 EXIT_LOG(%s, VOID_RET);
438 }
439
440 #ifdef QCOM_FEATURE_ULP
441 /*===========================================================================
442 FUNCTION loc_update_criteria
443
444 DESCRIPTION
445 This is used to inform the ULP module of new unique criteria that are passed
446 in by the applications
447 DEPENDENCIES
448 N/A
449
450 RETURN VALUE
451 0: success
452
453 SIDE EFFECTS
454 N/A
455
456 ===========================================================================*/
loc_update_criteria(UlpLocationCriteria criteria)457 static int loc_update_criteria(UlpLocationCriteria criteria)
458 {
459 ENTRY_LOG();
460 int ret_val = loc_eng_update_criteria(loc_afw_data, criteria);
461
462 EXIT_LOG(%d, ret_val);
463 return ret_val;
464 }
465 #endif
466
467 /*===========================================================================
468 FUNCTION loc_get_extension
469
470 DESCRIPTION
471 Get the gps extension to support XTRA.
472
473 DEPENDENCIES
474 N/A
475
476 RETURN VALUE
477 The GPS extension interface.
478
479 SIDE EFFECTS
480 N/A
481
482 ===========================================================================*/
loc_get_extension(const char * name)483 static const void* loc_get_extension(const char* name)
484 {
485 ENTRY_LOG();
486 const void* ret_val = NULL;
487
488 if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
489 {
490 ret_val = &sLocEngXTRAInterface;
491 }
492
493 else if (strcmp(name, AGPS_INTERFACE) == 0)
494 {
495 ret_val = &sLocEngAGpsInterface;
496 }
497
498 else if (strcmp(name, GPS_NI_INTERFACE) == 0)
499 {
500 ret_val = &sLocEngNiInterface;
501 }
502
503 else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
504 {
505 ret_val = &sLocEngAGpsRilInterface;
506 }
507 #ifdef QCOM_FEATURE_ULP
508 else if (strcmp(name, ULP_RAW_CMD_INTERFACE) == 0)
509 {
510 ret_val = &sLocEngInjectRawCmdInterface;
511 }
512 #endif
513 else
514 {
515 LOC_LOGE ("get_extension: Invalid interface passed in\n");
516 }
517
518 EXIT_LOG(%p, ret_val);
519 return ret_val;
520 }
521
522 /*===========================================================================
523 FUNCTION loc_agps_init
524
525 DESCRIPTION
526 Initialize the AGps interface.
527
528 DEPENDENCIES
529 NONE
530
531 RETURN VALUE
532 0
533
534 SIDE EFFECTS
535 N/A
536
537 ===========================================================================*/
loc_agps_init(AGpsCallbacks * callbacks)538 static void loc_agps_init(AGpsCallbacks* callbacks)
539 {
540 ENTRY_LOG();
541 loc_eng_agps_init(loc_afw_data, callbacks);
542 EXIT_LOG(%s, VOID_RET);
543 }
544
545 /*===========================================================================
546 FUNCTION loc_agps_open
547
548 DESCRIPTION
549 This function is called when on-demand data connection opening is successful.
550 It should inform ARM 9 about the data open result.
551
552 DEPENDENCIES
553 NONE
554
555 RETURN VALUE
556 0
557
558 SIDE EFFECTS
559 N/A
560
561 ===========================================================================*/
562 #ifdef QCOM_FEATURE_IPV6
loc_agps_open(AGpsType agpsType,const char * apn,AGpsBearerType bearerType)563 static int loc_agps_open(AGpsType agpsType,
564 const char* apn, AGpsBearerType bearerType)
565 {
566 ENTRY_LOG();
567 int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
568
569 EXIT_LOG(%d, ret_val);
570 return ret_val;
571 }
572 #else
loc_agps_open(const char * apn)573 static int loc_agps_open(const char* apn)
574 {
575 ENTRY_LOG();
576 int ret_val = loc_eng_agps_open(loc_afw_data, apn);
577
578 EXIT_LOG(%d, ret_val);
579 return ret_val;
580 }
581 #endif
582
583 /*===========================================================================
584 FUNCTION loc_agps_closed
585
586 DESCRIPTION
587 This function is called when on-demand data connection closing is done.
588 It should inform ARM 9 about the data close result.
589
590 DEPENDENCIES
591 NONE
592
593 RETURN VALUE
594 0
595
596 SIDE EFFECTS
597 N/A
598
599 ===========================================================================*/
600 #ifdef QCOM_FEATURE_IPV6
loc_agps_closed(AGpsType agpsType)601 static int loc_agps_closed(AGpsType agpsType)
602 {
603 ENTRY_LOG();
604 int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType);
605
606 EXIT_LOG(%d, ret_val);
607 return ret_val;
608 }
609 #else
loc_agps_closed()610 static int loc_agps_closed()
611 {
612 ENTRY_LOG();
613 int ret_val = loc_eng_agps_closed(loc_afw_data);
614
615 EXIT_LOG(%d, ret_val);
616 return ret_val;
617 }
618 #endif
619
620 /*===========================================================================
621 FUNCTION loc_agps_open_failed
622
623 DESCRIPTION
624 This function is called when on-demand data connection opening has failed.
625 It should inform ARM 9 about the data open result.
626
627 DEPENDENCIES
628 NONE
629
630 RETURN VALUE
631 0
632
633 SIDE EFFECTS
634 N/A
635
636 ===========================================================================*/
637 #ifdef QCOM_FEATURE_IPV6
loc_agps_open_failed(AGpsType agpsType)638 int loc_agps_open_failed(AGpsType agpsType)
639 {
640 ENTRY_LOG();
641 int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType);
642
643 EXIT_LOG(%d, ret_val);
644 return ret_val;
645 }
646 #else
loc_agps_open_failed()647 int loc_agps_open_failed()
648 {
649 ENTRY_LOG();
650 int ret_val = loc_eng_agps_open_failed(loc_afw_data);
651
652 EXIT_LOG(%d, ret_val);
653 return ret_val;
654 }
655 #endif
656
657 /*===========================================================================
658 FUNCTION loc_agps_set_server
659
660 DESCRIPTION
661 If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
662 proxy buffers server settings and calls loc_eng_set_server when the client is
663 open.
664
665 DEPENDENCIES
666 NONE
667
668 RETURN VALUE
669 0
670
671 SIDE EFFECTS
672 N/A
673
674 ===========================================================================*/
loc_agps_set_server(AGpsType type,const char * hostname,int port)675 static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
676 {
677 ENTRY_LOG();
678 LocServerType serverType;
679 switch (type) {
680 case AGPS_TYPE_SUPL:
681 serverType = LOC_AGPS_SUPL_SERVER;
682 break;
683 case AGPS_TYPE_C2K:
684 serverType = LOC_AGPS_CDMA_PDE_SERVER;
685 break;
686 }
687 int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port);
688
689 EXIT_LOG(%d, ret_val);
690 return ret_val;
691 }
692
693 /*===========================================================================
694 FUNCTION loc_xtra_init
695
696 DESCRIPTION
697 Initialize XTRA module.
698
699 DEPENDENCIES
700 None
701
702 RETURN VALUE
703 0: success
704
705 SIDE EFFECTS
706 N/A
707
708 ===========================================================================*/
loc_xtra_init(GpsXtraCallbacks * callbacks)709 static int loc_xtra_init(GpsXtraCallbacks* callbacks)
710 {
711 ENTRY_LOG();
712 int ret_val = loc_eng_xtra_init(loc_afw_data, callbacks);
713
714 EXIT_LOG(%d, ret_val);
715 return ret_val;
716 }
717
718
719 /*===========================================================================
720 FUNCTION loc_xtra_inject_data
721
722 DESCRIPTION
723 Initialize XTRA module.
724
725 DEPENDENCIES
726 None
727
728 RETURN VALUE
729 0: success
730
731 SIDE EFFECTS
732 N/A
733
734 ===========================================================================*/
loc_xtra_inject_data(char * data,int length)735 static int loc_xtra_inject_data(char* data, int length)
736 {
737 ENTRY_LOG();
738 int ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length);
739
740 EXIT_LOG(%d, ret_val);
741 return ret_val;
742 }
743
744 /*===========================================================================
745 FUNCTION loc_ni_init
746
747 DESCRIPTION
748 This function initializes the NI interface
749
750 DEPENDENCIES
751 NONE
752
753 RETURN VALUE
754 None
755
756 SIDE EFFECTS
757 N/A
758
759 ===========================================================================*/
loc_ni_init(GpsNiCallbacks * callbacks)760 void loc_ni_init(GpsNiCallbacks *callbacks)
761 {
762 ENTRY_LOG();
763 loc_eng_ni_init(loc_afw_data, callbacks);
764 EXIT_LOG(%s, VOID_RET);
765 }
766
767 /*===========================================================================
768 FUNCTION loc_ni_respond
769
770 DESCRIPTION
771 This function sends an NI respond to the modem processor
772
773 DEPENDENCIES
774 NONE
775
776 RETURN VALUE
777 None
778
779 SIDE EFFECTS
780 N/A
781
782 ===========================================================================*/
loc_ni_respond(int notif_id,GpsUserResponseType user_response)783 void loc_ni_respond(int notif_id, GpsUserResponseType user_response)
784 {
785 ENTRY_LOG();
786 loc_eng_ni_respond(loc_afw_data, notif_id, user_response);
787 EXIT_LOG(%s, VOID_RET);
788 }
789
790 // Below stub functions are members of sLocEngAGpsRilInterface
loc_agps_ril_init(AGpsRilCallbacks * callbacks)791 static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {}
loc_agps_ril_set_ref_location(const AGpsRefLocation * agps_reflocation,size_t sz_struct)792 static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {}
loc_agps_ril_set_set_id(AGpsSetIDType type,const char * setid)793 static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid) {}
loc_agps_ril_ni_message(uint8_t * msg,size_t len)794 static void loc_agps_ril_ni_message(uint8_t *msg, size_t len) {}
loc_agps_ril_update_network_state(int connected,int type,int roaming,const char * extra_info)795 static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info) {}
796
797 /*===========================================================================
798 FUNCTION loc_agps_ril_update_network_availability
799
800 DESCRIPTION
801 Sets data call allow vs disallow flag to modem
802 This is the only member of sLocEngAGpsRilInterface implemented.
803
804 DEPENDENCIES
805 None
806
807 RETURN VALUE
808 0: success
809
810 SIDE EFFECTS
811 N/A
812
813 ===========================================================================*/
loc_agps_ril_update_network_availability(int available,const char * apn)814 static void loc_agps_ril_update_network_availability(int available, const char* apn)
815 {
816 ENTRY_LOG();
817 loc_eng_agps_ril_update_network_availability(loc_afw_data, available, apn);
818 EXIT_LOG(%s, VOID_RET);
819 }
820
821 #ifdef QCOM_FEATURE_ULP
822 /*===========================================================================
823 FUNCTION loc_inject_raw_command
824
825 DESCRIPTION
826 This is used to send special test modem commands from the applications
827 down into the HAL
828 DEPENDENCIES
829 N/A
830
831 RETURN VALUE
832 0: success
833
834 SIDE EFFECTS
835 N/A
836
837 ===========================================================================*/
loc_inject_raw_command(char * command,int length)838 static bool loc_inject_raw_command(char* command, int length)
839 {
840 ENTRY_LOG();
841 int ret_val = loc_eng_inject_raw_command(loc_afw_data, command, length);
842 EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
843 return ret_val;
844 }
845 #endif
846
847
loc_cb(GpsLocation * location,void * locExt)848 static void loc_cb(GpsLocation* location, void* locExt)
849 {
850 ENTRY_LOG();
851 if (NULL != gps_loc_cb && NULL != location) {
852 #ifdef QCOM_FEATURE_ULP
853 CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
854 #else
855 CALLBACK_LOG_CALLFLOW("location_cb - at", %llu, location->timestamp);
856 #endif
857 gps_loc_cb(location);
858 }
859 EXIT_LOG(%s, VOID_RET);
860 }
861
sv_cb(GpsSvStatus * sv_status,void * svExt)862 static void sv_cb(GpsSvStatus* sv_status, void* svExt)
863 {
864 ENTRY_LOG();
865 if (NULL != gps_sv_cb) {
866 CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs);
867 gps_sv_cb(sv_status);
868 }
869 EXIT_LOG(%s, VOID_RET);
870 }
871