summaryrefslogtreecommitdiff
path: root/src/ciss-resp.c
blob: be2e286b7ffd007e3146dd7d59dc4dcca4145de6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
/*
 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "ciss-common.h"
#include "ciss-widget.h"
#include "ciss-resp.h"
#include "ciss-tapi-request.h"
#include "ciss-converter.h"
#include "ciss-util.h"

static char resultstring[CISS_MAX_SS_RECORDS][CISS_USSD_DATA_SIZE_MAX];

static void __ciss_create_forward_result_string(ciss_result_t *ciss_result, TelSsForwardResp_t* ss_forward_info)
{
	ret_if(ciss_result == NULL);
	ret_if(ss_forward_info == NULL);
	int i;
	DBG("\n [CISS-ENGINE] __ciss_create_forward_result_string: num of param=%d\n", ss_forward_info->record_num);

	ciss_result->szSsType = CISS_SERVICE_FORWARDING;
	ciss_result->nRecordNum = ss_forward_info->record_num;

	/* No SS Result received case.. */
	if (ss_forward_info->record_num <= 0) {
		DBG("\n [CISS-ENGINE] __ciss_create_forward_result_string: (ME) parameter num=0!\n");
		ciss_result->nRecordNum = 0;
		ciss_result->szBearer[0] = CISS_TELECOMM_SVC_NONE;
		_ciss_get_result_status_type(TAPI_SS_STATUS_PROVISIONED, &ciss_result->szResult[0]);
		ciss_result->szFlavor = CISS_FLAVOR_NONE;
	} else {
		/* Set Display string :  Network result value */
		for (i = 0; i < ss_forward_info->record_num; i++) {
			_ciss_get_telecomm_svc(ss_forward_info->record[i].Class, &ciss_result->szBearer[i]);
			_ciss_get_result_status_type(ss_forward_info->record[i].Status, &ciss_result->szResult[i]);
			if ((ss_forward_info->record[i].ForwardCondition == TAPI_SS_CF_WHEN_CFNRy)
					&& (ss_forward_info->record[i].NoReplyWaitTime != 0)) {
				ciss_result->nForwardWaitingTime[i] = ss_forward_info->record[i].NoReplyWaitTime;
				DBG("\n [CISS-ENGINE] __ciss_create_forward_result_string(Multiple %dth): No reply time=%d\n",
					i, ciss_result->nForwardWaitingTime[i]);
			}

			DBG("\n [CISS-ENGINE] #########forwarding number = %s########\n\n",
				ss_forward_info->record[i].szCallForwardingNumber);

			if (strlen((char *)ss_forward_info->record[i].szCallForwardingNumber) > 0) {
				_ciss_strcpy(ciss_result->szForwardedToNumber[i],
							 sizeof(ciss_result->szForwardedToNumber[i]),
							 (char *)ss_forward_info->record[i].szCallForwardingNumber);
				DBG("\n [CISS-ENGINE] #########forwarding number in response= %s########\n\n",
					ciss_result->szForwardedToNumber[i]);
			}
			DBG("\n [CISS-ENGINE] __ciss_create_forward_result_string(Multiple %dth): Bearer = %d, Favor = %d, Status = %d, num=%s\n",
				i, ss_forward_info->record[i].Class,
				ss_forward_info->record[i].ForwardCondition,
				ss_forward_info->record[i].Status,
				ciss_result->szForwardedToNumber[i]);
		}
	}
}

static void __ciss_create_barring_result_string(ciss_result_t *ciss_result /*out */, TelSsBarringResp_t ss_barring_info /*in */)
{
	ret_if(ciss_result == NULL);
	int i;

	ciss_result->szSsType = CISS_SERVICE_BARRING;
	ciss_result->nRecordNum = ss_barring_info.record_num;

	if (ss_barring_info.record_num <= 0) {
		DBG("\n [CISS-ENGINE] __ciss_create_barring_result_string: (ME) parameter num=0!\n");
		ciss_result->nRecordNum = 0;
		ciss_result->szBearer[0] = CISS_TELECOMM_SVC_NONE;
		_ciss_get_result_status_type(TAPI_SS_STATUS_PROVISIONED, &ciss_result->szResult[0]);
	} else {
		for (i = 0; i < ss_barring_info.record_num; i++) {
			_ciss_get_telecomm_svc(ss_barring_info.record[i].Class, &ciss_result->szBearer[i]);
			_ciss_get_result_status_type(ss_barring_info.record[i].Status, &ciss_result->szResult[i]);
			DBG("\n [CISS-ENGINE] __ciss_tapi_handle_barring_cnf(Multiple %dth): Bearer = %d, Flavour = %d, Status = %d\n",
				i, ss_barring_info.record[i].Class,
				ss_barring_info.record[i].Flavour,
				ss_barring_info.record[i].Status);
		}
	}
}

