2 * Telephony test application
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
28 #include <tapi_common.h>
32 #include <TapiUtility.h>
37 /* GPS Chipset on AP - START */
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;
48 /* Response Time Type */
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;
55 /* Location Method Type */
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;
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;
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
86 //GPS Assist Data Message
90 TAPI_GPS_CARRIER_INVALID,
93 } tapi_gps_carrier_e_type;
95 /* Utran Sfn Uncertainty */
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;
102 /* UTRAN Choice mode Type */
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;
109 /* DGPS Status Type */
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;
121 /* Navigation Satellite Status Type*/
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;
129 //GPS Measure Position Message
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;
139 /* Use Multiple Sets Type */
141 TAPI_GPS_MULTIPLESETS_INVALID,
142 TAPI_GPS_MULTIPLESETS_MULTIPLESETS,
143 TAPI_GPS_MULTIPLESETS_ONESET
144 } tapi_gps_use_multi_sets_e_type;
146 /* Environment Char Type */
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;
154 /* Cell Timing Wanted Type */
156 TAPI_GPS_CELLTIMING_INVALID,
157 TAPI_GPS_CELLTIMING_WANTED,
158 TAPI_GPS_CELLTIMING_NOT_WANTED
159 } tapi_gps_cell_timing_wnt_e_type;
161 /* Additional Assist Request Type */
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;
168 /* Measure Position Response Type */
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;
176 /* GPS element multi path Type */
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;
184 /* Accuracy Flag Value */
185 #define QOS_PRESENT_HORIZONTAL_ACCURACY 0x01
186 #define QOS_PRESENT_VERTICAL_ACCURACY 0x02
188 //GPS MTLR Notification Message
189 /* MTLR Notification Type */
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;
199 /* location estimate Type */
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;
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;
220 /* Verify Response Type */
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;
228 TAPI_GPS_FREQ_AIDING_DISABLE = 0,
229 TAPI_GPS_FREQ_AIDING_ENABLE,
230 } tapi_gps_freq_aiding_e_type;
232 /* GPS Chipset on AP - END */
235 /* GPS Chipset on AP - START */
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;
245 unsigned char sat_id;
247 }__attribute__ ((packed)) tapi_gps_sat_info_t;
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;
257 unsigned long int assistanceFlag;
258 unsigned short gpsWeek;
259 unsigned char gpsToe;
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;
268 tapi_gps_molr_e_type molr_type;
269 tapi_gps_location_method_e_type location_method;
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
279 //Measure Position message
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;
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;
298 signed long int latitude;
299 signed long int longitude;
300 }__attribute__ ((packed)) tapi_gps_ellipsoid_po_t;
303 tapi_gps_ellipsoid_po_t point;
304 unsigned char uncertainRadius;
305 }__attribute__ ((packed)) tapi_gps_po_unc_circle_t;
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;
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;
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;
335 tapi_gps_ellipsoid_po_t point;
336 signed short altitude;
337 }__attribute__ ((packed)) tapi_gps_ellipsoid_alt_t;
340 unsigned char noOfPoints;
341 tapi_gps_ellipsoid_po_t points[15];
342 }__attribute__ ((packed)) tapi_gps_polygon_t;
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;
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;
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;
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
382 tapi_gps_verify_rsp_e_type response;
383 }__attribute__ ((packed)) tapi_gps_mtlr_notification_confirm_t; //AGPS - MTLR Notification message - confirm
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
395 unsigned long int flag;
396 unsigned char horizontalAccuracy;
397 unsigned char vertcalAccuracy;
398 }__attribute__ ((packed)) tapi_gps_accuracy_t;
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
411 unsigned short deferredLocEventType;
412 tapi_gps_mtlr_notify_e_type locEstimateType;
413 }__attribute__ ((packed)) tapi_gps_mtlr_loc_t;
416 unsigned long int length; //Length of APDU
417 unsigned char val[63]; //APDU data
418 }__attribute__ ((packed)) tapi_gps_string_t;
422 tapi_gps_string_t str;
423 tapi_gps_format_ind_e_type format_indicator;
424 }__attribute__ ((packed)) tapi_gps_dcs_string_t;
428 tapi_gps_string_t str;
429 }__attribute__ ((packed)) tapi_gps_code_word_t;
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
443 unsigned char cipherKeyFlag;
444 unsigned char currentDecipherKey[7];
445 unsigned char nextDecipherKey[7];
446 }__attribute__ ((packed)) tapi_gps_deciphering_keys_t;
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
456 unsigned short bcchCarrier;
458 unsigned long int frameNumber;
459 unsigned short timeSlot;
460 unsigned short bitNumber;
461 }__attribute__ ((packed)) tapi_gps_gsm_time_t;
465 unsigned long int gpsTimeUncertainty;
466 }__attribute__ ((packed)) tapi_gps_utran_gps_unc_t;
470 signed long int driftRate;
471 }__attribute__ ((packed)) tapi_gps_drift_rate_t;
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;
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;
489 unsigned long int gpsTow;
490 unsigned long int gpsWeek;
491 unsigned char nrOfSats;
493 tapi_gps_gsm_time_t gsm_time;
494 tapi_gps_utran_time_t UtranTime;
496 tapi_gps_gps_tow_assist_t GpsTowAssist[12];
497 }__attribute__ ((packed)) tapi_gps_ref_time_t;
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;
514 unsigned char satId; //Satellite ID
517 signed short pseudoRangeCor;
518 signed short rangeRateCor;
519 }__attribute__ ((packed)) tapi_gps_dgps_sat_list_t;
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;
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;
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;
569 unsigned char NavigationSatStatus;
570 tapi_gps_navi_ephe_t NavigationEphemeris;
571 }__attribute__ ((packed)) tapi_gps_navi_sat_info_t;
574 unsigned long int numberOfSat;
575 tapi_gps_navi_sat_info_t NavigationSatInfo[16];
576 }__attribute__ ((packed)) tapi_gps_navi_model_t;
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;
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;
601 signed char dataId; // only for 3G, 0~3, if this value is -1, it means this value is invalid
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;
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;
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;
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;
641 unsigned long int gpsTow;
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;
651 unsigned char satId[16];
652 unsigned char numOfSat;
653 }__attribute__ ((packed)) tapi_gps_r_time_int_t;
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
670 unsigned char lock_status;
671 unsigned char afc_update;
672 }__attribute__ ((packed)) tapi_gps_frequency_aiding_noti_t;
674 /* GPS Chipset on AP - END */
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";
680 static void _gps_hex_dump(char *pad, int size, const void *data)
682 char buf[255] = {0, };
688 msg("%sno data", pad);
691 p = (unsigned char *)data;
693 snprintf(buf, 255, "%s%04X: ", pad, 0);
694 for (i = 0; i<size; i++) {
695 snprintf(hex, 4, "%02X ", p[i]);
698 if ((i + 1) % 8 == 0) {
699 if ((i + 1) % 16 == 0) {
702 snprintf(buf, 255, "%s%04X: ", pad, i + 1);
713 static void _gps_print_dump(int data_len, void *data)
719 msg(" \tlen=%d", data_len);
720 _gps_hex_dump(" ", data_len, data);
727 static void on_noti_assist_data(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
729 guchar *decoded_data = NULL;
731 tapi_gps_assist_data_noti_t *noti = NULL;
734 msgb("event(%s) receive !!", TAPI_NOTI_GPS_ASSIST_DATA);
735 msg("data=%p", data);
739 msg(" ## Before decoding ##");
740 _gps_print_dump(strlen(data), data);
742 decoded_data = g_base64_decode((const gchar *)data, &length);
743 noti = (tapi_gps_assist_data_noti_t *)decoded_data;
745 msg(" ## After decoding ##");
746 _gps_print_dump(length, decoded_data);
748 msg(" - length = %d", length);
749 msg(" - flag = %ld", noti->flag);
750 g_free(decoded_data);
753 static void on_ind_measure_position(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
755 guchar *decoded_data = NULL;
757 tapi_gps_measure_position_indi_t *ind = NULL;
760 msgb("event(%s) receive !!", TAPI_IND_GPS_MEASURE_POSITION);
761 msg("data=%p", data);
765 msg(" ## Before decoding ##");
766 _gps_print_dump(strlen(data), data);
768 decoded_data = g_base64_decode((const gchar *)data, &length);
769 ind = (tapi_gps_measure_position_indi_t *)decoded_data;
771 msg(" ## After decoding ##");
772 _gps_print_dump(length, decoded_data);
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);
784 static void on_noti_reset_assist_data(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
787 msgb("event(%s) receive !!", TAPI_NOTI_GPS_RESET_ASSIST_DATA);
788 msg("data=%p", data?data:0);
791 static void on_noti_frequency_aiding(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
793 tapi_gps_frequency_aiding_noti_t *noti = (tapi_gps_frequency_aiding_noti_t *)data;
796 msgb("event(%s) receive !!", TAPI_NOTI_GPS_FREQUENCY_AIDING);
797 msg("data=%p", data);
801 msg(" - lock = %d", noti->lock_status);
802 msg(" - afc_update = %d", noti->afc_update);
805 static void on_noti_area_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
807 struct tel_noti_smart_assistant_area_status *noti = (struct tel_noti_smart_assistant_area_status *)data;
810 msgb("event(%s) receive !!", TAPI_NOTI_SMART_ASSISTANT_AREA_STATUS);
811 msg("data=%p", data);
815 msg(" - area_status(1:IN, 2:OUT) = %d", noti->area_status);
816 msg(" - index = %d", noti->index);
819 static void on_noti_sync_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
821 struct tel_noti_smart_assistant_sync_status *noti = (struct tel_noti_smart_assistant_sync_status *)data;
824 msgb("event(%s) receive !!", TAPI_NOTI_SMART_ASSISTANT_SYNC_STATUS);
825 msg("data=%p", data);
829 msg(" - init_status(1:Success, 2:Fail) = %d", noti->init_status);
830 msg(" - init_fail_cause = %d", noti->init_fail_cause);
834 static void on_gps_set_frequency_aiding(TapiHandle *handle, int result, void *data, void *user_data)
837 msgb("tel_set_gps_frequency_aiding() response receive");
838 msg(" - result = 0x%x", result);
841 static void on_enable_smart_assistant(TapiHandle *handle, int result, void *data, void *user_data)
844 msgb("tel_enable_smart_assistant() response receive");
845 msg(" - result = 0x%x", result);
848 static void on_disable_smart_assistant(TapiHandle *handle, int result, void *data, void *user_data)
851 msgb("tel_disable_smart_assistant() response receive");
852 msg(" - result = 0x%x", result);
855 static void on_sync_smart_assistant_area_list(TapiHandle *handle, int result, void *data, void *user_data)
858 msgb("tel_sync_smart_assistant_area_list() response receive");
859 msg(" - result = 0x%x", result);
862 static void on_del_smart_assistant_area_list(TapiHandle *handle, int result, void *data, void *user_data)
865 msgb("tel_del_smart_assistant_area_list() response receive");
866 msg(" - result = 0x%x", result);
869 static void on_add_smart_assistant_area(TapiHandle *handle, int result, void *data, void *user_data)
872 msgb("tel_add_smart_assistant_area() response receive");
873 msg(" - result = 0x%x", result);
876 static void on_modify_smart_assistant_area(TapiHandle *handle, int result, void *data, void *user_data)
879 msgb("tel_set_gps_frequency_aiding() response receive");
880 msg(" - result = 0x%x", result);
883 static void on_set_smart_assistant_info(TapiHandle *handle, int result, void *data, void *user_data)
886 msgb("tel_set_smart_assistant_info() response receive");
887 msg(" - result = 0x%x", result);
892 static int run_gps_set_frequency_aiding(MManager *mm, struct menu_data *menu)
894 TapiHandle *handle = menu_manager_ref_user_data(mm);
897 msg("call tel_set_gps_frequency_aiding()");
899 state = atoi(data_gps_set_frequency_aiding);
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);
910 static int run_gps_confirm_measure_position(MManager *mm, struct menu_data *menu)
912 TapiHandle *handle = menu_manager_ref_user_data(mm);
914 tapi_gps_measure_position_confirm_t data;
916 msg("call tel_confirm_gps_measure_pos().");
917 _gps_print_dump(sizeof(tapi_gps_measure_position_confirm_t), &data);
919 result = tel_confirm_gps_measure_pos(handle, (unsigned char *)&data, sizeof(tapi_gps_measure_position_confirm_t));
921 if (result != TAPI_API_SUCCESS) {
922 msg("failed. (result = %d)", result);
928 static int run_enable_smart_assistant(MManager *mm, struct menu_data *menu)
930 TapiHandle *handle = menu_manager_ref_user_data(mm);
932 msg("call tel_enable_smart_assistant()");
934 result = tel_enable_smart_assistant(handle, on_enable_smart_assistant, NULL);
935 if (result != TAPI_API_SUCCESS) {
936 msg("failed. (result = %d)", result);
943 static int run_disable_smart_assistant(MManager *mm, struct menu_data *menu)
945 TapiHandle *handle = menu_manager_ref_user_data(mm);
947 msg("call tel_disable_smart_assistant()");
949 result = tel_disable_smart_assistant(handle, on_disable_smart_assistant, NULL);
950 if (result != TAPI_API_SUCCESS) {
951 msg("failed. (result = %d)", result);
957 static int run_sync_smart_assistant_area_list(MManager *mm, struct menu_data *menu)
959 TapiHandle *handle = menu_manager_ref_user_data(mm);
960 TelSmartAssistantAreaList_t area_list;
963 memset(&area_list, 0, sizeof(TelSmartAssistantAreaList_t));
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()");
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);
982 static int run_del_smart_assistant_area_list(MManager *mm, struct menu_data *menu)
984 TapiHandle *handle = menu_manager_ref_user_data(mm);
985 TelSmartAssistantAreaList_t area_list;
988 memset(&area_list, 0, sizeof(TelSmartAssistantAreaList_t));
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;
997 msg("call tel_del_smart_assistant_area_list()");
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);
1007 static int run_add_smart_assistant_area(MManager *mm, struct menu_data *menu)
1009 TapiHandle *handle = menu_manager_ref_user_data(mm);
1010 TelSmartAssistantArea_t area;
1013 area.index = atoi(data_smart_assistant_area_index);
1014 area.mode_state = atoi(data_smart_assistant_area_mode);
1016 msg("call tel_add_smart_assistant_area() index=%d", area.index);
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);
1026 static int run_modify_smart_assistant_area(MManager *mm, struct menu_data *menu)
1028 TapiHandle *handle = menu_manager_ref_user_data(mm);
1029 TelSmartAssistantArea_t area;
1032 area.index = atoi(data_smart_assistant_area_index);
1033 area.mode_state = atoi(data_smart_assistant_area_mode);
1035 msg("call tel_modify_smart_assistant_area() index=%d", area.index);
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);
1045 static int run_set_smart_assistant_info(MManager *mm, struct menu_data *menu)
1047 TapiHandle *handle = menu_manager_ref_user_data(mm);
1048 TelSmartAssistantInfo_t info;
1051 info.index = atoi(data_smart_assistant_area_index);
1052 info.lpp_state = atoi(data_smart_assistant_area_mode);
1054 msg("call tel_set_smart_assistant_info() index=%d", info.index);
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);
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},
1072 static struct menu_data menu_gps_confirm_measure_position[] = {
1073 { "1", "run", NULL, run_gps_confirm_measure_position, NULL},
1077 static struct menu_data menu_enable_smart_assistant[] = {
1078 { "1", "run", NULL, run_enable_smart_assistant, NULL},
1082 static struct menu_data menu_disable_smart_assistant[] = {
1083 { "1", "run", NULL, run_disable_smart_assistant, NULL},
1087 static struct menu_data menu_sync_smart_assistant_area_list[] = {
1088 { "1", "run", NULL, run_sync_smart_assistant_area_list, NULL},
1092 static struct menu_data menu_del_smart_assistant_area_list[] = {
1093 { "1", "run", NULL, run_del_smart_assistant_area_list, NULL},
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},
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},
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},
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},
1131 void register_gps_event(TapiHandle *handle)
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);
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);
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);
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);
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);
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);