Merge "Fix build error using gcc 13" into tizen
[platform/core/telephony/libtapi.git] / test_src / ss.c
1 /*
2  * libslp-tapi
3  *
4  * Copyright (c) 2014 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 <ITapiSs.h>
30 #include <TapiUtility.h>
31
32 #include "menu.h"
33 #include "ss.h"
34
35 static char data_ss_set_barring_class[MENU_DATA_SIZE + 1] = "16";
36 static char data_ss_set_barring_mode[MENU_DATA_SIZE + 1] = "0";
37 static char data_ss_set_barring_type[MENU_DATA_SIZE + 1] = "1";
38 static char data_ss_set_barring_password[MENU_DATA_SIZE + 1] = "1111";
39
40 static char data_ss_get_barring_status_class[MENU_DATA_SIZE + 1] = "16";
41 static char data_ss_get_barring_status_type[MENU_DATA_SIZE + 1] = "1";
42
43 static char data_ss_change_barring_password_old[MENU_DATA_SIZE + 1] = "1111";
44 static char data_ss_change_barring_password_new[MENU_DATA_SIZE + 1] = "1234";
45
46 static char data_ss_set_forward_class[MENU_DATA_SIZE + 1] = "16";
47 static char data_ss_set_forward_mode[MENU_DATA_SIZE + 1] = "1";
48 static char data_ss_set_forward_condition[MENU_DATA_SIZE + 1] = "5";
49 static char data_ss_set_forward_timer[MENU_DATA_SIZE + 1] = "5";
50 static char data_ss_set_forward_number[MENU_DATA_SIZE + 1] = "01030018655";
51
52 static char data_ss_get_forward_status_class[MENU_DATA_SIZE + 1] = "16";
53 static char data_ss_get_forward_status_condition[MENU_DATA_SIZE + 1] = "1";
54
55 static char data_ss_set_waiting_class[MENU_DATA_SIZE + 1] = "16";
56 static char data_ss_set_waiting_mode[MENU_DATA_SIZE + 1] = "0";
57
58 static char data_ss_get_waiting_status_class[MENU_DATA_SIZE + 1] = "16";
59
60 static char data_ss_get_cli_status_type[MENU_DATA_SIZE + 1] = "1";
61 static char data_ss_set_cli_status_type[MENU_DATA_SIZE + 1] = "1";
62 static char data_ss_set_cli_status[MENU_DATA_SIZE + 1] = "1";
63
64 static char data_ss_ussd_request_type[MENU_DATA_SIZE + 1] = "1";
65 static char data_ss_ussd_request_string[MENU_DATA_SIZE + 1] = "";
66
67 static void on_noti_ss_ussd(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
68 {
69         TelSsUssdMsgInfo_t *noti = data;
70
71         msg("");
72         msgb("event(%s) receive !!", TAPI_NOTI_SS_USSD);
73
74         if (!noti)
75                 return;
76
77         msg(" - Type = 0x%x", noti->Type);
78         msg(" - Length = 0x%x", noti->Length);
79         msg(" - szString = %s", noti->szString);
80 }
81
82 static void on_noti_ss_release_complete(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
83 {
84         TelSsRelCompMsgInfo_t *info = data;
85         int i = 0;
86
87         msg("");
88         msgb("event(%s) receive !!", TAPI_NOTI_SS_RELEASE_COMPLETE);
89
90
91         msg(" - info->RelCompMsgLen = 0x%x", info->RelCompMsgLen);
92         msg(" - info->szRelCompMsg = ");
93         for (i = 0; i < info->RelCompMsgLen; i++)
94                 msg("%d : [%x]", i, info->szRelCompMsg[i]);
95 }
96
97 static void on_noti_ss_forwarding_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
98 {
99         TelSsForwardNoti_t *noti = data;
100         int i = 0;
101
102         msg("SS Forwarding Status Noti");
103
104         for (i = 0; i < noti->record_num; i++) {
105                 msg("class : %d", noti->record[i].Class);
106                 msg("status : %d", noti->record[i].Status);
107                 msg("condition : %d", noti->record[i].ForwardCondition);
108                 msg("number present : %d", noti->record[i].bCallForwardingNumberPresent);
109                 msg("no reply time : %d", noti->record[i].NoReplyWaitTime);
110                 msg("ton : %d", noti->record[i].Ton);
111                 msg("npi : %d", noti->record[i].Npi);
112                 msg("number : %s", noti->record[i].szCallForwardingNumber);
113                 msg("");
114         }
115
116 }
117
118 static void on_noti_ss_barring_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
119 {
120         TelSsBarringNoti_t *noti = data;
121         int i = 0;
122
123         msg("SS Barring Status Noti");
124
125         for (i = 0; i < noti->record_num; i++) {
126                 msg("class : %d", noti->record[i].Class);
127                 msg("status : %d", noti->record[i].Status);
128                 msg("type : %d", noti->record[i].Flavour);
129                 msg("");
130         }
131
132 }
133
134 static void on_noti_ss_waiting_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
135 {
136         TelSsWaitingNoti_t *noti = data;
137         int i = 0;
138
139         msg("SS Waiting Status Noti");
140
141         for (i = 0; i < noti->record_num; i++) {
142                 msg("class : %d", noti->record[i].Class);
143                 msg("status : %d", noti->record[i].Status);
144                 msg("");
145         }
146 }
147
148 static void on_noti_ss_sups_info(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
149 {
150         TelSsInfo_t *noti = data;
151
152         msg("SS SUPS Info Noti");
153
154         msg("SS error : %d", noti->Cause);
155         msg("status : %d", noti->SsType);
156         msg("");
157 }
158
159 static void on_ss_barring(TapiHandle *handle, int result, void *data, void *user_data)
160 {
161         TelSsBarringResp_t *resp = data;
162         int i = 0;
163
164         msg("");
165         msgb("tel_set_ss_barring() or tel_get_ss_barring_status() response receive");
166         msg(" - result = 0x%x", result);
167
168         if (!resp)
169                 return;
170
171         msg(" - record_num = %d", resp->record_num);
172
173         for (i = 0; i < resp->record_num; i++) {
174                 msg(" - [%d] Class=%d, Status=%d, Flavour=%d",
175                                 i,
176                                 resp->record[i].Class,
177                                 resp->record[i].Status,
178                                 resp->record[i].Flavour);
179         }
180 }
181
182 static void on_ss_change_barring_password(TapiHandle *handle, int result, void *data, void *user_data)
183 {
184         msg("");
185         msgb("tel_change_ss_barring_password() response receive");
186         msg(" - result = 0x%x", result);
187 }
188
189 static void on_ss_forward(TapiHandle *handle, int result, void *data, void *user_data)
190 {
191         TelSsForwardResp_t *resp = data;
192         int i;
193
194         msg("");
195         msgb("tel_set_ss_forward() or tel_get_ss_forward_status() response receive");
196         msg(" - result = 0x%x", result);
197
198         if (!resp)
199                 return;
200
201         msg(" - record_num = %d", resp->record_num);
202
203         for (i = 0; i < resp->record_num; i++) {
204                 msg(" - [%d] Class=%d, Status=%d, ForwardCondition=%d, NoReplyWaitTime=%d, bCallForwardingNumberPresend=%d, szCallForwardingNumber=[%s]",
205                                 i,
206                                 resp->record[i].Class,
207                                 resp->record[i].Status,
208                                 resp->record[i].ForwardCondition,
209                                 resp->record[i].NoReplyWaitTime,
210                                 resp->record[i].bCallForwardingNumberPresent,
211                                 resp->record[i].szCallForwardingNumber);
212         }
213 }
214
215 static void on_ss_waiting(TapiHandle *handle, int result, void *data, void *user_data)
216 {
217         TelSsWaitingResp_t *resp = data;
218         int i;
219
220         msg("");
221         msgb("tel_set_ss_waiting() or tel_get_ss_waiting_status() response receive");
222         msg(" - result = 0x%x", result);
223
224         if (!resp)
225                 return;
226
227         msg(" - record_num = %d", resp->record_num);
228
229         for (i = 0; i < resp->record_num; i++) {
230                 msg(" - [%d] Class=%d, Status=%d",
231                                 i,
232                                 resp->record[i].Class,
233                                 resp->record[i].Status);
234         }
235 }
236
237 static void on_ss_set_cli_status(TapiHandle *handle, int result, void *data, void *user_data)
238 {
239         msg("");
240         msgb("tel_set_ss_cli_status() response receive");
241         msg(" - result = 0x%x", result);
242         return;
243 }
244
245 static void on_ss_get_cli_status(TapiHandle *handle, int result, void *data, void *user_data)
246 {
247         TelSsCliResp_t *resp = data;
248
249         msg("");
250         msgb("tel_get_ss_cli_status() response receive");
251         msg(" - result = 0x%x", result);
252
253         if (!resp)
254                 return;
255
256         msg(" - type = %d", resp->Type);
257         msg(" - status = %d", resp->Status);
258 }
259
260 static void on_ss_send_ussd_request(TapiHandle *handle, int result, void *data, void *user_data)
261 {
262         TelSsUssdResp_t *resp = data;
263
264         msg("");
265         msgb("tel_send_ss_ussd_request() response receive");
266         msg(" - result = 0x%x", result);
267
268         if (!resp)
269                 return;
270
271         msg(" - type = %d", resp->Type);
272         msg(" - status = %d", resp->Status);
273         msg(" - length = %d", resp->Length);
274         msg(" - string = [%s]", resp->szString);
275 }
276
277 static int run_ss_set_barring(MManager *mm, struct menu_data *menu)
278 {
279         TapiHandle *handle = menu_manager_ref_user_data(mm);
280         int result;
281         TelSsBarringInfo_t info;
282
283         msg("call tel_set_ss_barring()");
284
285         memset(&info, 0, sizeof(TelSsBarringInfo_t));
286         info.Class = atoi(data_ss_set_barring_class);
287         info.Mode = atoi(data_ss_set_barring_mode);
288         info.Type = atoi(data_ss_set_barring_type);
289         g_strlcpy(info.szPassword, data_ss_set_barring_password, TAPI_SS_GSM_BARR_PW_LEN_MAX+1);
290
291         msg("info.szPassword - %s data_ss_set_barring_password- %s\n", info.szPassword, data_ss_set_barring_password);
292
293         result = tel_set_ss_barring(handle, &info, on_ss_barring, NULL);
294         if (result != TAPI_API_SUCCESS)
295                 msg("failed. (result = %d)", result);
296
297         return 0;
298 }
299
300 static int run_ss_get_barring_status(MManager *mm, struct menu_data *menu)
301 {
302         TapiHandle *handle = menu_manager_ref_user_data(mm);
303         int result;
304         TelSsClass_t class;
305         TelSsBarringType_t type;
306
307         msg("call tel_get_ss_barring_status()");
308
309         class = atoi(data_ss_get_barring_status_class);
310         type = atoi(data_ss_get_barring_status_type);
311
312         result = tel_get_ss_barring_status(handle, class, type, on_ss_barring, NULL);
313         if (result != TAPI_API_SUCCESS)
314                 msg("failed. (result = %d)", result);
315
316         return 0;
317 }
318
319 static int run_ss_change_barring_password(MManager *mm, struct menu_data *menu)
320 {
321         TapiHandle *handle = menu_manager_ref_user_data(mm);
322         int result;
323
324         msg("call tel_change_ss_barring_password()");
325
326         result = tel_change_ss_barring_password(handle,
327                         data_ss_change_barring_password_old,
328                         data_ss_change_barring_password_new,
329                         data_ss_change_barring_password_new,
330                         on_ss_change_barring_password, NULL);
331         if (result != TAPI_API_SUCCESS)
332                 msg("failed. (result = %d)", result);
333
334         return 0;
335 }
336
337 static int run_ss_set_forward(MManager *mm, struct menu_data *menu)
338 {
339         TapiHandle *handle = menu_manager_ref_user_data(mm);
340         int result;
341         TelSsForwardInfo_t info;
342         int len;
343
344         msg("call tel_set_ss_forward()");
345
346         len = strlen(data_ss_set_forward_number);
347         if (len >= TAPI_CALL_DIALDIGIT_LEN_MAX - 1) {
348                 msg("failed. forward_number too long");
349                 return 0;
350         }
351
352         memset(&info, 0, sizeof(TelSsForwardInfo_t));
353         info.Class = atoi(data_ss_set_forward_class);
354         info.Condition = atoi(data_ss_set_forward_condition);
355         info.NoReplyConditionTimer = atoi(data_ss_set_forward_timer);
356         info.Mode = atoi(data_ss_set_forward_mode);
357         info.Ton = 0x01;
358         info.Npi = 0x01;
359         strncpy((char *)info.szPhoneNumber, data_ss_set_forward_number, len);
360         info.szPhoneNumber[len] = '\0';
361
362         result = tel_set_ss_forward(handle, &info, on_ss_forward, NULL);
363         if (result != TAPI_API_SUCCESS)
364                 msg("failed. (result = %d)", result);
365
366         return 0;
367 }
368
369 static int run_ss_get_forward_status(MManager *mm, struct menu_data *menu)
370 {
371         TapiHandle *handle = menu_manager_ref_user_data(mm);
372         int result;
373         TelSsClass_t class;
374         TelSsForwardWhen_t condition;
375
376         msg("call tel_get_ss_forward_status()");
377
378         class = atoi(data_ss_get_forward_status_class);
379         condition = atoi(data_ss_get_forward_status_condition);
380
381         result = tel_get_ss_forward_status(handle, class, condition, on_ss_forward, NULL);
382         if (result != TAPI_API_SUCCESS)
383                 msg("failed. (result = %d)", result);
384
385         return 0;
386 }
387
388 static int run_ss_set_waiting(MManager *mm, struct menu_data *menu)
389 {
390         TapiHandle *handle = menu_manager_ref_user_data(mm);
391         int result;
392         TelSsWaitingInfo_t info;
393
394         msg("call tel_set_ss_waiting()");
395
396         memset(&info, 0, sizeof(TelSsWaitingInfo_t));
397         info.Class = atoi(data_ss_set_waiting_class);
398         info.Mode = atoi(data_ss_set_waiting_mode);
399
400         result = tel_set_ss_waiting(handle, &info, on_ss_waiting, NULL);
401         if (result != TAPI_API_SUCCESS)
402                 msg("failed. (result = %d)", result);
403
404         return 0;
405 }
406
407 static int run_ss_get_waiting_status(MManager *mm, struct menu_data *menu)
408 {
409         TapiHandle *handle = menu_manager_ref_user_data(mm);
410         int result;
411         TelSsClass_t class;
412
413         msg("call tel_get_ss_waiting_status()");
414
415         class = atoi(data_ss_get_waiting_status_class);
416
417         result = tel_get_ss_waiting_status(handle, class, on_ss_waiting, NULL);
418         if (result != TAPI_API_SUCCESS)
419                 msg("failed. (result = %d)", result);
420
421         return 0;
422 }
423
424 static int run_ss_set_cli_status(MManager *mm, struct menu_data *menu)
425 {
426         TapiHandle *handle = menu_manager_ref_user_data(mm);
427         int result;
428         TelSsCliType_t type;
429         TelSsCliStatus_t status;
430
431         msg("call tel_set_ss_cli_status()");
432
433         type = atoi(data_ss_set_cli_status_type);
434         status  = atoi(data_ss_set_cli_status);
435
436         result = tel_set_ss_cli_status(handle, type, status, on_ss_set_cli_status, NULL);
437         if (result != TAPI_API_SUCCESS)
438                 msg("failed. (result = %d)", result);
439
440         return 0;
441 }
442
443
444 static int run_ss_get_cli_status(MManager *mm, struct menu_data *menu)
445 {
446         TapiHandle *handle = menu_manager_ref_user_data(mm);
447         int result;
448         TelSsCliType_t type;
449
450         msg("call tel_get_ss_cli_status()");
451
452         type = atoi(data_ss_get_cli_status_type);
453
454         result = tel_get_ss_cli_status(handle, type, on_ss_get_cli_status, NULL);
455         if (result != TAPI_API_SUCCESS)
456                 msg("failed. (result = %d)", result);
457
458         return 0;
459 }
460
461 static int run_ss_send_ussd_request(MManager *mm, struct menu_data *menu)
462 {
463         TapiHandle *handle = menu_manager_ref_user_data(mm);
464         int result;
465         TelSsUssdMsgInfo_t info;
466
467         msg("call tel_send_ss_ussd_request()");
468
469         memset(&info, 0, sizeof(TelSsUssdMsgInfo_t));
470         info.Type = atoi(data_ss_ussd_request_type);
471         info.Dcs = 0x0f;
472         info.Length = strlen(data_ss_ussd_request_string);
473         if (info.Length > TAPI_SS_USSD_DATA_SIZE_MAX - 1) {
474                 msg("failed. string is too long.");
475                 return 0;
476         }
477         strncpy(info.szString, data_ss_ussd_request_string, TAPI_SS_USSD_DATA_SIZE_MAX - 1);
478
479         result = tel_send_ss_ussd_request(handle, &info, on_ss_send_ussd_request, NULL);
480         if (result != TAPI_API_SUCCESS)
481                 msg("failed. (result = %d)", result);
482
483         return 0;
484 }
485
486 static struct menu_data menu_ss_set_barring[] = {
487         { "1", "class", NULL, NULL, data_ss_set_barring_class},
488         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
489         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
490         { "2", "mode", NULL, NULL, data_ss_set_barring_mode},
491         { "-", "(0=Activate, 1=Deactivate)", NULL, NULL, NULL},
492         { "3", "type", NULL, NULL, data_ss_set_barring_type},
493         { "-", "(1=All outgoing calls, 2=Outgoing international calls, 3=BOIC_NOT_HC", NULL, NULL, NULL},
494         { "-", " 4=All incoming calls, 5=BIC_ROAM, 6=AB, 7=AOB, 8=AIB, 9=BIC_NOT_SIM)", NULL, NULL, NULL},
495         { "4", "password", NULL, NULL, data_ss_set_barring_password},
496         { "5", "run", NULL, run_ss_set_barring, NULL},
497         { NULL, NULL, },
498 };
499
500 static struct menu_data menu_ss_get_barring_status[] = {
501         { "1", "class", NULL, NULL, data_ss_get_barring_status_class},
502         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
503         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
504         { "2", "type", NULL, NULL, data_ss_get_barring_status_type},
505         { "-", "(1=All outgoing calls, 2=Outgoing international calls, 3=BOIC_NOT_HC", NULL, NULL, NULL},
506         { "-", " 4=All incoming calls, 5=BIC_ROAM, 6=AB, 7=AOB, 8=AIB, 9=BIC_NOT_SIM)", NULL, NULL, NULL},
507         { "3", "run", NULL, run_ss_get_barring_status, NULL},
508         { NULL, NULL, },
509 };
510
511 static struct menu_data menu_ss_change_barring_password[] = {
512         { "1", "old password", NULL, NULL, data_ss_change_barring_password_old},
513         { "2", "new password", NULL, NULL, data_ss_change_barring_password_new},
514         { "3", "run", NULL, run_ss_change_barring_password, NULL},
515         { NULL, NULL, },
516 };
517
518 static struct menu_data menu_ss_set_forward[] = {
519         { "1", "class", NULL, NULL, data_ss_set_forward_class},
520         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
521         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
522         { "2", "mode", NULL, NULL, data_ss_set_forward_mode},
523         { "-", "(0=Deactivate, 1=Activate, 2=Register, 3=Deregister)", NULL, NULL, NULL},
524         { "3", "condition", NULL, NULL, data_ss_set_forward_condition},
525         { "-", "(1=CFU, 2=CFB, 3=CFNRy, 4=CFNRc, 5=CF_ALL, 6=CFC)", NULL, NULL, NULL},
526         { "4", "timer", NULL, NULL, data_ss_set_forward_timer},
527         { "-", "(5/10/15/20/25/30 secs)", NULL, NULL, NULL},
528         { "5", "number", NULL, NULL, data_ss_set_forward_number},
529         { "6", "run", NULL, run_ss_set_forward, NULL},
530
531         { NULL, NULL, },
532 };
533
534 static struct menu_data menu_ss_get_forward_status[] = {
535         { "1", "class", NULL, NULL, data_ss_get_forward_status_class},
536         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
537         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
538         { "2", "condition", NULL, NULL, data_ss_get_forward_status_condition},
539         { "-", "(1=CFU, 2=CFB, 3=CFNRy, 4=CFNRc, 5=CF_ALL, 6=CFC)", NULL, NULL, NULL},
540         { "3", "run", NULL, run_ss_get_forward_status, NULL},
541         { NULL, NULL, },
542 };
543
544 static struct menu_data menu_ss_set_waiting[] = {
545         { "1", "class", NULL, NULL, data_ss_set_waiting_class},
546         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
547         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
548         { "2", "mode", NULL, NULL, data_ss_set_waiting_mode},
549         { "-", "(0=Activate, 1=Deactivate)", NULL, NULL, NULL},
550         { "3", "run", NULL, run_ss_set_waiting, NULL},
551         { NULL, NULL, },
552 };
553
554 static struct menu_data menu_ss_get_waiting_status[] = {
555         { "1", "class", NULL, NULL, data_ss_get_waiting_status_class},
556         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
557         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
558         { "2", "run", NULL, run_ss_get_waiting_status, NULL},
559         { NULL, NULL, },
560 };
561
562 static struct menu_data menu_ss_set_cli_status[] = {
563         { "1", "type", NULL, NULL, data_ss_set_cli_status_type},
564         { "-", "(1=CLIP, 2=CLIR, 3=COLP, 4=COLR, 5=CDIP, 6=CNAP)", NULL, NULL, NULL},
565         { "2", "mode", NULL, NULL, data_ss_set_cli_status},
566         { "-", "(1=SS_CLI_STATUS_NOT_PROVISONED, 2=SS_CLI_STATUS_PROVISIONED ,)", NULL, NULL, NULL},
567         { "-", "(3=SS_CLI_STATUS_ACTIVATED, 4=SS_CLI_STATUS_UNKOWN ,)", NULL, NULL, NULL},
568         { "-", "(5 =SS_CLI_STATUS_TEMP_RESTRICTED (Only for CLIR) , 6=SS_CLI_STATUS_TEMP_ALLOWED (Only for CLIR) ,)", NULL, NULL, NULL},
569         { "3", "run", NULL, run_ss_set_cli_status, NULL},
570         { NULL, NULL, },
571 };
572
573 static struct menu_data menu_ss_get_cli_status[] = {
574         { "1", "type", NULL, NULL, data_ss_get_cli_status_type},
575         { "-", "(1=CLIP, 2=CLIR, 3=COLP, 4=COLR, 5=CDIP, 6=CNAP)", NULL, NULL, NULL},
576         { "2", "run", NULL, run_ss_get_cli_status, NULL},
577         { NULL, NULL, },
578 };
579
580 static struct menu_data menu_ss_send_ussd_request[] = {
581         { "1", "type", NULL, NULL, data_ss_ussd_request_type},
582         { "-", "(1=INIT, 2=RSP, 3=REL)", NULL, NULL, NULL},
583         { "2", "string", NULL, NULL, data_ss_ussd_request_string},
584         { "3", "run", NULL, run_ss_send_ussd_request, NULL},
585         { NULL, NULL, },
586 };
587
588 struct menu_data menu_ss_3gpp[] = {
589         { "1", "tel_set_ss_barring", menu_ss_set_barring, NULL, NULL},
590         { "2", "tel_get_ss_barring_status", menu_ss_get_barring_status, NULL, NULL},
591         { "3", "tel_change_ss_barring_password", menu_ss_change_barring_password, NULL, NULL},
592         { "4", "tel_set_ss_forward", menu_ss_set_forward, NULL, NULL},
593         { "5", "tel_get_ss_forward_status", menu_ss_get_forward_status, NULL, NULL},
594         { "6", "tel_set_ss_waiting", menu_ss_set_waiting, NULL, NULL},
595         { "7", "tel_get_ss_waiting_status", menu_ss_get_waiting_status, NULL, NULL},
596         { "8", "tel_set__cli_status", menu_ss_set_cli_status, NULL, NULL},
597         { "9", "tel_get_ss_cli_status", menu_ss_get_cli_status, NULL, NULL},
598         { "10", "tel_send_ss_ussd_request", menu_ss_send_ussd_request, NULL, NULL},
599         { NULL, NULL, },
600 };
601
602 struct menu_data menu_ss[] = {
603         { "1", "3GPP(GSM/WCDMA/LTE)", menu_ss_3gpp, NULL, NULL},
604         { "2", "3GPP2(CDMA) Not Supported", NULL, NULL, NULL},
605         { NULL, NULL, },
606 };
607
608 void register_ss_event(TapiHandle *handle)
609 {
610         int ret;
611
612         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_USSD, on_noti_ss_ussd, NULL);
613         if (ret != TAPI_API_SUCCESS)
614                 msg("event register failed(%d)", ret);
615
616         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_RELEASE_COMPLETE, on_noti_ss_release_complete, NULL);
617         if (ret != TAPI_API_SUCCESS)
618                 msg("event register failed(%d)", ret);
619
620         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_FORWARD_STATUS, on_noti_ss_forwarding_status, NULL);
621         if (ret != TAPI_API_SUCCESS)
622                 msg("event register failed(%d)", ret);
623
624         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_BARRING_STATUS, on_noti_ss_barring_status, NULL);
625         if (ret != TAPI_API_SUCCESS)
626                 msg("event register failed(%d)", ret);
627
628         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_WAITING_STATUS, on_noti_ss_waiting_status, NULL);
629         if (ret != TAPI_API_SUCCESS)
630                 msg("event register failed(%d)", ret);
631
632         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_INFO, on_noti_ss_sups_info, NULL);
633         if (ret != TAPI_API_SUCCESS)
634                 msg("event register failed(%d)", ret);
635 }