static void __ciss_create_waiting_result_string(ciss_result_t *ciss_result /*out */, TelSsWaitingResp_t ss_waiting_info /*in */)
{
	ret_if(ciss_result == NULL);
	TelSsStatus_t WaitingResultStatus;
	int i;

	ciss_result->szSsType = CISS_SERVICE_WAITING;

	if (ss_waiting_info.record[0].Status == TAPI_SS_STATUS_QUIESCENT) {
		WaitingResultStatus = TAPI_SS_STATUS_PROVISIONED;
	} else {
		WaitingResultStatus = TAPI_SS_STATUS_ACTIVE;
	}

	DBG("\n [CISS-ENGINE] create_waiting_result_string : WaitingResultStatus = %d", WaitingResultStatus);
	ciss_result->nRecordNum = ss_waiting_info.record_num;

	if (ss_waiting_info.record_num <= 0) {
		DBG("\n [CISS-ENGINE] __ciss_create_waiting_result_string: (ME) parameter num=0!\n");
		ciss_result->szBearer[0] = CISS_TELECOMM_SVC_NONE;
		_ciss_get_result_status_type(TAPI_SS_STATUS_PROVISIONED, &ciss_result->szResult[0]);
		ciss_result->nRecordNum = 0;
	} else {
		for (i = 0; i < ss_waiting_info.record_num; i++) {
			_ciss_get_telecomm_svc(ss_waiting_info.record[i].Class, &ciss_result->szBearer[i]);
			_ciss_get_result_status_type(WaitingResultStatus, &ciss_result->szResult[i]);
			DBG("\n [CISS-ENGINE] __ciss_create_waiting_result_string(Multiple %dth): Bearer = %d, Status = %d\n",
				i, ss_waiting_info.record[i].Class,
				ss_waiting_info.record[i].Status);
		}
	}
}

