Initialize Tizen 2.3
[framework/telephony/libslp-tapi.git] / wearable / test_src / gps.c
1 /*
2  * Telephony test application
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <sys/time.h>
25 #include <unistd.h>
26 #include <glib.h>
27
28 #include <tapi_common.h>
29 #include <ITapiGps.h>
30
31 //#include <TelGps.h>
32 #include <TapiUtility.h>
33
34 #include "menu.h"
35 #include "gps.h"
36
37 /*                                    GPS Chipset on AP - START                                      */
38 //GPS CP MO Location
39
40 /* MOLR Type */
41 typedef enum {
42         TAPI_GPS_MOLR_INVALID,
43         TAPI_GPS_MOLR_LOCATION_ESTIMATE,
44         TAPI_GPS_MOLR_ASSISTANCE_DATA,
45         TAPI_GPS_MOLR_DECIPHERING_KEY
46 } tapi_gps_molr_e_type;
47
48 /* Response Time Type */
49 typedef enum {
50         TAPI_GPS_RESPONSE_TIME_INVALID,
51         TAPI_GPS_RESPONSE_TIME_LOW_DELAY,
52         TAPI_GPS_RESPONSE_TIME_DELAY_TOLERANT
53 } tapi_gps_response_time;
54
55 /* Location Method Type */
56 typedef enum {
57         TAPI_GPS_LOCATION_METHOD_INVALID,
58         TAPI_GPS_LOCATION_METHOD_MSBASED_EOTD,
59         TAPI_GPS_LOCATION_METHOD_MSASSISTED_EOTD,
60         TAPI_GPS_LOCATION_METHOD_ASSISTED_GPS
61 } tapi_gps_location_method_e_type;
62
63 /* GAD Shape Type */
64 typedef enum {
65         TAPI_GPS_SHAPE_ELLIPSOIDPOINT,
66         TAPI_GPS_SHAPE_ELLIPSOIDPOINT_WITH_UNCERTAINTY_CIRCLE,
67         TAPI_GPS_SHAPE_ELLIPSOIDPOINT_WITH_UNCERTAINTY_ELLIPSE,
68         TAPI_GPS_SHAPE_POLYGON,
69         TAPI_GPS_SHAPE_ELLIPSOIDPOINT_WITH_ALTITUDE,
70         TAPI_GPS_SHAPE_ELLIPSOIDPOINT_WITH_ALTITUDE_AND_UNCERTAINTYELI,
71         TAPI_GPS_SHAPE_ELLIPSOIDPOINT_ARC
72 } tapi_gps_gad_shape_e_type;
73
74 /* GPS Assistance Data Flags */
75 #define GPS_ASSISTANCE_NONE                     0x00000000
76 #define GPS_ASSISTANCE_ALMANAC                  0x00000001
77 #define GPS_ASSISTANCE_UTC_MODEL                0x00000002
78 #define GPS_ASSISTANCE_IONO_MODEL               0x00000004
79 #define GPS_ASSISTANCE_NAVI_MODEL               0x00000008
80 #define GPS_ASSISTANCE_DGPS_CORRECTION          0x00000010
81 #define GPS_ASSISTANCE_REF_LOCATION             0x00000020
82 #define GPS_ASSISTANCE_REF_TIME                 0x00000040
83 #define GPS_ASSISTANCE_ACQUISITION_ASSISTANCE   0x00000080
84 #define GPS_ASSISTANCE_REAL_TIME_INTEGRITY      0x00000100
85
86 //GPS Assist Data Message
87
88 /* GPS Crrier Type */
89 typedef enum {
90         TAPI_GPS_CARRIER_INVALID,
91         TAPI_GPS_CARRIER_GSM,
92         TAPI_GPS_CARRIER_UMTS
93 } tapi_gps_carrier_e_type;
94
95 /* Utran Sfn Uncertainty */
96 typedef enum {
97         TAPI_GPS_UTRAN_SFN_UNCERTAINTY_INVALID,
98         TAPI_GPS_UTRAN_SFN_UNCERTAINTY_LESSTHAN_10,
99         TAPI_GPS_UTRAN_SFN_UNCERTAINTY_MORETHAN_10
100 } tapi_gps_sfn_unc_e_type;
101
102 /* UTRAN Choice mode Type */
103 typedef enum {
104         TAPI_GPS_UTRAN_CHOICE_INVALID,
105         TAPI_GPS_UTRAN_CHOICE_FDD,
106         TAPI_GPS_UTRAN_CHOICE_TDD
107 } tapi_gps_utrn_choice_mode_e_type;
108
109 /* DGPS Status Type */
110 typedef enum {
111         TAPI_GPS_DGPS_INVALID,
112         TAPI_GPS_DGPS_UDRE_SCALE_1_0,
113         TAPI_GPS_DGPS_UDRE_SCALE_0_75,
114         TAPI_GPS_DGPS_UDRE_SCALE_0_5,
115         TAPI_GPS_DGPS_UDRE_SCALE_0_3,
116         TAPI_GPS_DGPS_UDRE_SCALE_0_2,
117         TAPI_GPS_DGPS_UDRE_SCALE_0_1,
118         TAPI_GPS_DGPS_NO_DATA
119 } tapi_gps_dgps_status_e_type;
120
121 /* Navigation Satellite Status Type*/
122 typedef enum {
123         TAPI_GPS_NAVIGATION_MODEL_NEW_SATELLITE_NEW_NAVIGATION,
124         TAPI_GPS_NAVIGATION_MODEL_EXIST_SATELLITE_EXIST_NAVIGATION,
125         TAPI_GPS_NAVIGATION_MODEL_EXIST_SATELLITE_NEW_NAVIGATION,
126         TAPI_GPS_NAVIGATION_MODEL_RESERVED
127 } tapi_gps_navigation_sat_status_e_type;
128
129 //GPS Measure Position Message
130 /* Method Type */
131 typedef enum {
132         TAPI_GPS_METHODTYPE_INVALID,
133         TAPI_GPS_METHODTYPE_MS_ASSISTED,
134         TAPI_GPS_METHODTYPE_MS_BASED,
135         TAPI_GPS_METHODTYPE_MS_BASED_PREF,
136         TAPI_GPS_METHODTYPE_MS_ASSISTED_PREF
137 } tapi_gps_method_e_type;
138
139 /* Use Multiple Sets Type */
140 typedef enum {
141         TAPI_GPS_MULTIPLESETS_INVALID,
142         TAPI_GPS_MULTIPLESETS_MULTIPLESETS,
143         TAPI_GPS_MULTIPLESETS_ONESET
144 } tapi_gps_use_multi_sets_e_type;
145
146 /* Environment Char Type */
147 typedef enum {
148         TAPI_GPS_ENVIRONMENT_INVALID,
149         TAPI_GPS_ENVIRONMENT_BAD_AREA,
150         TAPI_GPS_ENVIRONMENT_NOT_BAD_AREA,
151         TAPI_GPS_ENVIRONMENT_MIXED_AREA
152 } tapi_gps_env_char_e_type;
153
154 /* Cell Timing Wanted Type */
155 typedef enum {
156         TAPI_GPS_CELLTIMING_INVALID,
157         TAPI_GPS_CELLTIMING_WANTED,
158         TAPI_GPS_CELLTIMING_NOT_WANTED
159 } tapi_gps_cell_timing_wnt_e_type;
160
161 /* Additional Assist Request Type */
162 typedef enum {
163         TAPI_GPS_ADDITIONAL_ASSISREQ_INVALID,
164         TAPI_GPS_ADDITIONAL_ASSISREQ_REQ,
165         TAPI_GPS_ADDITIONAL_ASSISREQ_NOT_REQ
166 } tapi_gps_add_assit_req_e_type;
167
168 /* Measure Position Response Type */
169 typedef enum {
170         TAPI_GPS_MSR_POS_RES_LOCATION,
171         TAPI_GPS_MSR_POS_RES_GPS_MEASUREMENTS,
172         TAPI_GPS_MSR_POS_RES_AID_REQ,
173         TAPI_GPS_MSR_POS_RES_ERROR
174 } tapi_gps_msr_pos_res_e_type;
175
176 /* GPS element multi path Type */
177 typedef enum {
178         TAPI_GPS_MULTIPATH_NOT_MEASURED,
179         TAPI_GPS_MULTIPATH_LOW,
180         TAPI_GPS_MULTIPATH_MEDIUM,
181         TAPI_GPS_MULTIPATH_HIGH
182 }tapi_gps_multi_path_e_type;
183
184 /* Accuracy Flag Value */
185 #define QOS_PRESENT_HORIZONTAL_ACCURACY 0x01
186 #define QOS_PRESENT_VERTICAL_ACCURACY   0x02
187
188 //GPS MTLR Notification Message
189 /* MTLR Notification Type */
190 typedef enum {
191         TAPI_GPS_NO_NOTIFY_NO_VERIFY,
192         TAPI_GPS_USER_NOTIFY_ONLY,     /* Location Notification Allowed */
193         TAPI_GPS_USER_NOTIFY_VERIFY_ALLOW_NO_RESP, /* notify and verify, if no response, Location Notification Allowed */
194         TAPI_GPS_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP, /* notify and verify, if no response, Location Notification Not Allowed */
195         TAPI_GPS_PRIVACY_NEEDED,
196         TAPI_GPS_PRIVACY_OVERRIDE
197 } tapi_gps_mtlr_notify_e_type;
198
199 /* location estimate Type */
200 typedef enum {
201         TAPI_GPS_ESTIMATE_TYPE_CURRENT_LOCATION,        ///< Current Location
202         TAPI_GPS_ESTIMATE_TYPE_CURRENT_OR_LAST_KNOWN_LOCATION,  ///< Current or Last Known Location
203         TAPI_GPS_ESTIMATE_TYPE_INITIAL_LOCATION,                ///< Initial Location
204         TAPI_GPS_ESTIMATE_TYPE_ACTIVATE_DEFERRED_LOC,   ///< Activate Deferred Location
205         TAPI_GPS_ESTIMATE_TYPE_CANCEL_DEFERRED_LOC,     ///< Cancel Deferred Location
206         TAPI_GPS_ESTIMATE_TYPE_NOTIFY_VERIFY_ONLY,              ///< Notification and Verification Only
207         TAPI_GPS_ESTIMATE_TYPE_INVALID
208 } tapi_gps_loc_estimate_e_type;
209
210 /* ID Format Type */
211 typedef enum {
212         TAPI_GPS_FORMAT_IND_LOGICAL_NAME,
213         TAPI_GPS_FORMAT_IND_EMAIL_ADDRESS,
214         TAPI_GPS_FORMAT_IND_MSISDN,
215         TAPI_GPS_FORMAT_IND_URL,
216         TAPI_GPS_FORMAT_IND_SIPURL,
217         TAPI_GPS_FORMAT_IND_IMS_PUBLIC_ID
218 } tapi_gps_format_ind_e_type;
219
220 /* Verify Response Type */
221 typedef enum {
222         TAPI_GPS_VERIFY_RSP_TYPE_DENIED,
223         TAPI_GPS_VERIFY_RSP_TYPE_GRANTED,
224         TAPI_GPS_VERIFY_RSP_TYPE_INVALID
225 } tapi_gps_verify_rsp_e_type;
226
227 typedef enum {
228         TAPI_GPS_FREQ_AIDING_DISABLE = 0,
229         TAPI_GPS_FREQ_AIDING_ENABLE,
230 } tapi_gps_freq_aiding_e_type;
231
232 /*                                     GPS Chipset on AP - END                                       */
233
234
235 /*                                    GPS Chipset on AP - START                                      */
236 typedef struct {
237         unsigned long int qosFlag;
238         unsigned char horizontalAccuracy;
239         unsigned char verticalCoordinateRequest;
240         unsigned char verticalAccuracy;
241         unsigned char responseTime; //0x01:low delay, 0x02: delay tolerant
242 }__attribute__ ((packed)) tapi_gps_qos_t;
243
244 typedef struct {
245         unsigned char sat_id;
246         unsigned char iode;
247 }__attribute__ ((packed)) tapi_gps_sat_info_t;
248
249 typedef struct {
250         unsigned char beginWeek;
251         unsigned char endWeek;
252         unsigned char beginTow;
253         unsigned char endTow;
254 }__attribute__ ((packed)) tapi_gps_ext_ephe_chk_t;
255
256 typedef struct {
257         unsigned long int assistanceFlag;
258         unsigned short gpsWeek;
259         unsigned char gpsToe;
260         unsigned char nSat;
261         unsigned char toeLimit;
262         tapi_gps_sat_info_t satInfo[15];
263         unsigned char gpsExtendedEphemeris;
264         tapi_gps_ext_ephe_chk_t extEphemerisChk;
265 }__attribute__ ((packed)) tapi_gps_assistance_data_t;
266
267 typedef struct {
268         tapi_gps_molr_e_type molr_type;
269         tapi_gps_location_method_e_type location_method;
270         tapi_gps_qos_t qos;
271         unsigned char client_id[82];
272         unsigned char mlc_num[82];
273         tapi_gps_assistance_data_t assistance_data;
274         tapi_gps_gad_shape_e_type gad_shape;
275         unsigned char serviceTypeID;
276         unsigned char pseudonymIndicator;
277 }__attribute__ ((packed)) tapi_gps_cp_mo_loc_set_t; //APGPS - Control Plane Mo Location - Set
278
279 //Measure Position message
280 typedef struct {
281         unsigned char satId; //Satellite ID
282         unsigned char cno; // 0~63, unit of dB-Hz
283         signed short doppler; // -32768~32767, Hz and scale factor 0.2
284         unsigned short wholeChips; // 0~1022
285         unsigned short fracChips; // 0~1024
286         unsigned char lcsMultiPath;
287         unsigned char pseuRangeRmsErr; // 0~63
288 }__attribute__ ((packed)) tapi_gps_measuremet_element_t;
289
290 typedef struct {
291         unsigned long int gpsTow; ///< GPS time of week [msec]
292         unsigned short gpsWeek; ///< GPS week [0 .. 1023]
293         unsigned char nrOfSats; ///< number of satellites [1 .. 16]
294         tapi_gps_measuremet_element_t GpsMeasure[16];
295 }__attribute__ ((packed)) tapi_gps_measure_t;
296
297 typedef struct {
298         signed long int latitude;
299         signed long int longitude;
300 }__attribute__ ((packed)) tapi_gps_ellipsoid_po_t;
301
302 typedef struct {
303         tapi_gps_ellipsoid_po_t point;
304         unsigned char uncertainRadius;
305 }__attribute__ ((packed)) tapi_gps_po_unc_circle_t;
306
307 typedef struct {
308         tapi_gps_ellipsoid_po_t point;
309         unsigned char semiMajorAxis;
310         unsigned char semiMinorAxis;
311         unsigned char orientationAngle;
312         unsigned char confidence;
313 }__attribute__ ((packed)) tapi_gps_po_unc_ellipse_t;
314
315 typedef struct {
316         tapi_gps_ellipsoid_po_t point;
317         signed short altitude;
318         unsigned char semiMajorAxis;
319         unsigned char semiMinorAxis;
320         unsigned char orientationAngle;
321         unsigned char uncertainAltitude;
322         unsigned char confidence;
323 }__attribute__ ((packed)) tapi_gps_po_alt_unc_ellipse_t;
324
325 typedef struct {
326         tapi_gps_ellipsoid_po_t point;
327         unsigned short innerRadius;
328         unsigned char uncertainRadius;
329         unsigned char offsetAngle;
330         unsigned char includedAngle;
331         unsigned char confidence;
332 }__attribute__ ((packed)) tapi_gps_ellipsoid_arc_t;
333
334 typedef struct {
335         tapi_gps_ellipsoid_po_t point;
336         signed short altitude;
337 }__attribute__ ((packed)) tapi_gps_ellipsoid_alt_t;
338
339 typedef struct {
340         unsigned char noOfPoints;
341         tapi_gps_ellipsoid_po_t points[15];
342 }__attribute__ ((packed)) tapi_gps_polygon_t;
343
344 typedef struct {
345         unsigned char shape_type;
346         tapi_gps_po_unc_circle_t p_unc_clrcle;
347         tapi_gps_po_unc_ellipse_t p_unc_ellipse;
348         tapi_gps_po_alt_unc_ellipse_t p_alt_unc_ellipse;
349         tapi_gps_ellipsoid_arc_t ellipsoid_arc;
350         tapi_gps_ellipsoid_po_t ellipsoid_po;
351         tapi_gps_ellipsoid_alt_t ellipsoid_alt;
352         tapi_gps_polygon_t polygon;
353 }__attribute__ ((packed)) tapi_gps_loc_info_t;
354
355 typedef struct {
356         unsigned long int gpsTow; ///< GPS time of week [msec]
357         unsigned short gpsWeek; ///< GPS week [0 .. 1023]
358         unsigned char fixType; ///< Fix type. 2D(0x01) or 3D(0x02)
359         tapi_gps_loc_info_t measured_loc_info;
360 }__attribute__ ((packed)) tapi_gps_measure_loc_info_t;
361
362 typedef struct {
363         unsigned char valid;
364         unsigned long int cellFrames;
365         unsigned char choice_mode;
366         unsigned long int UtranFdd; //FDD Primary Scrambling Code
367         unsigned long int UtranTdd; // TDD Cell Parameter ID
368         unsigned long int sfn; //SFN
369 }__attribute__ ((packed)) tapi_gps_utran_gps_ref_time_t;
370
371 typedef struct {
372         unsigned char result; // 0x00 : SUCCESS, 0x01 : Fail
373         tapi_gps_msr_pos_res_e_type response_type; //should be 4 byte
374         tapi_gps_measure_t gps_measure;
375         tapi_gps_measure_loc_info_t loc_info;
376         tapi_gps_assistance_data_t measured_assit_data;
377         tapi_gps_utran_gps_ref_time_t UtranGpsRefTime; // only for 3G
378 }__attribute__ ((packed)) tapi_gps_measure_position_confirm_t; //APGPS - Measure Position message - confirm
379
380 typedef struct {
381         unsigned char reqId;
382         tapi_gps_verify_rsp_e_type response;
383 }__attribute__ ((packed)) tapi_gps_mtlr_notification_confirm_t; //AGPS - MTLR Notification message - confirm
384
385
386 //RX part
387 typedef struct {
388         unsigned short arfcn; //ARFCN of GSM network
389         unsigned char bsic; //Base Station Identity Code
390         unsigned char rx_lev; // RX signal level
391         unsigned char ta; //Timing Advance
392 }__attribute__ ((packed)) tapi_gps_gsm_extended_radio_signal_info_t; //APGPS - GSM Extended Radio Signal Info - Resp
393
394 typedef struct {
395         unsigned long int flag;
396         unsigned char horizontalAccuracy;
397         unsigned char vertcalAccuracy;
398 }__attribute__ ((packed)) tapi_gps_accuracy_t;
399
400 typedef struct {
401         unsigned char method_type;
402         tapi_gps_accuracy_t accuracy;
403         unsigned char rsp_time;
404         unsigned char use_multi_sets;
405         unsigned char environment_char;
406         unsigned char cell_timing_wnt;
407         unsigned char add_assist_req;
408 }__attribute__ ((packed)) tapi_gps_measure_position_indi_t; //APGPS - Measure Position message -indication
409
410 typedef struct {
411         unsigned short deferredLocEventType;
412         tapi_gps_mtlr_notify_e_type locEstimateType;
413 }__attribute__ ((packed)) tapi_gps_mtlr_loc_t;
414
415 typedef struct {
416         unsigned long int length; //Length of APDU
417         unsigned char val[63]; //APDU data
418 }__attribute__ ((packed)) tapi_gps_string_t;
419
420 typedef struct {
421         unsigned char dcs;
422         tapi_gps_string_t str;
423         tapi_gps_format_ind_e_type format_indicator;
424 }__attribute__ ((packed)) tapi_gps_dcs_string_t;
425
426 typedef struct {
427         unsigned char dcs;
428         tapi_gps_string_t str;
429 }__attribute__ ((packed)) tapi_gps_code_word_t;
430
431 typedef struct {
432         unsigned char req_id;
433         tapi_gps_mtlr_notify_e_type notify_type;
434         tapi_gps_mtlr_loc_t loc;
435         unsigned char client_id[82];
436         tapi_gps_dcs_string_t client_name;
437         tapi_gps_dcs_string_t requestor_id;
438         tapi_gps_code_word_t code_word;
439         unsigned char svc_type_id;
440 }__attribute__ ((packed)) tapi_gps_mtlr_notification_indi_t; //AGPS - MTLR Notification message - Indication
441
442 typedef struct {
443         unsigned char cipherKeyFlag;
444         unsigned char currentDecipherKey[7];
445         unsigned char nextDecipherKey[7];
446 }__attribute__ ((packed)) tapi_gps_deciphering_keys_t;
447
448 typedef struct {
449         tapi_gps_loc_info_t loc_info;
450         unsigned char no_loc;
451         tapi_gps_deciphering_keys_t decper_keys;
452 }__attribute__ ((packed)) tapi_gps_cp_mo_loc_noti_t; //APGPS - Control Plane Mo Location - Notification
453
454 typedef struct {
455         unsigned char valid;
456         unsigned short bcchCarrier;
457         unsigned short bsic;
458         unsigned long int frameNumber;
459         unsigned short timeSlot;
460         unsigned short bitNumber;
461 }__attribute__ ((packed)) tapi_gps_gsm_time_t;
462
463 typedef struct {
464         unsigned char valid;
465         unsigned long int gpsTimeUncertainty;
466 }__attribute__ ((packed)) tapi_gps_utran_gps_unc_t;
467
468 typedef struct {
469         unsigned char valid;
470         signed long int driftRate;
471 }__attribute__ ((packed)) tapi_gps_drift_rate_t;
472
473 typedef struct {
474         tapi_gps_utran_gps_ref_time_t UtranGpsRefTime;
475         tapi_gps_utran_gps_unc_t UtranGpsUncertainty;
476         unsigned char UtranSfnUncertainty;
477         tapi_gps_drift_rate_t UtranDriftRate;
478 }__attribute__ ((packed)) tapi_gps_utran_time_t;
479
480 typedef struct {
481         unsigned short satID;
482         unsigned short tlmWord;
483         unsigned char antiSpoofFlag;
484         unsigned char alertFlag;
485         unsigned char tmlReservedBits;
486 }__attribute__ ((packed)) tapi_gps_gps_tow_assist_t;
487
488 typedef struct {
489         unsigned long int gpsTow;
490         unsigned long int gpsWeek;
491         unsigned char nrOfSats;
492         union {
493                 tapi_gps_gsm_time_t gsm_time;
494                 tapi_gps_utran_time_t UtranTime;
495         } networkTimeInfo;
496         tapi_gps_gps_tow_assist_t GpsTowAssist[12];
497 }__attribute__ ((packed)) tapi_gps_ref_time_t;
498
499 typedef struct {
500         unsigned char shapeType;
501         unsigned char hemisphere;
502         unsigned short altitude;
503         unsigned long int latitude;
504         signed long int longitude;
505         unsigned char directionOfAlt;
506         unsigned char semiMajorUncert;
507         unsigned char semiMinorUncert;
508         unsigned char majorAxis;
509         unsigned char altUncert;
510         unsigned char confidence;
511 }__attribute__ ((packed)) tapi_gps_ref_loc_t;
512
513 typedef struct {
514         unsigned char satId; //Satellite ID
515         unsigned short iode;
516         unsigned char udre;
517         signed short pseudoRangeCor;
518         signed short rangeRateCor;
519 }__attribute__ ((packed)) tapi_gps_dgps_sat_list_t;
520
521 typedef struct {
522         unsigned long int gpsTow;
523         unsigned char status;
524         unsigned long int numberOfSat;
525         tapi_gps_dgps_sat_list_t seqOfSatElement[16];
526 }__attribute__ ((packed)) tapi_gps_dgps_correction_t;
527
528 typedef struct {
529         unsigned long int rsv1; // 0~838860
530         unsigned long int rsv2; // 0~16777215
531         unsigned long int rsv3; // 0~16777215
532         unsigned long int rsv4; // 0~65535
533 }__attribute__ ((packed)) tapi_gps_navi_subframe_rsv_t;
534
535 typedef struct {
536         unsigned char ephemCodeOnL2; // 0~3
537         unsigned char ephemUra; // 0~15
538         unsigned char ephemSvHealth; // 0~63
539         unsigned short ephemIodc; // 0~1023
540         unsigned char ephemL2PFlag; // 0~1
541         tapi_gps_navi_subframe_rsv_t NavigationSubFrameRsv;
542         signed char ephemTgd; // -128~127
543         unsigned short ephemToc; // 0~37799
544         signed char ephemAf2; // -128~12
545         signed short ephemAf1; // -32768~32767
546         signed long int ephemAf0; // -2097152~2097151
547         signed short ephemCrs; // -32768~32767
548         signed short ephemDeltaN; // -32768~32767
549         signed long int ephemM0; // -2147483648~2147483647
550         signed short ephemCuc; // -32768~32767
551         unsigned long int ephemE; // 0~4294967295
552         signed short ephemCus; // -32768~32767
553         unsigned long int ephemAPowrHalf; // 0~4294967295
554         unsigned short ephemToe; // 0~37799
555         signed char ephemFitFlag; // 0~1
556         unsigned char ephemAoda; // 0~31
557         signed short ephemCic; // -32768~32767
558         signed long int ephemOmegaA0; // -2147483648~2147483647
559         signed short ephemCis; // -32768~32767
560         signed long int ephemI0; // -2147483648~2147483647
561         signed short ephemCrc; // -32768~32767
562         signed long int ephemW; // -2147483648~2147483647
563         signed long int ephemOmegaADot; // -8388608~8388607
564         signed short ephemIDot; // -8192~8191
565 }__attribute__ ((packed)) tapi_gps_navi_ephe_t;
566
567 typedef struct {
568         unsigned char satId;
569         unsigned char NavigationSatStatus;
570         tapi_gps_navi_ephe_t NavigationEphemeris;
571 }__attribute__ ((packed)) tapi_gps_navi_sat_info_t;
572
573 typedef struct {
574         unsigned long int numberOfSat;
575         tapi_gps_navi_sat_info_t NavigationSatInfo[16];
576 }__attribute__ ((packed)) tapi_gps_navi_model_t;
577
578 typedef struct {
579         signed char alfa0; // -128~127
580         signed char alfa1; // -128~127
581         signed char alfa2; // -128~127
582         signed char alfa3; // -128~127
583         signed char beta0; // -128~127
584         signed char beta1; // -128~127
585         signed char beta2; // -128~127
586         signed char beta3; // -128~127
587 }__attribute__ ((packed)) tapi_gps_iono_model_t;
588
589 typedef struct {
590         signed long int utcA1; // -8388608~8388607
591         signed long int utcA0; // -2147483648~2147483647
592         unsigned char utcTot; // 0~255
593         unsigned char utcWNt; // 0~255
594         signed char utcDeltaTls; // -128~127
595         unsigned char utcWNlsf; // 0~255
596         signed char utcDN; // -128~127
597         signed char utcDeltaTlsf; // -128~127
598 }__attribute__ ((packed)) tapi_gps_utc_model_t;
599
600 typedef struct {
601         signed char dataId; // only for 3G, 0~3, if this value is -1, it means this value is invalid
602         unsigned char satId;
603         unsigned short almanacE; // 0~65536
604         unsigned char almanacToa; // 0~255
605         signed short almanacKsii; // -32768~3276
606         signed short almanacOmegaDot; // -32768~3276
607         unsigned char almanacSvHealth; // 0~255
608         unsigned long int almanacAPowerHalf; // 0~16777215
609         signed long int almanacOmega0; // -8388608~8388607
610         signed long int almanacW; // -8388608~8388607
611         signed long int almanacM0; // -8388608~8388607
612         signed short almanacAf0; // -1024~1023
613         signed short almanacAf1; // -1024~1023
614 }__attribute__ ((packed)) tapi_gps_almanac_sat_info_t;
615
616 typedef struct {
617         unsigned char almanacWNa; // 0~255
618         unsigned long int numberOfSat;
619         tapi_gps_almanac_sat_info_t AlmanacSatInfo[64];
620 }__attribute__ ((packed)) tapi_gps_almanac_model_t;
621
622 typedef struct {
623         tapi_gps_utran_gps_ref_time_t AcqUtranGpsRefTime;
624         tapi_gps_utran_gps_unc_t AcqUtranGpsUncertainty;
625 }__attribute__ ((packed)) tapi_gps_acq_utran_time_t;
626
627 typedef struct {
628         unsigned char satId;
629         signed short doppler0; // -2048~2047 (real value is from -5120 to 5117.5 by step of 2.5)
630         unsigned char doppler1; // 0~63 (real value is from -0.966 to 0.483 by step of 0.023)
631         unsigned char dopplerUncertainty; // 0~7 (12.5, 25, 50, 100, 200)
632         unsigned short codePhase; // 0~1022
633         unsigned char intCodePhase; // 0~19
634         unsigned char gpsBitNumber; // 0~3
635         unsigned char codePhaseSearchWindow; // 0~15 (1023, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192)
636         unsigned char azimuth; // 0~31, 11.25 degree resolution
637         unsigned char elevation; // 0~7, 11.25 degree resolution
638 }__attribute__ ((packed)) tapi_gps_acq_sat_info_t;
639
640 typedef struct {
641         unsigned long int gpsTow;
642         union {
643                 tapi_gps_gsm_time_t gsm_time;
644                 tapi_gps_acq_utran_time_t AcqUtranTime;
645         } acquisitionTimeInfo;
646         unsigned long int numberOfSat;
647         tapi_gps_acq_sat_info_t lcsAcquisitionSatInfo[16];
648 }__attribute__ ((packed)) tapi_gps_acq_assist_t;
649
650 typedef struct {
651         unsigned char satId[16];
652         unsigned char numOfSat;
653 }__attribute__ ((packed)) tapi_gps_r_time_int_t;
654
655 typedef struct {
656         unsigned long int flag;
657 //      tapi_gps_carrier_e_type cr_type;
658         tapi_gps_ref_time_t ref_time;
659         tapi_gps_ref_loc_t ref_loc;
660         tapi_gps_dgps_correction_t dgps_corrections;
661         tapi_gps_navi_model_t navi_model;
662         tapi_gps_iono_model_t iono_model;
663         tapi_gps_utc_model_t utc_model;
664         tapi_gps_almanac_model_t almanac;
665         tapi_gps_acq_assist_t acq_assist;
666         tapi_gps_r_time_int_t r_time_int;
667 }__attribute__ ((packed)) tapi_gps_assist_data_noti_t; //APGPS -  GPS Assist Data Message - Notification
668
669 typedef struct {
670         unsigned char lock_status;
671         unsigned char afc_update;
672 }__attribute__ ((packed)) tapi_gps_frequency_aiding_noti_t;
673
674 /*                                     GPS Chipset on AP - END                                       */
675
676 static char data_gps_set_frequency_aiding[MENU_DATA_SIZE + 1] = "1";
677 static char data_smart_assistant_area_index[MENU_DATA_SIZE + 1] = "1";
678 static char data_smart_assistant_area_mode[MENU_DATA_SIZE + 1] = "1";
679
680 static void _gps_hex_dump(char *pad, int size, const void *data)
681 {
682         char buf[255] = {0, };
683         char hex[4] = {0, };
684         int i;
685         unsigned char *p;
686
687         if (size <= 0) {
688                 msg("%sno data", pad);
689                 return;
690         }
691         p = (unsigned char *)data;
692
693         snprintf(buf, 255, "%s%04X: ", pad, 0);
694         for (i = 0; i<size; i++) {
695                 snprintf(hex, 4, "%02X ", p[i]);
696                 strcat(buf, hex);
697
698                 if ((i + 1) % 8 == 0) {
699                         if ((i + 1) % 16 == 0) {
700                                 msg("%s", buf);
701                                 memset(buf, 0, 255);
702                                 snprintf(buf, 255, "%s%04X: ", pad, i + 1);
703                         }
704                         else {
705                                 strcat(buf, "  ");
706                         }
707                 }
708         }
709
710         msg("%s", buf);
711 }
712
713 static void _gps_print_dump(int data_len, void *data)
714 {
715         if(!data)
716                 return;
717
718         msg("");
719         msg("  \tlen=%d", data_len);
720         _gps_hex_dump("        ", data_len, data);
721
722         msg("");
723 }
724
725
726 /* Noti */
727 static void on_noti_assist_data(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
728 {
729         guchar *decoded_data = NULL;
730         gsize length;
731         tapi_gps_assist_data_noti_t *noti = NULL;
732
733         msg("");
734         msgb("event(%s) receive !!", TAPI_NOTI_GPS_ASSIST_DATA);
735         msg("data=%p", data);
736         if(!data)
737                 return;
738
739         msg(" ## Before decoding ##");
740         _gps_print_dump(strlen(data), data);
741
742         decoded_data = g_base64_decode((const gchar *)data, &length);
743         noti = (tapi_gps_assist_data_noti_t *)decoded_data;
744
745         msg(" ## After decoding ##");
746         _gps_print_dump(length, decoded_data);
747
748         msg(" - length = %d", length);
749         msg(" - flag = %ld", noti->flag);
750         g_free(decoded_data);
751 }
752
753 static void on_ind_measure_position(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
754 {
755         guchar *decoded_data = NULL;
756         gsize length;
757         tapi_gps_measure_position_indi_t *ind = NULL;
758
759         msg("");
760         msgb("event(%s) receive !!", TAPI_IND_GPS_MEASURE_POSITION);
761         msg("data=%p", data);
762         if(!data)
763                 return;
764
765         msg(" ## Before decoding ##");
766         _gps_print_dump(strlen(data), data);
767
768         decoded_data = g_base64_decode((const gchar *)data, &length);
769         ind = (tapi_gps_measure_position_indi_t *)decoded_data;
770
771         msg(" ## After decoding ##");
772         _gps_print_dump(length, decoded_data);
773
774         msg(" - length = %d", length);
775         msg(" - method_type = %d", ind->method_type);
776         msg(" - rsp_time = %d", ind->rsp_time);
777         msg(" - use_multi_sets = %d", ind->use_multi_sets);
778         msg(" - environment_char = %d", ind->environment_char);
779         msg(" - cell_timing_wnt = %d", ind->cell_timing_wnt);
780         msg(" - add_assist_req = %d", ind->add_assist_req);
781         g_free(decoded_data);
782 }
783
784 static void on_noti_reset_assist_data(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
785 {
786         msg("");
787         msgb("event(%s) receive !!", TAPI_NOTI_GPS_RESET_ASSIST_DATA);
788         msg("data=%p", data?data:0);
789 }
790
791 static void on_noti_frequency_aiding(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
792 {
793         tapi_gps_frequency_aiding_noti_t *noti = (tapi_gps_frequency_aiding_noti_t *)data;
794
795         msg("");
796         msgb("event(%s) receive !!", TAPI_NOTI_GPS_FREQUENCY_AIDING);
797         msg("data=%p", data);
798         if(!data)
799                 return;
800
801         msg(" - lock = %d", noti->lock_status);
802         msg(" - afc_update = %d", noti->afc_update);
803 }
804
805 static void on_noti_area_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
806 {
807         struct tel_noti_smart_assistant_area_status *noti = (struct tel_noti_smart_assistant_area_status *)data;
808
809         msg("");
810         msgb("event(%s) receive !!", TAPI_NOTI_SMART_ASSISTANT_AREA_STATUS);
811         msg("data=%p", data);
812         if(!data)
813                 return;
814
815         msg(" - area_status(1:IN, 2:OUT) = %d", noti->area_status);
816         msg(" - index = %d", noti->index);
817 }
818
819 static void on_noti_sync_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
820 {
821         struct tel_noti_smart_assistant_sync_status *noti = (struct tel_noti_smart_assistant_sync_status *)data;
822
823         msg("");
824         msgb("event(%s) receive !!", TAPI_NOTI_SMART_ASSISTANT_SYNC_STATUS);
825         msg("data=%p", data);
826         if(!data)
827                 return;
828
829         msg(" - init_status(1:Success, 2:Fail) = %d", noti->init_status);
830         msg(" - init_fail_cause = %d", noti->init_fail_cause);
831 }
832
833 /* Response */
834 static void on_gps_set_frequency_aiding(TapiHandle *handle, int result, void *data, void *user_data)
835 {
836         msg("");
837         msgb("tel_set_gps_frequency_aiding() response receive");
838         msg(" - result = 0x%x", result);
839 }
840
841 static void on_enable_smart_assistant(TapiHandle *handle, int result, void *data, void *user_data)
842 {
843         msg("");
844         msgb("tel_enable_smart_assistant() response receive");
845         msg(" - result = 0x%x", result);
846 }
847
848 static void on_disable_smart_assistant(TapiHandle *handle, int result, void *data, void *user_data)
849 {
850         msg("");
851         msgb("tel_disable_smart_assistant() response receive");
852         msg(" - result = 0x%x", result);
853 }
854
855 static void on_sync_smart_assistant_area_list(TapiHandle *handle, int result, void *data, void *user_data)
856 {
857         msg("");
858         msgb("tel_sync_smart_assistant_area_list() response receive");
859         msg(" - result = 0x%x", result);
860 }
861
862 static void on_del_smart_assistant_area_list(TapiHandle *handle, int result, void *data, void *user_data)
863 {
864         msg("");
865         msgb("tel_del_smart_assistant_area_list() response receive");
866         msg(" - result = 0x%x", result);
867 }
868
869 static void on_add_smart_assistant_area(TapiHandle *handle, int result, void *data, void *user_data)
870 {
871         msg("");
872         msgb("tel_add_smart_assistant_area() response receive");
873         msg(" - result = 0x%x", result);
874 }
875
876 static void on_modify_smart_assistant_area(TapiHandle *handle, int result, void *data, void *user_data)
877 {
878         msg("");
879         msgb("tel_set_gps_frequency_aiding() response receive");
880         msg(" - result = 0x%x", result);
881 }
882
883 static void on_set_smart_assistant_info(TapiHandle *handle, int result, void *data, void *user_data)
884 {
885         msg("");
886         msgb("tel_set_smart_assistant_info() response receive");
887         msg(" - result = 0x%x", result);
888 }
889
890
891 /* Request */
892 static int run_gps_set_frequency_aiding(MManager *mm, struct menu_data *menu)
893 {
894         TapiHandle *handle = menu_manager_ref_user_data(mm);
895         int result;
896         unsigned char state;
897         msg("call tel_set_gps_frequency_aiding()");
898
899         state = atoi(data_gps_set_frequency_aiding);
900
901         result = tel_set_gps_frequency_aiding(handle, state, on_gps_set_frequency_aiding, NULL);
902         if (result != TAPI_API_SUCCESS) {
903                 msg("failed. (result = %d)", result);
904         }
905         msg("exit");
906
907         return 0;
908 }
909
910 static int run_gps_confirm_measure_position(MManager *mm, struct menu_data *menu)
911 {
912         TapiHandle *handle = menu_manager_ref_user_data(mm);
913         int result;
914         tapi_gps_measure_position_confirm_t data;
915
916         msg("call tel_confirm_gps_measure_pos().");
917         _gps_print_dump(sizeof(tapi_gps_measure_position_confirm_t), &data);
918
919         result = tel_confirm_gps_measure_pos(handle, (unsigned char *)&data, sizeof(tapi_gps_measure_position_confirm_t));
920
921         if (result != TAPI_API_SUCCESS) {
922                 msg("failed. (result = %d)", result);
923         }
924         msg("exit");
925         return 0;
926 }
927
928 static int run_enable_smart_assistant(MManager *mm, struct menu_data *menu)
929 {
930         TapiHandle *handle = menu_manager_ref_user_data(mm);
931         int result;
932         msg("call tel_enable_smart_assistant()");
933
934         result = tel_enable_smart_assistant(handle, on_enable_smart_assistant, NULL);
935         if (result != TAPI_API_SUCCESS) {
936                 msg("failed. (result = %d)", result);
937         }
938         msg("exit");
939
940         return 0;
941 }
942
943 static int run_disable_smart_assistant(MManager *mm, struct menu_data *menu)
944 {
945         TapiHandle *handle = menu_manager_ref_user_data(mm);
946         int result;
947         msg("call tel_disable_smart_assistant()");
948
949         result = tel_disable_smart_assistant(handle, on_disable_smart_assistant, NULL);
950         if (result != TAPI_API_SUCCESS) {
951                 msg("failed. (result = %d)", result);
952         }
953         msg("exit");
954
955         return 0;
956 }
957 static int run_sync_smart_assistant_area_list(MManager *mm, struct menu_data *menu)
958 {
959         TapiHandle *handle = menu_manager_ref_user_data(mm);
960         TelSmartAssistantAreaList_t area_list;
961         int result;
962
963         memset(&area_list, 0, sizeof(TelSmartAssistantAreaList_t));
964
965         area_list.count = 3;
966         area_list.area[0].index = 1;
967         area_list.area[0].mode_state = TAPI_SMART_ASSISTANT_MODE_STATE_START;
968         area_list.area[1].index = 2;
969         area_list.area[1].mode_state = TAPI_SMART_ASSISTANT_MODE_STATE_STOP;
970         area_list.area[2].index = 3;
971         area_list.area[2].mode_state = TAPI_SMART_ASSISTANT_MODE_STATE_START;
972         msg("call tel_sync_smart_assistant_area_list()");
973
974         result = tel_sync_smart_assistant_area_list(handle, &area_list, on_sync_smart_assistant_area_list, NULL);
975         if (result != TAPI_API_SUCCESS) {
976                 msg("failed. (result = %d)", result);
977         }
978         msg("exit");
979
980         return 0;
981 }
982 static int run_del_smart_assistant_area_list(MManager *mm, struct menu_data *menu)
983 {
984         TapiHandle *handle = menu_manager_ref_user_data(mm);
985         TelSmartAssistantAreaList_t area_list;
986         int result;
987
988         memset(&area_list, 0, sizeof(TelSmartAssistantAreaList_t));
989         area_list.count = 3;
990         area_list.area[0].index = 1;
991         area_list.area[0].mode_state = TAPI_SMART_ASSISTANT_MODE_STATE_START;
992         area_list.area[1].index = 2;
993         area_list.area[1].mode_state = TAPI_SMART_ASSISTANT_MODE_STATE_STOP;
994         area_list.area[2].index = 3;
995         area_list.area[2].mode_state = TAPI_SMART_ASSISTANT_MODE_STATE_START;
996
997         msg("call tel_del_smart_assistant_area_list()");
998
999         result = tel_del_smart_assistant_area_list(handle, &area_list, on_del_smart_assistant_area_list, NULL);
1000         if (result != TAPI_API_SUCCESS) {
1001                 msg("failed. (result = %d)", result);
1002         }
1003         msg("exit");
1004
1005         return 0;
1006 }
1007 static int run_add_smart_assistant_area(MManager *mm, struct menu_data *menu)
1008 {
1009         TapiHandle *handle = menu_manager_ref_user_data(mm);
1010         TelSmartAssistantArea_t area;
1011         int result;
1012
1013         area.index = atoi(data_smart_assistant_area_index);
1014         area.mode_state = atoi(data_smart_assistant_area_mode);
1015
1016         msg("call tel_add_smart_assistant_area() index=%d", area.index);
1017
1018         result = tel_add_smart_assistant_area(handle, &area, on_add_smart_assistant_area, NULL);
1019         if (result != TAPI_API_SUCCESS) {
1020                 msg("failed. (result = %d)", result);
1021         }
1022         msg("exit");
1023
1024         return 0;
1025 }
1026 static int run_modify_smart_assistant_area(MManager *mm, struct menu_data *menu)
1027 {
1028         TapiHandle *handle = menu_manager_ref_user_data(mm);
1029         TelSmartAssistantArea_t area;
1030         int result;
1031
1032         area.index = atoi(data_smart_assistant_area_index);
1033         area.mode_state = atoi(data_smart_assistant_area_mode);
1034
1035         msg("call tel_modify_smart_assistant_area() index=%d", area.index);
1036
1037         result = tel_modify_smart_assistant_area(handle, &area, on_modify_smart_assistant_area, NULL);
1038         if (result != TAPI_API_SUCCESS) {
1039                 msg("failed. (result = %d)", result);
1040         }
1041         msg("exit");
1042
1043         return 0;
1044 }
1045 static int run_set_smart_assistant_info(MManager *mm, struct menu_data *menu)
1046 {
1047         TapiHandle *handle = menu_manager_ref_user_data(mm);
1048         TelSmartAssistantInfo_t info;
1049         int result;
1050
1051         info.index = atoi(data_smart_assistant_area_index);
1052         info.lpp_state = atoi(data_smart_assistant_area_mode);
1053
1054         msg("call tel_set_smart_assistant_info() index=%d", info.index);
1055
1056         result = tel_set_smart_assistant_info(handle, &info, on_set_smart_assistant_info, NULL);
1057         if (result != TAPI_API_SUCCESS) {
1058                 msg("failed. (result = %d)", result);
1059         }
1060         msg("exit");
1061
1062         return 0;
1063 }
1064
1065 /* Menu */
1066 static struct menu_data menu_gps_set_frequency_aiding[] = {
1067         { "1", "state (0=Disable, 1=Enable)", NULL, NULL, data_gps_set_frequency_aiding},
1068         { "2", "run", NULL, run_gps_set_frequency_aiding, NULL},
1069         { NULL, NULL, },
1070 };
1071
1072 static struct menu_data menu_gps_confirm_measure_position[] = {
1073         { "1", "run", NULL, run_gps_confirm_measure_position, NULL},
1074         { NULL, NULL, },
1075 };
1076
1077 static struct menu_data menu_enable_smart_assistant[] = {
1078         { "1", "run", NULL, run_enable_smart_assistant, NULL},
1079         { NULL, NULL, },
1080 };
1081
1082 static struct menu_data menu_disable_smart_assistant[] = {
1083         { "1", "run", NULL, run_disable_smart_assistant, NULL},
1084         { NULL, NULL, },
1085 };
1086
1087 static struct menu_data menu_sync_smart_assistant_area_list[] = {
1088         { "1", "run", NULL, run_sync_smart_assistant_area_list, NULL},
1089         { NULL, NULL, },
1090 };
1091
1092 static struct menu_data menu_del_smart_assistant_area_list[] = {
1093         { "1", "run", NULL, run_del_smart_assistant_area_list, NULL},
1094         { NULL, NULL, },
1095 };
1096
1097 static struct menu_data menu_add_smart_assistant_area[] = {
1098         { "1", "index (1=Default Index)", NULL, NULL, data_smart_assistant_area_index},
1099         { "2", "mode (1=Enable, 2=Disable)", NULL, NULL, data_smart_assistant_area_mode},
1100         { "3", "run", NULL, run_add_smart_assistant_area, NULL},
1101         { NULL, NULL, },
1102 };
1103
1104 static struct menu_data menu_modify_smart_assistant_area[] = {
1105         { "1", "index (1=Default Index)", NULL, NULL, data_smart_assistant_area_index},
1106         { "2", "mode (1=Enable, 2=Disable)", NULL, NULL, data_smart_assistant_area_mode},
1107         { "3", "run", NULL, run_modify_smart_assistant_area, NULL},
1108         { NULL, NULL, },
1109 };
1110
1111 static struct menu_data menu_set_smart_assistant_info[] = {
1112         { "1", "index (1=Default Index)", NULL, NULL, data_smart_assistant_area_index},
1113         { "2", "lpp_state (1=Start, 2=Stop)", NULL, NULL, data_smart_assistant_area_mode},
1114         { "3", "run", NULL, run_set_smart_assistant_info, NULL},
1115         { NULL, NULL, },
1116 };
1117
1118 struct menu_data menu_gps[] = {
1119         { "1", "SET Frequency Aiding", menu_gps_set_frequency_aiding, NULL, NULL},
1120         { "2", "CONFIRM Measure Position", menu_gps_confirm_measure_position, NULL, NULL},
1121         { "3", "ENABLE Smart Assistant", menu_enable_smart_assistant, NULL, NULL},
1122         { "4", "DISABLE Smart Assistant", menu_disable_smart_assistant, NULL, NULL},
1123         { "5", "SYNC Smart Assistant Area List", menu_sync_smart_assistant_area_list, NULL, NULL},
1124         { "6", "DELETE Smart Assistant Area List", menu_del_smart_assistant_area_list, NULL, NULL},
1125         { "7", "ADD Smart Assistant Area", menu_add_smart_assistant_area, NULL, NULL},
1126         { "8", "MODIFY Smart Assistant Area", menu_modify_smart_assistant_area, NULL, NULL},
1127         { "9", "SET Smart Assistant info", menu_set_smart_assistant_info, NULL, NULL},
1128         { NULL, NULL, },
1129 };
1130
1131 void register_gps_event(TapiHandle *handle)
1132 {
1133         int ret;
1134
1135         /* Gps */
1136         ret = tel_register_noti_event(handle, TAPI_NOTI_GPS_ASSIST_DATA, on_noti_assist_data, NULL);
1137         if (ret != TAPI_API_SUCCESS) {
1138                 msg("event register failed(%d)", ret);
1139         }
1140
1141         ret = tel_register_noti_event(handle, TAPI_IND_GPS_MEASURE_POSITION, on_ind_measure_position, NULL);
1142         if (ret != TAPI_API_SUCCESS) {
1143                 msg("event register failed(%d)", ret);
1144         }
1145
1146         ret = tel_register_noti_event(handle, TAPI_NOTI_GPS_RESET_ASSIST_DATA, on_noti_reset_assist_data, NULL);
1147         if (ret != TAPI_API_SUCCESS) {
1148                 msg("event register failed(%d)", ret);
1149         }
1150
1151         ret = tel_register_noti_event(handle, TAPI_NOTI_GPS_FREQUENCY_AIDING, on_noti_frequency_aiding, NULL);
1152         if (ret != TAPI_API_SUCCESS) {
1153                 msg("event register failed(%d)", ret);
1154         }
1155
1156         ret = tel_register_noti_event(handle, TAPI_NOTI_SMART_ASSISTANT_AREA_STATUS, on_noti_area_status, NULL);
1157         if (ret != TAPI_API_SUCCESS) {
1158                 msg("event register failed(%d)", ret);
1159         }
1160
1161         ret = tel_register_noti_event(handle, TAPI_NOTI_SMART_ASSISTANT_SYNC_STATUS, on_noti_sync_status, NULL);
1162         if (ret != TAPI_API_SUCCESS) {
1163                 msg("event register failed(%d)", ret);
1164         }
1165 }