06a2f23b6d3edc2193037739b13ccff74ebc8105
[framework/telephony/libslp-tapi.git] / wearable / test_src / ss.c
1 /*
2  * Telephony test application
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <sys/time.h>
25 #include <unistd.h>
26 #include <glib.h>
27
28 #include <tapi_common.h>
29 #include <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
98 static void on_noti_ss_forwarding_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
99 {
100         TelSsForwardNoti_t *noti = data;
101         int i =0;
102
103         msg("SS Forwarding Status Noti");
104
105         for ( i=0; i<noti->record_num; i++ ) {
106                 msg("class : %d", noti->record[i].Class);
107                 msg("status : %d", noti->record[i].Status);
108                 msg("condition : %d", noti->record[i].ForwardCondition);
109                 msg("number present : %d", noti->record[i].bCallForwardingNumberPresent);
110                 msg("no reply time : %d", noti->record[i].NoReplyWaitTime);
111                 msg("ton : %d", noti->record[i].Ton);
112                 msg("npi : %d", noti->record[i].Npi);
113                 msg("number : %s", noti->record[i].szCallForwardingNumber);
114                 msg("");
115         }
116
117 }
118
119 static void on_noti_ss_barring_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
120 {
121         TelSsBarringNoti_t *noti = data;
122         int i =0;
123
124         msg("SS Barring Status Noti");
125
126         for ( i=0; i<noti->record_num; i++ ) {
127                 msg("class : %d", noti->record[i].Class);
128                 msg("status : %d", noti->record[i].Status);
129                 msg("type : %d", noti->record[i].Flavour);
130                 msg("");
131         }
132
133 }
134
135 static void on_noti_ss_waiting_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
136 {
137         TelSsWaitingNoti_t *noti = data;
138         int i =0;
139
140         msg("SS Waiting Status Noti");
141
142         for ( i=0; i<noti->record_num; i++ ) {
143                 msg("class : %d", noti->record[i].Class);
144                 msg("status : %d", noti->record[i].Status);
145                 msg("");
146         }
147 }
148
149 static void on_noti_ss_sups_info(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
150 {
151         TelSsInfo_t *noti = data;
152
153         msg("SS SUPS Info Noti");
154
155         msg("SS error : %d", noti->Cause);
156         msg("status : %d", noti->SsType);
157         msg("");
158 }
159
160 static void on_ss_barring(TapiHandle *handle, int result, void *data, void *user_data)
161 {
162         TelSsBarringResp_t *resp = data;
163         int i = 0;
164
165         msg("");
166         msgb("tel_set_ss_barring() or tel_get_ss_barring_status() response receive");
167         msg(" - result = 0x%x", result);
168
169         if (!resp)
170                 return;
171
172         msg(" - record_num = %d", resp->record_num);
173
174         for (i = 0; i < resp->record_num; i++) {
175                 msg(" - [%d] Class=%d, Status=%d, Flavour=%d",
176                                 i,
177                                 resp->record[i].Class,
178                                 resp->record[i].Status,
179                                 resp->record[i].Flavour);
180         }
181 }
182
183 static void on_ss_change_barring_password(TapiHandle *handle, int result, void *data, void *user_data)
184 {
185         msg("");
186         msgb("tel_change_ss_barring_password() response receive");
187         msg(" - result = 0x%x", result);
188 }
189
190 static void on_ss_forward(TapiHandle *handle, int result, void *data, void *user_data)
191 {
192         TelSsForwardResp_t *resp = data;
193         int i;
194
195         msg("");
196         msgb("tel_set_ss_forward() or tel_get_ss_forward_status() response receive");
197         msg(" - result = 0x%x", result);
198
199         if (!resp)
200                 return;
201
202         msg(" - record_num = %d", resp->record_num);
203
204         for (i = 0; i < resp->record_num; i++) {
205                 msg(" - [%d] Class=%d, Status=%d, ForwardCondition=%d, NoReplyWaitTime=%d, bCallForwardingNumberPresend=%d, szCallForwardingNumber=[%s]",
206                                 i,
207                                 resp->record[i].Class,
208                                 resp->record[i].Status,
209                                 resp->record[i].ForwardCondition,
210                                 resp->record[i].NoReplyWaitTime,
211                                 resp->record[i].bCallForwardingNumberPresent,
212                                 resp->record[i].szCallForwardingNumber);
213         }
214 }
215
216 static void on_ss_waiting(TapiHandle *handle, int result, void *data, void *user_data)
217 {
218         TelSsWaitingResp_t *resp = data;
219         int i;
220
221         msg("");
222         msgb("tel_set_ss_waiting() or tel_get_ss_waiting_status() response receive");
223         msg(" - result = 0x%x", result);
224
225         if (!resp)
226                 return;
227
228         msg(" - record_num = %d", resp->record_num);
229
230         for (i = 0; i < resp->record_num; i++) {
231                 msg(" - [%d] Class=%d, Status=%d",
232                                 i,
233                                 resp->record[i].Class,
234                                 resp->record[i].Status);
235         }
236 }
237
238 static void on_ss_set_cli_status(TapiHandle *handle, int result, void *data, void *user_data)
239 {
240         msg("");
241         msgb("tel_set_ss_cli_status() response receive");
242         msg(" - result = 0x%x", result);
243         return;
244 }
245
246 static void on_ss_get_cli_status(TapiHandle *handle, int result, void *data, void *user_data)
247 {
248         TelSsCliResp_t *resp = data;
249
250         msg("");
251         msgb("tel_get_ss_cli_status() response receive");
252         msg(" - result = 0x%x", result);
253
254         if (!resp)
255                 return;
256
257         msg(" - type = %d", resp->Type);
258         msg(" - status = %d", resp->Status);
259 }
260
261 static void on_ss_send_ussd_request(TapiHandle *handle, int result, void *data, void *user_data)
262 {
263         TelSsUssdResp_t *resp = data;
264
265         msg("");
266         msgb("tel_send_ss_ussd_request() response receive");
267         msg(" - result = 0x%x", result);
268
269         if (!resp)
270                 return;
271
272         msg(" - type = %d", resp->Type);
273         msg(" - status = %d", resp->Status);
274         msg(" - length = %d", resp->Length);
275         msg(" - string = [%s]", resp->szString);
276 }
277
278 static int run_ss_set_barring(MManager *mm, struct menu_data *menu)
279 {
280         TapiHandle *handle = menu_manager_ref_user_data(mm);
281         int result;
282         TelSsBarringInfo_t info;
283
284         msg("call tel_set_ss_barring()");
285
286         memset(&info, 0, sizeof(TelSsBarringInfo_t));
287         info.Class = atoi(data_ss_set_barring_class);
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
298         return 0;
299 }
300
301 static int run_ss_get_barring_status(MManager *mm, struct menu_data *menu)
302 {
303         TapiHandle *handle = menu_manager_ref_user_data(mm);
304         int result;
305         TelSsClass_t class;
306         TelSsBarringType_t type;
307
308         msg("call tel_get_ss_barring_status()");
309
310         class = atoi(data_ss_get_barring_status_class);
311         type = atoi(data_ss_get_barring_status_type);
312
313         result = tel_get_ss_barring_status(handle, class, type, on_ss_barring, NULL);
314         if (result != TAPI_API_SUCCESS) {
315                 msg("failed. (result = %d)", result);
316         }
317
318         return 0;
319 }
320
321 static int run_ss_change_barring_password(MManager *mm, struct menu_data *menu)
322 {
323         TapiHandle *handle = menu_manager_ref_user_data(mm);
324         int result;
325
326         msg("call tel_change_ss_barring_password()");
327
328         result = tel_change_ss_barring_password(handle,
329                         data_ss_change_barring_password_old,
330                         data_ss_change_barring_password_new,
331                         data_ss_change_barring_password_new,
332                         on_ss_change_barring_password, NULL);
333         if (result != TAPI_API_SUCCESS) {
334                 msg("failed. (result = %d)", result);
335         }
336
337         return 0;
338 }
339
340 static int run_ss_set_forward(MManager *mm, struct menu_data *menu)
341 {
342         TapiHandle *handle = menu_manager_ref_user_data(mm);
343         int result;
344         TelSsForwardInfo_t info;
345         int len;
346
347         msg("call tel_set_ss_forward()");
348
349         len = strlen(data_ss_set_forward_number);
350         if (len >= TAPI_CALL_DIALDIGIT_LEN_MAX - 1) {
351                 msg("failed. forward_number too long");
352                 return 0;
353         }
354
355         memset(&info, 0, sizeof(TelSsForwardInfo_t));
356         info.Class = atoi(data_ss_set_forward_class);
357         info.Condition = atoi(data_ss_set_forward_condition);
358         info.NoReplyConditionTimer = atoi(data_ss_set_forward_timer);
359         info.Mode = atoi(data_ss_set_forward_mode);
360         info.Ton = 0x01;
361         info.Npi = 0x01;
362         strncpy((char*)info.szPhoneNumber, data_ss_set_forward_number, len);
363         info.szPhoneNumber[len] = '\0';
364
365         result = tel_set_ss_forward(handle, &info, on_ss_forward, NULL);
366         if (result != TAPI_API_SUCCESS) {
367                 msg("failed. (result = %d)", result);
368         }
369
370         return 0;
371 }
372
373 static int run_ss_get_forward_status(MManager *mm, struct menu_data *menu)
374 {
375         TapiHandle *handle = menu_manager_ref_user_data(mm);
376         int result;
377         TelSsClass_t class;
378         TelSsForwardWhen_t condition;
379
380         msg("call tel_get_ss_forward_status()");
381
382         class = atoi(data_ss_get_forward_status_class);
383         condition = atoi(data_ss_get_forward_status_condition);
384
385         result = tel_get_ss_forward_status(handle, class, condition, on_ss_forward, NULL);
386         if (result != TAPI_API_SUCCESS) {
387                 msg("failed. (result = %d)", result);
388         }
389
390         return 0;
391 }
392
393 static int run_ss_set_waiting(MManager *mm, struct menu_data *menu)
394 {
395         TapiHandle *handle = menu_manager_ref_user_data(mm);
396         int result;
397         TelSsWaitingInfo_t info;
398
399         msg("call tel_set_ss_waiting()");
400
401         memset(&info, 0, sizeof(TelSsWaitingInfo_t));
402         info.Class = atoi(data_ss_set_waiting_class);
403         info.Mode = atoi(data_ss_set_waiting_mode);
404
405         result = tel_set_ss_waiting(handle, &info, on_ss_waiting, NULL);
406         if (result != TAPI_API_SUCCESS) {
407                 msg("failed. (result = %d)", result);
408         }
409
410         return 0;
411 }
412
413 static int run_ss_get_waiting_status(MManager *mm, struct menu_data *menu)
414 {
415         TapiHandle *handle = menu_manager_ref_user_data(mm);
416         int result;
417         TelSsClass_t class;
418
419         msg("call tel_get_ss_waiting_status()");
420
421         class = atoi(data_ss_get_waiting_status_class);
422
423         result = tel_get_ss_waiting_status(handle, class, on_ss_waiting, NULL);
424         if (result != TAPI_API_SUCCESS) {
425                 msg("failed. (result = %d)", result);
426         }
427
428         return 0;
429 }
430
431 static int run_ss_set_cli_status(MManager *mm, struct menu_data *menu)
432 {
433         TapiHandle *handle = menu_manager_ref_user_data(mm);
434         int result;
435         TelSsCliType_t type;
436         TelSsCliStatus_t status;
437
438         msg("call tel_set_ss_cli_status()");
439
440         type = atoi(data_ss_set_cli_status_type);
441         status  = atoi(data_ss_set_cli_status);
442
443         result = tel_set_ss_cli_status(handle, type, status, on_ss_set_cli_status, NULL);
444         if (result != TAPI_API_SUCCESS) {
445                 msg("failed. (result = %d)", result);
446         }
447
448         return 0;
449 }
450
451
452 static int run_ss_get_cli_status(MManager *mm, struct menu_data *menu)
453 {
454         TapiHandle *handle = menu_manager_ref_user_data(mm);
455         int result;
456         TelSsCliType_t type;
457
458         msg("call tel_get_ss_cli_status()");
459
460         type = atoi(data_ss_get_cli_status_type);
461
462         result = tel_get_ss_cli_status(handle, type, on_ss_get_cli_status, NULL);
463         if (result != TAPI_API_SUCCESS) {
464                 msg("failed. (result = %d)", result);
465         }
466
467         return 0;
468 }
469
470 static int run_ss_send_ussd_request(MManager *mm, struct menu_data *menu)
471 {
472         TapiHandle *handle = menu_manager_ref_user_data(mm);
473         int result;
474         TelSsUssdMsgInfo_t info;
475
476         msg("call tel_send_ss_ussd_request()");
477
478         memset(&info, 0, sizeof(TelSsUssdMsgInfo_t));
479         info.Type = atoi(data_ss_ussd_request_type);
480         info.Dcs = 0x0f;
481         info.Length = strlen(data_ss_ussd_request_string);
482         if (info.Length > TAPI_SS_USSD_DATA_SIZE_MAX - 1) {
483                 msg("failed. string is too long.");
484                 return 0;
485         }
486         strncpy(info.szString, data_ss_ussd_request_string, TAPI_SS_USSD_DATA_SIZE_MAX - 1);
487
488         result = tel_send_ss_ussd_request(handle, &info, on_ss_send_ussd_request, NULL);
489         if (result != TAPI_API_SUCCESS) {
490                 msg("failed. (result = %d)", result);
491         }
492
493         return 0;
494 }
495
496 static struct menu_data menu_ss_set_barring[] = {
497         { "1", "class", NULL, NULL, data_ss_set_barring_class},
498         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
499         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
500         { "2", "mode", NULL, NULL, data_ss_set_barring_mode},
501         { "-", "(0=Activate, 1=Deactivate)", NULL, NULL, NULL},
502         { "3", "type", NULL, NULL, data_ss_set_barring_type},
503         { "-", "(1=All outgoing calls, 2=Outgoing international calls, 3=BOIC_NOT_HC", NULL, NULL, NULL},
504         { "-", " 4=All incoming calls, 5=BIC_ROAM, 6=AB, 7=AOB, 8=AIB, 9=BIC_NOT_SIM)", NULL, NULL, NULL},
505         { "4", "password", NULL, NULL, data_ss_set_barring_password},
506         { "5", "run", NULL, run_ss_set_barring, NULL},
507         { NULL, NULL, },
508 };
509
510 static struct menu_data menu_ss_get_barring_status[] = {
511         { "1", "class", NULL, NULL, data_ss_get_barring_status_class},
512         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
513         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
514         { "2", "type", NULL, NULL, data_ss_get_barring_status_type},
515         { "-", "(1=All outgoing calls, 2=Outgoing international calls, 3=BOIC_NOT_HC", NULL, NULL, NULL},
516         { "-", " 4=All incoming calls, 5=BIC_ROAM, 6=AB, 7=AOB, 8=AIB, 9=BIC_NOT_SIM)", NULL, NULL, NULL},
517         { "3", "run", NULL, run_ss_get_barring_status, NULL},
518         { NULL, NULL, },
519 };
520
521 static struct menu_data menu_ss_change_barring_password[] = {
522         { "1", "old password", NULL, NULL, data_ss_change_barring_password_old},
523         { "2", "new password", NULL, NULL, data_ss_change_barring_password_new},
524         { "3", "run", NULL, run_ss_change_barring_password, NULL},
525         { NULL, NULL, },
526 };
527
528 static struct menu_data menu_ss_set_forward[] = {
529         { "1", "class", NULL, NULL, data_ss_set_forward_class},
530         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
531         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
532         { "2", "mode", NULL, NULL, data_ss_set_forward_mode},
533         { "-", "(0=Deactivate, 1=Activate, 2=Register, 3=Deregister)", NULL, NULL, NULL},
534         { "3", "condition", NULL, NULL, data_ss_set_forward_condition},
535         { "-", "(1=CFU, 2=CFB, 3=CFNRy, 4=CFNRc, 5=CF_ALL, 6=CFC)", NULL, NULL, NULL},
536         { "4", "timer", NULL, NULL, data_ss_set_forward_timer},
537         { "-", "(5/10/15/20/25/30 secs)", NULL, NULL, NULL},
538         { "5", "number", NULL, NULL, data_ss_set_forward_number},
539         { "6", "run", NULL, run_ss_set_forward, NULL},
540
541         { NULL, NULL, },
542 };
543
544 static struct menu_data menu_ss_get_forward_status[] = {
545         { "1", "class", NULL, NULL, data_ss_get_forward_status_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", "condition", NULL, NULL, data_ss_get_forward_status_condition},
549         { "-", "(1=CFU, 2=CFB, 3=CFNRy, 4=CFNRc, 5=CF_ALL, 6=CFC)", NULL, NULL, NULL},
550         { "3", "run", NULL, run_ss_get_forward_status, NULL},
551         { NULL, NULL, },
552 };
553
554 static struct menu_data menu_ss_set_waiting[] = {
555         { "1", "class", NULL, NULL, data_ss_set_waiting_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", "mode", NULL, NULL, data_ss_set_waiting_mode},
559         { "-", "(0=Activate, 1=Deactivate)", NULL, NULL, NULL},
560         { "3", "run", NULL, run_ss_set_waiting, NULL},
561         { NULL, NULL, },
562 };
563
564 static struct menu_data menu_ss_get_waiting_status[] = {
565         { "1", "class", NULL, NULL, data_ss_get_waiting_status_class},
566         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
567         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
568         { "2", "run", NULL, run_ss_get_waiting_status, NULL},
569         { NULL, NULL, },
570 };
571
572 static struct menu_data menu_ss_set_cli_status[] = {
573         { "1", "type", NULL, NULL, data_ss_set_cli_status_type},
574         { "-", "(1=CLIP, 2=CLIR, 3=COLP, 4=COLR, 5=CDIP, 6=CNAP)", NULL, NULL, NULL},
575         { "2", "mode", NULL, NULL, data_ss_set_cli_status},
576         { "-", "(1=SS_CLI_STATUS_NOT_PROVISONED, 2=SS_CLI_STATUS_PROVISIONED ,)", NULL, NULL, NULL},
577         { "-", "(3=SS_CLI_STATUS_ACTIVATED, 4=SS_CLI_STATUS_UNKOWN ,)", NULL, NULL, NULL},
578         { "-", "(5 =SS_CLI_STATUS_TEMP_RESTRICTED (Only for CLIR) , 6=SS_CLI_STATUS_TEMP_ALLOWED (Only for CLIR) ,)", NULL, NULL, NULL},
579         { "3", "run", NULL, run_ss_set_cli_status, NULL},
580         { NULL, NULL, },
581 };
582
583 static struct menu_data menu_ss_get_cli_status[] = {
584         { "1", "type", NULL, NULL, data_ss_get_cli_status_type},
585         { "-", "(1=CLIP, 2=CLIR, 3=COLP, 4=COLR, 5=CDIP, 6=CNAP)", NULL, NULL, NULL},
586         { "2", "run", NULL, run_ss_get_cli_status, NULL},
587         { NULL, NULL, },
588 };
589
590 static struct menu_data menu_ss_send_ussd_request[] = {
591         { "1", "type", NULL, NULL, data_ss_ussd_request_type},
592         { "-", "(1=INIT, 2=RSP, 3=REL)", NULL, NULL, NULL},
593         { "2", "string", NULL, NULL, data_ss_ussd_request_string},
594         { "3", "run", NULL, run_ss_send_ussd_request, NULL},
595         { NULL, NULL, },
596 };
597
598 struct menu_data menu_ss[] = {
599         { "1", "tel_set_ss_barring", menu_ss_set_barring, NULL, NULL},
600         { "2", "tel_get_ss_barring_status", menu_ss_get_barring_status, NULL, NULL},
601         { "3", "tel_change_ss_barring_password", menu_ss_change_barring_password, NULL, NULL},
602         { "4", "tel_set_ss_forward", menu_ss_set_forward, NULL, NULL},
603         { "5", "tel_get_ss_forward_status", menu_ss_get_forward_status, NULL, NULL},
604         { "6", "tel_set_ss_waiting", menu_ss_set_waiting, NULL, NULL},
605         { "7", "tel_get_ss_waiting_status", menu_ss_get_waiting_status, NULL, NULL},
606         { "8", "tel_set__cli_status", menu_ss_set_cli_status, NULL, NULL},
607         { "9", "tel_get_ss_cli_status", menu_ss_get_cli_status, NULL, NULL},
608         { "10", "tel_send_ss_ussd_request", menu_ss_send_ussd_request, NULL, NULL},
609         { NULL, NULL, },
610 };
611
612 void register_ss_event(TapiHandle *handle)
613 {
614         int ret;
615
616         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_USSD, on_noti_ss_ussd, NULL);
617         if (ret != TAPI_API_SUCCESS) {
618                 msg("event register failed(%d)", ret);
619         }
620
621         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_RELEASE_COMPLETE, on_noti_ss_release_complete, NULL);
622         if (ret != TAPI_API_SUCCESS) {
623                 msg("event register failed(%d)", ret);
624         }
625
626         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_FORWARD_STATUS, on_noti_ss_forwarding_status, NULL);
627         if (ret != TAPI_API_SUCCESS) {
628                 msg("event register failed(%d)", ret);
629         }
630
631         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_BARRING_STATUS, on_noti_ss_barring_status, NULL);
632         if (ret != TAPI_API_SUCCESS) {
633                 msg("event register failed(%d)", ret);
634         }
635
636         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_WAITING_STATUS, on_noti_ss_waiting_status, NULL);
637         if (ret != TAPI_API_SUCCESS) {
638                 msg("event register failed(%d)", ret);
639         }
640
641         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_INFO, on_noti_ss_sups_info, NULL);
642         if (ret != TAPI_API_SUCCESS) {
643                 msg("event register failed(%d)", ret);
644         }
645 }