static void __ciss_create_cli_result_string(ciss_result_t *ciss_result /*out */, TelSsCliResp_t ss_cli_info /*in */, void *data)
{
	ret_if(ciss_result == NULL);
	ciss_result->szSsType = CISS_SERVICE_IDENTIFICATION;
	ciss_result->szFlavor = CISS_FLAVOR_NONE;
	ciss_result->szBearer[0] = CISS_TELECOMM_SVC_NONE;

	ciss_appdata_t *ad = (ciss_appdata_t *)data;
	ret_if(data == NULL);

	// activate, deactivate for CLIR (currently supported)
	if ((ad->mmi_ctx.opcode == activateSS) || (ad->mmi_ctx.opcode == deactivateSS)) {
		DBG("[CISS-ENGINE] opcode = 0x%x, ss_flavor = 0x%x", ad->mmi_ctx.opcode, ad->mmi_ctx.ss_flavor);

		if (ad->mmi_ctx.ss_flavor == TAPI_SS_CLI_CLIR) {
			ciss_result->cli_type = CISS_CALLING_LINE_IDENTITY_RESTRICTION;

			if (ad->mmi_ctx.opcode == activateSS) {
				ciss_result->szResult[0] = CISS_STATUS_ACTIVE;		// I think it will be problem some day
			} else if (ad->mmi_ctx.opcode == deactivateSS) {
				ciss_result->szResult[0] = CISS_STATUS_PROVISIONED;		// I think it will be problem some day
			}
		}

		return;
	}

	// interrogate
	switch (ss_cli_info.Type) {
	case TAPI_CALLING_LINE_IDENTITY_PRESENTATION:
		ciss_result->cli_type = CISS_CALLING_LINE_IDENTITY_PRESENTATION;
		DBG("\n [CISS-ENGINE] ciss_callId_display_identification: TAPI_CALLING_LINE_IDENTITY_PRESENTATION (ss_cli_info.status=%d)\n", ss_cli_info.Status);
		if (ss_cli_info.Status == TAPI_CLI_STATUS_ACTIVATED) {
			ciss_result->szResult[0] = CISS_STATUS_ACTIVE;
		} else {
			ciss_result->szResult[0] = CISS_STATUS_NOTHING;
		}
		break;

	case TAPI_CALLING_LINE_IDENTITY_RESTRICTION:
		ciss_result->cli_type = CISS_CALLING_LINE_IDENTITY_RESTRICTION;
		DBG("\n [CISS-ENGINE] ciss_callId_display_identification: TAPI_CALLING_LINE_IDENTITY_RESTRICTION (ss_cli_info.status = %d)\n", ss_cli_info.Status);
		if (ss_cli_info.Status == TAPI_CLI_STATUS_ACTIVATED || ss_cli_info.Status == TAPI_CLI_STATUS_TEMP_RESTRICTED) {
			ciss_result->szResult[0] = CISS_STATUS_ACTIVE;
		} else {
			ciss_result->szResult[0] = CISS_STATUS_NOTHING;
		}
		break;

	case TAPI_CONNECTED_LINE_IDENTITY_PRESENTATION:
		ciss_result->cli_type = CISS_CONNECTED_LINE_IDENTITY_PRESENTATION;
		DBG("\n [CISS-ENGINE] ciss_callId_display_identification: TAPI_CONNECTED_LINE_IDENTITY_PRESENTATION (ss_cli_info.status=%d)\n", ss_cli_info.Status);
		if (ss_cli_info.Status == TAPI_CLI_STATUS_ACTIVATED) {
			ciss_result->szResult[0] = CISS_STATUS_ACTIVE;
		} else {
			ciss_result->szResult[0] = CISS_STATUS_NOTHING;
		}
		break;

	case TAPI_CONNECTED_LINE_IDENTITY_RESTRICTION:
		ciss_result->cli_type = CISS_CONNECTED_LINE_IDENTITY_RESTRICTION;
		DBG("\n [CISS-ENGINE] ciss_callId_display_identification: TAPI_CONNECTED_LINE_IDENTITY_RESTRICTION (ss_cli_info.status=%d)\n", ss_cli_info.Status);
		if (ss_cli_info.Status == TAPI_CLI_STATUS_ACTIVATED) {
			ciss_result->szResult[0] = CISS_STATUS_ACTIVE;
		} else {
			ciss_result->szResult[0] = CISS_STATUS_NOTHING;
		}
		break;

	case TAPI_CALLING_NAME_PRESENTATION:
		ciss_result->cli_type = CISS_CALLING_NAME_PRESENTATION;
		DBG("\n [CISS-ENGINE] ciss_callId_display_identification: TAPI_CALLING_NAME_PRESENTATION (ss_cli_info.status=%d)\n", ss_cli_info.Status);
		if ((ss_cli_info.Status == TAPI_CLI_STATUS_ACTIVATED) ||
				(ss_cli_info.Status == TAPI_CLI_STATUS_PROVISIONED)) {
			ciss_result->szResult[0] = CISS_STATUS_ACTIVE;
		} else {
			ciss_result->szResult[0] = CISS_STATUS_NOTHING;
		}
		break;

	default:
		ciss_result->cli_type = CISS_CC_VOICE_IDENTIFICATION_NONE;
		ciss_result->szResult[0] = CISS_STATUS_NOTHING;
		DBG("\n [CISS-ENGINE] ciss_callId_display_identification: ERROR  Wrong  tapi_ss_cnap_status_t = %d  come. \n", ss_cli_info.Type);
		break;
	}
}

