Initial refactoring merge
[platform/core/telephony/libtapi.git] / test_src / ss.c
1 /*
2  * libtapi
3  *
4  * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
5  * Copyright (c) 2013 Intel Corporation. All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <sys/time.h>
24 #include <unistd.h>
25 #include <glib.h>
26 #include <glib-object.h>
27
28 #include <tapi.h>
29 #include <tapi_ss.h>
30 #include <tapi_events.h>
31
32 #include "menu.h"
33 #include "ss.h"
34
35 #define CHECK_RESULT(result) \
36 {\
37         if (result < TEL_SS_RESULT_SUCCESS || result > TEL_SS_RESULT_OPERATION_NOT_PERMITTED) { \
38                 msg("API failed with result : %d", result); \
39                 return; \
40         } else { \
41                 msg("Result[%d] :[%s] ", result, dbg_ss_result[result]); \
42         } \
43         if (result != TEL_SS_RESULT_SUCCESS) \
44                 return; \
45 }
46
47 static char* dbg_ss_result[] = {
48         "TEL_SS_RESULT_SUCCESS",
49         "TEL_SS_RESULT_FAILURE",
50         "TEL_SS_RESULT_INVALID_PARAMETER",
51         "TEL_SS_RESULT_MEMORY_FAILURE",
52         "TEL_SS_RESULT_OPERATION_NOT_SUPPORTED",
53         "TEL_SS_RESULT_SERVICE_NOT_AVAILABLE",
54         "TEL_SS_RESULT_OPERATION_NOT_ALLOWED",
55         "TEL_SS_RESULT_INCORRECT_OPERATION",
56         "TEL_SS_RESULT_INVALID_PASSWORD",
57         "TEL_SS_RESULT_PASSWORD_BLOCKED",
58         "TEL_SS_RESULT_OPERATION_NOT_PERMITTED"
59 };
60
61 static char data_ss_set_barring_class[MENU_DATA_SIZE + 1] = "10";
62 static char data_ss_set_barring_enable[MENU_DATA_SIZE + 1] = "0";
63 static char data_ss_set_barring_type[MENU_DATA_SIZE + 1] = "1";
64 static char data_ss_set_barring_password[MENU_DATA_SIZE + 1] = "1111";
65
66 static char data_ss_get_barring_status_class[MENU_DATA_SIZE + 1] = "16";
67 static char data_ss_get_barring_status_type[MENU_DATA_SIZE + 1] = "1";
68
69 static char data_ss_change_barring_password_old[MENU_DATA_SIZE + 1] = "1111";
70 static char data_ss_change_barring_password_new[MENU_DATA_SIZE + 1] = "1234";
71
72 static char data_ss_set_forward_class[MENU_DATA_SIZE + 1] = "16";
73 static char data_ss_set_forward_mode[MENU_DATA_SIZE + 1] = "1";
74 static char data_ss_set_forward_condition[MENU_DATA_SIZE + 1] = "5";
75 static char data_ss_set_forward_timer[MENU_DATA_SIZE + 1] = "5";
76 static char data_ss_set_forward_number[MENU_DATA_SIZE + 1] = "01030018655";
77
78 static char data_ss_get_forward_status_class[MENU_DATA_SIZE + 1] = "16";
79 static char data_ss_get_forward_status_condition[MENU_DATA_SIZE + 1] = "1";
80
81 static char data_ss_set_waiting_class[MENU_DATA_SIZE + 1] = "16";
82 static char data_ss_set_waiting_enable[MENU_DATA_SIZE + 1] = "0";
83
84 static char data_ss_get_waiting_status_class[MENU_DATA_SIZE + 1] = "16";
85
86 static char data_ss_set_cli_status_type[MENU_DATA_SIZE + 1] = "1";
87 static char data_ss_set_cli_device_status[MENU_DATA_SIZE + 1] = "0";
88
89 static char data_ss_get_cli_status_type[MENU_DATA_SIZE + 1] = "0";
90
91 static char data_ss_ussd_request_type[MENU_DATA_SIZE + 1] = "1";
92 static char data_ss_ussd_request_string[MENU_DATA_SIZE + 1] = "";
93
94 static void on_noti_ss_ussd(TelHandle *handle, const char *noti_id, void *data, void *user_data)
95 {
96         TelSsUssdNoti *noti = data;
97
98         if (g_strcmp0(noti_id, TEL_NOTI_SS_USSD) == 0) {
99                 msg("Event (%s) received !!", TEL_NOTI_SS_USSD);
100         } else {
101                 msg("Wrong Event Recieved : (%s)", noti_id);
102                 return;
103         }
104
105         if (noti) {
106                 msg(" USSD Noti Response - Status : [%d],  String : [%s]", noti->status, noti->str);
107         } else {
108                 msg("USSD Noti data is NULL.");
109         }
110 }
111
112 static void on_response_ss_set_barring(TelHandle *handle, int result, void *data, void *user_data)
113 {
114         msg("on_response_ss_set_barring :");
115         CHECK_RESULT(result);
116 }
117
118 static int run_ss_set_barring(MManager *mm, struct menu_data *menu)
119 {
120         TelHandle *handle = menu_manager_ref_user_data(mm);
121         TelReturn result;
122         TelSsBarringInfo info;
123
124         msg("call tapi_ss_set_barring()");
125
126         memset(&info, 0, sizeof(TelSsBarringInfo));
127
128         info.class = atoi(data_ss_set_barring_class);
129         info.type = atoi(data_ss_set_barring_type);
130         info.enable = atoi(data_ss_set_barring_enable);
131         if ( g_strlcpy(info.pwd, data_ss_set_barring_password, TEL_SS_BARRING_PASSWORD_LEN_MAX + 1) > TEL_SS_BARRING_PASSWORD_LEN_MAX) {
132                 msg ("Entered Password exceeds maximum permissible length(4). Exiting!");
133                 return 0;
134         }
135
136         msg("barring class : (%d)", info.class);
137         msg("barring type : (%d)", info.type);
138         msg("barring enable : (%d)", info.enable);
139         msg("barring password : (%s)", info.pwd);
140
141         result = tapi_ss_set_barring(handle, &info, on_response_ss_set_barring, NULL);
142         CHECK_RT(result);
143
144         return 0;
145 }
146
147 static void on_response_ss_get_barring_status(TelHandle *handle, int result, void *data, void *user_data)
148 {
149         TelSsBarringResp *resp = data;
150         unsigned int iter;
151
152         msg("on_response_ss_get_barring_status :");
153         CHECK_RESULT(result);
154
155         if (resp) {
156                 msg(" No. of records = %u", resp->record_num);
157                 for (iter = 0; iter < resp->record_num; ++iter) {
158                         msg("Record : [%d] - Class : [%d], Enable : [%d], Type : [%d]",
159                                 iter,
160                                 resp->records[iter].class,
161                                 resp->records[iter].enable,
162                                 resp->records[iter].type);
163                 }
164         }
165         else {
166                 msg("Response data is NULL");
167         }
168 }
169
170 static int run_ss_get_barring_status(MManager *mm, struct menu_data *menu)
171 {
172         TelHandle *handle = menu_manager_ref_user_data(mm);
173         TelReturn result;
174         TelSsBarringGetInfo info;
175
176         msg("call tapi_ss_get_barring_status()");
177
178         memset(&info, 0, sizeof(TelSsBarringGetInfo));
179
180         info.class = atoi(data_ss_get_barring_status_class);
181         info.type = atoi(data_ss_get_barring_status_type);
182
183         msg("barring class : (%d)", info.class);
184         msg("barring type : (%d)", info.type);
185
186         result = tapi_ss_get_barring_status(handle, &info, on_response_ss_get_barring_status, NULL);
187         CHECK_RT(result);
188
189         return 0;
190 }
191
192 static void on_response_ss_change_barring_password(TelHandle *handle, int result, void *data, void *user_data)
193 {
194         msg("on_response_ss_change_barring_password :");
195         CHECK_RESULT(result);
196 }
197
198 static int run_ss_change_barring_password(MManager *mm, struct menu_data *menu)
199 {
200         TelHandle *handle = menu_manager_ref_user_data(mm);
201         TelReturn result;
202         TelSsBarringPwdInfo info;
203
204         msg("call tapi_ss_change_barring_password()");
205
206         if ( g_strlcpy(info.old_pwd, data_ss_change_barring_password_old, TEL_SS_BARRING_PASSWORD_LEN_MAX + 1) > TEL_SS_BARRING_PASSWORD_LEN_MAX) {
207                 msg ("Entered Password exceeds maximum permissible length(4). Exiting!");
208                 return 0;
209         }
210         if ( g_strlcpy(info.new_pwd, data_ss_change_barring_password_new, TEL_SS_BARRING_PASSWORD_LEN_MAX + 1) > TEL_SS_BARRING_PASSWORD_LEN_MAX) {
211                 msg ("Entered Password exceeds maximum permissible length(4). Exiting!");
212                 return 0;
213         }
214
215         msg("old barring password : (%s)", info.old_pwd);
216         msg("new barring password : (%s)", info.new_pwd);
217
218         result = tapi_ss_change_barring_password(handle, &info, on_response_ss_change_barring_password, NULL);
219         CHECK_RT(result);
220
221         return 0;
222 }
223
224 static void on_response_ss_set_forward(TelHandle *handle, int result, void *data, void *user_data)
225 {
226         msg("on_response_ss_set_forward :");
227         CHECK_RESULT(result);
228 }
229
230 static int run_ss_set_forward(MManager *mm, struct menu_data *menu)
231 {
232         TelHandle *handle = menu_manager_ref_user_data(mm);
233         TelReturn result;
234         TelSsForwardInfo info;
235
236         msg("call tapi_ss_set_forwarding()");
237
238         memset(&info, 0, sizeof(TelSsForwardInfo));
239
240         info.class = atoi(data_ss_set_forward_class);
241         info.mode = atoi(data_ss_set_forward_mode);
242         info.condition = atoi(data_ss_set_forward_condition);
243         if (g_strlcpy(info.number, data_ss_set_forward_number, TEL_SS_NUMBER_LEN_MAX + 1) > TEL_SS_NUMBER_LEN_MAX) {
244                 msg("Entered Number exceeds maximum permissible length (82). Exiting!");
245                 return 0;
246         }
247         info.wait_time = atoi(data_ss_set_forward_timer);
248
249         msg("forward class : (%d)", info.class);
250         msg("forward mode : (%d)", info.mode);
251         msg("forward condition : (%d)", info.condition);
252         msg("forward number : (%s)", info.number);
253         msg("forward wait_time : (%u)", info.wait_time);
254
255         result = tapi_ss_set_forwarding(handle, &info, on_response_ss_set_forward, NULL);
256         CHECK_RT(result);
257
258         return 0;
259 }
260
261 static void on_response_ss_get_forward_status(TelHandle *handle, int result, void *data, void *user_data)
262 {
263         TelSsForwardingResp *resp = data;
264         unsigned int iter;
265
266         msg("on_response_ss_get_forward_status :");
267         CHECK_RESULT(result);
268
269         if (resp) {
270                 msg(" No. of records = %u", resp->record_num);
271                 for (iter = 0; iter < resp->record_num; ++iter) {
272                         msg(" Record : [%u] - Class : [%d], Enable : [%d], Condition : [%d], Number : [%s], Wait_Time : [%d]",
273                                         iter,
274                                         resp->records[iter].class,
275                                         resp->records[iter].enable,
276                                         resp->records[iter].condition,
277                                         resp->records[iter].number,
278                                         resp->records[iter].wait_time);
279                         msg("");
280                 }
281         } else {
282                 msg("Response data is NULL");
283         }
284 }
285
286 static int run_ss_get_forward_status(MManager *mm, struct menu_data *menu)
287 {
288         TelHandle *handle = menu_manager_ref_user_data(mm);
289         TelReturn result;
290         TelSsForwardGetInfo info;
291
292         msg("call tapi_ss_get_forwarding_status()");
293
294         info.class = atoi(data_ss_get_forward_status_class);
295         info.condition = atoi(data_ss_get_forward_status_condition);
296
297         msg("forward class : (%d)", info.class);
298         msg("forward condition : (%d)", info.condition);
299
300         result = tapi_ss_get_forwarding_status(handle, &info, on_response_ss_get_forward_status, NULL);
301         CHECK_RT(result);
302
303         return 0;
304 }
305
306 static void on_response_ss_set_waiting(TelHandle *handle, int result, void *data, void *user_data)
307 {
308         msg("on_response_ss_set_waiting :");
309         CHECK_RESULT(result);
310 }
311
312 static int run_ss_set_waiting(MManager *mm, struct menu_data *menu)
313 {
314         TelHandle *handle = menu_manager_ref_user_data(mm);
315         TelReturn result;
316         TelSsWaitingInfo info;
317
318         msg("call tapi_ss_set_waiting()");
319
320         memset(&info, 0, sizeof(TelSsWaitingInfo));
321
322         info.class = atoi(data_ss_set_waiting_class);
323         info.enable= atoi(data_ss_set_waiting_enable);
324
325         msg("waiting class : (%d)", info.class);
326         msg("waiting enable : (%d)", info.enable);
327
328         result = tapi_ss_set_waiting(handle, &info, on_response_ss_set_waiting, NULL);
329         CHECK_RT(result);
330
331         return 0;
332 }
333
334 static void on_response_ss_get_waiting_status(TelHandle *handle, int result, void *data, void *user_data)
335 {
336         TelSsWaitingResp *resp = data;
337         unsigned int iter;
338
339         msg("on_response_ss_get_waiting_status :");
340         CHECK_RESULT(result);
341
342         if (resp) {
343                 msg(" No. of records = %d", resp->record_num);
344                 for (iter = 0; iter < resp->record_num; ++iter) {
345                         msg(" Record : [%u] - Class : [%d], Enable : [%d]",
346                                 iter,
347                                 resp->records[iter].class,
348                                 resp->records[iter].enable);
349                 }
350         } else {
351                 msg("Response data is NULL");
352         }
353 }
354
355 static int run_ss_get_waiting_status(MManager *mm, struct menu_data *menu)
356 {
357         TelHandle *handle = menu_manager_ref_user_data(mm);
358         TelReturn result;
359         TelSsClass class;
360
361         msg("call tapi_ss_get_waiting_status()");
362
363         class = atoi(data_ss_get_waiting_status_class);
364
365         msg("waiting class : (%d)", class);
366
367         result = tapi_ss_get_waiting_status(handle, class, on_response_ss_get_waiting_status, NULL);
368         CHECK_RT(result);
369
370         return 0;
371 }
372
373 static void on_response_ss_set_cli(TelHandle *handle, int result, void *data, void *user_data)
374 {
375         msg("on_response_ss_set_cli :");
376         CHECK_RESULT(result);
377 }
378
379 static int run_ss_set_cli(MManager *mm, struct menu_data *menu)
380 {
381         TelHandle *handle = menu_manager_ref_user_data(mm);
382         TelReturn result;
383         TelSsCliInfo info;
384
385         msg("call tapi_ss_set_cli()");
386
387         info.type= atoi(data_ss_set_cli_status_type);
388
389         msg("cli type : (%d)", info.type);
390
391         switch (info.type) {
392                 case TEL_SS_CLI_CLIP:
393                         info.status.clip = atoi(data_ss_set_cli_device_status);
394                         msg("CLIP status : (%d)", info.status.clip);
395                         break;
396                 case TEL_SS_CLI_CLIR:
397                         info.status.clir = atoi(data_ss_set_cli_device_status);
398                         msg("CLIR status : (%d)", info.status.clir);
399                         break;
400                 case TEL_SS_CLI_COLP:
401                         info.status.colp = atoi(data_ss_set_cli_device_status);
402                         msg("COLP status : (%d)", info.status.colp);
403                         break;
404                 case TEL_SS_CLI_COLR:
405                         info.status.colr = atoi(data_ss_set_cli_device_status);
406                         msg("COLR status : (%d)", info.status.colr);
407                         break;
408                 case TEL_SS_CLI_CDIP:
409                         info.status.cdip = atoi(data_ss_set_cli_device_status);
410                         msg("CDIP status : (%d)", info.status.cdip);
411                         break;
412                 case TEL_SS_CLI_CNAP:
413                         info.status.cnap = atoi(data_ss_set_cli_device_status);
414                         msg("CNAP status : (%d)", info.status.cnap);
415         }
416
417         result = tapi_ss_set_cli(handle, &info, on_response_ss_set_cli, NULL);
418         CHECK_RT(result);
419
420         return 0;
421 }
422
423 static void on_response_ss_get_cli_status(TelHandle *handle, int result, void *data, void *user_data)
424 {
425         TelSsCliResp *resp = data;
426
427         msg("on_response_ss_get_cli_status :");
428         CHECK_RESULT(result);
429
430         if (resp) {
431                 switch (resp->type) {
432                         case TEL_SS_CLI_CLIP:
433                                 msg(" CLIP Response - Device : (%d), Network : (%d)",
434                                         resp->status.clip.dev_status,
435                                         resp->status.clip.net_status);
436                                 break;
437                         case TEL_SS_CLI_CLIR:
438                                 msg(" CLIR Response - Device : (%d), Network : (%d)",
439                                 resp->status.clir.dev_status,
440                                 resp->status.clir.net_status);
441                                 break;
442                         case TEL_SS_CLI_COLP:
443                                 msg(" COLP Response - Device : (%d), Network : (%d)",
444                                         resp->status.colp.dev_status,
445                                         resp->status.colp.net_status);
446                                 break;
447                         case TEL_SS_CLI_COLR:
448                                 msg(" COLR Response - Device : (%d), Network : (%d)",
449                                         resp->status.colr.dev_status,
450                                         resp->status.colr.net_status);
451                                 break;
452                         case TEL_SS_CLI_CDIP:
453                                 msg(" CDIP Response - Device : (%d), Network : (%d)",
454                                         resp->status.cdip.dev_status,
455                                         resp->status.cdip.net_status);
456                                 break;
457                         case TEL_SS_CLI_CNAP:
458                                 msg(" CNAP Response - Device : (%d), Network : (%d)",
459                                         resp->status.cnap.dev_status,
460                                         resp->status.cnap.net_status);
461                 }
462         } else {
463                 msg("Response data is NULL");
464         }
465 }
466
467 static int run_ss_get_cli_status(MManager *mm, struct menu_data *menu)
468 {
469         TelHandle *handle = menu_manager_ref_user_data(mm);
470         TelReturn result;
471         TelSsCliType type;
472
473         msg("call tapi_ss_get_cli_status()");
474
475         type = atoi(data_ss_get_cli_status_type);
476
477         msg("cli type : (%d)", type);
478
479         result = tapi_ss_get_cli_status(handle, type, on_response_ss_get_cli_status, NULL);
480         CHECK_RT(result);
481
482         return 0;
483 }
484
485 static void on_response_ss_send_ussd_request(TelHandle *handle, int result, void *data, void *user_data)
486 {
487         TelSsUssdResp *resp = data;
488
489         msg("on_response_ss_send_ussd_request :");
490         CHECK_RESULT(result);
491
492         if (resp) {
493                 msg(" Type : [%d] Status : [%d], String : [%s]",
494                                 resp->type,
495                                 resp->status,
496                                 resp->str);
497         } else {
498                 msg("No Callback data present.");
499         }
500 }
501
502 static int run_ss_send_ussd_request(MManager *mm, struct menu_data *menu)
503 {
504         TelHandle *handle = menu_manager_ref_user_data(mm);
505         TelReturn result;
506         TelSsUssdInfo info;
507
508         msg("call tapi_ss_send_ussd_request()");
509
510         memset(&info, 0, sizeof(TelSsUssdInfo));
511
512         info.type = atoi(data_ss_ussd_request_type);
513         info.str = (unsigned char *) &data_ss_ussd_request_string;
514
515         msg("ussd type : (%d)", info.type);
516         msg("ussd string : (%s)", info.str);
517
518         result = tapi_ss_send_ussd_request(handle, &info, on_response_ss_send_ussd_request, NULL);
519         CHECK_RT(result);
520
521         return 0;
522 }
523
524 static struct menu_data menu_ss_set_barring[] = {
525         { "1", "class (0=All Teleservices bearer, \n" \
526                         "\t 10=All Teleservices, 11=Voice, 12=All Data Teleservices, 13=Fax, 16=SMS, 17=VGCS, 18=VBS, 19=All Tele except SMS \n" \
527                         "\t 20=All Bearer, 21=All async, 22=All sync, 24=All CS sync, 25=All CS async, 26=All DEDI PS, 27=All DEDI PAD, 28=All Data CDA\n" \
528                         "\t 89=Aux voice, 99=All GPRS bearer", NULL, NULL, data_ss_set_barring_class},
529         { "2", "enable (0=No, 1=Yes)", NULL, NULL, data_ss_set_barring_enable},
530         { "3", "type (0=BOAC, 1=BOIC, 2=BOIC Not HC 3=BAIC, 4=BIC Roam, 5=NS, 6=AB, 7=AOB, 8=AIB)", NULL, NULL, data_ss_set_barring_type},
531         { "4", "password", NULL, NULL, data_ss_set_barring_password},
532         { "5", "run", NULL, run_ss_set_barring, NULL},
533         { NULL, NULL, },
534 };
535
536 static struct menu_data menu_ss_get_barring_status[] = {
537         { "1", "class (0=All Teleservices bearer, \n" \
538                         "\t 10=All Teleservices, 11=Voice, 12=All Data Teleservices, 13=Fax, 16=SMS, 17=VGCS, 18=VBS, 19=All Tele except SMS \n" \
539                         "\t 20=All Bearer, 21=All async, 22=All sync, 24=All CS sync, 25=All CS async, 26=All DEDI PS, 27=All DEDI PAD, 28=All Data CDA\n" \
540                         "\t 89=Aux voice, 99=All GPRS bearer", NULL, NULL, data_ss_get_barring_status_class},
541         { "2", "type (0=BOAC, 1=BOIC, 2=BOIC Not HC 3=BAIC, 4=BIC Roam, 5=NS, 6=AB, 7=AOB, 8=AIB)", NULL, NULL, data_ss_get_barring_status_type},
542         { "3", "run", NULL, run_ss_get_barring_status, NULL},
543         { NULL, NULL, },
544 };
545
546 static struct menu_data menu_ss_change_barring_password[] = {
547         { "1", "old password", NULL, NULL, data_ss_change_barring_password_old},
548         { "2", "new password", NULL, NULL, data_ss_change_barring_password_new},
549         { "3", "run", NULL, run_ss_change_barring_password, NULL},
550         { NULL, NULL, },
551 };
552
553 static struct menu_data menu_ss_set_forward[] = {
554         { "1", "class (0=All Teleservices bearer, \n" \
555                         "\t 10=All Teleservices, 11=Voice, 12=All Data Teleservices, 13=Fax, 16=SMS, 17=VGCS, 18=VBS, 19=All Tele except SMS \n" \
556                         "\t 20=All Bearer, 21=All async, 22=All sync, 24=All CS sync, 25=All CS async, 26=All DEDI PS, 27=All DEDI PAD, 28=All Data CDA\n" \
557                         "\t 89=Aux voice, 99=All GPRS bearer", NULL, NULL, data_ss_set_forward_class},
558         { "2", "mode (0=Disable, 1=Enable, 2=Register, 3=Deregister)", NULL, NULL, data_ss_set_forward_mode},
559         { "3", "condition (0=CFU, 1=CFB, 2=CFNRY, 3=CFNRC, 4=ALL, 5=ALL_CFC)", NULL, NULL, data_ss_set_forward_condition},
560         { "4", "number", NULL, NULL, data_ss_set_forward_number},
561         { "5", "wait time (1-30 seconds)", NULL, NULL, data_ss_set_forward_timer},
562         { "6", "run", NULL, run_ss_set_forward, NULL},
563
564         { NULL, NULL, },
565 };
566
567 static struct menu_data menu_ss_get_forward_status[] = {
568         { "1", "class (0=All Teleservices bearer, \n" \
569                         "\t 10=All Teleservices, 11=Voice, 12=All Data Teleservices, 13=Fax, 16=SMS, 17=VGCS, 18=VBS, 19=All Tele except SMS \n" \
570                         "\t 20=All Bearer, 21=All async, 22=All sync, 24=All CS sync, 25=All CS async, 26=All DEDI PS, 27=All DEDI PAD, 28=All Data CDA\n" \
571                         "\t 89=Aux voice, 99=All GPRS bearer", NULL, NULL, data_ss_get_forward_status_class},
572         { "2", "condition (0=CFU, 1=CFB, 2=CFNRY, 3=CFNRC, 4=ALL, 5=ALL_CFC)", NULL, NULL, data_ss_get_forward_status_condition},
573         { "3", "run", NULL, run_ss_get_forward_status, NULL},
574         { NULL, NULL, },
575 };
576
577 static struct menu_data menu_ss_set_waiting[] = {
578         { "1", "class (0=All Teleservices bearer, \n" \
579                         "\t 10=All Teleservices, 11=Voice, 12=All Data Teleservices, 13=Fax, 16=SMS, 17=VGCS, 18=VBS, 19=All Tele except SMS \n" \
580                         "\t 20=All Bearer, 21=All async, 22=All sync, 24=All CS sync, 25=All CS async, 26=All DEDI PS, 27=All DEDI PAD, 28=All Data CDA\n" \
581                         "\t 89=Aux voice, 99=All GPRS bearer", NULL, NULL, data_ss_set_waiting_class},
582         { "2", "enable (0=Deactivate, 1=Activate)", NULL, NULL, data_ss_set_waiting_enable},
583         { "3", "run", NULL, run_ss_set_waiting, NULL},
584         { NULL, NULL, },
585 };
586
587 static struct menu_data menu_ss_get_waiting_status[] = {
588         { "1", "class (0=All Teleservices bearer, \n" \
589                         "\t 10=All Teleservices, 11=Voice, 12=All Data Teleservices, 13=Fax, 16=SMS, 17=VGCS, 18=VBS, 19=All Tele except SMS \n" \
590                         "\t 20=All Bearer, 21=All async, 22=All sync, 24=All CS sync, 25=All CS async, 26=All DEDI PS, 27=All DEDI PAD, 28=All Data CDA\n" \
591                         "\t 89=Aux voice, 99=All GPRS bearer", NULL, NULL, data_ss_get_waiting_status_class},
592         { "2", "run", NULL, run_ss_get_waiting_status, NULL},
593         { NULL, NULL, },
594 };
595
596 static struct menu_data menu_ss_set_cli[] = {
597         { "1", "type (0=clir, 1=clip, 2=colp, 3=colr, 4=cdip, 5=cnap)", NULL, NULL, data_ss_set_cli_status_type},
598         { "2", "device status ( CLIR : 0=Default, 1=Invocation, 2=Suppression, \n" \
599                         "\t Others : 0=Disable, 1=Enable)", NULL, NULL, data_ss_set_cli_device_status},
600         { "3", "run", NULL, run_ss_set_cli, NULL},
601         { NULL, NULL, },
602 };
603
604 static struct menu_data menu_ss_get_cli_status[] = {
605         { "1", "type (0=CLIP, 1=CLIR, 2=COLP, 3=COLR, 4=CDIP, 5=CNAP)", NULL, NULL, data_ss_get_cli_status_type},
606         { "2", "run", NULL, run_ss_get_cli_status, NULL},
607         { NULL, NULL, },
608 };
609
610 static struct menu_data menu_ss_send_ussd_request[] = {
611         { "1", "type (0=INIT, 1=RSP, 2=REL)", NULL, NULL, data_ss_ussd_request_type},
612         { "2", "ussd string", NULL, NULL, data_ss_ussd_request_string},
613         { "3", "run", NULL, run_ss_send_ussd_request, NULL},
614         { NULL, NULL, },
615 };
616
617 struct menu_data menu_ss[] = {
618         { "1", "tapi_ss_set_barring", menu_ss_set_barring, NULL, NULL},
619         { "2", "tapi_ss_get_barring_status", menu_ss_get_barring_status, NULL, NULL},
620         { "3", "tapi_ss_change_barring_password", menu_ss_change_barring_password, NULL, NULL},
621         { "4", "tapi_ss_set_forwarding", menu_ss_set_forward, NULL, NULL},
622         { "5", "tapi_ss_get_forwarding_status", menu_ss_get_forward_status, NULL, NULL},
623         { "6", "tapi_ss_set_waiting", menu_ss_set_waiting, NULL, NULL},
624         { "7", "tapi_ss_get_waiting_status", menu_ss_get_waiting_status, NULL, NULL},
625         { "8", "tapi_ss_set_cli", menu_ss_set_cli, NULL, NULL},
626         { "9", "tapi_ss_get_cli_status", menu_ss_get_cli_status, NULL, NULL},
627         { "10", "tapi_ss_send_ussd_request", menu_ss_send_ussd_request, NULL, NULL},
628         { NULL, NULL, },
629 };
630
631 void register_ss_event(TelHandle *handle)
632 {
633         TelReturn ret;
634
635         ret = tapi_register_event_id (handle, TEL_NOTI_SS_USSD, on_noti_ss_ussd, NULL);
636         if (ret != TEL_RETURN_SUCCESS) {
637                 msg("TEL_NOTI_SS_USSD - register event failed: [%d]", ret);
638         }
639 }