2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "vc-core-engine.h"
20 #include "vc-core-util.h"
21 #include "vc-core-callagent.h"
22 #include "vc-core-callmanager.h"
25 #include <sys/times.h>
29 #include <unicode/uloc.h>
30 #include <unicode/udat.h>
31 #include <unicode/udatpg.h>
32 #include <unicode/ustring.h>
34 #include "appcore-common.h"
36 #define CALL_VODAFONEUK_CLI_SHOW_ID "1470"
37 #define CALL_COMMON_CLI_SHOW_ID "*31#"
38 #define CALL_COMMON_CLI_HIDE_ID "#31#"
48 #define ASCII_COMMA 44
51 #define ASCII_SEMI_COLON 59
53 #define EIGTH_BIT 0x80
54 #define SEVENTH_BIT 0x40
55 #define SIXTH_BIT 0x20
56 #define FIFTH_BIT 0x10
57 #define FOURTH_BIT 0x08
58 #define THIRD_BIT 0x04
59 #define SECOND_BIT 0x02
60 #define FIRST_BIT 0x01
62 #define CALLVC_MIN(x, y) ((x) <= (y) ? (x) : (y))
63 #define ISUSSDDIGIT(X) ((X >= '2') && (X <= '9'))
64 #define ISDIGIT(X) ((X >= '0') && (X <= '9'))
65 #define ISSSDIGITINCALL(X) ((X >= '7') && (X <= '9'))
66 #define IS1CHARUSSDDIGIT(X) ((X >= '1') && (X <= '9'))
68 #define DATE_FORMAT_1 "EEMMMddyyyy" /* Thu Aug 23 2001 */
69 #define TIME_12_TYPE "hma" /* 7:58 AM */
70 #define TIME_24_TYPE "HHmm" /* 19:58 */
73 * This function publishes the event of a given publish type
75 * @return Returns TRUE on success and FALSE on failure
76 * @param[in] src Telehone number from which call number needd to be parsed
77 * @param[out] dst Pointer to the buffer to store the parsed number
79 gboolean _vc_core_util_remove_invalid_chars(const char *src, char *dst)
81 VOICECALL_RETURN_FALSE_IF_FAIL((src != NULL));
82 VOICECALL_RETURN_FALSE_IF_FAIL((dst != NULL));
84 CALL_ENG_DEBUG(ENG_DEBUG, "Source phone number - %s", src);
90 CALL_ENG_DEBUG(ENG_DEBUG, "source String len - %d", nSrc);
92 for (i = 0; i < nSrc; ++i) {
96 if (src[i + 1] == '0')
121 CALL_ENG_DEBUG(ENG_DEBUG, "Destination phone number - %s", dst);
127 * This function publishes the event of a given publish type
129 * @return Returns TRUE on success and FALSE on failure
130 * @param[in] pszTelNumber Telehone number from which call number nned to be extracted
131 * @param[out] pBuffer Pointer to the buffer to store the extracted number
132 * @param[in] nBufSize Size of input buffer
134 gboolean _vc_core_util_extract_call_number(const char *pszTelNumber, char *pBuffer, const int nBufSize)
139 VOICECALL_RETURN_FALSE_IF_FAIL((pBuffer != NULL));
140 VOICECALL_RETURN_FALSE_IF_FAIL((pszTelNumber != NULL));
142 CALL_ENG_DEBUG(ENG_DEBUG, "number = %s..", pszTelNumber);
144 memset(pBuffer, 0, nBufSize);
146 if ((strncmp(pszTelNumber, CALL_COMMON_CLI_SHOW_ID, 4) == 0) || (strncmp(pszTelNumber, CALL_COMMON_CLI_HIDE_ID, 4) == 0))
147 pszNum = (char *)pszTelNumber + 4;
149 pszNum = (char *)pszTelNumber;
152 while (*pst != '\0') {
153 if (*pst == 'P' || *pst == 'p' || *pst == ',' || *pst == 'W' || *pst == 'w' || *pst == ';') {
159 if (strlen(pst) == 0) {
160 if (strlen(pszNum) == 0)
162 _vc_core_util_strcpy(pBuffer, nBufSize, pszNum);
167 _vc_core_util_strcpy(pBuffer, min((((int)pst - (int)pszNum) + 1), (nBufSize)), pszNum);
172 gboolean _vc_core_util_extract_call_number_without_cli(const char *pszTelNumber, char *pBuffer, const int nBufSize)
177 VOICECALL_RETURN_FALSE_IF_FAIL((pszTelNumber != NULL));
178 VOICECALL_RETURN_FALSE_IF_FAIL((pBuffer != NULL));
180 CALL_ENG_DEBUG(ENG_DEBUG, "number = %s..", pszTelNumber);
182 memset(pBuffer, 0, nBufSize);
183 pszNum = (char *)pszTelNumber;
185 while (*pst != '\0') {
186 if (*pst == 'P' || *pst == 'p' || *pst == ',' || *pst == 'W' || *pst == 'w' || *pst == ';') {
191 if (strlen(pst) == 0) {
192 if (strlen(pszNum) == 0)
194 _vc_core_util_strcpy(pBuffer, nBufSize, pszNum);
199 _vc_core_util_strcpy(pBuffer, min((((int)pst - (int)pszNum) + 1), (nBufSize)), pszNum);
205 * This function checks the validity of the given string for SS string
207 * @return Returns SS_SI_FORMAT_INVALID - if the string is invalid ss string, SS_SI_FORMAT_VALID - if valid
208 * @param[in] pinput_string string to be verified
210 call_vc_ss_si_format _vc_core_util_check_si_format(const char *pinput_string)
212 int index = 0, pos = 1, cnt = 0;
213 VOICECALL_RETURN_VALUE_IF_FAIL((pinput_string != NULL), SS_SI_FORMAT_INVALID);
215 if ((pinput_string[1] == '*') || (pinput_string[1] == '#'))
221 if (pinput_string[index++] == '*')
224 if (index >= strlen(pinput_string + pos)) {
225 CALL_ENG_DEBUG(ENG_DEBUG, "valid ss format...");
226 return SS_SI_FORMAT_VALID;
230 return SS_SI_FORMAT_VALID;
233 gboolean _vc_core_util_get_mcc(unsigned long *mcc)
238 VOICECALL_RETURN_FALSE_IF_FAIL((mcc != NULL));
240 ret = vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &plmn_value);
243 char plmn_string[10];
245 CALL_ENG_DEBUG(ENG_DEBUG, "plmn_value = [%d]", plmn_value);
247 memset(plmn_string, 0, sizeof(plmn_string));
248 memset(mcc_value, 0, sizeof(mcc_value));
250 snprintf(plmn_string, 10, "%d", plmn_value);
252 /*First 3 digits of plmn value constitutes the mcc value */
253 _vc_core_util_strcpy(mcc_value, 4, plmn_string);
254 *mcc = (unsigned long)atoi(mcc_value);
256 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed..[%d]", ret);
257 *mcc = CALL_NETWORK_MCC_UK;
259 CALL_ENG_DEBUG(ENG_DEBUG, "mcc = %ld", *mcc);
264 gboolean _vc_core_util_get_mnc(unsigned long *mnc)
269 VOICECALL_RETURN_FALSE_IF_FAIL((mnc != NULL));
271 ret = vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &plmn_value);
274 char plmn_string[10];
276 CALL_ENG_DEBUG(ENG_DEBUG, "plmn_value = [%d]", plmn_value);
278 memset(plmn_string, 0, sizeof(plmn_string));
279 memset(mnc_value, 0, sizeof(mnc_value));
281 snprintf(plmn_string, 10, "%d", plmn_value);
283 /* 4~6th digits of plmn value constitutes the mnc value */
284 _vc_core_util_strcpy(mnc_value, 4, &plmn_string[3]);
285 *mnc = (unsigned long)atoi(mnc_value);
287 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed..[%d]", ret);
288 *mnc = CALL_NETWORK_MNC_01;
290 CALL_ENG_DEBUG(ENG_DEBUG, "mnc = %ld", *mnc);
296 * This function checks whether the given number is SS string or not
298 * @return TRUE if the number is SS string, FALSE otherwise
299 * @param[in] pNumber number to be verified
301 gboolean _vc_core_util_check_ss_string(const char *pNumber)
304 VOICECALL_RETURN_FALSE_IF_FAIL(pNumber != NULL);
305 CALL_ENG_DEBUG(ENG_DEBUG, "pNumber(%s)", pNumber);
307 len = strlen(pNumber);
310 if (pNumber[len - 1] == '#') {
311 if (pNumber[0] == '*' || pNumber[0] == '#') {
316 * '*31#', '#31#' -> launch CISS
317 * '*31#nn..', '#31#nn...' -> launch Voice-call
319 if (strncmp(pNumber, CALL_COMMON_CLI_SHOW_ID, 4) == 0 || strncmp(pNumber, CALL_COMMON_CLI_HIDE_ID, 4) == 0) {
327 if ((len == 2) && (ISUSSDDIGIT(pNumber[0]) && ISDIGIT(pNumber[1]))) {
328 CALL_ENG_DEBUG(ENG_DEBUG, "USSD string");
332 if ((len == 1) && (IS1CHARUSSDDIGIT(pNumber[0]))) {
333 CALL_ENG_DEBUG(ENG_DEBUG, "1 character USSD string");
341 * This function checks whether the given number is in CALL SS string or not
343 * @return TRUE if the number is in call SS string, FALSE otherwise
344 * @param[in] pNumber number to be verified
346 gboolean _vc_core_util_check_incall_ss_string(const char *number)
350 VOICECALL_RETURN_FALSE_IF_FAIL(number != NULL);
351 CALL_ENG_DEBUG(ENG_DEBUG, "number(%s)", number);
353 len = strlen(number);
354 if (len > 2 || len < 1)
362 if (number[0] >= '0' && number[0] <= '4')
365 /* 11 ~ 17, 21 ~ 27 */
366 num_int = atoi(number);
368 if (num_int >= 11 && num_int <= 17)
370 if (num_int >= 21 && num_int <= 27)
378 * This function extracts the dtmf number from the given telephone number
380 * @param[in] tel_number source telephone number
381 * @param[out] dtmf_number extracted dtmf number
382 * @param[out] dtmf_buf_len size of dtmf number buffer
384 gboolean _vc_core_util_extract_dtmf_number(const char *tel_number, char *dtmf_number, const int dtmf_buf_len)
387 VOICECALL_RETURN_FALSE_IF_FAIL(tel_number != NULL);
388 VOICECALL_RETURN_FALSE_IF_FAIL(dtmf_number != NULL);
390 memset(dtmf_number, 0, dtmf_buf_len);
392 pst = (char *)tel_number;
393 while (*pst != '\0') {
394 #ifdef WDIAL_SEND_DTMF
395 if (*pst == 'P' || *pst == 'p' || *pst == ',' || *pst == 'W' || *pst == 'w' || *pst == ';') {
397 if (*pst == 'P' || *pst == 'p' || *pst == ',') {
404 if (strlen(pst) == 0) {
407 if (pst == tel_number)
409 strncpy(dtmf_number, pst, CALLVC_MIN((int)strlen(pst), (dtmf_buf_len-1)));
415 * This function checks whether the given number ia a valid dtmf number or not
417 * @return TRUE if the number can be used for sending dtmf , FALSE otherwise
418 * @param[in] pnumber number to be verified
420 gboolean _vc_core_util_isvalid_dtmf_number(char *pnumber)
423 VOICECALL_RETURN_FALSE_IF_FAIL(pnumber != NULL);
425 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_util_isvalid_dtmf_number.. entering");
427 if (NULL == pnumber || (len = strlen(pnumber)) <= 0) {
431 CALL_ENG_DEBUG(ENG_DEBUG, "Length = %d", len);
433 if (IS_DIGIT(pnumber[len - 1]) || (pnumber[len - 1] >= ASCII_A && pnumber[len - 1] <= ASCII_D) || (pnumber[len - 1] == ASCII_STAR || pnumber[len - 1] == ASCII_HASH)) {
442 * This function checks whether the given number ia a valid dtmf number or not
444 * @return TRUE if the number can be used for sending dtmf , FALSE otherwise
445 * @param[in] pnumber number to be verified
447 gboolean _vc_core_util_isvalid_full_dtmf_number(char *pnumber)
450 VOICECALL_RETURN_FALSE_IF_FAIL(pnumber != NULL);
452 CALL_ENG_DEBUG(ENG_DEBUG, "_vc_core_util_isvalid_dtmf_number.. entering");
454 if (NULL == pnumber || (len = strlen(pnumber)) <= 0) {
458 CALL_ENG_DEBUG(ENG_DEBUG, "Length = %d", len);
460 if (!(IS_DIGIT(pnumber[len - 1]) || (pnumber[len - 1] >= ASCII_A && pnumber[len - 1] <= ASCII_D) || \
461 (pnumber[len - 1] == ASCII_STAR || pnumber[len - 1] == ASCII_HASH) || \
462 (pnumber[len - 1] == ASCII_P || pnumber[len - 1] == ASCII_p || pnumber[len - 1] == ASCII_COMMA) || \
463 (pnumber[len - 1] == ASCII_W || pnumber[len - 1] == ASCII_w || pnumber[len - 1] == ASCII_SEMI_COLON))) {
464 CALL_ENG_DEBUG(ENG_DEBUG, "invalid character encountered...");
469 CALL_ENG_DEBUG(ENG_DEBUG, "Fully valid DTMF string..");
474 * This function checks the validity of the given telephone number
476 * @return TRUE if the given number is valid telephone number, FALSE otherwise
477 * @param[in] ptel_number telephone number to be verified
479 gboolean _vc_core_util_isvalid_telephone_number(char *ptel_number)
483 VOICECALL_RETURN_FALSE_IF_FAIL(ptel_number != NULL);
485 if (ptel_number != NULL) {
486 char call_number[VC_PHONE_NUMBER_LENGTH_MAX] = { 0, };
488 /* Function Test SLP-Call-0250 fixed.
489 * If user Input "*" or "#" and then make a call,
490 * the device should alert you that the phone number is incorrect.
492 /*if ((strlen(ptel_number) == 1) && ((strcmp(ptel_number, "*") == 0) ||(strcmp(ptel_number, "#") == 0))) */
493 /* 1 digit number -> wrong number popup */
494 if (strlen(ptel_number) == 1) {
495 CALL_ENG_DEBUG(ENG_DEBUG, "It is wrong number.(1 digit number)");
500 /*To avoid checking *31# and #31# */
501 if (_vc_core_util_extract_call_number(ptel_number, call_number, sizeof(call_number)) == FALSE) {
502 CALL_ENG_DEBUG(ENG_DEBUG, "No proper number = %s", ptel_number);
506 len = strlen(call_number);
507 for (i = 0; i < len; i++) {
508 /*'+' should be allowed only as first digit of the dialling number */
509 if (i >= 1 && call_number[i] == '+') {
513 if (!IS_DIGIT(call_number[i]) && call_number[i] != '+' && call_number[i] != ASCII_STAR && call_number[i] != ASCII_HASH && call_number[i] != 'P' && call_number[i] != 'p' && call_number[i] != ',') {
522 gboolean _vc_core_util_check_gcf_status(void)
524 gboolean bgcf_status = FALSE;
527 ret = vconf_get_int(VCONFKEY_ADMIN_GCF_TEST, &bgcf_status);
529 CALL_ENG_DEBUG(ENG_DEBUG, "bgcf_status = [%d]", bgcf_status);
531 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed..[%d]", ret);
537 gboolean _vc_core_util_check_zuhause_status(void)
539 int isZuhauseArea = 0;
542 ret = vconf_get_int(VCONFKEY_TELEPHONY_ZONE_ZUHAUSE, &isZuhauseArea);
544 CALL_ENG_DEBUG(ENG_DEBUG, "isZuhauseArea = [%d]", isZuhauseArea);
546 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed..[%d]", ret);
549 if (isZuhauseArea == 0) {
550 /*Not in a zuhause area.. */
553 /*in a zuhause area.. */
558 /*********************************************************************/
559 gboolean _vc_core_util_set_call_status(int call_status)
561 CALL_ENG_DEBUG(ENG_DEBUG, "call_status = [%d]", call_status);
563 if (vconf_set_int(VCONFKEY_CALL_STATE, call_status)) {
564 CALL_ENG_DEBUG(ENG_DEBUG, "vconf_set_int failed.");
570 gboolean _vc_core_util_set_call_volume(int vol_level)
572 CALL_ENG_DEBUG(ENG_DEBUG, "vol_level = [%d]", vol_level);
574 if (vconf_set_int(VCONFKEY_CALL_VOLUME_LEVEL, vol_level)) {
575 CALL_ENG_DEBUG(ENG_WARN, "vconf_set_int failed.");
581 int _vc_core_util_get_call_volume(void)
585 if (vconf_get_int(VCONFKEY_CALL_VOLUME_LEVEL, &vol_level)) {
586 CALL_ENG_DEBUG(ENG_WARN, "vconf_set_int failed.");
589 CALL_ENG_DEBUG(ENG_DEBUG, "vol_level(%d)", vol_level);
593 gboolean _vc_core_util_check_video_call_status(void)
598 ret = vconf_get_int(VCONFKEY_CALL_STATE, &call_status);
600 CALL_ENG_DEBUG(ENG_DEBUG, "call_status = [%d]", call_status);
601 if (call_status == VCONFKEY_CALL_VIDEO_CONNECTING || call_status == VCONFKEY_CALL_VIDEO_ACTIVE) {
605 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed..[%d]", ret);
610 gboolean _vc_core_util_get_SAP_status()
612 int bt_status = VCONFKEY_BT_DEVICE_NONE;
613 gboolean ret = FALSE;
615 ret = vconf_get_int(VCONFKEY_BT_DEVICE, &bt_status);
617 CALL_ENG_DEBUG(ENG_DEBUG, "bt_status = [0x%x]", bt_status);
619 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed..[%d]", ret);
622 if (bt_status == VCONFKEY_BT_DEVICE_SAP_CONNECTED) {
629 void _vc_core_util_get_cug_info(voicecall_setup_info_t *psetupcall_info)
631 VOICECALL_RETURN_IF_FAIL(psetupcall_info != NULL);
632 voicecall_cug_info_t *pcug_info = NULL;
633 /*int error_code = -1; */
635 pcug_info = (voicecall_cug_info_t *) &psetupcall_info->cug_info;
637 /*Get the CUG Information from the Settings */
638 memset(&psetupcall_info->cug_info, 0, sizeof(voicecall_cug_info_t));
639 pcug_info->bcug_used = 0;
642 void _vc_core_util_get_identity_mode(voicecall_setup_info_t *psetupcall_info)
644 int id_mode = 0; /*0 - default, 1-show, 2-hide */
646 VOICECALL_RETURN_IF_FAIL(psetupcall_info != NULL);
648 ret = vconf_get_int(VCONFKEY_CISSAPPL_SHOW_MY_NUMBER_INT, &id_mode);
650 CALL_ENG_DEBUG(ENG_DEBUG, "id_mode = [%d]", id_mode);
651 psetupcall_info->identity_mode = id_mode;
653 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed..[%d]", ret);
654 psetupcall_info->identity_mode = 0;
658 gboolean _vc_core_util_is_offline_mode(void)
660 gboolean bstatus = -1;
662 if (vconf_get_bool(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, &bstatus)) {
663 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_bool failed.");
666 CALL_ENG_DEBUG(ENG_DEBUG, "bstatus:[%d]", bstatus);
671 gboolean _vc_core_util_is_pwlock(void)
673 int pwlock_state = -1;
675 if (vconf_get_int(VCONFKEY_PWLOCK_STATE, &pwlock_state)) {
676 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed.");
679 CALL_ENG_DEBUG(ENG_DEBUG, "pwlock_state:[%d]", pwlock_state);
680 if ((pwlock_state == VCONFKEY_PWLOCK_BOOTING_LOCK) || (pwlock_state == VCONFKEY_PWLOCK_RUNNING_LOCK)) {
687 gboolean _vc_core_util_get_nw_status(int *network_status)
690 gboolean ret = FALSE;
691 VOICECALL_RETURN_FALSE_IF_FAIL(network_status != NULL);
693 ret = vconf_get_int(VCONFKEY_TELEPHONY_SVCTYPE, &svc_type);
695 CALL_ENG_DEBUG(ENG_DEBUG, "svc_type = [%d]", svc_type);
696 *network_status = svc_type;
699 CALL_ENG_DEBUG(ENG_ERR, "vconf_get_int failed..[%d]", ret);
704 /* Function Definitions */
706 * This function copies the source string to the target string according to the size of the destination string
708 * @return Returns newly copied string on success or NULL on failure
709 * @param[out] pbuffer Target Buffer
710 * @param[in] buf_count Size of Target Buffer
711 * @param[in] pstring Source String
713 gboolean _vc_core_util_strcpy(char *pbuffer, int buf_count, const char *pstring)
715 VOICECALL_RETURN_FALSE_IF_FAIL(pbuffer != NULL);
716 VOICECALL_RETURN_FALSE_IF_FAIL(pstring != NULL);
718 if (buf_count == 0) {
719 CALL_ENG_DEBUG(ENG_DEBUG, "buf_count is zero!!");
722 #ifdef _NO_USE_STRCPY_
723 if ((buf_count - 1) >= (int)strlen(pstring)) {
724 strcpy(pbuffer, pstring);
726 CALL_ENG_DEBUG(ENG_DEBUG, "pbuffer size is smaller than pstring!!");
727 strncpy(pbuffer, pstring, (buf_count - 1));
728 pbuffer[buf_count - 1] = '\0';
731 strncpy(pbuffer, pstring, (buf_count - 1));
732 pbuffer[buf_count - 1] = '\0';
738 * This function make the date and time string
740 * @return Returns newly copied string on success or NULL on failure
741 * @param[out] pbuffer Target Buffer
742 * @param[in] time time
744 char *_vc_core_util_get_date_time(time_t time)
747 const char *locale = uloc_getDefault();
748 UErrorCode status = U_ZERO_ERROR;
749 UDateTimePatternGenerator *generator;
750 UDateFormat *formatter;
751 UChar bestPattern[64] = { '\0', };
752 UChar formatted[64] = { '\0', };
753 char bestPatternString[128] = { '\0', };
754 char formattedString[128] = { '\0', };
755 int32_t bestPatternCapacity, formattedCapacity;
756 int32_t bestPatternLength, formattedLength;
757 char skeleton[128] = { '\0', };
758 UChar customSkeleton[64] = { '\0', };
759 enum appcore_time_format time_format;
761 appcore_get_timeformat(&time_format);
763 switch (time_format) {
764 case APPCORE_TIME_FORMAT_12:
765 snprintf(skeleton, sizeof(skeleton), "%s%s", DATE_FORMAT_1, TIME_12_TYPE);
767 case APPCORE_TIME_FORMAT_24:
768 snprintf(skeleton, sizeof(skeleton), "%s%s", DATE_FORMAT_1, TIME_24_TYPE);
770 case APPCORE_TIME_FORMAT_UNKNOWN:
772 snprintf(skeleton, sizeof(skeleton), "%s%s", DATE_FORMAT_1, TIME_24_TYPE);
776 u_uastrncpy(customSkeleton, skeleton, strlen(skeleton));
778 generator = udatpg_open(locale, &status);
779 bestPatternCapacity = (int32_t) (sizeof(bestPattern) / sizeof((bestPattern)[0]));
781 bestPatternLength = udatpg_getBestPattern(generator, customSkeleton, u_strlen(customSkeleton), bestPattern, bestPatternCapacity, &status);
782 u_austrncpy(bestPatternString, bestPattern, 128);
784 CALL_ENG_DEBUG(ENG_DEBUG, "BestPattern(%s)", bestPatternString);
786 date = (UDate) time * 1000;
788 formatter = udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, NULL, -1, bestPattern, -1, &status);
790 /* UDAT_IGNORE Passed so that our best pattern is used in generating pattern */
791 formattedCapacity = (int32_t) (sizeof(formatted) / sizeof((formatted)[0]));
792 formattedLength = udat_format(formatter, date, formatted, formattedCapacity, NULL, &status);
793 u_austrncpy(formattedString, formatted, 128);
794 udatpg_close(generator);
795 udat_close(formatter);
797 CALL_ENG_DEBUG(ENG_DEBUG, "DATE & TIME(%s)", formattedString);
798 return g_strdup(formattedString);
801 gboolean _vc_core_util_phonelock_status(void)
803 gboolean b_phonelock = FALSE;
804 if (!vconf_get_bool(VCONFKEY_SETAPPL_STATE_POWER_ON_LOCK_BOOL, &b_phonelock)) {
805 CALL_ENG_DEBUG(ENG_DEBUG, "b_phonelock:[%d]", b_phonelock);
808 CALL_ENG_DEBUG(ENG_DEBUG, "get VCONFKEY_SETAPPL_STATE_POWER_ON_LOCK_BOOL failed..");
813 void _vc_core_util_download_test_call(char *result)
816 FILE *d_call_test = NULL;
817 char string[20] = { };
819 VOICECALL_RETURN_IF_FAIL(result != NULL);
822 snprintf(string, sizeof(string), "/tmp/%s", result);
824 d_call_test = fopen(string, "w");
825 if (d_call_test == NULL) {
826 CALL_ENG_DEBUG(ENG_DEBUG, "FAIL:fopen(%s)", string);
829 /*ret = fwrite("\0", sizeof(char), 1, d_call_test); */
830 /*CALL_ENG_DEBUG(ENG_DEBUG,"Result:fwrite(%d)", ret); */
832 ret = fclose(d_call_test);
833 CALL_ENG_DEBUG(ENG_DEBUG, "Result:fwrite(%d)", ret);
835 CALL_ENG_DEBUG(ENG_DEBUG, "FAIL:fclose");