static void __ciss_ui_mmi_create_cnap_result_string(ciss_result_t *result, char *szResult, void *data)
{
	ret_if(result == NULL);
	ret_if(szResult == NULL);
	int cli_status;

	ciss_appdata_t *ad = (ciss_appdata_t *)data;

	switch (result->cli_type) {
	case CISS_CALLING_LINE_IDENTITY_PRESENTATION:
		switch (result->szResult[0]) {
		case CISS_STATUS_ACTIVE:
			strncpy(szResult, CISS_STR_CALLER_ID_SHOWN, CISS_USSD_DATA_SIZE_MAX - 1);
			break;
		case CISS_STATUS_REGISTERED:
		case CISS_STATUS_PROVISIONED:
		case CISS_STATUS_QUIESCENT:
		case CISS_STATUS_NOTHING:
		default:
			strncpy(szResult, CISS_STR_CALLER_ID_HIDDEN, CISS_USSD_DATA_SIZE_MAX - 1);
			break;
		}
		break;
	case CISS_CALLING_LINE_IDENTITY_RESTRICTION:
		if (vconf_get_int(VCONFKEY_TELEPHONY_SS_CLI_STATE, &cli_status) < 0) {
			DBG("get_cli_status is failed (%d)", cli_status);
		}

		switch (result->szResult[0]) {
		case CISS_STATUS_ACTIVE:
			if ((ad->mmi_ctx.opcode == activateSS) || (ad->mmi_ctx.opcode == deactivateSS)) {
				strncpy(szResult, CISS_STR_MY_CALLER_ID_IS_NOT_SENT_WHEN_CALLING, CISS_USSD_DATA_SIZE_MAX - 1);
			} else if (cli_status == VCONFKEY_TELEPHONY_SS_CLI_SHOW) {
				strncpy(szResult, CISS_STR_CALLER_ID_DEFAULTS_TO_RESTRICTED_NEXT_CALL_C_NOT_RESTRICTED, CISS_USSD_DATA_SIZE_MAX - 1);
			} else if (cli_status == VCONFKEY_TELEPHONY_SS_CLI_HIDE) {
				strncpy(szResult, CISS_STR_CALLER_ID_DEFAULTS_TO_RESTRICTED_NEXT_CALL_C_RESTRICTED, CISS_USSD_DATA_SIZE_MAX - 1);
			} else {
				strncpy(szResult, CISS_STR_CALLER_ID_DEFAULTS_TO_RESTRICTED_NEXT_CALL_C_RESTRICTED, CISS_USSD_DATA_SIZE_MAX - 1);
			}
			break;
		case CISS_STATUS_REGISTERED:
		case CISS_STATUS_PROVISIONED:
		case CISS_STATUS_QUIESCENT:
		case CISS_STATUS_NOTHING:
		default:
			if ((ad->mmi_ctx.opcode == activateSS) || (ad->mmi_ctx.opcode == deactivateSS)) {
				strncpy(szResult, CISS_STR_MY_CALLER_ID_WILL_BE_SENT_WHEN_CALLING, CISS_USSD_DATA_SIZE_MAX - 1);
			} else if (cli_status == VCONFKEY_TELEPHONY_SS_CLI_SHOW) {
				strncpy(szResult, CISS_STR_CALLER_ID_DEFAULTS_TO_NOT_RESTRICTED_NEXT_CALL_C_NOT_RESTRICTED, CISS_USSD_DATA_SIZE_MAX - 1);
			} else if (cli_status == VCONFKEY_TELEPHONY_SS_CLI_HIDE) {
				strncpy(szResult, CISS_STR_CALLER_ID_DEFAULTS_TO_NOT_RESTRICTED_NEXT_CALL_C_RESTRICTED, CISS_USSD_DATA_SIZE_MAX - 1);
			} else {
				strncpy(szResult, CISS_STR_CALLER_ID_DEFAULTS_TO_NOT_RESTRICTED_NEXT_CALL_C_NOT_RESTRICTED, CISS_USSD_DATA_SIZE_MAX - 1);
			}
			break;
		}
		break;
	case CISS_CONNECTED_LINE_IDENTITY_PRESENTATION:
		switch (result->szResult[0]) {
		case CISS_STATUS_ACTIVE:
			strncpy(szResult, CISS_STR_ANSWERING_NUMBER_IS_SHOWN_WHEN_CALLING, CISS_USSD_DATA_SIZE_MAX - 1);
			break;
		case CISS_STATUS_REGISTERED:
		case CISS_STATUS_PROVISIONED:
		case CISS_STATUS_QUIESCENT:
		case CISS_STATUS_NOTHING:
		default:
			strncpy(szResult, CISS_STR_ANSWERING_NUMBER_IS_NOT_SHOWN_WHEN_CALLING, CISS_USSD_DATA_SIZE_MAX - 1);
			break;
		}
		break;
	case CISS_CONNECTED_LINE_IDENTITY_RESTRICTION:
		switch (result->szResult[0]) {
		case CISS_STATUS_ACTIVE:
			strncpy(szResult, CISS_STR_MY_CALLER_ID_IS_NOT_SENT_WHEN_ANSWERING_CALLS, CISS_USSD_DATA_SIZE_MAX - 1);
			break;
		case CISS_STATUS_REGISTERED:
		case CISS_STATUS_PROVISIONED:
		case CISS_STATUS_QUIESCENT:
		case CISS_STATUS_NOTHING:
		default:
			strncpy(szResult, CISS_STR_MY_CALLER_ID_WILL_BE_SENT_WHEN_ANSWERING_CALLS, CISS_USSD_DATA_SIZE_MAX - 1);
			break;
		}
		break;
	case CISS_CALLING_NAME_PRESENTATION:
		switch (result->szResult[0]) {
		case CISS_STATUS_ACTIVE:
			strncpy(szResult, CISS_STR_CALLER_ID_AVAILABLE, CISS_USSD_DATA_SIZE_MAX - 1);
			break;
		case CISS_STATUS_REGISTERED:
		case CISS_STATUS_PROVISIONED:
		case CISS_STATUS_QUIESCENT:
		case CISS_STATUS_NOTHING:
		default:
			strncpy(szResult, CISS_STR_CALLER_ID_RESTRICTED, CISS_USSD_DATA_SIZE_MAX - 1);
			break;
		}
		break;
	default:
		strncpy(szResult, "Incorrect Service", CISS_USSD_DATA_SIZE_MAX - 1);
		break;
	}
	DBG("\n \n [CISS-MMI] THe result String :%s\n", szResult);
}

