4 * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyeongchul Kim <kyeongchul.kim@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.
22 #include <pthread.h> /* pthread functions and data structures */
29 #include "TelDefines.h"
30 #include "ITapiCall.h"
32 #include "TapiCommon.h"
35 #include "TelSatEnvelope.h"
36 #include "TelSatObj.h"
37 #include "TelSatProactvCmd.h"
39 #include "TelUtility_ext.h"
40 #include "TelUtility.h"
44 TelTapiCallInfo_t g_info;
46 extern int EvtDeliveryHandle ;
49 /***************************/
53 unsigned int curr_cmd = 0;
55 tapi_simatk_select_item_ind_data_t sel_item_data;
56 tapi_simatk_resp_data_t tr_data;
66 unsigned char *ptrEvnts[] = {
67 "Telephony.Sat.UI.DisplayText",
68 "Telephony.Sat.UI.GetInKey",
69 "Telephony.Sat.UI.GetInputKey",
70 "Telephony.Sat.UI.PlayTone",
71 "Telephony.Sat.UI.Refresh",
72 "Telephony.Sat.UI.SetUpMenu",
73 "Telephony.Sat.UI.SelectItem",
74 "Telephony.Sat.UI.SendSms",
75 "Telephony.Sat.UI.SendSs",
76 "Telephony.Sat.UI.SendUssd",
77 "Telephony.Sat.UI.SetupCall",
78 "Telephony.Sat.ProvideLocalInfo",
79 "Telephony.Sat.SetupEventList",
80 "Telephony.Sat.SetupIdelMode",
81 "Telephony.Sat.UI.SendDtmf",
82 "Telephony.Sat.Idle.LanguageNotification",
83 "Telephony.Sat.UI.LaunchBrowser",
84 "Telephony.Sat.UI.EndProacativeSession",
85 "Telephony.Sat.Call.CallControlCnf",
86 "Telephony.Sat.SMS.MoSmsControlCnf",
87 "Telephony.Sat.SMS.Refresh",
88 "Telephony.Sat.Phonebook.Refresh",
89 "Telephony.Sat.Idle.Refresh",
90 "Telephony.Sat.SMS.SendSms",
91 "Telephony.Sat.Call.SetupCall",
92 "Telephony.Sat.SS.SendSs",
93 "Telephony.Sat.USSD.SendUssd",
94 "Telephony.Sat.Idle.SetupText",
95 "Telephony.Sat.DTMF.SendDtmf",
96 "User.WapBrowser.ESimAtkOpenURL",
97 "Telephony.Sat.UI.CmdProcEnd",
98 "Telephony.Sat.MenuSelectionCnf",
99 "Telephony.Sat.EventDownloadCnf"
105 sat_util_pack_7bit( TS_BYTE* pOut, const char* szData, int in_len )
111 for( pos = 0, i = 0; /*pos < out_len_max &&*/ i < in_len; pos++, i++ )
113 /* pack the low bits */
114 pOut[pos] = szData[i] >> shift;
116 if ( i + 1 < in_len )
118 /* pack the high bits using the low bits of the next character */
119 pOut[pos] |= szData[i+1] << ( 7 - shift );
138 test_send_tr(unsigned char gen_resp)
144 tr_data.tr_data.display_txt.result.general_result = gen_resp;
145 tr_data.tr_data.display_txt.result.me_problem = 0x00;
161 char scabuf[5] = {0};
162 printf("additional response 0x00 ~ 0x0a: 0x\n");
163 ret = read(0, scabuf, sizeof(scabuf));
173 input = (scabuf[0] -'0' )<< 4;
174 input |= (scabuf[1]-'0')&0x0F;
175 if(input >= 0x00 && input <= 0x3F)
177 printf("additional response gen_resp 0x%x - add_resp 0x%x\n", gen_resp, input);
180 if(curr_cmd == TAPI_EVENT_SAT_UI_SEND_SS_IND)
181 tr_data.tr_data.send_ss.additional_cc_problem_info = input;
182 else if(curr_cmd == TAPI_EVENT_SAT_UI_SEND_USSD_IND)
183 tr_data.tr_data.send_ussd.additional_cc_problem_info = input;
185 tr_data.tr_data.display_txt.result.me_problem = input;
187 else if(gen_resp == 0x34)
188 tr_data.tr_data.send_ss.additional_ss_problem_info = input;
189 else if(gen_resp == 0x37)
190 tr_data.tr_data.send_ussd.additional_ussd_problem_info = input;
192 tr_data.tr_data.display_txt.result.me_problem = input;
201 printf(" [SAT] : test_send_tr ::: send TR. command_number=%d, type=0x%x\n",
202 tr_data.command_number, tr_data.command_type);
203 TelTapiSatSendUiUserConfirm(tr_data.command_number ,tr_data.command_type,SAT_ENGINE_USER_CONFIRM_YES,NULL,0);
209 test_call_control(void)
211 tapi_call_setup_info_t call;
212 unsigned short error;
213 tapi_call_handle call_handle;
214 unsigned char num_dial[] = "+01234567890123456789";
216 call.call_type = TAPI_CALL_TYPE_VOICE;
217 memcpy(call.number,num_dial, sizeof(num_dial));
218 call.identity_mode = 0x01;
219 tapi_call_setup(&call, call_handle, &error);
224 test_simatk_proactive_send_dtmf(tapi_simatk_send_dtmf_ind_data_t* tst_data)
227 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
229 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
231 printf(" [SAT] : alpha_id present?= %d, alphaID: %s\n",tst_data->alpha_id.is_present, tst_data->alpha_id.string);
233 printf(" [SAT] : DTMF STRING: len = %d, USSD string = %s\n", tst_data->dtmf_string.string_length, tst_data->dtmf_string.dtmf_tone);
235 if(tst_data->icon_id.is_present)
236 printf(" \n[SAT] : icon identifier: icon_id=%d, icon_qulaifier = 0x%x\n", tst_data->icon_id.icon_identifier, tst_data->icon_id.icon_qualifier);
238 printf(" \n[SAT] : icon NOT present\n");
241 tr_data.command_number = tst_data->command_detail.command_number;
242 tr_data.command_type = tst_data->command_detail.command_type;
246 test_simatk_proactive_play_tone(tapi_simatk_play_tone_ind_data_t* tst_data)
248 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
249 printf(" [SAT] : command qulaifier: Vibrate_alert 0=optional, 1=required, %d\n", tst_data->command_detail.u.cmd_quali_play_tone.vibrate_alert);
250 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
251 printf(" [SAT] : alpha identifier: is_alpha_present=%d, rawdcs=0x%x, str_len=%d, string=%s\n", tst_data->alpha_id.is_present,
252 tst_data->alpha_id.dcs.raw_dcs, tst_data->alpha_id.string_len, tst_data->alpha_id.string);
254 printf(" [SAT] : TONE: requested tone - 0x%02x\n", tst_data->tone.type);
255 printf(" [SAT] : DURATION: interval=0x%x, time unit=0x%x\n",tst_data->duration.time_interval,tst_data->duration.time_unit);
256 printf(" [SAT] : icon: is_icon_present=%d, icon id: %d\n",tst_data->icon_id.is_present, tst_data->icon_id.icon_identifier);
259 tr_data.command_number = tst_data->command_detail.command_number;
260 tr_data.command_type = tst_data->command_detail.command_type;
264 test_simatk_proactive_get_input(tapi_simatk_get_input_ind_data_t* tst_data)
266 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
268 printf(" [SAT] : command qualifier: is_using_alphabet_set (1=ys, 0=using digits) [%d]\n",tst_data->command_detail.u.cmd_quali_get_input.is_using_alphabet_set);
270 printf(" [SAT] : command qualifier: alpha_type = 0x%x, help info available? = %d\n",tst_data->command_detail.u.cmd_quali_get_input.alphabet_type, tst_data->command_detail.u.cmd_quali_get_input.is_help_info_available);
272 printf(" [SAT] : command qualifier: is_me_echo_user_input? [%d], unpacked data? [%d]\n",tst_data->command_detail.u.cmd_quali_get_input.is_me_echo_user_input, tst_data->command_detail.u.cmd_quali_get_input.is_user_input_unpacked_format);
274 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
276 printf(" [SAT] : text-dcs: compressed?=%d, alpha_format=0x%x\n",tst_data->text.dcs.is_compressed_format, tst_data->text.dcs.alphabet_format);
278 printf(" [SAT] : text: string_length=%d, string=%s\n",tst_data->text.string_length, tst_data->text.string);
280 printf(" [SAT] : text: response length: min =%d, max=%d\n",tst_data->response_length.min, tst_data->response_length.max);
282 printf(" [SAT] : icon: is_icon_present=%d, icon id: %d\n",tst_data->icon_id.is_present, tst_data->icon_id.icon_identifier);
284 printf(" [SAT] : Default Text: string length=%d\n",tst_data->default_text.string_length);
286 printf(" [SAT] : Default Text: dcs=0x%02x, default string: %s\n",tst_data->default_text.dcs.alphabet_format, tst_data->default_text.string);
288 if(!tst_data->command_detail.u.cmd_quali_get_input.is_user_input_unpacked_format)
289 tr_data.tr_data.get_input.text.dcs.alphabet_format = TAPI_SAT_ALPHABET_FROMAT_SMS_DEFAULT;
291 tr_data.tr_data.get_input.text.dcs.alphabet_format = TAPI_SIMATK_ALPHABET_FROMAT_8BIT_DATA;
293 tr_data.command_number = tst_data->command_detail.command_number;
294 tr_data.command_type = tst_data->command_detail.command_type;
296 if(tst_data->icon_id.is_present)
297 tr_data.tr_data.get_input.result.general_result = TAPI_SAT_R_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED;
299 tr_data.tr_data.get_input.result.general_result = 0x00;
304 test_simatk_proactive_get_inkey(tapi_simatk_get_inkey_ind_data_t* tst_data)
306 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
308 printf(" [SAT] : command qualifier: inkey_type 0== using character set, 1== yes/no type [%d]\n",tst_data->command_detail.u.cmd_quali_get_inkey.inkey_type);
310 printf(" [SAT] : command qualifier: use_alpha_set? [%d], is_help info available? [%d]\n",tst_data->command_detail.u.cmd_quali_get_inkey.is_using_alphabet_set, tst_data->command_detail.u.cmd_quali_get_inkey.is_help_info_available);
312 printf(" [SAT] : command qualifier: immideate response required? [%d], alphabet_type [%d]\n",tst_data->command_detail.u.cmd_quali_get_inkey.is_immediate_response_required, tst_data->command_detail.u.cmd_quali_get_inkey.alphabet_type);
314 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
316 printf(" [SAT] : text-dcs: compressed?=%d, alpha_format=0x%x, msg_class=0x%x, raw_dcs=%d\n",tst_data->text.dcs.is_compressed_format, tst_data->text.dcs.alphabet_format,tst_data->text.dcs.msg_class, tst_data->text.dcs.raw_dcs);
318 printf(" [SAT] : text: string_length=%d, string=%s\n",tst_data->text.string_length, tst_data->text.string);
320 printf(" [SAT] : icon: is_icon_present=%d\n",tst_data->icon_id.is_present);
322 printf(" [SAT] : DURATION: interval=0x%x, time unit=0x%x\n",tst_data->duration.time_interval,tst_data->duration.time_unit);
325 tr_data.command_number = tst_data->command_detail.command_number;
326 tr_data.command_type = tst_data->command_detail.command_type;
328 if(tst_data->icon_id.is_present)
329 tr_data.tr_data.get_inkey.result.general_result = TAPI_SAT_R_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED;
331 tr_data.tr_data.get_inkey.result.general_result = 0x00;
337 test_simatk_event_download(tapi_simatk_event_download_type_t event)
339 TelSatkEventDownloadData_t evt_dl;
342 memset(&evt_dl, 0x00, sizeof(TelSatkEventDownloadData_t));
344 printf(" [SAT] : EVENT DOWNLOAD\n");
348 case TAPI_EVENT_SAT_DW_TYPE_IDLE_SCREEN_AVAILABLE:
349 evt_dl.event_download_type = TAPI_EVENT_SAT_DW_TYPE_IDLE_SCREEN_AVAILABLE;
352 case TAPI_EVENT_SAT_DW_TYPE_USER_ACTIVITY:
353 evt_dl.event_download_type = TAPI_EVENT_SAT_DW_TYPE_USER_ACTIVITY;
356 case TAPI_EVENT_SAT_DW_TYPE_LANGUAGE_SELECTION:
358 char scabuf[5] = {0};
361 printf(" en: english\n");
362 printf(" de: german\n");
363 ret = read(0, scabuf, sizeof(scabuf));
373 if(strncmp(scabuf, "en", 2) == 0)
374 evt_dl.u.language_selection_event_req_Data.language = TAPI_SAT_LP_ENGLISH;
376 evt_dl.u.language_selection_event_req_Data.language = TAPI_SAT_LP_GERMAN;
378 evt_dl.event_download_type = TAPI_EVENT_SAT_DW_TYPE_LANGUAGE_SELECTION;
382 case TAPI_EVENT_SAT_DW_TYPE_BROWSER_TERMINATION:
383 evt_dl.event_download_type = TAPI_EVENT_SAT_DW_TYPE_BROWSER_TERMINATION;
384 evt_dl.u.browser_termination_event_req_Data.browser_termination_cause = TAPI_SAT_BROWSER_TERMINATED_BY_USER;
390 TelTapiSatEventDownloadEnvelope(&evt_dl, &requestId);
394 test_simatk_proactive_lang_noti(tapi_simatk_language_notification_ind_data_t* tst_data)
396 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
398 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
400 printf(" [SAT] : command qualifier: language specified? = %d\n",tst_data->command_detail.u.cmd_quali_language_notification.bSpecificLanguageNotification);
402 if(tst_data->command_detail.u.cmd_quali_language_notification.bSpecificLanguageNotification)
403 printf(" [SAT] : command qualifier: language = %d\n",tst_data->language.language);
406 tr_data.command_number = tst_data->command_detail.command_number;
407 tr_data.command_type = tst_data->command_detail.command_type;
412 test_simatk_proactive_provide_local_info(tapi_simatk_provide_local_info_ind_data_t* tst_data)
415 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
417 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
419 printf(" [SAT] : command qualifier: requested info = 0x%02x\n",tst_data->command_detail.u.cmd_quali_provide_local_info);
422 tr_data.command_number = tst_data->command_detail.command_number;
423 tr_data.command_type = tst_data->command_detail.command_type;
424 //tr_data.tr_data.provide_loc_info.other_info = TRUE;
425 tr_data.tr_data.provide_loc_info.info_type = tst_data->command_detail.u.cmd_quali_provide_local_info;
427 if(tst_data->command_detail.u.cmd_quali_provide_local_info == TAPI_SIMATK_CMD_QUALI_PROVIDE_LANGUAGE_SETTING)
429 tr_data.tr_data.provide_loc_info.u.language_info.language = TAPI_SIMATK_LP_ENGLISH;
431 else if(tst_data->command_detail.u.cmd_quali_provide_local_info == TAPI_SIMATK_CMD_QUALI_PROVIDE_DATE_TIME_AND_TIME_ZONE)
433 tr_data.tr_data.provide_loc_info.u.time_zone_info.year = 0x80;
434 tr_data.tr_data.provide_loc_info.u.time_zone_info.month = 0x50;
435 tr_data.tr_data.provide_loc_info.u.time_zone_info.day = 0x70;
436 tr_data.tr_data.provide_loc_info.u.time_zone_info.hour = 0x41;
437 tr_data.tr_data.provide_loc_info.u.time_zone_info.minute = 0x80;
438 tr_data.tr_data.provide_loc_info.u.time_zone_info.second = 0x71;
439 tr_data.tr_data.provide_loc_info.u.time_zone_info.time_zone = 0xFF;
444 test_simatk_proactive_setup_idle_mode_text(tapi_simatk_setup_idle_mode_text_ind_data_t* tst_data)
447 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
449 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
451 printf(" [SAT] : text-dcs: compressed?=%d, alpha_format=0x%x, msg_class=0x%x, raw_dcs=%d\n",tst_data->text.dcs.is_compressed_format, tst_data->text.dcs.alphabet_format,tst_data->text.dcs.msg_class, tst_data->text.dcs.raw_dcs);
453 printf(" [SAT] : text: string_length=%d, string=%s\n",tst_data->text.string_length, tst_data->text.string);
455 printf(" [SAT] : icon: is_icon_present=%d\n",tst_data->icon_id.is_present);
458 tr_data.command_number = tst_data->command_detail.command_number;
459 tr_data.command_type = tst_data->command_detail.command_type;
463 test_simatk_proactive_display_text(tapi_simatk_display_text_ind_data_t* tst_data)
466 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
468 printf(" [SAT] : command qualifier: clear=%d, priority=%d\n",tst_data->command_detail.u.cmd_quali_display_text.msg_clear,tst_data->command_detail.u.cmd_quali_display_text.msg_priority);
470 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
472 printf(" [SAT] : text-dcs: compressed?=%d, alpha_format=0x%x, msg_class=0x%x, raw_dcs=%d\n",tst_data->text.dcs.is_compressed_format, tst_data->text.dcs.alphabet_format,tst_data->text.dcs.msg_class, tst_data->text.dcs.raw_dcs);
474 printf(" [SAT] : text: string_length=%d, string=%s\n",tst_data->text.string_length, tst_data->text.string);
476 printf(" [SAT] : icon: is_icon_present=%d\n",tst_data->icon_id.is_present);
478 printf(" [SAT] : DURATION: interval=0x%x, time unit=0x%x\n",tst_data->duration.time_interval,tst_data->duration.time_unit);
482 tr_data.command_number = tst_data->command_detail.command_number;
483 tr_data.command_type = tst_data->command_detail.command_type;
484 /* tr_data.tr_data.display_txt.result.general_result = TAPI_SIMATK_R_SUCCESS;
485 tr_data.tr_data.display_txt.result.me_problem = 0x00;
486 printf(" [SAT] : send TR. command_number=%d, type=0x%x, gen_result=0x%x\n",
487 tr_data.command_number, tr_data.command_type,
488 tr_data.tr_data.display_txt.result.general_result);
489 tapi_simatk_send_terminal_response(&tr_data);*/
494 test_simatk_send_menu_select_env(TS_BOOL help)
496 TelSatMenuSelectionReqInfo_t env_data;
499 char scabuf[5] = {0};
503 ret = read(0, scabuf, sizeof(scabuf));
513 memcpy(str, scabuf, (strlen(scabuf)-1));
517 env_data.item_identifier = item;
518 env_data.is_help_requested = help;
519 printf(" [SAT] : test_simatk_send_menu_select_env ::: MENU SELECT item_id= 0x%x, HELP?=%s\n",
520 env_data.item_identifier,(env_data.is_help_requested)?"Reqd":"NOT Reqd");
521 TelTapiSatMenuSelectionEnvelope(&env_data, &requestId);
525 test_simatk_proactive_refresh(tapi_simatk_refresh_ind_data_t* tst_data)
528 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
530 printf(" [SAT] : command qualifier: REFRESH MODE=%d\n",tst_data->command_detail.u.cmd_quali_refresh);
532 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
534 printf(" [SAT] : File Count=%d\n", tst_data->file_list.file_count);
536 printf(" [SAT] : file ids:");
537 for(i=0; i<tst_data->file_list.file_count;i++)
538 printf("\tfile_#[%d] = 0x%04x",i,tst_data->file_list.file_id[i]);
544 tr_data.command_number = tst_data->command_detail.command_number;
545 tr_data.command_type = tst_data->command_detail.command_type;
546 /*tr_data.tr_data.refresh.result.general_result = TAPI_SIMATK_R_SUCCESS;
547 tr_data.tr_data.refresh.result.me_problem = 0x00;
548 printf(" [SAT] : send TR. command_number=%d, type=0x%x, gen_result=0x%x\n",
549 tr_data.command_number, tr_data.command_type,
550 tr_data.tr_data.refresh.result.general_result);
551 tapi_simatk_send_terminal_response(&tr_data);*/
555 test_simatk_proactive_setup_menu(tapi_simatk_setup_menu_ind_data_t* tst_data)
558 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
560 printf(" [SAT] : command qualifier: selection_pref=%d, help_info=%d\n",tst_data->command_detail.u.cmd_quali_setup_menu.selection_preference,tst_data->command_detail.u.cmd_quali_setup_menu.is_help_info_available);
562 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
564 printf(" [SAT] : alpha identifier: is_alpha_present=%d, rawdcs=0x%x, str_len=%d, string=%s\n", tst_data->alpha_id.is_present,
565 tst_data->alpha_id.dcs.raw_dcs, tst_data->alpha_id.string_len, tst_data->alpha_id.string);
567 printf(" [SAT] : items NAI: list count=%d \n [SAT] : items NAI:",tst_data->item_next_action_ind_list.list_count);
568 for(i=0; i<tst_data->item_next_action_ind_list.list_count;i++)
569 printf("\tnai_ind[%d] = 0x%02x",i, tst_data->item_next_action_ind_list.list[i]);
571 printf(" \n[SAT] : icon identifier: is icon present = %d\n",tst_data->icon_id.is_present);
573 printf(" [SAT] : setup menu: menu_count = %d\n",tst_data->menu_item_count);
574 for(i=0;i<tst_data->menu_item_count;i++)
575 printf("\tmenu_item[%d]= %s, [menu_item_id = %d]\n",i, tst_data->menu_item[i].text, tst_data->menu_item[i].item_id);
578 tr_data.command_number = tst_data->command_detail.command_number;
579 tr_data.command_type = tst_data->command_detail.command_type;
580 /*tr_data.tr_data.setup_menu.result.general_result = TAPI_SIMATK_R_SUCCESS;
581 tr_data.tr_data.setup_menu.result.me_problem = 0x00;
582 printf(" [SAT] : send TR. command_number=%d, type=0x%x, gen_result=0x%x\n",
583 tr_data.command_number, tr_data.command_type,
584 tr_data.tr_data.setup_menu.result.general_result);
585 tapi_simatk_send_terminal_response(&tr_data);*/
589 test_simatk_proactive_send_sms(tapi_simatk_send_sms_ind_data_t* tst_data)
592 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
594 printf(" [SAT] : send sms :is_packing_by ME rquired%d\n",tst_data->command_detail.u.cmd_quali_send_sms.is_packing_by_me_required);
596 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
598 printf(" [SAT] : send sms: alpha_id present?= %d, icon present? = %d, icon_id=%d\n",tst_data->alpha_id.is_present, tst_data->icon_id.is_present, tst_data->icon_id.icon_identifier);
600 printf(" [SAT] : send sms: ALPHA Len = %d, Alpha ID: %s\n",tst_data->alpha_id.string_len, tst_data->alpha_id.string);
601 printf(" [SAT] : send sms ADDRESS: ton=0x%x, npi=0x%x\n",tst_data->address.ton,tst_data->address.npi);
603 printf(" [SAT] : send sms ADDRESS: len = %d, dialling Number = %s\n", tst_data->address.dialling_number_length, tst_data->address.dialling_number);
605 printf(" [SAT] : send sms TPDU: len = %d, tpdu_data:\n",tst_data->sms_tpdu.data_length);
606 for(i=0;i<tst_data->sms_tpdu.data_length;i++)
607 printf("\t0x%02x",tst_data->sms_tpdu.data[i]);
612 tr_data.command_number = tst_data->command_detail.command_number;
613 tr_data.command_type = tst_data->command_detail.command_type;
614 /*tr_data.tr_data.setup_event_list.result.general_result = TAPI_SIMATK_R_SUCCESS;
615 tr_data.tr_data.setup_event_list.result.me_problem = 0x00;
616 printf(" [SAT] : send TR. command_number=%d, type=0x%x, gen_result=0x%x\n",
617 tr_data.command_number, tr_data.command_type,
618 tr_data.tr_data.setup_event_list.result.general_result);
619 tapi_simatk_send_terminal_response(&tr_data);*/
623 test_simatk_proactive_setup_evt_list(tapi_simatk_setup_event_list_ind_data_t* tst_data)
627 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
629 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
631 printf(" [SAT] : setup menu: setup event count = %d\n",tst_data->event_list.event_list_count);
632 for(i=0;i<tst_data->event_list.event_list_count;i++)
633 printf("\t#[%d], [event = 0x%02x]\n",i+1, tst_data->event_list.list[i]);
636 tr_data.command_number = tst_data->command_detail.command_number;
637 tr_data.command_type = tst_data->command_detail.command_type;
638 /*tr_data.tr_data.setup_event_list.result.general_result = TAPI_SIMATK_R_SUCCESS;
639 tr_data.tr_data.setup_event_list.result.me_problem = 0x00;
640 printf(" [SAT] : send TR. command_number=%d, type=0x%x, gen_result=0x%x\n",
641 tr_data.command_number, tr_data.command_type,
642 tr_data.tr_data.setup_event_list.result.general_result);
643 tapi_simatk_send_terminal_response(&tr_data);*/
647 test_simatk_proactive_send_ussd(tapi_simatk_send_ussd_ind_data_t* tst_data)
650 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
652 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
654 printf(" [SAT] : alpha_id present?= %d, alphaID: %s\n",tst_data->alpha_id.is_present, tst_data->alpha_id.string);
656 // printf(" [SAT] : USSD STRING - DCS: alpha format=0x%x, compressed format?=0x%x\n",tst_data->ussd_string.dcs.alphabet_format,tst_data->ussd_string.dcs.is_compressed_format);
658 printf(" [SAT] : USSD STRING - DCS: Raw DCS =0x%x\n",tst_data->ussd_string.raw_dcs);
660 printf(" [SAT] : USSD STRING: len = %d, USSD string = \n", tst_data->ussd_string.ussd_string_length);
662 for(i=0;i<tst_data->ussd_string.ussd_string_length;i++)
663 printf(" 0x%02x\t",tst_data->ussd_string.ussd_string[i]);
665 printf(" \n[SAT] : icon identifier: is icon present = %d, icon_id=%d\n",tst_data->icon_id.is_present, tst_data->icon_id.icon_identifier);
668 tr_data.command_number = tst_data->command_detail.command_number;
669 tr_data.command_type = tst_data->command_detail.command_type;
673 test_simatk_proactive_send_ss(tapi_simatk_send_ss_ind_data_t* tst_data)
676 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
678 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
680 printf(" [SAT] : alpha_id present?= %d, alphaID: %s\n",tst_data->alpha_id.is_present, tst_data->alpha_id.string);
682 printf(" [SAT] : SS STRING: ton=0x%x, npi=0x%x\n",tst_data->ss_string.ton,tst_data->ss_string.npi);
684 printf(" [SAT] : SS STRING: len = %d, ss string = %s\n", tst_data->ss_string.string_length, tst_data->ss_string.string);
686 printf(" \n[SAT] : icon identifier: is icon present = %d, icon_id=%d\n",tst_data->icon_id.is_present, tst_data->icon_id.icon_identifier);
689 tr_data.command_number = tst_data->command_detail.command_number;
690 tr_data.command_type = tst_data->command_detail.command_type;
694 test_simatk_proactive_setup_call(tapi_simatk_setup_call_ind_data_t* tst_data)
697 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
699 printf(" [SAT] : setup call :Qualifier = %d\n",tst_data->command_detail.u.cmd_quali_setup_call);
701 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
703 printf(" [SAT] : user confirmation phase: alpha_id present?= %d, alphaID: %s\n",tst_data->user_confirm_phase_alpha_id.is_present, tst_data->user_confirm_phase_alpha_id.string);
705 printf(" [SAT] : ADDRESS: ton=0x%x, npi=0x%x\n",tst_data->address.ton,tst_data->address.npi);
707 printf(" [SAT] : ADDRESS: len = %d, dialling Number = %s\n", tst_data->address.dialling_number_length, tst_data->address.dialling_number);
709 printf(" [SAT] : SUB ADDRESS: len = %d, data:\n",tst_data->sub_address.sub_address_len);
710 for(i=0;i<tst_data->sub_address.sub_address_len;i++)
711 printf("\t0x%02x",tst_data->sub_address.sub_address[i]);
714 printf(" [SAT] : CCP: len = %d, data:\n",tst_data->ccp.data_length);
715 for(i=0;i<tst_data->ccp.data_length;i++)
716 printf("\t0x%02x",tst_data->ccp.data[i]);
719 printf(" [SAT] : DURATION: interval=0x%x, time unit=0x%x\n",tst_data->duration.time_interval,tst_data->duration.time_unit);
721 printf(" [SAT] : call setup phase: alpha_id present?= %d, alphaID: %s\n",tst_data->call_setup_phase_alpha_id.is_present, tst_data->call_setup_phase_alpha_id.string);
723 printf(" \n[SAT] : user confirmation phase - icon identifier: is icon present = %d, icon_id=%d\n",tst_data->user_confirm_phase_icon_id.is_present, tst_data->user_confirm_phase_icon_id.icon_identifier);
725 printf(" \n[SAT] : call setup phase - icon identifier: is icon present = %d, icon_id=%d\n",tst_data->call_setup_phase_icon_id.is_present, tst_data->call_setup_phase_icon_id.icon_identifier);
728 tr_data.command_number = tst_data->command_detail.command_number;
729 tr_data.command_type = tst_data->command_detail.command_type;
730 /*tr_data.tr_data.setup_event_list.result.general_result = TAPI_SIMATK_R_SUCCESS;
731 tr_data.tr_data.setup_event_list.result.me_problem = 0x00;
732 printf(" [SAT] : send TR. command_number=%d, type=0x%x, gen_result=0x%x\n",
733 tr_data.command_number, tr_data.command_type,
734 tr_data.tr_data.setup_event_list.result.general_result);
735 //tapi_simatk_send_terminal_response(&tr_data);*/
739 test_simatk_proactive_select_item_list(tapi_simatk_select_item_ind_data_t* tst_data)
743 printf(" [SAT] : command detail: command_num=%d, command_type=0x%x\n",tst_data->command_detail.command_number,tst_data->command_detail.command_type);
745 printf(" [SAT] : command qualifier: prez_type = %d, selection_pref=%d, help_info=%d\n",tst_data->command_detail.u.cmd_quali_select_item.presentation_type,
746 tst_data->command_detail.u.cmd_quali_select_item.selection_preference,tst_data->command_detail.u.cmd_quali_select_item.is_help_info_available);
748 printf(" [SAT] : device identity: src=0x%x, dest=0x%x\n",tst_data->device_identities.source,tst_data->device_identities.destination);
750 printf(" [SAT] : alpha identifier: is_alpha_present=%d, rawdcs=0x%x, str_len=%d, string=%s\n", tst_data->alpha_id.is_present,
751 tst_data->alpha_id.dcs.raw_dcs, tst_data->alpha_id.string_len, tst_data->alpha_id.string);
753 printf(" [SAT] : items NAI: list count=%d \n [SAT] : items NAI:",tst_data->item_next_action_ind_list.list_count);
754 for(i=0; i<tst_data->item_next_action_ind_list.list_count;i++)
755 printf("\tnai_ind[%d] = 0x%02x",i, tst_data->item_next_action_ind_list.list[i]);
757 printf(" \n[SAT] : DEFAULT ITEM = %d\n",tst_data->default_item_identifier);
758 printf(" \n[SAT] : icon identifier: is icon present = %d, icon_id=%d\n",tst_data->icon_id.is_present, tst_data->icon_id.icon_identifier);
760 printf(" [SAT] : setup menu: item_count = %d\n",tst_data->menu_item_count);
761 for(i=0;i<tst_data->menu_item_count;i++)
762 printf("\tITEM#[%d]= %s, [item_id = %d]\n",i, tst_data->menu_item[i].text, tst_data->menu_item[i].item_id);
764 tr_data.command_number = tst_data->command_detail.command_number;
765 tr_data.command_type = tst_data->command_detail.command_type;
766 if(tst_data->command_detail.u.cmd_quali_select_item.is_help_info_available == TRUE)
767 tr_data.tr_data.select_item.item_identifier = 0x01;
771 test_select_item_send_tr(void)
773 tapi_simatk_resp_data_t tr_data;
778 //if(item_id > '0' && item_id <= '9')
780 char scabuf[5] = {0};
781 ret = read(0, scabuf, sizeof(scabuf));
790 memcpy(str, scabuf, (strlen(scabuf)));
795 tr_data.tr_data.select_item.result.general_result = TAPI_SIMATK_R_PROACTIVE_SESSION_TERMINATED_BY_USER;
796 tr_data.tr_data.select_item.other_info = FALSE;
798 /* else if(sel_item_data.menu_item_count < item )
800 printf(" [SAT] : ***input should be between 1 & %d\n",sel_item_data.menu_item_count);
801 tr_data.tr_data.select_item.result.general_result = TAPI_SIMATK_R_BACKWARD_MOVE_BY_USER;
802 tr_data.tr_data.select_item.other_info = FALSE;
807 tr_data.tr_data.select_item.result.general_result = TAPI_SIMATK_R_SUCCESS;
808 tr_data.tr_data.select_item.other_info = TRUE;
809 tr_data.tr_data.select_item.item_identifier = (unsigned char)item;
814 // printf(" [SAT] : ***INCORRECT INPUT\n");
815 // tr_data.tr_data.select_item.result.general_result = TAPI_SIMATK_R_PROACTIVE_SESSION_TERMINATED_BY_USER;
816 // tr_data.tr_data.select_item.other_info = FALSE;
820 tr_data.command_number = sel_item_data.command_detail.command_number;
821 tr_data.command_type = sel_item_data.command_detail.command_type;
823 tr_data.tr_data.select_item.result.me_problem = 0x00;
825 printf(" [SAT] : send TR. command_number=%d, type=0x%x, gen_result=0x%x, item_id=%d\n",
826 tr_data.command_number, tr_data.command_type,
827 tr_data.tr_data.select_item.result.general_result, item);
828 TelTapiSatSendUiUserConfirm(tr_data.command_number,tr_data.command_type,SAT_ENGINE_USER_CONFIRM_YES,&tr_data.tr_data.select_item.item_identifier,sizeof(TS_UINT8));
831 int isServerDied = 0;
832 /********************************************************************************/
835 int sat_read_key_input(void)
842 char dtmfStr[16] = "1000103001";
843 char normal[16] = "0103001";
849 ret = read(0, buf, sizeof(buf));
854 } else if (ret == 0) return ret;
857 printf("\n q : quit \n");
858 if(curr_cmd == TAPI_EVENT_SAT_SELECT_ITEM_IND)
859 printf(" si : select item terminal response \n");
860 if(curr_cmd == TAPI_EVENT_SAT_GET_INKEY_IND || curr_cmd == TAPI_EVENT_SAT_GET_INPUT_IND)
862 printf(" \"inkey\" or \"input\" : get inkey/input response \n");
863 printf(" \"tr\" : to send response other than success \n");
865 else if(curr_cmd != 0x00)
866 printf(" tr :Send TR for the current command = 0x%x \n",curr_cmd);
867 printf(" smhelp : envelope cmd help \n");
868 printf(" sm : envelope cmd select menu \n");
869 printf(" ed: event download\n");
870 printf(" cc: MO call control\n");
872 printf("--SAT_key_in : %s\n", buf);
874 if(strncmp(buf, "q", 1) == 0){
875 printf("### test program is terminated.\n");
880 if(strncmp(buf, "tr", 2) == 0)
882 char scabuf[5] = {0};
883 unsigned char input=0x00;
885 printf("general response 0x00 ~ 0x3d: 0x\n");
887 ret = read(0, scabuf, sizeof(scabuf));
897 input = (scabuf[0] -'0' )<< 4;
898 input |= (scabuf[1]-'0')&0x0F;
899 if(input >= 0x00 && input <= 0x3d)
906 else if(strncmp(buf, "smhelp", 6) == 0)
908 printf("\n select menu for help: \n");
909 test_simatk_send_menu_select_env(TRUE);
911 else if(strncmp(buf, "sm", 2) == 0)
913 printf("\n select menu: \n");
914 test_simatk_send_menu_select_env(FALSE);
917 else if(strncmp(buf, "si", 2) == 0)
919 printf("\n select item: \n");
920 test_select_item_send_tr();
922 else if(strncmp(buf, "ed", 2) == 0)
924 char scabuf[5] = {0};
925 printf(" id : idle screen \n");
926 printf(" ua : user activity \n");
927 printf(" ls: language selection\n");
928 printf(" bt: browser termination\n");
929 ret = read(0, scabuf, sizeof(scabuf));
939 if(strncmp(scabuf, "id", 2) == 0)
940 test_simatk_event_download(TAPI_SIMATK_EVENT_DW_TYPE_IDLE_SCREEN_AVAILABLE);
941 else if(strncmp(scabuf, "ua", 2) == 0)
942 test_simatk_event_download(TAPI_SIMATK_EVENT_DW_TYPE_USER_ACTIVITY);
943 else if(strncmp(scabuf, "ls", 2) == 0)
944 test_simatk_event_download(TAPI_SIMATK_EVENT_DW_TYPE_LANGUAGE_SELECTION);
945 else if(strncmp(scabuf, "bt", 2) == 0)
946 test_simatk_event_download(TAPI_SIMATK_EVENT_DW_TYPE_BROWSER_TERMINATION);
948 printf("no such event\n");
951 else if((strncmp(buf, "inkey", 5) == 0) ||(strncmp(buf, "input", 5) == 0))
953 char scabuf[255] = {0};
954 printf(" ONly one character for INKEY, between min and max for INPUT: \n");
955 printf(" plz read the command qualifier and provide the input accordingly... \n");
956 printf(" bk : backward move \n");
957 printf(" end : end proactive session \n");
958 printf(" INKEY: y OR n: for yes or no input\n");
959 printf(" input char/string:\n");
961 ret = read(0, scabuf, sizeof(scabuf));
971 if((strncmp(scabuf, "y", 1) == 0) || (strncmp(scabuf, "n", 1) == 0))
973 //tr_data.tr_data.get_inkey.result.general_result = 0x00;
974 tr_data.tr_data.get_inkey.text.dcs.msg_class = TAPI_SIMATK_MSG_CLASS_RESERVED;
975 tr_data.tr_data.get_inkey.text.dcs.alphabet_format = TAPI_SIMATK_ALPHABET_FROMAT_8BIT_DATA;
976 tr_data.tr_data.get_inkey.text.string_length = 1;
977 if(strncmp(scabuf, "y", 1) == 0)
978 tr_data.tr_data.get_inkey.text.string[0] = 0x01; //buf[0];
980 tr_data.tr_data.get_inkey.text.string[0] = 0x00;
981 tr_data.tr_data.get_inkey.text.string[1] = '\0';
982 //test_send_tr(tr_data.tr_data.get_inkey.result.general_result);
984 else if(strncmp(scabuf, "bk", 2) == 0)
986 tr_data.tr_data.get_inkey.result.general_result = 0x11;
988 else if(strncmp(scabuf, "end", 3) == 0)
990 tr_data.tr_data.get_inkey.result.general_result = 0x10;
994 if(strncmp(buf, "inkey", 5) == 0)
996 //tr_data.tr_data.get_inkey.result.general_result = 0x00;
997 tr_data.tr_data.get_inkey.text.dcs.msg_class = TAPI_SIMATK_MSG_CLASS_RESERVED;
998 tr_data.tr_data.get_inkey.text.dcs.alphabet_format = TAPI_SIMATK_ALPHABET_FROMAT_8BIT_DATA;
999 tr_data.tr_data.get_inkey.text.string_length = 1;
1000 tr_data.tr_data.get_inkey.text.string[0] = scabuf[0]; //buf[0];
1001 tr_data.tr_data.get_inkey.text.string[1] = '\0';
1007 //tr_data.tr_data.get_input.result.general_result = 0x00;
1008 tr_data.tr_data.get_input.text.dcs.msg_class = TAPI_SIMATK_MSG_CLASS_RESERVED;
1009 printf("inkey: input: %s\n",scabuf);
1010 while(scabuf[i] != 0xA)
1012 //printf("%c\n",scabuf[i]);
1015 if(tr_data.tr_data.get_input.text.dcs.alphabet_format == TAPI_SIMATK_ALPHABET_FROMAT_SMS_DEFAULT)
1017 tr_data.tr_data.get_input.text.string_length = (TS_UINT8)sat_util_pack_7bit(tr_data.tr_data.get_input.text.string, &scabuf[0], i );
1021 tr_data.tr_data.get_input.text.string_length = i;
1022 memcpy(tr_data.tr_data.get_input.text.string, &scabuf[0], tr_data.tr_data.get_input.text.string_length);
1027 test_send_tr(tr_data.tr_data.get_inkey.result.general_result);
1029 else if(strncmp(buf, "cc", 2) == 0)
1031 char scabuf[25] = {0};
1032 TelCallSetupParams_t si;
1034 memset(&si, 0, sizeof(si));
1035 si.CallType=TAPI_CALL_TYPE_VOICE;
1037 printf("number to be dialled:\n");
1039 ret = read(0, scabuf, sizeof(scabuf));
1049 memcpy(si.szNumber, &scabuf, strlen(scabuf));
1051 si.IdentityMode = TAPI_CALL_IDENTITY_SHOW; //default
1053 printf("send the call make message to server....%s", si.szNumber);
1055 //ret = tapi_call_setup(&si, &g_hCall);
1057 printf(" after calling tapi_call_setup : g_hCall - %d", g_hCall);
1059 printf(" Tapi return value is %d", ret);
1063 memcpy(&g_info.callNumber, si.szNumber, sizeof( si.szNumber));
1069 if(strncmp(buf, "prof", 4) == 0){
1070 test_simatk_profile_download();
1071 } else if(strncmp(buf, "env", 3) == 0){
1072 test_simatk_envelope_send();
1073 } else if(strncmp(buf, "ed", 2) == 0){
1074 test_simatk_event_send();
1075 } else if(strncmp(buf, "sm", 2) == 0) {
1078 sendEnvelopeCmd_SetupMenu(FALSE, atoi(buf));
1079 } else if(strncmp(buf, "si", 2) == 0) {
1082 sendTerminalResponse_SelectItem(0x00, TRUE, atoi(buf), 0, NULL);
1088 if(strncmp(buf, "menu", 4) == 0)
1090 printf("Finished Testing this module, Going back to Main Menu\n");
1096 memset(buf, '\0', 256);
1102 /********************************************************************************/
1103 static int app_callback(TelTapiEventClass_t eventClass, TelTapiEventType_t eventType, /*length*/int param1,/*pDate*/void * param2)
1106 //unsigned char *buf= (unsigned char*) param2;
1108 //unsigned char *count = buf;
1111 printf("\n [SAT] app_callback( eventType=0x%02x) \n", eventType);
1113 printf(" eventClass: %d, eventType: %d[%02x], paramLength = %d\n", eventClass, eventType, eventType, param1);
1115 for( i=0; i<param1; i++ ) printf("[%02x] ", buf[i]);
1116 printf("\n --------------- ------ \n");
1122 case TAPI_EVENT_CLASS_SAT:
1125 case TAPI_EVENT_SAT_END_PROACTIVE_SESSION_IND:
1126 printf("[SAT] TAPI_EVENT_SAT_END_PROACTIVE_SESSION_IND.\n");
1129 case TAPI_EVENT_SAT_DISPLAY_TEXT_IND:
1131 tapi_simatk_display_text_ind_data_t tst_data;
1132 tapi_simatk_resp_data_t tr_data;
1133 curr_cmd = eventType;
1135 printf(" [SAT] TAPI_EVENT_SAT_DISPLAY_TEXT_IND: \n");
1136 //test_display_text_data.data_len = param1;
1137 memcpy(&tst_data, param2, sizeof(tapi_simatk_display_text_ind_data_t));
1139 test_simatk_proactive_display_text(&tst_data);
1144 case TAPI_EVENT_SAT_UI_SETUP_MENU_IND:
1146 tapi_simatk_setup_menu_ind_data_t tst_data;
1147 curr_cmd = eventType;
1149 printf(" [SAT] TAPI_EVENT_SAT_UI_SETUP_MENU_IND: \n");
1150 memcpy(&tst_data, param2, sizeof(tapi_simatk_setup_menu_ind_data_t));
1152 test_simatk_proactive_setup_menu(&tst_data);
1156 case TAPI_SIMATK_EVENT_SETUP_EVENT_LIST_IND:
1158 tapi_simatk_setup_event_list_ind_data_t tst_data;
1160 curr_cmd = eventType;
1161 printf(" [SAT] TAPI_SIMATK_EVENT_SETUP_EVENT_LIST_IND: \n");
1162 memcpy(&tst_data, param2, sizeof(tapi_simatk_setup_event_list_ind_data_t));
1164 test_simatk_proactive_setup_evt_list(&tst_data);
1168 case TAPI_EVENT_SAT_UI_REFRESH_IND:
1170 tapi_simatk_refresh_ind_data_t tst_data;
1172 curr_cmd = eventType;
1173 printf(" [SAT] TAPI_EVENT_SAT_UI_REFRESH_IND: \n");
1174 memcpy(&tst_data, param2, sizeof(tapi_simatk_refresh_ind_data_t));
1176 test_simatk_proactive_refresh(&tst_data);
1180 case TAPI_EVENT_SAT_SELECT_ITEM_IND:
1182 printf(" [SAT] TAPI_EVENT_SAT_SELECT_ITEM_IND: \n");
1183 memcpy(&sel_item_data, param2, sizeof(tapi_simatk_select_item_ind_data_t));
1184 curr_cmd = eventType;
1185 test_simatk_proactive_select_item_list(&sel_item_data);
1189 case TAPI_EVENT_SAT_UI_SEND_SMS_IND:
1191 tapi_simatk_send_sms_ind_data_t tst_data;
1192 curr_cmd = eventType;
1193 printf(" [SAT] TAPI_EVENT_SAT_UI_SEND_SMS_IND: \n");
1194 memcpy(&tst_data, param2, sizeof(tapi_simatk_send_sms_ind_data_t));
1196 test_simatk_proactive_send_sms(&tst_data);
1200 case TAPI_EVENT_SAT_UI_SETUP_CALL_IND:
1202 tapi_simatk_setup_call_ind_data_t tst_data;
1203 curr_cmd = eventType;
1204 printf(" [SAT] TAPI_EVENT_SAT_UI_SETUP_CALL_IND: \n");
1205 memcpy(&tst_data, param2, sizeof(tapi_simatk_setup_call_ind_data_t));
1206 test_simatk_proactive_setup_call(&tst_data);
1210 case TAPI_EVENT_SAT_UI_SEND_SS_IND:
1212 tapi_simatk_send_ss_ind_data_t tst_data;
1213 curr_cmd = eventType;
1214 printf(" [SAT] TAPI_EVENT_SAT_UI_SEND_SS_IND: \n");
1215 memcpy(&tst_data, param2, sizeof(tapi_simatk_send_ss_ind_data_t));
1216 test_simatk_proactive_send_ss(&tst_data);
1220 case TAPI_EVENT_SAT_UI_SEND_USSD_IND:
1222 tapi_simatk_send_ussd_ind_data_t tst_data;
1223 curr_cmd = eventType;
1224 printf(" [SAT] TAPI_EVENT_SAT_UI_SEND_USSD_IND: \n");
1225 memcpy(&tst_data, param2, sizeof(tapi_simatk_send_ussd_ind_data_t));
1226 test_simatk_proactive_send_ussd(&tst_data);
1230 case TAPI_EVENT_SAT_GET_INKEY_IND:
1232 tapi_simatk_get_inkey_ind_data_t tst_data;
1233 curr_cmd = eventType;
1234 printf(" [SAT] TAPI_EVENT_SAT_GET_INKEY_IND: \n");
1235 memcpy(&tst_data, param2, sizeof(tapi_simatk_get_inkey_ind_data_t));
1236 test_simatk_proactive_get_inkey(&tst_data);
1240 case TAPI_EVENT_SAT_GET_INPUT_IND:
1242 tapi_simatk_get_input_ind_data_t tst_data;
1243 curr_cmd = eventType;
1244 printf(" [SAT] TAPI_EVENT_SAT_GET_INPUT_IND: \n");
1245 memcpy(&tst_data, param2, sizeof(tapi_simatk_get_inkey_ind_data_t));
1246 test_simatk_proactive_get_input(&tst_data);
1250 case TAPI_EVENT_SAT_PLAY_TONE_IND :
1252 tapi_simatk_play_tone_ind_data_t tst_data;
1253 curr_cmd = eventType;
1254 printf(" [SAT] TAPI_EVENT_SAT_PLAY_TONE_IND : \n");
1255 memcpy(&tst_data, param2, sizeof(tapi_simatk_play_tone_ind_data_t));
1256 test_simatk_proactive_play_tone(&tst_data);
1260 case TAPI_EVENT_SAT_UI_SEND_DTMF_IND:
1262 tapi_simatk_send_dtmf_ind_data_t tst_data;
1263 curr_cmd = eventType;
1264 printf(" [SAT] TAPI_EVENT_SAT_UI_SEND_DTMF_IND: \n");
1265 memcpy(&tst_data, param2, sizeof(tapi_simatk_send_dtmf_ind_data_t));
1266 test_simatk_proactive_send_dtmf(&tst_data);
1270 case TAPI_EVENT_SAT_SETUP_IDLE_MODE_TEXT_IND:
1272 tapi_simatk_setup_idle_mode_text_ind_data_t tst_data;
1273 curr_cmd = eventType;
1274 printf(" [SAT] TAPI_EVENT_SAT_SETUP_IDLE_MODE_TEXT_IND: \n");
1275 memcpy(&tst_data, param2, sizeof(tapi_simatk_setup_idle_mode_text_ind_data_t));
1276 test_simatk_proactive_setup_idle_mode_text(&tst_data);
1280 case TAPI_EVENT_SAT_PROVIDE_LOCAL_INFO_IND:
1282 tapi_simatk_provide_local_info_ind_data_t tst_data;
1283 curr_cmd = eventType;
1284 printf(" [SAT] TAPI_EVENT_SAT_PROVIDE_LOCAL_INFO_IND: \n");
1285 memcpy(&tst_data, param2, sizeof(tapi_simatk_provide_local_info_ind_data_t));
1286 test_simatk_proactive_provide_local_info(&tst_data);
1291 case TAPI_EVENT_SAT_LANGUAGE_NOTIFICATION_IND:
1293 tapi_simatk_language_notification_ind_data_t tst_data;
1294 curr_cmd = eventType;
1295 printf(" [SAT] TAPI_EVENT_SAT_PROVIDE_LOCAL_INFO_IND: \n");
1296 memcpy(&tst_data, param2, sizeof(tapi_simatk_language_notification_ind_data_t));
1297 test_simatk_proactive_lang_noti(&tst_data);
1302 case TAPI_EVENT_SAT_CALL_CONTROL_IND:
1304 tapi_simatk_call_control_cnf_data_t cc_result;
1306 memcpy(&cc_result, param2, sizeof(tapi_simatk_call_control_cnf_data_t));
1307 printf(" [SAT] TAPI_EVENT_SAT_CALL_CONTROL_IND: \n");
1308 curr_cmd = eventType;
1310 printf(" [SAT] : call type=0x%x, call control result: 0x%x\n",cc_result.call_type, cc_result.call_control_result);
1312 printf(" [SAT] : alpha_present=%d, alpha_len=%d, alpha_text=%s\n",cc_result.alpha_identifier.is_present, cc_result.alpha_identifier.string_len, cc_result.alpha_identifier.string);
1314 if(cc_result.call_control_result == SIMATK_CALL_CONTROL_R_ALLOWED_WITH_MOD)
1316 if(cc_result.call_type == TAPI_SIMATK_CALL_TYPE_MO_VOICE)
1318 if(cc_result.u.voice_call_data.address.dialling_number_length > 0)
1320 printf(" [SAT] : TON = 0x%x, NPI = 0x%x\n",cc_result.u.voice_call_data.address.ton, cc_result.u.voice_call_data.address.npi);
1321 printf(" [SAT] : ADDRESS: len=%d, value =", cc_result.u.voice_call_data.address.dialling_number_length);
1322 for(i=0; i<cc_result.u.voice_call_data.address.dialling_number_length;i++)
1323 printf("\t0x%02x",cc_result.u.voice_call_data.address.dialling_number[i]);
1326 if(cc_result.u.voice_call_data.sub_address.sub_address_len > 0)
1328 printf(" [SAT] : SUBADDRESS: len=%d, value =", cc_result.u.voice_call_data.sub_address.sub_address_len);
1329 for(i=0; i<cc_result.u.voice_call_data.sub_address.sub_address_len;i++)
1330 printf("\t0x%02x",cc_result.u.voice_call_data.sub_address.sub_address[i]);
1333 printf(" [SAT] : SUBADDRESS NOT PRESENT ");
1335 printf(" [SAT] : BC REPEAT IND: %d", cc_result.u.voice_call_data.bc_repeat_indicator);
1337 if(cc_result.u.voice_call_data.ccp1.data_length > 0)
1339 printf(" [SAT] : CCP1: len=%d, value =", cc_result.u.voice_call_data.ccp1.data_length);
1340 for(i=0; i<cc_result.u.voice_call_data.ccp1.data_length;i++)
1341 printf("\t0x%02x",cc_result.u.voice_call_data.ccp1.data[i]);
1344 printf(" [SAT] : CCP1 NOT PRESENT ");
1346 if(cc_result.u.voice_call_data.ccp2.data_length > 0)
1348 printf(" [SAT] : CCP2: len=%d, value =", cc_result.u.voice_call_data.ccp2.data_length);
1349 for(i=0; i<cc_result.u.voice_call_data.ccp2.data_length;i++)
1350 printf("\t0x%02x",cc_result.u.voice_call_data.ccp2.data[i]);
1353 printf(" [SAT] : CCP2 NOT PRESENT ");
1357 if(cc_result.u.ss_data.ss_string.string_length > 0)
1359 printf(" [SAT] : TON = 0x%x, NPI = 0x%x\n",cc_result.u.ss_data.ss_string.ton, cc_result.u.ss_data.ss_string.npi);
1360 printf(" [SAT] : ADDRESS: len=%d, value =", cc_result.u.ss_data.ss_string.string_length);
1361 for(i=0; i<cc_result.u.ss_data.ss_string.string_length;i++)
1362 printf("\t0x%02x",cc_result.u.ss_data.ss_string.string[i]);
1365 if(cc_result.u.ss_data.sub_address.sub_address_len > 0)
1367 printf(" [SAT] : SUBADDRESS: len=%d, value =", cc_result.u.ss_data.sub_address.sub_address_len);
1368 for(i=0; i<cc_result.u.ss_data.sub_address.sub_address_len;i++)
1369 printf("\t0x%02x",cc_result.u.ss_data.sub_address.sub_address[i]);
1372 printf(" [SAT] : SUBADDRESS NOT PRESENT ");
1374 printf(" [SAT] : BC REPEAT IND: %d", cc_result.u.ss_data.bc_repeat_indicator);
1376 if(cc_result.u.ss_data.ccp1.data_length > 0)
1378 printf(" [SAT] : CCP1: len=%d, value =", cc_result.u.ss_data.ccp1.data_length);
1379 for(i=0; i<cc_result.u.ss_data.ccp1.data_length;i++)
1380 printf("\t0x%02x",cc_result.u.ss_data.ccp1.data[i]);
1383 printf(" [SAT] : CCP1 NOT PRESENT ");
1385 if(cc_result.u.ss_data.ccp2.data_length > 0)
1387 printf(" [SAT] : CCP2: len=%d, value =", cc_result.u.ss_data.ccp2.data_length);
1388 for(i=0; i<cc_result.u.ss_data.ccp2.data_length;i++)
1389 printf("\t0x%02x",cc_result.u.ss_data.ccp2.data[i]);
1392 printf(" [SAT] : CCP2 NOT PRESENT ");
1397 case TAPI_EVENT_SAT_MO_SMS_CONTROL_IND:
1399 tapi_simatk_call_control_cnf_data_t sm_result;
1402 memcpy(&sm_result, param2, sizeof(tapi_simatk_call_control_cnf_data_t));
1403 printf(" [SAT] TAPI_EVENT_SAT_MO_SMS_CONTROL_IND: \n");
1404 curr_cmd = eventType;
1406 printf(" [SAT] : call type=0x%x, MO SM control result: 0x%x\n",sm_result.call_type, sm_result.call_control_result);
1408 printf(" [SAT] : alpha_present=%d, alpha_len=%d, alpha_text=%s\n",sm_result.alpha_identifier.is_present, sm_result.alpha_identifier.string_len, sm_result.alpha_identifier.string);
1410 if(sm_result.u.sms_data.rp_dest_address.dialling_number_length > 0)
1412 printf(" [SAT] : TON = 0x%x, NPI = 0x%x\n",sm_result.u.sms_data.rp_dest_address.ton, sm_result.u.sms_data.rp_dest_address.npi);
1414 printf(" [SAT] :RPD ADDRESS: len=%d, value =", sm_result.u.sms_data.rp_dest_address.dialling_number_length);
1415 for(i=0; i<sm_result.u.sms_data.rp_dest_address.dialling_number_length;i++)
1416 printf("\t0x%02x",sm_result.u.sms_data.rp_dest_address.dialling_number[i]);
1419 printf("RP Dest Address Not Present");
1422 if(sm_result.u.sms_data.tp_dest_address.dialling_number_length > 0)
1424 printf(" [SAT] : TON = 0x%x, NPI = 0x%x\n",sm_result.u.sms_data.tp_dest_address.ton, sm_result.u.sms_data.tp_dest_address.npi);
1426 printf(" [SAT] :TPD ADDRESS: len=%d, value =", sm_result.u.sms_data.tp_dest_address.dialling_number_length);
1427 for(i=0; i<sm_result.u.sms_data.tp_dest_address.dialling_number_length;i++)
1428 printf("\t0x%02x",sm_result.u.sms_data.tp_dest_address.dialling_number[i]);
1431 printf("TP Dest Address Not Present");
1443 printf(" NOT a simatk event\n");
1447 printf("\n [SAT] end of app_callback(sat_test/main.c) \n");
1456 /*****************************************************************/
1458 void sat_select_loop(void)
1462 // fprintf(stderr,"sat Select Loop!\n");
1467 FD_SET(0, &readfds);
1469 ret = select(0 + 1, &readfds, NULL, NULL, NULL);
1472 if (FD_ISSET(0, &readfds))
1474 if(sat_read_key_input()<0)
1481 void tapi_sat_thread()
1483 fprintf(stderr,"start tapi_sat_thread\n");
1485 fprintf (stderr, " sat exited\n");
1489 bool on_simatk_event_received (EvtSysEventSourceId_t src_id, const char* noti_id, GArray* parameters, void* local_data)
1491 EvtSysEventProperty_t* e;
1497 /* Number of params must be 5 */
1498 assert(parameters->len == 5);
1500 /* First param is tapi event group */
1501 e = &g_array_index (parameters, EvtSysEventProperty_t, 0);
1502 assert(e->type == DBUS_TYPE_INT32);
1504 printf("received group is :%d\n", group);
1506 /* First param is tapi event type */
1507 e = &g_array_index (parameters, EvtSysEventProperty_t, 1);
1508 assert(e->type == DBUS_TYPE_INT32);
1510 printf("received event type is :%d\n", type);
1512 e = &g_array_index (parameters, EvtSysEventProperty_t, 2);
1513 assert(e->type == DBUS_TYPE_INT32);
1515 printf("received Request ID is :%d\n", reqid);
1517 e = &g_array_index (parameters, EvtSysEventProperty_t, 3);
1518 assert(e->type == DBUS_TYPE_INT32);
1519 status = e->value.i;
1520 printf("received STATUS is :%d\n", status);
1522 /* over allocate this after receiving the len */
1523 unsigned char *data;
1524 unsigned char *result;
1527 /* Get the tapi event data here */
1528 e = &g_array_index (parameters, EvtSysEventProperty_t, 4);
1529 assert(e->type == DBUS_TYPE_STRING);
1535 printf("Decoding..\n");
1537 result = TAPI_BASE64_DECODE(data, len, &out_len);
1539 app_callback(group, type, len, result);
1540 /* clean the buffer */
1541 // memset(result2, NULL, (sdata->len*2));
1543 /* We've done with this notificaiton */
1549 int sat_test_subscribe_tapi_events(void)
1552 //GMainLoop *mainloop;
1554 noti_subscription_id_t subscription_id;
1558 fprintf(stderr, " GMAIN LOOP\n");
1560 if (! noti_init(&error_code))
1562 fprintf(stderr, "Error x_noti_init():%#X \n", error_code);
1565 printf("receive_tapi_event: noti init success\n");
1568 for(count =0;count<sizeof(ptrEvnts)/sizeof(*ptrEvnts);count++)
1570 error_code = EvtSysEventSubscribe (
1572 ptrEvnts[count], /* notification ID */
1573 NULL, /* filter expression */
1574 on_simatk_event_received, /* notification handler */
1575 (void *)&sdata, /* local data */
1576 &subscription_id /* subscription ID */
1580 fprintf(stderr, "Error x_noti_set_cb():%#X \n", error_code);
1583 fprintf(stderr, "SIMATK-not subscribe ok for [%d]\n", count);
1587 if (! noti_subscribe (
1588 ptrEvnts[count], /* notification ID */
1589 NULL, /* filter expression */
1590 on_simatk_event_received, /* notification handler */
1591 (void *)&sdata, /* local data */
1592 &subscription_id, /* subscription ID */
1595 fprintf(stderr, "Error x_noti_set_cb():%#X \n", error_code);
1598 fprintf(stderr, "SIMATK-not subscribe ok for [%d]\n", count);
1604 printf("receive_tapi_event: noti subscribe is success\n");
1606 mainloop = g_main_loop_new (NULL, FALSE);
1608 g_main_loop_run (mainloop);
1610 printf("receive_tapi_event: finish\n");
1618 int sat_main(int argc, char *argv[])
1621 pthread_t sat_thread_id;
1623 printf("\n\n\n ===== SAT TEST main* =====\n");
1626 //fprintf(stderr,"out of get handle\n");
1628 ret = pthread_create(&sat_thread_id, NULL, &tapi_sat_thread, NULL);
1632 fprintf(stderr, "Thread for TAPI Events Failed\n");
1635 sat_test_subscribe_tapi_events();
1637 pthread_join(sat_thread_id, NULL);