static void __ciss_ui_mmi_create_mmi_result_string(ciss_result_t *pSSResult, int index, char *result_string)
{
	DBG("Enter");
	ret_if(pSSResult == NULL);
	ret_if(result_string == NULL);
	char mszBuffer[CISS_TEXT_LEN_MAX*5];
	char szBuffer[CISS_TEXT_LEN_MAX];
	char service[CISS_TEXT_LEN_MAX];
	char teleservice[CISS_TEXT_LEN_MAX];
	char flavor[CISS_TEXT_LEN_MAX];
	char status[CISS_TEXT_LEN_MAX];

	_ciss_ui_mmi_get_service_name(pSSResult->szSsType, service);
	_ciss_ui_mmi_get_flavor_name(pSSResult->szFlavor, flavor);
	_ciss_ui_mmi_get_bearer_name(pSSResult->szSsType, pSSResult->szBearer[index], teleservice);
	_ciss_ui_mmi_get_result_status_type(pSSResult->szSsType, pSSResult->szResult[index], status);

	strncpy(mszBuffer, service, CISS_TEXT_LEN_MAX - 1);
	mszBuffer[CISS_TEXT_LEN_MAX - 1] = '\0';

	if (strlen(teleservice)) {
		strncat(mszBuffer, "<br>", strlen("<br>"));
		strncat(mszBuffer, " -", strlen(" -"));
		strncat(mszBuffer, teleservice, strlen(teleservice));
	}
	DBG("create_result_string: Label Text(telecommSvc) = %d\n", pSSResult->szBearer[index]);

	if (pSSResult->szSsType == CISS_SERVICE_FORWARDING) {
		if ((strcmp(flavor, CISS_STR_CALL_FORWARDING_ACTIVE_C_WHEN_NOREPLY) == 0) &&
				(pSSResult->nForwardWaitingTime[index] != 0)) {
			snprintf(szBuffer, CISS_TEXT_LEN_MAX, "%s %02ds", flavor, pSSResult->nForwardWaitingTime[index]);
		} else {
			strncpy(szBuffer, flavor, CISS_TEXT_LEN_MAX - 1);
			szBuffer[CISS_TEXT_LEN_MAX - 1] = '\0';
		}

		if (strlen(flavor) > 1) {
			strncat(mszBuffer, "<br>", strlen("<br>"));
			strncat(mszBuffer, " -", strlen(" -"));
			strncat(mszBuffer, szBuffer, strlen(szBuffer));
		}
		DBG("\n [CISS-MMI] create_result_string: Label Text(flavor) = %s\n", flavor);

		strncat(mszBuffer, "<br>", strlen("<br>"));
		strncat(mszBuffer, " -", strlen(" -"));
		strncat(mszBuffer, status, strlen(status));

		if (strlen(pSSResult->szForwardedToNumber[index]) &&
				(strcmp(status, CISS_STR_ACTIVATED) == 0)) {
			DBG("\n [CISS-MMI] create_result_string: Forwarded to number = %s\n",
				pSSResult->szForwardedToNumber[index]);

			strncat(mszBuffer, "<br>", strlen("<br>"));
			strncat(mszBuffer, " ", strlen(" "));
			strncat(mszBuffer, pSSResult->szForwardedToNumber[index], strlen(pSSResult->szForwardedToNumber[index]));
		} else {
			DBG("\n [CISS-MMI] create_result_string: Forwarded to number is not need");
		}
	} else if (pSSResult->szSsType == CISS_SERVICE_BARRING) {
		if (strlen(flavor) > 1) {
			strncat(mszBuffer, "<br>", strlen("<br>"));
			strncat(mszBuffer, " -", strlen(" -"));
			strncat(mszBuffer, flavor, strlen(flavor));
		}

		strncat(mszBuffer, "<br>", strlen("<br>"));
		strncat(mszBuffer, " -", strlen(" -"));
		strncat(mszBuffer, status, strlen(status));
	} else if (pSSResult->szSsType == CISS_SERVICE_WAITING) {
		strncat(mszBuffer, "<br>", strlen("<br>"));
		strncat(mszBuffer, " -", strlen("< ->"));
		strncat(mszBuffer, status, strlen(status));
	}
	strncpy(result_string, mszBuffer, sizeof(mszBuffer) - 1);

	DBG("Result String:%s\n", result_string);
	DBG("Leave");
}

static TelSsForwardResp_t* __ciss_tapi_handle_forward_cnf(ciss_result_t *ciss_result, void *tapi_data)
{
	TelSsForwardResp_t ss_forward_info, *out = 0;
	retv_if(tapi_data == NULL, NULL);
	retv_if(ciss_result == NULL, NULL);

	memset(&ss_forward_info, 0, sizeof(TelSsForwardResp_t));
	memcpy(&ss_forward_info, tapi_data, sizeof(TelSsForwardResp_t));

	DBG("\n [CISS-ENGINE] __ciss_tapi_handle_forward_cnf \n");
	DBG("\n [CISS-ENGINE] __ciss_tapi_handle_forward_cnf(Single): Bearer = %d, Flavor = %d, Status = %d \n",
		ss_forward_info.record[0].Class,
		ss_forward_info.record[0].ForwardCondition,
		ss_forward_info.record[0].Status);

	DBG("\n [CISS-ENGINE] ss_forward_info.record[0].szCallForwardingNumber : %s %zu",
		ss_forward_info.record[0].szCallForwardingNumber,
		strlen((char *)ss_forward_info.record[0].szCallForwardingNumber));
	_ciss_get_forward_flavor_type(ss_forward_info.record[0].ForwardCondition,
								  &(ciss_result->szFlavor));
	__ciss_create_forward_result_string(ciss_result, &ss_forward_info);

	DBG("\n [CISS-ENGINE] this->ss_req_data.flavor: %d\n", ciss_result->szFlavor);
	DBG("\n [CISS-ENGINE] this->ss_req_data.telecommSvc: %d\n, this->ss_req_data.action: %d \n",
		ciss_result->szBearer[0], ciss_result->szResult[0]);

	out = g_new0(TelSsForwardResp_t, 1);
	memcpy(out, tapi_data, sizeof(TelSsForwardResp_t));

	return out;
}

static TelSsBarringResp_t* __ciss_tapi_handle_barring_cnf(ciss_result_t *ciss_result, void *tapi_data)
{
	TelSsBarringResp_t ss_barring_info, *out;
	retv_if(tapi_data == NULL, NULL);
	retv_if(ciss_result == NULL, NULL);

	memset(&ss_barring_info, 0, sizeof(TelSsBarringResp_t));
	memcpy(&ss_barring_info, tapi_data, sizeof(TelSsBarringResp_t));

	DBG("\n [CISS-ENGINE] __ciss_tapi_handle_barring_cnf\n");
	DBG("\n [CISS-ENGINE] __ciss_tapi_handle_barring_cnf(Single): Bearer = %d, Favor = %d, Status = %d\n",
		ss_barring_info.record[0].Class,
		ss_barring_info.record[0].Flavour,
		ss_barring_info.record[0].Status);

	memset(ciss_result, 0, sizeof(ciss_result_t));
	_ciss_get_barring_flavor_type(ss_barring_info.record[0].Flavour, &(ciss_result->szFlavor));
	__ciss_create_barring_result_string(ciss_result, ss_barring_info);

	out = g_new0(TelSsBarringResp_t, 1);
	memcpy(out, tapi_data, sizeof(TelSsBarringResp_t));

	return out;
}

static TelSsWaitingResp_t* __ciss_tapi_handle_waiting_cnf(ciss_result_t *ciss_result /*out */,  void *tapi_data/*in */)
{
	TelSsWaitingResp_t ss_waiting_info, *out;
	retv_if(tapi_data == NULL, NULL);
	retv_if(ciss_result == NULL, NULL);

	memset(&ss_waiting_info, 0, sizeof(TelSsWaitingResp_t));
	memcpy(&ss_waiting_info, tapi_data, sizeof(TelSsWaitingResp_t));

	DBG("\n [CISS-ENGINE]__ciss_tapi_handle_waiting_cnf\n");
	DBG("\n [CISS-ENGINE] __ciss_tapi_handle_waiting_cnf(Single): Bearer = %d, Status = %d\n",
		ss_waiting_info.record[0].Class,
		ss_waiting_info.record[0].Status);

	memset(ciss_result, 0, sizeof(ciss_result_t));
	__ciss_create_waiting_result_string(ciss_result, ss_waiting_info);

	out = g_new0(TelSsWaitingResp_t , 1);
	memcpy(out, tapi_data, sizeof(TelSsWaitingResp_t));

	return out;
}

static TelSsCliResp_t* __ciss_tapi_handle_call_id(ciss_result_t *ciss_result, void *tapi_data, void *data)
{
	TelSsCliResp_t ss_cli_info, *out;
	ciss_appdata_t *ad = (ciss_appdata_t *)data;
	retv_if(data == NULL, NULL);
	retv_if(tapi_data == NULL, NULL);
	retv_if(ciss_result == NULL, NULL);

	memset(&ss_cli_info, 0, sizeof(TelSsCliResp_t));

	DBG("\n [CISS-ENGINE] __ciss_tapi_handle_call_id\n");

	if (ad->mmi_ctx.opcode == interrogateSS) {
		memcpy(&ss_cli_info, tapi_data, sizeof(TelSsCliResp_t));
	}

	__ciss_create_cli_result_string(ciss_result, ss_cli_info, ad);
	ciss_result->nRecordNum = 1;

	out = g_new0(TelSsCliResp_t , 1);
	memcpy(out, tapi_data, sizeof(TelSsCliResp_t));

	return out;
}

static int __ciss_create_ss_result_string(char *ss_result_string /*out */, ciss_result_t* ciss_result, void *data/*in */)
{
	DBG("Enter");
	int count = 0;
	retv_if(ss_result_string == NULL, -1);
	retv_if(ciss_result == NULL, -1);
	ciss_appdata_t *ad = (ciss_appdata_t *)data;

	memset(resultstring, 0x0, sizeof(resultstring));
	if (ciss_result->szSsType == CISS_SERVICE_IDENTIFICATION) {
		DBG("\n [CISS-MMI] CISS_SERVICE_IDENTIFICATION \n");
		__ciss_ui_mmi_create_cnap_result_string(ciss_result, resultstring[0], ad);
	} else if (ciss_result->nRecordNum == 0) {
		DBG("\n [CISS-MMI] result.nRecordNum == 0  \n");
		strncpy(resultstring[0], CISS_STR_SUCCESS, CISS_TEXT_LEN_MAX - 1);
		strncat(ss_result_string, "<br> ", strlen("<br> "));
		strncat(ss_result_string, resultstring[0], CISS_USSD_DATA_SIZE_MAX);
		strncat(ss_result_string, "<br> ", strlen("<br> "));
	} else {
		int g_count = 0;
		for (g_count = 0; g_count < ciss_result->nRecordNum; g_count++) {
			__ciss_ui_mmi_create_mmi_result_string(ciss_result, g_count, resultstring[g_count]);
			DBG("\n [CISS-MMI]  Copying data & parsing  Result string ::::::::::: %s \n", resultstring[g_count]);
		}
	}

	for (count = 0; count < ciss_result->nRecordNum; count++) {
		strncat(ss_result_string, "<br> ", strlen("<br> "));
		strncat(ss_result_string, resultstring[count], CISS_USSD_DATA_SIZE_MAX);
		strncat(ss_result_string, "<br> ", strlen("<br> "));
	}
	DBG("Final Result string : %s ", ss_result_string);
	DBG("Leave");

	return 0;
}

static void __ciss_ssresp_view_quit_cb(void *data, Evas_Object *obj, void *event_info)
{
	ciss_appdata_t *ad = (ciss_appdata_t *)data;

	if (ad->tapi_data)
		g_free(ad->tapi_data);

	ad->tapi_data = 0;

	elm_exit();
}

Evas_Object *_ciss_create_ss_resp_view(Evas_Object *parent, void *tapi_data, void *data)
{
	DBG("Enter");
	retv_if(parent == NULL, NULL);
	retv_if(data == NULL, NULL);

	Elm_Object_Item *navi_it;
	ciss_appdata_t *ad = (ciss_appdata_t *)data;
	ciss_result_t ciss_result;
	Evas_Object *nf;
#ifndef _CISS_HW_BACK_KEY
	Evas_Object *l_button;
#endif	/* !_CISS_HW_BACK_KEY */

	char ss_result_string[CISS_MMI_MAX_SS_RESP_STRING] = { };
	void *old_data = ad->tapi_data;

	DBG("ss_type(%d)", ad->resp_ss_type);
	memset(&ciss_result, 0, sizeof(ciss_result_t));
	memset(ss_result_string, 0, CISS_MMI_MAX_SS_RESP_STRING);

	switch (ad->resp_ss_type) {
	case CISS_SERVICE_FORWARDING:
		ad->tapi_data = __ciss_tapi_handle_forward_cnf(&ciss_result, tapi_data);
		break;
	case CISS_SERVICE_BARRING:
		ad->tapi_data = __ciss_tapi_handle_barring_cnf(&ciss_result, tapi_data);
		break;
	case CISS_SERVICE_WAITING:
		ad->tapi_data = __ciss_tapi_handle_waiting_cnf(&ciss_result, tapi_data);
		break;
	case CISS_SERVICE_IDENTIFICATION:
		ad->tapi_data = __ciss_tapi_handle_call_id(&ciss_result, tapi_data, ad);
		break;
	case CISS_SERVICE_CHANGE_BARRING_PASSWD:
		ciss_result.nRecordNum = 0;
		break;
	default:
		DBG("ss_type is not exist");
		return NULL;
	}

	if (old_data)
		g_free(old_data);

	__ciss_create_ss_result_string(ss_result_string, &ciss_result, ad);

	nf = elm_naviframe_add(parent);
	retv_if(nf == NULL, NULL);
	elm_object_part_content_set(parent, "elm.swallow.content", nf);

	eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, __ciss_ssresp_view_quit_cb, ad);

#ifdef _CISS_WEARABLE_CIRCLE_UI
	Evas_Object *content = NULL;
	Evas_Object *main_ly = elm_layout_add(nf);

	elm_layout_theme_set(main_ly, "layout", "application", "default");
	evas_object_size_hint_weight_set(main_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_show(main_ly);

	content = _ciss_create_result_content(ss_result_string, CISS_MMI_MAX_SS_RESP_STRING, main_ly, ad);

	elm_object_part_content_set(main_ly, "elm.swallow.content", content);

	navi_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, main_ly, "empty");
	if (navi_it == NULL)
		DBG("elm_naviframe_item_push returns NULL");

#else /* _CISS_WEARABLE_CIRCLE_UI */
	Evas_Object *genlist =
		_ciss_create_result_genlist(ss_result_string, CISS_MMI_MAX_SS_RESP_STRING, nf, ad);
	retv_if(NULL == genlist, NULL);

#ifdef _CISS_HW_BACK_KEY
	Elm_Object_Item *tb_it;
	Evas_Object *tb;

	elm_naviframe_prev_btn_auto_pushed_set(nf, EINA_FALSE);

	navi_it = elm_naviframe_item_push(nf, CISS_STR_INFORMATION, NULL,
			NULL, genlist, NULL);

	tb = elm_toolbar_add(nf);
	elm_object_style_set(tb, "default");
	elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_EXPAND);
	elm_toolbar_transverse_expanded_set(tb, EINA_TRUE);
	elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_DEFAULT);
	tb_it = elm_toolbar_item_append(tb, NULL, CISS_STR_OK,
			__ciss_ssresp_view_quit_cb, ad);

	if (tb_it == NULL)
		DBG("elm_toolbar_item_append returns NULL");

	elm_object_item_part_content_set(navi_it, "toolbar", tb);
#else	/* _CISS_HW_BACK_KEY */
	l_button = elm_button_add(nf);
	evas_object_smart_callback_add(l_button, "clicked", __ciss_ssresp_view_quit_cb, NULL);
	navi_it = elm_naviframe_item_push(nf, CISS_STR_INFORMATION, l_button, NULL, genlist, NULL);
	if (navi_it == NULL)
		DBG("elm_naviframe_item_push returns NULL");

	elm_object_style_set(l_button, "naviframe/back_btn/default");
#endif	/* !_CISS_HW_BACK_KEY */

	evas_object_show(genlist);
#endif
	evas_object_show(nf);

	DBG("Leave");
	return nf;
}