Code Sync up from tizen_2.4 05/36905/1 submit/tizen_mobile/20150323.032021
authorDongchul Lim <dc7.lim@samsung.com>
Tue, 17 Mar 2015 04:28:56 +0000 (13:28 +0900)
committerDongchul Lim <dc7.lim@samsung.com>
Tue, 17 Mar 2015 04:34:24 +0000 (13:34 +0900)
Change-Id: If0f5274bdfd9985dd885516c3cf4659736c702b9

110 files changed:
.gitignore [deleted file]
AUTHORS [new file with mode: 0644]
CMakeLists.txt
include/at.h
include/co_call.h
include/co_context.h
include/co_custom.h [moved from tel-headers/include/tel_if.h with 53% similarity]
include/co_gps.h
include/co_modem.h
include/co_network.h
include/co_phonebook.h
include/co_ps.h [changed mode: 0755->0644]
include/co_sap.h
include/co_sat.h
include/co_sim.h
include/co_sms.h
include/co_ss.h
include/communicator.h
include/core_object.h
include/hal.h
include/log.h
include/mux.h
include/plugin.h
include/queue.h
include/server.h
include/storage.h
include/tcore.h
include/type/call.h [new file with mode: 0644]
include/type/command.h [deleted file]
include/type/common.h
include/type/gps.h [new file with mode: 0644]
include/type/modem.h [new file with mode: 0644]
include/type/network.h [new file with mode: 0644]
include/type/notification.h
include/type/phonebook.h [new file with mode: 0644]
include/type/ps.h
include/type/request.h [new file with mode: 0644]
include/type/response.h [new file with mode: 0644]
include/type/sap.h [new file with mode: 0644]
include/type/sat.h [new file with mode: 0644]
include/type/sat_internal.h [deleted file]
include/type/sim.h [new file with mode: 0644]
include/type/sms.h [new file with mode: 0644]
include/type/sound.h [new file with mode: 0644]
include/type/ss.h [new file with mode: 0644]
include/udev.h [deleted file]
include/user_request.h [new file with mode: 0644]
include/util.h
libtcore.manifest [moved from packaging/libtcore.manifest with 66% similarity]
packaging/libtcore.spec [changed mode: 0644->0755]
src/at.c
src/co_call.c
src/co_context.c
src/co_custom.c [new file with mode: 0644]
src/co_gps.c
src/co_modem.c
src/co_network.c
src/co_phonebook.c
src/co_ps.c
src/co_sap.c
src/co_sat.c
src/co_sim.c
src/co_sms.c
src/co_ss.c
src/communicator.c
src/core_object.c
src/hal.c
src/mux.c
src/plugin.c
src/queue.c
src/server.c
src/storage.c
src/udev.c [deleted file]
src/user_request.c [new file with mode: 0644]
src/util.c [changed mode: 0755->0644]
tcore.pc.in
tel-headers/CMakeLists.txt [deleted file]
tel-headers/include/tel_call.h [deleted file]
tel-headers/include/tel_gps.h [deleted file]
tel-headers/include/tel_modem.h [deleted file]
tel-headers/include/tel_network.h [deleted file]
tel-headers/include/tel_phonebook.h [deleted file]
tel-headers/include/tel_return.h [deleted file]
tel-headers/include/tel_sap.h [deleted file]
tel-headers/include/tel_sat.h [deleted file]
tel-headers/include/tel_sim.h [deleted file]
tel-headers/include/tel_sms.h [deleted file]
tel-headers/include/tel_ss.h [deleted file]
tel-headers/introspection/call.xml [deleted file]
tel-headers/introspection/gen.sh [deleted file]
tel-headers/introspection/gps.xml [deleted file]
tel-headers/introspection/manager.xml [deleted file]
tel-headers/introspection/modem.xml [deleted file]
tel-headers/introspection/network.xml [deleted file]
tel-headers/introspection/phonebook.xml [deleted file]
tel-headers/introspection/sap.xml [deleted file]
tel-headers/introspection/sat.xml [deleted file]
tel-headers/introspection/sim.xml [deleted file]
tel-headers/introspection/sms.xml [deleted file]
tel-headers/introspection/ss.xml [deleted file]
tel-headers/tel-headers.pc.in [deleted file]
unit-test/CMakeLists.txt [new file with mode: 0644]
unit-test/log.c [new file with mode: 0644]
unit-test/test-at.c [new file with mode: 0644]
unit-test/test-co.c [new file with mode: 0644]
unit-test/test-dcs.c [new file with mode: 0644]
unit-test/test-hal.c [new file with mode: 0644]
unit-test/test-network.c [new file with mode: 0644]
unit-test/test-queue.c [new file with mode: 0644]
unit-test/test-util.c [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
deleted file mode 100644 (file)
index 63619be..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#Copyright (c) 2013 GitHub, Inc.
-#
-#Permission is hereby granted,  free of charge,  to any person obtaining a
-#copy of this software and associated documentation files (the "Software"),
-#to deal in the Software without restriction, including without limitation
-#the rights to  use, copy, modify, merge, publish, distribute, sublicense,
-#and/or sell copies of the Software, and to permit persons to whom the
-#Software is furnished to do so, subject to the following conditions:
-#
-#The above copyright notice and this permission notice shall be included in
-#all copies or substantial portions of the Software.
-#
-#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-#FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-#DEALINGS IN THE SOFTWARE.
-#
-# https://github.com/github/gitignore
-
-# Object files
-*.o
-
-# Libraries
-*.lib
-*.a
-
-# Shared objects (inc. Windows DLLs)
-*.dll
-*.so
-*.so.*
-*.dylib
-
-# Executables
-*.exe
-*.out
-*.app
-
-# CMake
-CMakeCache.txt
-CMakeFiles
-Makefile
-cmake_install.cmake
-install_manifest.txt
-
-# Emacs
-*~
-\#*\#
-/.emacs.desktop
-/.emacs.desktop.lock
-.elc
-auto-save-list
-tramp
-.\#*
-
-# Org-mode
-.org-id-locations
-*_archive
-
-# Linux
-.*
-!.gitignore
-*~
-
-# Vim
-*.s[a-w][a-z]
-*.un~
-Session.vim
-.netrwhist
-*~
-
-# Eclipse
-*.pydevproject
-.project
-.metadata
-bin/**
-tmp/**
-tmp/**/*
-*.tmp
-*.bak
-*.swp
-*~.nib
-local.properties
-.classpath
-.settings/
-.loadpath
-
-# External tool builders
-.externalToolBuilders/
-
-# Locally stored "Eclipse launch configurations"
-*.launch
-
-# CDT-specific
-.cproject
-
-# PDT-specific
-.buildpath
diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..0e9faa9
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,6 @@
+Jongman Park <jman.park@samsung.com>
+Ja-young Gu <jygu@samsung.com>
+Kyeongchul Kim <kyeongchul.kim@samsung.com>
+DongHoo Park <donghoo.park@samsung.>
+Youngman Park <youngman.park@samsung.com>
+Inho Oh <inho48.oh@samsung.com>
index 9d5162a..808ee40 100755 (executable)
@@ -10,49 +10,55 @@ SET(INCLUDEDIR "\${prefix}/include")
 
 # Set required packages
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED glib-2.0 gudev-1.0 gobject-2.0 gio-2.0 gio-unix-2.0)
+pkg_check_modules(pkgs REQUIRED glib-2.0 gudev-1.0)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SOURCE_DIR}/include ${EXTRA_CFLAGS} -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align")
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/tel-headers/include)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SOURCE_DIR}/include ${EXTRA_CFLAGS} -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align -O2 -Wall  -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-variable")
 
 ADD_DEFINITIONS("-DFEATURE_TLOG_DEBUG")
 ADD_DEFINITIONS("-DTCORE_LOG_TAG=\"TCORE\"")
+#ADD_DEFINITIONS("-DTCORE_HAL_DEBUG")
 ADD_DEFINITIONS("-DTCORE_VERSION=\"${VERSION}\"")
 
 MESSAGE(${CMAKE_C_FLAGS})
 MESSAGE(${CMAKE_EXE_LINKER_FLAGS})
 
+IF (ARCH_EMUL)
+       ADD_DEFINITIONS("-DEMULATOR")
+ENDIF (ARCH_EMUL)
+
 SET(SRCS
-       src/server.c
-       src/plugin.c
-       src/hal.c
-       src/at.c
-#      src/udev.c
-       src/communicator.c
-       src/storage.c
-       src/queue.c
-       src/util.c
-       src/core_object.c
-       src/co_modem.c
-       src/co_network.c
-       src/co_ps.c
-       src/co_context.c
-       src/co_sim.c
-       src/co_sat.c
-       src/co_sap.c
-       src/co_call.c
-       src/co_ss.c
-       src/co_sms.c
-       src/co_phonebook.c
-       src/co_gps.c
-       src/mux.c
+               src/server.c
+               src/plugin.c
+               src/hal.c
+               src/at.c
+               src/communicator.c
+               src/storage.c
+               src/queue.c
+               src/user_request.c
+               src/util.c
+               src/core_object.c
+               src/co_modem.c
+               src/co_network.c
+               src/co_ps.c
+               src/co_context.c
+               src/co_sim.c
+               src/co_sat.c
+               src/co_sap.c
+               src/co_call.c
+               src/co_ss.c
+               src/co_sms.c
+               src/co_phonebook.c
+               src/co_gps.c
+               src/co_custom.c
+               src/mux.c
 )
 
+
+
 # library build
 ADD_LIBRARY(tcore SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(tcore ${pkgs_LDFLAGS})
@@ -62,11 +68,12 @@ SET_TARGET_PROPERTIES(tcore PROPERTIES VERSION 0.0.0 SOVERSION 0 OUTPUT_NAME tco
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 CONFIGURE_FILE(tcore.pc.in tcore.pc @ONLY)
 
+
 # install
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/tcore)
 INSTALL(TARGETS tcore
-       LIBRARY DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tcore.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+               LIBRARY DESTINATION lib)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tcore.pc DESTINATION lib/pkgconfig)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME libtcore)
 
-ADD_SUBDIRECTORY(tel-headers)
+ADD_SUBDIRECTORY(unit-test)
index 8adcc0f..f8e477e 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __AT_H__
-#define __AT_H__
+#ifndef __TCORE_AT_H__
+#define __TCORE_AT_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
 
 #include <tcore.h>
 #include <queue.h>
 
-#define ZERO           0
-
-typedef enum {
-    TCORE_AT_COMMAND_TYPE_NO_RESULT,   /* no intermediate response expected */
-    TCORE_AT_COMMAND_TYPE_NUMERIC,     /* a single intermediate response starting with a 0-9 */
-    TCORE_AT_COMMAND_TYPE_SINGLELINE,  /* a single intermediate response starting with a prefix */
-    TCORE_AT_COMMAND_TYPE_MULTILINE,   /* multiple line intermediate response starting with a prefix */
-    TCORE_AT_COMMAND_TYPE_PDU
-} TcoreAtCommandType;
-
-typedef struct {
-       gchar *cmd;
-       gchar *prefix;
-       TcoreAtCommandType type;
-
-       gchar *next_send_pos;
-} TcoreAtRequest;
-
-typedef struct {
-       gboolean success; /* true if final response indicates success (eg "OK") */
-       gchar *final_response; /* eg OK, ERROR */
+enum tcore_at_command_type {
+    TCORE_AT_NO_RESULT,   /* no intermediate response expected */
+    TCORE_AT_NUMERIC,     /* a single intermediate response starting with a 0-9 */
+    TCORE_AT_SINGLELINE,  /* a single intermediate response starting with a prefix */
+    TCORE_AT_MULTILINE,   /* multiple line intermediate response starting with a prefix */
+    TCORE_AT_PDU
+};
+
+enum ATCMEError{
+       AT_ERROR_MOBILE_FAILRURE                                        =0,
+       AT_ERROR_NOT_CONNECTED_TO_PHONE         =1,
+       AT_ERROR_LINK_RESERVED                                  =2,
+       AT_ERROR_OPER_NOT_ALLOWED                               =3,
+       AT_ERROR_OPER_NOT_SUPPORTED                     =4,
+       AT_ERROR_PH_SIM_PIN_REQUIRED                    =5,
+       AT_ERROR_PH_FSIM_PIN_REQUIRED                   =6,
+       AT_ERROR_PH_FSIM_PUK_REQUIRED                   =7,
+
+       AT_ERROR_SIM_NOT_INSERTED                               =10,
+       AT_ERROR_SIM_PIN_REQUIRED                               =11,
+       AT_ERROR_SIM_PUK_REQUIRED                               =12,
+       AT_ERROR_SIM_FAILURE                                            =13,
+       AT_ERROR_SIM_BUSY                                                       =14,
+       AT_ERROR_SIM_WRONG                                              =15,
+       AT_ERROR_INCORRECT_PWD                                  =16,
+       AT_ERROR_SIM_PIN2_REQUIRED                              =17,
+       AT_ERROR_SIM_PUK2_REQUIRED                              =18,
+
+       AT_ERROR_MEMORY_FULL                                            =20,
+       AT_ERROR_INVALID_INDEX                                  =21,
+       AT_ERROR_NOT_FOUND                                              =22,
+       AT_ERROR_MEMORY_FAILURE                                 =23,
+       AT_ERROR_TEXT_TOO_LONG                                  =24,
+       AT_ERROR_INVALID_CHAR_IN_STR                    =25,
+       AT_ERROR_DIAL_TOO_LONG                                  =26,
+       AT_ERROR_INVALID_CHAR_IN_DIAL                   =27,
+
+       AT_ERROR_NO_NETWORK_SVC                                 =30,
+       AT_ERROR_NETWORK_TIMEOUT                                =31,
+       AT_ERROR_EMERGENCY_CALL_ONLY                    =32,
+
+       AT_ERROR_NET_PERSONAL_PIN_REQ                   =40,
+       AT_ERROR_NET_PERSONAL_PUN_REQ                   =41,
+       AT_ERROR_NET_SUB_PERSONAL_PIN_REQ               =42,
+       AT_ERROR_NET_SUB_PERSONAL_PUK_REQ               =43,
+       AT_ERROR_PROVIDER_PERSONAL_PIN_REQ              =44,
+       AT_ERROR_PROVIDER_PERSONAL_PUK_REQ              =45,
+       AT_ERROR_CORP_PERSONAL_PIN_REQ                  =46,
+       AT_ERROR_CORP_PERSONAL_PUK_REQ                  =47,
+       AT_ERROR_HIDDEN_KEY_REQUIRED                    =48,
+       AT_ERROR_EAP_METHOD_NOT_SUPPORTED               =49,
+       AT_ERROR_INCORRECT_PARAM                                =50,
+
+       AT_ERROR_UNKNOWN                                                        =100
+};
+
+
+struct tcore_at_request {
+       char *cmd;
+       char *next_send_pos;
+       char *prefix;
+       enum tcore_at_command_type type;
+};
+
+struct tcore_at_response {
+       int success; /* true if final response indicates success (eg "OK") */
+       char *final_response; /* eg OK, ERROR */
        GSList *lines; /* any intermediate responses */
-} TcoreAtResponse;
+};
 
-typedef gboolean (*TcoreAtNotificationCallback)(TcoreAT *at, const GSList *lines,
+typedef gboolean (*TcoreATNotificationCallback)(TcoreAT *at, const GSList *lines,
                void *user_data);
 
-void tcore_at_process_binary_data(TcoreAT *at, gchar *position, guint data_len);
-gboolean tcore_at_add_hook(TcoreHal *hal, void *hook_func);
-
-TcoreAT *tcore_at_new(TcoreHal *hal);
-void tcore_at_free(TcoreAT *at);
-
-TelReturn tcore_at_buf_write(TcoreAT *at, guint data_len, const gchar *data);
-
-TelReturn tcore_at_set_request(TcoreAT *at, TcoreAtRequest *req);
-TelReturn tcore_at_send_data(TcoreAT *at, TcoreAtRequest *req, gboolean send);
-
-TcoreAtRequest *tcore_at_get_request(TcoreAT *at);
-TcoreAtResponse *tcore_at_get_response(TcoreAT *at);
+typedef struct tcore_at_response TcoreATResponse;
+typedef struct tcore_at_request TcoreATRequest;
 
-TelReturn tcore_at_add_notification(TcoreAT *at, const gchar *prefix, gboolean pdu,
-       TcoreAtNotificationCallback callback, void *user_data);
-TelReturn tcore_at_remove_notification(TcoreAT *at, const gchar *prefix, TcoreAtNotificationCallback callback);
-TelReturn tcore_at_remove_notification_full(TcoreAT *at, const gchar *prefix,
-       TcoreAtNotificationCallback callback, void *user_data);
+TcoreAT*         tcore_at_new(TcoreHal *hal);
+void             tcore_at_free(TcoreAT *at);
 
-TcoreAtRequest *tcore_at_request_new(const gchar *cmd, const gchar *prefix, TcoreAtCommandType type);
-void tcore_at_request_free(TcoreAtRequest *at_req);
+TReturn          tcore_at_buf_write(TcoreAT *at, unsigned int data_len,
+                     const char *data);
 
-gboolean tcore_at_process(TcoreAT *at, guint data_len, const gchar *data);
+TReturn          tcore_at_set_request(TcoreAT *at, TcoreATRequest *req, gboolean send);
+TcoreATRequest*  tcore_at_get_request(TcoreAT *at);
+TcoreATResponse* tcore_at_get_response(TcoreAT *at);
 
-TcorePending *tcore_at_pending_new(CoreObject *co, const gchar *cmd,
-       const gchar *prefix, TcoreAtCommandType type,
-       TcorePendingResponseCallback func, void *user_data);
-
-GSList *tcore_at_tok_new(const gchar *line);
-void tcore_at_tok_free(GSList *tokens);
-gchar *tcore_at_tok_extract(const gchar *src);
-gchar *tcore_at_tok_nth(GSList *tokens, guint index);
+void tcore_at_process_binary_data(TcoreAT *at, char *position, int data_len);
+gboolean tcore_at_add_hook(TcoreHal *hal, void *hook_func);
 
-TelReturn tcore_at_prepare_and_send_request(CoreObject *co,
-       const gchar *cmd, const gchar *prefix,
-       TcoreAtCommandType type, void *request,
-       TcorePendingResponseCallback resp_cb, void *resp_cb_data,
-       TcorePendingSendCallback send_cb, void *send_cb_data);
-TelReturn tcore_at_prepare_and_send_request_ex(CoreObject *co,
-       const gchar *cmd, const gchar *prefix, TcoreAtCommandType type,
-       TcorePendingPriority priority, void *request,
-       TcorePendingResponseCallback resp_cb, void *resp_cb_data,
-       TcorePendingSendCallback send_cb, void *send_cb_data,
-       guint timeout, TcorePendingTimeoutCallback timeout_cb, void *timeout_cb_data,
-       gboolean auto_free, gboolean abortable);
+TReturn          tcore_at_add_notification(TcoreAT *at, const char *prefix,
+                     gboolean pdu, TcoreATNotificationCallback callback,
+                     void *user_data);
+TReturn          tcore_at_remove_notification(TcoreAT *at, const char *prefix,
+                     TcoreATNotificationCallback callback);
+TReturn          tcore_at_remove_notification_full(TcoreAT *at,
+                     const char *prefix,
+                     TcoreATNotificationCallback callback, void *user_data);
+
+TcoreATRequest*  tcore_at_request_new(const char *cmd, const char *prefix,
+                     enum tcore_at_command_type type);
+void                   tcore_at_request_free(TcoreATRequest *req);
+void                   tcore_at_response_free(TcoreATResponse* rsp);
+
+gboolean         tcore_at_process(TcoreAT *at, unsigned int data_len,
+                     const char *data);
+
+TcorePending*    tcore_at_pending_new(CoreObject *co, const char *cmd,
+                     const char *prefix, enum tcore_at_command_type type,
+                     TcorePendingResponseCallback func, void *user_data);
+
+GSList*          tcore_at_tok_new(const char *line);
+void             tcore_at_tok_free(GSList *tokens);
+char*            tcore_at_tok_extract(const char *src);
+char*            tcore_at_tok_nth(GSList *tokens, unsigned int token_index);
+void tcore_free_pending_timeout_at_request(TcoreAT *at);
+
+TReturn tcore_prepare_and_send_at_request(CoreObject *co,
+                                                                                               const char *at_cmd,
+                                                                                               const char *at_cmd_prefix,
+                                                                                               enum tcore_at_command_type at_cmd_type,
+                                                                                               UserRequest *ur,
+                                                                                               TcorePendingResponseCallback resp_cb,
+                                                                                               void *resp_cb_data,
+                                                                                               TcorePendingSendCallback send_cb,
+                                                                                               void *send_cb_data,
+                                                                                               unsigned int timeout,
+                                                                                               TcorePendingTimeoutCallback timeout_cb,
+                                                                                               void *timeout_cb_data);
+
+__END_DECLS
 
-#ifdef __cplusplus
-}
 #endif
-
-#endif /* __AT_H__ */
index e339298..29481b3 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef _CO_CALL_H__
-#define _CO_CALL_H__
+#ifndef __TCORE_CO_CALL_H__
+#define __TCORE_CO_CALL_H__
 
-#include "core_object.h"
-#include <tel_call.h>
-#include <tel_return.h>
+#include <core_object.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
 
-typedef TelCallStatus CallObject;
-
-typedef struct {
-       TelReturn (*dial)(CoreObject *co, const TelCallDial *dial_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*answer)(CoreObject *co, TelCallAnswerType ans_type, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*end)(CoreObject *co, const TelCallEnd *end_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*send_dtmf)(CoreObject *co, const char *dtmf_str, TcoreObjectResponseCallback cb,  void *cb_data);
-       TelReturn (*hold)(CoreObject *co, TcoreObjectResponseCallback cb ,void *cb_data);
-       TelReturn (*active)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*swap)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*join)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*split)(CoreObject *co, unsigned int call_id, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*transfer)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*deflect)(CoreObject *co, const char *deflect_to, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_active_line)(CoreObject *co, TelCallActiveLine active_line, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_active_line)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_volume_info)(CoreObject *co, const TelCallVolumeInfo *volume_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_volume_info)(CoreObject *co, TelCallSoundDevice sound_device, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_sound_path)(CoreObject *co, const TelCallSoundPathInfo *sound_path_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_mute)(CoreObject *co, gboolean mute, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_mute_status)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_sound_recording)(CoreObject *co, TelCallSoundRecording sound_rec, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_sound_equalization)(CoreObject *co, const TelCallSoundEqualization *sound_eq, TcoreObjectResponseCallback cb, void *cb_data);
-} TcoreCallOps;
-
-
-/* Call Core API */
-CoreObject *tcore_call_new(TcorePlugin *p, TcoreCallOps *ops, TcoreHal *hal);
-void tcore_call_free(CoreObject *co);
-
-gboolean tcore_call_set_ops(CoreObject *co, TcoreCallOps *ops);
-void tcore_call_override_ops(CoreObject *co, TcoreCallOps *call_ops);
-
-/* Call Object API */
-CallObject *tcore_call_object_new(CoreObject *co, unsigned int call_id);
-void tcore_call_object_free(CoreObject *co, CallObject *call_obj);
-CallObject *tcore_call_object_current_on_mt_processing(CoreObject *co);
-CallObject *tcore_call_object_current_on_mo_processing(CoreObject *co);
-CallObject *tcore_call_object_find_by_id(CoreObject *co, unsigned int call_id);
-CallObject *tcore_call_object_find_by_number(CoreObject *co, const char *num);
-GSList *tcore_call_object_find_by_status(CoreObject *co, TelCallState cs);
-
-gboolean tcore_call_object_get_id(CallObject *call_obj, unsigned int *call_id);
-
-gboolean tcore_call_object_set_type(CallObject *call_obj, TelCallType ct);
-gboolean tcore_call_object_get_call_type(CallObject *call_obj, TelCallType *call_type);
-
-
-gboolean tcore_call_object_set_direction(CallObject *call_obj, gboolean mo);
-gboolean tcore_call_object_get_direction(CallObject *call_obj, gboolean *mo_call);
-
-gboolean tcore_call_object_set_state(CallObject *call_obj, TelCallState call_state);
-gboolean tcore_call_object_get_state(CallObject *call_obj, TelCallState *call_state);
-
-gboolean tcore_call_object_set_cli_info(CallObject *call_obj, TelCallCliValidity cli_validity, char *num);
-gboolean tcore_call_object_get_cli_validity(CallObject *call_obj, TelCallCliValidity *cli_validity);
-gsize tcore_call_object_get_number(CallObject *call_obj, char *num);
-
-gboolean tcore_call_object_set_cni_info(CallObject *call_obj, TelCallCniValidity cni_validity, char *name);
-gboolean tcore_call_object_get_cni_validity(CallObject *call_obj, TelCallCniValidity *cni_validity);
-gsize tcore_call_object_get_name(CallObject *call_obj, char *name);
-
-gboolean tcore_call_object_set_multiparty_state(CallObject *call_obj, gboolean state);
-gboolean tcore_call_object_get_multiparty_state(CallObject *call_obj, gboolean *mpty);
-
-gboolean tcore_call_object_set_mt_forward(CallObject *call_obj, gboolean forward);
-gboolean tcore_call_object_get_mt_forward(CallObject *call_obj, gboolean *forward);
-
-gboolean tcore_call_object_set_active_line(CallObject *call_obj, TelCallActiveLine line);
-gboolean tcore_call_object_get_active_line(CallObject *call_obj, TelCallActiveLine *active_line);
-gboolean tcore_call_object_get_count(CoreObject *co, unsigned int *count);
-
-#ifdef __cplusplus
-}
-#endif
+#define MAX_CALL_NUMBER_LEN                    83
+#define MAX_CALL_NAME_LEN                      83
+
+enum tcore_call_type {
+       TCORE_CALL_TYPE_VOICE,
+       TCORE_CALL_TYPE_VIDEO,
+       TCORE_CALL_TYPE_E911,
+       TCORE_CALL_TYPE_STDOTASP,
+       TCORE_CALL_TYPE_NONSTDOTASP,
+};
+
+enum tcore_call_direction {
+       TCORE_CALL_DIRECTION_NONE,
+       TCORE_CALL_DIRECTION_OUTGOING,
+       TCORE_CALL_DIRECTION_INCOMING,
+};
+
+enum tcore_call_status {
+       TCORE_CALL_STATUS_IDLE,
+       TCORE_CALL_STATUS_ACTIVE,
+       TCORE_CALL_STATUS_HELD,
+       TCORE_CALL_STATUS_DIALING,
+       TCORE_CALL_STATUS_ALERT,
+       TCORE_CALL_STATUS_INCOMING,
+       TCORE_CALL_STATUS_WAITING,
+};
+
+enum tcore_call_no_cli_cause {
+       TCORE_CALL_NO_CLI_CAUSE_NONE = -1,
+       TCORE_CALL_NO_CLI_CAUSE_UNAVAILABLE,
+       TCORE_CALL_NO_CLI_CAUSE_USER_REJECTED,
+       TCORE_CALL_NO_CLI_CAUSE_OTHERS,
+       TCORE_CALL_NO_CLI_CAUSE_PAY_PHONE
+};
+
+enum tcore_call_cli_mode {
+       TCORE_CALL_CLI_MODE_PRESENT,
+       TCORE_CALL_CLI_MODE_RESTRICT,
+       TCORE_CALL_CLI_MODE_UNAVAILABLE,
+       TCORE_CALL_CLI_MODE_DEFAULT,
+};
+
+enum tcore_call_cna_mode {
+       TCORE_CALL_CNA_MODE_DEFAULT,
+       TCORE_CALL_CNA_MODE_PRESENT,
+       TCORE_CALL_CNA_MODE_RESTRICT,
+};
+
+enum tcore_call_answer_type {
+       TCORE_CALL_ANSWER_ACCEPT,
+       TCORE_CALL_ANSWER_REJECT,
+       TCORE_CALL_ANSWER_REPLACE,
+       TCORE_CALL_ANSWER_HOLD_AND_ACCEPT,
+};
+
+enum tcore_call_end_type {
+       TCORE_CALL_END_DEFAULT,
+       TCORE_CALL_END_ALL,
+       TCORE_CALL_END_ALL_ACTIVE,
+       TCORE_CALL_END_ALL_HELD,
+};
+
+typedef struct call_object CallObject;
+
+struct tcore_call_operations {
+       TReturn (*dial)(CoreObject *o, UserRequest *ur);
+       TReturn (*answer)(CoreObject *o, UserRequest *ur);
+       TReturn (*end)(CoreObject *o, UserRequest *ur);
+       TReturn (*hold)(CoreObject *o, UserRequest *ur);
+       TReturn (*active)(CoreObject *o, UserRequest *ur);
+       TReturn (*swap)(CoreObject *o, UserRequest *ur);
+       TReturn (*join)(CoreObject *o, UserRequest *ur);
+       TReturn (*split)(CoreObject *o, UserRequest *ur);
+       TReturn (*deflect)(CoreObject* o, UserRequest *ur);
+       TReturn (*transfer)(CoreObject* o, UserRequest *ur);
+       TReturn (*start_cont_dtmf)(CoreObject *o, UserRequest *ur);
+       TReturn (*stop_cont_dtmf)(CoreObject *o, UserRequest *ur);
+       TReturn (*send_burst_dtmf)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sound_path)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sound_volume_level)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_sound_volume_level)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sound_mute_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_sound_mute_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sound_recording)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sound_equalization)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sound_noise_reduction)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sound_clock_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_active_line)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_active_line)(CoreObject *o, UserRequest *ur);
+       TReturn (*activate_ccbs)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_preferred_voice_subscription)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_preferred_voice_subscription)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_privacy_mode)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_privacy_mode)(CoreObject *o, UserRequest *ur);
+};
+
+struct tcore_call_information_operations {
+       void (*mo_call_col)(CoreObject *o, char* number);
+       void (*mo_call_waiting)(CoreObject *o);
+       void (*mo_call_cug)(CoreObject *o, int cug_index);
+       void (*mo_call_forwarded)(CoreObject *o);
+       void (*mo_call_barred_incoming)(CoreObject *o);
+       void (*mo_call_barred_outgoing)(CoreObject *o);
+       void (*mo_call_deflected)(CoreObject *o);
+       void (*mo_call_clir_suppression_reject)(CoreObject *o);
+       void (*mo_call_cfu)(CoreObject *o);
+       void (*mo_call_cfc)(CoreObject *o);
+       void (*mt_call_cli)(CoreObject *o, enum tcore_call_cli_mode mode, char *number);
+       void (*mt_call_cna)(CoreObject *o, enum tcore_call_cna_mode mode, char *name, int dcs);
+       void (*mt_call_forwarded_call)(CoreObject *o, char* number);
+       void (*mt_call_cug_call)(CoreObject *o, int cug_index, char* number);
+       void (*mt_call_deflected_call)(CoreObject *o, char* number);
+       void (*mt_call_transfered)(CoreObject *o, char* number);
+       void (*call_held)(CoreObject *o, char* number);
+       void (*call_active)(CoreObject *o, char* number);
+       void (*call_joined)(CoreObject *o, char* number);
+       void (*call_released_on_hold)(CoreObject *o, char* number);
+       void (*call_transfer_alert)(CoreObject *o, char* number);
+       void (*call_transfered)(CoreObject *o, char* number);
+       void (*call_cf_check_message)(CoreObject *o, char* number);
+};
+
+typedef void(*ConfirmCallback)(TcorePending *p, int data_len, const void *data, void *user_data);
+
+struct tcore_call_control_operations {
+       TReturn (*answer_hold_and_accept)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*answer_replace)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*answer_reject)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*end_specific)( CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data );
+       TReturn (*end_all_active)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*end_all_held)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*active)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*hold)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*swap)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*join)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*split)( CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data );
+       TReturn (*transfer)( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+       TReturn (*deflect)( CoreObject* o, UserRequest* ur, const char* number, ConfirmCallback cb, void* user_data );
+};
+
+// Call Core API
+CoreObject*                            tcore_call_new(TcorePlugin *p, const char *name, struct tcore_call_operations *ops, TcoreHal *hal);
+void                                   tcore_call_free( CoreObject *o);
+
+void tcore_call_set_ops(CoreObject *o, struct tcore_call_operations *ops);
+
+// Call Object API
+CallObject*                            tcore_call_object_new( CoreObject *o, int id );
+gboolean                               tcore_call_object_free( CoreObject *o, CallObject *co );
+
+int                                            tcore_call_object_total_length( CoreObject *o );
+CallObject*                            tcore_call_object_current_on_mt_processing( CoreObject *o );
+CallObject*                            tcore_call_object_current_on_mo_processing( CoreObject *o );
+CallObject*                            tcore_call_object_find_by_id( CoreObject *o, int id );
+CallObject*                            tcore_call_object_find_by_number( CoreObject *o, char *num );
+GSList*                                        tcore_call_object_find_by_status( CoreObject *o, enum tcore_call_status cs );
+
+int                                            tcore_call_object_get_id( CallObject *co );
+
+gboolean                               tcore_call_object_set_type( CallObject *co, enum tcore_call_type ct );
+enum tcore_call_type   tcore_call_object_get_type( CallObject *co );
+
+gboolean                               tcore_call_object_set_direction( CallObject *co, enum tcore_call_direction cd );
+enum tcore_call_direction tcore_call_object_get_direction( CallObject *co );
+
+gboolean                               tcore_call_object_set_status( CallObject *co, enum tcore_call_status cs );
+enum tcore_call_status  tcore_call_object_get_status( CallObject *co );
+
+gboolean tcore_call_object_set_cli_info(struct call_object *co,
+                                               enum tcore_call_cli_mode mode, enum tcore_call_no_cli_cause cause,
+                                               char *num, int num_len);
+enum tcore_call_cli_mode tcore_call_object_get_cli_mode( CallObject *co );
+enum tcore_call_no_cli_cause tcore_call_object_get_no_cli_cause(struct call_object *co);
+int                                            tcore_call_object_get_number( CallObject *co, char *num );
+
+gboolean                               tcore_call_object_set_cna_info( CallObject *co, enum tcore_call_cna_mode mode, char *name, int dcs );
+enum tcore_call_cna_mode tcore_call_object_get_cna_mode( CallObject *co );
+int                                            tcore_call_object_get_name( CallObject *co, char *name );
+
+gboolean                               tcore_call_object_set_multiparty_state ( CallObject *co,  gboolean is );
+gboolean                               tcore_call_object_get_multiparty_state ( CallObject *co );
+
+gboolean                               tcore_call_object_set_active_line( CallObject *co, unsigned int line );
+int                                            tcore_call_object_get_active_line( CallObject *co );
+gboolean tcore_call_object_set_is_volte_call(CallObject *co, gboolean flag);
+gboolean tcore_call_object_get_is_volte_call(CallObject *co);
+gboolean tcore_call_object_set_session_id(CallObject *co, int session_id);
+int tcore_call_object_get_session_id(CallObject *co);
+gboolean tcore_call_object_set_conf_call_session_id(CallObject *co, int session_id);
+int tcore_call_object_get_conf_call_session_id(CallObject *co);
+gboolean tcore_call_object_set_early_media(CallObject *co, gboolean flag);
+gboolean tcore_call_object_get_early_media(CallObject *co);
+struct call_object *tcore_call_object_find_by_session_id(CoreObject *o, int session_id);
+gboolean tcore_call_object_check_cs_call_existence(CoreObject *o);
+GSList *tcore_call_object_get_all_session_ids(CoreObject *o);
+
+// Call Control API
+gboolean                               tcore_call_control_new( CoreObject *o, struct tcore_call_control_operations *ops );
+void                                   tcore_call_control_free( CoreObject *o );
+
+TReturn                                        tcore_call_control_answer_hold_and_accept( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_answer_replace( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_answer_reject( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+
+TReturn                                        tcore_call_control_end_specific( CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_end_all_active( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_end_all_held( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+
+TReturn                                        tcore_call_control_active( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_hold( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_swap( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_join( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_split( CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_transfer( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data );
+TReturn                                        tcore_call_control_deflect( CoreObject* o, UserRequest* ur, const char* number, ConfirmCallback cb, void* user_data );
+
+void                                   tcore_call_control_set_operations( CoreObject* o, struct tcore_call_control_operations *ops );
+
+
+void                                   tcore_call_information_mo_col( CoreObject *o, char* number );
+void                                   tcore_call_information_mo_waiting( CoreObject *o );
+void                                   tcore_call_information_mo_cug( CoreObject *o, int cug_index );
+void                                   tcore_call_information_mo_forwarded( CoreObject *o );
+void                                   tcore_call_information_mo_barred_incoming( CoreObject *o );
+void                                   tcore_call_information_mo_barred_outgoing( CoreObject *o );
+void                                   tcore_call_information_mo_deflected( CoreObject *o );
+void                                   tcore_call_information_mo_clir_suppression_reject( CoreObject *o );
+void                                   tcore_call_information_mo_cfu( CoreObject *o );
+void                                   tcore_call_information_mo_cfc( CoreObject *o );
+
+void                                   tcore_call_information_mt_cli( CoreObject *o, enum tcore_call_cli_mode mode, char* number );
+void                                   tcore_call_information_mt_cna( CoreObject *o, enum tcore_call_cna_mode mode, char* name, int dcs );
+void                                   tcore_call_information_mt_forwarded_call( CoreObject *o, char* number );
+void                                   tcore_call_information_mt_cug_call( CoreObject *o, int cug_index, char* number );
+void                                   tcore_call_information_mt_deflected_call( CoreObject *o, char* number );
+void                                   tcore_call_information_mt_transfered( CoreObject *o, char* number );
+
+void                                   tcore_call_information_held( CoreObject *o, char* number );
+void                                   tcore_call_information_active( CoreObject *o, char* number );
+void                                   tcore_call_information_joined( CoreObject *o, char* number );
+void                                   tcore_call_information_released_on_hold( CoreObject *o, char* number );
+void                                   tcore_call_information_transfer_alert( CoreObject *o, char* number );
+void                                   tcore_call_information_transfered( CoreObject *o, char* number );
+void                                   tcore_call_information_cf_check_ss_message( CoreObject *o, char* number );
+
+void                                   tcore_call_information_set_operations( CoreObject *o, struct tcore_call_information_operations *ops );
+
+__END_DECLS
 
 #endif
index a8a71e5..c2921f7 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_CONTEXT_H__
-#define __CO_CONTEXT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef __TCORE_CO_CONTEXT_H__
+#define __TCORE_CO_CONTEXT_H__
 
 #include <core_object.h>
-#include <tel_return.h>
-#include "type/ps.h"
-
-typedef enum {
-       TCORE_CONTEXT_STATE_DEACTIVATED,
-       TCORE_CONTEXT_STATE_DEFINING,
-       TCORE_CONTEXT_STATE_DEFINED,
-       TCORE_CONTEXT_STATE_ACTIVATING,
-       TCORE_CONTEXT_STATE_ACTIVATED,
-       TCORE_CONTEXT_STATE_DEACTIVATING,
-} TcoreContextState;
-
-typedef enum {
-       TCORE_CONTEXT_TYPE_UNKNOWN,
-       TCORE_CONTEXT_TYPE_X25,
-       TCORE_CONTEXT_TYPE_IP,
-       TCORE_CONTEXT_TYPE_IHOST,
-       TCORE_CONTEXT_TYPE_PPP,
-       TCORE_CONTEXT_TYPE_IPV6,
-} TcoreContextType;
-
-typedef enum {
-       TCORE_CONTEXT_ROLE_UNKNOWN,
-       TCORE_CONTEXT_ROLE_INTERNET,
-       TCORE_CONTEXT_ROLE_MMS,
-       TCORE_CONTEXT_ROLE_PREPAID_INTERNET,
-       TCORE_CONTEXT_ROLE_PREPAID_MMS,
-       TCORE_CONTEXT_ROLE_TETHERING,
-       TCORE_CONTEXT_ROLE_USER_DEFINED,
-} TcoreContextRole;
-
-typedef enum {
-       TCORE_CONTEXT_D_COMP_OFF,
-       TCORE_CONTEXT_D_COMP_ON,
-       TCORE_CONTEXT_D_COMP_V42BIS,
-       TCORE_CONTEXT_D_COMP_V44,
-} TcoreContextDComp;
-
-typedef enum {
-       TCORE_CONTEXT_H_COMP_OFF,
-       TCORE_CONTEXT_H_COMP_ON,
-       TCORE_CONTEXT_H_COMP_RFC1144,
-       TCORE_CONTEXT_H_COMP_RFC2507,
-       TCORE_CONTEXT_H_COMP_RFC3095
-} TcoreContextHComp;
-
-typedef enum {
-       TCORE_CONTEXT_AUTH_NONE,
-       TCORE_CONTEXT_AUTH_PAP,
-       TCORE_CONTEXT_AUTH_CHAP
-} TcoreContextAuth;
-
-CoreObject *tcore_context_new(TcorePlugin *p, TcoreHal *hal);
-void tcore_context_free(CoreObject *co);
-
-gboolean tcore_context_get_state(CoreObject *co,  TcoreContextState *state);
-gboolean tcore_context_set_state(CoreObject *co, TcoreContextState state);
-
-gboolean tcore_context_get_id(CoreObject *co, guint *id);
-gboolean tcore_context_set_id(CoreObject *co, guint id);
-
-gboolean tcore_context_get_role(CoreObject *co, TcoreContextRole *role);
-gboolean tcore_context_set_role(CoreObject *co, TcoreContextRole type);
-
-gboolean tcore_context_get_apn(CoreObject *co, gchar **apn);
-gboolean tcore_context_set_apn(CoreObject *co, const gchar *apn);
-
-gboolean tcore_context_get_address(CoreObject *co, gchar **addr);
-gboolean tcore_context_set_address(CoreObject *co, const gchar *addr);
-
-gboolean tcore_context_get_dns1(CoreObject *co, gchar **dns);
-gboolean tcore_context_set_dns1(CoreObject *co, const gchar *dns);
-
-gboolean tcore_context_get_dns2(CoreObject *co, gchar **dns);
-gboolean tcore_context_set_dns2(CoreObject *co, const gchar *dns);
 
-gboolean tcore_context_get_type(CoreObject *co, TcoreContextType *type);
-gboolean tcore_context_set_type(CoreObject *co, TcoreContextType type);
+__BEGIN_DECLS
+
+enum co_context_state {
+       CONTEXT_STATE_DEACTIVATED,
+       CONTEXT_STATE_ACTIVATING,
+       CONTEXT_STATE_ACTIVATED,
+       CONTEXT_STATE_DEACTIVATING,
+};
+
+enum co_context_type {
+       CONTEXT_TYPE_UNKNOWN,
+       CONTEXT_TYPE_X25,
+       CONTEXT_TYPE_IP,
+       CONTEXT_TYPE_IHOST,
+       CONTEXT_TYPE_PPP,
+       CONTEXT_TYPE_IPV6,
+       CONTEXT_TYPE_IPV4V6,
+};
+
+enum co_context_role {
+       CONTEXT_ROLE_UNKNOWN = -1,
+       CONTEXT_ROLE_IMS = 0,
+       CONTEXT_ROLE_INTERNET,
+       CONTEXT_ROLE_MMS,
+       CONTEXT_ROLE_PREPAID_INTERNET,
+       CONTEXT_ROLE_PREPAID_MMS,
+       CONTEXT_ROLE_TETHERING,
+       CONTEXT_ROLE_IMS_EMERGENCY,
+       CONTEXT_ROLE_USER_DEFINED,
+};
+
+enum co_context_d_comp {
+       CONTEXT_D_COMP_OFF,
+       CONTEXT_D_COMP_ON,
+       CONTEXT_D_COMP_V42BIS,
+       CONTEXT_D_COMP_V44,
+};
+
+enum co_context_h_comp {
+       CONTEXT_H_COMP_OFF,
+       CONTEXT_H_COMP_ON,
+       CONTEXT_H_COMP_RFC1144,
+       CONTEXT_H_COMP_RFC2507,
+       CONTEXT_H_COMP_RFC3095
+};
+
+enum co_context_auth {
+       CONTEXT_AUTH_NONE,
+       CONTEXT_AUTH_PAP,
+       CONTEXT_AUTH_CHAP
+};
+
+typedef struct {
+       unsigned int count;
+       char **addr;
+} pcscf_addr;
+
+enum co_context_tech {
+       CONTEXT_TECH_INVALID = -1,
+       CONTEXT_TECH_3GPP,
+       CONTEXT_TECH_3GPP2
+};
+
+CoreObject*              tcore_context_new(TcorePlugin *p, const char *name, TcoreHal *hal);
+void                     tcore_context_free(CoreObject *o);
+
+TReturn                  tcore_context_set_state(CoreObject *o, enum co_context_state state);
+enum co_context_state    tcore_context_get_state(CoreObject *o);
+TReturn                  tcore_context_set_id(CoreObject *o, unsigned char id);
+unsigned char             tcore_context_get_id(CoreObject *o);
+TReturn                  tcore_context_set_role(CoreObject *o, enum co_context_role type);
+enum co_context_role     tcore_context_get_role(CoreObject *o);
+
+TReturn                  tcore_context_set_apn(CoreObject *o, const char *apn);
+char*                    tcore_context_get_apn(CoreObject *o);
+TReturn                  tcore_context_set_address(CoreObject *o, const char *addr);
+char*                    tcore_context_get_address(CoreObject *o);
+TReturn                  tcore_context_set_type(CoreObject *o, enum co_context_type type);
+enum co_context_type     tcore_context_get_type(CoreObject *o);
+TReturn                  tcore_context_set_data_compression(CoreObject *o, enum co_context_d_comp comp);
+enum co_context_d_comp   tcore_context_get_data_compression(CoreObject *o);
+TReturn                  tcore_context_set_header_compression(CoreObject *o, enum co_context_h_comp comp);
+enum co_context_h_comp   tcore_context_get_header_compression(CoreObject *o);
+TReturn tcore_context_set_tech_preference(CoreObject *o, enum co_context_tech tech);
+enum co_context_tech tcore_context_get_tech_preference(CoreObject *o);
+TReturn                  tcore_context_set_username(CoreObject *o, const char *username);
+char*                    tcore_context_get_username(CoreObject *o);
+TReturn                  tcore_context_set_password(CoreObject *o, const char *password);
+char*                    tcore_context_get_password(CoreObject *o);
+TReturn                  tcore_context_set_dns1(CoreObject *o, const char *dns);
+TReturn                  tcore_context_set_ipv6_dns1(CoreObject *o, const char *dns);
+char*                    tcore_context_get_dns1(CoreObject *o);
+TReturn                  tcore_context_set_dns2(CoreObject *o, const char *dns);
+TReturn                  tcore_context_set_ipv6_dns2(CoreObject *o, const char *dns);
+char*                    tcore_context_get_dns2(CoreObject *o);
+TReturn                  tcore_context_set_auth(CoreObject *o, enum co_context_auth auth);
+enum co_context_auth     tcore_context_get_auth(CoreObject *o);
+TReturn                  tcore_context_set_proxy(CoreObject *o, const char *proxy);
+char*                    tcore_context_get_proxy(CoreObject *o);
+TReturn                  tcore_context_set_mmsurl(CoreObject *o, const char *mmsurl);
+char*                    tcore_context_get_mmsurl(CoreObject *o);
+TReturn                  tcore_context_set_profile_name(CoreObject *o, const char *profile_name);
+char*                    tcore_context_get_profile_name(CoreObject *o);
+TReturn                tcore_context_set_default_profile(CoreObject *o, gboolean default_conn);
+gboolean               tcore_context_get_default_profile(CoreObject *o);
+
+TReturn                  tcore_context_set_devinfo(CoreObject *o, struct tnoti_ps_pdp_ipconfiguration *devinfo);
+TReturn                  tcore_context_reset_devinfo(CoreObject *o);
+void                     tcore_context_cp_service_info(CoreObject *dest, CoreObject *src);
+
+char*                    tcore_context_get_ipv4_addr(CoreObject *o);
+char*                    tcore_context_get_ipv4_dns1(CoreObject *o);
+char*                    tcore_context_get_ipv4_dns2(CoreObject *o);
+char*                    tcore_context_get_ipv4_gw(CoreObject *o);
+char*                    tcore_context_get_ipv4_devname(CoreObject *o);
+
+char*                    tcore_context_get_ipv6_addr(CoreObject *o);
+char*                    tcore_context_get_ipv6_dns1(CoreObject *o);
+char*                    tcore_context_get_ipv6_dns2(CoreObject *o);
+char*                    tcore_context_get_ipv6_gw(CoreObject *o);
+
+pcscf_addr *tcore_context_get_pcscf_ipv4_addr(CoreObject *o);
+pcscf_addr *tcore_context_get_pcscf_ipv6_addr(CoreObject *o);
+TReturn tcore_context_set_attach_apn(CoreObject *o, gboolean flag);
+gboolean tcore_context_get_attach_apn(CoreObject *o);
+
+__END_DECLS
 
-gboolean tcore_context_get_data_compression(CoreObject *co, TcoreContextDComp *comp);
-gboolean tcore_context_set_data_compression(CoreObject *co, TcoreContextDComp comp);
-
-gboolean tcore_context_get_header_compression(CoreObject *co, TcoreContextHComp *comp);
-gboolean tcore_context_set_header_compression(CoreObject *co, TcoreContextHComp comp);
-
-gboolean tcore_context_get_username(CoreObject *co, gchar **username);
-gboolean tcore_context_set_username(CoreObject *co, const gchar *username);
-
-gboolean tcore_context_get_password(CoreObject *co, gchar **password);
-gboolean tcore_context_set_password(CoreObject *co, const gchar *password);
-
-gboolean tcore_context_get_auth(CoreObject *co, TcoreContextAuth *auth);
-gboolean tcore_context_set_auth(CoreObject *co, TcoreContextAuth auth);
-
-gboolean tcore_context_get_proxy(CoreObject *co, gchar **proxy);
-gboolean tcore_context_set_proxy(CoreObject *co, const gchar *proxy);
-
-gboolean tcore_context_get_mmsurl(CoreObject *co, gchar **mmsurl);
-gboolean tcore_context_set_mmsurl(CoreObject *co, const gchar *mmsurl);
-
-gboolean tcore_context_get_profile_name(CoreObject *co, gchar **profile_name);
-gboolean tcore_context_set_profile_name(CoreObject *co, const gchar *profile_name);
-
-gboolean tcore_context_set_devinfo(CoreObject *co, TcorePsPdpIpConf *devinfo);
-gboolean tcore_context_reset_devinfo(CoreObject *co);
-
-gboolean tcore_context_get_ipv4_addr(CoreObject *co, gchar **ipv4);
-gboolean tcore_context_set_ipv4_addr(CoreObject *co, const gchar *addr);
-
-gboolean tcore_context_get_ipv4_dns1(CoreObject *co, gchar **ipv4_dns);
-gboolean tcore_context_get_ipv4_dns2(CoreObject *co, gchar **ipv4_dns2);
-gboolean tcore_context_set_ipv4_dns(CoreObject *co, const gchar *dns1, const gchar *dns2);
-
-gboolean tcore_context_get_ipv4_gw(CoreObject *co, gchar **ipv4_gw);
-
-gboolean tcore_context_get_ipv4_devname(CoreObject *co, gchar **dev_name);
-gboolean tcore_context_set_ipv4_devname(CoreObject *co, const gchar *name);
-
-void tcore_context_cp_service_info(CoreObject *dest, CoreObject *src);
-
-#ifdef __cplusplus
-}
 #endif
-
-#endif /* __CO_CONTEXT_H__ */
similarity index 53%
rename from tel-headers/include/tel_if.h
rename to include/co_custom.h
index b159238..e590297 100644 (file)
@@ -1,8 +1,9 @@
 /*
- * tel-headers
+ * custom
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Anga Santhosh Kumar <santhosh.a@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __TEL_IF_H__
-#define __TEL_IF_H__
+#ifndef __TCORE_CO_CUSTOM_H__
+#define __TCORE_CO_CUSTOM_H__
+
+__BEGIN_DECLS
 
-/** Telephony service name */
-#define TELEPHONY_SERVICE      "org.tizen.telephony"
+typedef void *tcore_custom_operations;
 
-/** Telephony object path */
-#define TELEPHONY_OBJECT_PATH "/org/tizen/telephony"
+CoreObject *tcore_custom_new(TcorePlugin *p,
+       const char *name, tcore_custom_operations ops,
+       CoreObjectDispatcher dispatcher, TcoreHal *hal);
+void tcore_custom_free(CoreObject *co);
 
-#ifdef __cplusplus
-}
-#endif
+__END_DECLS
 
-#endif /* __TEL_IF_H__ */
+#endif /* __TCORE_CO_CUSTOM_H__ */
index ad4202d..d97881a 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_GPS_H__
-#define __CO_GPS_H__
-
-#include "core_object.h"
-#include <tel_gps.h>
-#include <tel_return.h>
+#ifndef __TCORE_CO_GPS_H__
+#define __TCORE_CO_GPS_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <core_object.h>
 
-typedef struct {
-    TelReturn (*confirm_measure_pos)(CoreObject *co, const TelGpsDataInfo *gps_data,
-                               TcoreObjectResponseCallback cb, void *cb_data);
-    TelReturn (*set_frequency_aiding)(CoreObject *co, gboolean state,
-                               TcoreObjectResponseCallback cb, void *cb_data);
-} TcoreGpsOps;
+__BEGIN_DECLS
 
+struct tcore_gps_operations {
+       TReturn (*confirm_measure_pos)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_frequency_aiding)(CoreObject *o, UserRequest *ur);
+       TReturn (*enable_smart_assistant)(CoreObject *o, UserRequest *ur);
+       TReturn (*disable_smart_assistant)(CoreObject *o, UserRequest *ur);
+       TReturn (*sync_smart_assistant_area_list)(CoreObject *o, UserRequest *ur);
+       TReturn (*del_smart_assistant_area_list)(CoreObject *o, UserRequest *ur);
+       TReturn (*add_smart_assistant_area)(CoreObject *o, UserRequest *ur);
+       TReturn (*modify_smart_assistant_area)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_smart_assistant_info)(CoreObject *o, UserRequest *ur);
+};
 
-CoreObject *tcore_gps_new(TcorePlugin *plugin, TcoreGpsOps *ops, TcoreHal *hal);
-void tcore_gps_free(CoreObject *co);
+CoreObject*  tcore_gps_new(TcorePlugin *p, const char *name, struct tcore_gps_operations *ops, TcoreHal *hal);
+void         tcore_gps_free(CoreObject *o);
+void tcore_gps_set_ops(CoreObject *o, struct tcore_gps_operations *ops);
 
-gboolean tcore_gps_set_ops(CoreObject *co, TcoreGpsOps *ops);
-void tcore_gps_override_ops(CoreObject *co, TcoreGpsOps *ops);
+__END_DECLS
 
-#ifdef __cplusplus
-}
 #endif
-
-#endif/* __CO_GPS_H__ */
index a747336..ccc5be2 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_MODEM_H__
-#define __CO_MODEM_H__
+#ifndef __TCORE_CO_MODEM_H__
+#define __TCORE_CO_MODEM_H__
 
-#include "core_object.h"
-#include <tel_modem.h>
-#include <tel_return.h>
+#include <core_object.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
 
-typedef struct {
-       TelReturn (*set_power_status)(CoreObject *co, TelModemPowerStatus status, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_flight_mode)(CoreObject *co, gboolean enable, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_flight_mode)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_version)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_imei)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-} TcoreModemOps;
 
-CoreObject *tcore_modem_new(TcorePlugin *plugin, TcoreModemOps *ops, TcoreHal *hal);
-void tcore_modem_free(CoreObject *co);
+struct tcore_modem_operations {
+       TReturn (*power_on)(CoreObject *o, UserRequest *ur);
+       TReturn (*power_off)(CoreObject *o, UserRequest *ur);
+       TReturn (*power_reset)(CoreObject *o, UserRequest *ur);
+       TReturn (*power_low)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_flight_mode)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_imei)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_version)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_sn)(CoreObject *o, UserRequest *ur);
+       TReturn (*dun_pin_ctrl)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_flight_mode)(CoreObject *o, UserRequest *ur);
+};
 
-gboolean tcore_modem_set_ops(CoreObject *co, TcoreModemOps *ops);
-void tcore_modem_override_ops(CoreObject *co, TcoreModemOps *ops);
 
-gboolean tcore_modem_set_flight_mode_state(CoreObject *co, gboolean state);
-gboolean tcore_modem_get_flight_mode_state(CoreObject *co, gboolean *state);
-gboolean tcore_modem_set_powered(CoreObject *co, gboolean pwr);
-gboolean tcore_modem_get_powered(CoreObject *co, gboolean *pwr);
+CoreObject*      tcore_modem_new(TcorePlugin *p, const char *name, struct tcore_modem_operations *ops, TcoreHal *hal);
+void             tcore_modem_free(CoreObject *o);
 
-#ifdef __cplusplus
-}
-#endif
+void tcore_modem_set_ops(CoreObject *o, struct tcore_modem_operations *ops);
 
-#endif /* __CO_MODEM_H__ */
+TReturn          tcore_modem_set_flight_mode_state(CoreObject *o, gboolean flag);
+gboolean         tcore_modem_get_flight_mode_state(CoreObject *o);
+TReturn          tcore_modem_set_powered(CoreObject *o, gboolean pwr);
+gboolean         tcore_modem_get_powered(CoreObject *o);
+
+__END_DECLS
+
+#endif
index 53e9dfc..0cd7f19 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_NETWORK_H__
-#define __CO_NETWORK_H__
-
-#include "core_object.h"
-#include <tel_network.h>
-#include <tel_return.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-       TelReturn (*get_identity_info)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*search)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*cancel_search)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*select_automatic)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*select_manual)(CoreObject *co, const TelNetworkSelectManualInfo *sel_manual, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_selection_mode)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_preferred_plmn)(CoreObject *co, const TelNetworkPreferredPlmnInfo *pref_plmn, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_preferred_plmn)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_mode)(CoreObject *co, TelNetworkMode mode, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_mode)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_neighboring_cell_info)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-}TcoreNetworkOps;
-
-CoreObject* tcore_network_new(TcorePlugin *plugin, TcoreNetworkOps *ops, TcoreHal *hal);
-void tcore_network_free(CoreObject *co);
-
-gboolean tcore_network_set_ops(CoreObject *co, TcoreNetworkOps *ops);
-void tcore_network_override_ops(CoreObject *co, TcoreNetworkOps *ops);
-
+#ifndef __TCORE_CO_NETWORK_H__
+#define __TCORE_CO_NETWORK_H__
 
-gboolean tcore_network_get_cs_reg_status(CoreObject *co,
-               TelNetworkRegStatus *cs_status);
-gboolean tcore_network_set_cs_reg_status(CoreObject *co,
-               TelNetworkRegStatus cs_status);
+#include <core_object.h>
 
-gboolean tcore_network_get_ps_reg_status(CoreObject *co,
-               TelNetworkRegStatus *ps_status);
-gboolean tcore_network_set_ps_reg_status(CoreObject *co,
-               TelNetworkRegStatus ps_status);
+__BEGIN_DECLS
 
+/*
+ * Manual PLMN property
+ *
+ * Value: MCC+MNC or Empty(Unknown mode)
+ */
+#define PROP_NET_MANUAL_PLMN  "manual_plmn"
 
-gboolean tcore_network_get_access_technology(CoreObject *co,
-               TelNetworkAct *act);
-gboolean tcore_network_set_access_technology(CoreObject *co,
-               TelNetworkAct act);
-
-gboolean tcore_network_get_roam_state(CoreObject *co, gboolean *state);
-gboolean tcore_network_set_roam_state(CoreObject *co, gboolean state);
-
-
-gboolean tcore_network_get_lac(CoreObject *co, unsigned int *lac);
-gboolean tcore_network_set_lac(CoreObject *co, unsigned int lac);
-
-gboolean tcore_network_get_rac(CoreObject *co, unsigned int *rac);
-gboolean tcore_network_set_rac(CoreObject *co, unsigned int rac);
-
-gboolean tcore_network_get_cell_id(CoreObject *co, unsigned int *cell_id);
-gboolean tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id);
-
-/* The calling function needs to free memory allocated at output parameter */
-gboolean tcore_network_get_plmn(CoreObject *co, char **plmn);
-gboolean tcore_network_set_plmn(CoreObject *co, const char *plmn);
-
-gboolean tcore_network_get_short_name(CoreObject *co, char **short_name);
-gboolean tcore_network_set_short_name(CoreObject *co, const char *short_name);
+/*
+ * Manual Selection status property
+ *
+ * Value: 'waiting' / 'success' / 'failure' / Empty(Unknown state)
+ */
+#define PROP_NET_MANUAL_SELECTION_STATUS  "manual_selection_status"
 
-gboolean tcore_network_get_long_name(CoreObject *co, char **long_name);
-gboolean tcore_network_set_long_name(CoreObject *co, const char *long_name);
+/*
+ * Network Registration Reject Cause Property
+ *
+ * Value: LU registration reject cause strings
+ */
+#define PROP_NET_REG_LU_REJECT_CAUSE  "reg_reject_cause"
 
-gboolean tcore_network_get_operator_name(CoreObject *co,
-               const char *plmn, char **name);
-gboolean tcore_network_set_operator_name(CoreObject *co,
-               const char *plmn, const char *name);
+/*
+ * Read mdn Property
+ *
+ * Value: mdn strings
+ */
+#define PROP_NET_READ_MDN_FOR_ACTIVATION  "mdn_for_activation"
 
-#ifdef __cplusplus
-}
-#endif
+/*
+ * Read pESN Property
+ *
+ * Value: pESN strings
+ */
+#define PROP_MODEM_READ_ESN_FOR_ACTIVATION  "esn_for_activation"
+
+
+
+enum tcore_network_service_domain_type {
+       TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT,
+       TCORE_NETWORK_SERVICE_DOMAIN_TYPE_PACKET
+};
+
+enum tcore_network_name_type {
+       TCORE_NETWORK_NAME_TYPE_SHORT,
+       TCORE_NETWORK_NAME_TYPE_FULL,
+       TCORE_NETWORK_NAME_TYPE_SPN,
+};
+
+enum tcore_network_name_priority {
+       TCORE_NETWORK_NAME_PRIORITY_UNKNOWN,
+       TCORE_NETWORK_NAME_PRIORITY_NETWORK,
+       TCORE_NETWORK_NAME_PRIORITY_SPN,
+       TCORE_NETWORK_NAME_PRIORITY_ANY,
+};
+
+enum tcore_network_operator_info_type {
+       TCORE_NETWORK_OPERATOR_INFO_TYPE_TS25_DB = 0,
+       TCORE_NETWORK_OPERATOR_INFO_TYPE_DELTA_DB,
+       TCORE_NETWORK_OPERATOR_INFO_TYPE_NITZ,
+       TCORE_NETWORK_OPERATOR_INFO_TYPE_EONS,
+};
+
+struct tcore_network_operator_info {
+       enum tcore_network_operator_info_type type;
+       char mcc[4];
+       char mnc[4];
+       char name[41];
+       char country[4];
+};
+
+struct tcore_network_operations {
+       TReturn (*search)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_plmn_selection_mode)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_plmn_selection_mode)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_service_domain)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_service_domain)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_band)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_band)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_preferred_plmn)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_preferred_plmn)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_order)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_order)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_power_on_attach)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_power_on_attach)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_cancel_manual_search)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_serving_network)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_mode)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_mode)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_neighboring_cell_info)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_neighboring_cell_info)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_default_data_subscription)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_default_data_subscription)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_default_subscription)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_default_subscription)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_emergency_callback_mode)(CoreObject *o, UserRequest *ur); /* 3GPP2 spcefic */
+       TReturn (*set_roaming_preference)(CoreObject *o, UserRequest *ur); /* 3GPP2 spcefic */
+       TReturn (*get_roaming_preference)(CoreObject *o, UserRequest *ur); /* 3GPP2 spcefic */
+       TReturn (*get_subscription_info)(CoreObject *o, UserRequest *ur); /* 3GPP2 spcefic */
+};
+
+
+CoreObject* tcore_network_new(TcorePlugin *plugin, const char *name,
+                struct tcore_network_operations *ops, TcoreHal *hal);
+void        tcore_network_free(CoreObject *co);
+
+void tcore_network_set_ops(CoreObject *co, struct tcore_network_operations *ops);
+
+TReturn     tcore_network_set_plmn(CoreObject *co, const char *plmn);
+char*       tcore_network_get_plmn(CoreObject *co);
+
+TReturn     tcore_network_set_network_name(CoreObject *co,
+                enum tcore_network_name_type type, const char *network_name);
+char*       tcore_network_get_network_name(CoreObject *co,
+                enum tcore_network_name_type type);
+
+TReturn     tcore_network_set_network_name_priority(CoreObject *co,
+                enum tcore_network_name_priority priority);
+TReturn     tcore_network_get_network_name_priority(CoreObject *co,
+                enum tcore_network_name_priority *priority);
+
+TReturn     tcore_network_set_roaming_state(CoreObject *co, gboolean state);
+gboolean    tcore_network_get_roaming_state(CoreObject *co);
+
+TReturn     tcore_network_set_restricted_state(CoreObject *co, int state);
+int         tcore_network_get_restricted_state(CoreObject *co);
+
+TReturn     tcore_network_set_service_status(CoreObject *co,
+                enum tcore_network_service_domain_type type,
+                enum telephony_network_service_domain_status status);
+TReturn     tcore_network_get_service_status(CoreObject *co,
+                enum tcore_network_service_domain_type type,
+                enum telephony_network_service_domain_status *result);
+
+TReturn     tcore_network_set_access_technology(CoreObject *co,
+                enum telephony_network_access_technology act);
+TReturn     tcore_network_get_access_technology(CoreObject *co,
+                enum telephony_network_access_technology *result);
+
+TReturn     tcore_network_set_lac(CoreObject *co, unsigned int lac);
+TReturn     tcore_network_get_lac(CoreObject *co, unsigned int *result);
+
+TReturn     tcore_network_set_rac(CoreObject *co, unsigned int rac);
+TReturn     tcore_network_get_rac(CoreObject *co, unsigned int *result);
+
+TReturn     tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id);
+TReturn     tcore_network_get_cell_id(CoreObject *co, unsigned int *result);
+
+TReturn        tcore_network_set_gsm_dtm_support(CoreObject *co, gboolean state);
+gboolean       tcore_network_get_gsm_dtm_support(CoreObject *co);
+
+TReturn     tcore_network_set_service_type(CoreObject *co,
+                enum telephony_network_service_type service_type);
+TReturn     tcore_network_get_service_type(CoreObject *co,
+                enum telephony_network_service_type *result);
+
+TReturn     tcore_network_operator_info_add(CoreObject *co,
+                const struct tcore_network_operator_info *noi);
+
+struct tcore_network_operator_info*
+            tcore_network_operator_info_find(CoreObject *co,
+                const char *mcc, const char *mnc);
+
+__END_DECLS
 
 #endif
index b2d6294..0ddea4f 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_PHONEBOOK_H__
-#define __CO_PHONEBOOK_H__
+#ifndef __TCORE_CO_PHONEBOOK_H__
+#define __TCORE_CO_PHONEBOOK_H__
 
-#include "core_object.h"
-#include <tel_phonebook.h>
-#include <tel_return.h>
+#include <core_object.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
 
-typedef struct {
-       TelReturn (*get_info)(CoreObject *co, TelPbType pb_type, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*read_record)(CoreObject *co, const TelPbRecordInfo *record, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*update_record)(CoreObject *co, const TelPbUpdateRecord *req_data, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*delete_record)(CoreObject *co, const TelPbRecordInfo *record, TcoreObjectResponseCallback cb, void *cb_data);
-} TcorePbOps;
+struct tcore_phonebook_operations {
+       TReturn (*get_count)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_info)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_usim_info)(CoreObject *o, UserRequest *ur);
+       TReturn (*read_record)(CoreObject *o, UserRequest *ur);
+       TReturn (*update_record)(CoreObject *o, UserRequest *ur);
+       TReturn (*delete_record)(CoreObject *o, UserRequest *ur);
+};
 
-CoreObject *tcore_phonebook_new(TcorePlugin *p, TcorePbOps *ops, TcoreHal *hal);
-void tcore_phonebook_free(CoreObject *co);
+CoreObject* tcore_phonebook_new(TcorePlugin *p, const char *name, struct tcore_phonebook_operations *ops, TcoreHal *hal);
+void        tcore_phonebook_free(CoreObject *n);
 
-gboolean tcore_phonebook_set_ops(CoreObject *co, TcorePbOps *ops);
-void tcore_phonebook_override_ops(CoreObject *co, TcorePbOps *phonebook_ops);
+void tcore_phonebook_set_ops(CoreObject *o, struct tcore_phonebook_operations *ops);
 
-gboolean tcore_phonebook_get_status(CoreObject *co, gboolean *init_status);
-gboolean tcore_phonebook_set_status(CoreObject *co, gboolean init_status);
+gboolean    tcore_phonebook_get_status(CoreObject *o);
+gboolean    tcore_phonebook_set_status(CoreObject *o, gboolean b_init);
 
-gboolean tcore_phonebook_get_support_list(CoreObject *co, TelPbList **pb_list);
-gboolean tcore_phonebook_set_support_list(CoreObject *co, TelPbList *pb_list);
+struct tel_phonebook_support_list* tcore_phonebook_get_support_list(CoreObject *o);
+gboolean    tcore_phonebook_set_support_list(CoreObject *o, struct tel_phonebook_support_list *list);
 
-gboolean tcore_phonebook_get_selected_type(CoreObject *co, TelPbType *pb_type);
-gboolean tcore_phonebook_set_selected_type(CoreObject *co, TelPbType pb_type);
+struct tel_phonebook_field_support_list* tcore_phonebook_get_field_support_list(CoreObject *o);
+gboolean    tcore_phonebook_set_field_support_list(CoreObject *o, struct tel_phonebook_field_support_list *list);
 
-#ifdef __cplusplus
-}
-#endif
+enum tel_phonebook_type tcore_phonebook_get_selected_type(CoreObject *o);
+gboolean tcore_phonebook_set_selected_type(CoreObject *o, enum tel_phonebook_type t);
 
-#endif /*__CO_PHONEBOOK_H__*/
+__END_DECLS
+
+#endif
old mode 100755 (executable)
new mode 100644 (file)
index e9cf50e..aacb250
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_PS_H__
-#define __CO_PS_H__
+#ifndef __TCORE_CO_PS_H__
+#define __TCORE_CO_PS_H__
 
 #include <core_object.h>
-#include <tel_return.h>
 #include <co_context.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
 
-#define TCORE_PS_MAX_CID  4
 
-typedef struct {
-       TelReturn (*define_context)(CoreObject *co_ps, CoreObject *context,
-               TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*activate_context)(CoreObject *co_ps, CoreObject *context,
-               TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*deactivate_context)(CoreObject *co_ps, CoreObject *context,
-               TcoreObjectResponseCallback cb, void *cb_data);
-} TcorePsOps;
+#define PS_MAX_CID  4
 
-CoreObject *tcore_ps_new(TcorePlugin *p,
-       TcorePsOps *ops, TcoreHal *hal);
-void tcore_ps_free(CoreObject *o);
+struct tcore_ps_operations {
+       TReturn (*define_context)(CoreObject *co_ps, CoreObject *context, void *user_data);
+       TReturn (*activate_context)(CoreObject *co_ps, CoreObject *context, void *user_data);
+       TReturn (*deactivate_context)(CoreObject *co_ps, CoreObject *context, void *user_data);
+       TReturn (*send_dormant_request)(CoreObject *co_ps, void *user_data);
+};
 
-gboolean tcore_ps_set_ops(CoreObject *o, TcorePsOps *ps_ops);
-void tcore_ps_override_ops(CoreObject *o, TcorePsOps *ps_ops);
+CoreObject*  tcore_ps_new(TcorePlugin *p, const char *name, struct tcore_ps_operations *ops, TcoreHal *hal);
+void         tcore_ps_free(CoreObject *o);
 
-gboolean tcore_ps_set_online(CoreObject *o, gboolean state);
+void tcore_ps_set_ops(CoreObject *o, struct tcore_ps_operations *ops);
 
-gboolean tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, guint cid);
-gboolean tcore_ps_clear_context_id(CoreObject *o, CoreObject *context);
+TReturn      tcore_ps_add_context(CoreObject *o, CoreObject *ctx_o);
+TReturn      tcore_ps_remove_context(CoreObject *o, CoreObject *ctx_o);
+CoreObject*  tcore_ps_ref_context_by_role(CoreObject *o, enum co_context_role role);
+GSList*      tcore_ps_ref_context_by_id(CoreObject *o, unsigned int id);
+gboolean tcore_ps_any_context_activating_activated(CoreObject *o, int * state);
 
-CoreObject *tcore_ps_ref_context_by_role(CoreObject *o, TcoreContextRole role);
-gboolean tcore_ps_ref_context_by_id(CoreObject *o, guint id, GSList **list);
+TReturn      tcore_ps_set_online(CoreObject *o, gboolean state);
+TReturn      tcore_ps_set_num_of_pdn(CoreObject *o, gint numbers);
+unsigned int tcore_ps_get_num_of_pdn(CoreObject *o);
+unsigned int tcore_ps_set_cid_active(CoreObject *o, unsigned int cid, unsigned int enable);
+unsigned int tcore_ps_get_cid_active(CoreObject *o, unsigned int cid);
+GSList*      tcore_ps_get_active_cids(CoreObject *o);
+unsigned int tcore_ps_set_cid_connected(CoreObject *o, unsigned int cid, unsigned int connected);
+unsigned int tcore_ps_get_cid_connected(CoreObject *o, unsigned int cid);
+GSList*      tcore_ps_get_connected_cids(CoreObject *o);
+unsigned int tcore_ps_is_active_apn(CoreObject *o, const char* apn);
+TReturn      tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, unsigned char cid);
+TReturn      tcore_ps_clear_context_id(CoreObject *o, CoreObject *context);
 
-gboolean tcore_ps_is_active_apn(CoreObject *o, const char* apn);
-#ifdef __cplusplus
-}
-#endif
+TReturn         tcore_ps_send_dormant_request(CoreObject *o, void *user_data);
+TReturn      tcore_ps_define_context(CoreObject *o, CoreObject *context, void *user_data);
+TReturn      tcore_ps_activate_context(CoreObject *o, CoreObject *context, void *user_data);
+TReturn      tcore_ps_deactivate_context(CoreObject *o, CoreObject *context, void *user_data);
+TReturn      tcore_ps_deactivate_contexts(CoreObject *o);
+TReturn      tcore_ps_deactivate_cid(CoreObject *o, unsigned int cid);
 
-#endif /* __CO_PS_H__ */
+__END_DECLS
+
+#endif
index c8e345b..451051a 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_SAP_H__
-#define __CO_SAP_H__
+#ifndef __TCORE_CO_SAP_H__
+#define __TCORE_CO_SAP_H__
 
-#include "core_object.h"
-#include <tel_sap.h>
+#include <core_object.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
 
-typedef struct {
-       TelReturn (*req_connect)(CoreObject *co, unsigned int max_msg_size, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*req_disconnect)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_atr)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*req_transfer_apdu)(CoreObject *co, const TelSapApdu *apdu_data, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*req_transport_protocol)(CoreObject *co, TelSimSapProtocol protocol, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*req_power_operation)(CoreObject *co, TelSapPowerMode power_mode, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_cardreader_status)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-} TcoreSapOps;
+struct tcore_sap_operations {
+       TReturn (*connect)(CoreObject *o, UserRequest *ur);
+       TReturn (*disconnect)(CoreObject *o, UserRequest *ur);
+       TReturn (*req_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_transport_protocol)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_power)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_atr)(CoreObject *o, UserRequest *ur);
+       TReturn (*transfer_apdu)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_cardreader_status)(CoreObject *o, UserRequest *ur);
+};
 
-CoreObject *tcore_sap_new(TcorePlugin *plugin, TcoreSapOps *sap_ops, TcoreHal *hal);
-void tcore_sap_free(CoreObject *co);
+CoreObject* tcore_sap_new(TcorePlugin *p, const char *name, struct tcore_sap_operations *ops, TcoreHal *hal);
+void        tcore_sap_free(CoreObject *o);
+void tcore_sap_set_ops(CoreObject *o, struct tcore_sap_operations *ops);
 
-gboolean tcore_sap_set_ops(CoreObject *co, TcoreSapOps *ops);
-void tcore_sap_override_ops(CoreObject *co, TcoreSapOps *sap_ops);
+__END_DECLS
 
-#ifdef __cplusplus
-}
 #endif
-
-#endif /* __CO_SAP_H__ */
index c1f78f9..ceecd03 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_SAT_H__
-#define __CO_SAT_H__
+#ifndef __TCORE_CO_SAT_H__
+#define __TCORE_CO_SAT_H__
 
 #include <core_object.h>
-#include "type/sat_internal.h"
-#include <tel_return.h>
 
-#ifdef __cplusplus
-       extern "C" {
-#endif
+enum tcore_sat_result{
+       TCORE_SAT_SUCCESS,
+       TCORE_SAT_SUCCESS_PARTIAL_COMPREHENSION,
+       TCORE_SAT_UNABLE_TO_PERFORM_CMD,
+       TCORE_SAT_REQUIRED_VALUE_MISSING,
+       TCORE_SAT_COMMAND_NOT_UNDERSTOOD,
+       TCORE_SAT_BEYOND_ME_CAPABILITY,
+       TCORE_SAT_COMMAND_TYPE_NOT_UNDERSTOOD,
+       TCORE_SAT_ERROR_FATAL
+};
 
-/* OEM operations */
-typedef struct {
-       TelReturn (*send_envelope)(CoreObject *co, const TelSatRequestEnvelopCmdData *envelop_data, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*send_terminal_response)(CoreObject *co, const TelSatRequestTerminalResponseData *terminal_rsp_data, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*send_user_confirmation)(CoreObject *co, const TelSatRequestUserConfirmationData *user_conf_data, TcoreObjectResponseCallback cb, void *cb_data);
-}TcoreSatOps;
-
-CoreObject *tcore_sat_new(TcorePlugin *p, TcoreSatOps *sat_ops, TcoreHal *hal);
-void tcore_sat_free(CoreObject *co);
-void tcore_sat_override_ops(CoreObject *co, TcoreSatOps *sat_ops);
-gboolean tcore_sat_set_ops(CoreObject *co, TcoreSatOps *ops);
-
-gboolean tcore_sat_decode_proactive_command(unsigned char* tlv_origin, unsigned int tlv_length,
-               TelSatDecodedProactiveData* decoded_tlv, int* decode_err_code);
-int tcore_sat_decode_call_control_result(unsigned char* tlv_origin, unsigned int tlv_length, TelSatNotiCallControlResultInd* call_ctrl_result_tlv);
-gboolean tcore_sat_encode_envelop_cmd(const TelSatRequestEnvelopCmdData *src_envelop, char *dst_envelop, int* envelope_length);
-gboolean tcore_sat_encode_terminal_response(const TelSatRequestTerminalResponseData *src_tr, char *dst_tr, int* tr_length);
-
-#ifdef __cplusplus
-}
-#endif
+struct tcore_sat_proactive_command {
+       int cmd_num;
+       enum tel_sat_proactive_cmd_type cmd_type;
+       union {
+               struct tel_sat_display_text_tlv display_text;
+               struct tel_sat_get_inkey_tlv get_inkey;
+               struct tel_sat_get_input_tlv get_input;
+               struct tel_sat_more_time_tlv more_time;
+               struct tel_sat_play_tone_tlv play_tone;
+               struct tel_sat_setup_menu_tlv setup_menu;
+               struct tel_sat_select_item_tlv select_item;
+               struct tel_sat_send_sms_tlv send_sms;
+               struct tel_sat_send_ss_tlv send_ss;
+               struct tel_sat_send_ussd_tlv send_ussd;
+               struct tel_sat_setup_call_tlv setup_call;
+               struct tel_sat_refresh_tlv refresh;
+               struct tel_sat_provide_local_info_tlv provide_local_info;
+               struct tel_sat_setup_event_list_tlv setup_event_list;
+               struct tel_sat_setup_idle_mode_text_tlv setup_idle_mode_text;
+               struct tel_sat_send_dtmf_tlv send_dtmf;
+               struct tel_sat_language_notification_tlv language_notification;
+               struct tel_sat_launch_browser_tlv launch_browser;
+               struct tel_sat_open_channel_tlv open_channel;
+               struct tel_sat_close_channel_tlv close_channel;
+               struct tel_sat_receive_channel_tlv receive_data;
+               struct tel_sat_send_channel_tlv send_data;
+               struct tel_sat_get_channel_status_tlv get_channel_status;
+               struct tel_sat_unsupproted_command_tlv unsupport_cmd;
+       } data;
+};
+
+struct tcore_sat_operations {
+       TReturn (*envelope)(CoreObject *o, UserRequest *ur);
+       TReturn (*terminal_response)(CoreObject *o, UserRequest *ur);
+       TReturn (*user_confirmation)(CoreObject *o, UserRequest *ur);
+};
 
-#endif         /* __CO_SAT_H__ */
+int tcore_sat_decode_proactive_command(unsigned char* tlv_origin, unsigned int tlv_length, struct tcore_sat_proactive_command* decoded_tlv);
+int tcore_sat_decode_call_control_result(unsigned char* tlv_origin, unsigned int tlv_length, struct tnoti_sat_call_control_result_ind* call_ctrl_result_tlv);
+int tcore_sat_encode_envelop_cmd(const struct treq_sat_envelop_cmd_data *src_envelop, char *dst_envelop);
+int tcore_sat_encode_terminal_response(const struct treq_sat_terminal_rsp_data *src_tr, char *dst_tr);
+
+CoreObject* tcore_sat_new(TcorePlugin *p, const char *name, struct tcore_sat_operations *ops, TcoreHal *hal);
+void        tcore_sat_free(CoreObject *n);
+
+void tcore_sat_set_ops(CoreObject *o, struct tcore_sat_operations *ops);
+
+#endif
index d61b45e..be27956 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_SIM_H__
-#define __CO_SIM_H__
-
-#include "core_object.h"
-#include <tel_sim.h>
-#include <tel_return.h>
-
-#ifdef __cplusplus
-       extern "C" {
-#endif
-
-#define TEL_SIM_LANG_CNT_MAX 30 /**< Max language count */
-#define TEL_SIM_XDN_ALPHA_ID_LEN_MAX 30 /**< Max alpha id length */
-#define TEL_SIM_XDN_NUMBER_LEN_MAX 20 /**< Max XDN number length */
-#define TEL_SIM_SST_LEN_MAX 20 /**< Telephony defined */
-#define TEL_SIM_SST_SERVICE_CNT_MAX 56 /**< Max SST service count */
-#define TEL_SIM_UST_SERVICE_CNT_MAX 64 /**< Max UST service count */
-#define TEL_SIM_SPDI_PLMN_MAX 41 /**< Max SPDI PLMN */
-#define TEL_SIM_UST_BYTE_LEN_MAX 8 /**< Max UST byte length */
-#define TEL_SIM_ECC_BYTE_LEN_MAX 3 /**< Max ECC byte length */
-#define TEL_SIM_MAIL_BOX_IDENTIFIER_LEN_MAX 5 /**< Max mail box identifier length */
-#define TEL_SIM_CPHS_VMWF_LEN_MAX 2 /**< Max CPHS VMWF length */
-#define TEL_SIM_CPHS_OPERATOR_NAME_LEN_MAX 25 /**< Max CPHS operator name length */
-#define TEL_SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX 10 /**< Max CPHS operator name short form length */
-
-typedef enum {
-       // service 1 ~ 8
-       TEL_SIM_SST_CHV1_DISABLE_FUNC = 0,      /**< CHV1 disable function */
-       TEL_SIM_SST_ADN,                                        /**< abbreviated Dialing number */
-       TEL_SIM_SST_FDN,                                        /**< fixed Dialing number */
-       TEL_SIM_SST_SMS,                                        /**< short message storage */
-       TEL_SIM_SST_AOC,                                        /**< advice of charge */
-       TEL_SIM_SST_CCP,                                        /**< capability configuration parameters */
-       TEL_SIM_SST_PLMN_SELECTOR,                      /**< plmn selector */
-       TEL_SIM_SST_RFU1,                                       /**< rfu */
-
-       // service 9 ~ 16
-       TEL_SIM_SST_MSISDN = 8,                         /**< msisdn */
-       TEL_SIM_SST_EXT1,                                       /**< extension1 */
-       TEL_SIM_SST_EXT2,                                       /**< extension2 */
-       TEL_SIM_SST_SMS_PARAMS,                         /**< sms parameteres */
-       TEL_SIM_SST_LND,                                        /**< last number dialed */
-       TEL_SIM_SST_CELL_BROADCAST_MSG_ID,      /**< cell broadcast message identifier */
-       TEL_SIM_SST_GID_LV1,                            /**< group identifier level 1 */
-       TEL_SIM_SST_GID_LV2,                            /**< group identifier level 2 */
-
-       // service 17 ~ 24
-       TEL_SIM_SST_SPN = 16,                           /**< service provider name */
-       TEL_SIM_SST_SDN,                                        /**< service Dialing number */
-       TEL_SIM_SST_EXT3,                                       /**< extension3 */
-       TEL_SIM_SST_RFU2,                                       /**< rfu */
-       TEL_SIM_SST_VGCS_GID_LIST,                      /**< vgcs group identifier (EF-VGCS, EF-VGCSS) */
-       TEL_SIM_SST_VBS_GID_LIST,                       /**< vbs group identifier (EF-VBS, EF-VBSS) */
-       TEL_SIM_SST_ENHANCED_MULTI_LV_PRECEDENCE_PREEMPTION_SRVC,       /**< enhanced multi-level precedence and pre-emption service */
-       TEL_SIM_SST_AUTO_ANSWER_FOR_EMLPP,      /**< automatic answer fro eMLPP */
-
-       // service 25 ~ 32,
-       TEL_SIM_SST_DATA_DOWNLOAD_VIA_SMS_CB = 24,      /**< data download via sms-cb */
-       TEL_SIM_SST_DATA_DOWNLOAD_VIA_SMS_PP,           /**< data download via sms-pp */
-       TEL_SIM_SST_MENU_SELECTION,                                     /**< menu selection */
-       TEL_SIM_SST_CALL_CTRL,                                          /**< call control */
-       TEL_SIM_SST_PROACTIVE_SIM,                                      /**< proactive sim command */
-       TEL_SIM_SST_CELL_BROADCAST_MSG_ID_RANGES,       /**< cell broadcast message identifier ranges */
-       TEL_SIM_SST_BDN,                                                        /**< barred Dialing numbers */
-       TEL_SIM_SST_EXT4,                                                       /**< extension 4 */
-
-       // service 33 ~ 40
-       TEL_SIM_SST_DEPERSONALIZATION_CTRL_KEYS = 32,   /**< de-personalization control keys */
-       TEL_SIM_SST_COOPERATIVE_NETWORK_LIST,                   /**< co-operative network list */
-       TEL_SIM_SST_SMS_STATUS_REPORTS,                                 /**< short message status reports */
-       TEL_SIM_SST_NIA,                                        /**< network's indication of alerting in the MS (NIA) */
-       TEL_SIM_SST_MO_SMS_CTRL_BY_SIM,         /**< mobile-originated short message control by sim */
-       TEL_SIM_SST_GPRS,                                       /**< gprs */
-       TEL_SIM_SST_IMG,                                        /**< image */
-       TEL_SIM_SST_SOLSA,                                      /**< support of local service area */
-
-       // service 41 ~ 48
-       TEL_SIM_SST_USSD_STR_DATA_OBJECT_SUPPORTED_IN_CALL_CTRL = 40,   /**< ussd string data object supported in call control */
-       TEL_SIM_SST_RUN_AT_CMD_CMD,                                                     /**< RUN AT COMMAND command */
-       TEL_SIM_SST_USER_CTRLED_PLMN_SELECTOR_WACT,                     /**< user controlled PLMN selector with Access technology */
-       TEL_SIM_SST_OPERATOR_CTRLED_PLMN_SELECTOR_WACT,         /**< operator controlled PLMN selector with Access technology */
-       TEL_SIM_SST_HPLMN_SELECTOR_WACT,                        /**< HPLMN selector with access technology */
-       TEL_SIM_SST_CPBCCH_INFO,                                        /**< CPBCCH information */
-       TEL_SIM_SST_INVESTIGATION_SCAN,                         /**< investigation scan */
-       TEL_SIM_SST_EXTENDED_CAPA_CONF_PARAMS,          /**< extended capability configuration parameters */
-
-       //      service 49 ~ 56
-       TEL_SIM_SST_MEXE = 48,                          /**< MExE */
-       TEL_SIM_SST_RPLMN_LAST_USED_ACCESS_TECH,        /**< RPLMN last used access technology */
-       TEL_SIM_SST_PLMN_NETWORK_NAME,          /*PLMN Network Name*/
-       TEL_SIM_SST_OPERATOR_PLMN_LIST,         /*Operator PLMN List*/
-       TEL_SIM_SST_MBDN,                                       /*Mailbox Dialling Numbers*/
-       TEL_SIM_SST_MWIS,                                       /*Message Waiting Indication Status*/
-       TEL_SIM_SST_CFIS,                                       /*Call Forwarding Indication Status*/
-       TEL_SIM_SST_SPDI                                        /*Service Provider Display Information*/
-} TelSimSstService;
-
-typedef enum {
-       // service 1 ~ 8
-       TEL_SIM_UST_LOCAL_PB = 0,               /**< local phone book */
-       TEL_SIM_UST_FDN,                                /**< fixed Dialing number */
-       TEL_SIM_UST_EXT2,                               /**< extension2 */
-       TEL_SIM_UST_SDN,                                /**< service Dialing number */
-       TEL_SIM_UST_EXT3,                               /**< extension3 */
-       TEL_SIM_UST_BDN,                                /**< barred Dialing numbers */
-       TEL_SIM_UST_EXT4,                               /**< extension 4 */
-       TEL_SIM_UST_OUTGOING_CALL_INFO, /**< outgoing call information */
-
-       // service 9 ~ 16
-       TEL_SIM_UST_INCOMING_CALL_INFO = 8,             /**< incoming call information */
-       TEL_SIM_UST_SMS,                                                /**< short message storage */
-       TEL_SIM_UST_SMS_STATUS_REPORTS,                 /**< short message status reports */
-       TEL_SIM_UST_SMS_PARAMS,                                 /**< sms parameteres */
-       TEL_SIM_UST_AOC,                                                /**< advice of charge */
-       TEL_SIM_UST_CCP,                                                /**< capability configuration parameters */
-       TEL_SIM_UST_CELL_BROADCAST_MSG_ID,              /**< cell broadcast message identifier */
-       TEL_SIM_UST_CELL_BROADCAST_MSG_ID_RANGES,       /**< cell broadcast message identifier ranges */
-
-       // service 17 ~ 24
-       TEL_SIM_UST_GID_LV1 = 16,                                               /**< group identifier level 1 */
-       TEL_SIM_UST_GID_LV2,                                                    /**< group identifier level 2 */
-       TEL_SIM_UST_SPN,                                                                /**< service provider name */
-       TEL_SIM_UST_USER_CTRLED_PLMN_SELECTOR_WACT,             /**< user controlled PLMN selector with Access technology */
-       TEL_SIM_UST_MSISDN,                                                                                     /**< msisdn */
-       TEL_SIM_UST_IMG,                                                                                        /**< image */
-       TEL_SIM_UST_SOLSA,                                                                                      /**< support of local service area */
-       TEL_SIM_UST_ENHANCED_MULTI_LV_PRECEDENCE_PREEMPTION_SRVC,       /**< enhanced multi-level precedence and pre-emption service */
-
-       // service 25 ~ 32
-       TEL_SIM_UST_AUTO_ANSWER_FOR_EMLPP = 24, /**< automatic answer fro eMLPP */
-       TEL_SIM_UST_RFU1,                                               /**< rfu */
-       TEL_SIM_UST_GSM_ACCESS,                                 /**< gsm access */
-       TEL_SIM_UST_DATA_DOWNLOAD_VIA_SMS_PP,   /**< data download via sms-pp */
-       TEL_SIM_UST_DATA_DOWNLOAD_VIA_SMS_CB,   /**< data download via sms-cb */
-       TEL_SIM_UST_CALL_CTRL,                                  /**< call control by usim*/
-       TEL_SIM_UST_MO_SMS_CTRL,                                /**< mobile-originated short message control by usim */
-       TEL_SIM_UST_RUN_AT_CMD_CMD,                             /**< RUN AT COMMAND command */
-
-       // service 33 ~ 40
-       TEL_SIM_UST_SHALL_BE_SET_TO_ONE = 32,   /**< shall be set to 1 */
-       TEL_SIM_UST_ENABLED_SRVC_TABLE,                 /**< enabled service table */
-       TEL_SIM_UST_ACL,                                                /**< APN control list */
-       TEL_SIM_UST_DEPERSONALIZATION_CTRL_KEYS,        /**< de-personalization control keys */
-       TEL_SIM_UST_COOPERATIVE_NETWORK_LIST,           /**< co-operative network list */
-       TEL_SIM_UST_GSM_SEC_CONTEXT,                            /**< gsm security context */
-       TEL_SIM_UST_CPBCCH_INFO,                                        /**< CPBCCH information */
-       TEL_SIM_UST_INVESTIGATION_SCAN,                         /**< investigation scan */
-
-       // service 41 ~ 48
-       TEL_SIM_UST_MEXE = 40,                                                          /**< MExE */
-       TEL_SIM_UST_OPERATOR_CTRLED_PLMN_SELECTOR_WACT,         /**< operator controlled PLMN selector with Access technology */
-       TEL_SIM_UST_HPLMN_SELECTOR_WACT,        /**< HPLMN selector with access technology */
-       TEL_SIM_UST_EXT5,                                       /**< extension 5 */
-       TEL_SIM_UST_PLMN_NETWORK_NAME,          /*PLMN Network Name*/
-       TEL_SIM_UST_OPERATOR_PLMN_LIST,         /*Operator PLMN List*/
-       TEL_SIM_UST_MBDN,                                       /*Mailbox Dialling Numbers*/
-       TEL_SIM_UST_MWIS,                                       /*Message Waiting Indication Status*/
-
-       // service 49 ~ 56
-       TEL_SIM_UST_CFIS = 48,                                          /*Call Forwarding Indication Status*/
-       TEL_SIM_UST_RPLMN_LAST_USED_ACCESS_TECH,        /**< RPLMN last used access technology */
-       TEL_SIM_UST_SPDI,                                                       /*Service Provider Display Information*/
-       TEL_SIM_UST_MMS,                                                        /**< multi media messaging service */
-       TEL_SIM_UST_EXT8,                                                       /**< extension 8 */
-       TEL_SIM_UST_CALL_CTRL_ON_GPRS,                          /**< call control on gprs by usim */
-       TEL_SIM_UST_MMS_USER_CONNECTIVITY_PARAMS,       /**< mms user connectivity parameters */
-       TEL_SIM_UST_NIA,                                                        /**< network's indication of alerting in the MS (NIA) */
-
-       // service 57 ~ 64
-       TEL_SIM_UST_VGCS_GID_LIST,                      /**< vgcs group identifier List (EF-VGCS, EF-VGCSS) */
-       TEL_SIM_UST_VBS_GID_LIST,                       /**< vbs group identifier List (EF-VBS, EF-VBSS) */
-       TEL_SIM_UST_PSEUDONYM,
-       TEL_SIM_UST_USER_CTRLED_PLMN_SELECTOR_IWLAN,            /**< user controlled PLMN selector for I-WLAN access */
-       TEL_SIM_UST_OPERATOR_CTRLED_PLMN_SELECTOR_IWLAN,                /**< operator controlled PLMN selector for I-WLAN access */
-       TEL_SIM_UST_USER_CTRLED_WSID_LIST,
-       TEL_SIM_UST_OPERATOR_CTRLED_WSID_LIST,
-       TEL_SIM_UST_VGCS_SEC
-} TelSimUstService;
+#ifndef __TCORE_CO_SIM_H__
+#define __TCORE_CO_SIM_H__
+
+#include <core_object.h>
+
+__BEGIN_DECLS
+
+struct tcore_sim_operations {
+       TReturn (*verify_pins)(CoreObject *o, UserRequest *ur);
+       TReturn (*verify_puks)(CoreObject *o, UserRequest *ur);
+       TReturn (*change_pins)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_facility_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*enable_facility)(CoreObject *o, UserRequest *ur);
+       TReturn (*disable_facility)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_lock_info)(CoreObject *o, UserRequest *ur);
+       TReturn (*read_file)(CoreObject *o, UserRequest *ur);
+       TReturn (*update_file)(CoreObject *o, UserRequest *ur);
+       TReturn (*transmit_apdu)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_atr)(CoreObject *o, UserRequest *ur);
+       TReturn (*req_authentication)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_powerstate)(CoreObject *o, UserRequest *ur);
+};
+
+CoreObject*    tcore_sim_new(TcorePlugin *p, const char *name, struct tcore_sim_operations *ops, TcoreHal *hal);
+void           tcore_sim_free(CoreObject *n);
+
+void   tcore_sim_set_ops(CoreObject *o, struct tcore_sim_operations *ops);
+
+enum tel_sim_type      tcore_sim_get_type(CoreObject *o);
+gboolean               tcore_sim_set_type(CoreObject *o, enum tel_sim_type type);
+
+struct tel_sim_imsi*   tcore_sim_get_imsi(CoreObject *o);
+gboolean               tcore_sim_set_imsi(CoreObject *o, const struct tel_sim_imsi *imsi);
+
+enum tel_sim_status    tcore_sim_get_status(CoreObject *o);
+gboolean               tcore_sim_set_status(CoreObject *o, enum tel_sim_status status);
+
+gboolean               tcore_sim_get_identification(CoreObject *o);
+gboolean               tcore_sim_set_identification(CoreObject *o, gboolean b_changed);
+
+struct tel_sim_service_table*  tcore_sim_get_service_table(CoreObject *o);
+gboolean                       tcore_sim_set_service_table(CoreObject *o, const struct tel_sim_service_table *svct);
+enum tcore_return              tcore_sim_delete_service_table(CoreObject *o);
+
+struct tel_sim_cphs_csp*       tcore_sim_get_csp(CoreObject *o);
+gboolean               tcore_sim_set_csp(CoreObject *o, const struct tel_sim_cphs_csp *csp);
+gboolean               tcore_sim_delete_csp(CoreObject *o);
+
+
+struct tel_sim_ecc_list*       tcore_sim_get_ecc_list(CoreObject *o);
+gboolean                       tcore_sim_set_ecc_list(CoreObject *o, const struct tel_sim_ecc_list *ecc_list);
+enum tcore_return              tcore_sim_delete_ecc_list(CoreObject *o);
+
+struct tel_sim_msisdn_list*    tcore_sim_get_msisdn_list(CoreObject *o);
+gboolean                       tcore_sim_set_msisdn_list(CoreObject *o, const struct tel_sim_msisdn_list *msisdn_list);
+enum tcore_return              tcore_sim_delete_msisdn_list(CoreObject *o);
+
+struct tel_sim_spn*            tcore_sim_get_spn(CoreObject *o);
+gboolean                       tcore_sim_set_spn(CoreObject *o, const struct tel_sim_spn *spn);
+enum tcore_return              tcore_sim_delete_spn(CoreObject *o);
+
+struct tel_sim_cphs_netname*   tcore_sim_get_cphs_netname(CoreObject *o);
+gboolean                       tcore_sim_set_cphs_netname(CoreObject *o, const struct tel_sim_cphs_netname *cphs_netname);
+enum tcore_return              tcore_sim_delete_cphs_netname(CoreObject *o);
+
+struct tel_sim_iccid*          tcore_sim_get_iccid(CoreObject *o);
+gboolean                       tcore_sim_set_iccid(CoreObject *o, const struct tel_sim_iccid *iccid);
+enum tcore_return              tcore_sim_delete_iccid(CoreObject *o);
+
+gboolean       tcore_sim_get_cphs_status(CoreObject *o);
+gboolean       tcore_sim_set_cphs_status(CoreObject *o, gboolean b_support);
+unsigned char tcore_sim_get_app_list(CoreObject *o);
+gboolean tcore_sim_set_app_list(CoreObject *o, unsigned char app_list);
+struct tel_sim_ist *tcore_sim_get_isim_service_table(CoreObject *o);
+gboolean tcore_sim_set_isim_service_table(CoreObject *o, struct tel_sim_ist *ist);
+enum tcore_return tcore_sim_delete_isim_service_table(CoreObject *o);
+
+gboolean       tcore_sim_link_userdata(CoreObject *o, void *userdata);
+void*          tcore_sim_ref_userdata(CoreObject *o);
+
+gboolean       tcore_sim_decode_iccid(struct tel_sim_iccid *p_out, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_lp(struct tel_sim_language *p_out, unsigned char *p_in, int in_length);
+char*          tcore_sim_encode_lp(int *out_length, struct tel_sim_language *p_in);
+gboolean       tcore_sim_decode_li(enum tel_sim_file_id file_id, struct tel_sim_language *p_out, unsigned char *p_in, int in_length);
+char*          tcore_sim_encode_li(int *out_length, struct tel_sim_language *p_in);
+gboolean       tcore_sim_decode_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_cdma_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_sst(struct tel_sim_sst *p_sst, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_cdma_st(struct tel_sim_cst *p_cdma_st, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_csim_st(struct tel_sim_cst *p_csim_st, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_spn(struct tel_sim_spn *p_spn, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_cdma_spn(struct tel_sim_spn *p_spn, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_spdi(struct tel_sim_spdi *p_spdi, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_msisdn(struct tel_sim_msisdn *p_msisdn, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_mdn(struct tel_sim_msisdn *p_msisdn, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_xdn(struct tel_sim_dialing_number *p_xdn, unsigned char *p_in, int in_length);
+char*          tcore_sim_encode_xdn(int in_length, struct tel_sim_dialing_number *p_xdn);
+gboolean       tcore_sim_decode_ecc(struct tel_sim_ecc_list *p_ecc, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_ust(struct tel_sim_ust *p_ust, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_ist(struct tel_sim_ist *p_ist, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_est(struct tel_sim_est *p_est, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_uecc(struct tel_sim_ecc *p_ecc, unsigned char* p_in, int in_length);
+gboolean       tcore_sim_decode_gid( struct tel_sim_gid *p_gid, unsigned char* p_in, int in_length);
+gboolean       tcore_sim_decode_mbi(struct tel_sim_mbi *p_mbi, unsigned char *p_in, int in_length);
+char*          tcore_sim_encode_mbi(const struct tel_sim_mbi *p_mbi, int in_length);
+gboolean       tcore_sim_decode_mwis(struct tel_sim_mw *pMwis, unsigned char *p_in, int in_length);
+char*          tcore_sim_encode_mwis(int *out_length, const struct tel_sim_mw *pMwis, int in_length);
+gboolean       tcore_sim_decode_vmwf(struct tel_sim_cphs_mw *p_vmwf,   unsigned char* p_in, unsigned long in_length);
+char*          tcore_sim_encode_vmwf(int *out_length, const struct tel_sim_cphs_mw *p_vmwf, int in_length);
+gboolean       tcore_sim_decode_cfis(struct tel_sim_cfis *cfis, unsigned char *p_in, int in_length);
+char*          tcore_sim_encode_cfis(int *out_length, const struct tel_sim_cfis *p_cfis);
+gboolean       tcore_sim_decode_cff(struct tel_sim_cphs_cf *cfis, unsigned char *p_in, int in_length);
+char*          tcore_sim_encode_cff(const struct tel_sim_cphs_cf *cff, int in_length);
+gboolean       tcore_sim_decode_csp(struct tel_sim_cphs_csp *p_csp, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_encode_csp(unsigned char *p_out, int out_length, struct tel_sim_cphs_csp *p_csp);
+gboolean       tcore_sim_decode_dynamic_flag(struct tel_sim_cphs_dflag *p_df, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_encode_dynamic_flag(char *p_out, int out_length, struct tel_sim_cphs_dflag *p_df);
+gboolean       tcore_sim_decode_dynamic2_flag(struct tel_sim_cphs_dflag2 *p_d2f, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_encode_dynamic2_flag(char *p_out, int out_length, struct tel_sim_cphs_dflag2 *p_d2f);
+gboolean       tcore_sim_decode_cphs_info(struct tel_sim_cphs_info *pCphsInfo, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_short_ons(unsigned char *p_out, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_ons(unsigned char *p_out, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_information_number(struct tel_sim_cphs_info_number *p_info, unsigned char* p_in, int in_length);
+gboolean       tcore_sim_decode_opl(struct tel_sim_opl *p_opl, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_pnn(struct tel_sim_pnn *p_pnn, unsigned char* p_in, int in_length);
+gboolean       tcore_sim_decode_oplmnwact(struct tel_sim_oplmnwact_list *p_list, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_ext(struct tel_sim_ext *p_ext, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_decode_img(struct tel_sim_img *p_out, unsigned char *p_in, int in_length);
+gboolean       tcore_sim_check_plmn_having_3digits_mnc(char* plmn);
+gboolean               tcore_sim_decode_isim_impi(struct tel_sim_impi *p_out, unsigned char *p_in, int in_length);
+gboolean               tcore_sim_decode_isim_domain(struct tel_sim_domain *p_out, unsigned char *p_in, int in_length);
+gboolean               tcore_sim_decode_isim_impu(struct tel_sim_impu *p_out, unsigned char *p_in, int in_length);
+gboolean               tcore_sim_decode_isim_pcscf(struct tel_sim_pcscf *p_out, unsigned char *p_in, int in_length);
+
+__END_DECLS
 
-typedef enum {
-       TEL_SIM_EF_DIR = 0x2F00, /**< Root Directory for the USIM */
-       TEL_SIM_EF_ICCID = 0x2FE2, /**< the ICC Identification file     */
-       TEL_SIM_EF_IMSI = 0x6F07, /**< the IMSI file */
-       TEL_SIM_EF_SST = 0x6F38, /**< the SIM Service Table file. EF UST has same address */
-       TEL_SIM_EF_EST = 0x6F56, /**< the Enabled Service Table file   */
-       TEL_SIM_EF_OPLMN_ACT = 0x6F61, /**< the OPLMN List file*/
-       TEL_SIM_EF_GID1 = 0x6F3E, /**< the Group Identifier Level 1 */
-       TEL_SIM_EF_GID2 = 0x6F3F, /**< the Group Identifier Level 2 */
-
-       TEL_SIM_EF_ELP = 0x2F05, /**< the Extended Language Preference file */
-       TEL_SIM_EF_LP = 0x6F05, /**< SIM: Language preference */
-       TEL_SIM_EF_ECC = 0x6FB7, /**< the Emergency Call Codes     */
-       TEL_SIM_EF_SPN = 0x6F46, /**< the Service Provider Name    */
-       TEL_SIM_EF_SPDI = 0x6FCD, /**< the Service provider display information*/
-       TEL_SIM_EF_PNN = 0x6FC5, /**< the PLMN Network Name File*/
-       TEL_SIM_EF_OPL = 0x6FC6, /**< the Operator PLMN List File*/
-       TEL_SIM_EF_MBDN = 0x6FC7, /** < SIM Mail Box Dialing Number file */
-       TEL_SIM_EF_MSISDN = 0x6F40, /**< MSISDN */
-       TEL_SIM_EF_EXT1 = 0x6F4A, /**< Extension File-1 */
-       TEL_SIM_EF_EXT5 = 0x6F4E, /**< Extension File-5 */
-       TEL_SIM_EF_IMG = 0x4F20, /**Image file*/
-
-       TEL_SIM_EF_USIM_LI = 0x6A05, /**< USIM: Language Indication */
-       TEL_SIM_EF_USIM_PL = 0x2A05, /**< the Language Preference file of USIM */
-       TEL_SIM_EF_USIM_MBI = 0x6FC9, /** < Mailbox Identifier -linear fixed*/
-       TEL_SIM_EF_USIM_MWIS = 0x6FCA, /** < Message Waiting Indication Status -linear fixed*/
-       TEL_SIM_EF_USIM_CFIS = 0x6FCB, /** < Call forward indication status -linear fixed*/
-
-       /* CPHS FILE ID */
-       TEL_SIM_EF_CPHS_VOICE_MSG_WAITING = 0x6F11, /** < CPHS voice MSG waiting indication  */
-       TEL_SIM_EF_CPHS_SERVICE_STRING_TABLE = 0x6F12, /** < CPHS service string table  */
-       TEL_SIM_EF_CPHS_CALL_FORWARD_FLAGS = 0x6F13, /** < CPHS call forward flags  */
-       TEL_SIM_EF_CPHS_OPERATOR_NAME_STRING = 0x6F14, /** < CPHS operator name string  */
-       TEL_SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE = 0x6F15, /** < CPHS customer service profile  */
-       TEL_SIM_EF_CPHS_CPHS_INFO = 0x6F16, /** < CPHS information  */
-       TEL_SIM_EF_CPHS_MAILBOX_NUMBERS = 0x6F17, /** < CPHS mail box numbers  */
-       TEL_SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING = 0x6F18, /** < CPHS operator name short form string  */
-       TEL_SIM_EF_CPHS_INFORMATION_NUMBERS = 0x6F19, /** < CPHS information numbers  */
-       /*  CPHS ALS FILE ID */
-       TEL_SIM_EF_CPHS_DYNAMICFLAGS = 0x6F9F, /** < CPHS Dynamics flags  */
-       TEL_SIM_EF_CPHS_DYNAMIC2FLAG = 0x6F92, /** < CPHS Dynamics2 flags  */
-       TEL_SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE_LINE2 = 0x6F98, /** < CPHS CSP2  */
-       TEL_SIM_EF_PBR = 0x4F30,
-
-       /*  SMS FILE ID */
-       TEL_SIM_EF_SMSP = 0x6F42, /** < SMSP File  */
-
-       /* Invalid File ID, All the file ID are less than this Value*/
-       TEL_SIM_EF_INVALID = 0xFFFF, /**< Invalid file.*/
-       TEL_SIM_EF_OTHERS, /**< Element to indicate an unknown file.*/
-} TelSimFileId;
-
-typedef struct {
-       TelSimCardType sim_type;
-       union {
-               char sst_service[TEL_SIM_SST_SERVICE_CNT_MAX];  // should accessed with 'enum tel_sim_sst_service' as index
-               char ust_service[TEL_SIM_UST_SERVICE_CNT_MAX];  // should accessed with 'enum tel_sim_ust_service' as index
-       } table;
-} TelSimServiceTable;
-
-/* OEM operations */
-typedef struct {
-       TelReturn (*get_imsi)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_ecc)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_iccid)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_language)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_language)(CoreObject *co, TelSimLanguagePreferenceCode language, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_callforwarding_info)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_messagewaiting_info)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_messagewaiting_info)(CoreObject *co, const TelSimMwis *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_mailbox_info)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_mailbox_info)(CoreObject *co, const TelSimMailBoxNumber *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_msisdn)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_spn)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_cphs_netname)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_sp_display_info)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*req_authentication)(CoreObject *co, const TelSimAuthenticationData *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*verify_pins)(CoreObject *co, const TelSimSecPinPw *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*verify_puks)(CoreObject *co, const TelSimSecPukPw *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*change_pins)(CoreObject *co, const TelSimSecChangePinPw *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*disable_facility)(CoreObject *co, const TelSimFacilityPw *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*enable_facility)(CoreObject *co, const TelSimFacilityPw *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_facility)(CoreObject *co, TelSimLockType lock_type, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_lock_info)(CoreObject *co, TelSimLockType lock_type, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*req_apdu)(CoreObject *co, const TelSimApdu *request, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*req_atr)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-} TcoreSimOps;
-
-CoreObject *tcore_sim_new(TcorePlugin *plugin, TcoreSimOps *sim_ops, TcoreHal *hal);
-void tcore_sim_free(CoreObject *co);
-
-gboolean tcore_sim_set_ops(CoreObject *co, TcoreSimOps *ops);
-void tcore_sim_override_ops(CoreObject *co,
-                       TcoreSimOps *sim_ops);
-
-gboolean tcore_sim_get_type(CoreObject *co, TelSimCardType *type);
-gboolean tcore_sim_set_type(CoreObject *co, TelSimCardType  type);
-
-gboolean tcore_sim_get_imsi(CoreObject *co, TelSimImsiInfo **imsi);
-gboolean tcore_sim_set_imsi(CoreObject *co, TelSimImsiInfo *imsi);
-
-gboolean tcore_sim_get_status(CoreObject *co, TelSimCardStatus *status);
-gboolean tcore_sim_set_status(CoreObject *co, TelSimCardStatus status);
-
-gboolean tcore_sim_get_identification(CoreObject *co, TelSimCardChangeStatus *change_status);
-gboolean tcore_sim_set_identification(CoreObject *co, TelSimCardChangeStatus change_status);
-
-gboolean tcore_sim_get_service_table(CoreObject *co, TelSimServiceTable **svct);
-gboolean tcore_sim_set_service_table(CoreObject *co, TelSimServiceTable *svct);
-
-gboolean tcore_sim_get_cphs_status(CoreObject *co, gboolean *is_supported);
-gboolean tcore_sim_set_cphs_status(CoreObject *co, gboolean is_support);
-
-gboolean tcore_sim_get_spn(CoreObject *co, gchar **spn);
-gboolean tcore_sim_set_spn(CoreObject *co, gchar *spn);
-gboolean tcore_sim_get_disp_condition(CoreObject *co, TelSimSpnDispCondition *disp_condition);
-gboolean tcore_sim_set_disp_condition(CoreObject *co, TelSimSpnDispCondition disp_condition);
-
-gboolean tcore_sim_link_userdata(CoreObject *co, void *userdata);
-void *tcore_sim_ref_userdata(CoreObject *co);
-
-gboolean tcore_sim_decode_iccid(unsigned char *enc_iccid, int enc_iccid_len, char *dec_iccid);
-gboolean tcore_sim_decode_lp(unsigned char *enc_lang, int enc_lang_len, TelSimLanguagePreferenceCode *dec_lang);
-gboolean tcore_sim_encode_lp(TelSimLanguagePreferenceCode dec_lang, char **enc_lang, int *enc_lang_len);
-gboolean tcore_sim_decode_li(unsigned char *enc_lang, int enc_lang_len, TelSimFileId file_id, TelSimLanguagePreferenceCode *dec_lang);
-gboolean tcore_sim_encode_li(TelSimLanguagePreferenceCode dec_lang, char **en_lang, int *en_lang_len);
-gboolean tcore_sim_decode_imsi(unsigned char *en_imsi, int en_imsi_len, TelSimImsiInfo *dec_imsi);
-gboolean tcore_sim_decode_sst(unsigned char *enc_sst, int enc_sst_len, char *dec_sst);
-gboolean tcore_sim_decode_spn(unsigned char *enc_spn, int enc_spn_len, TelSimSpn *dec_spn);
-gboolean tcore_sim_decode_spdi(unsigned char *enc_spdi, int enc_spdi_len, TelSimSpPlmnList *dec_spdi);
-gboolean tcore_sim_decode_msisdn(unsigned char *enc_msisdn, int enc_msisdn_len, TelSimSubscriberInfo *dec_msisdn);
-gboolean tcore_sim_decode_xdn(unsigned char *enc_xdn, int enc_xdn_len,
-       char *alpha_id, unsigned int *alpha_id_len, char *num);
-gboolean tcore_sim_encode_xdn(gchar *alpha_id, gchar *number, guint enc_xdn_len,
-       gchar **enc_data);
-gboolean tcore_sim_decode_ecc(unsigned char *enc_ecc, int enc_ecc_len, TelSimEccList *dec_ecc);
-gboolean tcore_sim_decode_ust(unsigned char *enc_ust, int enc_ust_len, char *dec_ust);
-gboolean tcore_sim_decode_uecc(unsigned char* enc_uecc, int enc_uecc_len, TelSimEcc *dec_ecc);
-gboolean tcore_sim_decode_mbi(unsigned char *enc_mbi, int enc_mbi_len, TelSimMbi *dec_mbi);
-gboolean tcore_sim_decode_cff(unsigned char *enc_cff, int enc_cff_len, TelSimMwis *dec_mwis);
-gboolean tcore_sim_decode_mwis(unsigned char *enc_mwis, int enc_mwis_len, TelSimMwis *dec_mwis);
-gboolean tcore_sim_encode_mwis(const TelSimMwis *mwis, guint field_count,
-       gchar **encoded_mwis, guint *encoded_mwis_len);
-gboolean tcore_sim_decode_vmwf(unsigned char* enc_vmwf, unsigned long enc_vmwf_len, TelSimMwis *dec_vmwf);
-gboolean tcore_sim_decode_ons(unsigned  char* enc_ons, int enc_ons_len, unsigned char *dec_ons);
-gboolean tcore_sim_decode_cfis(unsigned char *enc_cfis, int enc_cfis_len, TelSimCfis *dec_cfis);
-gboolean tcore_sim_decode_short_ons(unsigned char *enc_short_ons, int enc_short_ons_len, unsigned char *dec_short_ons);
-gboolean tcore_sim_decode_opl(unsigned char *enc_opl, int enc_opl_len, TelSimOpl *dec_opl);
-gboolean tcore_sim_decode_pnn(unsigned char* enc_pnn, int enc_pnn_len, TelSimPnn *dec_pnn);
-
-#ifdef __cplusplus
-}
 #endif
-
-#endif /* __CO_SIM_H__ */
index d112040..6f95470 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_SMS_H__
-#define __CO_SMS_H__
+#ifndef __TCORE_CO_SMS_H__
+#define __TCORE_CO_SMS_H__
 
-#define tcore_sms_convert_to_semioctet_length(length)  ((length + 1) / 2)
+#include <core_object.h>
 
-#include "core_object.h"
-#include <tel_sms.h>
-#include <tel_return.h>
+__BEGIN_DECLS
 
-#ifdef __cplusplus
-extern "C" {
-#endif
 
-typedef struct tcore_sms_operations {
-       TelReturn (*send_sms)(CoreObject *co, const TelSmsSendInfo *send_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*read_in_sim)(CoreObject *co, unsigned int index, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*write_in_sim)(CoreObject *co, const TelSmsSimDataInfo *wdata, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*delete_in_sim)(CoreObject *co, unsigned int index, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_count)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_cb_config)(CoreObject *co, const TelSmsCbConfigInfo *cb_conf, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_cb_config)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_parameters)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_parameters)(CoreObject *co, const TelSmsParamsInfo *params, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*send_deliver_report)(CoreObject *co, const TelSmsDeliverReportInfo *dr_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_sca)(CoreObject *co, const TelSmsSca *sca, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_sca)(CoreObject *co, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_memory_status)(CoreObject *co, gboolean available, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_message_status)(CoreObject *co, const TelSmsStatusInfo *status_info, TcoreObjectResponseCallback cb, void *cb_data);
-} TcoreSmsOps;
-
-gboolean tcore_sms_get_ready_status(CoreObject *co, gboolean *status);
-gboolean tcore_sms_set_ready_status(CoreObject *co, gboolean status);
-
-CoreObject *tcore_sms_new(TcorePlugin *p, TcoreSmsOps *sms_ops, TcoreHal *hal);
-void tcore_sms_free(CoreObject *co);
-
-gboolean tcore_sms_set_ops(CoreObject *co, TcoreSmsOps *ops);
-void tcore_sms_override_ops(CoreObject *co, TcoreSmsOps *sms_ops);
-
-#ifdef __cplusplus
-}
+#define nDefaultSMSPWithoutAlphaId     28
+
+#define SMSPValidDestAddr                      0x01
+#define SMSPValidSvcAddr                       0x02
+#define SMSPValidPID                           0x04
+#define SMSPValidDCS                           0x08
+#define SMSPValidVP                                    0x10
+
+#define nDestAddrOffset                                1
+#define nSCAAddrOffset                         13
+#define nPIDOffset                                     25
+#define nDCSOffset                                     26
+#define nVPOffset                                      27
+
+struct property_sms_info {
+       int     g_trans_id;
+       int     SMSPRecordLen;
+};
+
+struct tcore_sms_operations {
+       TReturn (*send_umts_msg)(CoreObject *o, UserRequest *ur);
+       TReturn (*read_msg)(CoreObject *o, UserRequest *ur);
+       TReturn (*save_msg)(CoreObject *o, UserRequest *ur);
+       TReturn (*delete_msg)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_storedMsgCnt)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_sca)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sca)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_cb_config)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_cb_config)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_mem_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_pref_brearer)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_pref_brearer)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_delivery_report)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_msg_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_sms_params)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_sms_params)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_paramcnt)(CoreObject *o, UserRequest *ur);
+       TReturn (*send_cdma_msg)(CoreObject *o, UserRequest *ur);
+};
+
+/**
+ * This function is used to encode SMS Parameters to TPDU on EFsmsp
+ *
+ * @return             length of string
+ * @param[in]          incoming - telephony_sms_Params_t
+ * @param[in]          data - TPDU data
+ * @Interface          Synchronous.
+ * @remark
+ * @Refer
+ */
+int  _tcore_util_sms_encode_smsParameters(const struct telephony_sms_Params *incoming, unsigned char *data, int SMSPRecordLen);
+int  tcore_util_sms_decode_smsParameters(uint8_t *incoming, uint32_t length, struct telephony_sms_Params *params);
+
+
+void tcore_util_sms_semioctet_to_octect(int* nScLength);
+enum telephony_sms_ready_status  tcore_sms_get_ready_status(CoreObject *o);
+gboolean  tcore_sms_set_ready_status(CoreObject *o, enum telephony_sms_ready_status status);
+CoreObject* tcore_sms_new(TcorePlugin *p, const char *name, struct tcore_sms_operations *ops, TcoreHal *hal);
+void  tcore_sms_free(CoreObject * n);
+
+void tcore_sms_set_ops(CoreObject *o, struct tcore_sms_operations *ops);
+
+__END_DECLS
+
 #endif
 
-#endif /*__CO_SMS_H__*/
index a7a98df..75db702 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CO_SS_H__
-#define __CO_SS_H__
+#ifndef __TCORE_CO_SS_H__
+#define __TCORE_CO_SS_H__
 
-#include "core_object.h"
-#include <tel_ss.h>
-#include <tel_return.h>
+#include <core_object.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
+
+#define MAX_TCORE_SS_NUMBER_LEN 83
+
+enum tcore_ss_class {
+       TCORE_SS_CLATCORE_SS_NONE = 0x00,              /* 0x00 */
+
+       /* TELESERVICE */
+       TCORE_SS_CLATCORE_SS_ALL_TELE = 0x10,          /* 0x10 : All Teleservices */
+       TCORE_SS_CLATCORE_SS_VOICE = 0x11,             /* 0x11 : All Voice (telephony) */
+       TCORE_SS_CLATCORE_SS_ALL_DATA_TELE = 0x12,     /* 0x12 : All Data Teleservices */
+       TCORE_SS_CLATCORE_SS_FAX = 0x13,               /* 0x13 : All Fax Service */
+       TCORE_SS_CLATCORE_SS_SMS = 0x16,               /* 0x16 : SMS service */
+       TCORE_SS_CLATCORE_SS_VGCS = 0x17,              /* 0x17 : Voice Group Call Service */
+       TCORE_SS_CLATCORE_SS_VBS = 0x18,               /* 0x18 : Voice Broadcast */
+       TCORE_SS_CLATCORE_SS_ALL_TELE_EXPT_SMS = 0x19, /* 0x19 : All teleservice except SMS */
+
+       /* BEARER SERVICE */
+       TCORE_SS_CLATCORE_SS_ALL_BEARER = 0x20,        /* 0X20 : all bearer services */
+       TCORE_SS_CLATCORE_SS_ALL_ASYNC = 0x21,         /* 0x21 : All Async services */
+       TCORE_SS_CLATCORE_SS_ALL_SYNC = 0x22,          /* 0x22 : All sync services */
+       TCORE_SS_CLATCORE_SS_ALL_CS_SYNC = 0x24,       /* 0x24 : All Circuit switched sync */
+       TCORE_SS_CLATCORE_SS_ALL_CS_ASYNC = 0x25,      /* 0x25 : All Circuit switched async */
+       TCORE_SS_CLATCORE_SS_ALL_DEDI_PS = 0x26,       /* 0x26 : All Dedicated packet Access */
+       TCORE_SS_CLATCORE_SS_ALL_DEDI_PAD = 0x27,      /* 0x27 : All Dedicated PAD Access */
+       TCORE_SS_CLATCORE_SS_ALL_DATA_CDA = 0x28,      /* 0x28 : All Data CDA */
+
+       /* PLMN SPECIFIC TELESERVICE */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_ALL = 0x50,     /* 0x50 : PLMN specific teleservices */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_1 = 0x51,       /* 0x51 : PLMN specific teleservice 1 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_2 = 0x52,       /* 0x52 : PLMN specific teleservice 2 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_3 = 0x53,       /* 0x53 : PLMN specific teleservice 3 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_4 = 0x54,       /* 0x54 : PLMN specific teleservice 4 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_5 = 0x55,       /* 0x55 : PLMN specific teleservice 5 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_6 = 0x56,       /* 0x56 : PLMN specific teleservice 6 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_7 = 0x57,       /* 0x57 : PLMN specific teleservice 7 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_8 = 0x58,       /* 0x58 : PLMN specific teleservice 8 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_9 = 0x59,       /* 0x59 : PLMN specific teleservice 9 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_A = 0x60,       /* 0x60 : PLMN specific teleservice 10 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_B = 0x61,       /* 0x61 : PLMN specific teleservice 11 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_C = 0x62,       /* 0x62 : PLMN specific teleservice 12 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_D = 0x63,       /* 0x63 : PLMN specific teleservice 13 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_E = 0x64,       /* 0x64 : PLMN specific teleservice 14 */
+       TCORE_SS_CLATCORE_SS_PLMN_TELE_F = 0x65,       /* 0x65 : PLMN specific teleservice 15 */
+
+       /* PLMN SPECIFIC BEARER SERVICE */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_ALL = 0x70,     /* 0x70 : All PLMN specific bearer services */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_1 = 0x71,       /* 0x71 : PLMN specific bearer service 1 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_2 = 0x72,       /* 0x72 : PLMN specific bearer service 2 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_3 = 0x73,       /* 0x73 : PLMN specific bearer service 3 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_4 = 0x74,       /* 0x74 : PLMN specific bearer service 4 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_5 = 0x75,       /* 0x75 : PLMN specific bearer service 5 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_6 = 0x76,       /* 0x76 : PLMN specific bearer service 6 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_7 = 0x77,       /* 0x77 : PLMN specific bearer service 7 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_8 = 0x78,       /* 0x78 : PLMN specific bearer service 8 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_9 = 0x79,       /* 0x79 : PLMN specific bearer service 9 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_A = 0x80,       /* 0x80 : PLMN specific bearer service 10 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_B = 0x81,       /* 0x81 : PLMN specific bearer service 11 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_C = 0x82,       /* 0x82 : PLMN specific bearer service 12 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_D = 0x83,       /* 0x83 : PLMN specific bearer service 13 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_E = 0x84,       /* 0x84 : PLMN specific bearer service 14 */
+       TCORE_SS_CLATCORE_SS_PLMN_BEAR_F = 0x85,       /* 0x85 : PLMN specific bearer service 15 */
+
+       /* CPHS - AUXILIARY SERVICE */
+       TCORE_SS_CLATCORE_SS_AUX_VOICE = 0x89,         /* 0x89 : All Auxiliary Voice (Auxiliary telephony) */
+
+       TCORE_SS_CLATCORE_SS_ALL_GPRS_BEARER = 0x99,   /* 0x99 : All GPRS bearer services */
+       TCORE_SS_CLATCORE_SS_ALL_TELE_BEARER = 0xFF,   /* 0xFF : all tele and bearer services */
+};
+
+enum tcore_ss_status {
+       TCORE_SS_STATUS_REG = 0x01, /* 0x01 : Registration */
+       TCORE_SS_STATUS_DEREG,      /* 0x02 : De-registration( erase ) */
+       TCORE_SS_STATUS_ACTIVATE,   /* 0x03 : Activation */
+       TCORE_SS_STATUS_DEACTIVATE, /* 0x04 : De-activation */
+       TCORE_SS_STATUS_MAX
+};
+
+enum tcore_ss_barring_mode {
+       TCORE_SS_BARR_MODE_NONE,
+       TCORE_SS_BARR_MODE_BAOC,        /* 0x01 : Barring All Outgoing Calls */
+       TCORE_SS_BARR_MODE_BOIC,        /* 0x02 : Barring Outgoing International Calls */
+       TCORE_SS_BARR_MODE_BOIC_NOT_HC, /* 0x03 : Barring Outgoing International Calls  except to Home Country */
+       TCORE_SS_BARR_MODE_BAIC,        /* 0x04 : Barring All Incoming Calls */
+       TCORE_SS_BARR_MODE_BIC_ROAM,    /* 0x05 : Barring Incoming Calls when roam,     outside of the Home Country */
+       TCORE_SS_BARR_MODE_AB,          /* 0x06 : All Barring Services */
+       TCORE_SS_BARR_MODE_AOB,         /* 0x07 : All Outgoing Barring Services */
+       TCORE_SS_BARR_MODE_AIB,         /* 0x08 : All Incoming Barring Services */
+       TCORE_SS_BARR_MODE_BIC_NOT_SIM, /* 0x09 : Barring Incoming Calls which is not stored in the SIM memory */
+       TCORE_SS_BARR_MODE_MAX
+};
+
+enum tcore_ss_forwarding_mode {
+       TCORE_SS_CF_MODE_CFU = 0x01, /* 0x01 : Call Forwarding Unconditional */
+       TCORE_SS_CF_MODE_CFB,        /* 0x02 : Call Forwarding Mobile Busy */
+       TCORE_SS_CF_MODE_CFNRy,      /* 0x03 : Call Forwarding No Reply */
+       TCORE_SS_CF_MODE_CFNRc,      /* 0x04 : Call Forwarding Not Reachable */
+       TCORE_SS_CF_MODE_CF_ALL,     /* 0x05 : All Call Forwarding */
+       TCORE_SS_CF_MODE_CFC,        /* 0x06 : All Conditional Call Forwarding */
+       TCORE_SS_CF_MODE_MAX         /* 0x07 : Max */
+};
+
+enum tcore_ss_ussd_type {
+       TCORE_SS_USSD_TYPE_USER_INITIATED = 0x01, /* User Initiated USSD Message */
+       TCORE_SS_USSD_TYPE_USER_RES,              /* User Response to Network Initiated Message */
+       TCORE_SS_USSD_TYPE_USER_RELEASE,          /* SS Termination by user */
+       TCORE_SS_USSD_TYPE_NETWORK_INITIATED,     /* Network Initiated USSD Message */
+       TCORE_SS_USSD_TYPE_MAX,
+};
+
+enum tcore_ss_ussd_status {
+       TCORE_SS_USSD_NO_ACTION_REQUIRE = 0x01, /* 0x01 : no further user action required  information needed after mobile initiated operation) */
+       TCORE_SS_USSD_ACTION_REQUIRE,           /* 0x02 : further user action required(network initiated USSD Request, or further information needed after mobile initiated operation) */
+       TCORE_SS_USSD_TERMINATED_BY_NET,        /* 0x03 : USSD terminated by network */
+       TCORE_SS_USSD_OTHER_CLIENT,             /* 0x04 : other local client has responded */
+       TCORE_SS_USSD_NOT_SUPPORT,              /* 0x05 : operation not supported */
+       TCORE_SS_USSD_TIME_OUT,                 /* 0x06 : network time out */
+       TCORE_SS_USSD_MAX
+};
+
+enum tcore_ss_aoc_type {
+       TCORE_SS_AOC_TYPE_RESET  = 0x00, /* AoC Reset Message */
+       TCORE_SS_AOC_TYPE_ACM    = 0x01, /* Accumulated call meter Message */
+       TCORE_SS_AOC_TYPE_CCM    = 0x02, /* Current call meter Message */
+       TCORE_SS_AOC_TYPE_MAXACM = 0x04, /* Max Accumulated call meter Message */
+       TCORE_SS_AOC_TYPE_PUC    = 0x08, /* Price per unit and currency Message */
+       TCORE_SS_AOC_TYPE_MAX    = 0x10
+};
 
 typedef struct ussd_session UssdSession;
 
-typedef struct {
-       TelReturn (*set_barring)(CoreObject *co, const TelSsBarringInfo *barring_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_barring_status)(CoreObject *co, const TelSsBarringGetInfo *get_barring_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*change_barring_password)(CoreObject *co, const TelSsBarringPwdInfo *barring_pwd_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_forwarding)(CoreObject *co, const TelSsForwardInfo *forwarding_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_forwarding_status)(CoreObject *co, const TelSsForwardGetInfo *get_forwarding_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_waiting)(CoreObject *co, const TelSsWaitingInfo *waiting_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_waiting_status)(CoreObject *co, TelSsClass ss_class, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*set_cli)(CoreObject *co, const TelSsCliInfo *cli_info, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*get_cli_status)(CoreObject *co, TelSsCliType cli_type, TcoreObjectResponseCallback cb, void *cb_data);
-       TelReturn (*send_ussd_request)(CoreObject *co, const TelSsUssdInfo *ussd_request, TcoreObjectResponseCallback cb, void *cb_data);
-} TcoreSsOps;
-
-
-CoreObject *tcore_ss_new(TcorePlugin *p, TcoreSsOps *ops, TcoreHal *hal);
-void tcore_ss_free(CoreObject *co);
-
-gboolean tcore_ss_set_ops(CoreObject *co, TcoreSsOps *ops);
-void tcore_ss_override_ops(CoreObject *co, TcoreSsOps *ss_ops);
-
-UssdSession *tcore_ss_ussd_create_session(CoreObject *co, TelSsUssdType type, void *data, guint data_len);
-void tcore_ss_ussd_destroy_session(UssdSession *ussd_s);
-UssdSession *tcore_ss_ussd_get_session(CoreObject *co);
-gboolean tcore_ss_ussd_get_session_type(UssdSession *ussd_s, TelSsUssdType *ussd_type);
-gboolean tcore_ss_ussd_set_session_type(UssdSession *ussd_s, TelSsUssdType type);
-gboolean tcore_ss_ussd_get_session_data(UssdSession *ussd_s, void **data, guint *data_len);
-gboolean tcore_ss_ussd_set_session_data(UssdSession *ussd_s, void *data, guint data_len);
-
-#ifdef __cplusplus
-}
-#endif
+struct tcore_ss_operations {
+       TReturn (*barring_activate)(CoreObject *o, UserRequest *ur);
+       TReturn (*barring_deactivate)(CoreObject *o, UserRequest *ur);
+       TReturn (*barring_change_password)(CoreObject *o, UserRequest *ur);
+       TReturn (*barring_get_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*forwarding_activate)(CoreObject *o, UserRequest *ur);
+       TReturn (*forwarding_deactivate)(CoreObject *o, UserRequest *ur);
+       TReturn (*forwarding_register)(CoreObject *o, UserRequest *ur);
+       TReturn (*forwarding_deregister)(CoreObject *o, UserRequest *ur);
+       TReturn (*forwarding_get_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*waiting_activate)(CoreObject *o, UserRequest *ur);
+       TReturn (*waiting_deactivate)(CoreObject *o, UserRequest *ur);
+       TReturn (*waiting_get_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*cli_activate)(CoreObject *o, UserRequest *ur);
+       TReturn (*cli_deactivate)(CoreObject *o, UserRequest *ur);
+       TReturn (*cli_set_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*cli_get_status)(CoreObject *o, UserRequest *ur);
+       TReturn (*send_ussd)(CoreObject *o, UserRequest *ur);
+       TReturn (*set_aoc)(CoreObject *o, UserRequest *ur);
+       TReturn (*get_aoc)(CoreObject *o, UserRequest *ur);
+};
+
+
+CoreObject* tcore_ss_new(TcorePlugin *p, const char *name, struct tcore_ss_operations *ops, TcoreHal *hal);
+void        tcore_ss_free(CoreObject *o);
+
+void tcore_ss_set_ops(CoreObject *o, struct tcore_ss_operations *ops);
+
+struct ussd_session*   tcore_ss_ussd_create_session( CoreObject *o, enum tcore_ss_ussd_type type, void *data, int data_len );
+void                                   tcore_ss_ussd_destroy_session( struct ussd_session *ussd_s );
+struct ussd_session*   tcore_ss_ussd_get_session( CoreObject *o );
+enum tcore_ss_ussd_type tcore_ss_ussd_get_session_type( struct ussd_session* ussd_s );
+void                                   tcore_ss_ussd_set_session_type( struct ussd_session* ussd_s, enum tcore_ss_ussd_type type );
+int                                            tcore_ss_ussd_get_session_data( struct ussd_session* ussd_s, void** data );
+void                                   tcore_ss_ussd_set_session_data( struct ussd_session* ussd_s, void* data, int data_len );
 
+__END_DECLS
 
 #endif
index bfb5d02..867cb66 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __COMMUNICATOR_H__
-#define __COMMUNICATOR_H__
+#ifndef __TCORE_COMMUNICATOR_H__
+#define __TCORE_COMMUNICATOR_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
 
-typedef struct {
-       TelReturn (*send_notification)(Communicator *comm,
-       TcorePlugin *source, gint command, unsigned int data_len, const void *data);
-} TcoreCommunicatorOps ;
+struct tcore_communitor_operations {
+       TReturn (*send_response)(Communicator *comm, UserRequest *ur,
+        enum tcore_response_command command,
+        unsigned int data_len, const void *data);
 
-Communicator *tcore_communicator_new(TcorePlugin *plugin,
-               const gchar *name, TcoreCommunicatorOps *ops);
-void tcore_communicator_free(Communicator *comm);
+       TReturn (*send_notification)(Communicator *comm, CoreObject *source,
+        enum tcore_notification_command command,
+        unsigned int data_len, const void *data);
+};
 
-TcorePlugin *tcore_communicator_ref_plugin(Communicator *comm);
-const gchar *tcore_communicator_ref_name(Communicator *comm);
+Communicator* tcore_communicator_new(TcorePlugin *plugin, const char *name,
+                  struct tcore_communitor_operations *ops);
+void          tcore_communicator_free();
 
-TelReturn tcore_communicator_link_user_data(Communicator *comm, void *data);
-void *tcore_communicator_ref_user_data(Communicator *comm);
+TcorePlugin*  tcore_communicator_ref_plugin(Communicator *comm);
+const char*   tcore_communicator_ref_name(Communicator *comm);
 
-TelReturn tcore_communicator_send_notification(Communicator *comm,
-       TcorePlugin *source, gint command, guint data_len, const void *data);
+TReturn       tcore_communicator_link_user_data(Communicator *comm, void *data);
+void*         tcore_communicator_ref_user_data(Communicator *comm);
 
-#ifdef __cplusplus
-}
-#endif
+TReturn       tcore_communicator_send_response(Communicator *comm,
+                  UserRequest *ur,  enum tcore_response_command command,
+                  unsigned int data_len, const void *data);
+
+TReturn       tcore_communicator_send_notification(Communicator *comm,
+                  CoreObject *source, enum tcore_notification_command command,
+                  unsigned int data_len, const void *data);
 
-#endif /* __COMMUNICATOR_H__ */
+TReturn       tcore_communicator_dispatch_request(Communicator *comm, UserRequest *ur);
+
+__END_DECLS
+
+#endif
index 61ff974..49f323e 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __CORE_OBJECT_H__
-#define __CORE_OBJECT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define CORE_OBJECT_TYPE_DEFAULT       0xB0000000
-#define CORE_OBJECT_TYPE_MODEM (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_MODEM)
-#define CORE_OBJECT_TYPE_CALL          (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_CALL)
-#define CORE_OBJECT_TYPE_SS            (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SS)
-#define CORE_OBJECT_TYPE_NETWORK       (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_NETWORK)
-#define CORE_OBJECT_TYPE_PS            (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_PS)
-#define CORE_OBJECT_TYPE_PS_CONTEXT    (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_PDP)
-#define CORE_OBJECT_TYPE_SIM           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SIM)
-#define CORE_OBJECT_TYPE_SAT           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SAT)
-#define CORE_OBJECT_TYPE_SAP           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SAP)
-#define CORE_OBJECT_TYPE_SMS           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SMS)
-#define CORE_OBJECT_TYPE_PHONEBOOK     (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_PHONEBOOK)
-#define CORE_OBJECT_TYPE_CUSTOM        (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_CUSTOM)
-#define CORE_OBJECT_TYPE_GPS           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_GPS)
-
-#define CORE_OBJECT_CHECK(co,t) \
-       if (co == NULL) { warn("core_object is NULL"); return; } \
-       if (tcore_object_get_type(co) != t) { \
-               warn("type(0x%x != 0x%x) mismatch", tcore_object_get_type(co), t); \
-               return; \
-       }
-
-#define CORE_OBJECT_CHECK_RETURN(co,t,r) \
-       if (co == NULL) { warn("core_object is NULL"); return r; } \
-       if (tcore_object_get_type(co) != t) { \
-               warn("type(0x%x != 0x%x) mismatch", tcore_object_get_type(co), t); \
-               return r; \
-       }
-
-#define GET_OBJECT_TYPE(command)       ((command & 0x0FF00000) | CORE_OBJECT_TYPE_DEFAULT)
-
-typedef struct tcore_object_mapping_tbl TcoreObjectMappingTable;
-
-typedef void (*TcoreObjectFreeHook)(CoreObject *co);
-typedef void (*TcoreObjectCloneHook)(CoreObject *src, CoreObject *dest);
-typedef gboolean (*TcoreObjectCallback)(CoreObject *co,
-       const void *event_info, void *user_data);
-
-typedef gboolean (*TcoreObjectInit)(TcorePlugin *plugin, CoreObject *co);
-typedef void (*TcoreObjectDeinit)(TcorePlugin *plugin, CoreObject *co);
+#ifndef __TCORE_CORE_OBJECT_H__
+#define __TCORE_CORE_OBJECT_H__
+
+__BEGIN_DECLS
+
+#define CORE_OBJECT_TYPE_DEFAULT       0xB0000000
+#define CORE_OBJECT_TYPE_MODEM         (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_MODEM)
+#define CORE_OBJECT_TYPE_CALL          (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_CALL)
+#define CORE_OBJECT_TYPE_SS            (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SS)
+#define CORE_OBJECT_TYPE_NETWORK       (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_NETWORK)
+#define CORE_OBJECT_TYPE_PS            (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_PS)
+#define CORE_OBJECT_TYPE_PS_CONTEXT    (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_PDP)
+#define CORE_OBJECT_TYPE_SIM           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SIM)
+#define CORE_OBJECT_TYPE_SAT           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SAT)
+#define CORE_OBJECT_TYPE_SAP           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SAP)
+#define CORE_OBJECT_TYPE_SMS           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SMS)
+#define CORE_OBJECT_TYPE_PHONEBOOK     (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_PHONEBOOK)
+#define CORE_OBJECT_TYPE_SOUND         (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_SOUND)
+#define CORE_OBJECT_TYPE_CUSTOM        (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_CUSTOM)
+#define CORE_OBJECT_TYPE_GPS           (CORE_OBJECT_TYPE_DEFAULT | TCORE_TYPE_GPS)
+
+#define CORE_OBJECT_CHECK(o,t) \
+       if (!o) { warn("core_object is NULL"); return; } \
+       if (tcore_object_get_type(o) != t) { warn("type(0x%x != 0x%x) mismatch", tcore_object_get_type(o), t); return; }
+#define CORE_OBJECT_CHECK_RETURN(o,t,r) \
+       if (!o) { warn("core_object is NULL"); return r; } \
+       if (tcore_object_get_type(o) != t) { warn("type(0x%x != 0x%x) mismatch", tcore_object_get_type(o), t); return r; }
+typedef struct tcore_object_mapping_tbl object_mapping_table_t;
+
+#define CORE_OBJECT_EVENT_PROPERTY_CHANGED "core_object_property_changed"
+#define CORE_OBJECT_KEY_FIND(keys, k) g_slist_find_custom((keys), (k), (GCompareFunc)g_strcmp0)
+
+typedef void (*CoreObjectFreeHook)(CoreObject *co);
+typedef void (*CoreObjectCloneHook)(CoreObject *src, CoreObject *dest);
+typedef gboolean (*CoreObjectCallback)(CoreObject *co, const void *event_info, void *user_data);
+typedef gboolean (*tcore_object_callback)(CoreObject *co,
+                               const void *event_info, void *user_data);
+typedef TReturn (*CoreObjectDispatcher)(CoreObject *co, UserRequest *ur);
+
+typedef gboolean (*tcore_object_init)(TcorePlugin *plugin, CoreObject *co);
+typedef void (*tcore_object_deinit)(TcorePlugin *plugin, CoreObject *co);
 
 /* Core Object Initializers */
-typedef struct {
-       TcoreObjectInit modem_init;
-       TcoreObjectInit sim_init;
-       TcoreObjectInit sat_init;
-       TcoreObjectInit sap_init;
-       TcoreObjectInit network_init;
-       TcoreObjectInit ps_init;
-       TcoreObjectInit call_init;
-       TcoreObjectInit ss_init;
-       TcoreObjectInit sms_init;
-       TcoreObjectInit phonebook_init;
-       TcoreObjectInit gps_init;
+struct object_initializer {
+       tcore_object_init modem_init;
+       tcore_object_init sim_init;
+       tcore_object_init sat_init;
+       tcore_object_init sap_init;
+       tcore_object_init network_init;
+       tcore_object_init ps_init;
+       tcore_object_init call_init;
+       tcore_object_init ss_init;
+       tcore_object_init sms_init;
+       tcore_object_init phonebook_init;
+       tcore_object_init gps_init;
        /* To be updated based on New modules */
-} TcoreObjectInitializer;
+};
 
 /* Core Object De-initializers */
-typedef struct {
-       TcoreObjectDeinit modem_deinit;
-       TcoreObjectDeinit sim_deinit;
-       TcoreObjectDeinit sat_deinit;
-       TcoreObjectDeinit sap_deinit;
-       TcoreObjectDeinit network_deinit;
-       TcoreObjectDeinit ps_deinit;
-       TcoreObjectDeinit call_deinit;
-       TcoreObjectDeinit ss_deinit;
-       TcoreObjectDeinit sms_deinit;
-       TcoreObjectDeinit phonebook_deinit;
-       TcoreObjectDeinit gps_deinit;
+struct object_deinitializer {
+       tcore_object_deinit modem_deinit;
+       tcore_object_deinit sim_deinit;
+       tcore_object_deinit sat_deinit;
+       tcore_object_deinit sap_deinit;
+       tcore_object_deinit network_deinit;
+       tcore_object_deinit ps_deinit;
+       tcore_object_deinit call_deinit;
+       tcore_object_deinit ss_deinit;
+       tcore_object_deinit sms_deinit;
+       tcore_object_deinit phonebook_deinit;
+       tcore_object_deinit gps_deinit;
        /* To be updated based on New modules */
-} TcoreObjectDeinitializer;
+};
+
 
-CoreObject *tcore_object_new(TcorePlugin *plugin, TcoreHal *hal);
-void tcore_object_free(CoreObject *co);
+CoreObject*      tcore_object_new(TcorePlugin *plugin, const char *name, TcoreHal *hal);
+void             tcore_object_free(CoreObject *co);
 
-TelReturn tcore_object_set_free_hook(CoreObject *co,
-               TcoreObjectFreeHook free_hook);
-TelReturn tcore_object_set_clone_hook(CoreObject *co,
-               TcoreObjectCloneHook clone_hook);
+TReturn          tcore_object_set_free_hook(CoreObject *co, CoreObjectFreeHook free_hook);
+TReturn          tcore_object_set_clone_hook(CoreObject *co, CoreObjectCloneHook clone_hook);
+
+CoreObject*      tcore_object_clone(CoreObject *src, TcorePlugin *new_parent);
+
+TReturn          tcore_object_set_name(CoreObject *co, const char *name);
+const char*      tcore_object_ref_name(CoreObject *co);
 
-CoreObject *tcore_object_clone(CoreObject *src, TcorePlugin *new_parent);
 CoreObject *tcore_object_clone_template_object(TcorePlugin *p,
-               guint co_type);
-
-TelReturn tcore_object_set_plugin(CoreObject *co, TcorePlugin *plugin);
-TcorePlugin *tcore_object_ref_plugin(CoreObject *co);
-
-TelReturn tcore_object_link_object(CoreObject *co, void *object);
-void *tcore_object_ref_object(CoreObject *co);
-
-TelReturn tcore_object_set_type(CoreObject *co, guint type);
-guint tcore_object_get_type(CoreObject *co);
-
-TelReturn tcore_object_set_hal(CoreObject *co, TcoreHal *hal);
-TcoreHal *tcore_object_get_hal(CoreObject *co);
-
-TelReturn tcore_object_link_user_data(CoreObject *co, void *user_data);
-void *tcore_object_ref_user_data(CoreObject *co);
-
-TelReturn tcore_object_set_dispatcher(CoreObject *co, TcoreObjectDispatcher func);
-TelReturn tcore_object_dispatch_request(CoreObject *co,
-               gboolean exec_hooks, TcoreCommand command,
-               const void *request, guint request_len,
-               TcorePluginResponseCallback cb, const void *user_data);
-
-TelReturn tcore_object_add_callback(CoreObject *co, const gchar *event,
-               TcoreObjectCallback callback, void *user_data);
-TelReturn tcore_object_del_callback(CoreObject *co, const gchar *event,
-               TcoreObjectCallback callback);
-TelReturn tcore_object_override_callback(CoreObject *co, const gchar *event,
-               TcoreObjectCallback callback, void *user_data);
-TelReturn tcore_object_emit_callback(CoreObject *co, const gchar *event,
-               const void *event_info);
-
-TelReturn tcore_object_add_request_hook(CoreObject *co,
-               TcoreCommand command, TcoreRequestHook func, void *user_data);
-void tcore_object_remove_request_hook(CoreObject *co,
-               TcoreCommand command, TcoreRequestHook func);
-
-TelReturn tcore_object_add_response_hook(CoreObject *co,
-               TcoreCommand command, const void *request,
-               TcoreResponseHook func, void *user_data);
-void tcore_object_remove_response_hook(CoreObject *co,
-               TcoreCommand command, TcoreResponseHook func);
-
-TelReturn tcore_object_add_notification_hook(CoreObject *co,
-       TcoreNotification command, TcoreNotificationHook func, void *user_data);
-void tcore_object_remove_notification_hook(CoreObject *co,
-       TcoreNotification command, TcoreNotificationHook func);
-TelReturn tcore_object_send_notification(CoreObject *co,
-       TcoreNotification command, guint data_len, void *data);
+                                       unsigned int co_type);
+
+
+TReturn          tcore_object_set_plugin(CoreObject *co, TcorePlugin *plugin);
+TcorePlugin*     tcore_object_ref_plugin(CoreObject *co);
+
+TReturn          tcore_object_link_object(CoreObject *co, void *object);
+void*            tcore_object_ref_object(CoreObject *co);
 
+TReturn          tcore_object_set_type(CoreObject *co, unsigned int type);
+unsigned int     tcore_object_get_type(CoreObject *co);
+
+TReturn          tcore_object_set_hal(CoreObject *co, TcoreHal *hal);
+TcoreHal*        tcore_object_get_hal(CoreObject *co);
+
+TReturn          tcore_object_link_user_data(CoreObject *co, void *user_data);
+void*            tcore_object_ref_user_data(CoreObject *co);
+
+TReturn          tcore_object_set_dispatcher(CoreObject *co, CoreObjectDispatcher func);
+TReturn          tcore_object_dispatch_request(CoreObject *co, UserRequest *ur);
+
+TReturn          tcore_object_add_callback(CoreObject *co, const char *event, CoreObjectCallback callback, void *user_data);
+TReturn          tcore_object_del_callback(CoreObject *co, const char *event, CoreObjectCallback callback);
+TReturn tcore_object_override_callback(CoreObject *co, const char *event, CoreObjectCallback callback, void *user_data);
+TReturn          tcore_object_emit_callback(CoreObject *co, const char *event, const void *event_info);
+
+#define          tcore_object_set_property(co, ...) tcore_object_set_property_full(co, __VA_ARGS__, NULL, NULL)
+TReturn          tcore_object_set_property_full(CoreObject *co, const char *first_property, ...);
+const char*      tcore_object_ref_property(CoreObject *co, const char *key);
+GHashTable*      tcore_object_ref_property_hash(CoreObject *co);
 void *tcore_object_add_mapping_tbl_entry(void *mapping_tbl,
-               guint object_type, TcoreHal *hal);
+                                               unsigned int object_type, TcoreHal *hal);
 void tcore_object_remove_mapping_tbl(void *mapping_tbl);
 void *tcore_object_remove_mapping_tbl_entry(void *mapping_tbl, TcoreHal *hal);
 void tcore_object_remove_mapping_tbl_entry_by_type(void *mapping_tbl,
-               guint co_type);
+                                                       unsigned int co_type);
 
 void tcore_object_print_mapping_tbl(void *mapping_tbl);
 
-TelReturn tcore_object_init_objects(TcorePlugin *plugin,
-               TcoreObjectInitializer *initializer_list);
+TReturn tcore_object_init_objects(TcorePlugin *plugin,
+                                               struct object_initializer *initializer_list);
 void tcore_object_deinit_objects(TcorePlugin *plugin,
-               TcoreObjectDeinitializer *deinitializer_list);
+                                               struct object_deinitializer *deinitializer_list);
+
 
-#ifdef __cplusplus
-}
-#endif
 
-#endif /* __CORE_OBJECT_H__ */
+__END_DECLS
+
+#endif
index a925647..024bcb1 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __HAL_H__
-#define __HAL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef __TCORE_HAL_H__
+#define __TCORE_HAL_H__
 
-typedef void (*TcoreHalReceiveCallback)(TcoreHal *hal,
-       guint data_len, const void *data, void *user_data);
+__BEGIN_DECLS
 
-typedef TcoreHookReturn (*TcoreHalSendHook)(TcoreHal *hal,
-       guint data_len, void *data, void *user_data);
+typedef void (*TcoreHalReceiveCallback)(TcoreHal *hal, unsigned int data_len, const void *data, void *user_data);
+typedef enum tcore_hook_return (*TcoreHalSendHook)(TcoreHal *hal, unsigned int data_len, void *data, void *user_data);
+typedef void (*TcoreHalSetupNetifCallback)(CoreObject *co, int result, const char* devname, void *user_data);
 
-typedef void (*TcoreHalSetupNetifCallback)(CoreObject *co,
-       gint result, const gchar* devname, void *user_data);
-
-typedef enum {
+enum tcore_hal_recv_data_type {
        TCORE_HAL_RECV_INDICATION,
        TCORE_HAL_RECV_RESPONSE,
        TCORE_HAL_RECV_NOTIFICATION,
        TCORE_HAL_RECV_UNKNOWN
-} TcoreHalRecvDataType;
+};
 
-typedef enum {
+enum tcore_hal_mode {
        TCORE_HAL_MODE_UNKNOWN,
        TCORE_HAL_MODE_AT,
        TCORE_HAL_MODE_CUSTOM,
-       TCORE_HAL_MODE_TRANSPARENT
-} TcoreHalMode;
-
-typedef struct {
-       TelReturn (*power)(TcoreHal *hal, gboolean flag);
-       TelReturn (*send)(TcoreHal *hal, guint data_len, void *data);
-       TelReturn (*setup_netif)(CoreObject *co,
-               TcoreHalSetupNetifCallback func, void *user_data,
-               guint cid, gboolean enable);
-} TcoreHalOperations;
-
-TcoreHal *tcore_hal_new(TcorePlugin *plugin, const gchar *name,
-               TcoreHalOperations *hops, TcoreHalMode mode);
-void tcore_hal_free(TcoreHal *hal);
-
-TelReturn tcore_hal_set_name(TcoreHal *hal, const gchar *name);
-gchar *tcore_hal_get_name(TcoreHal *hal);
-
-TcoreAT *tcore_hal_get_at(TcoreHal *hal);
-TcoreHalMode tcore_hal_get_mode(TcoreHal *hal);
-TelReturn tcore_hal_set_mode(TcoreHal *hal, TcoreHalMode mode);
-
-TelReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag);
-
-TelReturn tcore_hal_link_user_data(TcoreHal *hal, void *user_data);
-void *tcore_hal_ref_user_data(TcoreHal *hal);
-
-TelReturn tcore_hal_send_data(TcoreHal *hal, guint data_len, void *data);
-TelReturn tcore_hal_send_request(TcoreHal *hal, TcorePending *pending);
-TelReturn tcore_hal_send_force(TcoreHal *hal);
-
-TelReturn tcore_hal_dispatch_response_data(TcoreHal *hal, guint id,
-               guint data_len, const void *data);
-
-TelReturn tcore_hal_add_recv_callback(TcoreHal *hal,
-       TcoreHalReceiveCallback func, void *user_data);
-TelReturn tcore_hal_remove_recv_callback(TcoreHal *hal,
-       TcoreHalReceiveCallback func);
-TelReturn tcore_hal_emit_recv_callback(TcoreHal *hal,
-       guint data_len, const void *data);
-TelReturn tcore_hal_add_send_hook(TcoreHal *hal,
-       TcoreHalSendHook func, void *user_data);
-TelReturn tcore_hal_remove_send_hook(TcoreHal *hal,
-       TcoreHalSendHook func);
-
-TelReturn tcore_hal_set_power_state(TcoreHal *hal, gboolean flag);
-gboolean tcore_hal_get_power_state(TcoreHal *hal);
-
-TcoreQueue *tcore_hal_ref_queue(TcoreHal *hal);
-TcorePlugin *tcore_hal_ref_plugin(TcoreHal *hal);
-
-TelReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
-       TcoreHalSetupNetifCallback func, void *user_data,
-       guint cid, gboolean enable);
-
-#ifdef __cplusplus
-}
-#endif
+    TCORE_HAL_MODE_TRANSPARENT
+};
+
+struct tcore_hal_operations {
+       TReturn (*power)(TcoreHal *hal, gboolean flag);
+       TReturn (*send)(TcoreHal *hal, unsigned int data_len, void *data);
+       TReturn (*setup_netif)(CoreObject *co,
+                               TcoreHalSetupNetifCallback func,
+                               void *user_data, unsigned int cid,
+                               gboolean enable);
+};
+
+TcoreHal*    tcore_hal_new(TcorePlugin *plugin, const char *name,
+                 struct tcore_hal_operations *hops,
+                 enum tcore_hal_mode mode);
+void         tcore_hal_free(TcoreHal *hal);
+
+TReturn      tcore_hal_set_name(TcoreHal *hal, const char *name);
+char*        tcore_hal_get_name(TcoreHal *hal);
+
+TcoreAT*     tcore_hal_get_at(TcoreHal *hal);
+enum tcore_hal_mode tcore_hal_get_mode(TcoreHal *hal);
+TReturn      tcore_hal_set_mode(TcoreHal *hal, enum tcore_hal_mode mode);
+
+TReturn      tcore_hal_set_power(TcoreHal *hal, gboolean flag);
 
-#endif /* __HAL_H__ */
+TReturn      tcore_hal_link_user_data(TcoreHal *hal, void *user_data);
+void*        tcore_hal_ref_user_data(TcoreHal *hal);
+
+TReturn      tcore_hal_send_data(TcoreHal *hal, unsigned int data_len, void *data);
+TReturn      tcore_hal_send_request(TcoreHal *hal, TcorePending *pending);
+TReturn      tcore_hal_send_force(TcoreHal *hal);
+
+TReturn      tcore_hal_free_timeout_pending_request(TcoreHal *hal, TcorePending *p,
+                 unsigned int data_len, const void *data);
+TReturn      tcore_hal_dispatch_response_data(TcoreHal *hal, int id,
+                 unsigned int data_len, const void *data);
+
+TReturn      tcore_hal_add_recv_callback(TcoreHal *hal,
+                 TcoreHalReceiveCallback func, void *user_data);
+TReturn      tcore_hal_remove_recv_callback(TcoreHal *hal,
+                 TcoreHalReceiveCallback func);
+TReturn      tcore_hal_emit_recv_callback(TcoreHal *hal,
+                 unsigned int data_len, const void *data);
+
+TReturn      tcore_hal_add_send_hook(TcoreHal *hal, TcoreHalSendHook func,
+                 void *user_data);
+TReturn      tcore_hal_remove_send_hook(TcoreHal *hal, TcoreHalSendHook func);
+
+TReturn      tcore_hal_set_power_state(TcoreHal *hal, gboolean flag);
+gboolean     tcore_hal_get_power_state(TcoreHal *hal);
+
+TcoreQueue*  tcore_hal_ref_queue(TcoreHal *hal);
+TcorePlugin* tcore_hal_ref_plugin(TcoreHal *hal);
+
+TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
+                                       TcoreHalSetupNetifCallback func,
+                                       void *user_data, unsigned int cid,
+                                       gboolean enable);
+
+__END_DECLS
+
+#endif
index 7fe63e6..fb251c3 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #ifndef __TCORE_LOG_H__
 #define __TCORE_LOG_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
+
+#include <glib.h>
+extern gboolean tcore_debug;
 
 #ifdef FEATURE_DLOG_DEBUG
 
@@ -32,11 +34,12 @@ extern "C" {
 #define TCORE_LOG_TAG "UNKNOWN"
 #endif
 
-#define info(fmt,args...)  do { RLOG(LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); } while(0)
-#define msg(fmt,args...)  do { RLOG(LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); } while(0)
-#define dbg(fmt,args...)  do { RLOG(LOG_DEBUG, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
-#define warn(fmt,args...)  do { RLOG(LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
-#define err(fmt,args...)  do { RLOG(LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
+#define info(fmt,args...)  { if(tcore_debug) RLOG(LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); }
+#define msg(fmt,args...)  { if(tcore_debug) RLOG(LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); }
+#define dbg(fmt,args...)  { if(tcore_debug) RLOG(LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); }
+#define warn(fmt,args...)  { RLOG(LOG_WARN, TCORE_LOG_TAG, fmt "\n", ##args); }
+#define err(fmt,args...)  { RLOG(LOG_ERROR, TCORE_LOG_TAG, fmt "\n", ##args); }
+#define fatal(fmt,args...)  { RLOG(LOG_FATAL, TCORE_LOG_TAG, fmt "\n", ##args); }
 
 #elif defined(FEATURE_TLOG_DEBUG)
 
@@ -47,7 +50,8 @@ extern "C" {
 enum tcore_log_type {
        TCORE_LOG_TYPE_MAIN = 0,
        TCORE_LOG_TYPE_RADIO,
-       TCORE_LOG_TYPE_SYSTEM
+       TCORE_LOG_TYPE_SYSTEM,
+       TCORE_LOG_TYPE_TIME_CHECK
 };
 
 enum tcore_log_priority {
@@ -68,15 +72,21 @@ enum tcore_log_priority {
  */
 void tcore_log(enum tcore_log_type type, enum tcore_log_priority priority, const char *tag, const char *fmt, ...);
 
-#ifndef __MODULE__
-#define __MODULE__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
-#endif
+#define info(fmt,args...)  { if(tcore_debug) tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_INFO, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define msg(fmt,args...)  { if(tcore_debug) tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); }
+#define dbg(fmt,args...)  { if(tcore_debug) tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define warn(fmt,args...)  { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define err(fmt,args...)  { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_ERROR, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define fatal(fmt,args...)  { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+
+#define info_ex(tag,fmt,args...)  { if(tcore_debug) tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_INFO, tag, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define msg_ex(tag,fmt,args...)  { if(tcore_debug) tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_INFO, tag, fmt "\n", ##args); }
+#define dbg_ex(tag,fmt,args...)  { if(tcore_debug) tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, tag, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define warn_ex(tag,fmt,args...)  { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_WARN, tag, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define err_ex(tag,fmt,args...)  { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_ERROR, tag, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
+#define fatal_ex(tag,fmt,args...)  { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_FATAL, tag, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); }
 
-#define info(fmt,args...)  do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); } while(0)
-#define msg(fmt,args...)  do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); } while(0)
-#define dbg(fmt,args...)  do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, "<%s: %s[%d]> " fmt "\n", __MODULE__, __func__, __LINE__, ##args); } while(0)
-#define warn(fmt,args...)  do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_WARN, TCORE_LOG_TAG, "<%s: %s[%d]> " fmt "\n", __MODULE__, __func__, __LINE__, ##args); } while(0)
-#define err(fmt,args...)  do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_FATAL, TCORE_LOG_TAG, "<%s: %s[%d]> " fmt "\n", __MODULE__, __func__, __LINE__, ##args); } while(0)
+#define TIME_CHECK(fmt,args...) { tcore_log(TCORE_LOG_TYPE_TIME_CHECK, TCORE_LOG_INFO, "TIME_CHECK", fmt "\n", ##args); }
 
 #else
 
@@ -108,16 +118,15 @@ void tcore_log(enum tcore_log_type type, enum tcore_log_priority priority, const
 #define TCORE_LOG_FUNC fprintf
 #endif
 
-#define info(fmt,args...)  do { TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE); } while(0)
-#define msg(fmt,args...)  do { TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE); } while(0)
-#define dbg(fmt,args...)  do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTGRAY "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0)
-#define warn(fmt,args...)  do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_YELLOW "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0)
-#define err(fmt,args...)  do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTRED "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0)
+#define info(fmt,args...) { if(tcore_debug) TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE);}
+#define msg(fmt,args...) { if(tcore_debug) TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE);}
+#define dbg(fmt,args...) { if(tcore_debug) TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTGRAY "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE);}
+#define warn(fmt,args...) TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_YELLOW "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE);
+#define err(fmt,args...)  TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTRED "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE);
+#define fatal(fmt,args...)  TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTRED "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE);
 
 #endif
 
-#ifdef __cplusplus
-}
-#endif
+__END_DECLS
 
 #endif
index 1f598c0..a17f127 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Arijit Sen <arijit.sen@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,34 +30,34 @@ typedef enum {
 } tcore_cmux_mode;
 
 /* CMUX Channel */
-typedef struct cmux_channel TcoreCmuxChannel;
+typedef struct cmux_channel tcore_cmux_channel;
 
 /* Global MUX Object */
-typedef struct cmux_obj TcoreCmuxObject;
+typedef struct cmux_obj tcore_cmux_object;
 
 /* CMUX setup complete callback prototype */
-typedef void (*CmuxSetupCompleteCbFunc) (gpointer user_data);
+typedef void (*cmux_setup_complete_cb_func) (gpointer user_data);
 
 /* CMUX setup callback prototype */
-typedef void (*CmuxSetupCbFunc) (guint channel_id,
-       TcoreHal *hal, gpointer user_data);
+typedef void (*cmux_setup_cb_func) (int channel_id, TcoreHal *hal,
+                                                                       gpointer user_data);
 
 /* CMUX Channel close callback prototype */
-typedef void (*CmuxChannelCloseCbFunc) (TcoreHal *hal, gpointer user_data);
+typedef void (*cmux_channel_close_cb_func) (TcoreHal *hal, gpointer user_data);
 
 /* CMUX initialization - Internal and Kernel */
-TelReturn tcore_cmux_init(TcoreHal *phy_hal, guint frame_size,
-       TcorePendingResponseCallback resp_cb, void *resp_cb_data);
+TReturn tcore_cmux_init(TcoreHal *phy_hal, unsigned int frame_size,
+                                       TcorePendingResponseCallback resp_cb, void *resp_cb_data);
 
 /* Setup Internal CMUX */
-TelReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
-       guint max_channels, guint cmux_buf_size, TcoreHal *phy_hal,
-       CmuxSetupCbFunc channel_setup_cb, gpointer channel_setup_cb_data,
-       CmuxSetupCompleteCbFunc setup_complete_cb, gpointer setup_complete_cb_data);
+TReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
+       int max_channels, unsigned int cmux_buf_size, TcoreHal *phy_hal,
+       cmux_setup_cb_func channel_setup_cb, gpointer channel_setup_user_data,
+       cmux_setup_complete_cb_func setup_complete_cb, gpointer setup_complete_user_data);
 
 /* Close CMUX */
 void tcore_cmux_close(TcoreHal *phy_hal,
-       CmuxChannelCloseCbFunc channel_close_cb, gpointer channel_close_cb_data);
+       cmux_channel_close_cb_func channel_close_cb, gpointer channel_close_user_data);
 
 /* HAL Receive for Internal CMUX */
 void tcore_cmux_rcv_from_hal(TcoreHal *hal, unsigned char *data, size_t length);
index b196b21..081d0f8 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __PLUGIN_H__
-#define __PLUGIN_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef __TCORE_PLUGIN_H__
+#define __TCORE_PLUGIN_H__
 
-typedef void (*TcoreResponseCallback)(gint result, const void *response, void *user_data);
+__BEGIN_DECLS
 
 enum tcore_plugin_priority {
        TCORE_PLUGIN_PRIORITY_HIGH = -100,
@@ -33,7 +30,7 @@ enum tcore_plugin_priority {
 };
 
 struct tcore_plugin_define_desc {
-       gchar *name;
+       const gchar *name;
        enum tcore_plugin_priority priority;
        int version;
        gboolean (*load)();
@@ -42,53 +39,36 @@ struct tcore_plugin_define_desc {
 };
 
 
-TcorePlugin *tcore_plugin_new(Server *server,
-               const struct tcore_plugin_define_desc *desc,
-               const gchar *filename, void *handle);
-void tcore_plugin_free(TcorePlugin *plugin);
+TcorePlugintcore_plugin_new(Server *server,
+                 const struct tcore_plugin_define_desc *desc,
+                 const char *filename, void *handle);
+void         tcore_plugin_free(TcorePlugin *plugin);
 
-const struct tcore_plugin_define_desc *tcore_plugin_get_description(TcorePlugin *plugin);
+const struct tcore_plugin_define_desc*
+             tcore_plugin_get_description(TcorePlugin *plugin);
 
-gchar *tcore_plugin_get_filename(TcorePlugin *plugin);
-const gchar *tcore_plugin_ref_plugin_name(TcorePlugin *plugin);
-Server *tcore_plugin_ref_server(TcorePlugin *plugin);
+char*        tcore_plugin_get_filename(TcorePlugin *plugin);
+const char*        tcore_plugin_ref_plugin_name(TcorePlugin *plugin);
+Server*      tcore_plugin_ref_server(TcorePlugin *plugin);
 
-TelReturn tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data);
-void *tcore_plugin_ref_user_data(TcorePlugin *plugin);
+TReturn      tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data);
+void*        tcore_plugin_ref_user_data(TcorePlugin *plugin);
 
-TelReturn tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co);
-TelReturn tcore_plugin_remove_core_object(TcorePlugin *plugin, CoreObject *co);
+TReturn      tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co);
+TReturn      tcore_plugin_remove_core_object(TcorePlugin *plugin, CoreObject *co);
 
-GSList *tcore_plugin_ref_core_objects(TcorePlugin *plugin);
 CoreObject *tcore_plugin_ref_core_object(TcorePlugin *plugin, unsigned int type);
-GSList *tcore_plugin_get_core_objects_bytype(TcorePlugin *plugin,
-               unsigned int type);
+GSList*      tcore_plugin_get_core_objects(TcorePlugin *plugin);
+GSList*      tcore_plugin_get_core_objects_bytype(TcorePlugin *plugin,
+                 unsigned int type);
 
-TelReturn tcore_plugin_core_object_event_emit(TcorePlugin *plugin,
-               const gchar *event, const void *event_info);
+TReturn      tcore_plugin_core_object_event_emit(TcorePlugin *plugin,
+                 const char *event, const void *event_info);
 
-TelReturn tcore_plugin_link_property(TcorePlugin *plugin, const gchar *key,
-               void *data);
-void *tcore_plugin_ref_property(TcorePlugin *plugin, const gchar *key);
+TReturn      tcore_plugin_link_property(TcorePlugin *plugin, const char *key,
+                 void *data);
+void*        tcore_plugin_ref_property(TcorePlugin *plugin, const char *key);
 
-TelReturn tcore_plugin_add_request_hook(TcorePlugin *plugin,
-       TcoreCommand command, TcoreRequestHook func, void *user_data);
-void tcore_plugin_remove_request_hook(TcorePlugin *plugin,
-       TcoreCommand command, TcoreRequestHook func);
-TelReturn tcore_plugin_add_notification_hook(TcorePlugin *plugin,
-       TcoreNotification command, TcoreNotificationHook func, void *user_data);
-void tcore_plugin_remove_notification_hook(TcorePlugin *plugin,
-       TcoreNotification command, TcoreNotificationHook func);
+__END_DECLS
 
-TelReturn tcore_plugin_dispatch_request(TcorePlugin *plugin,
-               gboolean exec_hooks, TcoreCommand command,
-               const void *request, guint request_len,
-               TcoreResponseCallback cb, const void *user_data);
-TelReturn tcore_plugin_send_notification(TcorePlugin *plugin,
-       TcoreNotification command, guint data_len, void *data);
-
-#ifdef __cplusplus
-}
 #endif
-
-#endif /* __PLUGIN_H__ */
index 970166c..856afd9 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __QUEUE_H__
-#define __QUEUE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef __TCORE_QUEUE_H__
+#define __TCORE_QUEUE_H__
 
-typedef void(*TcorePendingSendCallback)(TcorePending *p,
-       TelReturn send_status, void *user_data);
+__BEGIN_DECLS
 
+typedef void(*TcorePendingSendCallback)(TcorePending *p, gboolean result,
+    void *user_data);
 typedef void(*TcorePendingTimeoutCallback)(TcorePending *p, void *user_data);
+typedef void(*TcorePendingResponseCallback)(TcorePending *p, int data_len,
+    const void *data, void *user_data);
 
-typedef void(*TcorePendingResponseCallback)(TcorePending *p,
-       guint data_len, const void *data, void *user_data);
-
-typedef enum {
+enum tcore_pending_priority {
        TCORE_PENDING_PRIORITY_IMMEDIATELY = 0,
        TCORE_PENDING_PRIORITY_HIGH = 100,
        TCORE_PENDING_PRIORITY_DEFAULT = 200,
        TCORE_PENDING_PRIORITY_LOW = 300,
-} TcorePendingPriority;
-
-TcorePending *tcore_pending_new(CoreObject *co, guint id);
-void tcore_pending_free(TcorePending *pending);
-
-guint  tcore_pending_get_id(TcorePending *pending);
-
-TelReturn tcore_pending_set_auto_free_status_after_sent(TcorePending *pending,
-       gboolean flag);
-gboolean tcore_pending_get_auto_free_status_after_sent(TcorePending *pending);
-
-TelReturn tcore_pending_set_abortable(TcorePending *pending,
-       gboolean abortable);
-gboolean tcore_pending_get_abortable(TcorePending *pending);
-
-TelReturn tcore_pending_set_request_data(TcorePending *pending,
-       guint data_len, void *data);
-void *tcore_pending_ref_request_data(TcorePending *pending, guint *data_len);
-
-TelReturn tcore_pending_set_timeout(TcorePending *pending, guint timeout);
-
-TcorePlugin *tcore_pending_ref_plugin(TcorePending *pending);
-CoreObject *tcore_pending_ref_core_object(TcorePending *pending);
-
-TelReturn tcore_pending_set_priority(TcorePending *pending,
-       TcorePendingPriority priority);
-TelReturn tcore_pending_get_priority(TcorePending *pending,
-       TcorePendingPriority *priority);
-
-TelReturn tcore_pending_get_send_status(TcorePending *pending, gboolean *status);
+};
+
+TcorePending* tcore_pending_new(CoreObject *co, unsigned int id);
+void          tcore_pending_free(TcorePending *pending);
+
+unsigned int  tcore_pending_get_id(TcorePending *pending);
+TReturn       tcore_pending_set_auto_free_status_after_sent(TcorePending *pending,
+                  gboolean flag);
+gboolean      tcore_pending_get_auto_free_status_after_sent(TcorePending *pending);
+TReturn       tcore_pending_set_request_data(TcorePending *pending,
+                  unsigned int data_len, void *data);
+void*         tcore_pending_ref_request_data(TcorePending *pending,
+                  unsigned int *data_len);
+TReturn       tcore_pending_set_timeout(TcorePending *pending,
+                  unsigned int timeout);
+unsigned int  tcore_pending_get_timeout(TcorePending *pending);
+TcorePlugin*  tcore_pending_ref_plugin(TcorePending *pending);
+CoreObject*   tcore_pending_ref_core_object(TcorePending *pending);
+TReturn       tcore_pending_set_priority(TcorePending *pending,
+                  enum tcore_pending_priority priority);
+TReturn       tcore_pending_get_priority(TcorePending *pending,
+                  enum tcore_pending_priority *result_priority);
+TReturn       tcore_pending_get_send_status(TcorePending *pending,
+                  gboolean *result_status);
+TReturn       tcore_pending_link_user_request(TcorePending *pending,
+                  UserRequest *ur);
+UserRequest*  tcore_pending_ref_user_request(TcorePending *pending);
+
+TReturn tcore_pending_start_timer(TcorePending *pending);
+
+TReturn       tcore_pending_set_send_callback(TcorePending *pending,
+                  TcorePendingSendCallback func, void *user_data);
+TReturn       tcore_pending_emit_send_callback(TcorePending *pending, int bytes);
+
+TReturn       tcore_pending_set_timeout_callback(TcorePending *pending,
+                  TcorePendingTimeoutCallback func, void *user_data);
+TReturn       tcore_pending_emit_timeout_callback(TcorePending *pending);
+
+TReturn       tcore_pending_set_response_callback(TcorePending *pending,
+                  TcorePendingResponseCallback func, void *user_data);
+TReturn       tcore_pending_emit_response_callback(TcorePending *pending,
+                  int data_len, const void *data);
+
+
+TcoreQueue*   tcore_queue_new(TcoreHal *hal);
+void          tcore_queue_free(TcoreQueue *qeueu);
+
+TReturn       tcore_queue_push(TcoreQueue *queue, TcorePending *pending);
+TcorePending* tcore_queue_pop(TcoreQueue *queue);
+TcorePending* tcore_queue_pop_by_pending(TcoreQueue *queue, TcorePending *pending);
+TcorePending* tcore_queue_pop_timeout_pending(TcoreQueue *queue);
+TcorePending* tcore_queue_ref_head(TcoreQueue *queue);
+TcorePending* tcore_queue_ref_tail(TcoreQueue *queue);
+TcorePending* tcore_queue_pop_by_id(TcoreQueue *queue, unsigned int id);
+TcorePending* tcore_queue_ref_pending_by_id(TcoreQueue *queue, unsigned int id);
+TcorePending* tcore_queue_ref_next_pending(TcoreQueue *queue);
+unsigned int  tcore_queue_get_length(TcoreQueue *queue);
+unsigned int  tcore_queue_get_normal_length(TcoreQueue *queue);
+TcoreHal*     tcore_queue_ref_hal(TcoreQueue *queue);
+TReturn       tcore_queue_cancel_pending_by_command(TcoreQueue *queue, enum tcore_request_command command);
+TcorePending* tcore_queue_search_by_command(TcoreQueue *queue, enum tcore_request_command command, gboolean flag_sent);
+
+__END_DECLS
 
-TelReturn tcore_pending_link_request(TcorePending *pending, void *request);
-void *tcore_pending_ref_request(TcorePending *pending);
-
-TelReturn tcore_pending_set_send_callback(TcorePending *pending,
-       TcorePendingSendCallback func, void *user_data);
-TelReturn tcore_pending_emit_send_callback(TcorePending *pending,
-       TelReturn send_status);
-
-TelReturn tcore_pending_set_timeout_callback(TcorePending *pending,
-       TcorePendingTimeoutCallback func, void *user_data);
-TelReturn tcore_pending_emit_timeout_callback(TcorePending *pending);
-
-TelReturn tcore_pending_set_response_callback(TcorePending *pending,
-       TcorePendingResponseCallback func, void *user_data);
-TelReturn tcore_pending_emit_response_callback(TcorePending *pending,
-       guint data_len, const void *data);
-
-
-TcoreQueue *tcore_queue_new(TcoreHal *hal);
-void tcore_queue_free(TcoreQueue *queue);
-
-TelReturn tcore_queue_push(TcoreQueue *queue, TcorePending *pending);
-TcorePending *tcore_queue_pop(TcoreQueue *queue);
-TcorePending *tcore_queue_pop_by_id(TcoreQueue *queue, guint id);
-TcorePending *tcore_queue_pop_by_pending(TcoreQueue *queue,
-       TcorePending *pending);
-TcorePending *tcore_queue_pop_abortable_pending(TcoreQueue *queue);
-TcorePending *tcore_queue_pop_timeout_pending(TcoreQueue *queue);
-
-TcorePending *tcore_queue_ref_head(TcoreQueue *queue);
-TcorePending *tcore_queue_ref_tail(TcoreQueue *queue);
-TcorePending *tcore_queue_ref_pending_by_id(TcoreQueue *queue, guint id);
-TcorePending *tcore_queue_ref_next_pending(TcoreQueue *queue);
-
-guint tcore_queue_get_length(TcoreQueue *queue);
-
-TcoreHal *tcore_queue_ref_hal(TcoreQueue *queue);
-TelReturn tcore_queue_cancel_pending_by_command(TcoreQueue *queue,
-       TcoreCommand command);
-
-TcorePending *tcore_queue_search_by_command(TcoreQueue *queue,
-       TcoreCommand command, gboolean flag_sent);
-
-#ifdef __cplusplus
-}
 #endif
-
-#endif /* __QUEUE_H__ */
index ed50b7c..63e629f 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __SERVER_H__
-#define __SERVER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef __TCORE_SERVER_H__
+#define __TCORE_SERVER_H__
 
-typedef TcoreHookReturn (*TcoreServerNotificationHook)(Server *s,
-               TcoreServerNotification command, guint data_len, void *data, void *user_data);
+__BEGIN_DECLS
 
-Server *tcore_server_new();
-void tcore_server_free(Server *s);
+typedef enum tcore_hook_return (*TcoreServerRequestHook)(Server *s,
+    UserRequest *ur, void *user_data);
+typedef enum tcore_hook_return (*TcoreServerNotificationHook)(Server *s,
+    CoreObject *source, enum tcore_notification_command command,
+    unsigned int data_len, void *data, void *user_data);
 
-TelReturn tcore_server_run(Server *s);
-TelReturn tcore_server_exit(Server *s);
+Server*       tcore_server_new();
+void          tcore_server_free(Server *s);
 
-TelReturn tcore_server_add_plugin(Server *s, TcorePlugin *plugin);
-TelReturn tcore_server_remove_plugin(Server *s, TcorePlugin *plugin);
-GSList *tcore_server_ref_plugins(Server *s);
-TcorePlugin *tcore_server_find_plugin(Server *s, const gchar *name);
+TReturn       tcore_server_run(Server *s);
+TReturn       tcore_server_exit(Server *s);
 
-TelReturn tcore_server_add_communicator(Server *s, Communicator *comm);
-TelReturn tcore_server_remove_communicator(Server *s, Communicator *comm);
-GSList *tcore_server_ref_communicators(Server *s);
-Communicator *tcore_server_find_communicator(Server *s, const gchar *name);
+TReturn       tcore_server_add_plugin(Server *s, TcorePlugin *plugin);
+GSList*       tcore_server_ref_plugins(Server *s);
+TcorePlugin*  tcore_server_find_plugin(Server *s, const char *name);
 
-TelReturn tcore_server_add_storage(Server *s, TcoreStorage *strg);
-TelReturn tcore_server_remove_storage(Server *s, TcoreStorage *strg);
-GSList *tcore_server_ref_storages(Server *s);
-TcoreStorage * tcore_server_find_storage(Server *s, const gchar *name);
+TReturn       tcore_server_add_communicator(Server *s, Communicator *comm);
+TReturn       tcore_server_remove_communicator(Server *s, Communicator *comm);
+GSList*       tcore_server_ref_communicators(Server *s);
+Communicator* tcore_server_find_communicator(Server *s, const char *name);
 
-TelReturn tcore_server_add_template_object(Server *s, CoreObject *template_co);
-TelReturn tcore_server_remove_template_object(Server *s, CoreObject *template_co);
-GSList *tcore_server_ref_template_object(Server *s);
-CoreObject *tcore_server_find_template_object(Server *s, guint type);
+TReturn       tcore_server_add_storage(Server *s, Storage *strg);
+GSList*       tcore_server_ref_storages(Server *s);
+Storage*      tcore_server_find_storage(Server *s, const char *name);
 
-TelReturn tcore_server_link_udev(Server *s, TcoreUdev *udev);
-TcoreUdev *tcore_server_ref_udev(Server *s);
+TReturn       tcore_server_add_hal(Server *s, TcoreHal *hal);
+TReturn       tcore_server_remove_hal(Server *s, TcoreHal *hal);
+GSList*       tcore_server_ref_hals(Server *s);
+TcoreHal*     tcore_server_find_hal(Server *s, const char *name);
 
-TelReturn tcore_server_send_server_notification(Server *s,
-       TcoreServerNotification command, guint data_len, void *data);
-TelReturn tcore_server_send_notification(Server *s,
-       TcorePlugin *source, TcoreNotification command, guint data_len, void *data);
+CoreObject *tcore_server_find_template_object(Server *s, unsigned int type);
 
-TelReturn tcore_server_add_notification_hook(Server *s,
-       TcoreServerNotification command, TcoreServerNotificationHook func, void *user_data);
-TelReturn tcore_server_remove_notification_hook(Server *s,
-       TcoreServerNotificationHook func);
+TReturn       tcore_server_link_udev(Server *s, TcoreUdev *udev);
+TcoreUdev*    tcore_server_ref_udev(Server *s);
 
-gboolean tcore_server_register_modem(Server *s, TcorePlugin *modem_iface_plugin);
-void tcore_server_unregister_modem(Server *s, TcorePlugin *modem_iface_plugin);
-gboolean tcore_server_update_modem_plugin(TcorePlugin *modem_iface_plugin,
-       TcorePlugin *modem_plugin);
+TReturn       tcore_server_dispatch_request(Server *s, UserRequest *ur);
+TReturn       tcore_server_send_notification(Server *s, CoreObject *source,
+                  enum tcore_notification_command command,
+                  unsigned int data_len, void *data);
 
-const gchar *tcore_server_get_cp_name_by_plugin(TcorePlugin *plugin);
+TReturn       tcore_server_add_request_hook(Server *s,
+                  enum tcore_request_command command,
+                  TcoreServerRequestHook func, void *user_data);
+TReturn       tcore_server_remove_request_hook(Server *s,
+                  TcoreServerRequestHook func);
+TReturn       tcore_server_add_notification_hook(Server *s,
+                  enum tcore_notification_command command,
+                  TcoreServerNotificationHook func, void *user_data);
+TReturn       tcore_server_remove_notification_hook(Server *s,
+                  TcoreServerNotificationHook func);
 
-gboolean tcore_server_add_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
-       guint co_type, TcoreHal *hal);
-void tcore_server_remove_cp_mapping_tbl(TcorePlugin *modem_iface_plugin);
-void tcore_server_remove_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
-       TcoreHal *hal);
+TcoreModem *tcore_server_register_modem(Server *s, TcorePlugin *modem_iface_plugin);
+void tcore_server_unregister_modem(Server *s, TcoreModem *modem);
+gboolean tcore_server_update_modem_plugin(TcorePlugin *modem_iface_plugin,
+                                                       TcorePlugin *modem_plugin);
+GSList *tcore_server_get_cp_name_list(Server *s);
+const char *tcore_server_get_cp_name_by_plugin(TcorePlugin *modem_plugin);
+
+gboolean tcore_server_add_cp_mapping_tbl_entry(TcoreModem *modem,
+                                       unsigned int co_type, TcoreHal *hal);
+void tcore_server_remove_cp_mapping_tbl(TcoreModem *modem);
+void tcore_server_remove_cp_mapping_tbl_entry(TcoreModem *modem,
+                                       TcoreHal *hal);
 void *tcore_server_get_cp_mapping_tbl(TcorePlugin *modem_plugin);
+void tcore_server_print_modems(Server *s);
 
-void tcore_server_print_modems(TcorePlugin *plugin);
-
-TelReturn tcore_server_load_modem_plugin(Server *s,
-       TcorePlugin *modem_if_plugin, const gchar *name);
-void tcore_server_unload_modem_plugin(Server *s,
-       TcorePlugin *modem_if_plugin);
-
+TReturn tcore_server_load_modem_plugin(Server *s,
+                                       TcoreModem *modem,
+                                       const char *name)
+;
+void tcore_server_unload_modem_plugin(Server *s, TcoreModem *modem);
 GSList *tcore_server_get_modem_plugin_list(Server *s);
+gint tcore_server_get_modems_count(Server *s);
+__END_DECLS
 
-#ifdef __cplusplus
-}
 #endif
-
-#endif /* __SERVER_H__ */
index 2fc3bd2..f62bac1 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __STORAGE_H__
-#define __STORAGE_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-typedef enum {
-       STORAGE_KEY_INT = 0x01000000,
-       STORAGE_KEY_PLMN,
-       STORAGE_KEY_LAC,
-       STORAGE_KEY_CELLID,
-       STORAGE_KEY_SVCTYPE,
-       STORAGE_KEY_SVC_CS,
-
-       STORAGE_KEY_SVC_PS,
-       STORAGE_KEY_SPN_DISP_CONDITION,
-       STORAGE_KEY_RSSI,
-       STORAGE_KEY_SIM_SLOT,
-       STORAGE_KEY_PM_STATE,
+#ifndef __TCORE_STORAGE_H__
+#define __TCORE_STORAGE_H__
+
+__BEGIN_DECLS
+
+#define STORAGE_KEY_INT                0x01000000
+#define STORAGE_KEY_BOOL       0x02000000
+#define STORAGE_KEY_STRING     0x03000000
+#define STORAGE_KEY_DOUBLE     0x04000000
+
+enum tcore_storage_key {
+       STORAGE_KEY_TELEPHONY_INT = STORAGE_KEY_INT,
+       STORAGE_KEY_TELEPHONY_PLMN,
+       STORAGE_KEY_TELEPHONY_LAC,
+       STORAGE_KEY_TELEPHONY_CELLID,
+       STORAGE_KEY_TELEPHONY_SVCTYPE,
+       STORAGE_KEY_TELEPHONY_SVC_CS,//5
+
+       STORAGE_KEY_TELEPHONY_SVC_PS,
+       STORAGE_KEY_TELEPHONY_SVC_ROAM,
+       STORAGE_KEY_TELEPHONY_ZONE_TYPE,
+
+       STORAGE_KEY_TELEPHONY_SIM_PB_INIT,
+       STORAGE_KEY_TELEPHONY_CALL_STATE,
+       STORAGE_KEY_TELEPHONY_CALL_FORWARD_STATE,
+       STORAGE_KEY_TELEPHONY_TAPI_STATE,
+       STORAGE_KEY_TELEPHONY_SPN_DISP_CONDITION,//15
+
+       STORAGE_KEY_TELEPHONY_RSSI,
+       STORAGE_KEY_TELEPHONY_LOW_BATTERY,
+       STORAGE_KEY_TELEPHONY_EVENT_SYSTEM_READY,
+       STORAGE_KEY_TELEPHONY_SIM_SLOT,
+       STORAGE_KEY_TELEPHONY_SIM_SLOT2,
+       STORAGE_KEY_TELEPHONY_SIM_SLOT_COUNT,
+       STORAGE_KEY_PM_STATE,//20
 
-       STORAGE_KEY_PACKET_SERVICE_STATE,
        STORAGE_KEY_PACKET_INDICATOR_STATE,
+       STORAGE_KEY_PACKET_SERVICE_STATE,
+       STORAGE_KEY_PACKET_SERVICE_STATE2,
+       STORAGE_KEY_MESSAGE_NETWORK_MODE,
        STORAGE_KEY_CELLULAR_STATE,
+
        STORAGE_KEY_CELLULAR_PKT_TOTAL_RCV,
+       STORAGE_KEY_CELLULAR_PKT_TOTAL_RCV2,
        STORAGE_KEY_CELLULAR_PKT_TOTAL_SNT,
+       STORAGE_KEY_CELLULAR_PKT_TOTAL_SNT2,
+       STORAGE_KEY_CELLULAR_PKT_LAST_RCV,//30
 
-       STORAGE_KEY_CELLULAR_PKT_LAST_RCV,
+       STORAGE_KEY_CELLULAR_PKT_LAST_RCV2,
        STORAGE_KEY_CELLULAR_PKT_LAST_SNT,
-       STORAGE_KEY_SIM_PB_INIT,
-       STORAGE_KEY_SVC_ROAM,
-       STORAGE_KEY_TAPI_STATE,
-
-       STORAGE_KEY_BOOL = 0x02000000,
-       STORAGE_KEY_CALL_FORWARD_STATE,
-       STORAGE_KEY_DATA_ENABLE,
-       STORAGE_KEY_READY,
-       STORAGE_KEY_SETAPPL_STATE_DATA_ROAMING,
-       STORAGE_KEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE,
-
-       STORAGE_KEY_FLIGHT_MODE,
+       STORAGE_KEY_CELLULAR_PKT_LAST_SNT2,
+       STORAGE_KEY_TELEPHONY_DUALSIM_DEFAULT_DATA_SERVICE_INT,
+       STORAGE_KEY_TELEPHONY_PREFERRED_VOICE_SUBSCRIPTION,
+       STORAGE_KEY_TELEPHONY_DUALSIM_DEFAULT_SERVICE_INT,
+       STORAGE_KEY_WIFI_STATE_INT,
+
+       STORAGE_KEY_POWER_SAVING_MODE,
+       STORAGE_KEY_WECONN_ALL_CONNECTED,
+       STORAGE_KEY_SAP_CONNECTION_TYPE,
        STORAGE_KEY_IDLE_SCREEN_LAUNCHED,
 
-       STORAGE_KEY_STRING = 0x03000000,
-       STORAGE_KEY_NWNAME,
-       STORAGE_KEY_SPN_NAME,
+       STORAGE_KEY_TELEPHONY_BOOL = STORAGE_KEY_BOOL,
+       STORAGE_KEY_3G_ENABLE,
+       STORAGE_KEY_TELEPHONY_READY,
+       STORAGE_KEY_SETAPPL_STATE_DATA_ROAMING_BOOL,
+       STORAGE_KEY_SETAPPL_STATE_DATA_ROAMING_APP_STATUS,
+       STORAGE_KEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL,
+       STORAGE_KEY_SETAPPL_NETWORK_RESTRICT_MODE,
+       STORAGE_KEY_SETAPPL_MOBILE_DATA_POPUP_DONE_BOOL,
+       STORAGE_KEY_MSG_SERVER_READY_BOOL,
+       STORAGE_KEY_FLIGHT_MODE_BOOL,
+       STORAGE_KEY_TESTMODE_FAST_DORMANCY_BOOL,
+
+       STORAGE_KEY_TELEPHONY_STRING = STORAGE_KEY_STRING,
+       STORAGE_KEY_TELEPHONY_NWNAME,
+       STORAGE_KEY_TELEPHONY_SPN_NAME,
+       STORAGE_KEY_TELEPHONY_IMEI,
+       STORAGE_KEY_TELEPHONY_SWVERSION,
+       STORAGE_KEY_TELEPHONY_HWVERSION,
+       STORAGE_KEY_TELEPHONY_CALDATE,
+       STORAGE_KEY_TELEPHONY_IMEI_FACTORY_REBOOT,
+       STORAGE_KEY_TELEPHONY_SIM_FACTORY_MODE,
+       STORAGE_KEY_TELEPHONY_PRODUCTCODE,
        STORAGE_KEY_LANGUAGE_SET,
-} TcoreStorageKey;
-
-typedef void (*TcoreStorageKeyCallback) (TcoreStorageKey key,
-       void *value, void *user_data);
-typedef void (*TcoreStorageDispatchCallback) (TcoreStorage *strg,
-       TcoreStorageKey key, void *value);
-
-typedef struct {
-       void *(*create_handle)(TcoreStorage *strg, const char *path);
-       gboolean (*remove_handle)(TcoreStorage *strg, void *handle);
-
-       gboolean (*set_int)(TcoreStorage *strg,
-               TcoreStorageKey key, int value);
-       gboolean (*set_string)(TcoreStorage *strg,
-               TcoreStorageKey key, const char *value);
-       gboolean (*set_bool)(TcoreStorage *strg,
-               TcoreStorageKey key, gboolean value);
-
-       int (*get_int)(TcoreStorage *strg, TcoreStorageKey key);
-       char *(*get_string)(TcoreStorage *strg, TcoreStorageKey key);
-       gboolean (*get_bool)(TcoreStorage *strg, TcoreStorageKey key);
-
-       gboolean (*set_key_callback)(TcoreStorage *strg,
-               TcoreStorageKey key, TcoreStorageDispatchCallback cb);
-       gboolean (*remove_key_callback)(TcoreStorage *strg, TcoreStorageKey key);
-
-       gboolean (*update_query_database)(TcoreStorage *strg,
-               void *handle, const char *query, GHashTable *in_param);
-       gboolean (*read_query_database)(TcoreStorage *strg,
-               void *handle, const char *query, GHashTable *in_param,
-               GHashTable *out_param, int out_param_cnt);
-       gboolean (*insert_query_database)(TcoreStorage *strg,
-               void *handle, const char *query, GHashTable *in_param);
-       gboolean (*remove_query_database)(TcoreStorage *strg,
-               void *handle, const char *query, GHashTable *in_param);
-}TcoreStorageOperations;
-
-TcoreStorage *tcore_storage_new(TcorePlugin *plugin,
-       const char *name, TcoreStorageOperations *ops);
-void tcore_storage_free(TcoreStorage *strg);
-
-const char *tcore_storage_ref_name(TcoreStorage *strg);
-
-void *tcore_storage_create_handle(TcoreStorage *strg, const char *path);
-gboolean tcore_storage_remove_handle(TcoreStorage *strg, void *handle);
-
-/* 'vconf' TcoreStorage */
-gboolean tcore_storage_set_int(TcoreStorage *strg,
-       TcoreStorageKey key, int value);
-int  tcore_storage_get_int(TcoreStorage *strg, TcoreStorageKey key);
-
-gboolean tcore_storage_set_string(TcoreStorage *strg,
-       TcoreStorageKey key, const char *value);
-char *tcore_storage_get_string(TcoreStorage *strg, TcoreStorageKey key);
-
-gboolean tcore_storage_set_bool(TcoreStorage *strg,
-       TcoreStorageKey key, gboolean value);
-gboolean tcore_storage_get_bool(TcoreStorage *strg, TcoreStorageKey key);
-
-gboolean tcore_storage_set_key_callback(TcoreStorage *strg,
-       TcoreStorageKey key, TcoreStorageKeyCallback cb, void *user_data);
-gboolean tcore_storage_remove_key_callback(TcoreStorage *strg,
-       TcoreStorageKey key, TcoreStorageKeyCallback cb);
-
-/* 'database' TcoreStorage */
-gboolean tcore_storage_update_query_database(TcoreStorage *strg,
-       void *handle, const char *query, GHashTable *in_param);
-gboolean tcore_storage_read_query_database(TcoreStorage *strg,
-       void *handle, const char *query, GHashTable *in_param,
-       GHashTable *out_param, int out_param_cnt);
-gboolean tcore_storage_insert_query_database(TcoreStorage *strg,
-       void *handle, const char *query, GHashTable *in_param);
-gboolean tcore_storage_remove_query_database(TcoreStorage *strg,
-       void *handle, const char *query, GHashTable *in_param);
-
-#ifdef __cplusplus
-}
-#endif
+       STORAGE_KEY_TESTMODE_FAST_DORMANCY,
+       STORAGE_KEY_TESTMODE_FAST_DORMANCY2,
+       STORAGE_KEY_IDLE_SCREEN_LAUNCHED_BOOL
+};
+
+enum storage_value {
+       STORAGE_VALUE_UNKNOWN = 0,
+       STORAGE_VALUE_OFF = 0,
+       STORAGE_VALUE_ON  = 1,
+       STORAGE_VALUE_STATE_0 = 0,
+       STORAGE_VALUE_STATE_1 = 1,
+       STORAGE_VALUE_STATE_2 = 2,
+       STORAGE_VALUE_STATE_3 = 3,
+       STORAGE_VALUE_STATE_4 = 4,
+       STORAGE_VALUE_STATE_5 = 5,
+       STORAGE_VALUE_STATE_6 = 6,
+       STORAGE_VALUE_STATE_7 = 7,
+       STORAGE_VALUE_STATE_8 = 8,
+       STORAGE_VALUE_STATE_9 = 9,
+};
+
+typedef void (*TcoreStorageKeyCallback) (enum tcore_storage_key key,
+    void *value, void *user_data);
+typedef void (*TcoreStorageDispatchCallback) (Storage *strg,
+    enum tcore_storage_key key, void *value);
+
+struct storage_operations {
+       void* (*create_handle)(Storage *strg, const char *path);
+       gboolean (*remove_handle)(Storage *strg, void *handle);
+
+       gboolean (*set_int)(Storage *strg, enum tcore_storage_key key, int value);
+       gboolean (*set_string)(Storage *strg, enum tcore_storage_key key, const char *value);
+       gboolean (*set_bool)(Storage *strg, enum tcore_storage_key key, gboolean value);
+       int (*get_int)(Storage *strg, enum tcore_storage_key key);
+       char* (*get_string)(Storage *strg, enum tcore_storage_key key);
+       gboolean (*get_bool)(Storage *strg, enum tcore_storage_key key);
+       gboolean (*set_key_callback)(Storage *strg, enum tcore_storage_key key,
+                       TcoreStorageDispatchCallback cb);
+       gboolean (*remove_key_callback)(Storage *strg, enum tcore_storage_key key);
+
+       gboolean (*update_query_database)(Storage *strg, void *handle,
+                       const char *query, GHashTable *in_param);
+       gboolean (*read_query_database)(Storage *strg, void *handle,
+                       const char *query, GHashTable *in_param,
+                       GHashTable *out_param, int out_param_cnt);
+       gboolean (*insert_query_database)(Storage *strg, void *handle,
+                       const char *query, GHashTable *in_param);
+       gboolean (*remove_query_database)(Storage *strg, void *handle,
+                       const char *query, GHashTable *in_param);
+};
+
+Storage*     tcore_storage_new(TcorePlugin *plugin, const char *name,
+                 struct storage_operations *ops);
+void         tcore_storage_free(Storage *strg);
+const char*  tcore_storage_ref_name(Storage *strg);
+
+void*        tcore_storage_create_handle(Storage *strg, const char *path);
+gboolean     tcore_storage_remove_handle(Storage *strg, void *handle);
+
+//storage vconf
+gboolean     tcore_storage_set_int(Storage *strg, enum tcore_storage_key key,
+                 int value);
+int          tcore_storage_get_int(Storage *strg, enum tcore_storage_key key);
+
+gboolean     tcore_storage_set_string(Storage *strg, enum tcore_storage_key key,
+                 const char *value);
+char*        tcore_storage_get_string(Storage *strg, enum tcore_storage_key key);
+
+gboolean     tcore_storage_set_bool(Storage *strg, enum tcore_storage_key key,
+                 gboolean value);
+gboolean     tcore_storage_get_bool(Storage *strg, enum tcore_storage_key key);
+
+gboolean     tcore_storage_set_key_callback(Storage *strg,
+                 enum tcore_storage_key key, TcoreStorageKeyCallback cb,
+                 void *user_data);
+gboolean     tcore_storage_remove_key_callback(Storage *strg,
+                 enum tcore_storage_key key, TcoreStorageKeyCallback cb);
+
+//storage database
+gboolean     tcore_storage_update_query_database(Storage *strg, void *handle,
+                 const char *query, GHashTable *in_param);
+gboolean     tcore_storage_read_query_database(Storage *strg, void *handle,
+                 const char *query, GHashTable *in_param, GHashTable *out_param,
+                 int out_param_cnt);
+gboolean     tcore_storage_insert_query_database(Storage *strg, void *handle,
+                 const char *query, GHashTable *in_param);
+gboolean     tcore_storage_remove_query_database(Storage *strg, void *handle,
+                 const char *query, GHashTable *in_param);
+
+__END_DECLS
 
-#endif /* __STORAGE_H__ */
+#endif
index da8e5c1..02ffb22 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #ifndef __TCORE_H__
 #define __TCORE_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <sys/types.h>
 #include <stdint.h>
 
 #include <log.h>
-#include <string.h>
 
-#include "type/common.h"
-#include "type/command.h"
-#include "type/notification.h"
+#include <type/common.h>
 
-#include <tel_return.h>
-#include <tel_network.h>
-#include <tel_modem.h>
-#include <tel_sim.h>
-//#include <tel_sat.h>
-#include <tel_sms.h>
-#include <tel_call.h>
-#include <tel_ss.h>
-#include <tel_sap.h>
-#include <tel_phonebook.h>
-#include <tel_gps.h>
+#include <type/request.h>
+#include <type/response.h>
+#include <type/notification.h>
 
+#include <type/ps.h>
+#include <type/network.h>
+#include <type/modem.h>
+#include <type/sim.h>
+#include <type/sat.h>
+#include <type/sms.h>
+#include <type/call.h>
+#include <type/ss.h>
+#include <type/sap.h>
+#include <type/phonebook.h>
+#include <type/gps.h>
 #include <util.h>
 
 typedef struct tcore_object_type CoreObject;
@@ -55,42 +52,16 @@ typedef struct tcore_modem_type TcoreModem;
 typedef struct tcore_queue_type TcoreQueue;
 typedef struct tcore_pending_type TcorePending;
 typedef struct tcore_communicator_type Communicator;
+typedef struct tcore_user_request_type UserRequest;
 typedef struct tcore_server_type Server;
-typedef struct tcore_storage_type TcoreStorage;
+typedef struct tcore_storage_type Storage;
 typedef struct tcore_at_type TcoreAT;
 typedef struct tcore_udev_type TcoreUdev;
 
-typedef enum {
-       TCORE_HOOK_RETURN_STOP_PROPAGATION = FALSE,
-       TCORE_HOOK_RETURN_CONTINUE = TRUE
-} TcoreHookReturn;
-
-/*
- *Function pointers
- */
-/* Response callbacks */
-typedef void (*TcorePluginResponseCallback)(TcorePlugin *plugin,
-       gint result, const void *response, void *user_data);
-
-typedef void (*TcoreObjectResponseCallback)(CoreObject *co,
-       gint result, const void *response, void *user_data);
-
-/* Dispatcher */
-typedef TelReturn (*TcoreObjectDispatcher)(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data);
+enum tcore_hook_return {
+       TCORE_HOOK_RETURN_STOP_PROPAGATION = 0,
+       TCORE_HOOK_RETURN_STOP_PROPAGATION_FAIL,
+       TCORE_HOOK_RETURN_CONTINUE
+};
 
-/* Hooks */
-typedef TcoreHookReturn (*TcoreRequestHook)(CoreObject *co,
-       TcoreCommand command, const void *request, const void *user_data,
-       TcoreObjectResponseCallback cb, const void *cb_data);
-typedef TcoreHookReturn (*TcoreResponseHook)(CoreObject *co,
-       gint result, TcoreCommand command, const void *response, const void *user_data);
-typedef TcoreHookReturn (*TcoreNotificationHook)(TcorePlugin *source,
-       TcoreNotification command, guint data_len, void *data, void *user_data);
-
-#ifdef __cplusplus
-}
 #endif
-
-#endif /* __TCORE_H__ */
diff --git a/include/type/call.h b/include/type/call.h
new file mode 100644 (file)
index 0000000..e4d96b8
--- /dev/null
@@ -0,0 +1,927 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_CALL_H__
+#define __TYPE_CALL_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+
+enum telephony_call_error {
+       CALL_ERROR_NONE,                                        /**< Success  */
+       CALL_ERROR_ACCESSDISCARD,                       /**< Access discarded  */
+       CALL_ERROR_BARR_BYOPERATOR,                     /**< Barred by operator */
+       CALL_ERROR_BEARERMODE_NOTIMPL,          /**< Bearer mode not implemented */
+       CALL_ERROR_BEARERMODE_RESTRICTED,       /**< Bearer mode restricted */
+       CALL_ERROR_BEARERMODE_UNAUTH,           /**< Bearer mode un authorized */
+       CALL_ERROR_BEARERMODE_UNAVAIL,          /**< Bearer mode not available */
+       CALL_ERROR_BUSY,                                        /**< (Network/Server) busy */
+       CALL_ERROR_CALLMETER_EXPIRED,           /**< Call meter expired */
+       CALL_ERROR_CALLNO_ERROR,                        /**< Call number error */
+       CALL_ERROR_CKTUNAVAIL,                          /**< Circuit channel unavailable */                     //10
+       CALL_ERROR_CONGESTION,                          /**< Congestion happened */
+       CALL_ERROR_NO_CIRCUIT_AVAIL,            /**< Circuit  not available */
+       CALL_ERROR_DESTIN_INCOMPAT,                     /**< Destination incompatibility */
+       CALL_ERROR_DTMF_NOSPEECH,                       /**< No speech in DTMF */
+       CALL_ERROR_DTMF_REJECTED,                       /**< DTMF rejected */
+       CALL_ERROR_FACILITY_NOTIMPL,            /**< Facility not implemented */
+       CALL_ERROR_FACILITY_NOTSUBSCRIBED,      /**< Facility not subscribed */
+       CALL_ERROR_INCOMINGCUGCALLS_BARRED, /**< Incoming CUG Calls barred */
+       CALL_ERROR_INVALNUM,                            /**< Invalid number */
+       CALL_ERROR_MPTY_ERROR,                          /**< Multiparty error */                                                //20
+       CALL_ERROR_NOANSWER,                            /**< No answer  */
+       CALL_ERROR_NONCUGMEMBER,                        /**< Non CUG member */
+       CALL_ERROR_NUMBERCHANGED,                       /**< Number changed */
+       CALL_ERROR_NUMBER_ERROR,                        /**< Number error */
+       CALL_ERROR_NWFAILURE,                           /**< Network failure */
+       CALL_ERROR_OPERATIONUNAVAIL,            /**< Operation not available */
+       CALL_ERROR_OUTOFORDER,                          /**< Out of order */
+       CALL_ERROR_PROTOCOL_ERROR,                      /**< Protocol error */
+       CALL_ERROR_QOSUNAVAIL,                          /**< QOS unavailable */
+       CALL_ERROR_REJECT,                                      /**< Rejected */                                                                //30
+       CALL_ERROR_REJ_FAIL,                            /**< Rejection failed */
+       CALL_ERROR_REJ_SRVC_NOT_AVL,            /**< Rejection service not available  */
+       CALL_ERROR_REJ_SAT_CALL_CTRL,           /**< Rejection by SAT call control  */
+       CALL_ERROR_REMOTE_CKTUNAVAIL,           /**< Remote Circuit channel unavailable */
+       CALL_ERROR_RESOURCEUNAVAIL,                     /**< Resource not available */
+       CALL_ERROR_SERVICEID_ERROR,                     /**< Service id error */
+       CALL_ERROR_SERVICE_NOTIMPL,                     /**< Service not implemented */
+       CALL_ERROR_SERVICE_UNAVAIL,                     /**< Service not available */
+       CALL_ERROR_MODIFY_SAME_BEARER,          /**< Modify same bearer */
+       CALL_ERROR_MODIFY_NOT_PERMITTED,        /**< Modification not permitted */
+       CALL_ERROR_HOLD_FAIL,                           /**< Call hold fail */                                                  //40
+       CALL_ERROR_TEMPFAILURE,                         /**< Temporary failure */
+       CALL_ERROR_WRONGNUM,                            /**< Wrong number */
+       CALL_ERROR_NORMAL_UNSPECIFIED,          /**< Normal but unspecified */
+       CALL_ERROR_SSERRINVALIDTIVALUE,         /**< SS invalid Transaction ID Value */
+       CALL_ERROR_SSERRINVALIDTI,                      /**< SS Invalid transaction ID */
+       CALL_ERROR_SSINCOMPATIBLESTATE,         /**< SS incompatible state */
+       CALL_ERROR_SSERRSYNTAXERROR,            /**< SS syntax error */
+       CALL_ERROR_SSPROTOCOLERROR,                     /**< Protocol error */
+       CALL_ERROR_SSNEGATIVEPASSWORDCHECK, /**< Negative password check */
+       CALL_ERROR_SSSENTASPHASE1,                      /**< SS sent as phase1 message */                               //50
+       CALL_ERROR_SSERROR,                                     /**< Supplementary service error */
+       CALL_ERROR_SS_USSD_BUSY,                        /**< Second USSD request will be rejected when already USSD transaction is ongoing. */
+       CALL_ERROR_IDLE,                                        /**< Idle */
+       CALL_ERROR_NETWORK_SPECIFIC,            /**< Network specific error */
+       CALL_ERROR_FADE,                                        /**< voice call was dropped e.g. because of a loss of signal */
+       CALL_ERROR_UNKNOWN,                                     /**< unknown no details available */
+       CALL_ERROR_INCOM_CALL,                          /**< terminated by incoming call */
+       CALL_ERROR_ALERT_STOP,                          /**< terminated by alert stop */
+       CALL_ERROR_INTERCEPT,                           /**< voice call was dropped by interception */
+       CALL_ERROR_REORDER,                                     /**< voice call was dropped by reordering */    //60
+       CALL_ERROR_CLIENT_END,                          /**< client ended the call */
+       CALL_ERROR_ACCESS_CLASS_BLOCKED,        /**< access class blocked */
+       CALL_ERROR_MEMCAPEXCEEDED,                      /**< Memory capacity exceeded */
+       CALL_ERROR_TYPENOTSUPPORTED,            /**< Type not supported */
+       CALL_ERROR_REPLACENOTSUPPORTED,         /**< Replace not supported */
+       CALL_ERROR_PROTOCOLID_ERROR,            /**< Protocol id error */
+       CALL_ERROR_CLASSNOTSUPPORTED,           /**< Class not supported */
+       CALL_ERROR_DATACODING_ERROR,            /**< Data coding error */
+       CALL_ERROR_INVAL_MSG,                           /**< Invalid message */
+       CALL_ERROR_CALL_BARRED,                 /**< Call barred */                                                     //70
+       CALL_ERROR_SIM_CALL_CONTROL_CHANGED_TO_SS,              /**< Sim call control changed to SS */
+       CALL_ERROR_SIM_CALL_CONTROL_CHANGED_TO_CALL,    /**< SIM Call control changed to call */
+       CALL_ERROR_SIM_ERROR,                           /**< SIM error */
+       CALL_ERROR_SIM_CALL_CONTROL_MODIFIED,                   /**< SIM call control modified */
+       CALL_ERROR_RANDOM_ACCESS_FAILURE,       /**< Random access error */
+       CALL_ERROR_LOWER_LAYER_FAILURE,         /**< Lower layer error */
+       CALL_ERROR_ACCESS_REJECTED,                     /**< Access rejected */
+       CALL_ERROR_RESET_NOT_ALLOWED,           /**< Reset not allowed */
+       CALL_ERROR_EMERGENCY_CALL_NOT_ALLOWED,                  /**< Emergency call not allowed */
+       CALL_ERROR_ACCESS_NOT_ALLOWED,          /**< Access not allowed */                                              //80
+       CALL_ERROR_RADIO_LINK_FAILURE,          /**< Radio link failure */
+       CALL_ERROR_INVALID_IDENTITY,            /**< Invalid identity */
+       CALL_ERROR_UNKNOWN_IDENTITY,            /**< Unknown identity */
+       CALL_ERROR_UNACCEPTABLE_IDENTITY,       /**< Un acceptable identity */
+       CALL_ERROR_NO_SERVICE_HERE,                     /**< No service here */
+       CALL_ERROR_SERVICE_NOT_ALLOWED,         /**< Service not allowed */
+       CALL_ERROR_SERVICE_NOT_AVAIL,           /**< Service not available */
+       CALL_ERROR_SERVICE_NOT_WORKING,         /**< Service not working */
+       CALL_ERROR_CANNOT_IDENTIFY_CALL,        /**< Cannot identify the call */
+       CALL_ERROR_DEACTIVATION,                        /**< Deactivation */                                                    //90
+       CALL_ERROR_FATAL_ERROR,                         /**< Fatal error */
+       CALL_ERROR_SEND_DTMF_SUCCESS,           /**< Sending DTMF Success */
+       CALL_ERROR_SEND_DTMF_FAIL,                      /**< Sending DTMF Failed */
+       CALL_ERROR_FIXED_DIALING_NUMBER_ONLY,/**< Fixed Dialing Number Only */
+       CALL_ERROR_TIMER_EXPIRED,                       /**< Call Timer Expired */
+};
+
+enum telephony_call_answer_type {
+       CALL_ANSWER_TYPE_ACCEPT,
+       CALL_ANSWER_TYPE_REJECT,
+       CALL_ANSWER_TYPE_REPLACE,
+       CALL_ANSWER_TYPE_HOLD_ACCEPT,
+};
+
+enum telephony_call_type {
+       CALL_TYPE_VOICE,
+       CALL_TYPE_VIDEO,
+       CALL_TYPE_E911
+};
+
+enum telephony_call_emergency_category {
+       CALL_EMERGENCY_CATEGORY_DEFAULT = 0x00,
+       CALL_EMERGENCY_CATEGORY_POLICE = 0x01,
+       CALL_EMERGENCY_CATEGORY_AMBULANCE = 0x02,
+       CALL_EMERGENCY_CATEGORY_FIRE_BRIGADE = 0x04,
+       CALL_EMERGENCY_CATEGORY_MARINE_GUARD = 0x08,
+       CALL_EMERGENCY_CATEGORY_MOUNTAIN_RESCUE = 0x10,
+       CALL_EMERGENCY_CATEGORY_NONE = 0xff,
+};
+
+enum telephony_call_status {
+       CALL_STATUS_IDLE,
+       CALL_STATUS_ACTIVE,
+       CALL_STATUS_HELD,
+       CALL_STATUS_DIALING,
+       CALL_STATUS_ALERT,
+       CALL_STATUS_INCOMING,
+       CALL_STATUS_WAITING,
+};
+
+enum telephony_call_end_type {
+       CALL_END_TYPE_DEFAULT,
+       CALL_END_TYPE_ALL,
+       CALL_END_TYPE_ACTIVE_ALL,
+       CALL_END_TYPE_HOLD_ALL,
+};
+
+enum telephony_call_rec_type {
+       CALL_REC_NAME_INFO,
+       CALL_REC_NUMBER_INFO,
+};
+
+
+enum telephony_call_end_cause {
+       CALL_END_CAUSE_NONE = 0x00,                             /**< No Cause */
+
+       CALL_END_CAUSE_UNASSIGNED_NUMBER,                       /**< Unassigned Number */
+       CALL_END_CAUSE_NO_ROUTE_TO_DEST,                        /**< No Route to Destination */
+       CALL_END_CAUSE_CHANNEL_UNACCEPTABLE,            /**< Channel Unacceptable */
+       CALL_END_CAUSE_OPERATOR_DETERMINED_BARRING,     /**< Operator Determined Barring */
+       CALL_END_CAUSE_NORMAL_CALL_CLEARING,    /**< Normal Call Clearing */
+
+       CALL_END_CAUSE_USER_BUSY,                                       /**< User Busy */
+       CALL_END_CAUSE_NO_USER_RESPONDING,                      /**< No user Responding */
+       CALL_END_CAUSE_USER_ALERTING_NO_ANSWER,         /**< User Alerting no Answer */
+       CALL_END_CAUSE_CALL_REJECTED,                   /**< Call Rejected */
+       CALL_END_CAUSE_NUMBER_CHANGED,                          /**< Number Changed */
+
+       CALL_END_CAUSE_NON_SELECTED_USER_CLEARING,      /**< Non Selected User Clearing */
+       CALL_END_CAUSE_DESTINATION_OUT_OF_ORDER,        /**< Destination out of Order */
+       CALL_END_CAUSE_INVALID_NUMBER_FORMAT,           /**< Invalid Number Format */
+       CALL_END_CAUSE_FACILITY_REJECTED,                       /**< Facility Rejected */
+       CALL_END_CAUSE_RESPONSE_TO_STATUS_ENQUIRY,      /**< Response to Status Enquiry */
+
+       CALL_END_CAUSE_NORMAL_UNSPECIFIED,                              /**< Normal Unspecified */
+       CALL_END_CAUSE_NO_CIRCUIT_CHANNEL_AVAILABLE,    /**< No Circuit Channel Available */
+       CALL_END_CAUSE_NETWORK_OUT_OF_ORDER,                    /**< Network out of Order */
+       CALL_END_CAUSE_TEMPORARY_FAILURE,                               /**< Temporary Failure */
+       CALL_END_CAUSE_SWITCHING_EQUIPMENT_CONGESTION,  /**< Switching Equipment Congestion */
+
+       CALL_END_CAUSE_ACCESS_INFORMATION_DISCARDED,                    /**< Access Information Discarded */
+       CALL_END_CAUSE_REQUESTED_CIRCUIT_CHANNEL_NOT_AVAILABLE, /**< Requested Circuit channel not available */
+       CALL_END_CAUSE_RESOURCES_UNAVAILABLE_UNSPECIFIED,               /**< Resources unavailable unspecified */
+       CALL_END_CAUSE_QUALITY_OF_SERVICE_UNAVAILABLE,                  /**< Quality of service unavailable */
+       CALL_END_CAUSE_REQUESTED_FACILITY_NOT_SUBSCRIBED,               /**< Requested facility not subscribed */
+
+       CALL_END_CAUSE_INCOMING_CALL_BARRED_WITHIN_CUG,         /**< incomming call barred within CUG */
+       CALL_END_CAUSE_BEARER_CAPABILITY_NOT_AUTHORISED,                /**< Bearer Capability not Authorised */
+       CALL_END_CAUSE_BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE,/**< Bearer capability not presently Available */
+       CALL_END_CAUSE_SERVICE_OR_OPTION_NOT_AVAILABLE,                 /**< Service or Option not available */
+       CALL_END_CAUSE_BEARER_SERVICE_NOT_IMPLEMENTED,                  /**< Service not implemented */
+
+       CALL_END_CAUSE_ACM_GEQ_ACMMAX,                                                  /**< ACM GEQ ACMAX */
+       CALL_END_CAUSE_REQUESTED_FACILITY_NOT_IMPLEMENTED,              /**< Requested facility not implemented */
+       CALL_END_CAUSE_ONLY_RESTRICTED_DIGITAL_INFO_BC_AVAILABLE,/**< Resticted digital info BC not available */
+       CALL_END_CAUSE_SERVICE_OR_OPTION_NOT_IMPLEMENTED,               /**< Service or Option not Implemented  */
+       CALL_END_CAUSE_INVALID_TRANSACTION_ID_VALUE,                    /**< Transaction ID value */
+
+       CALL_END_CAUSE_USER_NOT_MEMBER_OF_CUG,                          /**< Not member of CUG */
+       CALL_END_CAUSE_INCOMPATIBLE_DESTINATION,                        /**< Incompatible Destination */
+       CALL_END_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION,       /**< Transit Network selection */
+       CALL_END_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE,          /**< Semantically Incorrect message */
+       CALL_END_CAUSE_INVALID_MANDATORY_INFORMATION,           /**< Invalid Mandatory Message */
+
+       CALL_END_CAUSE_MESSAGE_TYPE_NON_EXISTENT,                                       /**< Message Type Non Existent */
+       CALL_END_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROT_STATE,     /**< Message type not compatible with Prot state */
+       CALL_END_CAUSE_IE_NON_EXISTENT_OR_NOT_IMPLEMENTED,                      /**< IE non exitent or not implemented */
+       CALL_END_CAUSE_CONDITIONAL_IE_ERROR,                                            /**< Conditional IE error */
+       CALL_END_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE,      /**< Not Compatible with protocol state */
+
+       CALL_END_CAUSE_RECOVERY_ON_TIMER_EXPIRY,        /**< Recovery on timer expiry */
+       CALL_END_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,      /**< Protocol error unspecified */
+       CALL_END_CAUSE_INTERWORKING_UNSPECIFIED,        /**< Interworking unspecified */
+       CALL_END_CAUSE_REORDER,                         /**< Reorder */
+
+       CALL_END_CAUSE_END = 128,
+
+       /* Reject causes*/
+       CALL_END_CAUSE_IMSI_UNKNOWN_IN_HLR,     /**< IMSI unknown in HLR */
+       CALL_END_CAUSE_ILLEGAL_MS,                      /**< Illegal MS */
+       CALL_END_CAUSE_IMSI_UNKNOWN_IN_VLR,     /**< IMSI unknown in VLR */
+       CALL_END_CAUSE_IMEI_NOT_ACCEPTED,       /**< IMEI not accepted */
+       CALL_END_CAUSE_ILLEGAL_ME,                      /**< Illegal ME */
+
+       CALL_END_CAUSE_GPRS_SERVICES_NOT_ALLOWED,                                               /**< GPRS service not allowed */
+       CALL_END_CAUSE_GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED, /**< GPRS services and Non-GPRS services not allowed */
+       CALL_END_CAUSE_MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK,    /**< MS device cannot be derived by the network */
+       CALL_END_CAUSE_IMPLICITLY_DETACHED,                                                             /**< Implicitly detached */
+       CALL_END_CAUSE_PLMN_NOT_ALLOWED,                                                                /**< PLMN not allowed */
+
+       CALL_END_CAUSE_LA_NOT_ALLOWED,                                                  /**< LA not allowed */
+       CALL_END_CAUSE_NATIONAL_ROAMING_NOT_ALLOWED,                    /**< National roaming not allowed */
+       CALL_END_CAUSE_GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN,  /**< GPRS services not allowed in this PLMN */
+       CALL_END_CAUSE_NO_SUITABLE_CELLS_IN_LA,                                 /**< No suitable cells in the LA */
+       CALL_END_CAUSE_MSC_TEMPORARILY_NOT_REACHABLE,                   /**< MSC temporarily not reachable */
+
+       CALL_END_CAUSE_NETWORK_FAILURE,         /**< Network unavailable */
+       CALL_END_CAUSE_MAC_FAILURE,                     /**< MAC failure */
+       CALL_END_CAUSE_SYNCH_FAILURE,           /**< SYNCh failure */
+       CALL_END_CAUSE_CONGESTTION,                     /**< Congestion */
+       CALL_END_CAUSE_GSM_AUTH_UNACCEPTED,     /**< GSM Auth unaccepted */
+
+       CALL_END_CAUSE_SERVICE_OPTION_NOT_SUPPORTED, /**< Service option not supported */
+       CALL_END_CAUSE_REQ_SERV_OPT_NOT_SUBSCRIBED,     /**< REQ_SERV option not suscribed */
+       CALL_END_CAUSE_SERVICE_OPT__OUT_OF_ORDER,       /**< Service OPT out of order */
+       CALL_END_CAUSE_CALL_CANNOT_BE_IDENTIFIED,       /**< Call cannot be identified */
+       CALL_END_CAUSE_NO_PDP_CONTEXT_ACTIVATED,        /**< No PDP context Activated */
+
+       CALL_END_CAUSE_RETRY_UPON_ENTRY_INTO_A_NEW_CELL_MIN_VALUE,      /**< Retry upon entry into a new call min value */
+       CALL_END_CAUSE_RETRY_UPON_ENTRY_INTO_A_NEW_CELL_MAX_VALUE,      /**< Retry upon entry into a new call max value */
+       CALL_END_CAUSE_SEMANTICALLY_INCORRECT_MSG,                                      /**< Semantically incorret message */
+       CALL_END_CAUSE_INVALID_MANDATORY_INFO,                                          /**< Invalid mandatory information */
+       CALL_END_CAUSE_MESSAGE_TYPE_NON_EXISTANT,                                       /**< Message type non-existant */
+
+       CALL_END_CAUSE_MESSAGE_TYPE_NOT_COMP_PRT_ST,            /**< Message type not COMP PRT ST */
+       CALL_END_CAUSE_IE_NON_EXISTANT,                                         /**< IE not existant */
+       CALL_END_CAUSE_MSG_NOT_COMPATIBLE_PROTOCOL_STATE,       /**< MSG not compatible protocol state */
+
+       /* Connection Management establishment rejection cause */
+       CALL_END_CAUSE_REJ_UNSPECIFIED, /**< rej unspecified */
+
+       /* AS reject causes */
+       CALL_END_CAUSE_AS_REJ_RR_REL_IND,                                               /**< RR release indication */
+       CALL_END_CAUSE_AS_REJ_RR_RANDOM_ACCESS_FAILURE,                 /**< Random Access Failure */
+       CALL_END_CAUSE_AS_REJ_RRC_REL_IND,                                              /**< RRC release indication */
+       CALL_END_CAUSE_AS_REJ_RRC_CLOSE_SESSION_IND,                    /**< RRC close session indication */
+       CALL_END_CAUSE_AS_REJ_RRC_OPEN_SESSION_FAILURE,                 /**< RRC open session failure */
+       CALL_END_CAUSE_AS_REJ_LOW_LEVEL_FAIL,                                   /**< Low level failure */
+       CALL_END_CAUSE_AS_REJ_LOW_LEVEL_FAIL_REDIAL_NOT_ALLOWED, /**< Low level failure redial not alowed */
+       CALL_END_CAUSE_AS_REJ_LOW_LEVEL_IMMED_RETRY,                    /**< low level immediate retry */
+
+       /* MM reject causes */
+       CALL_END_CAUSE_MM_REJ_INVALID_SIM,                      /**< invalid Sim */
+       CALL_END_CAUSE_MM_REJ_NO_SERVICE,                       /**< No service */
+       CALL_END_CAUSE_MM_REJ_TIMER_T3230_EXP,          /**< Timer T3230 expire */
+       CALL_END_CAUSE_MM_REJ_NO_CELL_AVAILABLE,        /**< No call available  */
+       CALL_END_CAUSE_MM_REJ_WRONG_STATE,                      /**< wrong state */
+       CALL_END_CAUSE_MM_REJ_ACCESS_CLASS_BLOCKED,     /**< Access class blocked */
+
+       /* Definitions for release ind causes between MM  and CNM*/
+       CALL_END_CAUSE_ABORT_MSG_RECEIVED,      /**< Abort Message received */
+       CALL_END_CAUSE_OTHER_CAUSE,                     /**< Other cause  */
+
+       /* CNM reject causes */
+       CALL_END_CAUSE_CNM_REJ_TIMER_T303_EXP,  /**< Timer T303 expiry */
+       CALL_END_CAUSE_CNM_REJ_NO_RESOURCES,    /**< Rejected due to unavailibilty of resources */
+       CALL_END_CAUSE_CNM_MM_REL_PENDING,              /**< MM release pending */
+       CALL_END_CAUSE_CNM_INVALID_USER_DATA,   /**< Invalid user data */
+};
+
+enum telephony_call_no_cli_cause {
+       CALL_NO_CLI_CAUSE_NONE = -1,                    /**< None value - Infers NO CLI Cause */
+       CALL_NO_CLI_CAUSE_UNAVAILABLE,                  /**< Unavailable */
+       CALL_NO_CLI_CAUSE_USER_REJECTED,                /**< Rejected by user */
+       CALL_NO_CLI_CAUSE_OTHERS,                               /**< Interaction with other services */
+       CALL_NO_CLI_CAUSE_PAY_PHONE                     /**< Coin line/ Pay phone */
+};
+
+enum telephony_call_cli_mode {
+       CALL_CLI_MODE_PRESENT,
+       CALL_CLI_MODE_RESTRICT,
+       CALL_CLI_MODE_UNAVAILABLE,
+       CALL_CLI_MODE_DEFAULT,
+};
+
+enum telephony_call_cna_mode {
+       CALL_CNA_MODE_DEFAULT,
+       CALL_CNA_MODE_PRESENT,
+       CALL_CNA_MODE_RESTRICT,
+};
+
+enum telephony_call_sound_path {
+       CALL_SOUND_PATH_HANDSET         = 0x01,
+       CALL_SOUND_PATH_HEADSET,
+       CALL_SOUND_PATH_HANDFREE,
+       CALL_SOUND_PATH_BLUETOOTH,
+       CALL_SOUND_PATH_STEREO_BLUETOOTH,
+       CALL_SOUND_PATH_SPEAKER,
+       CALL_SOUND_PATH_HEADSET_3_5PI,
+       CALL_SOUND_PATH_BT_NSEC_OFF,
+       CALL_SOUND_PATH_MIC1,
+       CALL_SOUND_PATH_MIC2,
+       CALL_SOUND_PATH_HEADSET_HAC,
+};
+
+enum telephony_call_sound_device {
+       CALL_SOUND_DEVICE_RECEIVER      = 0x10,
+       CALL_SOUND_DEVICE_SPEAKER       = 0x20,
+       CALL_SOUND_DEVICE_HFK           = 0x30,
+       CALL_SOUND_DEVICE_BLUETOOTH     = 0x40,
+       CALL_SOUND_DEVICE_ECHO_CANCELLER        = 0xA0,
+};
+
+enum telephony_call_sound_type {
+       CALL_SOUND_TYPE_VOICE   = 0x1,
+       CALL_SOUND_TYPE_KEYTONE,
+       CALL_SOUND_TYPE_BELL,
+       CALL_SOUND_TYPE_MESSAGE,
+       CALL_SOUND_TYPE_ALARM,
+       CALL_SOUND_TYPE_MISCELLANEOUS,
+};
+
+enum telephony_call_sound_volume_level {
+       CALL_SOUND_MUTE,
+       CALL_SOUND_VOLUME_LEVEL_1,
+       CALL_SOUND_VOLUME_LEVEL_2,
+       CALL_SOUND_VOLUME_LEVEL_3,
+       CALL_SOUND_VOLUME_LEVEL_4,
+       CALL_SOUND_VOLUME_LEVEL_5,
+       CALL_SOUND_VOLUME_LEVEL_6,
+       CALL_SOUND_VOLUME_LEVEL_7,
+       CALL_SOUND_VOLUME_LEVEL_8,
+       CALL_SOUND_VOLUME_LEVEL_9,
+};
+
+enum telephony_call_sound_mute_path {
+       CALL_SOUND_MUTE_PATH_TX = 0x00,
+       CALL_SOUND_MUTE_PATH_RX = 0x02,
+       CALL_SOUND_MUTE_PATH_ALL = 0x04,
+};
+
+enum telephony_call_sound_mute_status {
+       CALL_SOUND_MUTE_STATUS_OFF = 0x00,
+       CALL_SOUND_MUTE_STATUS_ON = 0x01,
+};
+
+enum telephony_call_sound_ringback_tone_status {
+       CALL_SOUND_RINGBACK_TONE_END,
+       CALL_SOUND_RINGBACK_TONE_START,
+};
+
+enum telephony_call_sound_direction {
+       CALL_SOUND_DIRECTION_LEFT,
+       CALL_SOUND_DIRECTION_RIGHT,
+};
+
+enum telephony_call_preferred_voice_subs {
+       CALL_PREFERRED_VOICE_SUBS_UNKNOWN = -1,  /**<  Unknown status **/
+       CALL_PREFERRED_VOICE_SUBS_CURRENT_NETWORK = 0, /**< Current network **/
+       CALL_PREFERRED_VOICE_SUBS_ASK_ALWAYS, /**< ASK Always **/
+       CALL_PREFERRED_VOICE_SUBS_SIM1, /**< SIM 1 **/
+       CALL_PREFERRED_VOICE_SUBS_SIM2 /**<  SIM 2 **/
+};
+
+enum telephony_call_voice_privacy_mode {
+       CALL_PRIVACY_MODE_STANDARD,
+       CALL_PRIVACY_MODE_ENHANCED,
+};
+
+enum  telephony_call_otasp_status{
+       CALL_OTASP_OK_SPL_UNLOCKED = 0x01,
+       CALL_OTASP_OK_AKEY_EXCESS,
+       CALL_OTASP_OK_SSD_UPDATE,
+       CALL_OTASP_OK_NAM_DWNLD,
+       CALL_OTASP_OK_MDN_DWNLD,
+       CALL_OTASP_OK_IMSI_DWNLD,
+       CALL_OTASP_OK_PRL_DWNLD,
+       CALL_OTASP_OK_COMMIT,
+       CALL_OTASP_OK_PROGRAMMING,
+       CALL_OTASP_SUCCESS,
+       CALL_OTASP_UNSUCCESS,
+       CALL_OTASP_OK_OTAPA_VERIFY,
+       CALL_OTASP_PROGRESS,
+       CALL_OTASP_FAILURES_EXCESS_SPC,
+       CALL_OTASP_LOCK_CODE_PW_SET,
+};
+
+enum telephony_call_otapa_status{
+       CALL_OTAPA_STOP = 0x00,
+       CALL_OTAPA_START,
+       CALL_OTAPA_ABORTED,
+       CALL_OTAPA_COMMITTED,
+};
+
+enum  telephony_call_otasp_result{
+       CALL_OTASP_FAIL = 0x00,
+       CALL_OTASP_PASS,
+};
+
+enum telephony_call_alert_signal_type{
+       CALL_SIGNAL_TYPE_TONE = 0x00,
+       CALL_SIGNAL_TYPE_ISDN_ALERTING,
+       CALL_SIGNAL_TYPE_IS54B_ALERTING,
+       CALL_SIGNAL_TYPE_RESERVED,
+};
+
+enum telephony_call_alert_pitch_type{
+       CALL_ALERT_PITCH_MED = 0x00,
+       CALL_ALERT_PITCH_HIGH,
+       CALL_ALERT_PITCH_LOW,
+       CALL_ALERT_PITCH_RESERVED,
+};
+
+// SIGNAL : SIGNAL TYPE SIGNAL_TONE
+enum telephony_call_tone_signal{
+       CALL_SIGNAL_TONE_DIAL = 0x00,
+       CALL_SIGNAL_TONE_RINGBACK_TONE_ON,
+       CALL_SIGNAL_TONE_INTERCEPT_TONE_ON,
+       CALL_SIGNAL_TONE_ABBREV_TONE,
+       CALL_SIGNAL_TONE_NETWORK_CONGESTION_TONE_ON,
+       CALL_SIGNAL_TONE_ABBREV_NETWORK_CONGESTION,
+       CALL_SIGNAL_TONE_BUSY_TONE_ON,
+       CALL_SIGNAL_TONE_CFRM_TONE_ON,
+       CALL_SIGNAL_TONE_ANSWER_TONE_ON,
+       CALL_SIGNAL_TONE_CALL_WAITING_TONE_ON,
+       CALL_SINGNAL_TONE_PIPE_TONE_ON,
+       CALL_SIGNAL_TONE_OFF,
+};
+
+// SIGNAL : SIGNAL TYPE SIGNAL_ISDNALERT
+enum telephony_call_isdn_alert_signal{
+       CALL_SIGNAL_ISDN_ALERT_NORMAL = 0x00,
+       CALL_SIGNAL_ISDN_ALERT_INTER_GROUP,
+       CALL_SIGNAL_ISDN_ALERT_SPECIAL_PRIORITY,
+       CALL_SIGNAL_ISDN_ALERT_ISDN_RESERVED1,
+       CALL_SIGNAL_ISDN_ALERT_PING_RING,
+       CALL_SIGNAL_ISDN_ALERT_ISDN_RESERVED2,
+       CALL_SIGNAL_ISDN_ALERT_ISDN_RESERVED3,
+       CALL_SIGNAL_ISDN_ALERT_ISDN_RESERVED4,
+       CALL_SIGNAL_ISDN_ALERT_OFF,
+};
+
+// SIGNAL : SIGNAL TYPE IS- SIGNAL_IS54BALERT
+enum telephony_call_is54b_alert_signal{
+       CALL_SIGNAL_IS54B_ALERT_NOTONE = 0x00,
+       CALL_SIGNAL_IS54B_ALERT_LONG,
+       CALL_SIGNAL_IS54B_ALERT_SHORT_SHORT,
+       CALL_SIGNAL_IS54B_ALERT_SHORT_SHORT_LONG,
+       CALL_SIGNAL_IS54B_ALERT_SHORT_SHORT_2,
+       CALL_SIGNAL_IS54B_ALERT_SHORT_LONG_SHORT,
+       CALL_SIGNAL_IS54B_ALERT_SHORT_SHORT_SHORT_SHORT,
+       CALL_SIGNAL_IS54B_ALERT_PBX_LONG,
+       CALL_SIGNAL_IS54B_ALERT_PBX_SHORT_SHORT,
+       CALL_SIGNAL_IS54B_ALERT_PBX_SHORT_SHORT_LONG,
+       CALL_SIGNAL_IS54B_ALERT_PBX_SHORT_LONG_SHORT,
+       CALL_SIGNAL_IS54B_ALERT_PBX_SHORT_SHORT_SHORT_SHORT,
+       CALL_SIGNAL_IS54B_ALERT_PIP_PIP_PIP_PIP,
+};
+
+enum telephony_call_dtmf_inter_digit_interval{
+       CALL_DTMF_OFFLENGTH_60MS,
+       CALL_DTMF_OFFLENGTH_100MS,
+       CALL_DTMF_OFFLENGTH_150MS,
+       CALL_DTMF_OFFLENGTH_200MS,
+};
+
+enum telephony_call_dtmf_pulse_width{
+       CALL_DTMF_ONLENGTH_95MS,
+       CALL_DTMF_ONLENGTH_150MS,
+       CALL_DTMF_ONLENGTH_200MS,
+       CALL_DTMF_ONLENGTH_250MS,
+       CALL_DTMF_ONLENGTH_300MS,
+       CALL_DTMF_ONLENGTH_350MS,
+       CALL_DTMF_ONLENGTH_SMS
+};
+
+enum telephony_call_srvcc_ho_state {
+       CALL_SRVCC_HANDOVER_STATE_START,
+       CALL_SRVCC_HANDOVER_STATE_COMPLETE,
+       CALL_SRVCC_HANDOVER_STATE_CANCEL_OR_FAIL
+};
+
+enum telephony_call_confirm_type {
+       CALL_CONFIRM_TYPE_ACCEPT,
+       CALL_CONFIRM_TYPE_REJECT,
+};
+
+/**********
+  Struct
+  **********/
+
+// Request
+
+#define MAX_CALL_NUMBER_LEN 83
+#define MAX_CALL_DIAL_NUM_LEN MAX_CALL_NUMBER_LEN
+#define MAX_CALL_BURST_DTMF_STRING_LEN 32
+
+#define MAX_ALPHA_INFO_LEN 64
+
+#define MAX_CALL_CLI_NUM_LEN MAX_CALL_NUMBER_LEN
+#define MAX_CALL_CNA_NAME_LEN 83
+
+#define MAX_CALL_DISPLAY_INFORMATION 182
+
+struct telephony_call_cli_info {
+       enum telephony_call_cli_mode mode;
+       enum telephony_call_no_cli_cause no_cli_cause;
+       char number[ MAX_CALL_CLI_NUM_LEN ];
+};
+
+struct telephony_call_cna_info {
+       enum telephony_call_cna_mode mode;
+       char name[ MAX_CALL_CNA_NAME_LEN ];
+};
+
+struct telephony_call_rec_info {
+       unsigned int id;
+       enum telephony_call_rec_type type;
+       union {
+               char name[ MAX_ALPHA_INFO_LEN ];
+               char number[ MAX_CALL_NUMBER_LEN ];
+       } data;
+};
+
+struct treq_call_dial {
+       enum telephony_call_type type;
+       enum telephony_call_emergency_category ecc;
+       char number[ MAX_CALL_DIAL_NUM_LEN ];
+};
+
+struct treq_call_answer {
+       unsigned int id;
+       enum telephony_call_answer_type type;
+};
+
+struct treq_call_end {
+       unsigned int id;
+       enum telephony_call_end_type type;
+};
+
+struct treq_call_start_cont_dtmf {
+       unsigned char dtmf_digit;
+};
+
+struct treq_call_send_burst_dtmf {
+       char dtmf_string[ MAX_CALL_BURST_DTMF_STRING_LEN + 1];
+       enum telephony_call_dtmf_pulse_width pulse_width;
+       enum telephony_call_dtmf_inter_digit_interval inter_digit_interval;
+};
+
+struct treq_call_active {
+       unsigned int id;
+};
+
+struct treq_call_hold {
+       unsigned int id;
+};
+
+struct treq_call_swap {
+       unsigned int id;
+};
+
+struct treq_call_join {
+       unsigned int id;
+};
+
+struct treq_call_split {
+       unsigned int id;
+};
+
+struct treq_call_transfer {
+       unsigned int id;
+};
+
+struct treq_call_deflect {
+       unsigned int id;
+       char number[MAX_CALL_NUMBER_LEN];
+};
+
+struct treq_call_set_sound_path {
+       enum telephony_call_sound_path path;
+       gboolean extra_volume_on;
+};
+
+struct treq_call_set_sound_volume_level {
+       enum telephony_call_sound_type sound;
+       enum telephony_call_sound_device device;
+       enum telephony_call_sound_volume_level volume;
+};
+
+struct treq_call_get_sound_volume_level {
+       enum telephony_call_sound_type sound;
+       enum telephony_call_sound_device device;
+};
+
+struct treq_call_set_sound_mute_status {
+       enum telephony_call_sound_mute_path path;
+       enum telephony_call_sound_mute_status status;
+};
+
+struct treq_call_set_sound_recording {
+       gboolean state;
+};
+
+#define MAX_CALL_EQ_PARAMETER_SIZE 6
+struct treq_call_set_sound_equalization {
+       int mode;
+       enum telephony_call_sound_direction direction;
+       unsigned short parameter[ MAX_CALL_EQ_PARAMETER_SIZE ];
+};
+
+struct treq_call_set_sound_noise_reduction {
+       gboolean status;
+};
+
+struct treq_call_set_sound_clock_status {
+       gboolean status;
+};
+
+struct treq_call_set_voice_privacy_mode {
+       enum telephony_call_voice_privacy_mode privacy_mode;
+};
+
+struct treq_call_set_preferred_voice_subscription {
+       enum telephony_call_preferred_voice_subs preferred_subs;
+};
+
+struct treq_call_get_preferred_voice_subscription {
+};
+
+struct treq_call_modify {
+       unsigned int id;
+       enum telephony_call_type call_type;
+};
+
+struct treq_call_confirm_modify {
+       unsigned int id;
+       enum telephony_call_confirm_type confirm_type;
+};
+
+// Response
+
+struct tresp_call_dial {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_answer {
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_end {
+       enum telephony_call_end_type type;
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_hold {
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_active {
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_swap {
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_join {
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_split {
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_deflect {
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_transfer {
+       unsigned int id;
+       enum telephony_call_error err;
+};
+
+struct tresp_call_dtmf {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_set_sound_path {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_set_sound_volume_level {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_get_sound_volume_level {
+       enum telephony_call_error err;
+       int record_num;
+       struct volume_info {
+               enum telephony_call_sound_type sound;
+               enum telephony_call_sound_volume_level volume;
+       } *record;
+};
+
+struct tresp_call_set_sound_mute_status {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_get_sound_mute_status {
+       enum telephony_call_error err;
+       enum telephony_call_sound_mute_path path;
+       enum telephony_call_sound_mute_status status;
+};
+
+struct tresp_call_set_sound_recording {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_set_sound_equalization {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_set_sound_noise_reduction {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_set_sound_clock_status {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_set_preferred_voice_subscription {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_get_preferred_voice_subscription {
+       enum telephony_call_error err;
+       enum telephony_call_preferred_voice_subs preferred_subs;
+};
+
+struct tresp_call_set_voice_privacy_mode {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_get_voice_privacy_mode {
+       enum telephony_call_error err;
+       enum telephony_call_voice_privacy_mode privacy_mode;
+};
+
+struct tresp_call_modify {
+       enum telephony_call_error err;
+};
+
+struct tresp_call_confirm_modify {
+       enum telephony_call_error err;
+};
+
+// Notification
+
+struct tnoti_call_status_idle {
+       enum telephony_call_type type;
+       unsigned int    id;
+       enum telephony_call_end_cause cause;
+};
+
+struct tnoti_call_status_active {
+       enum telephony_call_type type;
+       unsigned int    id;
+};
+
+struct tnoti_call_status_held {
+       enum telephony_call_type type;
+       unsigned int    id;
+};
+
+struct tnoti_call_status_dialing {
+       enum telephony_call_type type;
+       unsigned int    id;
+};
+
+struct tnoti_call_status_alert {
+       enum telephony_call_type type;
+       unsigned int    id;
+};
+
+struct tnoti_call_status_incoming {
+       enum telephony_call_type type;
+       unsigned int    id;
+       struct telephony_call_cli_info cli;
+       struct telephony_call_cna_info cna;
+       gboolean                forward;
+       unsigned int    active_line;
+};
+
+struct tnoti_call_status_waiting {
+       enum telephony_call_type type;
+       unsigned int    id;
+};
+
+struct tnoti_call_sound_path {
+       enum telephony_call_sound_path path;
+};
+
+struct tnoti_call_sound_ringback_tone {
+       enum telephony_call_sound_ringback_tone_status status;
+};
+
+struct tnoti_call_sound_wbamr {
+       gboolean status;
+};
+
+struct tnoti_call_sound_equalization {
+       int mode;
+       enum telephony_call_sound_direction direction;
+};
+
+struct tnoti_call_sound_noise_reduction {
+       gboolean status;
+};
+
+struct tnoti_call_sound_clock_status {
+       gboolean status;
+};
+
+struct tnoti_call_info_extra_information {
+       int type;
+       int data_len;
+       void *data;
+};
+
+struct tnoti_call_preferred_voice_subscription {
+       enum telephony_call_preferred_voice_subs preferred_subs;
+};
+
+struct tnoti_call_info_voice_privacy_mode {
+       enum telephony_call_voice_privacy_mode privacy_mode;
+};
+
+struct tnoti_call_srvcc_handover {
+       enum telephony_call_srvcc_ho_state srvcc_ho_status;
+};
+
+struct tnoti_call_signal_info {
+       enum telephony_call_alert_signal_type signal_type;
+       enum telephony_call_alert_pitch_type pitch_type;
+       union {
+               enum telephony_call_tone_signal sig_tone_type;
+               enum telephony_call_isdn_alert_signal sig_isdn_alert_type;
+               enum telephony_call_is54b_alert_signal sig_is54b_alert_type;
+       } signal;
+};
+
+struct tnoti_call_otasp_status {
+       enum telephony_call_otasp_status otasp_status ;
+};
+
+struct tnoti_call_otapa_status {
+       enum telephony_call_otapa_status otapa_status;
+};
+
+struct tnoti_call_otasp_result {
+       enum telephony_call_otasp_result otasp_result ;
+};
+
+struct tnoti_call_display_information {
+       unsigned char display_information[ MAX_CALL_DISPLAY_INFORMATION + 1];
+};
+
+struct tnoti_call_info_rec {
+       struct telephony_call_rec_info rec_info;
+};
+
+struct tnoti_call_modify_request {
+       unsigned int id;
+       enum telephony_call_type call_type;
+};
+__END_DECLS
+
+#endif
diff --git a/include/type/command.h b/include/type/command.h
deleted file mode 100644 (file)
index 415b565..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * libtcore
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TYPE_COMMAND_H__
-#define __TYPE_COMMAND_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include <type/common.h>
-
-/** Commands */
-typedef enum {
-       /* Modem */
-       TCORE_COMMAND_MODEM = TCORE_COMMAND | TCORE_TYPE_MODEM,
-       TCORE_COMMAND_MODEM_SET_POWER_STATUS,
-       TCORE_COMMAND_MODEM_SET_FLIGHTMODE,
-       TCORE_COMMAND_MODEM_GET_FLIGHTMODE,
-       TCORE_COMMAND_MODEM_GET_IMEI,
-       TCORE_COMMAND_MODEM_GET_VERSION,
-
-       /* SIM */
-       TCORE_COMMAND_SIM = TCORE_COMMAND | TCORE_TYPE_SIM,
-       TCORE_COMMAND_SIM_GET_IMSI,
-       TCORE_COMMAND_SIM_GET_ECC,
-       TCORE_COMMAND_SIM_GET_ICCID,
-       TCORE_COMMAND_SIM_GET_LANGUAGE,
-       TCORE_COMMAND_SIM_SET_LANGUAGE,
-       TCORE_COMMAND_SIM_GET_CALL_FORWARDING_INFO,
-       TCORE_COMMAND_SIM_GET_MESSAGE_WAITING_INFO,
-       TCORE_COMMAND_SIM_SET_MESSAGE_WAITING_INFO,
-       TCORE_COMMAND_SIM_GET_MAILBOX_INFO,
-       TCORE_COMMAND_SIM_SET_MAILBOX_INFO,
-       TCORE_COMMAND_SIM_GET_MSISDN,
-       TCORE_COMMAND_SIM_GET_SPN,
-       TCORE_COMMAND_SIM_GET_CPHS_NET_NAME,
-       TCORE_COMMAND_SIM_GET_SP_DISPLAY_INFO,
-       TCORE_COMMAND_SIM_REQ_AUTHENTICATION,
-       TCORE_COMMAND_SIM_VERIFY_PINS,
-       TCORE_COMMAND_SIM_VERIFY_PUKS,
-       TCORE_COMMAND_SIM_CHANGE_PINS,
-       TCORE_COMMAND_SIM_DISABLE_FACILITY,
-       TCORE_COMMAND_SIM_ENABLE_FACILITY,
-       TCORE_COMMAND_SIM_GET_FACILITY,
-       TCORE_COMMAND_SIM_GET_LOCK_INFO,
-       TCORE_COMMAND_SIM_REQ_APDU,
-       TCORE_COMMAND_SIM_REQ_ATR,
-
-       /* NETWORK */
-       TCORE_COMMAND_NETWORK = TCORE_COMMAND | TCORE_TYPE_NETWORK,
-       TCORE_COMMAND_NETWORK_GET_IDENTITY_INFO,
-       TCORE_COMMAND_NETWORK_SEARCH,
-       TCORE_COMMAND_NETWORK_CANCEL_SEARCH,
-       TCORE_COMMAND_NETWORK_SELECT_AUTOMATIC,
-       TCORE_COMMAND_NETWORK_SELECT_MANUAL,
-       TCORE_COMMAND_NETWORK_GET_SELECTION_MODE,
-       TCORE_COMMAND_NETWORK_SET_PREFERRED_PLMN,
-       TCORE_COMMAND_NETWORK_GET_PREFERRED_PLMN,
-       TCORE_COMMAND_NETWORK_SET_MODE,
-       TCORE_COMMAND_NETWORK_GET_MODE,
-       TCORE_COMMAND_NETWORK_GET_NEIGHBORING_CELL_INFO,
-
-       /* CALL */
-       TCORE_COMMAND_CALL = TCORE_COMMAND | TCORE_TYPE_CALL,
-       TCORE_COMMAND_CALL_DIAL,
-       TCORE_COMMAND_CALL_ANSWER,
-       TCORE_COMMAND_CALL_END,
-       TCORE_COMMAND_CALL_SEND_DTMF,
-       TCORE_COMMAND_CALL_HOLD,
-       TCORE_COMMAND_CALL_ACTIVE,
-       TCORE_COMMAND_CALL_SWAP,
-       TCORE_COMMAND_CALL_JOIN,
-       TCORE_COMMAND_CALL_SPLIT,
-       TCORE_COMMAND_CALL_TRANSFER,
-       TCORE_COMMAND_CALL_DEFLECT,
-       TCORE_COMMAND_CALL_SET_ACTIVE_LINE,
-       TCORE_COMMAND_CALL_GET_ACTIVE_LINE,
-       TCORE_COMMAND_CALL_SET_VOLUME_INFO,
-       TCORE_COMMAND_CALL_GET_VOLUME_INFO,
-       TCORE_COMMAND_CALL_SET_SOUND_PATH,
-       TCORE_COMMAND_CALL_SET_MUTE,
-       TCORE_COMMAND_CALL_GET_MUTE_STATUS,
-       TCORE_COMMAND_CALL_SET_SOUND_RECORDING,
-       TCORE_COMMAND_CALL_SET_SOUND_EQUALIZATION,
-
-       /* SS */
-       TCORE_COMMAND_SS = TCORE_COMMAND | TCORE_TYPE_SS,
-       TCORE_COMMAND_SS_SET_BARRING,
-       TCORE_COMMAND_SS_GET_BARRING_STATUS,
-       TCORE_COMMAND_SS_CHANGE_BARRING_PASSWORD,
-       TCORE_COMMAND_SS_SET_FORWARDING,
-       TCORE_COMMAND_SS_GET_FORWARDING_STATUS,
-       TCORE_COMMAND_SS_SET_WAITING,
-       TCORE_COMMAND_SS_GET_WAITING_STATUS,
-       TCORE_COMMAND_SS_SET_CLI,
-       TCORE_COMMAND_SS_GET_CLI_STATUS,
-       TCORE_COMMAND_SS_SEND_USSD_REQUEST,
-
-       /* PHONEBOOK */
-       TCORE_COMMAND_PHONEBOOK = TCORE_COMMAND | TCORE_TYPE_PHONEBOOK,
-       TCORE_COMMAND_PHONEBOOK_GET_INFO,
-       TCORE_COMMAND_PHONEBOOK_READ_RECORD,
-       TCORE_COMMAND_PHONEBOOK_UPDATE_RECORD,
-       TCORE_COMMAND_PHONEBOOK_DELETE_RECORD,
-
-       /* SMS */
-       TCORE_COMMAND_SMS = TCORE_COMMAND | TCORE_TYPE_SMS,
-       TCORE_COMMAND_SMS_SEND_SMS,
-       TCORE_COMMAND_SMS_READ_IN_SIM,
-       TCORE_COMMAND_SMS_WRITE_IN_SIM,
-       TCORE_COMMAND_SMS_DELETE_IN_SIM,
-       TCORE_COMMAND_SMS_GET_COUNT,
-       TCORE_COMMAND_SMS_SET_CB_CONFIG,
-       TCORE_COMMAND_SMS_GET_CB_CONFIG,
-       TCORE_COMMAND_SMS_GET_PARAMETERS,
-       TCORE_COMMAND_SMS_SET_PARAMETERS,
-       TCORE_COMMAND_SMS_SEND_DELIVER_REPORT,
-       TCORE_COMMAND_SMS_SET_SCA,
-       TCORE_COMMAND_SMS_GET_SCA,
-       TCORE_COMMAND_SMS_SET_MEMORY_STATUS,
-       TCORE_COMMAND_SMS_SET_MESSAGE_STATUS,
-
-       /* SAT */
-       TCORE_COMMAND_SAT = TCORE_COMMAND | TCORE_TYPE_SAT,
-       TCORE_COMMAND_SAT_REQ_ENVELOPE,
-       TCORE_COMMAND_SAT_REQ_TERMINAL_RESPONSE,
-       TCORE_COMMAND_SAT_REQ_USER_CONFIRMATION,
-
-       /* SAP */
-       TCORE_COMMAND_SAP = TCORE_COMMAND | TCORE_TYPE_SAP,
-       TCORE_COMMAND_SAP_REQ_CONNECT,
-       TCORE_COMMAND_SAP_REQ_DISCONNECT,
-       TCORE_COMMAND_SAP_GET_ATR,
-       TCORE_COMMAND_SAP_REQ_TRANSFER_APDU,
-       TCORE_COMMAND_SAP_REQ_TRANSPORT_PROTOCOL,
-       TCORE_COMMAND_SAP_REQ_POWER_OPERATION,
-       TCORE_COMMAND_SAP_GET_CARDREADER_STATUS,
-
-       /* GPS */
-       TCORE_COMMAND_GPS = TCORE_COMMAND | TCORE_TYPE_GPS,
-       TCORE_COMMAND_GPS_CONFIRM_MEASURE_POS,
-       TCORE_COMMAND_GPS_SET_FREQUENCY_AIDING,
-
-       /* PS */
-       TCORE_COMMAND_PS = TCORE_COMMAND | TCORE_TYPE_PS,
-       TCORE_COMMAND_PS_DEFINE_CONTEXT,
-       TCORE_COMMAND_PS_ACTIVATE_CONTEXT,
-       TCORE_COMMAND_PS_DEACTIVATE_CONTEXT,
-
-} TcoreCommand;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TYPE_COMMAND_H__ */
index 10fd5e6..092ec89 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <errno.h>
 
-#define TCORE_COMMAND                  0x10000000
-#define TCORE_NOTIFICATION             0x20000000
-
-/* Command Masks */
-/* TODO - Remove unwanted command masks */
-#define TCORE_TYPE_DEFAULT             0x00100000
-#define TCORE_TYPE_SERVER              0x00200000
-#define TCORE_TYPE_PENDING             0x00300000
-#define TCORE_TYPE_HOOK                0x00400000
-#define TCORE_TYPE_MODEM               0x00500000
-#define TCORE_TYPE_SIM                 0x00600000
-#define TCORE_TYPE_NETWORK     0x00700000
-#define TCORE_TYPE_CALL                0x00800000
-#define TCORE_TYPE_SS                  0x00900000
-#define TCORE_TYPE_PHONEBOOK   0x00A00000
-#define TCORE_TYPE_SMS                 0x00B00000
-#define TCORE_TYPE_PS                  0x00C00000
-#define TCORE_TYPE_PDP                 0x00D00000
-#define TCORE_TYPE_SAT                 0x00E00000
-#define TCORE_TYPE_SAP                 0x00F00000
-#define TCORE_TYPE_SOUND               0x01000000
-#define TCORE_TYPE_GPS                 0x01100000
-#define TCORE_TYPE_CUSTOM              0x0F000000
-
-#define TCORE_PLUGIN_DEFAULT   "default"
-
-#endif /* __TYPE_COMMON_H__ */
+#define TCORE_REQUEST        0x10000000
+#define TCORE_RESPONSE       0x20000000
+#define TCORE_NOTIFICATION   0x30000000
+#define TCORE_RETURN         0x40000000
+#define TCORE_3GPP_RETURN    0x50000000
+
+#define TCORE_TYPE_DEFAULT   0x00100000
+#define TCORE_TYPE_SERVER    0x00200000
+#define TCORE_TYPE_MODEM     0x00300000
+#define TCORE_TYPE_PENDING   0x00400000
+#define TCORE_TYPE_HOOK      0x00500000
+#define TCORE_TYPE_CALL      0x01000000
+#define TCORE_TYPE_NETWORK   0x01100000
+#define TCORE_TYPE_PS        0x01200000
+#define TCORE_TYPE_PDP       0x01300000
+#define TCORE_TYPE_SIM       0x01400000
+#define TCORE_TYPE_SAT       0x01500000
+#define TCORE_TYPE_SAP       0x01600000
+#define TCORE_TYPE_SMS       0x01700000
+#define TCORE_TYPE_PHONEBOOK 0x01800000
+#define TCORE_TYPE_SS        0x01900000
+#define TCORE_TYPE_SOUND     0x01A00000
+#define TCORE_TYPE_GPS       0x01B00000
+#define TCORE_TYPE_CUSTOM    0x0F000000
+
+#define TCORE_PLUGIN_DEFAULT "default"
+
+
+__BEGIN_DECLS
+
+enum tcore_return {
+       TCORE_RETURN_SUCCESS = 0,
+       TCORE_RETURN_FAILURE = -1,
+       TCORE_RETURN_OPERATION_ABORTED = 1, /**< Operation Aborted */
+       TCORE_RETURN_ENOENT = ENOENT, /* No such file or directory */
+       TCORE_RETURN_EPERM = EPERM, /* Operation not permitted */
+       TCORE_RETURN_ENOMEM = ENOMEM, /* Out of memory */
+       TCORE_RETURN_EAGAIN = EAGAIN, /* Try again */
+       TCORE_RETURN_EINVAL = EINVAL, /* Invalid argument */
+       TCORE_RETURN_ENOSYS = ENOSYS, /* Function not implemented */
+       TCORE_RETURN_EALREADY = EALREADY, /* Operation already in progress */
+       TCORE_RETURN_ETIMEDOUT = ETIMEDOUT, /* Connection timed out */
+       TCORE_RETURN_EMSGSIZE = EMSGSIZE, /* Message too long */
+       TCORE_RETURN_ENODATA = ENODATA, /* No data available */
+
+       TCORE_RETURN_SERVER_WRONG_PLUGIN = TCORE_RETURN | TCORE_TYPE_SERVER,
+
+       TCORE_RETURN_PENDING_WRONG_ID = TCORE_RETURN | TCORE_TYPE_PENDING,
+
+       TCORE_RETURN_PS_NETWORK_NOT_READY = TCORE_RETURN | TCORE_TYPE_PS,
+       TCORE_RETURN_PS_CID_ERROR,
+       TCORE_RETURN_PS_ACTIVATING,
+       TCORE_RETURN_PS_ALREADY_ACTIVATED,
+       TCORE_RETURN_PS_DEACTIVATING,
+
+       TCORE_RETURN_HOOK_STOP = TCORE_RETURN | TCORE_TYPE_HOOK,
+
+       TCORE_RETURN_SIM = TCORE_RETURN | TCORE_TYPE_SIM,
+       TCORE_RETURN_SIM_DISABLED_IN_SST, /* feature in sst is disabled */
+
+       /* NETTEXT */
+       TCORE_RETURN_SMS = TCORE_RETURN | TCORE_TYPE_SMS,
+       TCORE_RETURN_SMS_DEVICE_NOT_READY, /**<Nettext device not ready */
+       TCORE_RETURN_SMS_SCADDR_NOT_SET, /**<Nettext SCA address not set */
+       TCORE_RETURN_SMS_INVALID_DATA_LEN, /**<Nettext Invalid data length */
+       TCORE_RETURN_SMS_SCADDRESS_NOT_SET, /**<Nettext SCA address not set*/
+
+       TCORE_RETURN_3GPP_ERROR = TCORE_3GPP_RETURN, /**< TCORE_3GPP_RETURN + (0x0000 ~ 0x7FFF) */
+       TCORE_RETURN_3GPP_PLMN_NOT_ALLOWED,    /* 3GPP error cause 11*/
+       TCORE_RETURN_3GPP_ROAMING_NOT_ALLOWED, /* 3GPP error cause 13 */
+
+       TCORE_RETURN_UNKNOWN = TCORE_RETURN | 0x0FFFFFFF
+};
+
+typedef enum tcore_return TReturn;
+
+__END_DECLS
+
+#endif
diff --git a/include/type/gps.h b/include/type/gps.h
new file mode 100644 (file)
index 0000000..352775e
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_GPS_H__
+#define __TYPE_GPS_H__
+
+__BEGIN_DECLS
+
+#define SMART_ASSISTANT_AREA_LIST_MAX 10
+
+struct tel_smart_assistant_area {
+       unsigned short index;
+       unsigned char mode_state;
+};
+
+struct tel_smart_assistant_area_list {
+       unsigned char count;
+       struct tel_smart_assistant_area area[SMART_ASSISTANT_AREA_LIST_MAX];
+};
+
+struct treq_gps_set_frequency_aiding {
+       unsigned char enable;
+};
+
+struct treq_set_smart_assistant_info {
+       unsigned short index;
+       unsigned char lpp_state;
+};
+
+struct tresp_gps_set_frequency_aiding {
+       TReturn result;
+};
+
+struct tresp_smart_assistant_result {
+       TReturn result;
+};
+
+struct tnoti_gps_frequency_aiding {
+       unsigned char lock_status;
+       unsigned char afc_update;
+};
+
+struct tnoti_smart_assistant_area_status {
+       unsigned char area_status;
+       unsigned short index;
+};
+
+struct tnoti_smart_assistant_sync_status {
+       unsigned char init_status;
+       unsigned char init_fail_cause;
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/type/modem.h b/include/type/modem.h
new file mode 100644 (file)
index 0000000..c7584a5
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_MODEM_H__
+#define __TYPE_MODEM_H__
+
+__BEGIN_DECLS
+
+#define MODEM_DEVICE_SN_LEN_MAX 13
+#define MODEM_DEVICE_MEID_LEN_MAX 17
+#define MODEM_DEVICE_IMEI_LEN_MAX 17
+#define MODEM_DEVICE_IMEISV_LEN_MAX 17
+
+enum modem_state {
+       MODEM_STATE_UNKNOWN = -1,
+       MODEM_STATE_ONLINE = 0,
+       MODEM_STATE_OFFLINE,
+       MODEM_STATE_RESET,
+       MODEM_STATE_LOW,
+       MODEM_STATE_MAX = MODEM_STATE_LOW,
+
+       /* internal states (not to be published) */
+       MODEM_STATE_ERROR,
+       MODEM_STATE_RESUME
+};
+
+enum modem_dun_pincontrol_signal {
+       DUN_PINCONTROL_SIGNAL_DCD = 0x01,
+       DUN_PINCONTROL_SIGNAL_DTR = 0x04,
+       DUN_PINCONTROL_SIGNAL_DSR = 0x06,
+       DUN_PINCONTROL_SIGNAL_RTS = 0x07,
+       DUN_PINCONTROL_SIGNAL_CTS = 0x08,
+       DUN_PINCONTROL_SIGNAL_RI = 0x09
+};
+
+enum modem_dun_pincontrol_status {
+       DUN_PINCONTROL_STATUS_OFF = 0x00,
+       DUN_PINCONTROL_STATUS_ON = 0x01,
+};
+
+struct treq_modem_power_on {
+};
+
+struct treq_modem_power_off {
+};
+
+struct treq_modem_power_reset {
+};
+
+struct treq_modem_power_low {
+};
+
+struct treq_modem_set_flightmode {
+       int enable;
+};
+
+struct treq_modem_get_flightmode {
+};
+
+struct treq_modem_get_imei {
+};
+
+struct treq_modem_get_version {
+};
+
+struct treq_modem_get_sn {
+};
+
+struct treq_modem_set_dun_pin_control {
+       enum modem_dun_pincontrol_signal signal;
+       enum modem_dun_pincontrol_status status;
+};
+
+
+struct tresp_modem_power_on {
+       TReturn result;
+};
+
+struct tresp_modem_power_off {
+       TReturn result;
+};
+
+struct tresp_modem_power_reset {
+       TReturn result;
+};
+
+struct tresp_modem_power_low {
+       TReturn result;
+};
+
+struct tresp_modem_set_flightmode {
+       TReturn result;
+};
+
+struct tresp_modem_get_flightmode {
+       TReturn result;
+       int enable;
+};
+
+struct tresp_modem_get_imei {
+       TReturn result;
+       char imei[MODEM_DEVICE_IMEI_LEN_MAX];
+};
+
+struct tresp_modem_get_version {
+       TReturn result;
+       char software[33];
+       char hardware[33];
+       char calibration[33];
+       char product_code[33];
+       char prl_version[18];
+       char eri_version[18];
+};
+
+struct tresp_modem_get_sn {
+       TReturn result;
+       char sn[MODEM_DEVICE_SN_LEN_MAX];
+       char meid[MODEM_DEVICE_MEID_LEN_MAX];
+       char imei[MODEM_DEVICE_IMEI_LEN_MAX];
+       char imeisv[MODEM_DEVICE_IMEISV_LEN_MAX];
+};
+
+struct tresp_modem_set_dun_pin_control {
+       int result;
+};
+
+struct tnoti_modem_power {
+       enum modem_state state;
+};
+
+struct tnoti_modem_flight_mode {
+       int enable;
+};
+
+struct tnoti_modem_dun_pin_control {
+       enum modem_dun_pincontrol_signal signal;
+       enum modem_dun_pincontrol_status status;
+};
+
+struct tnoti_modem_dun_external_call {
+};
+
+struct tnoti_modem_bootup {
+       void *plugin;
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/type/network.h b/include/type/network.h
new file mode 100644 (file)
index 0000000..a1aff1a
--- /dev/null
@@ -0,0 +1,591 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_NETWORK_H__
+#define __TYPE_NETWORK_H__
+
+__BEGIN_DECLS
+
+#define NETWORK_GERAN_NEIGHBORING_CELL_LIST_MAX 6              /**<    max count of GERAN neighboring cell list        */
+#define NETWORK_UMTS_NEIGHBORING_CELL_LIST_MAX 24              /**<    max count of UMTS neighboring cell list         */
+
+#define NETWORK_CDMA_SUBSCRIPTION_MCC_MAX 4
+#define NETWORK_CDMA_SUBSCRIPTION_MNC_MAX 4
+#define NETWORK_CDMA_SUBSCRIPTION_MIN_MAX 11
+#define NETWORK_CDMA_SUBSCRIPTION_MDN_MAX 16
+
+#define NETWORK_MODE_AUTO  0x00
+#define NETWORK_MODE_GSM   0x01
+#define NETWORK_MODE_WCDMA 0x02
+#define NETWORK_MODE_1XRTT 0x04
+#define NETWORK_MODE_LTE   0x08
+#define NETWORK_MODE_EVDO  0x10
+#define NETWORK_MODE_CDMA  (NETWORK_MODE_1XRTT | NETWORK_MODE_EVDO)
+
+#define NETWORK_RESTRICTED_STATE_NONE           0x00 /* No restriction at all including voice/SMS/USSD/SS/AV64 and packet data. */
+#define NETWORK_RESTRICTED_STATE_CS_EMERGENCY   0x01 /* Block emergency call due to restriction. But allow all normal voice/SMS/USSD/SS/AV64. */
+#define NETWORK_RESTRICTED_STATE_CS_NORMAL      0x02 /* Block all normal voice/SMS/USSD/SS/AV64 due to restriction. Only Emergency call allowed. */
+#define NETWORK_RESTRICTED_STATE_CS_ALL         0x04 /* Block all voice/SMS/USSD/SS/AV64 including emergency call due to restriction.*/
+#define NETWORK_RESTRICTED_STATE_PS_ALL         0x10 /* Block packet data access due to restriction. */
+
+enum telephony_network_select_mode {
+       NETWORK_SELECT_MODE_AUTOMATIC = 0x01, /**< Automation Network Selection Mode */
+       NETWORK_SELECT_MODE_MANUAL = 0x02 /**< Manual Network Selection Mode - Not applicable to 3GPP2 */
+};
+
+/* 3GPP2 spcefic */
+enum telephony_network_emergency_callback_mode {
+       NETWORK_EMERGENCY_CALLBACK_MODE_ENTER,                  /**< Enter emergency callback mode */
+       NETWORK_EMERGENCY_CALLBACK_MODE_EXIT,                   /**< Exit emergency callback mode */
+       NETWORK_EMERGENCY_CALLBACK_MODE_READY                   /**< Ready Emergency Callback mode for preparing */
+};
+
+enum telephony_network_plmn_status {
+       NETWORK_PLMN_UNKNOWN,
+       NETWORK_PLMN_CURRENT,
+       NETWORK_PLMN_AVAILABLE,
+       NETWORK_PLMN_FORBIDDEN
+};
+
+enum telephony_network_service_domain {
+       NETWORK_SERVICE_DOMAIN_COMBINED = 0x01,
+       NETWORK_SERVICE_DOMAIN_CS,
+       NETWORK_SERVICE_DOMAIN_PS,
+       NETWORK_SERVICE_DOMAIN_AUTOMATIC
+};
+
+enum telephony_network_roaming_preference {
+    NETWORK_PREF_NET_TYPE_HOME_ONLY = 0x0,
+    NETWORK_PREF_NET_TYPE_AFFILIATED,
+    NETWORK_PREF_NET_TYPE_AUTOMATIC,
+    NETWORK_PREF_NET_TYPE_AUTOMATIC_A,
+    NETWORK_PREF_NET_TYPE_AUTOMATIC_B,
+    NETWORK_PREF_NET_TYPE_ROAM_DOMESTIC,
+    NETWORK_PREF_NET_TYPE_ROAM_INTERNATIONAL,
+    NETWORK_PREF_NET_TYPE_ROAM_DUAL,
+    NETWORK_PREF_NET_TYPE_BLANK,
+};
+
+enum telephony_network_service_domain_status {
+       NETWORK_SERVICE_DOMAIN_STATUS_NO = 0x0,
+       NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY,
+       NETWORK_SERVICE_DOMAIN_STATUS_FULL,
+       NETWORK_SERVICE_DOMAIN_STATUS_SEARCH
+};
+
+enum telephony_network_service_type {
+       NETWORK_SERVICE_TYPE_UNKNOWN = 0x0,
+       NETWORK_SERVICE_TYPE_NO_SERVICE,
+       NETWORK_SERVICE_TYPE_EMERGENCY,
+       NETWORK_SERVICE_TYPE_SEARCH,
+       NETWORK_SERVICE_TYPE_2G,
+       NETWORK_SERVICE_TYPE_2_5G,
+       NETWORK_SERVICE_TYPE_2_5G_EDGE,
+       NETWORK_SERVICE_TYPE_3G,
+       NETWORK_SERVICE_TYPE_HSDPA,
+       NETWORK_SERVICE_TYPE_LTE
+};
+
+enum telephony_network_subscription {
+       NETWORK_SUBSCRIPTION_PRIMARY,
+       NETWORK_SUBSCRIPTION_SECONDARY,
+       NETWORK_SUBSCRIPTION_TERTIARY,
+       NETWORK_SUBSCRIPTION_MAX = 0xFF
+};
+
+enum telephony_network_access_technology {
+       NETWORK_ACT_UNKNOWN = 0x0,
+       NETWORK_ACT_GSM = 0x1,
+       NETWORK_ACT_GPRS,
+       NETWORK_ACT_EGPRS,
+       NETWORK_ACT_UMTS = 0x4,
+       NETWORK_ACT_UTRAN = 0x4,
+       NETWORK_ACT_GSM_UTRAN,
+       NETWORK_ACT_IS95A = 0x11,
+       NETWORK_ACT_IS95B,
+       NETWORK_ACT_CDMA_1X,
+       NETWORK_ACT_EVDO_REV0,
+       NETWORK_ACT_CDMA_1X_EVDO_REV0,
+       NETWORK_ACT_EVDO_REVA,
+       NETWORK_ACT_CDMA_1X_EVDO_REVA,
+       NETWORK_ACT_EVDO_REVB,
+       NETWORK_ACT_CDMA_1X_EVDO_REVB,
+       NETWORK_ACT_EVDV,
+       NETWORK_ACT_EHRPD,
+       NETWORK_ACT_LTE = 0x21,
+       NETWORK_ACT_NOT_SPECIFIED = 0xFF
+};
+
+enum telephony_network_band_mode {
+       NETWORK_BAND_MODE_PREFERRED = 0x01,
+       NETWORK_BAND_MODE_ONLY = 0x02
+};
+
+enum telephony_network_band {
+       NETWORK_BAND_TYPE_ANY = 0x00,
+       NETWORK_BAND_TYPE_GSM850,
+       NETWORK_BAND_TYPE_GSM_900_1800,
+       NETWORK_BAND_TYPE_GSM1900,
+       NETWORK_BAND_TYPE_GSM,
+       NETWORK_BAND_TYPE_WCDMA,
+       NETWORK_BAND_TYPE_WCDMA850,
+       NETWORK_BAND_TYPE_WCDMA1900,
+       NETWORK_BAND_TYPE_WCDMA2100,
+       NETWORK_BAND_TYPE_GSM900,
+       NETWORK_BAND_TYPE_GSM1800,
+       NETWORK_BAND_TYPE_GSM_850_1900,
+       NETWORK_BAND_TYPE_LTE_BAND_4,
+       NETWORK_BAND_TYPE_LTE_BAND_17
+};
+
+enum telephony_network_preferred_plmn_operation {
+       NETWORK_PREF_PLMN_ADD = 0x01,
+       NETWORK_PREF_PLMN_EDIT,
+       NETWORK_PREF_PLMN_DELETE
+};
+
+enum telephony_network_acquisition_order {
+       NETWORK_ORDER_AUTO = 0x01,
+       NETWORK_ORDER_GSM_FIRST = 0x02,
+       NETWORK_ORDER_WCDMA_FIRST = 0x03,
+       NETWORK_ORDER_NO_CHANGE = 0x04,
+       NETWORK_ORDER_LTE_FIRST = 0x05,
+       NETWORK_ORDER_CDMA_1X_FIRST = 0x06,
+       NETWORK_ORDER_CDMA_1XEVDO_FIRST = 0x07
+};
+
+enum telephony_network_icon_info_type {
+       NETWORK_ICON_INFO_RSSI = 0x01,
+       NETWORK_ICON_INFO_BATTERY = 0x02,
+       NETWORK_ICON_INFO_HDR_RSSI = 0x04,
+       NETWORK_ICON_INFO_ROAM_ICON_MODE = 0x8,
+       NETWORK_ICON_INFO_ALL = 0xFF
+};
+
+enum telephony_network_mm_info_type {
+       NETWORK_MM_INFO_CS = 0x0,
+       NETWORK_MM_INFO_PS = 0x1,
+};
+
+enum telephony_network_name_option {
+       NETWORK_NAME_OPTION_NONE,
+       NETWORK_NAME_OPTION_SPN,
+       NETWORK_NAME_OPTION_OPERATOR,
+       NETWORK_NAME_OPTION_ANY
+};
+
+enum telephony_network_default_data_subs {
+       NETWORK_DEFAULT_DATA_SUBS_UNKNOWN = -1,  /*  Unknown status */
+       NETWORK_DEFAULT_DATA_SUBS_SIM1 = 0, /* SIM 1 */
+       NETWORK_DEFAULT_DATA_SUBS_SIM2 /*  SIM 2 */
+};
+
+enum telephony_network_default_subs {
+       NETWORK_DEFAULT_SUBS_UNKNOWN = -1,  /**<  Unknown status **/
+       NETWORK_DEFAULT_SUBS_SIM1 = 0, /**< SIM 1 network **/
+       NETWORK_DEFAULT_SUBS_SIM2 /**<  SIM 2 network **/
+};
+
+enum telephony_network_ims_voice_status {
+       NETWORK_IMS_VOICE_UNKNOWN = -1,
+       NETWORK_IMS_VOICE_NOT_SUPPORT = 0,
+       NETWORK_IMS_VOICE_SUPPORT
+};
+
+struct tel_network_geran_cell_info {
+       int cell_id;    /* Cell ID (-1 indicates cell ID information not present)*/
+       int lac;                /* Location area code (this field is ignored when cell_id not present)*/
+       int bcch;               /* Broadcast Control Channel Frequency number */
+       int bsic;               /* Base Station Identification Code  */
+       int rxlev;              /* Received Signal Strength level. Valid values are (0-63, 99) */
+};
+
+struct tel_network_umts_cell_info {
+       int cell_id;    /* UCID (-1 indicates cell ID information not present)*/
+       int lac;                /* Location area code (this field is ignored when cell_id not present)*/
+       int arfcn;              /* UTRA Absolute RF Channel Number */
+       int psc;                /* Primary scrambling Code      */
+       int rscp;               /* Received Signal Code Power.  Valid values are (0-96, 255) */
+};
+
+struct tel_network_lte_cell_info {
+       int cell_id;    /* Cell ID (-1 indicates cell ID information not present)*/
+       int lac;                /* Location area code (this field is ignored when cell_id not present)*/
+       int earfcn;             /* E-UTRA Absolute RF Channel Number */
+       int tac;                /* Tracking area code   */
+       int rssi;               /* RSSI in dBm (signed) */
+};
+
+struct tel_network_cdma_cell_info {
+       unsigned short sid;     /**<   System ID. */
+       unsigned short nid;     /**<   Network ID. */
+       unsigned short base_id; /**<   Base station ID. */
+       unsigned short refpn;    /**<   Reference PN. */
+       unsigned int base_lat; /**<   Latitude of the current base station */
+       unsigned int base_long; /**<   Longitude of the current base station */
+};
+
+struct tel_network_serving_cell_info {
+       enum telephony_network_access_technology act;
+       int mcc;
+       int mnc;
+       union {
+               struct tel_network_geran_cell_info geran;
+               struct tel_network_umts_cell_info umts;
+               struct tel_network_lte_cell_info lte;
+               struct tel_network_cdma_cell_info cdma;
+       }cell;
+};
+
+struct tel_network_neighboring_cell_info {
+       struct tel_network_serving_cell_info serving;
+       int geran_list_count;
+       struct tel_network_geran_cell_info geran_list[NETWORK_GERAN_NEIGHBORING_CELL_LIST_MAX];
+       int umts_list_count;
+       struct tel_network_umts_cell_info umts_list[NETWORK_UMTS_NEIGHBORING_CELL_LIST_MAX];
+};
+
+
+struct treq_network_search { /* no data */
+};
+struct treq_network_set_plmn_selection_mode {
+       enum telephony_network_select_mode mode;
+       char plmn[7];
+       enum telephony_network_access_technology act;
+};
+struct treq_network_get_plmn_selection_mode { /* no data */
+};
+struct treq_network_set_service_domain {
+       enum telephony_network_service_domain domain;
+};
+struct treq_network_get_service_domain { /* no data */
+};
+struct treq_network_set_band {
+       enum telephony_network_band_mode mode;
+       enum telephony_network_band band;
+};
+struct treq_network_get_band { /* no data */
+};
+struct treq_network_set_preferred_plmn {
+       enum telephony_network_preferred_plmn_operation operation;
+       char plmn[7];
+       enum telephony_network_access_technology act;
+       int ef_index;
+};
+struct treq_network_get_preferred_plmn { /* no data */
+};
+struct treq_network_set_order {
+       enum telephony_network_acquisition_order order;
+};
+struct treq_network_get_order { /* no data */
+};
+struct treq_network_set_power_on_attach {
+       int enable;
+};
+struct treq_network_get_power_on_attach { /* no data */
+};
+struct treq_network_set_cancel_manual_search { /* no data */
+};
+struct treq_network_get_serving_network { /* no data */
+};
+struct treq_network_set_mode {
+       int mode;
+};
+struct treq_network_get_mode { /* no data */
+};
+struct treq_network_set_neighboring_cell_info {
+       int enable;
+};
+struct treq_network_get_neighboring_cell_info { /* no data */
+};
+
+/* 3GPP2 spcefic */
+struct treq_network_set_emergency_callback_mode {
+       enum telephony_network_emergency_callback_mode mode;
+};
+struct treq_network_set_roaming_preference {
+       enum telephony_network_roaming_preference roam_pref;
+};
+struct treq_network_get_roaming_preference { /* no data */
+};
+
+struct treq_network_get_subscription_info { /* no data */
+};
+struct treq_network_set_default_data_subscription { /* no data */
+};
+struct treq_network_get_default_data_subscription { /* no data */
+};
+struct treq_network_set_default_subscription {
+       enum telephony_network_default_subs default_subs;
+};
+struct treq_network_get_default_subscription { /* no data */
+};
+
+
+struct tresp_network_search {
+       TReturn result;
+       int list_count;
+       struct {
+               enum telephony_network_plmn_status  status;
+               char name[41];
+               char plmn[7];
+               enum telephony_network_access_technology act;
+               unsigned int lac;
+               unsigned int rac;
+               unsigned int cell_id;
+               unsigned int tac;
+       } list[20];
+};
+
+struct tresp_network_set_plmn_selection_mode {
+       TReturn result;
+};
+
+struct tresp_network_get_plmn_selection_mode {
+       TReturn result;
+       enum telephony_network_select_mode mode;
+};
+
+struct tresp_network_set_service_domain {
+       TReturn result;
+};
+
+struct tresp_network_get_service_domain {
+       TReturn result;
+       enum telephony_network_service_domain domain;
+};
+
+struct tresp_network_set_band {
+       TReturn result;
+};
+
+struct tresp_network_get_band {
+       TReturn result;
+       enum telephony_network_band_mode mode;
+       enum telephony_network_band band;
+};
+
+struct tresp_network_set_preferred_plmn {
+       TReturn result;
+};
+
+struct tresp_network_get_preferred_plmn {
+       TReturn result;
+       int list_count;
+       struct {
+               int ef_index;
+               char name[41];
+               char plmn[7];
+               enum telephony_network_access_technology act;
+               unsigned int lac;
+       } list[150];
+};
+
+struct tresp_network_set_order {
+       TReturn result;
+};
+
+struct tresp_network_get_order {
+       TReturn result;
+       enum telephony_network_acquisition_order order;
+};
+
+struct tresp_network_set_power_on_attach {
+       TReturn result;
+};
+
+struct tresp_network_get_power_on_attach {
+       TReturn result;
+       int enabled;
+};
+
+struct tresp_network_set_cancel_manual_search {
+       TReturn result;
+};
+
+struct tresp_network_get_serving_network {
+       TReturn result;
+       char plmn[7];
+       enum telephony_network_access_technology act;
+       struct {
+               unsigned int lac;
+       } gsm;
+       struct {
+               int carrier;
+               int sid;
+               int nid;
+               int bs_id;
+               int bs_lat;
+               int bs_long;
+               int reg_zone;
+               int pilot_pn;
+       } cdma;
+};
+
+struct tresp_network_set_mode {
+       TReturn result;
+};
+
+struct tresp_network_get_mode {
+       TReturn result;
+       int mode;
+};
+
+struct tresp_network_set_neighboring_cell_info {
+       TReturn result;
+};
+
+struct tresp_network_get_neighboring_cell_info {
+       TReturn result;
+       struct tel_network_neighboring_cell_info info;
+};
+
+/* 3GPP2 spcefic */
+struct tresp_network_set_emergency_callback_mode {
+       TReturn result;
+};
+
+struct tresp_network_set_roaming_preference {
+       TReturn result;
+};
+
+struct tresp_network_get_roaming_preference {
+       TReturn result;
+       enum telephony_network_roaming_preference roam_pref;
+};
+
+struct tresp_network_get_subscription_info {
+       TReturn result;
+       char mcc[NETWORK_CDMA_SUBSCRIPTION_MCC_MAX];
+       char mnc[NETWORK_CDMA_SUBSCRIPTION_MNC_MAX];
+       char min[NETWORK_CDMA_SUBSCRIPTION_MIN_MAX];
+       char mdn[NETWORK_CDMA_SUBSCRIPTION_MDN_MAX];
+};
+
+struct tresp_network_set_default_data_subscription {
+       TReturn result;
+};
+
+struct tresp_network_get_default_data_subs {
+       TReturn result;
+       enum telephony_network_default_data_subs default_subs; /* 'default' Data Subscription */
+};
+
+struct tresp_network_set_default_subs {
+       TReturn result;
+};
+
+struct tresp_network_get_default_subs {
+       TReturn result;
+       enum telephony_network_default_subs default_subs; /* 'default' Subscription */
+};
+
+struct tnoti_network_registration_status {
+       enum telephony_network_service_domain_status cs_domain_status;
+       enum telephony_network_service_domain_status ps_domain_status;
+       enum telephony_network_service_type service_type;
+       int roaming_status;
+};
+
+struct tnoti_network_location_cellinfo {
+       unsigned int lac;
+       unsigned int cell_id;
+};
+
+struct tnoti_network_icon_info {
+       enum telephony_network_icon_info_type type;
+       int rssi;
+       int battery;
+       int hdr_rssi;
+       int roam_icon_mode;
+};
+
+struct tnoti_network_signal_strength {
+       int dbm;
+};
+
+struct tnoti_network_change {
+       char plmn[7];
+       enum telephony_network_access_technology act;
+       struct {
+               unsigned int lac;
+       } gsm;
+       struct {
+               int carrier;
+               int sid;
+               int nid;
+               int bs_id;
+               int bs_lat;
+               int bs_long;
+               int reg_zone;
+               int pilot_pn;
+       } cdma;
+};
+
+struct tnoti_network_timeinfo {
+       unsigned int year;
+       unsigned int month;
+       unsigned int day;
+       unsigned int hour;
+       unsigned int minute;
+       unsigned int second;
+       unsigned int wday;
+       int gmtoff;
+       int dstoff;
+       unsigned int isdst;
+       char plmn[7];
+       enum telephony_network_mm_info_type mm_type;
+};
+
+struct tnoti_network_identity {
+       char short_name[17];
+       char full_name[33];
+       char plmn[7];
+};
+
+struct tnoti_network_neighboring_cell_info {
+       struct tel_network_neighboring_cell_info info;
+};
+
+struct tnoti_network_restricted_state {
+       int restricted_state;
+};
+
+struct tnoti_network_default_data_subs {
+       enum telephony_network_default_data_subs default_subs; /* 'default' Data Subscription */
+};
+
+struct tnoti_network_default_subs {
+       enum telephony_network_default_subs default_subs; /* 'default' Subscription */
+};
+
+/* 3GPP2 spcefic */
+struct tnoti_network_emergency_callback_mode {
+       enum telephony_network_emergency_callback_mode mode;
+};
+
+struct tnoti_network_ims_voice_status {
+       enum telephony_network_ims_voice_status status;
+};
+
+
+__END_DECLS
+
+#endif
index 7cd591a..941d8e2 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <type/common.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-       TCORE_SERVER_NOTIFICATION_UNKNOWN = 0,
-
-       TCORE_SERVER_NOTIFICATION = TCORE_NOTIFICATION | TCORE_TYPE_SERVER,
-       TCORE_SERVER_NOTIFICATION_SERVER_RUN,
-       TCORE_SERVER_NOTIFICATION_ADDED_PLUGIN,
-       TCORE_SERVER_NOTIFICATION_REMOVED_PLUGIN,
-       TCORE_SERVER_NOTIFICATION_ADDED_COMMUNICATOR,
-       TCORE_SERVER_NOTIFICATION_REMOVED_COMMUNICATOR,
-       TCORE_SERVER_NOTIFICATION_ADDED_HAL,
-       TCORE_SERVER_NOTIFICATION_REMOVED_HAL,
-       TCORE_SERVER_NOTIFICATION_ADDED_STORAGE,
-       TCORE_SERVER_NOTIFICATION_REMOVED_STORAGE,
-       TCORE_SERVER_NOTIFICATION_ADDED_MODEM_PLUGIN,
-       TCORE_SERVER_NOTIFICATION_REMOVED_MODEM_PLUGIN,
-       TCORE_SERVER_NOTIFICATION_EXIT,
-       TCORE_SERVER_NOTIFICATION_MODEM_ERR
-} TcoreServerNotification;
-
-typedef enum {
-       TCORE_NOTIFICATION_UNKNOWN = 0,
-
-       TCORE_NOTIFICATION_CALL = TCORE_NOTIFICATION | TCORE_TYPE_CALL,
-       TCORE_NOTIFICATION_CALL_STATUS_IDLE,
-       TCORE_NOTIFICATION_CALL_STATUS_ACTIVE,
-       TCORE_NOTIFICATION_CALL_STATUS_HELD,
-       TCORE_NOTIFICATION_CALL_STATUS_DIALING,
-       TCORE_NOTIFICATION_CALL_STATUS_ALERT,
-       TCORE_NOTIFICATION_CALL_STATUS_INCOMING,
-       TCORE_NOTIFICATION_VIDEO_CALL_STATUS_IDLE,
-       TCORE_NOTIFICATION_VIDEO_CALL_STATUS_ACTIVE,
-       TCORE_NOTIFICATION_VIDEO_CALL_STATUS_DIALING,
-       TCORE_NOTIFICATION_VIDEO_CALL_STATUS_ALERT,
-       TCORE_NOTIFICATION_VIDEO_CALL_STATUS_INCOMING,
-       TCORE_NOTIFICATION_CALL_INFO_HELD,
-       TCORE_NOTIFICATION_CALL_INFO_ACTIVE,
-       TCORE_NOTIFICATION_CALL_INFO_JOINED,
-       TCORE_NOTIFICATION_CALL_INFO_MO_FORWARD_UNCONDITIONAL,
-       TCORE_NOTIFICATION_CALL_INFO_MO_FORWARD_CONDITIONAL,
-       TCORE_NOTIFICATION_CALL_INFO_MO_FORWARDED,
-       TCORE_NOTIFICATION_CALL_INFO_MO_WAITING,
-       TCORE_NOTIFICATION_CALL_INFO_MO_BARRED_OUTGOING,
-       TCORE_NOTIFICATION_CALL_INFO_MO_BARRED_INCOMING,
-       TCORE_NOTIFICATION_CALL_INFO_MO_DEFLECTED,
-       TCORE_NOTIFICATION_CALL_INFO_MT_FORWARDED,
-       TCORE_NOTIFICATION_CALL_INFO_MT_DEFLECTED,
-       TCORE_NOTIFICATION_CALL_INFO_TRANSFERED,
-       TCORE_NOTIFICATION_CALL_SOUND_RINGBACK_TONE,
-       TCORE_NOTIFICATION_CALL_SOUND_WBAMR,
-       TCORE_NOTIFICATION_CALL_SOUND_EQUALIZATION,
-       TCORE_NOTIFICATION_CALL_SOUND_CLOCK_STATUS,
-
-       TCORE_NOTIFICATION_SS = TCORE_NOTIFICATION | TCORE_TYPE_SS,
-       TCORE_NOTIFICATION_SS_INFO,
-       TCORE_NOTIFICATION_SS_USSD,
-
-       TCORE_NOTIFICATION_MODEM = TCORE_NOTIFICATION | TCORE_TYPE_MODEM,
-       TCORE_NOTIFICATION_MODEM_POWER,
-       TCORE_NOTIFICATION_MODEM_FLIGHT_MODE,
-
-       TCORE_NOTIFICATION_SIM = TCORE_NOTIFICATION | TCORE_TYPE_SIM,
-       TCORE_NOTIFICATION_SIM_TYPE,
-       TCORE_NOTIFICATION_SIM_STATUS,
-
-       TCORE_NOTIFICATION_SAT = TCORE_NOTIFICATION | TCORE_TYPE_SAT,
-       TCORE_NOTIFICATION_SAT_PROACTIVE_CMD,
-       TCORE_NOTIFICATION_SAT_SESSION_END,
-       TCORE_NOTIFICATION_SAT_CALL_CTRL_RESULT,
-       TCORE_NOTIFICATION_SAT_MO_SM_CTRL_RESULT,
-
-       TCORE_NOTIFICATION_SAP = TCORE_NOTIFICATION | TCORE_TYPE_SAP,
-       TCORE_NOTIFICATION_SAP_STATUS,
-
-       TCORE_NOTIFICATION_NETWORK = TCORE_NOTIFICATION | TCORE_TYPE_NETWORK,
-       TCORE_NOTIFICATION_NETWORK_REGISTRATION_STATUS,
-       TCORE_NOTIFICATION_NETWORK_LOCATION_CELLINFO,
-       TCORE_NOTIFICATION_NETWORK_RSSI,
-       TCORE_NOTIFICATION_NETWORK_TIMEINFO,
-       TCORE_NOTIFICATION_NETWORK_IDENTITY,
-
-       TCORE_NOTIFICATION_PS = TCORE_NOTIFICATION | TCORE_TYPE_PS,
-       TCORE_NOTIFICATION_PS_CALL_STATUS,
-       TCORE_NOTIFICATION_PS_IPCONFIG,
-
-       TCORE_NOTIFICATION_SMS = TCORE_NOTIFICATION | TCORE_TYPE_SMS,
-       TCORE_NOTIFICATION_SMS_INCOM_MSG,                       /* This is an unsolicited Incoming SMS Event*/
-       TCORE_NOTIFICATION_SMS_CB_INCOM_MSG,            /* This is an unsolicited Incoming cell broadcast message*/
-       TCORE_NOTIFICATION_SMS_MEMORY_STATUS,           /* This event is an unsolicited event indicating SIM memory status */
-       TCORE_NOTIFICATION_SMS_DEVICE_READY,            /* Device Ready indication */
-       TCORE_NOTIFICATION_SMS_ETWS_INCOM_MSG,          /* This is an unsolicited Incoming ETWS message*/
-
-       TCORE_NOTIFICATION_PHONEBOOK = TCORE_NOTIFICATION | TCORE_TYPE_PHONEBOOK,
-       TCORE_NOTIFICATION_PHONEBOOK_STATUS,
-
-       TCORE_NOTIFICATION_GPS = TCORE_NOTIFICATION | TCORE_TYPE_GPS,
-       TCORE_NOTIFICATION_GPS_ASSIST_DATA,
-       TCORE_NOTIFICATION_GPS_MEASURE_POSITION,
-       TCORE_NOTIFICATION_GPS_RESET_ASSIST_DATA,
-
-       TCORE_NOTIFICATION_CUSTOM = TCORE_NOTIFICATION | TCORE_TYPE_CUSTOM,
-} TcoreNotification;
-
-#ifdef __cplusplus
-}
-#endif
+__BEGIN_DECLS
+
+enum tcore_notification_command {
+       TNOTI_UNKNOWN = 0,
+
+       TNOTI_SERVER = TCORE_NOTIFICATION | TCORE_TYPE_SERVER,
+       TNOTI_SERVER_RUN,
+       TNOTI_SERVER_ADDED_PLUGIN,
+       TNOTI_SERVER_REMOVED_PLUGIN,
+       TNOTI_SERVER_ADDED_COMMUNICATOR,
+       TNOTI_SERVER_REMOVED_COMMUNICATOR,
+       TNOTI_SERVER_ADDED_HAL,
+       TNOTI_SERVER_REMOVED_HAL,
+       TNOTI_SERVER_ADDED_STORAGE,
+       TNOTI_SERVER_REMOVED_STORAGE,
+       TNOTI_SERVER_ADDED_MODEM_PLUGIN,
+       TNOTI_SERVER_REMOVED_MODEM_PLUGIN,
+       TNOTI_SERVER_ADDED_MODEM_PLUGIN_COMPLETED,
+       TNOTI_SERVER_EXIT,
+
+       TNOTI_CALL = TCORE_NOTIFICATION | TCORE_TYPE_CALL,
+       TNOTI_CALL_STATUS_IDLE,
+       TNOTI_CALL_STATUS_ACTIVE,
+       TNOTI_CALL_STATUS_HELD,
+       TNOTI_CALL_STATUS_DIALING,
+       TNOTI_CALL_STATUS_ALERT,
+       TNOTI_CALL_STATUS_INCOMING,
+       TNOTI_CALL_STATUS_WAITING,
+       TNOTI_CALL_INFO_CALL_CONNECTED_LINE,
+       TNOTI_CALL_INFO_WAITING,
+       TNOTI_CALL_INFO_CUG,
+       TNOTI_CALL_INFO_FORWARDED,
+       TNOTI_CALL_INFO_BARRED_INCOMING,
+       TNOTI_CALL_INFO_BARRED_OUTGOING,
+       TNOTI_CALL_INFO_DEFLECTED,
+       TNOTI_CALL_INFO_CLIR_SUPPRESSION_REJECT,
+       TNOTI_CALL_INFO_FORWARD_UNCONDITIONAL,
+       TNOTI_CALL_INFO_FORWARD_CONDITIONAL,
+       TNOTI_CALL_INFO_CALL_LINE_IDENTITY,
+       TNOTI_CALL_INFO_CALL_NAME_INFORMATION,
+       TNOTI_CALL_INFO_FORWARDED_CALL,
+       TNOTI_CALL_INFO_CUG_CALL,
+       TNOTI_CALL_INFO_DEFLECTED_CALL,
+       TNOTI_CALL_INFO_TRANSFERED_CALL,
+       TNOTI_CALL_INFO_HELD,
+       TNOTI_CALL_INFO_ACTIVE,
+       TNOTI_CALL_INFO_JOINED,
+       TNOTI_CALL_INFO_RELEASED_ON_HOLD,
+       TNOTI_CALL_INFO_TRANSFER_ALERT,
+       TNOTI_CALL_INFO_TRANSFERED,
+       TNOTI_CALL_INFO_CF_CHECK_MESSAGE,
+       TNOTI_CALL_INFO_EXTRA_INFORMATION,
+       TNOTI_CALL_INFO_PRIVACY_MODE,
+       TNOTI_CALL_INFO_REC,
+       TNOTI_CALL_OTASP_STATUS,
+       TNOTI_CALL_OTAPA_STATUS,
+       TNOTI_CALL_SIGNAL_INFO,
+       TNOTI_CALL_SOUND_PATH,
+       TNOTI_CALL_SOUND_RINGBACK_TONE,
+       TNOTI_CALL_SOUND_WBAMR,
+       TNOTI_CALL_SOUND_EQUALIZATION,
+       TNOTI_CALL_SOUND_NOISE_REDUCTION,
+       TNOTI_CALL_SOUND_CLOCK_STATUS,
+       TNOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION,
+       TNOTI_CALL_DISPLAY_INFORMATION,
+       TNOTI_CALL_OTASP_RESULT,
+       TNOTI_CALL_SRVCC_HANDOVER,
+       TNOTI_CALL_MODIFY_REQUEST,
+
+       TNOTI_SS = TCORE_NOTIFICATION | TCORE_TYPE_SS,
+       TNOTI_SS_INFO,
+       TNOTI_SS_USSD,
+       TNOTI_SS_FORWARDING_STATUS,
+       TNOTI_SS_BARRING_STATUS,
+       TNOTI_SS_WAITING_STATUS,
+       TNOTI_SS_RELEASE_COMPLETE,
+
+       TNOTI_MODEM = TCORE_NOTIFICATION | TCORE_TYPE_MODEM,
+       TNOTI_MODEM_POWER,
+       TNOTI_MODEM_FLIGHT_MODE,
+       TNOTI_MODEM_DUN_PIN_CONTROL,
+       TNOTI_MODEM_DUN_EXTERNAL_CALL,
+       TNOTI_MODEM_ADDED,
+       TNOTI_MODEM_BOOTUP,
+
+       TNOTI_SIM = TCORE_NOTIFICATION | TCORE_TYPE_SIM,
+       TNOTI_SIM_STATUS,
+       TNOTI_SIM_REFRESHED,
+       TNOTI_SIM_CALL_FORWARD_STATE,
+
+       TNOTI_SAT = TCORE_NOTIFICATION | TCORE_TYPE_SAT,
+       TNOTI_SAT_PROACTIVE_CMD,
+       TNOTI_SAT_SESSION_END,
+       TNOTI_SAT_CALL_CTRL_RESULT,
+       TNOTI_SAT_MO_SM_CTRL_RESULT,
+
+       TNOTI_SAP = TCORE_NOTIFICATION | TCORE_TYPE_SAP,
+       TNOTI_SAP_STATUS,
+       TNOTI_SAP_DISCONNECT,
+
+       TNOTI_NETWORK = TCORE_NOTIFICATION | TCORE_TYPE_NETWORK,
+       TNOTI_NETWORK_REGISTRATION_STATUS,
+       TNOTI_NETWORK_LOCATION_CELLINFO,
+       TNOTI_NETWORK_ICON_INFO,
+       TNOTI_NETWORK_CHANGE,
+       TNOTI_NETWORK_TIMEINFO,
+       TNOTI_NETWORK_IDENTITY,
+       TNOTI_NETWORK_NEIGHBORING_CELL_INFO,
+       TNOTI_NETWORK_RESTRICTED_STATE,
+       TNOTI_NETWORK_SIGNAL_STRENGTH,
+       TNOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION,
+       TNOTI_NETWORK_DEFAULT_SUBSCRIPTION,
+       TNOTI_NETWORK_EMERGENCY_CALLBACK_MODE,
+       TNOTI_NETWORK_IMS_VOICE_SUPPORT_STATUS,
+
+       TNOTI_PS = TCORE_NOTIFICATION | TCORE_TYPE_PS,
+       TNOTI_PS_CALL_STATUS,
+       TNOTI_PS_CURRENT_SESSION_DATA_COUNTER,
+       TNOTI_PS_PDP_IPCONFIGURATION,
+       TNOTI_PS_DEDICATED_BEARER_INFO,
+       TNOTI_PS_EXTERNAL_CALL,
+       TNOTI_PS_PROTOCOL_STATUS,
+       TNOTI_PS_ALL_PDP_DISCONNECTED,
+
+       TNOTI_SMS = TCORE_NOTIFICATION | TCORE_TYPE_SMS,
+       TNOTI_SMS_INCOM_MSG,                    /* This is an unsolicited Incoming SMS Event*/
+       TNOTI_SMS_CB_INCOM_MSG,         /* This is an unsolicited Incoming cell broadcast message*/
+       TNOTI_SMS_INCOM_EX_MSG,         /* This is an extended unsolicited Incoming SMS Event*/
+       TNOTI_SMS_CB_INCOM_EX_MSG,      /* This is an extended unsolicited Incoming cell broadcast message*/
+       TNOTI_SMS_MEMORY_STATUS,                /* This event is an unsolicited event indicating SIM memory status */
+       TNOTI_SMS_DEVICE_READY,         /* Device Ready indication */
+       TNOTI_SMS_IND_MAX,
+       TNOTI_SMS_ETWS_INCOM_MSG,               /* This is an unsolicited Incoming ETWS message*/
+
+       TNOTI_PHONEBOOK = TCORE_NOTIFICATION | TCORE_TYPE_PHONEBOOK,
+       TNOTI_PHONEBOOK_STATUS,
+
+       TNOTI_GPS = TCORE_NOTIFICATION | TCORE_TYPE_GPS,
+       TNOTI_GPS_ASSIST_DATA,
+       TNOTI_GPS_MEASURE_POSITION,
+       TNOTI_GPS_RESET_ASSIST_DATA,
+       TNOTI_GPS_FREQUENCY_AIDING_DATA,
+       TNOTI_SMART_ASSISTANT_AREA_STATUS,
+       TNOTI_SMART_ASSISTANT_SYNC_STATUS,
+
+       TNOTI_CUSTOM = TCORE_NOTIFICATION | TCORE_TYPE_CUSTOM,
+       TNOTI_CUSTOM_MIP_ERROR,
+};
+
+struct tnoti_server_run {
+};
+
+struct tnoti_server_added_plugin {
+};
+
+struct tnoti_server_removed_plugin {
+};
+
+struct tnoti_server_added_communicator {
+};
+
+struct tnoti_server_removed_communicator {
+};
+
+struct tnoti_server_added_hal {
+};
+
+struct tnoti_server_removed_hal {
+};
+
+struct tnoti_server_added_storage {
+};
+
+struct tnoti_server_removed_storage {
+};
+
+struct tnoti_server_exit {
+};
+
+__END_DECLS
 
 #endif
diff --git a/include/type/phonebook.h b/include/type/phonebook.h
new file mode 100644 (file)
index 0000000..16a8f3b
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_PHONEBOOK_H__
+#define __TYPE_PHONEBOOK_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+#define PHONEBOOK_NAME_BYTE_MAX                256             //Samsung IPC defined
+#define PHONEBOOK_NUMBER_BYTE_MAX      256             //Samsung IPC defined
+#define PHONEBOOK_EMAIL_BYTE_MAX       256             //Samsung IPC defined
+
+enum tel_phonebook_type {
+       PB_TYPE_FDN, /**< Fixed Dialing Number */
+       PB_TYPE_ADN, /**< SIM - ADN      */
+       PB_TYPE_SDN, /**< Service Dialing Number  */
+       PB_TYPE_USIM, /**< USIM - 3G phone book */
+       PB_TYPE_AAS, /**< Additional number Alpha String */
+       PB_TYPE_GAS, /**< Grouping identifier Alpha String */
+       PB_TYPE_UNKNOWNN = 0xFF, /**< Unknown file type */
+};
+
+enum tel_phonebook_field_type {
+       PB_FIELD_NAME = 0x01, /**< Name */
+       PB_FIELD_NUMBER, /**< Number */
+       PB_FIELD_ANR1, /**< First Another number*/
+       PB_FIELD_ANR2, /**< Second Another number */
+       PB_FIELD_ANR3, /**< Third Another number */
+       PB_FIELD_EMAIL1, /**< First Email */
+       PB_FIELD_EMAIL2, /**< Second Email */
+       PB_FIELD_EMAIL3, /**< Third Email */
+       PB_FIELD_EMAIL4, /**< Fourth Email */
+       PB_FIELD_SNE, /**< Second name entry of main name*/
+       PB_FIELD_GRP, /**< Group  */
+       PB_FIELD_PBC, /** <1 byte control info and 1 byte hidden info*/
+};
+
+enum tel_phonebook_result {
+       PB_SUCCESS, /**< SIM phonebook operation successful. */
+       PB_FAIL, /**< SIM phonebook operation failure. */
+       PB_INVALID_INDEX, /**< The index passed was not a valid index. */
+       PB_INVALID_NUMBER_LENGTH, /**< The number length is exceeds the max length allowed (or 0). */
+       PB_INVALID_NAME_LENGTH, /**< The name length is exceeds the max length allowed (or 0). */
+       PB_ACCESS_CONDITION_NOT_SATISFIED, /**< Access condition for PB file is not satisfied. */
+};
+
+enum tel_phonebook_ton {
+       PB_TON_UNKNOWN = 0, /**< unknown */
+       PB_TON_INTERNATIONAL = 1, /**< international number */
+       PB_TON_NATIONAL = 2, /**< national number */
+       PB_TON_NETWORK_SPECIFIC = 3, /**< network specific number */
+       PB_TON_DEDICATED_ACCESS = 4, /**< subscriber number */
+       PB_TON_ALPHA_NUMERIC = 5, /**< alphanumeric, GSM 7-bit default alphabet) */
+       PB_TON_ABBREVIATED_NUMBER = 6, /**< abbreviated number */
+       PB_TON_RESERVED_FOR_EXT = 7 /**< reserved for extension */
+};
+
+enum tel_phonebook_dcs {
+       PB_TEXT_ASCII, /**< ASCII Encoding */
+       PB_TEXT_GSM7BIT, /**< GSM 7 Bit with bit 8 set to 0 Encoding */
+       PB_TEXT_UCS2, /**< UCS2 Encoding */
+       PB_TEXT_HEX, /**< HEX Encoding */
+};
+
+struct tel_phonebook_support_list {
+       gboolean b_fdn; /**< Fixed Dialing Number */
+       gboolean b_adn; /**< SIM - ADN(2G phonebook, Under DF phonebook */
+       gboolean b_sdn; /**< Service Dialing Number  */
+       gboolean b_usim; /**< USIM - 3G phonebook */
+       gboolean b_aas; /**< Additional number Alpha String phonebook */
+       gboolean b_gas; /**< Grouping information Alpha String phonebook */
+};
+
+struct tel_phonebook_field_support_list {
+       gboolean b_field_list[13];
+       //supported fields are 12 according to 'enum tel_phonebook_field_type'. each index number means enum value.
+       //it is used from index 1. (index 0 doesn't match to any enum value. (no meaning))
+};
+
+struct treq_phonebook_get_count {
+       enum tel_phonebook_type phonebook_type;
+};
+
+struct treq_phonebook_get_info {
+       enum tel_phonebook_type phonebook_type;
+};
+
+struct treq_phonebook_get_usim_info {
+
+};
+
+struct treq_phonebook_read_record {
+       enum tel_phonebook_type phonebook_type;
+       unsigned short index;
+};
+
+struct treq_phonebook_update_record {
+       enum tel_phonebook_type phonebook_type;
+       unsigned short index;
+
+       unsigned char name[PHONEBOOK_NAME_BYTE_MAX+1];          // +1 is for Null termination
+       unsigned short name_len;
+       enum tel_phonebook_dcs dcs;
+
+       unsigned char number[PHONEBOOK_NUMBER_BYTE_MAX+1];      // +1 is for Null termination
+       enum tel_phonebook_ton ton;
+
+       /* following fields are valid in only USIM*/
+       unsigned char sne[PHONEBOOK_NAME_BYTE_MAX+1];           // +1 is for Null termination
+       unsigned short sne_len;
+       enum tel_phonebook_dcs sne_dcs;
+
+       unsigned char anr1[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
+       enum tel_phonebook_ton anr1_ton;
+       unsigned char anr2[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
+       enum tel_phonebook_ton anr2_ton;
+       unsigned char anr3[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
+       enum tel_phonebook_ton anr3_ton;
+
+       unsigned char email1[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
+       unsigned short email1_len;
+       unsigned char email2[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
+       unsigned short email2_len;
+       unsigned char email3[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
+       unsigned short email3_len;
+       unsigned char email4[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
+       unsigned short email4_len;
+
+       unsigned short group_index; //GRP
+       unsigned short pb_control; //PBC
+};
+
+struct treq_phonebook_delete_record {
+       enum tel_phonebook_type phonebook_type;
+       unsigned short index;
+};
+
+struct tresp_phonebook_get_count {
+       enum tel_phonebook_result result;
+       enum tel_phonebook_type type;
+       unsigned short used_count;
+       unsigned short total_count;
+};
+
+struct tresp_phonebook_get_info {
+       enum tel_phonebook_result result;
+       enum tel_phonebook_type type;
+       unsigned short index_min;
+       unsigned short index_max;
+       unsigned short number_length_max;
+       unsigned short text_length_max;
+       unsigned short used_count;
+};
+
+struct tel_phonebook_usim_meta {
+       enum tel_phonebook_field_type field;
+       unsigned short index_max;
+       unsigned short text_max;
+       unsigned short used_count;
+};
+
+struct tresp_phonebook_get_usim_info {
+       enum tel_phonebook_result result;
+       int field_count;
+       struct tel_phonebook_usim_meta field_list[13]; //supported fields are 13 currently.
+};
+
+struct tresp_phonebook_read_record {
+       enum tel_phonebook_result result;
+       enum tel_phonebook_type phonebook_type;
+       unsigned short index;
+       unsigned short next_index;
+
+       unsigned char name[PHONEBOOK_NAME_BYTE_MAX+1];          // +1 is for Null termination
+       unsigned short name_len;
+       enum tel_phonebook_dcs dcs;
+
+       unsigned char number[PHONEBOOK_NUMBER_BYTE_MAX+1];      // +1 is for Null termination
+       enum tel_phonebook_ton ton;
+
+       /* following fields are valid in only USIM*/
+       unsigned char sne[PHONEBOOK_NAME_BYTE_MAX+1];           // +1 is for Null termination
+       unsigned short sne_len;
+       enum tel_phonebook_dcs sne_dcs;
+
+       unsigned char anr1[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
+       enum tel_phonebook_ton anr1_ton;
+       unsigned char anr2[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
+       enum tel_phonebook_ton anr2_ton;
+       unsigned char anr3[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
+       enum tel_phonebook_ton anr3_ton;
+
+       unsigned char email1[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
+       unsigned short email1_len;
+       unsigned char email2[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
+       unsigned short email2_len;
+       unsigned char email3[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
+       unsigned short email3_len;
+       unsigned char email4[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
+       unsigned short email4_len;
+
+       unsigned short group_index; //GRP
+       unsigned short pb_control; //PBC
+};
+
+struct tresp_phonebook_update_record {
+       enum tel_phonebook_result result;
+};
+
+struct tresp_phonebook_delete_record {
+       enum tel_phonebook_result result;
+};
+
+struct tnoti_phonebook_status {
+       gboolean b_init;
+       struct tel_phonebook_support_list support_list;
+};
+
+__END_DECLS
+
+
+#endif
index f7bc064..4ab45a1 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #ifndef __TYPE_PS_H__
 #define __TYPE_PS_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
+
+#define IPV6_ADDR_LEN 16
+#define IPV4_ADDR_LEN 4
+
+#define MAX_NUM_DEDICATED_BEARER 8
+
+enum telephony_ps_pdp_err {
+       PDP_FAILURE_CAUSE_NORMAL                                                = 0x00,                   // 0x00 : Normal Process ( no problem )
+       PDP_FAILURE_CAUSE_REL_BY_USER                                   = 0x01,                   // Call Released by User
+       PDP_FAILURE_CAUSE_REGULAR_DEACTIVATION                  = 0x02,                   // Regular deactivation
+       PDP_FAILURE_CAUSE_LLC_SNDCP                                     = 0x03,                   // LLC SNDCP failure
+       PDP_FAILURE_CAUSE_INSUFFICIENT_RESOURCE         = 0x04,                   // Insufficient resources
+       PDP_FAILURE_CAUSE_UNKNOWN_APN                                   = 0x05,                   // Missing or unkown apn
+       PDP_FAILURE_CAUSE_UNKNOWN_PDP_ADDRESS                   = 0x06,                   // Unknown pdp address or type
+       PDP_FAILURE_CAUSE_USER_AUTH_FAILED                              = 0x07,                   // Unknown pdp address or type
+       PDP_FAILURE_CAUSE_ACT_REJ_GGSN                                  = 0x08,                   // Unknown pdp address or type
+       PDP_FAILURE_CAUSE_ACT_REJ_UNSPECIFIED                   = 0x09,                   // Unknown pdp address or type
+       PDP_FAILURE_CAUSE_SVC_OPTION_NOT_SUPPORTED              = 0x0A,                   // Service option not supported
+       PDP_FAILURE_CAUSE_SVC_NOT_SUBSCRIBED                    = 0x0B,                   // Requested service option not subscribed
+       PDP_FAILURE_CAUSE_SVC_OPT_OUT_ORDER                     = 0x0C,                   // Service out of order
+    PDP_FAILURE_CAUSE_NSAPI_USED                                       = 0x0D,                   // NSAPI already used
+       PDP_FAILURE_CAUSE_QOS_NOT_ACCEPTED                              = 0x0E,                   // QoS not accepted
+       PDP_FAILURE_CAUSE_NETWORK_FAILURE                               = 0x0F,                   // Network Failure
+    PDP_FAILURE_CAUSE_REACT_REQUIRED                           = 0x10,                   // Reactivation Required
+       PDP_FAILURE_CAUSE_FEATURE_NOT_SUPPORTED         = 0x11,                   // Feature not supported
+       PDP_FAILURE_CAUSE_TFT_FILTER_ERROR                              = 0x12,                   // TFT or filter error
+       PDP_FAILURE_CAUSE_UNKOWN_PDP_CONTEXT                    = 0x13,                   // Unkown PDP context
+       PDP_FAILURE_CAUSE_INVALID_MSG                                   = 0x14,                   // Invalied MSG
+       PDP_FAILURE_CAUSE_PROTOCOL_ERROR                                = 0x15,                   // Protocol error
+       PDP_FAILURE_CAUSE_MOBILE_FAILURE_ERROR                  = 0x16,                   // Mobile failure error
+       PDP_FAILURE_CAUSE_TIMEOUT_ERROR                         = 0x17,                   // Timeout error
+       PDP_FAILURE_CAUSE_UNKNOWN_ERROR                         = 0x18,                   // Unknown error
+       PDP_FAILURE_CAUSE_MAX,
+};
+
+enum telephony_ps_protocol_status {
+       TELEPHONY_HSDPA_OFF = 0x00,
+       TELEPHONY_HSDPA_ON = 0x01,
+       TELEPHONY_HSUPA_ON = 0x02,
+       TELEPHONY_HSPA_ON = 0x03,
+       TELEPHONY_HSPAP_ON = 0x04
+};
+
+enum telephony_ps_state {
+       TELEPHONY_PS_ON,
+       TELEPHONY_PS_3G_OFF,
+       TELEPHONY_PS_ROAMING_OFF,
+       TELEPHONY_PS_FLIGHT_MODE,
+       TELEPHONY_PS_NO_SERVICE,
+       TELEPHONY_PS_RESTRICTED_SERVICE
+};
+
+struct dedicated_bearer_info {
+       char profile_id;
+       char qci;
+       char gbr_dl;
+       char gbr_ul;
+       char max_br_dl;
+       char max_br_ul;
+};
+
+struct treq_ps_pdp_activate {
+       int context_id;
+       int secondary_context_id;
+       char apn[102];
+       char pdp_address[20];
+       int pdp_type;
+
+       char username[32];
+       char password[32];
+       char dns1[16];
+       char dns2[16];
+       int auth_type;
+};
+
+struct tresp_ps_set_pdp_activate {
+       int context_id;
+       int secondary_context_id;
+       int result;
+};
+
+
+struct treq_ps_pdp_deactivate {
+       int context_id;
+       int secondary_context_id;
+
+       char username[32];
+       char password[32];
+       char dns1[16];
+       char dns2[16];
+       int auth_type;
+};
+
+struct tresp_ps_set_pdp_deactivate {
+       int context_id;
+       int secondary_context_id;
+       int result;
+};
+
+struct tnoti_ps_call_status {
+       int context_id;
+       int state;
+       int result;
+};
+
+struct tnoti_ps_pdp_ipconfiguration {
+       int context_id;
+       int secondary_context_id;
+
+       enum telephony_ps_pdp_err err;
+       unsigned short field_flag;
+
+       char devname[16];
+
+       unsigned char ip_address[IPV4_ADDR_LEN];
+       unsigned char primary_dns[IPV4_ADDR_LEN];
+       unsigned char secondary_dns[IPV4_ADDR_LEN];
+       unsigned char gateway[IPV4_ADDR_LEN];
+       unsigned char subnet_mask[IPV4_ADDR_LEN];
+
+       char *ipv6_address;
+       char *ipv6_primary_dns;
+       char *ipv6_secondary_dns;
+       char *ipv6_gateway;
+
+       unsigned int pcscf_ipv4_count;
+       char **pcscf_ipv4;
+
+       unsigned int pcscf_ipv6_count;
+       char **pcscf_ipv6;
+};
+
+struct tnoti_ps_external_call {
+};
+
+struct tnoti_ps_protocol_status {
+       enum telephony_ps_protocol_status status;
+};
+
+struct tnoti_MIP_status {
+       int result;
+};
+
+struct tnoti_ps_dedicated_bearer_info {
+       unsigned char num_dedicated_bearer;
+       struct dedicated_bearer_info dedicated_bearer [MAX_NUM_DEDICATED_BEARER];
+};
+__END_DECLS
 
-#define TCORE_PS_NUM_IP_ADDRESS_LEN_MAX        4
-#define TCORE_PS_STR_IP_ADDRESS_LEN_MAX        16
-
-#define TCORE_PS_PDP_ADDRESS_LEN_MAX   20
-#define TCORE_PS_APN_LEN_MAX                   102
-
-#define TCORE_PS_DEVNAME_LEN_MAX               16
-#define TCORE_PS_USERNAME_LEN_MAX              32
-#define TCORE_PS_PASSWORD_LEN_MAX              32
-
-typedef enum {
-       TCORE_PS_FAILURE_CAUSE_NORMAL,
-       TCORE_PS_FAILURE_CAUSE_REL_BY_USER,
-       TCORE_PS_FAILURE_CAUSE_REGULAR_DEACTIVATION,
-       TCORE_PS_FAILURE_CAUSE_LLC_SNDCP,
-       TCORE_PS_FAILURE_CAUSE_INSUFFICIENT_RESOURCE,
-       TCORE_PS_FAILURE_CAUSE_UNKNOWN_APN,
-       TCORE_PS_FAILURE_CAUSE_UNKNOWN_PDP_ADDRESS,
-       TCORE_PS_FAILURE_CAUSE_USER_AUTH_FAILED,
-       TCORE_PS_FAILURE_CAUSE_ACT_REJ_GGSN,
-       TCORE_PS_FAILURE_CAUSE_ACT_REJ_UNSPECIFIED,
-       TCORE_PS_FAILURE_CAUSE_SVC_OPTION_NOT_SUPPORTED,
-       TCORE_PS_FAILURE_CAUSE_SVC_NOT_SUBSCRIBED,
-       TCORE_PS_FAILURE_CAUSE_SVC_OPT_OUT_ORDER,
-       TCORE_PS_FAILURE_CAUSE_NSAPI_USED,
-       TCORE_PS_FAILURE_CAUSE_QOS_NOT_ACCEPTED,
-       TCORE_PS_FAILURE_CAUSE_NETWORK_FAILURE,
-       TCORE_PS_FAILURE_CAUSE_REACT_REQUIRED,
-       TCORE_PS_FAILURE_CAUSE_FEATURE_NOT_SUPPORTED,
-       TCORE_PS_FAILURE_CAUSE_TFT_FILTER_ERROR,
-       TCORE_PS_FAILURE_CAUSE_UNKOWN_PDP_CONTEXT,
-       TCORE_PS_FAILURE_CAUSE_INVALID_MSG,
-       TCORE_PS_FAILURE_CAUSE_PROTOCOL_ERROR,
-       TCORE_PS_FAILURE_CAUSE_MOBILE_FAILURE_ERROR,
-       TCORE_PS_FAILURE_CAUSE_TIMEOUT_ERROR,
-       TCORE_PS_FAILURE_CAUSE_UNKNOWN_ERROR,
-       TCORE_PS_FAILURE_CAUSE_MAX
-} TcorePsFailureCause;
-
-typedef enum {
-       TCORE_PS_STATE_ON,
-       TCORE_PS_STATE_3G_OFF,
-       TCORE_PS_STATE_ROAMING_OFF,
-       TCORE_PS_STATE_FLIGHT_MODE,
-       TCORE_PS_STATE_NO_SERVICE,
-} TcorePsState;
-
-typedef enum {
-       TCORE_PS_CALL_STATE_CTX_DEFINED,
-       TCORE_PS_CALL_STATE_NOT_CONNECTED,
-       TCORE_PS_CALL_STATE_CONNECTED
-} TcorePsCallState;
-
-#if 0
-typedef struct {
-       gint context_id;
-       gint secondary_context_id;
-       gchar apn[TCORE_PS_APN_LEN_MAX];
-       gchar pdp_address[TCORE_PS_PDP_ADDRESS_LEN_MAX];
-       gint pdp_type;
-
-       gchar username[TCORE_PS_USERNAME_LEN_MAX];
-       gchar password[TCORE_PS_PASSWORD_LEN_MAX];
-       gchar dns1[TCORE_PS_STR_IP_ADDRESS_LEN_MAX];
-       gchar dns2[TCORE_PS_STR_IP_ADDRESS_LEN_MAX];
-       gint auth_type;
-} TreqPsPdpActivate;
-
-typedef struct {
-       gint context_id;
-       gint secondary_context_id;
-       gint result;
-} TrespPsSetPdpActivate;
-
-typedef struct {
-       gint context_id;
-       gint secondary_context_id;
-
-       gchar username[TCORE_PS_USERNAME_LEN_MAX];
-       gchar password[TCORE_PS_PASSWORD_LEN_MAX];
-       gchar dns1[TCORE_PS_STR_IP_ADDRESS_LEN_MAX];
-       gchar dns2[TCORE_PS_STR_IP_ADDRESS_LEN_MAX];
-       gint auth_type;
-} TreqPsPdpDeactivate;
-
-typedef struct {
-       gint context_id;
-       gint secondary_context_id;
-       gint result;
-} TrespPsSetPdpDeactivate;
 #endif
-
-typedef struct {
-       guint context_id;
-       TcorePsCallState state;
-} TcorePsCallStatusInfo;
-
-typedef struct {
-       gint context_id;
-       gint secondary_context_id;
-
-       TcorePsFailureCause err;
-       gushort field_flag;
-       guchar ip_address[TCORE_PS_NUM_IP_ADDRESS_LEN_MAX];
-       guchar primary_dns[TCORE_PS_NUM_IP_ADDRESS_LEN_MAX];
-       guchar secondary_dns[TCORE_PS_NUM_IP_ADDRESS_LEN_MAX];
-       guchar gateway[TCORE_PS_NUM_IP_ADDRESS_LEN_MAX];
-       guchar subnet_mask[TCORE_PS_NUM_IP_ADDRESS_LEN_MAX];
-       gchar devname[TCORE_PS_DEVNAME_LEN_MAX];
-} TcorePsPdpIpConf;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TYPE_PS_H__ */
diff --git a/include/type/request.h b/include/type/request.h
new file mode 100644 (file)
index 0000000..46371fd
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_REQUEST_H__
+#define __TYPE_REQUEST_H__
+
+#include <type/common.h>
+
+__BEGIN_DECLS
+
+/*
+ * SET/REQ: async
+ * GET: sync
+ */
+enum tcore_request_command {
+       TREQ_UNKNOWN = 0,
+
+       TREQ_SERVER = TCORE_REQUEST | TCORE_TYPE_SERVER,
+       TREQ_SERVER_GET_PLUGINS,
+
+       TREQ_MODEM = TCORE_REQUEST | TCORE_TYPE_MODEM,
+       TREQ_MODEM_POWER_ON,
+       TREQ_MODEM_POWER_OFF,
+       TREQ_MODEM_POWER_RESET,
+       TREQ_MODEM_POWER_LOW,
+       TREQ_MODEM_SET_FLIGHTMODE,
+       TREQ_MODEM_GET_FLIGHTMODE,
+       TREQ_MODEM_GET_IMEI,
+       TREQ_MODEM_GET_VERSION,
+       TREQ_MODEM_GET_SN,
+       TREQ_MODEM_SET_DUN_PIN_CONTROL,
+
+       TREQ_CALL = TCORE_REQUEST | TCORE_TYPE_CALL,
+       TREQ_CALL_DIAL,
+       TREQ_CALL_ANSWER,
+       TREQ_CALL_END,
+       TREQ_CALL_HOLD,
+       TREQ_CALL_ACTIVE,
+       TREQ_CALL_SWAP,
+       TREQ_CALL_JOIN,
+       TREQ_CALL_SPLIT,
+       TREQ_CALL_DEFLECT,
+       TREQ_CALL_TRANSFER,
+       TREQ_CALL_START_CONT_DTMF,
+       TREQ_CALL_STOP_CONT_DTMF,
+       TREQ_CALL_SEND_BURST_DTMF,
+       TREQ_CALL_SET_PRIVACY_MODE,
+       TREQ_CALL_GET_PRIVACY_MODE,
+       TREQ_CALL_SET_SOUND_PATH,
+       TREQ_CALL_GET_SOUND_VOLUME_LEVEL,
+       TREQ_CALL_SET_SOUND_VOLUME_LEVEL,
+       TREQ_CALL_SET_SOUND_MUTE_STATUS,
+       TREQ_CALL_GET_SOUND_MUTE_STATUS,
+       TREQ_CALL_SET_SOUND_RECORDING,
+       TREQ_CALL_SET_SOUND_EQUALIZATION,
+       TREQ_CALL_SET_SOUND_NOISE_REDUCTION,
+       TREQ_CALL_SET_SOUND_CLOCK_STATUS,
+       TREQ_CALL_SET_PREFERRED_VOICE_SUBSCRIPTION,
+       TREQ_CALL_GET_PREFERRED_VOICE_SUBSCRIPTION,
+       TREQ_CALL_MODIFY,
+       TREQ_CALL_CONFIRM_MODIFY,
+
+       TREQ_CALL_SET_ACTIVE_LINE,
+       TREQ_CALL_GET_ACTIVE_LINE,
+       TREQ_CALL_ACTIVATE_CCBS,
+       TREQ_CALL_CUSTOM_SERVICE,
+
+       TREQ_SS = TCORE_REQUEST | TCORE_TYPE_SS,
+       TREQ_SS_BARRING_ACTIVATE,
+       TREQ_SS_BARRING_DEACTIVATE,
+       TREQ_SS_BARRING_CHANGE_PASSWORD,
+       TREQ_SS_BARRING_GET_STATUS,
+       TREQ_SS_FORWARDING_ACTIVATE,
+       TREQ_SS_FORWARDING_DEACTIVATE,
+       TREQ_SS_FORWARDING_REGISTER,
+       TREQ_SS_FORWARDING_DEREGISTER,
+       TREQ_SS_FORWARDING_GET_STATUS,
+       TREQ_SS_WAITING_ACTIVATE,
+       TREQ_SS_WAITING_DEACTIVATE,
+       TREQ_SS_WAITING_GET_STATUS,
+       TREQ_SS_CLI_ACTIVATE,
+       TREQ_SS_CLI_DEACTIVATE,
+       TREQ_SS_CLI_SET_STATUS,
+       TREQ_SS_CLI_GET_STATUS,
+       TREQ_SS_SEND_USSD,
+       TREQ_SS_SET_AOC,
+       TREQ_SS_GET_AOC,
+
+       TREQ_SIM = TCORE_REQUEST | TCORE_TYPE_SIM,
+       TREQ_SIM_VERIFY_PINS,
+       TREQ_SIM_VERIFY_PUKS,
+       TREQ_SIM_CHANGE_PINS,
+       TREQ_SIM_GET_FACILITY_STATUS,
+       TREQ_SIM_DISABLE_FACILITY,
+       TREQ_SIM_ENABLE_FACILITY,
+       TREQ_SIM_TRANSMIT_APDU,
+       TREQ_SIM_GET_ATR,
+       TREQ_SIM_GET_ECC,
+       TREQ_SIM_GET_LANGUAGE,
+       TREQ_SIM_SET_LANGUAGE,
+       TREQ_SIM_GET_ICCID,
+       TREQ_SIM_GET_MAILBOX,
+       TREQ_SIM_SET_MAILBOX,
+       TREQ_SIM_GET_CALLFORWARDING,
+       TREQ_SIM_SET_CALLFORWARDING,
+       TREQ_SIM_GET_MESSAGEWAITING,
+       TREQ_SIM_SET_MESSAGEWAITING,
+       TREQ_SIM_GET_CPHS_INFO,
+       TREQ_SIM_GET_SERVICE_TABLE,
+       TREQ_SIM_GET_MSISDN,
+       TREQ_SIM_GET_SPN,
+       TREQ_SIM_GET_SPDI,
+       TREQ_SIM_GET_OPL,
+       TREQ_SIM_GET_PNN,
+       TREQ_SIM_GET_CPHS_NETNAME,
+       TREQ_SIM_GET_OPLMNWACT,
+       TREQ_SIM_REQ_AUTHENTICATION,
+       TREQ_SIM_GET_LOCK_INFO,
+       TREQ_SIM_GET_ICON,
+       TREQ_SIM_SET_POWERSTATE,
+       TREQ_SIM_GET_GID,
+#if defined TIZEN_GLOBALCONFIG_ENABLE_CSP
+       TREQ_SIM_GET_CPHS_CSP_INFO,
+       TREQ_SIM_SET_CPHS_CSP_INFO,
+#endif
+       TREQ_SIM_GET_IMPI,
+       TREQ_SIM_GET_IMPU,
+       TREQ_SIM_GET_DOMAIN,
+       TREQ_SIM_GET_PCSCF,
+       TREQ_SIM_GET_ISIM_SERVICE_TABLE,
+
+       TREQ_SAT = TCORE_REQUEST | TCORE_TYPE_SAT,
+       TREQ_SAT_REQ_ENVELOPE,
+       TREQ_SAT_REQ_TERMINALRESPONSE,
+       TREQ_SAT_REQ_USERCONFIRMATION,
+
+       TREQ_SAP = TCORE_REQUEST | TCORE_TYPE_SAP,
+       TREQ_SAP_REQ_CONNECT,
+       TREQ_SAP_REQ_DISCONNECT,
+       TREQ_SAP_REQ_STATUS,
+       TREQ_SAP_REQ_ATR,
+       TREQ_SAP_TRANSFER_APDU,
+       TREQ_SAP_SET_PROTOCOL,
+       TREQ_SAP_SET_POWER,
+       TREQ_SAP_REQ_CARDREADERSTATUS,
+
+       TREQ_NETWORK = TCORE_REQUEST | TCORE_TYPE_NETWORK,
+       TREQ_NETWORK_SEARCH,
+       TREQ_NETWORK_SET_PLMN_SELECTION_MODE,
+       TREQ_NETWORK_GET_PLMN_SELECTION_MODE,
+       TREQ_NETWORK_SET_SERVICE_DOMAIN,
+       TREQ_NETWORK_GET_SERVICE_DOMAIN,
+       TREQ_NETWORK_SET_BAND,
+       TREQ_NETWORK_GET_BAND,
+       TREQ_NETWORK_SET_PREFERRED_PLMN,
+       TREQ_NETWORK_GET_PREFERRED_PLMN,
+       TREQ_NETWORK_SET_ORDER,
+       TREQ_NETWORK_GET_ORDER,
+       TREQ_NETWORK_SET_POWER_ON_ATTACH,
+       TREQ_NETWORK_GET_POWER_ON_ATTACH,
+       TREQ_NETWORK_SET_CANCEL_MANUAL_SEARCH,
+       TREQ_NETWORK_GET_SERVING_NETWORK,
+       TREQ_NETWORK_SET_MODE,
+       TREQ_NETWORK_GET_MODE,
+       TREQ_NETWORK_SET_NEIGHBORING_CELL_INFO,
+       TREQ_NETWORK_GET_NEIGHBORING_CELL_INFO,
+       TREQ_NETWORK_SET_DEFAULT_DATA_SUBSCRIPTION,
+       TREQ_NETWORK_GET_DEFAULT_DATA_SUBSCRIPTION,
+       TREQ_NETWORK_SET_DEFAULT_SUBSCRIPTION,
+       TREQ_NETWORK_GET_DEFAULT_SUBSCRIPTION,
+       TREQ_NETWORK_SET_EMERGENCY_CALLBACK_MODE,
+       TREQ_NETWORK_SET_ROAMING_PREFERENCE,
+       TREQ_NETWORK_GET_ROAMING_PREFERENCE,
+       TREQ_NETWORK_GET_SUBSCRIPTION_INFO,
+
+       TREQ_PS = TCORE_REQUEST | TCORE_TYPE_PS,
+       TREQ_PS_SET_PDP_ACTIVATE,
+       TREQ_PS_SET_PDP_DEACTIVATE,
+
+       TREQ_SMS = TCORE_REQUEST | TCORE_TYPE_SMS,
+       TREQ_SMS_SEND_UMTS_MSG, /* Send the SMS-SUBMIT, SMS-COMMAND or SMS-SUBMIT-REPORT message */
+       TREQ_SMS_READ_MSG, /* Read the message from the phone flash or SIM */
+       TREQ_SMS_SAVE_MSG, /* Stores a message to memory storage */
+       TREQ_SMS_DELETE_MSG, /* Deletes message from preferred message storage */
+       TREQ_SMS_GET_COUNT, /* Get SMS Count Stored in Memory */
+       TREQ_SMS_GET_SCA, /* Get SMS Service Center Address */
+       TREQ_SMS_SET_SCA, /* Set SMS Service Center Address */
+       TREQ_SMS_GET_CB_CONFIG, /* Get Cell Broadcast Configuration */
+       TREQ_SMS_SET_CB_CONFIG, /* Set Cell Broadcast Configuration */
+       TREQ_SMS_SET_MEM_STATUS, /* Memory Storage Status message*/
+       TREQ_SMS_GET_PREF_BEARER, /* Get SMS Service Option like CS/PS bearer */
+       TREQ_SMS_SET_PREF_BEARER, /* Set SMS Service Option like CS/PS bearer */
+       TREQ_SMS_SET_DELIVERY_REPORT, /* Send the SMS-DELIVER-REPORT message to the network for the SMS-DELIVER message. */
+       TREQ_SMS_SET_MSG_STATUS, /* SMS Status Stored in Memory message */
+       TREQ_SMS_GET_PARAMS,
+       TREQ_SMS_SET_PARAMS,
+       TREQ_SMS_GET_PARAMCNT,
+       TREQ_SMS_SEND_CDMA_MSG,
+
+       TREQ_PHONEBOOK = TCORE_REQUEST | TCORE_TYPE_PHONEBOOK,
+       TREQ_PHONEBOOK_GETCOUNT,
+       TREQ_PHONEBOOK_GETMETAINFO,
+       TREQ_PHONEBOOK_GETUSIMINFO,
+       TREQ_PHONEBOOK_READRECORD,
+       TREQ_PHONEBOOK_UPDATERECORD,
+       TREQ_PHONEBOOK_DELETERECORD,
+
+       TREQ_SOUND = TCORE_REQUEST | TCORE_TYPE_SOUND,
+
+       TREQ_GPS = TCORE_REQUEST | TCORE_TYPE_GPS,
+       TREQ_GPS_CONFIRM_MEASURE_POS,
+       TREQ_GPS_SET_FREQUENCY_AIDING,
+       TREQ_ENABLE_SMART_ASSISTANT,
+       TREQ_DISABLE_SMART_ASSISTANT,
+       TREQ_SYNC_SMART_ASSISTANT_AREA_LIST,
+       TREQ_DEL_SMART_ASSISTANT_AREA_LIST,
+       TREQ_ADD_SMART_ASSISTANT_AREA,
+       TREQ_MODIFY_SMART_ASSISTANT_AREA,
+       TREQ_SET_SMART_ASSISTANT_INFO,
+
+       TREQ_CUSTOM = TCORE_REQUEST | TCORE_TYPE_CUSTOM,
+};
+
+struct treq_server_get_plugins {
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/type/response.h b/include/type/response.h
new file mode 100644 (file)
index 0000000..88180e9
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_RESPONSE_H__
+#define __TYPE_RESPONSE_H__
+
+#include <type/common.h>
+
+__BEGIN_DECLS
+
+enum tcore_response_command {
+       TRESP_UNKNOWN = 0,
+
+       TRESP_SERVER = TCORE_RESPONSE | TCORE_TYPE_SERVER,
+
+       TRESP_MODEM = TCORE_RESPONSE | TCORE_TYPE_MODEM,
+       TRESP_MODEM_POWER_ON,
+       TRESP_MODEM_POWER_OFF,
+       TRESP_MODEM_POWER_RESET,
+       TRESP_MODEM_POWER_LOW,
+       TRESP_MODEM_SET_FLIGHTMODE,
+       TRESP_MODEM_GET_FLIGHTMODE,
+       TRESP_MODEM_GET_IMEI,
+       TRESP_MODEM_GET_VERSION,
+       TRESP_MODEM_GET_SN,
+       TRESP_MODEM_SET_DUN_PIN_CONTROL,
+
+       TRESP_CALL = TCORE_RESPONSE | TCORE_TYPE_CALL,
+       TRESP_CALL_DIAL,
+       TRESP_CALL_ANSWER,
+       TRESP_CALL_END,
+       TRESP_CALL_HOLD,
+       TRESP_CALL_ACTIVE,
+       TRESP_CALL_SWAP,
+       TRESP_CALL_JOIN,
+       TRESP_CALL_SPLIT,
+       TRESP_CALL_DEFLECT,
+       TRESP_CALL_TRANSFER,
+       TRESP_CALL_START_CONT_DTMF,
+       TRESP_CALL_STOP_CONT_DTMF,
+       TRESP_CALL_SEND_BURST_DTMF,
+       TRESP_CALL_SET_PRIVACY_MODE,
+       TRESP_CALL_GET_PRIVACY_MODE,
+       TRESP_CALL_SET_SOUND_PATH,
+       TRESP_CALL_GET_SOUND_VOLUME_LEVEL,
+       TRESP_CALL_SET_SOUND_VOLUME_LEVEL,
+       TRESP_CALL_SET_SOUND_MUTE_STATUS,
+       TRESP_CALL_GET_SOUND_MUTE_STATUS,
+       TRESP_CALL_SET_SOUND_RECORDING,
+       TRESP_CALL_SET_SOUND_EQUALIZATION,
+       TRESP_CALL_SET_SOUND_NOISE_REDUCTION,
+       TRESP_CALL_SET_SOUND_CLOCK_STATUS,
+       TRESP_CALL_SET_ACTIVE_LINE,
+       TRESP_CALL_GET_ACTIVE_LINE,
+       TRESP_CALL_ACTIVATE_CCBS,
+       TRESP_CALL_SET_PREFERRED_VOICE_SUBSCRIPTION,
+       TRESP_CALL_GET_PREFERRED_VOICE_SUBSCRIPTION,
+       TRESP_CALL_MODIFY,
+       TRESP_CALL_CONFIRM_MODIFY,
+
+       TRESP_SS = TCORE_RESPONSE | TCORE_TYPE_SS,
+       TRESP_SS_BARRING_ACTIVATE,
+       TRESP_SS_BARRING_DEACTIVATE,
+       TRESP_SS_BARRING_CHANGE_PASSWORD,
+       TRESP_SS_BARRING_GET_STATUS,
+       TRESP_SS_FORWARDING_ACTIVATE,
+       TRESP_SS_FORWARDING_DEACTIVATE,
+       TRESP_SS_FORWARDING_REGISTER,
+       TRESP_SS_FORWARDING_DEREGISTER,
+       TRESP_SS_FORWARDING_GET_STATUS,
+       TRESP_SS_WAITING_ACTIVATE,
+       TRESP_SS_WAITING_DEACTIVATE,
+       TRESP_SS_WAITING_GET_STATUS,
+       TRESP_SS_CLI_ACTIVATE,
+       TRESP_SS_CLI_DEACTIVATE,
+       TRESP_SS_CLI_SET_STATUS,
+       TRESP_SS_CLI_GET_STATUS,
+       TRESP_SS_SEND_USSD,
+       TRESP_SS_SET_AOC,
+       TRESP_SS_GET_AOC,
+
+       TRESP_SIM = TCORE_RESPONSE | TCORE_TYPE_SIM,
+       TRESP_SIM_VERIFY_PINS,
+       TRESP_SIM_VERIFY_PUKS,
+       TRESP_SIM_CHANGE_PINS,
+       TRESP_SIM_GET_FACILITY_STATUS,
+       TRESP_SIM_DISABLE_FACILITY,
+       TRESP_SIM_ENABLE_FACILITY,
+       TRESP_SIM_TRANSMIT_APDU,
+       TRESP_SIM_GET_ATR,
+       TRESP_SIM_GET_ECC,
+       TRESP_SIM_GET_LANGUAGE,
+       TRESP_SIM_SET_LANGUAGE,
+       TRESP_SIM_GET_ICCID,
+       TRESP_SIM_GET_MAILBOX,
+       TRESP_SIM_SET_MAILBOX,
+       TRESP_SIM_GET_CALLFORWARDING,
+       TRESP_SIM_SET_CALLFORWARDING,
+       TRESP_SIM_GET_MESSAGEWAITING,
+       TRESP_SIM_SET_MESSAGEWAITING,
+       TRESP_SIM_GET_CPHS_INFO,
+       TRESP_SIM_GET_SERVICE_TABLE,
+       TRESP_SIM_GET_MSISDN,
+       TRESP_SIM_GET_SPN,
+       TRESP_SIM_GET_SPDI,
+       TRESP_SIM_GET_OPL,
+       TRESP_SIM_GET_PNN,
+       TRESP_SIM_GET_CPHS_NETNAME,
+       TRESP_SIM_GET_OPLMNWACT,
+       TRESP_SIM_REQ_AUTHENTICATION,
+       TRESP_SIM_GET_LOCK_INFO,
+       TRESP_SIM_SET_POWERSTATE,
+       TRESP_SIM_GET_GID,
+#if defined TIZEN_GLOBALCONFIG_ENABLE_CSP
+       TRESP_SIM_GET_CPHS_CSP_INFO,
+       TRESP_SIM_SET_CPHS_CSP_INFO,
+#endif
+       TRESP_SIM_GET_IMPI,
+       TRESP_SIM_GET_IMPU,
+       TRESP_SIM_GET_DOMAIN,
+       TRESP_SIM_GET_PCSCF,
+       TRESP_SIM_GET_ISIM_SERVICE_TABLE,
+
+       TRESP_SAT = TCORE_RESPONSE | TCORE_TYPE_SAT,
+       TRESP_SAT_REQ_ENVELOPE,
+       TRESP_SAT_REQ_TERMINALRESPONSE,
+
+       TRESP_SAP = TCORE_RESPONSE | TCORE_TYPE_SAP,
+       TRESP_SAP_REQ_CONNECT,
+       TRESP_SAP_REQ_DISCONNECT,
+       TRESP_SAP_REQ_STATUS,
+       TRESP_SAP_REQ_ATR,
+       TRESP_SAP_TRANSFER_APDU,
+       TRESP_SAP_SET_PROTOCOL,
+       TRESP_SAP_SET_POWER,
+       TRESP_SAP_REQ_CARDREADERSTATUS,
+
+       TRESP_NETWORK = TCORE_RESPONSE | TCORE_TYPE_NETWORK,
+       TRESP_NETWORK_SEARCH,
+       TRESP_NETWORK_SET_PLMN_SELECTION_MODE,
+       TRESP_NETWORK_GET_PLMN_SELECTION_MODE,
+       TRESP_NETWORK_SET_SERVICE_DOMAIN,
+       TRESP_NETWORK_GET_SERVICE_DOMAIN,
+       TRESP_NETWORK_SET_BAND,
+       TRESP_NETWORK_GET_BAND,
+       TRESP_NETWORK_SET_PREFERRED_PLMN,
+       TRESP_NETWORK_GET_PREFERRED_PLMN,
+       TRESP_NETWORK_SET_ORDER,
+       TRESP_NETWORK_GET_ORDER,
+       TRESP_NETWORK_SET_POWER_ON_ATTACH,
+       TRESP_NETWORK_GET_POWER_ON_ATTACH,
+       TRESP_NETWORK_SET_CANCEL_MANUAL_SEARCH,
+       TRESP_NETWORK_GET_SERVING_NETWORK,
+       TRESP_NETWORK_SET_MODE,
+       TRESP_NETWORK_GET_MODE,
+       TRESP_NETWORK_SET_NEIGHBORING_CELL_INFO,
+       TRESP_NETWORK_GET_NEIGHBORING_CELL_INFO,
+       TRESP_NETWORK_SET_DEFAULT_DATA_SUBSCRIPTION,
+       TRESP_NETWORK_GET_DEFAULT_DATA_SUBSCRIPTION,
+       TRESP_NETWORK_SET_DEFAULT_SUBSCRIPTION,
+       TRESP_NETWORK_GET_DEFAULT_SUBSCRIPTION,
+       TRESP_NETWORK_SET_EMERGENCY_CALLBACK_MODE,
+       TRESP_NETWORK_SET_ROAMING_PREFERENCE,
+       TRESP_NETWORK_GET_ROAMING_PREFERENCE,
+       TRESP_NETWORK_GET_SUBSCRIPTION_INFO,
+
+       TRESP_PS = TCORE_RESPONSE | TCORE_TYPE_PS,
+       TRESP_PS_SET_PDP_ACTIVATE,
+       TRESP_PS_SET_PDP_DEACTIVATE,
+
+       TRESP_SMS = TCORE_RESPONSE | TCORE_TYPE_SMS,
+       TRESP_SMS_SEND_UMTS_MSG, /* This event is returned in response to SMS  message sent */
+       TRESP_SMS_READ_MSG, /* This event is returned in response to SMS Read message*/
+       TRESP_SMS_SAVE_MSG, /* This confirmation event is a returned indicating the Save SMS into SIM status*/
+       TRESP_SMS_DELETE_MSG, /* This confirmation event is a returned indicating the delete message status*/
+       TRESP_SMS_GET_STORED_MSG_COUNT, /* This event is returned in response to Get Number of messages stored in SIM*/
+       TRESP_SMS_GET_SCA, /* This event is returned with Get SCA */
+       TRESP_SMS_SET_SCA,
+       TRESP_SMS_GET_CB_CONFIG, /* This event is returned with Get CB configuration details*/
+       TRESP_SMS_SET_CB_CONFIG, /* This event is returned as a confirmation for SET CB configuration */
+       TRESP_SMS_SET_MEM_STATUS,
+       TRESP_SMS_GET_PREF_BEARER, /* This event is returned as a response to get preferred bearer used for SMS Transport*/
+       TRESP_SMS_SET_PREF_BEARER,
+       TRESP_SMS_SET_DELIVERY_REPORT, /* This event is returned in response to send delivery report */
+       TRESP_SMS_SET_MSG_STATUS,
+       TRESP_SMS_GET_PARAMS, /* This event is returned in response to SMS Get parameters*/
+       TRESP_SMS_SET_PARAMS,
+       TRESP_SMS_GET_PARAMCNT, /* Parameter count response */
+       TRESP_SMS_SEND_CDMA_MSG, /* This event is returned in response to SMS  message extended sent*/
+
+       TRESP_PHONEBOOK = TCORE_RESPONSE | TCORE_TYPE_PHONEBOOK,
+       TRESP_PHONEBOOK_GETCOUNT,
+       TRESP_PHONEBOOK_GETMETAINFO,
+       TRESP_PHONEBOOK_GETUSIMINFO,
+       TRESP_PHONEBOOK_READRECORD,
+       TRESP_PHONEBOOK_UPDATERECORD,
+       TRESP_PHONEBOOK_DELETERECORD,
+
+       TRESP_SOUND = TCORE_RESPONSE | TCORE_TYPE_SOUND,
+
+       TRESP_GPS = TCORE_RESPONSE | TCORE_TYPE_GPS,
+       TRESP_GPS_SET_FREQUENCY_AIDING,
+       TRESP_ENABLE_SMART_ASSISTANT,
+       TRESP_DISABLE_SMART_ASSISTANT,
+       TRESP_SYNC_SMART_ASSISTANT_AREA_LIST,
+       TRESP_DEL_SMART_ASSISTANT_AREA_LIST,
+       TRESP_ADD_SMART_ASSISTANT_AREA,
+       TRESP_MODIFY_SMART_ASSISTANT_AREA,
+       TRESP_SET_SMART_ASSISTANT_INFO,
+
+       TRESP_CUSTOM = TCORE_RESPONSE | TCORE_TYPE_CUSTOM,
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/type/sap.h b/include/type/sap.h
new file mode 100644 (file)
index 0000000..ffd525a
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_SAP_H__
+#define __TYPE_SAP_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+
+enum tel_sap_power_mode {
+       SAP_POWER_ON,
+       SAP_POWER_OFF,
+       SAP_POWER_RESET
+};
+
+enum tel_sap_protocol_type {
+       SAP_PROTOCOL_T0, /**< T = 0, character */
+       SAP_PROTOCOL_T1 /**< T = 1, block */
+};
+
+enum tel_sap_connection_status {
+       SAP_CONNECTION_STATUS_OK = 0x00, /**< connect successfully */
+       SAP_CONNECTION_STATUS_UNABLE_TO_ESTABLISH, /**< unable to establish connection */
+       SAP_CONNECTION_STATUS_NOT_SUPPORT_MAX_SIZE, /**< when server does not support message length that client want send */
+       SAP_CONNECTION_STATUS_TOO_SMALL_MAX_SIZE /**< when client want to connect with very small message length which is not supported by Server */
+};
+
+enum tel_sap_disconnect_type {
+       SAP_DISCONNECT_TYPE_GRACEFUL = 0x00, /**< disconnection procedure ends after finishing current work */
+       SAP_DISCONNECT_TYPE_IMMEDIATE /**<  disconnection procedure ends immediately*/
+};
+
+enum tel_sap_status { //CARD READER STATUS
+       SAP_STATUS_UNKNOWN = 0x00, /**<  SAP server connection status - unknown*/
+       SAP_STATUS_NO_SIM, /**<  SAP server connection status - no SIM*/
+       SAP_STATUS_NOT_READY, /**<  SAP server connection status - not ready*/
+       SAP_STATUS_READY, /**<  SAP server connection status - ready*/
+       SAP_STATUS_CONNECTED /**<  SAP server connection status - connected*/
+};
+
+enum tel_sap_status_change {
+       SAP_CARD_STATUS_UNKNOWN = 0x00, /**<  SAP server status(card reader status) - unknown*/
+       SAP_CARD_STATUS_RESET, /**<  SAP server status(card reader status) - reset*/
+       SAP_CARD_STATUS_NOT_ACCESSIBLE, /**<  SAP server status(card reader status) - not accessible*/
+       SAP_CARD_STATUS_REMOVED, /**<  SAP server status(card reader status) - removed*/
+       SAP_CARD_STATUS_INSERTED, /**<  SAP server status(card reader status) - inserted*/
+       SAP_CARD_STATUS_RECOVERED /**<  SAP server status(card reader status) - recovered*/
+};
+
+enum tel_sap_result_code {
+       SAP_RESULT_CODE_OK = 0x00, /**<  SAP operation result - OK*/
+       SAP_RESULT_CODE_NO_REASON, /**<  SAP operation result - no reason*/
+       SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE, /**<  SAP operation result - not accessible*/
+       SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF, /**<  SAP operation result - card already power off*/
+       SAP_RESULT_CODE_CARD_REMOVED, /**<  SAP operation result - card removed*/
+       SAP_RESULT_CODE_CARD_ALREADY_POWER_ON, /**<  SAP operation result - card already power on*/
+       SAP_RESULT_CODE_DATA_NOT_AVAILABLE, /**<  SAP operation result - data not available*/
+       SAP_RESULT_CODE_NOT_SUPPORT /**<  SAP operation result - not support*/
+};
+
+struct treq_sap_req_connect {
+       unsigned short max_msg_size;
+};
+
+struct treq_sap_req_disconnect {
+       /*NO Parameter*/
+};
+
+struct treq_sap_req_status {
+       /*NO Parameter*/
+};
+
+struct treq_sap_req_atr {
+       /*NO Parameter*/
+};
+
+struct treq_sap_transfer_apdu {
+       unsigned int apdu_length;
+       unsigned char apdu_data[256+2];
+};
+
+struct treq_sap_set_protocol {
+       enum tel_sap_protocol_type protocol;
+};
+
+struct treq_sap_set_power {
+       enum tel_sap_power_mode mode;
+};
+
+struct treq_sap_req_cardreaderstatus {
+       /*NO Parameter*/
+};
+
+struct tresp_sap_req_connect {
+       enum tel_sap_connection_status status;
+       unsigned short max_msg_size;
+};
+
+struct tresp_sap_req_disconnect {
+       enum tel_sap_result_code result;
+};
+
+struct tresp_sap_req_status {
+       enum tel_sap_status status;
+};
+
+struct tresp_sap_req_atr {
+       enum tel_sap_result_code result;
+       unsigned int atr_length;
+       unsigned char atr[256];
+};
+
+struct tresp_sap_transfer_apdu {
+       enum tel_sap_result_code result;
+       unsigned int resp_apdu_length;
+       unsigned char resp_adpdu[256+2];
+};
+
+struct tresp_sap_set_protocol {
+       enum tel_sap_result_code result;
+};
+
+struct tresp_sap_set_power {
+       enum tel_sap_result_code result;
+};
+
+struct tresp_sap_req_cardreaderstatus {
+       enum tel_sap_result_code result;
+       char reader_status;
+};
+
+struct tnoti_sap_status_changed {
+       enum tel_sap_status_change status;
+};
+
+struct tnoti_sap_disconnect {
+       enum tel_sap_disconnect_type type;
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/type/sat.h b/include/type/sat.h
new file mode 100644 (file)
index 0000000..659c1ce
--- /dev/null
@@ -0,0 +1,1831 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_SAT_H__
+#define __TYPE_SAT_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+#include <type/sim.h>
+
+#define SAT_DEF_TITLE_LEN_MAX 50 /**< max length for Menu Title */
+#define SAT_DEF_ITEM_STR_LEN_MAX 50
+
+#define SAT_TEXT_STRING_LEN_MAX 500
+#define SAT_MENU_ITEM_COUNT_MAX 40
+#define SAT_DIALING_NUMBER_LEN_MAX 200
+#define SAT_SS_STRING_LEN_MAX 160
+#define SAT_USSD_STRING_LEN_MAX 255
+#define SAT_ALPHA_ID_LEN_MAX 255               /**<    max length of  alpha identifier         */
+#define SAT_ITEM_TEXT_LEN_MAX 255              /**<    max length of item text         */
+#define SAT_SMS_TPDU_SMS_DATA_LEN_MAX 175
+#define SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT 50    /**<   max count of items next action indication list  */
+#define SAT_IMG_DATA_FILE_PATH_LEN_MAX 50       /**<   max length of image data file name (Icon, CLUT)         */
+#define SAT_ICON_LIST_MAX_COUNT        50       /**<   max count of icon list          */
+#define SAT_DTMF_STRING_LEN_MAX 30      /**<   max length of dtmf string               */
+#define SAT_URL_LEN_MAX 129     /**<   max length of URL               */
+#define SAT_ITEM_TEXT_ATTRIBUTES_LIST_MAX_COUNT        50       /**<   max count of item text attributes list          */
+#define SAT_EVENT_LIST_MAX     17      /**< max count of event list */
+#define SAT_FILE_ID_LIST_MAX_COUNT 255
+#define SAT_ENVELOPE_CMD_LEN_MAX 256
+#define SAT_AID_LEN_MAX 128
+#define SAT_SUB_ADDR_LEN_MAX 30
+#define SAT_CCP_DATA_LEN_MAX 30         /**<   max length of ccp data          */
+#define SAT_URL_LEN_MAX 129     /**<   max length of url               */
+#define SAT_BEARER_LIST_MAX_COUNT 5     /**<   max count of bearer list                */
+#define SAT_PROVISIONING_REF_MAX_COUNT 10      /**<    max count of sat provisioning reference */
+#define SAT_PROVISIONING_FILE_PATH_LEN_MAX 50   /**<   max length of provisioning file path    */
+#define SAT_BEARER_PARAMS_LEN_MAX 10    /**<   max length of bearer parameters         */
+#define SAT_OTHER_ADDR_LEN_MAX 30       /**<   max length of other address             */
+#define SAT_NET_ACC_NAM_LEN_MAX 30      /**<   max length of net acc name              */
+#define SAT_REMOTE_ENTITY_ADDR_LEN_MAX 50       /**<   max length of remote entity address     */
+#define SAT_CHANNEL_DATA_STRING_LEN_MAX 255
+
+enum tel_sat_proactive_cmd_type {
+       SAT_PROATV_CMD_NONE = 0x00, /**<        command type - None             */
+       SAT_PROATV_CMD_REFRESH = 0x01, /**<     command type - refresh          */
+       SAT_PROATV_CMD_MORE_TIME = 0x02, /**<   command type - more time                */
+       SAT_PROATV_CMD_SETUP_EVENT_LIST = 0x05, /**<    command type - setup event list         */
+       SAT_PROATV_CMD_SETUP_CALL = 0x10, /**<  command type - setup call               */
+       SAT_PROATV_CMD_SEND_SS = 0x11, /**<     command type - send ss          */
+       SAT_PROATV_CMD_SEND_USSD = 0x12, /**<   command type - send ussd                */
+       SAT_PROATV_CMD_SEND_SMS = 0x13, /**<    command type - send sms         */
+       SAT_PROATV_CMD_SEND_DTMF = 0x14, /**<   command type - send dtmf                */
+       SAT_PROATV_CMD_LAUNCH_BROWSER = 0x15, /**<      command type - launch browser           */
+       SAT_PROATV_CMD_PLAY_TONE = 0x20, /**<   command type - play tone                */
+       SAT_PROATV_CMD_DISPLAY_TEXT = 0x21, /**<        command type - display text             */
+       SAT_PROATV_CMD_GET_INKEY = 0x22, /**<   command type - get inkey                */
+       SAT_PROATV_CMD_GET_INPUT = 0x23, /**<   command type - get input                */
+       SAT_PROATV_CMD_SELECT_ITEM = 0x24, /**< command type - select item              */
+       SAT_PROATV_CMD_SETUP_MENU = 0x25, /**<  command type - setup menu               */
+       SAT_PROATV_CMD_PROVIDE_LOCAL_INFO = 0x26, /**<  command type - provide local info               */
+       SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT = 0x28, /**<        command type - setup idle mode text             */
+       SAT_PROATV_CMD_LANGUAGE_NOTIFICATION = 0x35, /**<       command type - language notification            */
+       SAT_PROATV_CMD_OPEN_CHANNEL = 0x40, /**<        command type - open channel -class e            */
+       SAT_PROATV_CMD_CLOSE_CHANNEL = 0x41, /**<       command type - close channel - class e          */
+       SAT_PROATV_CMD_RECEIVE_DATA = 0x42, /**<        command type - receive data -class e            */
+       SAT_PROATV_CMD_SEND_DATA = 0x43, /**<   command type - send data                */
+       SAT_PROATV_CMD_GET_CHANNEL_STATUS = 0x44, /**<  command type - get channel status -class e              */
+       SAT_PROATV_CMD_TYPE_END_PROACTIVE_SESSION = 0xFE,
+       SAT_PROATV_CMD_RESERVED = 0xFF /**<     command type - reserved         */
+};
+
+/*
+ * TS 102.223 V6.12.0
+ * SAT DATA OBJECT DEFINE
+ */
+
+/*
+ * Data Coding Scheme Object
+ */
+enum alphabet_format{
+       ALPHABET_FORMAT_SMS_DEFAULT = 0x00,
+       ALPHABET_FORMAT_8BIT_DATA = 0x01,
+       ALPHABET_FORMAT_UCS2 = 0x02,
+       ALPHABET_FORMAT_RESERVED = 0x03
+};
+
+enum msg_class{
+       MSG_CLASS_NONE =0x00,
+       MSG_CLASS_0 =0x01, //class 0
+       MSG_CLASS_1, // class 1 Default meaning:ME-specific
+       MSG_CLASS_2, // class 2 SIM specific message
+       MSG_CLASS_3, // class 3 Default meaning: TE specific
+       MSG_CLASS_RESERVED =0xFF
+};
+
+struct data_coding_scheme{
+       int is_compressed_format;               // if FALSE, unpacked format
+       enum alphabet_format a_format;
+       enum msg_class m_class;
+       unsigned char raw_dcs;
+};
+
+/*
+ * 8.1 Address
+ */
+enum type_of_number{
+       TON_UNKNOWN = 0,                        /*< unknown */
+       TON_INTERNATIONAL = 1,          /*< international number */
+       TON_NATIONAL = 2,                       /*< national number */
+       TON_NETWORK_SPECIFIC = 3,       /*< network specific number */
+       TON_DEDICATED_ACCESS = 4,       /*< subscriber number */
+       TON_ALPHA_NUMERIC = 5,          /*< alphanumeric, GSM 7-bit default alphabet) */
+       TON_ABBREVIATED_NUMBER = 6,     /*< abbreviated number */
+       TON_RESERVED_FOR_EXT = 0xF      /*< reserved for extension */
+};
+
+enum numbering_plan_identifier{
+       NPI_UNKNOWN = 0,                                /*< Unknown */
+       NPI_ISDN_TEL = 1,                               /*< ISDN/Telephone numbering plan */
+       NPI_DATA_NUMBERING_PLAN = 3,    /*< Data numbering plan */
+       NPI_TELEX = 4,                                  /*< Telex numbering plan */
+       NPI_SVC_CNTR_SPECIFIC_PLAN = 5, /*< Service Center Specific plan */
+       NPI_SVC_CNTR_SPECIFIC_PLAN2 = 6,/*< Service Center Specific plan */
+       NPI_NATIONAL = 8,                               /*< National numbering plan */
+       NPI_PRIVATE = 9,                                /*< Private numbering plan */
+       NPI_ERMES_NUMBERING_PLAN = 10,  /*< ERMES numbering plan */
+       NPI_RESERVED_FOR_EXT = 0xF              /*< Reserved for extension */
+};
+
+struct tel_sat_address{
+       enum type_of_number ton;
+       enum numbering_plan_identifier npi;
+       int dialing_number_len;                                 /**< Dialing Number length */
+       char dialing_number[SAT_DIALING_NUMBER_LEN_MAX];        /**< Dialing Number*/
+};
+
+/*
+ * 8.2 Alpha identifier
+ */
+struct tel_sat_alpha_identifier{
+       gboolean is_exist;
+       struct data_coding_scheme dcs;
+       unsigned char alpha_data_len; /**<      alpha identifier length         */
+       char alpha_data[SAT_ALPHA_ID_LEN_MAX]; /**<     alpha identifier info   */
+};
+
+/*
+ * 8.3 Subaddress
+ */
+struct tel_sat_subaddress{
+       int subaddress_len;
+       char subaddress[SAT_SUB_ADDR_LEN_MAX];
+};
+
+/*
+ * 8.4 Capability configuration parameters
+ */
+struct tel_sat_ccp{
+       int data_len;
+       char data[SAT_CCP_DATA_LEN_MAX];
+};
+
+/*
+ * 8.6 Command details
+ */
+enum display_text_priority{
+       TEXT_PRIORITY_NORMAL = 0,
+       TEXT_PRIORITY_HIGH = 1
+};
+
+enum display_text_clear_type{
+       TEXT_AUTO_CLEAR_MSG_AFTER_A_DELAY = 0,
+       TEXT_WAIT_FOR_USER_TO_CLEAR_MSG = 1
+};
+
+struct tel_sat_cmd_qualifier_display_text{
+       enum display_text_priority text_priority;
+       enum display_text_clear_type text_clear_type;
+};
+
+enum inkey_type{
+       INKEY_TYPE_CHARACTER_SET_ENABLED = 0,
+       INKEY_TYPE_YES_NO_REQUESTED = 1
+
+};
+
+enum input_alphabet_type{
+       INPUT_ALPHABET_TYPE_SMS_DEFAULT = 1,
+       INPUT_ALPHABET_TYPE_UCS2 = 2
+};
+
+struct tel_sat_cmd_qualifier_get_inkey{
+       enum inkey_type inkey_type;
+       enum input_alphabet_type alphabet_type;
+       gboolean alphabet_set;
+       gboolean immediate_rsp_required;
+       gboolean help_info;
+};
+
+struct tel_sat_cmd_qualifier_get_input{
+       enum input_alphabet_type alphabet_type;
+       gboolean alphabet_set;
+       gboolean me_echo_user_input;
+       gboolean user_input_unpacked_format;
+       gboolean help_info;
+};
+
+enum vibration_alert{
+       VIBRATE_ALERT_OPTIONAL = 0, /**<        VIBRATE ALERT UPTO THE TERMINAL         */
+       VIBRATE_ALERT_REQUIRED = 1 /**< VIBRATE, IF AVAILABLE, WITH TONE.               */
+};
+
+struct tel_sat_cmd_qualifier_play_tone{
+       enum vibration_alert vibration_alert;
+};
+
+struct tel_sat_cmd_qualifier_refresh{
+       enum tel_sim_refresh_command refresh;
+};
+
+enum provide_local_info_command{
+       LOCAL_INFO_LOCATION = 0,
+       LOCAL_INFO_IMEI = 1,
+       LOCAL_INFO_NMR = 2,
+       LOCAL_INFO_DATE_TIME_AND_TIMEZONE = 3,
+       LOCAL_INFO_LANGUAGE = 4,
+       LOCAL_INFO_TIMING_ADVANCE = 5,
+       LOCAL_INFO_ACT = 6,
+       LOCAL_INFO_ESN = 7,
+       LOCAL_INFO_IMEISV = 8,
+       LOCAL_INFO_MEID = 0x0B,
+       LOCAL_INFO_RESERVED = 0xFF
+};
+
+struct tel_sat_cmd_qualifier_provide_local_info{
+       enum provide_local_info_command provide_local_info;
+};
+
+enum setup_call_command{
+       SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY = 0x00, /**<        command qualifier for SETUP CALL IF ANOTHER CALL NOT BUSY               */
+       SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY_WITH_REDIAL = 0x01, /**<    command qualifier for SETUP CALL IF ANOTHER CALL NOT BUSY WITH REDIAL           */
+       SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD = 0x02, /**<     command qualifier for SETUP CALL PUTTING ALL OTHER CALLS ON HOLD                */
+       SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD_WITH_REDIAL = 0x03, /**< command qualifier for SETUP CALL PUTTING ALL OTHER CALLS ON HOLD WITH REDIAL            */
+       SETUP_CALL_DISCONN_ALL_OTHER_CALLS = 0x04, /**< command qualifier for SETUP CALL DISCONNECTING ALL OTHER CALLS          */
+       SETUP_CALL_DISCONN_ALL_OTHER_CALLS_WITH_REDIAL = 0x05, /**<     command qualifier for SETUP CALL DISCONNECTING ALL OTHER CALLS WITH REDIAL              */
+       SETUP_CALL_RESERVED = 0xFF /**< command qualifier for SETUP CALL RESERVED               */
+};
+
+struct tel_sat_cmd_qualifier_setup_call{
+       enum setup_call_command setup_call;
+};
+
+enum presentation_type{
+       PRESENTATION_TYPE_NOT_SPECIFIED = 0x00,
+       PRESENTATION_TYPE_DATA_VALUE                    = 0x01,
+       PRESENTATION_TYPE_NAVIGATION_OPTION     = 0x02
+
+};
+
+enum selection_preference_type {
+       SELECTION_PREFERENCE_NONE_REQUESTED = 0,
+       SELECTION_PREFERENCE_USING_SOFT_KEY = 1
+};
+
+struct tel_sat_cmd_qualifier_select_item{
+       enum presentation_type presentation_type;
+       enum selection_preference_type select_preference;
+       gboolean help_info;
+};
+
+struct tel_sat_cmd_qualifier_send_sms{
+       gboolean packing_by_me_required;
+};
+
+struct tel_sat_cmd_qualifier_language_notification{
+       gboolean specific_language;
+};
+
+enum launch_browser_command{
+       LAUNCH_BROWSER_IF_NOT_ALREADY_LAUNCHED = 0, /**<        command qualifier for  LAUNCH BROWSER           */
+       LAUNCH_BROWSER_NOT_USED = 1, /**<       command qualifier for  NOT USED         */
+       LAUNCH_BROWSER_USE_EXISTING_BROWSER = 2, /**<   command qualifier for  USE EXISTING BROWSER if secure session, do not use it.           */
+       LAUNCH_BROWSER_CLOSE_AND_LAUNCH_NEW_BROWSER = 3, /**<   command qualifier for CLOSE AND LAUNCH NEW BROWSER              */
+       LAUNCH_BROWSER_NOT_USED2 = 4, /**<      command qualifier for  NOT USED2                */
+       LAUNCH_BROWSER_RESERVED = 0xFF /**<     reserved        */
+};
+
+struct tel_sat_cmd_qualifier_launch_browser{
+       enum launch_browser_command launch_browser;
+};
+
+struct tel_sat_cmd_qualifier_setup_menu{
+       enum selection_preference_type select_preference;
+       gboolean help_info;
+};
+
+struct tel_sat_cmd_qualifier_open_channel{
+       gboolean immediate_link;
+       gboolean automatic_reconnection;
+       gboolean background_mode;
+};
+
+struct tel_sat_cmd_qualifier_send_data{
+       gboolean send_data_immediately;
+};
+
+struct tel_sat_cmd_detail_info{
+       int cmd_num; /**< specific command number       */
+       enum tel_sat_proactive_cmd_type cmd_type; /**<  proactive command type          */
+       union {
+               struct tel_sat_cmd_qualifier_display_text display_text;
+               struct tel_sat_cmd_qualifier_get_inkey get_inkey;
+               struct tel_sat_cmd_qualifier_get_input get_input;
+               struct tel_sat_cmd_qualifier_play_tone play_tone;
+               struct tel_sat_cmd_qualifier_setup_menu setup_menu; /**<        setup menu command qualifier info       */
+               struct tel_sat_cmd_qualifier_select_item select_item;
+               struct tel_sat_cmd_qualifier_send_sms send_sms;
+               struct tel_sat_cmd_qualifier_setup_call setup_call;
+               struct tel_sat_cmd_qualifier_refresh refresh;
+               struct tel_sat_cmd_qualifier_provide_local_info provide_local_info;
+               struct tel_sat_cmd_qualifier_language_notification language_notification;
+               struct tel_sat_cmd_qualifier_launch_browser launch_browser;
+               struct tel_sat_cmd_qualifier_open_channel open_channel;
+               struct tel_sat_cmd_qualifier_send_data send_data;
+       }cmd_qualifier; /**<    Union   */
+};
+
+/*
+ * 8.7 Device identities
+ */
+enum device_identity{
+       DEVICE_ID_KEYPAD = 0x01,
+       DEVICE_ID_DISPLAY = 0x02,
+       DEVICE_ID_EARPIECE = 0x03,
+       //21-27 for channel
+       DEVICE_ID_SIM = 0x81,
+       DEVICE_ID_ME = 0x82,
+       DEVICE_ID_NETWORK = 0x83,
+       DEVICE_ID_RESERVED = 0XFF
+};
+
+struct tel_sat_device_identities{
+       enum device_identity src;
+       enum device_identity dest;
+};
+
+/*
+ * 8.8 Duration
+ */
+enum time_unit_type{
+       TIME_UNIT_MINUTES                                               = 0x0,
+       TIME_UNIT_SECONDS                                               = 0x01,
+       TIME_UNIT_TENTHS_OF_SECONDS                     = 0x02,
+       TIME_UNIT_RESERVED                                              = 0xFF
+};
+
+struct tel_sat_duration{
+       enum time_unit_type time_unit;
+       unsigned char time_interval;
+};
+
+/*
+ * 8.9 Item
+ */
+struct tel_sat_item_info{
+       unsigned char item_id;
+       unsigned char text_len;
+       unsigned char text[SAT_ITEM_TEXT_LEN_MAX + 1];
+       struct data_coding_scheme dcs;
+};
+
+/*
+ * 8.10 Item identifier
+ */
+struct tel_sat_item_identifier{
+       unsigned char item_identifier;
+};
+
+/*
+ * 8.11 Response length
+ */
+struct tel_sat_response_length{
+       unsigned char min;
+       unsigned char max;
+};
+
+/*
+ * 8.12 Result
+ */
+enum tel_sat_result_type{
+       RESULT_SUCCESS = 0x0, /**<      command performed successfully */
+       RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION = 0x01, /**<  command performed with partial comprehension    */
+       RESULT_SUCCESS_WITH_MISSING_INFO = 0x02, /**<   command performed, with missing information     */
+
+       RESULT_REFRESH_PERFORMED_WITH_ADDITIONAL_EFS_READ = 0x03, /**<  REFRESH PERFORMED WITH ADDITIONAL EFS READ              */
+       RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED = 0x04, /**<    command performed but REQUESTED ICON NOT DISPLAYED                      */
+       RESULT_SUCCESS_BUT_MODIFIED_BY_CALL_CONTROL_BY_SIM = 0x05, /**< command performed but MODIFIED BY CALL CONTROL BY SIM           */
+       RESULT_SUCCESS_LIMITED_SERVICE = 0x06, /**<     command performed with LIMITED SERVICE          */
+       RESULT_SUCCESS_WITH_MODIFICATION = 0x07, /**<   command performed with MODIFICATION             */
+       RESULT_REFRESH_PRFRMD_BUT_INDICATED_USIM_NOT_ACTIVE = 0x08, /**<        REFRESH PERFORMED BUT INDICATED USIM NOT ACTIVE         */
+       RESULT_SUCCESS_BUT_TONE_NOT_PLAYED = 0x09, /**< command performed successfully, tone not played*/
+
+       RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER = 0x10, /**<        proactive sim application session terminated by user            */
+       RESULT_BACKWARD_MOVE_BY_USER = 0x11, /**<       backward move in the proactive sim application session request by the user              */
+       RESULT_NO_RESPONSE_FROM_USER = 0x12, /**<       no response from user           */
+
+       RESULT_HELP_INFO_REQUIRED_BY_USER = 0x13, /**<  HELP INFO REQUIRED BY USER              */
+       RESULT_USSD_OR_SS_TRANSACTION_TERMINATED_BY_USER = 0x14, /**<   USSD OR SS TRANSACTION TERMINATED BY USER       */
+
+       RESULT_ME_UNABLE_TO_PROCESS_COMMAND = 0x20, /**<        ME currently unable to process command          */
+       RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND = 0x21, /**<   Network currently unable to process command             */
+       RESULT_USER_DID_NOT_ACCEPT_CALL_SETUP_REQ = 0x22, /**<  User did not accept call setup request          */
+       RESULT_USER_CLEAR_DOWN_CALL_BEFORE_CONN = 0x23, /**<    User cleared down call before connection or network released            */
+
+       RESULT_INTERACTION_WITH_CC_BY_SIM_IN_TMP_PRBLM = 0x25, /**<     INTERACTION WITH CALL CONTROL BY SIM IN TEMPORARY PROBLEM               */
+       RESULT_LAUNCH_BROWSER_GENERIC_ERROR_CODE = 0x26, /**<   LAUNCH BROWSER GENERIC ERROR CODE               */
+
+       RESULT_BEYOND_ME_CAPABILITIES = 0x30, /**<      command beyond ME's capabilities                */
+       RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME = 0x31, /**<   command type not understood by ME               */
+       RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME = 0x32, /**<   command data not understood by ME               */
+       RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME = 0x33, /**<      command number not known by ME          */
+       RESULT_SS_RETURN_ERROR = 0x34, /**<     SS return error         */
+       RESULT_SMS_RP_ERROR = 0x35, /**<        SMS rp-error            */
+       RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING = 0x36, /**<   Error, required values are missing      */
+
+       RESULT_USSD_RETURN_ERROR = 0x37, /**<   USSD_RETURN_ERROR               */
+       RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM = 0x39, /**<     INTERACTION WITH CALL CONTROL OR SMS CONTROL PERMANENT PROBLEM  */
+       RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR = 0x3A, /**<   BEARER INDEPENDENT PROTOCOL ERROR               */
+       RESULT_FRAMES_ERROR = 0x3C /**< FRAMES ERROR            */
+};
+
+enum tel_sat_me_problem_type{
+       ME_PROBLEM_NO_SPECIFIC_CAUSE = 0x0, /**<        ME problem with NO SPECIFIC CAUSE               */
+       ME_PROBLEM_SCREEN_BUSY = 0x01, /**<     ME problem with SCREEN BUSY             */
+       ME_PROBLEM_ME_BUSY_ON_CALL = 0x02, /**< ME problem with ME BUSY ON CALL         */
+       ME_PROBLEM_ME_BUSY_ON_SS = 0x03, /**<   ME problem with ME_BUSY ON SS           */
+       ME_PROBLEM_NO_SERVICE = 0x04, /**<      ME problem with NO SERVICE              */
+       ME_PROBLEM_ACCESS_CONTROL_CLASS_BAR = 0x05, /**<        ME problem with ACCESS CONTROL CLASS BAR                */
+       ME_PROBLEM_RADIO_RES_NOT_GRANTED = 0x06, /**<   ME problem with RADIO RES NOT GRANTED           */
+       ME_PROBLEM_NOT_IN_SPEECH_CALL = 0x07, /**<      ME problem with NOT IN SPEECH CALL      */
+       ME_PROBLEM_ME_BUSY_ON_USSD = 0x08, /**< ME problem with ME BUSY ON USSD         */
+       ME_PROBLEM_ME_BUSY_ON_SEND_DTMF_CMD = 0x09, /**<        ME problem with ME BUSY ON SEND DTMF CMD        */
+       ME_PROBLEM_NO_USIM_ACTIVE = 0x0A, /**<  ME problem with NO USIM ACTIVE          */
+       ME_PROBLEM_INVALID = 0xFF /**<  ME problem with INVALID         */
+};
+
+enum tel_sat_user_confirm_type{
+       USER_CONFIRM_NOT_SPECIFIED = -1,                        /**<This Enum Informs That not specified */
+       USER_CONFIRM_YES = 0,                                           /**<This Enum Informs That user confirms yes */
+       USER_CONFIRM_NO_OR_CANCEL,                              /**<This enum informs that user confirms no/cancel */
+       USER_CONFIRM_HELP_INFO,                         /**<This enum informs that user wants help information */
+       USER_CONFIRM_END,                                               /**<This enum informs that user confirms end */
+       USER_CONFIRM_TIMEOUT,                                   /**<This enum informs that user did not respond */
+};
+
+enum tel_sat_call_ctrl_problem_type{
+       CC_PROBLEM_NO_SPECIFIC_CAUSE = 0, /**<  Call Control problem with no specific cause             */
+       CC_PROBLEM_ACTION_NOT_ALLOWED = 1, /**< Call Control problem with action not allowed    */
+       CC_PROBLEM_REQUEST_TYPE_HAS_CHANGED = 2 /**<    Call Control problem with request type has changed      */
+};
+
+enum ss_problem_type{
+       SATK_SS_PROBLEM_NO_SPECIFIC_CAUSE                       = 0,
+       SATK_SS_PROBLEM_FACILITY_NOT_SUPPORTED          = 0x15
+};
+
+enum ussd_problem_type{
+       SATK_USSD_PROBLEM_NO_SPECIFIC_CAUSE                     = 0,
+       SATK_USSD_PROBLEM_UNKNOWN_ALPHABET                      = 0x47
+};
+
+enum network_problem_type{
+       NETWORK_PROBLEM_NO_SPECIFIC_CAUSE = 0x0, /**<   Network problem with no specific cause          */
+       NETWORK_PROBLEM_USER_BUSY = 0x91 /**<   Network problem with USER BUSY          */
+};
+
+enum browser_problem_type{
+       BROWSER_PROBLEM_NO_SPECIFIC_CAUSE = 0, /**<     Browser problem with no specific cause          */
+       BROWSER_PROBLEM_BEARER_UNAVAILABLE = 1, /**<    Browser problem with bearer unavailable         */
+       BROWSER_PROBLEM_BROWSER_UNAVAILABLE = 2, /**<   Browser problem with browser unavailable                */
+       BROWSER_PRBLM_ME_UNABLE_TO_READ_PROV_DATA = 3 /**<      Browser problem with ME unable to read provisioning data                */
+};
+
+enum bip_problem_type{
+       BIP_PROBLEM_NO_SPECIFIC_CAUSE = 0x00, /**<      BIP problem with no specific cause      */
+       BIP_PROBLEM_NO_CHANNEL_AVAILABLE = 0x01, /**<   BIP problem with no channel available           */
+       BIP_PROBLEM_CHANNEL_CLOSED = 0x02, /**< BIP problem with channel closed         */
+       BIP_PROBLEM_CHANNEL_ID_NOT_VALID = 0x03, /**<   BIP problem with channel id not valid           */
+       BIP_PROBLEM_BUF_SIZE_NOT_AVAILABLE = 0x04, /**< BIP problem with buffer size not available              */
+       BIP_PROBLEM_SECURITY_ERROR = 0x05, /**< BIP problem with security error         */
+       BIP_PRBLM_SIM_ME_IF_TRNSPRT_LEVEL_NOT_AVL = 0x06, /**<  BIP problem with SIM ME interface transport level not available         */
+       BIP_REMOTE_DEV_NOT_REACHABLE = 0x07, /**<       BIP problem with remote device not reachable            */
+       BIP_SERVICE_ERROR = 0x08, /**<  BIP service error               */
+       BIP_SERVICE_IDENTIFIER_UNKNOWN = 0x09 /**<      BIP service identifier unknown          */
+};
+
+/*
+ * 8.13 3GPP SMS TPDU
+ */
+enum sms_tpdu_type{
+       SMS_TPDU_TYPE_DELIVER_TPDU      = 0,
+       SMS_TPDU_TYPE_DELIVER_RPT       = 1,
+       SMS_TPDU_TYPE_SUBMIT_TPDU       = 2,
+       SMS_TPDU_TYPE_SUBMIT_RPT        = 3,
+       SMS_TPDU_TYPE_STATUS_RPT        = 4,
+       SMS_TPDU_TYPE_TPDU_CMD          = 5
+};
+
+struct tel_sat_sms_tpdu{
+       enum sms_tpdu_type tpdu_type;
+       int data_len;
+       char data[SAT_SMS_TPDU_SMS_DATA_LEN_MAX];
+};
+
+/*
+ * 8.14 SS string
+ */
+struct tel_sat_ss_string{
+       enum type_of_number ton;
+       enum numbering_plan_identifier npi;
+       unsigned char string_len;                                       /**< SS string length */
+       char ss_string[SAT_SS_STRING_LEN_MAX];  /**< SS stringr*/
+};
+
+/*
+ * 8.15 Text string
+ */
+struct tel_sat_text_string_object{
+       int is_digit_only;
+       struct data_coding_scheme dcs;
+       int string_length;
+       char string[SAT_TEXT_STRING_LEN_MAX+1];
+};
+
+/*
+ * 8.16 TONE
+ */
+enum tone_type{
+       // standard supervisory tones
+       DIAL_TONE = 0x01, /**<  TONE TYPE DIAL TONE             */
+       CALLED_SUBSCRIBER_BUSY = 0x02, /**<     TONE TYPE CALLED SUBSCRIBER BUSY                */
+       CONGESTION = 0x03, /**< TONE TYPE CONGESTION    */
+       RADIO_PATH_ACK = 0x04, /**<     TONE TYPE RADIO PATH ACK        */
+       RADIO_PATH_NOT_AVAILABLE_CALL_DROPPED = 0x05, /**<      TONE TYPE RADIO PATH NOT AVAILABLE CALL DROPPED */
+       ERR_SPECIAL_INFO = 0x06, /**<   TONE TYPE ERR SPECIAL INFO      */
+       CALL_WAITING_TONE = 0x07, /**<  TONE TYPE CALL WAITING TONE             */
+       RINGING_TONE = 0x08, /**<       TONE TYPE RINGING TONE  */
+
+       // ME proprietary tones
+       GENERAL_BEEP = 0x10, /**<       TONE TYPE GENERAL BEEP          */
+       POSITIVE_ACK_TONE = 0x11, /**<  TONE TYPE POSITIVE ACK TONE             */
+       NEGATIVE_ACK_OR_ERROR_TONE = 0x12, /**< TONE TYPE NEGATIVE ACK OR ERROR TONE            */
+       RINGING_TONE_SLCTD_BY_USR_FOR_INCOM_SPEECH_CALL = 0x13, /**<    TONE TYPE RINGING TONE SELECTED BY USER FOR INCOMING SPEECH CALL        */
+       ALERT_TONE_SELECTED_BY_USER_FOR_INCOMING_SMS = 0x14, /**<       TONE TYPE ALERT TONE SELECTED BY USER FOR INCOMING SMS          */
+       CRITICAL_ALERT = 0x15, /**<     TONE TYPE CRITICAL ALERT                */
+
+       //Themed tones
+       HAPPY_TONE = 0x30, /**< TONE TYPE HAPPY TONE            */
+       SAD_TONE = 0x31, /**<   TONE TYPE SAD TONE                      */
+       URGENT_ACTION_TONE = 0x32, /**< TONE TYPE URGENT ACTION TONE            */
+       QUESTION_TONE = 0x33, /**<      TONE TYPE QUESTION TONE         */
+       MESSAGE_RECEIVED_TONE = 0x34, /**<      TONE TYPE MESSAGE RECEIVED TONE         */
+
+       //Melody tones
+       MELODY_1 = 0x40, /**<   TONE TYPE MELODY 1              */
+       MELODY_2 = 0x41, /**<   TONE TYPE MELODY 2              */
+       MELODY_3 = 0x42, /**<   TONE TYPE MELODY 3              */
+       MELODY_4 = 0x43, /**<   TONE TYPE MELODY 4              */
+       MELODY_5 = 0x44, /**<   TONE TYPE MELODY 5              */
+       MELODY_6 = 0x45, /**<   TONE TYPE MELODY 6              */
+       MELODY_7 = 0x46, /**<   TONE TYPE MELODY 7              */
+       MELODY_8 = 0x47, /**<   TONE TYPE MELODY 8              */
+
+       TONE_TYPE_RESERVED = 0xFF /**<  TONE TYPE RESERVED              */
+};
+
+struct tel_sat_tone{
+       enum tone_type tone_type;
+};
+
+/*
+ * 8.17 USSD string
+ */
+struct tel_sat_ussd_string{
+       struct data_coding_scheme dsc;
+       unsigned char string_len;                                       /**< USSD string length */
+       char ussd_string[SAT_USSD_STRING_LEN_MAX];      /**< USSD stringr*/
+};
+
+/*
+ * 8.18 File List
+ */
+/* use enum tel_sim_file_id in sim.h*/
+
+struct tel_sat_file_list{
+       int file_count;
+       enum tel_sim_file_id file_id[SAT_FILE_ID_LIST_MAX_COUNT];
+};
+
+/*
+ * 8.19 Location information
+ */
+struct tel_sat_location_information{
+       char mcc[3+1];
+       char mnc[3+1];
+       char lac [4+1];
+       char cell_id[4+1];
+       char extended_cell_id[4+1];
+};
+
+/*
+ * 8.20 IMEI
+ */
+struct tel_sat_imei{
+       char imei[8+1]; // length is defined by 8 in TS 102 223
+};
+
+/*
+ * 8.22 Network measurement results
+ */
+struct tel_sat_network_measurement_results{
+       char nmr[10+1]; // length is defined by 10 in TS 102 223
+};
+
+/*
+ * 8.23 Default text
+ * It is the same as Text string(8.15)
+ */
+
+/*
+ * 8.24 Items next action indicator
+ */
+struct tel_sat_item_next_action_indicatior_list{
+       unsigned char cnt;
+       unsigned char indicator_list[SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT];
+};
+
+/*
+ * 8.25 Event list
+ */
+enum event_list{
+       EVENT_MT_CALL = 0,
+       EVENT_CALL_CONNECTED = 1,
+       EVENT_CALL_DISCONNECTED = 2,
+       EVENT_LOCATION_STATUS = 3,
+       EVENT_USER_ACTIVITY = 4, /**<   data download type - USER_ACTIVITY              */
+       EVENT_IDLE_SCREEN_AVAILABLE = 5, /**<   data download type - IDLE SCREEN AVAILABLE              */
+       EVENT_CARD_READER_STATUS = 6,
+       EVENT_LANGUAGE_SELECTION = 7, /**<      data download type - LANGUAGE SELECTION         */
+       EVENT_BROWSER_TERMINATION = 8, /**<     data download type - BROWSER TERMINATION                */
+       EVENT_DATA_AVAILABLE = 9, /**<  data download type -DATA AVAILABLE              */
+       EVENT_CHANNEL_STATUS = 0x0A, /**<       data download type - CHANNEL STATUS             */
+       EVENT_ACCESS_TECHNOLOGY_CHANGED = 0x0B,
+       EVENT_DISPLAY_PARAMETERS_CHANGED = 0x0C,
+       EVENT_LOCAL_CONNECTION = 0x0D,
+       EVENT_NW_SEARCH_MODE_CHANGED = 0X0E,
+       EVENT_BROWSING_STATUS = 0X0F,
+       EVENT_FRAMES_INFORMATION_CHANGED = 0X10,
+       EVENT_RESERVED_FOR_3GPP = 0X11,
+       EVENT_UNKNOWN = 0xFF /**<       data download type - unknown            */
+};
+
+struct tel_sat_event_list{
+       int event_list_cnt;
+       enum event_list evt_list[SAT_EVENT_LIST_MAX];
+};
+
+/*
+ * 8.42 BC repeat indicator
+ */
+enum bc_repeat_indi_type{
+       BC_REPEAT_INDI_ALTERNATE_MODE = 0x01, /**<      BC REPEAT ALTERNATE MODE                */
+       BC_REPEAT_INDI_SEQUENTIAL_MODE = 0x03, /**<     BC REPEAT SEQUENTIAL MODE               */
+       BC_REPEAT_INDI_RESERVED = 0xFF /**<     RESERVED        */
+};
+
+struct tel_sat_repeat_indicator_type{
+       enum bc_repeat_indi_type bc_indi_repeat_type;
+};
+
+/*
+ * 8.30 Call control requested action
+ */
+struct tel_sat_call_ctrl_req_action{
+       struct tel_sat_address address;
+       struct tel_sat_ccp ccp1;
+       struct tel_sat_subaddress sub_address;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_repeat_indicator_type bc_repeat_type;
+       struct tel_sat_ccp ccp2;
+};
+
+/*
+ * 8.31 Icon identifier
+ */
+/*enum img_coding_scheme{
+       IMAGE_CODING_SCHEME_BASIC = 0x11,
+       IMAGE_CODING_SCHEME_COLOUR = 0x21,
+       IMAGE_CODING_SCHEME_RESERVED = 0xFF
+};*/
+
+enum icon_qualifier{
+       ICON_QUALI_SELF_EXPLANATORY = 0,
+       ICON_QUALI_NOT_SELF_EXPLANATORY = 1,
+       ICON_QUALI_RESERVED = 0xFF
+};
+
+struct tel_sat_icon{
+       unsigned char width;
+       unsigned char height;
+       enum img_coding_scheme ics;
+       unsigned short icon_data_len;
+       unsigned short clut_data_len;
+       char icon_file[SAT_IMG_DATA_FILE_PATH_LEN_MAX];
+       char clut_file[SAT_IMG_DATA_FILE_PATH_LEN_MAX];
+};
+
+struct tel_sat_icon_identifier{
+       gboolean is_exist;
+       enum icon_qualifier icon_qualifer;
+       unsigned char icon_identifier;
+       struct tel_sat_icon icon_info;
+};
+
+/*
+ * 8.32 Item icon identifier next_action_indicator_list
+ */
+struct tel_sat_icon_identifier_list{
+       gboolean is_exist;
+       enum icon_qualifier icon_qualifer;
+       unsigned char icon_cnt;
+       unsigned char icon_id_list[SAT_ICON_LIST_MAX_COUNT];
+       struct tel_sat_icon icon_info[SAT_ICON_LIST_MAX_COUNT];
+};
+
+/*
+ * 8.39 date, time and timezone
+ */
+struct tel_sat_date_time_and_timezone{
+       unsigned char year; /**<        year    */
+       unsigned char month; /**<       month   */
+       unsigned char day; /**< day     */
+       unsigned char hour; /**<        hour    */
+       unsigned char minute; /**<      minute  */
+       unsigned char second; /**<      second  */
+       unsigned char timeZone; /**<    timeZone        */
+};
+
+/*
+ * 8.44 DTMF string
+ */
+struct tel_sat_dtmf_string{
+       int dtmf_length;
+       char dtmf_string[SAT_DTMF_STRING_LEN_MAX];
+};
+
+/*
+ * 8.45 Language
+ */
+/*
+ * Refer enum tel_sim_language_type in sim.h
+ */
+
+/*
+ * 8.47 Browser Identity
+ */
+enum browser_identity{
+       BROWSER_ID_DEFAULT = 0, /**<    DEFAULT BROWSER         */
+       BROWSER_ID_WML, /**<    BROWSER WML     */
+       BROWSER_ID_HTML, /**<   BROWSER HTML    */
+       BROWSER_ID_XHTML, /**<  BROWSER XHTML   */
+       BROWSER_ID_CHTML, /**<  BROWSER CHTML   */
+       BROWSER_ID_RESERVED = 0xFF /**< RESERVED        */
+};
+
+/*
+ * 8.48 URL
+ * URL shall be coded as defined in RFC 1738 on using the "SMS 7bit default alphabet" with bit 8 set to 0.
+ */
+struct tel_sat_url{
+       int url_length;
+       char url[SAT_URL_LEN_MAX];
+};
+
+/*
+ * 8.49 Bear
+ */
+enum bearer_list_type{
+       BEARER_LIST_SMS = 0, /**<       BEARER SMS              */
+       BEARER_LIST_CSD = 1, /**<       BEARER CSD              */
+       BEARER_LIST_USSD = 2, /**<      BEARER USSD             */
+       BEARER_LIST_GPRS = 3, /**<      BEARER GPRS             */
+       BEARER_LIST_RESERVED = 0xFF /**<        BEARER RESERVED         */
+};
+
+struct tel_sat_bearer_list{
+       int count;
+       enum bearer_list_type bear[6];
+};
+
+/*
+ * 8.50 Provisioning file reference
+ */
+struct tel_sat_provisioning_file_ref{
+       int file_path_length;
+       char file_path[SAT_PROVISIONING_FILE_PATH_LEN_MAX];
+};
+
+
+/*
+ * 8.51 Browser termination cause
+ */
+enum browser_termination_cause{
+       BROWSER_TERMINATED_BY_USER = 0, /**<    BROWSER TERMINATED BY USER              */
+       BROWSER_TERMINATED_BY_ERROR = 1, /**<   BROWSER TERMINATED BY ERROR             */
+};
+
+/*
+ * 8.52 Bearer description
+ */
+enum bearer_type{
+       BEARER_CSD = 0x1, /**<  BEARER DESC CSD         */
+       BEARER_GPRS = 0x2, /**< BEARER DESC GPRS                */
+       BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER = 0x3, /**<  BEARER DESC DEFAULT BEARER FROM TRANSPORT LAYER         */
+       BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT = 0x4, /**<    BEARER DESC LOCAL LINK TECHNOLOGY INDEPENDENT           */
+       BEARER_BLUETOOTH = 0x5, /**<    BEARER DESC BLUETOOTH   */
+       BEARER_IrDA = 0x6, /**< BEARER DESC IrDA        */
+       BEARER_RS232 = 0x7, /**<        BEARER DESC RS232       */
+       BEARER_USB = 0x10, /**< BEARER DESC USB */
+       BEARER_RESERVED = 0xFF /**<     RESERVED        */
+};
+
+enum bearer_param_cs_data_rate{
+       BIP_DR_AUTOBAUDING = 0, /**<    CSD data rate - AUTOBAUDING             */
+       BIP_DR_300BPS_V21 = 1, /**<     CSD data rate -300BPS V21               */
+       BIP_DR_1200BPS_V22 = 2, /**<    CSD data rate - 1200BPS V22             */
+       BIP_DR_1200_75BPS_V23 = 3, /**< CSD data rate -1200 75BPS V23                   */
+       BIP_DR_2400BPS_V22 = 4, /**<    CSD data rate -2400BPS V22              */
+       BIP_DR_2400BPS_V26 = 5, /**<    CSD data rate - 2400BPS V26                     */
+       BIP_DR_4800BPS_V32 = 6, /**<    CSD data rate - 4800BPS V32             */
+       BIP_DR_9600BPS_V32 = 7, /**<    CSD data rate - 9600BPS V32             */
+       BIP_DR_9600BPS_V34 = 12, /**<   CSD data rate - 9600BPS_V34             */
+       BIP_DR_14400BPS_V34 = 14, /**<  CSD data rate -14400BPS V34             */
+       BIP_DR_19200BPS_V34 = 15, /**<  CSD data rate -19200BPS V34             */
+       BIP_DR_28800BPS_V34 = 16, /**<  CSD data rate -28800BPS V34             */
+       BIP_DR_33600BPS_V34 = 17, /**<  CSD data rate -33600BPS V34             */
+       BIP_DR_1200BPS_V120 = 34, /**<  CSD data rate -1200BPS V120             */
+       BIP_DR_2400BPS_V120 = 36, /**<  CSD data rate -2400BPS V120             */
+       BIP_DR_4800BPS_V120 = 38, /**<  CSD data rate -4800BPS V120             */
+       BIP_DR_9600BPS_V120 = 39, /**<  CSD data rate -9600BPS V120             */
+       BIP_DR_14400BPS_V120 = 43, /**< CSD data rate -14400BPS V120            */
+       BIP_DR_19200BPS_V120 = 47, /**< CSD data rate -19200BPS V120            */
+       BIP_DR_28800BPS_V120 = 48, /**< CSD data rate -28800BPS V120            */
+       BIP_DR_38400BPS_V120 = 49, /**< CSD data rate -38400BPS V120            */
+       BIP_DR_48000BPS_V120 = 50, /**< CSD data rate -48000BPS V120            */
+       BIP_DR_56000BPS_V120 = 51, /**< CSD data rate -56000BPS V120            */
+       BIP_DR_300BPS_V110 = 65, /**<   CSD data rate - 300BPS V110             */
+       BIP_DR_1200BPS_V110 = 66, /**<  CSD data rate -1200BPS V110             */
+       BIP_DR_2400BPS_V110_OR_X31_FALG_STUFFING = 68, /**<     CSD data rate - 2400BPS V110 OR X31 FALG STUFFING               */
+       BIP_DR_4800BPS_V110_OR_X31_FALG_STUFFING = 70, /**<     CSD data rate - 4800BPS V110 OR X31 FALG STUFFING               */
+       BIP_DR_9600BPS_V110_OR_X31_FALG_STUFFING = 71, /**<     CSD data rate - 9600BPS V110 OR X31 FALG STUFFING               */
+       BIP_DR_14400BPS_V110_OR_X31_FALG_STUFFING = 75, /**<    CSD data rate - 14400BPS V110 OR X31 FALG STUFFING              */
+       BIP_DR_19200BPS_V110_OR_X31_FALG_STUFFING = 79, /**<    CSD data rate -19200BPS V110 OR X31 FALG STUFFING               */
+       BIP_DR_28800BPS_V110_OR_X31_FALG_STUFFING = 80, /**<    CSD data rate -28800BPS V110 OR X31 FALG STUFFING               */
+       BIP_DR_38400BPS_V110_OR_X31_FALG_STUFFING = 81, /**<    CSD data rate -38400BPS V110 OR X31 FALG STUFFING               */
+       BIP_DR_48000BPS_V110_OR_X31_FALG_STUFFING = 82, /**<    CSD data rate -48000BPS V110 OR X31 FALG STUFFING               */
+       BIP_DR_56000BPS_V110_OR_X31_FALG_STUFFING = 83, /**<    CSD data rate -56000BPS V110 OR X31 FALG STUFFING               */
+       BIP_DR_64000BPS = 84, /**<      CSD data rate -64000BPS         */
+       BIP_DR_56000BPS_BIT_TRANSPERENT = 115, /**<     CSD data rate -56000BPS BIT TRANSPERENT         */
+       BIP_DR_64000BPS_BIT_TRANSPERENT = 116, /**<     CSD data rate -64000BPS BIT TRANSPERENT         */
+       BIP_DR_32000BPS_PIAFS32K = 120, /**<    CSD data rate -32000BPS PIAFS32K                */
+       BIP_DR_64000BPS_PIAFS64K = 121, /**<    CSD data rate - 64000BPS PIAFS64K               */
+       BIP_DR_28800BPS_MULTIMEDIA = 130, /**<  CSD data rate -28800BPS MULTIMEDIA              */
+       BIP_DR_32000BPS_MULTIMEDIA = 131, /**<  CSD data rate -32000BPS MULTIMEDIA              */
+       BIP_DR_33600BPS_MULTIMEDIA = 132, /**<  CSD data rate - 33600BPS MULTIMEDIA             */
+       BIP_DR_56000BPS_MULTIMEDIA = 133, /**<  CSD data rate -56000BPS MULTIMEDIA              */
+       BIP_DR_64000BPS_MULTIMEDIA = 134 /**<   CSD data rate -64000BPS MULTIMEDIA              */
+};
+
+enum bearer_param_cs_service_type{
+       BIP_CSD_BS_DATA_CIRCUIT_ASYNC_UDI = 0, /**<     CSD Bearer service - DATA CIRCUIT ASYNCHRONOUS UDI              */
+       BIP_CSD_BS_DATA_CIRCUIT_SYNC = 1, /**<  CSD Bearer service - DATA CIRCUIT SYNCHRONOUS UDI               */
+       BIP_CSD_BS_PAD_ACCESS_ASYNC_UDI = 2, /**<       CSD Bearer service - PAD ACCESS ASYNCHRONOUS UDI                        */
+       BIP_CSD_BS_PACKET_ACCESS_SYNC = 3, /**< CSD Bearer service - PACKET ACCESS SYNCHRONOUS UDI              */
+       BIP_CSD_BS_DATA_CIRCUIT_ASYNC_RDI = 4, /**<     CSD Bearer service - DATA CIRCUIT ASYNCHRONOUS RDI              */
+       BIP_CSD_BS_DATA_CIRCUIT_SYNC_RDI = 5, /**<      CSD Bearer service - DATA CIRCUIT SYNCHRONOUS RDI               */
+       BIP_CSD_BS_PAD_ACCESS_ASYNC_RDI = 6, /**<       CSD Bearer service - PAD ACCESS ASYNCHRONOUS RDI                */
+       BIP_CSD_BS_PACKET_ACCESS_SYNC_RDI = 7 /**<      CSD Bearer service - PACKET ACCESS SYNCHRONOUS RDI              */
+};
+
+enum bearer_param_cs_connection_element_type{
+       BIP_CSD_CONN_ELEM_TRANSPARENT = 0, /**< CSD connection element - TRANSPARENT            */
+       BIP_CSD_CONN_ELEM_NON_TRANSPARENT = 1, /**<     CSD connection element - NON TRANSPARENT                */
+       BIP_CSD_CONN_ELEM_BOTH_TRANSPARENT_PREF = 2, /**<       CSD connection element -BOTH TRANSPARENT PREFFERED              */
+       BIP_CSD_CONN_ELEM_BOTH_NON_TRANSPARENT_PREF = 3 /**<    CSD connection element -  NON TRANSPARENT PREFFERED             */
+};
+
+struct tel_sat_bearer_param_cs_bearer{
+       enum bearer_param_cs_data_rate data_rate;
+       enum bearer_param_cs_service_type service_type;
+       enum bearer_param_cs_connection_element_type connection_element_type;
+};
+
+enum bearer_param_ps_precedence_class{
+       BIP_GPRS_PRECED_CLASS_HIGH_PRIORITY = 0x01, /**<        GPRS precedence class -HIGH PRIORITY            */
+       BIP_GPRS_PRECED_CLASS_NORM_PRIORITY = 0x02, /**<        GPRS precedence class -NORM PRIORITY            */
+       BIP_GPRS_PRECED_CLASS_LOW_PRIORITY = 0x03 /**<  GPRS precedence class - LOW PRIORITY            */
+};
+
+enum bearer_param_ps_delay_class{
+       BIP_GPRS_DELAY_CLASS_1 = 0x01, /**<     GPRS delay class - 1            */
+       BIP_GPRS_DELAY_CLASS_2 = 0x02, /**<     GPRS delay class -      2       */
+       BIP_GPRS_DELAY_CLASS_3 = 0x03, /**<     GPRS delay class -      3       */
+       BIP_GPRS_DELAY_CLASS_4 = 0x04 /**<      GPRS delay class - 4            */
+};
+
+enum bearer_param_ps_reliability_class{
+       BIP_GPRS_RELIABILITY_CLASS_1 = 0x01, /**<       GPRS Reliability class -1               */
+       BIP_GPRS_RELIABILITY_CLASS_2 = 0x02, /**<       GPRS Reliability class -2               */
+       BIP_GPRS_RELIABILITY_CLASS_3 = 0x03, /**<       GPRS Reliability class -3               */
+       BIP_GPRS_RELIABILITY_CLASS_4 = 0x04, /**<       GPRS Reliability class -4               */
+       BIP_GPRS_RELIABILITY_CLASS_5 = 0x05 /**<        GPRS Reliability class -5               */
+};
+
+enum bearer_param_ps_peak_throughput_class{
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_8KBPS = 0x01, /**<  GPRS peak throughput class- UPTO 8KBPS          */
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_16KBPS = 0x02, /**< GPRS peak throughput class- UPTO 16KBPS         */
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_32KBPS = 0x03, /**< GPRS peak throughput class-UPTO 32KBPS          */
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_64KBPS = 0x04, /**< GPRS peak throughput class-UPTO 64KBPS          */
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_128KBPS = 0x05, /**<        GPRS peak throughput class- UPTO 128KBPS                        */
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_256KBPS = 0x06, /**<        GPRS peak throughput class- UPTO 256KBPS                        */
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_512KBPS = 0x07, /**<        GPRS peak throughput class- UPTO 512KBPS                */
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_1024KBPS = 0x08, /**<       GPRS peak throughput class-UPTO 1024KBPS                */
+       BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_2048KBPS = 0x09 /**<        GPRS peak throughput class- UPTO 2048KBPS               */
+};
+
+enum bearer_param_ps_mean_throughput_class{
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_DOT_22_BPS = 0x01, /**<  GPRS mean throughput class - DOT 22 BPS         */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_DOT_44_BPS = 0x02, /**<  GPRS mean throughput class - DOT 44 BPS         */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_1_DOT_11_BPS = 0x03, /**<        GPRS mean throughput class -1 DOT 11 BPS                */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_2_DOT_2_BPS = 0x04, /**< GPRS mean throughput class -2 DOT 2 BPS         */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_2_DOT_4_BPS = 0x05, /**< GPRS mean throughput class -2 DOT 4 BPS         */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_11_DOT_1_BPS = 0x06, /**<        GPRS mean throughput class - 11 DOT 1 BPS               */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_22BPS = 0x07, /**<       GPRS mean throughput class -22BPS               */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_44BPS = 0x08, /**<       GPRS mean throughput class - 44BPS              */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_111BPS = 0x09, /**<      GPRS mean throughput class - 111BPS             */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_DOT_22_KBPS = 0x0A, /**< GPRS mean throughput class - DOT 22 KBPS                */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_DOT_44_KBPS = 0x0B, /**< GPRS mean throughput class -DOT 44 KBPS         */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_1_DOT_11_KBPS = 0x0C, /**<       GPRS mean throughput class -1 DOT 11 KBPS               */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_2_DOT_2_KBPS = 0x0D, /**<        GPRS mean throughput class -2 DOT 2 KBPS                */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_4_DOT_4_KBPS = 0x0E, /**<        GPRS mean throughput class - 4 DOT 4 KBPS               */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_11_DOT_1_KBPS = 0x0F, /**<       GPRS mean throughput class -11 DOT 1 KBPS               */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_22KBPS = 0x10, /**<      GPRS mean throughput class - 22KBPS             */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_44KBPS = 0x11, /**<      GPRS mean throughput class - 44KBPS             */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_111KBPS = 0x12, /**<     GPRS mean throughput class -111KBPS             */
+       BIP_GPRS_MEAN_THROUGHPUT_CLASS_BEST_EFFORT = 0x13 /**<  GPRS mean throughput class - BEST EFFORT                */
+};
+
+enum bearer_param_ps_pdp_type{
+       BIP_GPRS_PDP_TYPE_IP = 0x02, /**<       bearer parameter GPRS pdp type - IP             */
+       BIP_GPRS_PDP_TYPE_RESERVED = 0xff /**<  reserved                */
+};
+
+struct tel_sat_bearer_param_ps_bearer{
+       enum bearer_param_ps_precedence_class precedence_class;
+       enum bearer_param_ps_delay_class delay_class;
+       enum bearer_param_ps_reliability_class reliability_class;
+       enum bearer_param_ps_peak_throughput_class peak_throughput_class;
+       enum bearer_param_ps_mean_throughput_class mean_throughput_class;
+       enum bearer_param_ps_pdp_type pdp_type;
+};
+
+enum bearer_param_local_link_service_type{
+       BIP_LL_SERVICE_IDENT_VALUE_ASSIGNED_BY_USIM = 0x00, /**<        local links service identity - value assigned by USIM           */
+       BIP_LL_SERVICE_IDENT_VALUE_ASSIGNED_BY_REMOTED_DEVICE = 0xFF /**<       local links service identity - value assigned by remote service */
+};
+
+struct tel_sat_bearer_param_local_link_bearer{
+       enum bearer_param_local_link_service_type service_type;
+       char service_record[SAT_BEARER_PARAMS_LEN_MAX];
+};
+
+struct tel_sat_bearer_description{
+       enum bearer_type bearer_type;
+       union{
+               struct tel_sat_bearer_param_cs_bearer cs_bearer_param;
+               struct tel_sat_bearer_param_ps_bearer ps_bearer_param;
+               struct tel_sat_bearer_param_local_link_bearer local_link_bearer_param;
+       }bearer_parameter;
+};
+
+/*
+ * 8.53 Channel data
+ */
+struct tel_sat_channel_data{
+       unsigned char data_string_len; /**<     channel data string length      */
+       char    data_string[SAT_CHANNEL_DATA_STRING_LEN_MAX];
+};
+
+/*
+ * 8.54 Channel data length
+ */
+struct tel_sat_channel_data_len{
+       unsigned char data_len; /**<    channel data length     */
+};
+
+
+/*
+ * 8.55 Buffer size
+ */
+struct tel_sat_buffer_size{
+       unsigned char size[2]; /**<     channel data buffer size        */
+};
+
+/*
+ * 8.56 Channel status
+ */
+enum channel_status{
+       link_or_packet_service_not_activated,
+       link_or_packet_service_activated
+};
+
+enum channel_status_info{
+       no_futher_info = 0x00,
+       link_dropped = 0x05
+};
+
+struct tel_sat_channel_status{
+       unsigned char channel_id;
+       enum channel_status status;
+       enum channel_status_info status_info;
+};
+
+/*
+ * 8.58 Other Address
+ */
+enum address_type{
+       ADDR_TYPE_IPv4 = 0x21, /**<     address type - IPv4     */
+       ADDR_TYPE_IPv6 = 0x57, /**<     address type - IPv6     */
+       ADDR_RESERVED = 0xFF /**<       reserved                */
+};
+
+struct tel_sat_other_address{
+       enum address_type address_type; /**<    channel address type    */
+       unsigned char address_len; /**< channel address length  */
+       char address[SAT_OTHER_ADDR_LEN_MAX]; /**<      channel address */
+};
+
+/*
+ * 8.59 UICC/terminal interface transport level
+ */
+enum transport_protocol_type{
+       TP_TYPE_UDP_UICC_CLIENT = 0x01, /**<    transport protocol type- UDP UICC CLIENT        */
+       TP_TYPE_TCP_UICC_CLIENT = 0x02, /**<    transport protocol type-TCP UICC CLIENT */
+       TP_TYPE_TCP_UICC_SERVER = 0x03 /**<     transport protocol type- TCP UICC SERVER        */
+};
+
+struct tel_sat_uicc_terminal_interface_transport_level{
+       enum transport_protocol_type protocol_type;
+       unsigned short port_number;
+};
+
+/*
+ * 8.68 Remote entity address
+ */
+enum remote_entity_coding_type{
+       REMOTE_ENTITY_ADDR_CODING_TYPE_IEEE802_48BIT = 0, /**<  remote entity address coding type- IEEE802 48BIT                */
+       REMOTE_ENTITY_ADDR_CODING_TYPE_IRDA_32BIT = 1, /**<     remote entity address coding type- IRDA 32BIT           */
+       REMOTE_ENTITY_ADDR_CODING_TYPE_RESERVED = 0xFF /**<     reserved                */
+};
+
+struct tel_sat_remote_entity_address{
+       enum remote_entity_coding_type coding_type;
+       unsigned short length;
+       unsigned char remote_entity_address[SAT_REMOTE_ENTITY_ADDR_LEN_MAX];
+};
+
+/*
+ * 8.70 Network access name
+ */
+struct tel_sat_network_access_name{
+       unsigned short length;
+       unsigned char network_access_name[SAT_NET_ACC_NAM_LEN_MAX];
+};
+
+/*
+ * 8.72 Text attribute
+ */
+struct tel_sat_text_attribute{
+       gboolean b_txt_attr;
+       unsigned char text_formatting[4];
+};
+
+/*
+ * 8.73 Item text attribute list
+ */
+struct tel_sat_text_attribute_list{
+       unsigned int list_cnt;
+       struct tel_sat_text_attribute text_attribute_list[SAT_ITEM_TEXT_ATTRIBUTES_LIST_MAX_COUNT];
+};
+
+/*
+ * 6.6 Structure of proactive UICC commands
+ */
+
+/*
+ * 6.6.1 DISPLAY TEXT
+ */
+struct tel_sat_display_text_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_text_string_object text;
+       struct tel_sat_icon_identifier icon_id;
+       gboolean immediate_response_requested;
+       struct tel_sat_duration duration;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.2 GET INKEY
+ */
+struct tel_sat_get_inkey_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_text_string_object text;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_duration duration;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.3 GET INPUT
+ */
+struct tel_sat_get_input_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_text_string_object text;
+       struct tel_sat_response_length rsp_len;
+       struct tel_sat_text_string_object default_text;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.4 MORE TIME
+ */
+struct tel_sat_more_time_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+};
+
+/*
+ * 6.6.5 PLAY TONE
+ */
+struct tel_sat_play_tone_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_tone tone;
+       struct tel_sat_duration duration;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.7 SET-UP MENU
+ */
+struct tel_sat_setup_menu_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       unsigned char menu_item_cnt;
+       struct tel_sat_item_info menu_item[SAT_MENU_ITEM_COUNT_MAX];
+       struct tel_sat_item_next_action_indicatior_list next_act_ind_list;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_icon_identifier_list icon_list;
+       struct tel_sat_text_attribute text_attribute;
+       struct tel_sat_text_attribute_list text_attribute_list;
+};
+
+/*
+ * 6.6.8 SELECT ITEM
+ */
+struct tel_sat_select_item_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       unsigned char menu_item_cnt;
+       struct tel_sat_item_info menu_item[SAT_MENU_ITEM_COUNT_MAX];
+       struct tel_sat_item_next_action_indicatior_list item_next_act_ind_list;
+       struct tel_sat_item_identifier item_identifier;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_icon_identifier_list icon_list;
+       struct tel_sat_text_attribute text_attribute;
+       struct tel_sat_text_attribute_list text_attribute_list;
+       //frame identifier 8.80
+};
+
+/*
+ * 6.6.9 SEND SMS
+ */
+struct tel_sat_send_sms_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_address address;
+       struct tel_sat_sms_tpdu sms_tpdu;
+       //CDMA-SMS TPDU 8.71
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_text_attribute text_attribute;
+       //frame identifier 8.80
+};
+
+/*
+ * 6.6.10 SEND SS
+ */
+struct tel_sat_send_ss_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_ss_string ss_string;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_text_attribute text_attribute;
+       //frame identifier 8.80
+};
+
+/*
+ * 6.6.11 SEND USSD
+ */
+struct tel_sat_send_ussd_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_ussd_string ussd_string;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_text_attribute text_attribute;
+       //frame identifier 8.80
+};
+
+/*
+ * 6.6.12 SETUP CALL
+ */
+struct tel_sat_setup_call_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_address address;
+       struct tel_sat_ccp ccp;
+       struct tel_sat_subaddress subaddress;
+       struct tel_sat_duration duration;
+       struct tel_sat_alpha_identifier user_confirm_alpha_id;
+       struct tel_sat_icon_identifier user_confirm_icon_id;
+       struct tel_sat_alpha_identifier call_setup_alpha_id;
+       struct tel_sat_icon_identifier call_setup_icon_id;
+       struct tel_sat_text_attribute user_confirm_text_attribute;
+       struct tel_sat_text_attribute call_setup_text_attribute;
+       //frame identifier 8.80
+};
+
+/*
+ * 6.6.13 REFRESH
+ */
+struct tel_sat_refresh_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_file_list file_list;
+       char aid[16]; // 8.60 AID - length is 16 byte, Refer TS 101.220
+};
+
+/*
+ * 6.6.15 PROVIDE LOCAL INFORMATION
+ */
+struct tel_sat_provide_local_info_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+};
+
+/*
+ * 6.6.16 SETUP EVENT LIST
+ */
+struct tel_sat_setup_event_list_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_event_list event_list;
+};
+
+/*
+ * 6.6.22 SETUP IDLE MODE TEXT
+ */
+struct tel_sat_setup_idle_mode_text_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_text_string_object text;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.24 SEND DTMF
+ */
+struct tel_sat_send_dtmf_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_dtmf_string dtmf_string;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.25 LANGUAGE NOTIFICATION
+ */
+struct tel_sat_language_notification_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sim_language_type language;
+};
+
+/*
+ * 6.6.26 LAUNCH BROWSER
+ */
+struct tel_sat_launch_browser_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum browser_identity browser_id;
+       struct tel_sat_url url;
+       struct tel_sat_bearer_list bearer;
+       int file_ref_count;
+       struct tel_sat_provisioning_file_ref file_list[SAT_PROVISIONING_REF_MAX_COUNT];
+       struct tel_sat_text_string_object gateway_proxy_text;
+       struct tel_sat_alpha_identifier user_confirm_alpha_id;
+       struct tel_sat_icon_identifier user_confirm_icon_id;
+       struct tel_sat_text_attribute user_confirm_text_attribute;
+       //frame identifier 8.80
+};
+
+/*
+ * 6.6.27 OPEN CHANNEL
+ */
+struct tel_sat_open_channel_cs_bearer{
+       struct tel_sat_address address;
+       struct tel_sat_subaddress subaddress;
+       struct tel_sat_duration duration1;
+       struct tel_sat_duration duration2;
+       struct tel_sat_other_address other_address;
+       struct tel_sat_text_string_object text_user_login;
+       struct tel_sat_text_string_object text_user_pwd;
+};
+
+struct tel_sat_open_channel_packet_data_service_bearer{
+       struct tel_sat_network_access_name network_access_name;
+       struct tel_sat_other_address other_address;
+       struct tel_sat_text_string_object text_user_login;
+       struct tel_sat_text_string_object text_user_pwd;
+};
+
+struct tel_sat_open_channel_local_bearer{
+       struct tel_sat_duration duration1;
+       struct tel_sat_duration duration2;
+       struct tel_sat_text_string_object text_user_pwd;
+       struct tel_sat_remote_entity_address remote_entity_address;
+};
+
+struct tel_sat_open_channel_default_bearer{
+       struct tel_sat_other_address other_address;
+       struct tel_sat_text_string_object text_user_login;
+       struct tel_sat_text_string_object text_user_pwd;
+};
+
+struct tel_sat_open_channel_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_bearer_description bearer_desc;
+       struct tel_sat_buffer_size buffer_size;
+       struct tel_sat_uicc_terminal_interface_transport_level interface_transport_level;
+       struct tel_sat_other_address data_destination_address;
+       struct tel_sat_text_attribute text_attribute;
+       //frame identifier 8.80
+       union{
+               struct tel_sat_open_channel_cs_bearer cs_bearer;
+               struct tel_sat_open_channel_packet_data_service_bearer ps_bearer;
+               struct tel_sat_open_channel_local_bearer local_bearer;
+               struct tel_sat_open_channel_default_bearer default_bearer;
+       }bearer_detail;
+};
+
+/*
+ * 6.6.28 CLOSE CHANNEL
+ */
+struct tel_sat_close_channel_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.29 RECEIVE DATA
+ */
+struct tel_sat_receive_channel_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_channel_data_len channel_data_len;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.30 SEND DATA
+ */
+struct tel_sat_send_channel_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_icon_identifier icon_id;
+       struct tel_sat_channel_data channel_data;
+       struct tel_sat_text_attribute text_attribute;
+};
+
+/*
+ * 6.6.31 GET CHANNEL STATUS
+ */
+struct tel_sat_get_channel_status_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+};
+
+/*
+ * 6.6.XX UNSUPPORTED CMD
+ */
+struct tel_sat_unsupproted_command_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+};
+
+/*
+ * CoreObject
+ * Structure of Req. Rsp. Noti.
+ */
+
+/*
+ * Define SAT Request structure
+ */
+enum sat_envelop_sub_cmd{
+       ENVELOP_MENU_SELECTION,
+       ENVELOP_CALL_CONTROL,
+       ENVELOP_TIMER_EXPIRATION,
+       ENVELOP_EVENT_DOWNLOAD,
+};
+
+struct tel_sat_envelop_menu_selection_tlv{
+       struct tel_sat_device_identities device_identitie;
+       struct tel_sat_item_identifier item_identifier;
+       gboolean help_request;
+};
+
+struct tel_sat_envelop_event_download_tlv{
+       struct tel_sat_device_identities device_identitie;
+       enum event_list event;
+       gboolean idle_screen;
+       enum tel_sim_language_type language;
+       enum browser_termination_cause browser_termination;
+       struct tel_sat_channel_status channel_status;
+       struct tel_sat_channel_data_len channel_data_len;
+};
+
+struct treq_sat_envelop_cmd_data{
+       enum sat_envelop_sub_cmd sub_cmd;
+       union{
+               struct tel_sat_envelop_menu_selection_tlv menu_select;
+               struct tel_sat_envelop_event_download_tlv event_download;
+       }envelop_data;
+};
+
+struct tel_sat_tr_display_text_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_get_inkey_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       struct tel_sat_text_string_object text;
+       struct tel_sat_duration duration;
+};
+
+struct tel_sat_tr_get_input_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       struct tel_sat_text_string_object text;
+};
+
+struct tel_sat_tr_more_time_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_play_tone_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_refresh_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_setup_menu_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_select_item_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       gboolean other_info;
+       struct tel_sat_item_identifier item_identifier;
+};
+
+struct tel_sat_tr_send_sms_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum tel_sat_call_ctrl_problem_type cc_problem_type;
+};
+
+struct tel_sat_tr_send_ss_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum ss_problem_type ss_problem;
+       gboolean other_info;
+       enum tel_sat_call_ctrl_problem_type cc_problem_type;
+       struct tel_sat_call_ctrl_req_action call_ctrl_req_act;
+       enum tel_sat_result_type result_type2;
+       struct tel_sat_text_string_object text;
+};
+
+struct tel_sat_tr_send_ussd_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum ussd_problem_type ussd_problem;
+       gboolean other_info;
+       gboolean call_ctrl_has_modification;
+       enum tel_sat_call_ctrl_problem_type cc_problem_type;
+       struct tel_sat_call_ctrl_req_action call_ctrl_req_act;
+       enum tel_sat_result_type result_type2;
+       struct tel_sat_text_string_object text;
+       struct tel_sat_text_string_object text2;
+};
+
+struct tel_sat_tr_setup_call_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       gboolean other_info;
+       enum network_problem_type network_problem_type;
+       enum tel_sat_call_ctrl_problem_type cc_problem_type;
+       struct tel_sat_call_ctrl_req_action call_ctrl_req_act;
+       enum tel_sat_result_type result_type2;
+       struct tel_sat_text_string_object text;
+       gboolean tapi_cause;
+       int tapi_call_level_cause;
+       int tapi_ss_level_cause;
+};
+
+struct tel_sat_tr_provide_local_info_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       gboolean other_info;
+       union {
+               struct tel_sat_location_information location_info;
+               struct tel_sat_imei imei;
+               struct tel_sat_network_measurement_results nmr;
+               struct tel_sat_date_time_and_timezone date_time_and_timezone;
+               enum tel_sim_language_type language;
+       }other;
+};
+
+struct tel_sat_tr_setup_event_list_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_setup_idle_mode_text_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_send_dtmf_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_language_notification_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct tel_sat_tr_launch_browser_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum browser_problem_type browser_problem_type;
+};
+
+struct tel_sat_tr_open_channel_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum bip_problem_type bip_problem_type;
+       struct tel_sat_channel_status channel_status;
+       struct tel_sat_bearer_description bearer_desc;
+       struct tel_sat_buffer_size buffer_size;
+       //struct tel_sat_other_address other_address; (uicc server mode)
+};
+
+struct tel_sat_tr_close_channel_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum bip_problem_type bip_problem_type;
+};
+
+struct tel_sat_tr_send_data_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum bip_problem_type bip_problem_type;
+       struct tel_sat_channel_data_len channel_data_len;
+};
+
+struct tel_sat_tr_receive_data_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum bip_problem_type bip_problem_type;
+       struct tel_sat_channel_data channel_data;
+       struct tel_sat_channel_data_len channel_data_len;
+};
+
+struct tel_sat_tr_get_channel_status_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+       enum bip_problem_type bip_problem_type;
+       struct tel_sat_channel_status channel_status;
+};
+
+struct tel_sat_tr_unsupport_command_tlv{
+       struct tel_sat_cmd_detail_info command_detail;
+       struct tel_sat_device_identities device_id;
+       enum tel_sat_result_type result_type;
+       enum tel_sat_me_problem_type me_problem_type;
+};
+
+struct treq_sat_terminal_rsp_data{
+       int cmd_number;
+       enum tel_sat_proactive_cmd_type cmd_type;
+       union{
+               struct tel_sat_tr_display_text_tlv display_text;
+               struct tel_sat_tr_get_inkey_tlv get_inkey;
+               struct tel_sat_tr_get_input_tlv get_input;
+               struct tel_sat_tr_more_time_tlv more_time;
+               struct tel_sat_tr_play_tone_tlv play_tone;
+               struct tel_sat_tr_refresh_tlv refresh;
+               struct tel_sat_tr_setup_menu_tlv setup_menu;
+               struct tel_sat_tr_select_item_tlv select_item;
+               struct tel_sat_tr_send_sms_tlv send_sms;
+               struct tel_sat_tr_send_ss_tlv send_ss;
+               struct tel_sat_tr_send_ussd_tlv send_ussd;
+               struct tel_sat_tr_setup_call_tlv setup_call;
+               struct tel_sat_tr_provide_local_info_tlv provide_local_info;
+               struct tel_sat_tr_setup_event_list_tlv setup_event_list;
+               struct tel_sat_tr_setup_idle_mode_text_tlv setup_idle_mode_text;
+               struct tel_sat_tr_send_dtmf_tlv send_dtmf;
+               struct tel_sat_tr_language_notification_tlv language_notification;
+               struct tel_sat_tr_launch_browser_tlv launch_browser;
+               struct tel_sat_tr_open_channel_tlv open_channel;
+               struct tel_sat_tr_close_channel_tlv close_channel;
+               struct tel_sat_tr_send_data_tlv send_data;
+               struct tel_sat_tr_receive_data_tlv receive_data;
+               struct tel_sat_tr_get_channel_status_tlv get_channel_status;
+               struct tel_sat_tr_unsupport_command_tlv unsupport_cmd;
+       }terminal_rsp_data;
+};
+
+struct treq_sat_user_confirmation_data{
+       int user_conf;
+       int icon_conf; /* Notice: Not being used for now*/
+};
+
+/*
+ * Define SAT Response structure
+ */
+enum envelop_rsp{
+       ENVELOPE_SUCCESS,       /**<    envelope result - success       */
+       ENVELOPE_SIM_BUSY,      /**<    envelope result - USIM busy     */
+       ENVELOPE_FAILED /**<    envelope result - failed        */
+};
+
+struct tresp_sat_envelop_data{
+       int result;
+       enum sat_envelop_sub_cmd sub_cmd;
+       enum envelop_rsp envelop_resp;
+};
+
+/*
+ * Define SAT Notification structure
+ */
+enum call_control_result{
+       call_control_allowed_no_mod = 0x00,
+       call_control_not_allowed = 0x01,
+       call_control_allowed_with_mod = 0x02
+};
+
+struct tnoti_sat_proactive_ind{
+       int decode_err_code;
+       int cmd_number;
+       enum tel_sat_proactive_cmd_type cmd_type;
+       union{
+               struct tel_sat_display_text_tlv display_text;
+               struct tel_sat_get_inkey_tlv get_inkey;
+               struct tel_sat_get_input_tlv get_input;
+               struct tel_sat_more_time_tlv more_time;
+               struct tel_sat_play_tone_tlv play_tone;
+               struct tel_sat_setup_menu_tlv setup_menu;
+               struct tel_sat_select_item_tlv select_item;
+               struct tel_sat_send_sms_tlv send_sms;
+               struct tel_sat_send_ss_tlv send_ss;
+               struct tel_sat_send_ussd_tlv send_ussd;
+               struct tel_sat_setup_call_tlv setup_call;
+               struct tel_sat_refresh_tlv refresh;
+               struct tel_sat_provide_local_info_tlv provide_local_info;
+               struct tel_sat_setup_event_list_tlv setup_event_list;
+               struct tel_sat_setup_idle_mode_text_tlv setup_idle_mode_text;
+               struct tel_sat_send_dtmf_tlv send_dtmf;
+               struct tel_sat_language_notification_tlv language_notification;
+               struct tel_sat_launch_browser_tlv launch_browser;
+               struct tel_sat_open_channel_tlv open_channel;
+               struct tel_sat_close_channel_tlv close_channel;
+               struct tel_sat_receive_channel_tlv receive_data;
+               struct tel_sat_send_channel_tlv send_data;
+               struct tel_sat_get_channel_status_tlv get_channel_status;
+               struct tel_sat_unsupproted_command_tlv unsupport_cmd;
+       }proactive_ind_data;
+};
+
+struct tnoti_sat_call_control_result_ind{
+       enum call_control_result cc_result;
+
+       struct tel_sat_address address;
+       struct tel_sat_ss_string ss_string;
+
+       struct tel_sat_ccp ccp1;
+       struct tel_sat_subaddress sub_address;
+       struct tel_sat_alpha_identifier alpha_id;
+       struct tel_sat_repeat_indicator_type bc_repeat_type;
+       struct tel_sat_ccp ccp2;
+};
+
+struct tnoti_sat_mo_sm_control_result_ind{
+       enum call_control_result cc_result;
+
+       struct tel_sat_address rp_dst_address;
+       struct tel_sat_address tp_dst_address;
+       struct tel_sat_alpha_identifier alpha_id;
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/type/sat_internal.h b/include/type/sat_internal.h
deleted file mode 100755 (executable)
index 48ec96c..0000000
+++ /dev/null
@@ -1,1262 +0,0 @@
-/*
- * libtcore
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __SAT_INTERNAL_H__
-#define __SAT_INTERNAL_H__
-
-/**
-*  @addtogroup TAPI_SAT
-*  @{
-*
-*  @file tel_sat.h
-*  @brief TAPI sat Interface
-*/
-
-#include <tel_sat.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TEL_SAT_DEF_TITLE_LEN_MAX      50 /**< max length for Menu Title */
-#define TEL_SAT_DEF_ITEM_STR_LEN_MAX   50 /**< max length for default item string */
-#define TEL_SAT_TEXT_STRING_LEN_MAX            500 /**< max length for text string */
-#define TEL_SAT_ENVELOPE_CMD_LEN_MAX   256 /**< max length for envelope command */
-#define TEL_SAT_AID_LEN_MAX    128 /**< max length for AID */
-#define TEL_SAT_PROVISIONING_REF_MAX_COUNT     10 /**< max count of sat provisioning reference */
-#define TEL_SAT_BEARER_PARAMS_LEN_MAX          10 /**< max length of bearer parameters */
-#define TEL_SAT_BEARER_LIST_MAX_COUNT  6 /**< max count of bearer list */
-
-/**
- * @enum TelSatDisplayTextPriority
- * This enumeration defines display text priority
-*/
-typedef enum {
-       TEL_SAT_TEXT_PRIORITY_NORMAL = 0, /**< Display text priority -normal */
-       TEL_SAT_TEXT_PRIORITY_HIGH = 1 /**< Display text priority - high */
-} TelSatDisplayTextPriority;
-
-/**
- * @enum TelSatDisplayTextClearType
- * This enumeration defines Display text clear type
-*/
-typedef enum {
-       TEL_SAT_TEXT_AUTO_CLEAR_MSG_AFTER_A_DELAY = 0, /**< Display text clear type -clear msg after a delay */
-       TEL_SAT_TEXT_WAIT_FOR_USER_TO_CLEAR_MSG = 1 /**< Display text clear type -wait for user to clear msg */
-} TelSatDisplayTextClearType;
-
-/**
- * @enum TelSatInputAlphabetType
- * This enumeration defines Alphabet types
-*/
-typedef enum {
-       TEL_SAT_INPUT_ALPHABET_TYPE_SMS_DEFAULT = 1, /**< Display input alphabet type -SMS default */
-       TEL_SAT_INPUT_ALPHABET_TYPE_UCS2 = 2 /**< Display inkey type -UCS2 type */
-} TelSatInputAlphabetType;
-
-/**
- * @enum TelSatCmdQualifierPlayTone
- * This enumeration defines cmd qualifier for play tone
-*/
-typedef enum {
-       TEL_SAT_VIBRATE_ALERT_OPTIONAL = 0, /**< VIBRATE ALERT UPTO THE TERMINAL */
-       TEL_SAT_VIBRATE_ALERT_REQUIRED = 1 /**< VIBRATE, IF AVAILABLE, WITH TONE */
-} TelSatCmdQualifierPlayTone;
-
-/**
- * @enum TelSatPresentationType
- * This enumeration defines presentation types
-*/
-typedef enum {
-       TEL_SAT_PRESENTATION_TYPE_NOT_SPECIFIED = 0x00,  /**< presentation type -NOT SPECIFIED */
-       TEL_SAT_PRESENTATION_TYPE_DATA_VALUE = 0x01, /**< presentation type -DATA VALUE */
-       TEL_SAT_PRESENTATION_TYPE_NAVIGATION_OPTION = 0x02 /**< presentation type -NAVIGATION OPTION */
-} TelSatPresentationType;
-
-/**
- * @enum TelSatSelectionPreferenceType
- * This enumeration defines selection preference types
-*/
-typedef enum  {
-       TEL_SAT_SELECTION_PREFERENCE_NONE_REQUESTED = 0, /**< selection preference type -NONE REQUESTED */
-       TEL_SAT_SELECTION_PREFERENCE_USING_SOFT_KEY = 1 /**< selection preference type -USING SOFT KEY */
-} TelSatSelectionPreferenceType;
-
-/**
- * @enum TelSatSsProblemType
- * This enumeration defines SS problem types
-*/
-typedef enum {
-       TEL_SAT_SS_PROBLEM_NO_SPECIFIC_CAUSE     = 0, /**< SS problem type -NO SPECIFIC CAUSE */
-       TEL_SAT_SS_PROBLEM_FACILITY_NOT_SUPPORTED = 0x15 /**< SS problem type -FACILITY NOT SUPPORTED */
-} TelSatSsProblemType;
-
-/**
- * @enum TelSatUssdProblemType
- * This enumeration defines USSD problem types
-*/
-typedef enum {
-       TEL_SAT_USSD_PROBLEM_NO_SPECIFIC_CAUSE = 0, /**< USSD problem type -NO SPECIFIC CAUSE */
-       TEL_SAT_USSD_PROBLEM_UNKNOWN_ALPHABET = 0x47 /**< USSD problem type -UNKNOWN ALPHABET */
-} TelSatUssdProblemType;
-
-/**
- * @enum TelSatNetworkProblemType
- * This enumeration defines network problem types
-*/
-typedef enum {
-       TEL_SAT_NETWORK_PROBLEM_NO_SPECIFIC_CAUSE = 0x0, /**< Network problem with no specific cause */
-       TEL_SAT_NETWORK_PROBLEM_USER_BUSY = 0x91 /**< Network problem with USER BUSY */
-} TelSatNetworkProblemType;
-
-/**
- * @enum TelSatBipProblemType
- * This enumeration defines BIP problem types
-*/
-typedef enum {
-       TEL_SAT_BIP_PROBLEM_NO_SPECIFIC_CAUSE = 0x00, /**< BIP problem with no specific cause */
-       TEL_SAT_BIP_PROBLEM_NO_CHANNEL_AVAILABLE = 0x01, /**< BIP problem with no channel available */
-       TEL_SAT_BIP_PROBLEM_CHANNEL_CLOSED = 0x02, /**< BIP problem with channel closed */
-       TEL_SAT_BIP_PROBLEM_CHANNEL_ID_NOT_VALID = 0x03, /**< BIP problem with channel id not valid */
-       TEL_SAT_BIP_PROBLEM_BUF_SIZE_NOT_AVAILABLE = 0x04, /**< BIP problem with buffer size not available */
-       TEL_SAT_BIP_PROBLEM_SECURITY_ERROR = 0x05, /**< BIP problem with security error */
-       TEL_SAT_BIP_PRBLM_SIM_ME_IF_TRNSPRT_LEVEL_NOT_AVL = 0x06, /**< BIP problem with SIM ME interface transport level not available */
-       TEL_SAT_BIP_REMOTE_DEV_NOT_REACHABLE = 0x07, /**< BIP problem with remote device not reachable */
-       TEL_SAT_BIP_SERVICE_ERROR = 0x08, /**< BIP service error */
-       TEL_SAT_BIP_SERVICE_IDENTIFIER_UNKNOWN = 0x09 /**< BIP service identifier unknown */
-} TelSatBipProblemType;
-
-/**
- * @enum TelSatBearerDescType
- * This enumeration defines bearer desc types
-*/
-typedef enum {
-       TEL_SAT_BEARER_CSD = 0x1, /**< BEARER DESC CSD */
-       TEL_SAT_BEARER_GPRS = 0x2, /**< BEARER DESC GPRS */
-       TEL_SAT_BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER = 0x3, /**< BEARER DESC DEFAULT BEARER FROM TRANSPORT LAYER */
-       TEL_SAT_BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT = 0x4, /**< BEARER DESC LOCAL LINK TECHNOLOGY INDEPENDENT */
-       TEL_SAT_BEARER_BLUETOOTH = 0x5, /**< BEARER DESC BLUETOOTH */
-       TEL_SAT_BEARER_IrDA = 0x6, /**< BEARER DESC IrDA */
-       TEL_SAT_BEARER_RS232 = 0x7, /**< BEARER DESC RS232      */
-       TEL_SAT_BEARER_USB = 0x10, /**< BEARER DESC USB */
-       TEL_SAT_BEARER_RESERVED = 0xFF /**<     RESERVED        */
-} TelSatBearerDescType;
-
-/**
- * @enum TelSatBearerParamCsdDataRateType
- * This enumeration defines bearer param csd data rate types
-*/
-typedef enum {
-       TEL_SAT_BIP_DR_AUTOBAUDING = 0, /**< CSD data rate - AUTOBAUDING */
-       TEL_SAT_BIP_DR_300BPS_V21 = 1, /**<  CSD data rate -300BPS V21 */
-       TEL_SAT_BIP_DR_1200BPS_V22 = 2, /**< CSD data rate - 1200BPS V22 */
-       TEL_SAT_BIP_DR_1200_75BPS_V23 = 3, /**< CSD data rate -1200 75BPS V23 */
-       TEL_SAT_BIP_DR_2400BPS_V22 = 4, /**< CSD data rate -2400BPS V22 */
-       TEL_SAT_BIP_DR_2400BPS_V26 = 5, /**< CSD data rate - 2400BPS V26 */
-       TEL_SAT_BIP_DR_4800BPS_V32 = 6, /**< CSD data rate - 4800BPS V32 */
-       TEL_SAT_BIP_DR_9600BPS_V32 = 7, /**< CSD data rate - 9600BPS V32 */
-       TEL_SAT_BIP_DR_9600BPS_V34 = 12, /**<   CSD data rate - 9600BPS_V34 */
-       TEL_SAT_BIP_DR_14400BPS_V34 = 14, /**< CSD data rate -14400BPS V34 */
-       TEL_SAT_BIP_DR_19200BPS_V34 = 15, /**< CSD data rate -19200BPS V34 */
-       TEL_SAT_BIP_DR_28800BPS_V34 = 16, /**< CSD data rate -28800BPS V34 */
-       TEL_SAT_BIP_DR_33600BPS_V34 = 17, /**< CSD data rate -33600BPS V34 */
-       TEL_SAT_BIP_DR_1200BPS_V120 = 34, /**< CSD data rate -1200BPS V120 */
-       TEL_SAT_BIP_DR_2400BPS_V120 = 36, /**< CSD data rate -2400BPS V120 */
-       TEL_SAT_BIP_DR_4800BPS_V120 = 38, /**< CSD data rate -4800BPS V120 */
-       TEL_SAT_BIP_DR_9600BPS_V120 = 39, /**< CSD data rate -9600BPS V120 */
-       TEL_SAT_BIP_DR_14400BPS_V120 = 43, /**< CSD data rate -14400BPS V120    */
-       TEL_SAT_BIP_DR_19200BPS_V120 = 47, /**< CSD data rate -19200BPS V120    */
-       TEL_SAT_BIP_DR_28800BPS_V120 = 48, /**< CSD data rate -28800BPS V120    */
-       TEL_SAT_BIP_DR_38400BPS_V120 = 49, /**< CSD data rate -38400BPS V120    */
-       TEL_SAT_BIP_DR_48000BPS_V120 = 50, /**< CSD data rate -48000BPS V120    */
-       TEL_SAT_BIP_DR_56000BPS_V120 = 51, /**< CSD data rate -56000BPS V120    */
-       TEL_SAT_BIP_DR_300BPS_V110 = 65, /**<   CSD data rate - 300BPS V110 */
-       TEL_SAT_BIP_DR_1200BPS_V110 = 66, /**< CSD data rate -1200BPS V110 */
-       TEL_SAT_BIP_DR_2400BPS_V110_OR_X31_FALG_STUFFING = 68, /**< CSD data rate - 2400BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_4800BPS_V110_OR_X31_FALG_STUFFING = 70, /**< CSD data rate - 4800BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_9600BPS_V110_OR_X31_FALG_STUFFING = 71, /**< CSD data rate - 9600BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_14400BPS_V110_OR_X31_FALG_STUFFING = 75, /**< CSD data rate - 14400BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_19200BPS_V110_OR_X31_FALG_STUFFING = 79, /**< CSD data rate -19200BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_28800BPS_V110_OR_X31_FALG_STUFFING = 80, /**<    CSD data rate -28800BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_38400BPS_V110_OR_X31_FALG_STUFFING = 81, /**<    CSD data rate -38400BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_48000BPS_V110_OR_X31_FALG_STUFFING = 82, /**<    CSD data rate -48000BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_56000BPS_V110_OR_X31_FALG_STUFFING = 83, /**<    CSD data rate -56000BPS V110 OR X31 FALG STUFFING */
-       TEL_SAT_BIP_DR_64000BPS = 84, /**< CSD data rate -64000BPS */
-       TEL_SAT_BIP_DR_56000BPS_BIT_TRANSPERENT = 115, /**< CSD data rate -56000BPS BIT TRANSPERENT      */
-       TEL_SAT_BIP_DR_64000BPS_BIT_TRANSPERENT = 116, /**< CSD data rate -64000BPS BIT TRANSPERENT */
-       TEL_SAT_BIP_DR_32000BPS_PIAFS32K = 120, /**<    CSD data rate -32000BPS PIAFS32K */
-       TEL_SAT_BIP_DR_64000BPS_PIAFS64K = 121, /**<    CSD data rate - 64000BPS PIAFS64K */
-       TEL_SAT_BIP_DR_28800BPS_MULTIMEDIA = 130, /**<  CSD data rate -28800BPS MULTIMEDIA */
-       TEL_SAT_BIP_DR_32000BPS_MULTIMEDIA = 131, /**<  CSD data rate -32000BPS MULTIMEDIA */
-       TEL_SAT_BIP_DR_33600BPS_MULTIMEDIA = 132, /**<  CSD data rate - 33600BPS MULTIMEDIA */
-       TEL_SAT_BIP_DR_56000BPS_MULTIMEDIA = 133, /**<  CSD data rate -56000BPS MULTIMEDIA */
-       TEL_SAT_BIP_DR_64000BPS_MULTIMEDIA = 134 /**<   CSD data rate -64000BPS MULTIMEDIA */
-} TelSatBearerParamCsdDataRateType;
-
-/**
- * @enum TelSatBearerParamCsdBearerServiceType
- * This enumeration defines bearer param csd bearer service types
-*/
-typedef enum {
-       TEL_SAT_BIP_CSD_BS_DATA_CIRCUIT_ASYNC_UDI = 0, /**< CSD Bearer service - DATA CIRCUIT ASYNCHRONOUS UDI */
-       TEL_SAT_BIP_CSD_BS_DATA_CIRCUIT_SYNC = 1, /**< CSD Bearer service - DATA CIRCUIT SYNCHRONOUS UDI */
-       TEL_SAT_BIP_CSD_BS_PAD_ACCESS_ASYNC_UDI = 2, /**< CSD Bearer service - PAD ACCESS ASYNCHRONOUS UDI */
-       TEL_SAT_BIP_CSD_BS_PACKET_ACCESS_SYNC = 3, /**< CSD Bearer service - PACKET ACCESS SYNCHRONOUS UDI */
-       TEL_SAT_BIP_CSD_BS_DATA_CIRCUIT_ASYNC_RDI = 4, /**< CSD Bearer service - DATA CIRCUIT ASYNCHRONOUS RDI */
-       TEL_SAT_BIP_CSD_BS_DATA_CIRCUIT_SYNC_RDI = 5, /**< CSD Bearer service - DATA CIRCUIT SYNCHRONOUS RDI */
-       TEL_SAT_BIP_CSD_BS_PAD_ACCESS_ASYNC_RDI = 6, /**< CSD Bearer service - PAD ACCESS ASYNCHRONOUS RDI */
-       TEL_SAT_BIP_CSD_BS_PACKET_ACCESS_SYNC_RDI = 7 /**< CSD Bearer service - PACKET ACCESS SYNCHRONOUS RDI */
-} TelSatBearerParamCsdBearerServiceType;
-
-/**
- * @enum TelSatBearerParamCsdConnectionElementType
- * This enumeration defines bearer param csd connection element types
-*/
-typedef enum {
-       TEL_SAT_BIP_CSD_CONN_ELEM_TRANSPARENT = 0, /**< CSD connection element - TRANSPARENT */
-       TEL_SAT_BIP_CSD_CONN_ELEM_NON_TRANSPARENT = 1, /**< CSD connection element - NON TRANSPARENT    */
-       TEL_SAT_BIP_CSD_CONN_ELEM_BOTH_TRANSPARENT_PREF = 2, /**<       CSD connection element -BOTH TRANSPARENT PREFFERED */
-       TEL_SAT_BIP_CSD_CONN_ELEM_BOTH_NON_TRANSPARENT_PREF = 3 /**< CSD connection element -  NON TRANSPARENT PREFFERED */
-} TelSatBearerParamCsdConnectionElementType;
-
-/**
- * @enum TelSatBearerParamGprsPrecedenceClassType
- * This enumeration defines bearer param gprs precedence class types
-*/
-typedef enum {
-       TEL_SAT_BIP_GPRS_PRECED_CLASS_HIGH_PRIORITY = 0x01, /**<        GPRS precedence class -HIGH PRIORITY */
-       TEL_SAT_BIP_GPRS_PRECED_CLASS_NORM_PRIORITY = 0x02, /**< GPRS precedence class -NORM PRIORITY */
-       TEL_SAT_BIP_GPRS_PRECED_CLASS_LOW_PRIORITY = 0x03 /**< GPRS precedence class - LOW PRIORITY */
-} TelSatBearerParamGprsPrecedenceClassType;
-
-/**
- * @enum TelSatBearerParamGprsDelayClassType
- * This enumeration defines bearer param gprs delay class types
-*/
-typedef enum {
-       TEL_SAT_BIP_GPRS_DELAY_CLASS_1 = 0x01, /**< GPRS delay class - 1 */
-       TEL_SAT_BIP_GPRS_DELAY_CLASS_2 = 0x02, /**< GPRS delay class -2 */
-       TEL_SAT_BIP_GPRS_DELAY_CLASS_3 = 0x03, /**< GPRS delay class -3 */
-       TEL_SAT_BIP_GPRS_DELAY_CLASS_4 = 0x04 /**< GPRS delay class - 4 */
-} TelSatBearerParamGprsDelayClassType;
-
-/**
- * @enum TelSatBearerParamGprsReliabilityClassType
- * This enumeration defines bearer param gprs reliability class types
-*/
-typedef enum {
-       TEL_SAT_BIP_GPRS_RELIABILITY_CLASS_1 = 0x01, /**< GPRS Reliability class -1 */
-       TEL_SAT_BIP_GPRS_RELIABILITY_CLASS_2 = 0x02, /**< GPRS Reliability class -2 */
-       TEL_SAT_BIP_GPRS_RELIABILITY_CLASS_3 = 0x03, /**< GPRS Reliability class -3 */
-       TEL_SAT_BIP_GPRS_RELIABILITY_CLASS_4 = 0x04, /**< GPRS Reliability class -4 */
-       TEL_SAT_BIP_GPRS_RELIABILITY_CLASS_5 = 0x05 /**<         GPRS Reliability class -5 */
-} TelSatBearerParamGprsReliabilityClassType;
-
-/**
- * @enum TelSatBearerParamGprsPeakThroughputClassType
- * This enumeration defines bearer param gprs peak throughput class types
-*/
-typedef enum {
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_8KBPS = 0x01, /**< GPRS peak throughput class- UPTO 8KBPS */
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_16KBPS = 0x02, /**< GPRS peak throughput class- UPTO 16KBPS */
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_32KBPS = 0x03, /**< GPRS peak throughput class-UPTO 32KBPS */
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_64KBPS = 0x04, /**< GPRS peak throughput class-UPTO 64KBPS */
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_128KBPS = 0x05, /**< GPRS peak throughput class- UPTO 128KBPS */
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_256KBPS = 0x06, /**< GPRS peak throughput class- UPTO 256KBPS */
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_512KBPS = 0x07, /**< GPRS peak throughput class- UPTO 512KBPS */
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_1024KBPS = 0x08, /**< GPRS peak throughput class-UPTO 1024KBPS */
-       TEL_SAT_BIP_GPRS_PEAK_THROUGHPUT_CLASS_UPTO_2048KBPS = 0x09 /**<        GPRS peak throughput class- UPTO 2048KBPS */
-} TelSatBearerParamGprsPeakThroughputClassType;
-
-/**
- * @enum TelSatBearerParamGprsMeanThroughputClassType
- * This enumeration defines bearer param gprs mean throughput class types
-*/
-typedef enum {
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_DOT_22_BPS = 0x01, /**< GPRS mean throughput class - DOT 22 BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_DOT_44_BPS = 0x02, /**< GPRS mean throughput class - DOT 44 BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_1_DOT_11_BPS = 0x03, /**< GPRS mean throughput class -1 DOT 11 BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_2_DOT_2_BPS = 0x04, /**< GPRS mean throughput class -2 DOT 2 BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_2_DOT_4_BPS = 0x05, /**< GPRS mean throughput class -2 DOT 4 BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_11_DOT_1_BPS = 0x06, /**< GPRS mean throughput class - 11 DOT 1 BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_22BPS = 0x07, /**< GPRS mean throughput class -22BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_44BPS = 0x08, /**< GPRS mean throughput class - 44BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_111BPS = 0x09, /**< GPRS mean throughput class - 111BPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_DOT_22_KBPS = 0x0A, /**< GPRS mean throughput class - DOT 22 KBPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_DOT_44_KBPS = 0x0B, /**< GPRS mean throughput class -DOT 44 KBPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_1_DOT_11_KBPS = 0x0C, /**< GPRS mean throughput class -1 DOT 11 KBPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_2_DOT_2_KBPS = 0x0D, /**<        GPRS mean throughput class -2 DOT 2 KBPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_4_DOT_4_KBPS = 0x0E, /**<        GPRS mean throughput class - 4 DOT 4 KBPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_11_DOT_1_KBPS = 0x0F, /**< GPRS mean throughput class -11 DOT 1 KBPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_22KBPS = 0x10, /**<      GPRS mean throughput class - 22KBPS     */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_44KBPS = 0x11, /**<      GPRS mean throughput class - 44KBPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_111KBPS = 0x12, /**< GPRS mean throughput class -111KBPS */
-       TEL_SAT_BIP_GPRS_MEAN_THROUGHPUT_CLASS_BEST_EFFORT = 0x13 /**< GPRS mean throughput class - BEST EFFORT */
-} TelSatBearerParamGprsMeanThroughputClassType;
-
-/**
- * @enum TelSatBearerParamGprsPdpType
- * This enumeration defines bearer param gprs pdp types
-*/
-typedef enum {
-       TEL_SAT_BIP_GPRS_PDP_TYPE_IP = 0x02, /**< bearer parameter GPRS pdp type - IP */
-       TEL_SAT_BIP_GPRS_PDP_TYPE_RESERVED = 0xff /**< reserved */
-} TelSatBearerParamGprsPdpType;
-
-/**
- * @enum TelSatBearerParamLocalLinksServiceIdentityType
- * This enumeration defines bearer param local links service identity types
-*/
-typedef enum {
-       TEL_SAT_BIP_LL_SERVICE_IDENT_VALUE_ASSIGNED_BY_USIM = 0x00, /**< local links service identity - value assigned by USIM */
-       TEL_SAT_BIP_LL_SERVICE_IDENT_VALUE_ASSIGNED_BY_REMOTED_DEVICE = 0xFF /**< local links service identity - value assigned by remote service */
-} TelSatBearerParamLocalLinksServiceIdentityType;
-
-/**
- * @enum TelSatEnvelopSubCmd
- * This enumeration defines envelope sub command types
-*/
-typedef enum {
-       TEL_SAT_ENVELOP_MENU_SELECTION, /**< Envelope sub command type -MENU SELECTION */
-       TEL_SAT_ENVELOP_CALL_CONTROL, /**< Envelope sub command type -CALL CONTROL */
-       TEL_SAT_ENVELOP_TIMER_EXPIRATION, /**< Envelope sub command type -TIMER EXPIRATION */
-       TEL_SAT_ENVELOP_EVENT_DOWNLOAD /**< Envelope sub command type -EVENT DOWNLOAD */
-} TelSatEnvelopSubCmd;
-
-/**
- * @enum TelSatEnvelopeResp
- * This enum indicates the general result of sending an envelope command to USIM.
- */
-typedef enum {
-       TEL_SAT_ENVELOPE_SUCCESS,       /**< envelope result - success */
-       TEL_SAT_ENVELOPE_SIM_BUSY,      /**<    envelope result - USIM busy */
-       TEL_SAT_ENVELOPE_FAILED /**<    envelope result - failed         */
-}TelSatEnvelopeResp;
-
-/**
-* This structure defines display text command qualifier Info
-*/
-typedef struct {
-       TelSatDisplayTextPriority text_priority; /**< display text priority */
-       TelSatDisplayTextClearType text_clear_type; /**< display text clear type */
-} TelSatCmdQualifierDisplayText;
-
-/**
-* This structure defines Get inkey command qualifier Info
-*/
-typedef struct {
-       TelSatInkeyType inkey_type; /**< inkey type */
-       TelSatInputAlphabetType alphabet_type; /**< alphabet type */
-       gboolean alphabet_set; /**< alphabet set */
-       gboolean immediate_rsp_required; /**< immediate response required */
-       gboolean help_info; /**< help info */
-} TelSatCmdQualifierGetInkey;
-
-/**
-* This structure defines Get Input command qualifier Info
-*/
-typedef struct {
-       TelSatInputAlphabetType alphabet_type;  /**< alphabet type */
-       gboolean alphabet_set; /**< alphabet set */
-       gboolean me_echo_user_input; /**< me echo user input */
-       gboolean user_input_unpacked_format; /**< user input unpacked format */
-       gboolean help_info; /**< help info */
-} TelSatCmdQualifierGetInput;
-
-/**
-* This structure defines Select Item command qualifier Info
-*/
-typedef struct {
-       TelSatPresentationType presentation_type; /**< presentation type */
-       TelSatSelectionPreferenceType select_preference; /**< selection preference type */
-       gboolean help_info; /**< help info */
-} TelSatCmdQualifierSelectItem;
-
-/**
-* This structure defines Setup Menu command qualifier Info
-*/
-typedef struct {
-       TelSatSelectionPreferenceType select_preference; /**< selection preference type */
-       gboolean help_info; /**< help info */
-} TelSatCmdQualifierSetupMenu;
-
-/**
-* This structure defines open channel command qualifier Info
-*/
-typedef struct {
-       gboolean immediate_link; /**< open channel - immediate link type */
-       gboolean automatic_reconnection; /**< open channel -automatic reconnection type */
-       gboolean background_mode; /**< open channel -background mode type */
-} TelSatCmdQualifierOpenChannel;
-
-/**
-* This structure defines Cmd qualifier details Info
-*/
-typedef struct {
-       int cmd_num; /**< specific command number */
-       TelSatProactiveCmdType cmd_type; /**< proactive command type */
-       union {
-               TelSatCmdQualifierDisplayText display_text;  /**< display text command qualifier info */
-               TelSatCmdQualifierGetInkey get_inkey;  /**< get inkey command qualifier info */
-               TelSatCmdQualifierGetInput get_input;  /**< get input command qualifier info */
-               TelSatCmdQualifierPlayTone play_tone;  /**< play tone command qualifier info */
-               TelSatCmdQualifierSetupMenu setup_menu; /**<    setup menu command qualifier info */
-               TelSatCmdQualifierSelectItem select_item;  /**< select item command qualifier info */
-               gboolean cmd_quali_send_sms;  /**< send sms command qualifier info */
-               TelSatCmdQualifierSetupCall setup_call;  /**< setup call command qualifier info */
-               TelSatCmdQualifierRefresh refresh;  /**< refresh command qualifier info */
-               TelSatCmdQualifierProvideLocalInfo provide_local_info;  /**< provide local info command qualifier info */
-               gboolean cmd_quali_language_notification;  /**< language notification command qualifier info */
-               TelSatCmdQualifierLaunchBrowser launch_browser;  /**< launch browser command qualifier info */
-               TelSatCmdQualifierOpenChannel open_channel;  /**< open channel command qualifier info */
-               gboolean cmd_quali_send_data;  /**< send data command qualifier info */
-       }cmd_qualifier; /**< cmd qualifier Union */
-} TelSatCmdDetailInfo;
-
-/**
-* This structure defines DISPLAY TEXT command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< DISPLAY TEXT command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< DISPLAY TEXT command device id info */
-       TelSatTextTypeInfo text; /**< DISPLAY TEXT command text type info */
-       TelSatIconIdentifierInfo icon_id; /**< DISPLAY TEXT command icon id info */
-       gboolean immediate_response_requested; /**< DISPLAY TEXT command immediate response requested check info */
-       TelSatDurationInfo duration; /**< DISPLAY TEXT command duration info */
-       unsigned char text_attribute[4]; /**< DISPLAY TEXT command text attribute info */
-} TelSatDisplayTextTlv;
-
-/**
-* This structure defines GET INKEY command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< GET INKEY command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< GET INKEY command device id info */
-       TelSatTextTypeInfo text; /**< GET INKEY command device id info */
-       TelSatIconIdentifierInfo icon_id; /**< GET INKEY command device id info */
-       TelSatDurationInfo duration; /**< GET INKEY command device id info */
-       unsigned char text_attribute[4]; /**< GET INKEY command device id info */
-} TelSatGetInkeyTlv;
-
-/**
-* This structure defines GET INPUT command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< GET INPUT command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< GET INPUT command device id info */
-       TelSatTextTypeInfo text; /**< GET INPUT command device id info */
-       TelSatResponseLength rsp_len; /**< GET INPUT command rsp len info */
-       TelSatTextTypeInfo default_text; /**< GET INPUT command default text info */
-       TelSatIconIdentifierInfo icon_id; /**< GET INPUT command icon id info */
-       unsigned char text_attribute[4]; /**< GET INPUT command text attribute info */
-} TelSatGetInputTlv;
-
-/**
-* This structure defines MORE TIME command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< MORE TIME command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< MORE TIME command device id info */
-} TelSatMoreTimeTlv;
-
-/**
-* This structure defines PLAY TONE command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< PLAY TONE command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< PLAY TONE command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< PLAY TONE command alpha id info */
-       TelSatToneType tone; /**< PLAY TONE command tone info */
-       TelSatDurationInfo duration; /**< PLAY TONE command duration info */
-       TelSatIconIdentifierInfo icon_id; /**< PLAY TONE command icon id info */
-       unsigned char text_attribute[4]; /**< PLAY TONE command text attribute info */
-} TelSatPlayToneTlv;
-
-/**
-* This structure defines SETUP MENU command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SETUP MENU command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SETUP MENU command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< SETUP MENU command alpha id info */
-       unsigned char menu_item_cnt; /**< SETUP MENU command menu item count */
-       TelSatMenuItemInfo menu_item[TEL_SAT_MENU_ITEM_COUNT_MAX]; /**< SETUP MENU command menu item info */
-       TelSatItemsNextActionIndiListInfo next_act_ind_list; /**< SETUP MENU command next act ind list info */
-       TelSatIconIdentifierInfo icon_id; /**< SETUP MENU command icon id info */
-       TelSatIconIdentifierListInfo icon_list; /**< SETUP MENU command icon list info */
-       unsigned char text_attribute[4]; /**< SETUP MENU command text attribute info */
-       TelSatTextAttributeListInfo text_attribute_list; /**< SETUP MENU command text attribute list info */
-} TelSatSetupMenuTlv;
-
-/**
-* This structure defines SELECT ITEM command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SELECT ITEM command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SELECT ITEM command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< SELECT ITEM command alpha id info */
-       unsigned char menu_item_cnt; /**< SELECT ITEM command menu item count info */
-       TelSatMenuItemInfo menu_item[TEL_SAT_MENU_ITEM_COUNT_MAX]; /**< SELECT ITEM command menu item info */
-       TelSatItemsNextActionIndiListInfo item_next_act_ind_list; /**< SELECT ITEM command next act ind list info */
-       unsigned char item_identifier; /**< SELECT ITEM command item identifier info */
-       TelSatIconIdentifierInfo icon_id; /**< SELECT ITEM command icon id info */
-       TelSatIconIdentifierListInfo icon_list; /**< SELECT ITEM command icon list info */
-       unsigned char text_attribute[4]; /**< SELECT ITEM command text attribute info */
-       TelSatTextAttributeListInfo text_attribute_list; /**< SELECT ITEM command text attribute list info */
-       /* frame identifier 8.80 */
-} TelSatSelectItemTlv;
-
-/**
-* This structure defines SEND SMS command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SEND SMS command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SEND SMS command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< SEND SMS command alpha id info */
-       TelSatAddressInfo address; /**< SEND SMS command address info */
-       TelSatSmsTpduInfo sms_tpdu; /**< SEND SMS command sms tpdu info */
-       /* CDMA-SMS TPDU 8.71 */
-       TelSatIconIdentifierInfo icon_id; /**< SEND SMS command icon id info */
-       unsigned char text_attribute[4]; /**< SEND SMS command text attribute info */
-       /* frame identifier 8.80 */
-} TelSatSendSmsTlv;
-
-/**
-* This structure defines SEND SS command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SEND SS command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SEND SS command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< SEND SS command alpha id info */
-       TelSatSsStringInfo ss_string; /**< SEND SS command ss string info */
-       TelSatIconIdentifierInfo icon_id; /**< SEND SS command icon id info */
-       unsigned char text_attribute[4]; /**< SEND SS command text attribute info */
-       /* frame identifier 8.80 */
-} TelSatSendSsTlv;
-
-/**
-* This structure defines SEND USSD command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SEND USSD command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SEND USSD command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< SEND USSD command alpha id info */
-       TelSatUssdStringInfo ussd_string; /**< SEND USSD command ussd string info */
-       TelSatIconIdentifierInfo icon_id; /**< SEND USSD command icon id info */
-       unsigned char text_attribute[4]; /**< SEND USSD command text attribute info */
-       /* frame identifier 8.80 */
-} TelSatSendUssdTlv;
-
-/**
-* This structure defines SETUP CALL command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SETUP CALL command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SETUP CALL command device id info */
-       TelSatAddressInfo address; /**< SETUP CALL command address info */
-       TelSatCcpInfo ccp; /**< SETUP CALL command ccp info */
-       TelSatSubAddressInfo subaddress; /**< SETUP CALL command subaddress info */
-       TelSatDurationInfo duration; /**< SETUP CALL command duration info */
-       TelSatAlphaIdentifierInfo user_confirm_alpha_id; /**< SETUP CALL command user confirm alpha id info */
-       TelSatIconIdentifierInfo user_confirm_icon_id; /**< SETUP CALL command user confirm icon id info */
-       TelSatAlphaIdentifierInfo call_setup_alpha_id; /**< SETUP CALL command alpha id info */
-       TelSatIconIdentifierInfo call_setup_icon_id; /**< SETUP CALL command icon id info */
-       unsigned char user_confirm_text_attribute[4]; /**< SETUP CALL command user confirm text attribute info */
-       unsigned char call_setup_text_attribute[4]; /**< SETUP CALL command text attribute info */
-       /* frame identifier 8.80 */
-} TelSatSetupCallTlv;
-
-/**
-* This structure defines REFRESH command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< REFRESH command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< REFRESH command device id info */
-       TelSatFileListInfo file_list; /**< REFRESH command file list info */
-       char aid[16]; /**< 8.60 AID - length is 16 byte, Refer TS 101.220 */
-} TelSatRefreshTlv;
-
-/**
-* This structure defines PROVIDE LOCAL INFORMATION command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< PROVIDE LOCAL INFORMATION command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< PROVIDE LOCAL INFORMATION command device id info */
-} TelSatProvideLocalInfoTlv;
-
-/**
-* This structure defines SETUP EVENT LIST command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SETUP EVENT LIST command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SETUP EVENT LIST command device id info */
-       TelSatEventListInfo event_list; /**< SETUP EVENT LIST command event list info */
-       TelSatEventListInfo modem_event_list; /**< SETUP EVENT LIST command modem event list info */
-} TelSatSetupEventListTlv;
-
-/**
-* This structure defines SETUP IDLE MODE TEXT command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SETUP IDLE MODE TEXT command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SETUP IDLE MODE TEXT command device id info */
-       TelSatTextTypeInfo text; /**< SETUP IDLE MODE TEXT command textinfo */
-       TelSatIconIdentifierInfo icon_id; /**< SETUP IDLE MODE TEXT command icon id info */
-       unsigned char text_attribute[4]; /**< SETUP IDLE MODE TEXT command text attribute info */
-} TelSatSetupIdleModeTextTlv;
-
-/**
-* This structure defines SEND DTMF command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SEND DTMF command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SEND DTMF command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< SEND DTMF command alpha id info */
-       TelSatDtmfStringInfo dtmf_string; /**< SEND DTMF command dtmf string info */
-       TelSatIconIdentifierInfo icon_id; /**< SEND DTMF command icon id info */
-       unsigned char text_attribute[4]; /**< SEND DTMF command text attribute info */
-} TelSatSendDtmfTlv;
-
-/**
-* This structure defines LANGUAGE NOTIFICATION command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< LANGUAGE NOTIFICATION command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< LANGUAGE NOTIFICATION command device id info */
-       TelSatLanguageInfo language; /**< LANGUAGE NOTIFICATION command language info */
-} TelSatLanguageNotificationTlv;
-
-/**
-* This structure defines LAUNCH BROWSER command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< LAUNCH BROWSER command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< LAUNCH BROWSER command device id info */
-       TelSatBrowserIdentityType browser_id; /**< LAUNCH BROWSER command browser id info */
-       TelSatUrlInfo url; /**< LAUNCH BROWSER command url info */
-       TelSatBearerList bearer; /**< LAUNCH BROWSER command bearer info */
-       int file_ref_count; /**< LAUNCH BROWSER command file ref count info */
-       TelSatProvisioningFileRef file_list[TEL_SAT_PROVISIONING_REF_MAX_COUNT]; /**< LAUNCH BROWSER command file list info */
-       TelSatTextTypeInfo gateway_proxy_text; /**< LAUNCH BROWSER command gateway proxy text info */
-       TelSatAlphaIdentifierInfo user_confirm_alpha_id; /**< LAUNCH BROWSER command user confirm alpha id info */
-       TelSatIconIdentifierInfo user_confirm_icon_id; /**< LAUNCH BROWSER command user confirm icon id info */
-       unsigned char user_confirm_text_attribute[4]; /**< LAUNCH BROWSER command user confirm text attribute info */
-       //frame identifier 8.80
-} TelSatLaunchBrowserTlv;
-
-/**
-* This structure defines Open Channel CS Bearer Info
-*/
-typedef struct {
-       TelSatAddressInfo address; /**< address info */
-       TelSatSubAddressInfo subaddress; /**< OPEN CHANNEL command subaddress info */
-       TelSatDurationInfo duration1; /**< OPEN CHANNEL command duration1 info */
-       TelSatDurationInfo duration2; /**< OPEN CHANNEL command duration2 info */
-       TelSatOtherAddressInfo other_address; /**< OPEN CHANNEL command other address info */
-       TelSatTextTypeInfo text_user_login; /**< OPEN CHANNEL command text user login info */
-       TelSatTextTypeInfo text_user_pwd; /**< OPEN CHANNEL command text user pwd info */
-} TelSatOpenChannelCsBearerInfo;
-
-/**
-* This structure defines Open Channel Packet Data Service Bearer Info
-*/
-typedef struct {
-       TelSatNetworkAccessNameInfo network_access_name; /**< network access name info */
-       TelSatOtherAddressInfo other_address; /**< other address info */
-       TelSatTextTypeInfo text_user_login; /**< user login text info */
-       TelSatTextTypeInfo text_user_pwd; /**< user pwd text info */
-} TelSatOpenChannelPacketDataServiceBearerInfo;
-
-/**
-* This structure defines Open Channel Local Bearer Info
-*/
-typedef struct {
-       TelSatDurationInfo duration1; /**< duration info */
-       TelSatDurationInfo duration2; /**< duration info */
-       TelSatTextTypeInfo text_user_pwd; /**< user pwd text info */
-       TelSatRemoteEntityAddressInfo remote_entity_address; /**< remote entity address info */
-} TelSatOpenChannelLocalBearerInfo;
-
-/**
-* This structure defines Open Channel Default Bearer Info
-*/
-typedef struct {
-       TelSatOtherAddressInfo other_address; /**< other address info */
-       TelSatTextTypeInfo text_user_login; /**< user login text info */
-       TelSatTextTypeInfo text_user_pwd; /**< user pwd text info */
-} TelSatOpenChannelDefaultBearerInfo;
-
-/**
-* This structure defines Bearer Param Csd Info
-*/
-typedef struct {
-       TelSatBearerParamCsdDataRateType data_rate; /**< Bearer Param Csd Data Rate Type */
-       TelSatBearerParamCsdBearerServiceType service_type; /**< Bearer Param Csd Bearer Service Type */
-       TelSatBearerParamCsdConnectionElementType connection_element_type; /**< Bearer Param Csd Connection Element Type */
-} TelSatBearerParametersCsdInfo;
-
-/**
-* This structure defines Bearer Param Gprs Info
-*/
-typedef struct {
-       TelSatBearerParamGprsPrecedenceClassType precedence_class; /**< Bearer Param Gprs Precedence Class Type */
-       TelSatBearerParamGprsDelayClassType delay_class; /**< Bearer Param Gprs Delay Class Type */
-       TelSatBearerParamGprsReliabilityClassType reliability_class; /**< Bearer Param Gprs Reliability Class Type */
-       TelSatBearerParamGprsPeakThroughputClassType peak_throughput_class; /**< Bearer Param Gprs Peak Throughput Class Type */
-       TelSatBearerParamGprsMeanThroughputClassType mean_throughput_class; /**< Bearer Param Gprs Mean Throughput Class Type */
-       TelSatBearerParamGprsPdpType pdp_type; /**< Bearer Param Gprs Pdp Type */
-} TelSatBearerParametersGprsInfo;
-
-/**
-* This structure defines Bearer Param Local Links Info
-*/
-typedef struct {
-       TelSatBearerParamLocalLinksServiceIdentityType service_type; /**< Bearer Param Local Links Service Identity Type */
-       char service_record[TEL_SAT_BEARER_PARAMS_LEN_MAX]; /**< service record data */
-} TelSatBearerParametersLocalLinksInfo;
-
-/**
-* This structure defines Bearer Desc Info
-*/
-typedef struct {
-       TelSatBearerDescType bearer_type; /**< Bearer Desc Type */
-       union{
-               TelSatBearerParametersCsdInfo cs_bearer_param; /**< Bearer Parameters Csd Info */
-               TelSatBearerParametersGprsInfo ps_bearer_param; /**< Bearer Parameters Gprs Info */
-               TelSatBearerParametersLocalLinksInfo local_link_bearer_param; /**< Bearer Parameters Local Links Info */
-       }bearer_parameter; /**< Union */
-} TelSatBearerDescriptionInfo;
-
-/**
-* This structure defines OPEN CHANNEL command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< OPEN CHANNEL command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< OPEN CHANNEL command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< OPEN CHANNEL command alpha id info */
-       TelSatIconIdentifierInfo icon_id; /**< OPEN CHANNEL command icon id info */
-       TelSatBearerDescriptionInfo bearer_desc; /**< OPEN CHANNEL command bearer desc info */
-       unsigned char buffer_size[2]; /**< OPEN CHANNEL command buffer size info */
-       TelSatSimMeInterfaceTransportLevelInfo interface_transport_level; /**< OPEN CHANNEL command interface transport level info */
-       TelSatOtherAddressInfo data_destination_address; /**< OPEN CHANNEL command data destination address info */
-       unsigned char text_attribute[4]; /**< OPEN CHANNEL command text attribute info */
-       /* frame identifier 8.80 */
-       union{
-               TelSatOpenChannelCsBearerInfo cs_bearer; /**< OPEN CHANNEL command cs bearer info */
-               TelSatOpenChannelPacketDataServiceBearerInfo ps_bearer; /**< OPEN CHANNEL command ps bearer info */
-               TelSatOpenChannelLocalBearerInfo local_bearer; /**< OPEN CHANNEL command local bearer info */
-               TelSatOpenChannelDefaultBearerInfo default_bearer; /**< OPEN CHANNEL command default bearer info */
-       }bearer_detail; /**< Union */
-} TelSatOpenChannelTlv;
-
-/**
-* This structure defines CLOSE CHANNEL command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< CLOSE CHANNEL command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< CLOSE CHANNEL command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< CLOSE CHANNEL command alpha id info */
-       TelSatIconIdentifierInfo icon_id; /**< CLOSE CHANNEL command icon id info */
-       unsigned char text_attribute[4]; /**< CLOSE CHANNEL command text attribute info */
-} TelSatCloseChannelTlv;
-
-/**
-* This structure defines RECEIVE DATA command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< RECEIVE DATA command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< RECEIVE DATA command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< RECEIVE DATA command alpha id info */
-       TelSatIconIdentifierInfo icon_id; /**< RECEIVE DATA command icon id info */
-       unsigned char channel_data_len; /**< RECEIVE DATA command channel data len info */
-       unsigned char text_attribute[4]; /**< RECEIVE DATA command text attribute info */
-} TelSatReceiveChannelTlv;
-
-/**
-* This structure defines SEND DATA command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< SEND DATA command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< SEND DATA command device id info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< SEND DATA command alpha id info */
-       TelSatIconIdentifierInfo icon_id; /**< SEND DATA command icon id info */
-       TelSatChannelDataInfo channel_data; /**< SEND DATA command channel data info */
-       unsigned char text_attribute[4]; /**< SEND DATA command text attribute info */
-} TelSatSendChannelTlv;
-
-/**
-* This structure defines GET CHANNEL STATUS command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< GET CHANNEL STATUS command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< GET CHANNEL STATUS command device id info */
-} TelSatGetChannelStatusTlv;
-
-/**
-* This structure defines Menu Selection envelope data
-*/
-typedef struct {
-       TelSatDeviceIdentitiesInfo device_identitie; /**< device identities info */
-       unsigned char item_identifier; /**< item identifier info */
-       gboolean help_request; /**< help request info */
-} TelSatEnvelopMenuSelectionInfo;
-
-/**
-* This structure defines Event Download envelope data
-*/
-typedef struct {
-       TelSatDeviceIdentitiesInfo device_identitie; /**< device identities info */
-       TelSatEventListType event; /**< event info */
-       gboolean idle_screen; /**< idle screen check */
-       TelSatLanguageInfo language; /**< language info */
-       TelSatBrowserTerminationCauseType browser_termination; /**< browser termination info */
-       TelSatChannelStatusInfo channel_status; /**< channel_status info */
-       unsigned char channel_data_len; /**< channel_data_len */
-} TelSatEnvelopEventDownloadTlv;
-
-/**
-* This structure defines Terminal Response data for Display Text command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Display Text command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Display Text command TR device id info */
-       TelSatResultType result_type; /**< Display Text command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Display Text command TR me problem type info */
-} TelSatTrDisplayTextTlv;
-
-/**
-* This structure defines Terminal Response data for Get Inkey command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Get Inkey command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Get Inkey command TR device id info */
-       TelSatResultType result_type; /**< Get Inkey command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Get Inkey command TR me problem type info */
-       TelSatTextTypeInfo text; /**< Get Inkey command TR text info */
-       TelSatDurationInfo duration; /**< Get Inkey command TR duration info */
-} TelSatTrGetInkeyTlv;
-
-/**
-* This structure defines Terminal Response data for Get Input command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Get Input command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Get Input command TR device id info */
-       TelSatResultType result_type; /**< Get Input command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Get Input command TR me problem type info */
-       TelSatTextTypeInfo text; /**< Get Input command TR text info */
-} TelSatTrGetInputTlv;
-
-/**
-* This structure defines Terminal Response data for More Time command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< More Time command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< More Time command TR device id info */
-       TelSatResultType result_type; /**< More Time command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< More Time command TR me problem type info */
-} TelSatTrMoreTimeTlv;
-
-/**
-* This structure defines Terminal Response data for Play Tone command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Play Tone command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Play Tone command TR device id info */
-       TelSatResultType result_type; /**< Play Tone command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Play Tone command TR me problem type info */
-} TelSatTrPlayToneTlv;
-
-/**
-* This structure defines Terminal Response data for Refresh command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Refresh command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Refresh command TR device id info */
-       TelSatResultType result_type; /**< Refresh command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Refresh command TR me problem type info */
-} TelSatTrRefreshTlv;
-
-/**
-* This structure defines Terminal Response data for Setup Menu command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Setup Menu command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Setup Menu command TR device id info */
-       TelSatResultType result_type; /**< Setup Menu command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Setup Menu command TR me problem type info */
-} TelSatTrSetupMenuTlv;
-
-/**
-* This structure defines Terminal Response data for Select Item command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Select Item command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Select Item command TR device id info */
-       TelSatResultType result_type; /**< Select Item command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Select Item command TR me problem type info */
-       gboolean other_info; /**< Select Item command TR other info */
-       unsigned char item_identifier; /**< Select Item command TR item identifier info */
-} TelSatTrSelectItemTlv;
-
-/**
-* This structure defines Terminal Response data for Send Sms command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Send Sms command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Send Sms command TR device id info */
-       TelSatResultType result_type; /**< Send Sms command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Send Sms command TR me problem type info */
-       TelSatCallCtrlProblemType cc_problem_type; /**< Send Sms command TR cc problem type info */
-} TelSatTrSendSmsTlv;
-
-/**
-* This structure defines Terminal Response data for Send SS command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Send SS command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Send SS command TR device id info */
-       TelSatResultType result_type; /**< Send SS command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Send SS command TR me problem type info */
-       TelSatSsProblemType ss_problem; /**< Send SS command TR ss problem info */
-       gboolean other_info; /**< Send SS command TR other info */
-       TelSatCallCtrlProblemType cc_problem_type; /**< Send SS command TR cc problem type info */
-       TelSatCallCtrlRequestedActionInfo call_ctrl_req_act; /**< Send SS command TR call ctrl req act info */
-       TelSatResultType result_type2; /**< Send SS command TR result type2 info */
-       TelSatTextTypeInfo text; /**< Send SS command TR text info */
-} TelSatTrSendSsTlv;
-
-/**
-* This structure defines Terminal Response data for Send Ussd command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Send Ussd command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Send Ussd command TR device id info */
-       TelSatResultType result_type; /**< Send Ussd command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Send Ussd command TR me problem type info */
-       TelSatUssdProblemType ussd_problem; /**< Send Ussd command TR ussd problem info */
-       gboolean other_info; /**< Send Ussd command TR other info */
-       gboolean call_ctrl_has_modification; /**< Send Ussd command TR call ctrl has modification check */
-       TelSatCallCtrlProblemType cc_problem_type; /**< Send Ussd command TR cc problem type info */
-       TelSatCallCtrlRequestedActionInfo call_ctrl_req_act; /**< Send Ussd command TR call ctrl req act info */
-       TelSatResultType result_type2; /**< Send Ussd command TR result type info */
-       TelSatTextTypeInfo text; /**< Send Ussd command TR text info */
-       TelSatTextTypeInfo text2; /**< Send Ussd command TR text info */
-} TelSatTrSendUssdTlv;
-
-/**
-* This structure defines Terminal Response data for Setup Call command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Setup Call command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Setup Call command TR device id info */
-       TelSatResultType result_type; /**< Setup Call command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Setup Call command TR me problem type info */
-       gboolean other_info; /**< Setup Call command TR other info */
-       TelSatNetworkProblemType network_problem_type; /**< Setup Call command TR network problem type info */
-       TelSatCallCtrlProblemType cc_problem_type; /**< Setup Call command TR cc problem type info */
-       TelSatCallCtrlRequestedActionInfo call_ctrl_req_act; /**< Setup Call command TR call ctrl req act info */
-       TelSatResultType result_type2; /**< Setup Call command TR result type info */
-       TelSatTextTypeInfo text; /**< Setup Call command TR text info */
-       gboolean tapi_cause; /**< Setup Call command TR tapi cause info */
-       int tapi_call_level_cause; /**< Setup Call command TR tapi call level cause info */
-       int tapi_ss_level_cause; /**< Setup Call command TR tapi ss level cause info */
-} TelSatTrSetupCallTlv;
-
-/**
-* This structure defines Terminal Response data for Provide Local Info command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Provide Local Info command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Provide Local Info command TR device id info */
-       TelSatResultType result_type; /**< Provide Local Info command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Provide Local Info command TR me problem type info */
-       gboolean other_info; /**< Provide Local Info command TR other info */
-       union {
-               TelSatLocationInformationInfo location_info; /**< Provide Loca lInfo command TR location info */
-               char imei[8+1];  /**< length is defined by 8 in TS 102 223 */
-               char nmr[10+1];  /**< length is defined by 10 in TS 102 223 */
-               TelSatDateTimeZoneInfo date_time_and_timezone; /**< Provide Loca lInfo command TR date time and timezone info */
-               TelSatLanguageInfo language; /**< Provide Loca lInfo command TR language info */
-       }other; /**< Union */
-} TelSatTrProvideLocalInfoTlv;
-
-/**
-* This structure defines Terminal Response data for Setup Event List command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Setup Event List command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Setup Event List command TR device id info */
-       TelSatResultType result_type; /**< Setup Event List command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Setup Event List command TR me problem type info */
-} TelSatTrSetupEventListTlv;
-
-/**
-* This structure defines Terminal Response data for Setup Idle Mode Text command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Setup Idle Mode Text command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Setup Idle Mode Text command TR device id info */
-       TelSatResultType result_type; /**< Setup Idle Mode Text command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Setup Idle Mode Text command TR me problem type info */
-} TelSatTrSetupIdleModeTextTlv;
-
-/**
-* This structure defines Terminal Response data for Send Dtmf command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Send Dtmf command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Send Dtmf command TR device id info */
-       TelSatResultType result_type; /**< Send Dtmf command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Send Dtmf command TR me problem type info */
-} TelSatTrSendDtmfTlv;
-
-/**
-* This structure defines Terminal Response data for Language Notification command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Language Notification command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Language Notification command TR device id info */
-       TelSatResultType result_type; /**< Language Notification command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Language Notification command TR me problem type info */
-} TelSatTrLanguageNotificationTlv;
-
-/**
-* This structure defines Terminal Response data for Launch Browser command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Launch Browser command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Launch Browser command TR device id info */
-       TelSatResultType result_type; /**< Launch Browser command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Launch Browser command TR me problem type info */
-       TelSatLaunchBrowserProblemType browser_problem_type; /**< Launch Browser command TR browser problem type info */
-} TelSatTrLaunchBrowserTlv;
-
-/**
-* This structure defines Terminal Response data for Open Channel command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Open Channel command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Open Channel command TR device id info */
-       TelSatResultType result_type; /**< Open Channel command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Open Channel command TR me problem type info */
-       TelSatBipProblemType bip_problem_type; /**< Open Channel command TR bip problem type info */
-       TelSatChannelStatusInfo channel_status; /**< Open Channel command TR channel status info */
-       TelSatBearerDescriptionInfo bearer_desc; /**< Open Channel command TR bearer desc info */
-       unsigned char buffer_size[2]; /**< Open Channel command TR buffer size info */
-       /* TelSatOtherAddressInfo other_address; (uicc server mode) */
-} TelSatTrOpenChannelTlv;
-
-/**
-* This structure defines Terminal Response data for Close Channel command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Close Channel command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Close Channel command TR device id info */
-       TelSatResultType result_type; /**< Close Channel command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Close Channel command TR me problem type info */
-       TelSatBipProblemType bip_problem_type; /**< Close Channel command TR bip problem type info */
-} TelSatTrCloseChannelTlv;
-
-/**
-* This structure defines Terminal Response data for Send Data command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Send Data command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Send Data command TR device id info */
-       TelSatResultType result_type; /**< Send Data command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Send Data command TR me problem type info */
-       TelSatBipProblemType bip_problem_type; /**< Send Data command TR bip problem type info */
-       unsigned char channel_data_len; /**< Send Data command TR channel data len info */
-} TelSatTrSendDataTlv;
-
-/**
-* This structure defines Terminal Response data for Receive Data command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Receive Data command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Receive Data command TR device id info */
-       TelSatResultType result_type; /**< Receive Data command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Receive Data command TR me problem type info */
-       TelSatBipProblemType bip_problem_type; /**< Receive Data command TR bip problem type info */
-       TelSatChannelDataInfo channel_data; /**< Receive Data command TR channel data info */
-       unsigned char channel_data_len; /**< Receive Data command TR channel data len info */
-} TelSatTrReceiveDataTlv;
-
-/**
-* This structure defines Terminal Response data for Get Channel Status command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Get Channel Status command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Get Channel Status command TR device id info */
-       TelSatResultType result_type; /**< Get Channel Status command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Get Channel Status command TR me problem type info */
-       TelSatBipProblemType bip_problem_type; /**< Get Channel Status command TR bip problem type info */
-       TelSatChannelStatusInfo channel_status; /**< Get Channel Status command TR channel status info */
-} TelSatTrGetChannelStatusTlv;
-
-/**
-* This structure defines Terminal Response data for unsupported command
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Unsupport Command TR details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Unsupport Command TR device id info */
-       TelSatResultType result_type; /**< Unsupport Command TR result type info */
-       TelSatMeProblemType me_problem_type; /**< Unsupport Command TR me problem type info */
-} TelSatTrUnsupportCommandTlv;
-
-/**
-* This structure defines unsupported command data
-*/
-typedef struct {
-       TelSatCmdDetailInfo command_detail; /**< Unsupport Command details info */
-       TelSatDeviceIdentitiesInfo device_id; /**< Unsupport Command device id info */
-} TelSatUnsupportCommandTlv;
-
-/**
-* This structure defines Terminal Resonse request data
-*/
-typedef struct {
-       int cmd_number; /**< Command number info */
-       TelSatProactiveCmdType cmd_type; /**< Command type info */
-       union{
-               TelSatTrDisplayTextTlv display_text; /**< display text command Terminal Response data */
-               TelSatTrGetInkeyTlv get_inkey; /**< get inkey command Terminal Response data */
-               TelSatTrGetInputTlv get_input; /**< get input command Terminal Response data */
-               TelSatTrMoreTimeTlv more_time; /**< more time command Terminal Response data */
-               TelSatTrPlayToneTlv play_tone; /**< play tone command Terminal Response data */
-               TelSatTrRefreshTlv refresh; /**< refresh command Terminal Response data */
-               TelSatTrSetupMenuTlv setup_menu; /**< setup menu command Terminal Response data */
-               TelSatTrSelectItemTlv select_item; /**< select item command Terminal Response data */
-               TelSatTrSendSmsTlv send_sms; /**< send sms command Terminal Response data */
-               TelSatTrSendSsTlv send_ss; /**< send ss command Terminal Response data */
-               TelSatTrSendUssdTlv send_ussd; /**< send ussd command Terminal Response data */
-               TelSatTrSetupCallTlv setup_call; /**< setup call command Terminal Response data */
-               TelSatTrProvideLocalInfoTlv provide_local_info; /**< provide local info command Terminal Response data */
-               TelSatTrSetupEventListTlv setup_event_list; /**< setup event list command Terminal Response data */
-               TelSatTrSetupIdleModeTextTlv setup_idle_mode_text; /**< setup idle mode text command Terminal Response data */
-               TelSatTrSendDtmfTlv send_dtmf; /**< send dtmf command Terminal Response data */
-               TelSatTrLanguageNotificationTlv language_notification; /**< language notification command Terminal Response data */
-               TelSatTrLaunchBrowserTlv launch_browser; /**< launch browser command Terminal Response data */
-               TelSatTrOpenChannelTlv open_channel; /**< open channel command Terminal Response data */
-               TelSatTrCloseChannelTlv close_channel; /**< close channel command Terminal Response data */
-               TelSatTrSendDataTlv send_data; /**< send data command Terminal Response data */
-               TelSatTrReceiveDataTlv receive_data; /**< receive data command Terminal Response data */
-               TelSatTrGetChannelStatusTlv get_channel_status; /**< get channel status command Terminal Response data */
-               TelSatTrUnsupportCommandTlv unsupport_cmd; /**< unsupported command Terminal Response data */
-       }terminal_rsp_data; /**< Union */
-} TelSatRequestTerminalResponseData;
-
-/**
-* This structure defines user confirmation request data
-*/
-typedef struct {
-       int user_conf; /**< User Confirmation Data */
-       /* Note: Not being used for now*/
-       int icon_conf;  /**< icon Confirmation Data */
-} TelSatRequestUserConfirmationData;
-
-/**
-* This structure defines envelope request data
-*/
-typedef struct {
-       TelSatEnvelopSubCmd sub_cmd; /**< Envelop Sub Cmd */
-       union{
-               TelSatEnvelopMenuSelectionInfo menu_select; /**< Envelop Menu Selection info */
-               TelSatEnvelopEventDownloadTlv event_download; /**< Envelop Event Download info */
-       }envelop_data; /**< Union */
-} TelSatRequestEnvelopCmdData;
-
-/**
-* This structure defines SAT Notification decoding structure
-*/
-typedef struct {
-       int cmd_num; /**< Command number */
-       TelSatProactiveCmdType cmd_type; /**< Command type */
-       union {
-               TelSatDisplayTextTlv display_text; /**< display text command Decoded Proactive Data */
-               TelSatGetInkeyTlv get_inkey; /**< get inkey command Decoded Proactive Data */
-               TelSatGetInputTlv get_input; /**< get input command Decoded Proactive Data */
-               TelSatMoreTimeTlv more_time; /**< more time command Decoded Proactive Data */
-               TelSatPlayToneTlv play_tone; /**< play tone command Decoded Proactive Data */
-               TelSatSetupMenuTlv setup_menu; /**< setup menu command Decoded Proactive Data */
-               TelSatSelectItemTlv select_item; /**< select item command Decoded Proactive Data */
-               TelSatSendSmsTlv send_sms; /**< send sms command Decoded Proactive Data */
-               TelSatSendSsTlv send_ss; /**< send ss command Decoded Proactive Data */
-               TelSatSendUssdTlv send_ussd; /**< send ussd command Decoded Proactive Data */
-               TelSatSetupCallTlv setup_call; /**< setup call command Decoded Proactive Data */
-               TelSatRefreshTlv refresh; /**< refresh command Decoded Proactive Data */
-               TelSatProvideLocalInfoTlv provide_local_info; /**< provide local info command Decoded Proactive Data */
-               TelSatSetupEventListTlv setup_event_list; /**< setup event list command Decoded Proactive Data */
-               TelSatSetupIdleModeTextTlv setup_idle_mode_text; /**< setup idle mode text command Decoded Proactive Data */
-               TelSatSendDtmfTlv send_dtmf; /**< send dtmf command Decoded Proactive Data */
-               TelSatLanguageNotificationTlv language_notification; /**< language notification command Decoded Proactive Data */
-               TelSatLaunchBrowserTlv launch_browser; /**< launch browser command Decoded Proactive Data */
-               TelSatOpenChannelTlv open_channel; /**< open channel command Decoded Proactive Data */
-               TelSatCloseChannelTlv close_channel; /**< close channel command Decoded Proactive Data */
-               TelSatReceiveChannelTlv receive_data; /**< receive data command Decoded Proactive Data */
-               TelSatSendChannelTlv send_data; /**< send data command Decoded Proactive Data */
-               TelSatGetChannelStatusTlv get_channel_status; /**< get channel status command Decoded Proactive Data */
-               TelSatUnsupportCommandTlv unsupport_cmd; /**< unsupported command Decoded Proactive Data */
-       } data; /**< Union */
-}TelSatDecodedProactiveData;
-
- /**
- * This structure defines SAT Notification structure
- */
-typedef struct {
-       int decode_err_code; /**< decoded error code */
-       int cmd_number; /**< Command number */
-       TelSatProactiveCmdType cmd_type; /**< Command type */
-       union{
-               TelSatDisplayTextTlv display_text; /**< display text command Noti Proactive Data */
-               TelSatGetInkeyTlv get_inkey; /**< get inkey command Noti Proactive Data */
-               TelSatGetInputTlv get_input; /**< get input command Noti Proactive Data */
-               TelSatMoreTimeTlv more_time; /**< more time command Noti Proactive Data */
-               TelSatPlayToneTlv play_tone; /**< play tone command Noti Proactive Data */
-               TelSatSetupMenuTlv setup_menu; /**< setup menu command Noti Proactive Data */
-               TelSatSelectItemTlv select_item; /**< select item command Noti Proactive Data */
-               TelSatSendSmsTlv send_sms; /**< send sms command Noti Proactive Data */
-               TelSatSendSsTlv send_ss; /**< send ss command Noti Proactive Data */
-               TelSatSendUssdTlv send_ussd; /**< send ussd command Noti Proactive Data */
-               TelSatSetupCallTlv setup_call; /**< setup call command Noti Proactive Data */
-               TelSatRefreshTlv refresh; /**< refresh command Noti Proactive Data */
-               TelSatProvideLocalInfoTlv provide_local_info; /**< provide local info command Noti Proactive Data */
-               TelSatSetupEventListTlv setup_event_list; /**< setup event list command Noti Proactive Data */
-               TelSatSetupIdleModeTextTlv setup_idle_mode_text; /**< setup idle mode text command Noti Proactive Data */
-               TelSatSendDtmfTlv send_dtmf; /**< send dtmf command Noti Proactive Data */
-               TelSatLanguageNotificationTlv language_notification; /**< language notification command Noti Proactive Data */
-               TelSatLaunchBrowserTlv launch_browser; /**< launch browser command Noti Proactive Data */
-               TelSatOpenChannelTlv open_channel; /**< open channel command Noti Proactive Data */
-               TelSatCloseChannelTlv close_channel; /**< close channel command Noti Proactive Data */
-               TelSatReceiveChannelTlv receive_data; /**< receive data command Noti Proactive Data */
-               TelSatSendChannelTlv send_data; /**< send data command Noti Proactive Data */
-               TelSatGetChannelStatusTlv get_channel_status; /**< get channel status command Noti Proactive Data */
-               TelSatUnsupportCommandTlv unsupport_cmd; /**< unsupported command Noti Proactive Data */
-       }proactive_ind_data; /**< Union */
-} TelSatNotiProactiveData;
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
- #endif /* __SAT_INTERNAL_H__ */
diff --git a/include/type/sim.h b/include/type/sim.h
new file mode 100644 (file)
index 0000000..c6001d1
--- /dev/null
@@ -0,0 +1,1324 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_SIM_H__
+#define __TYPE_SIM_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+
+#define SIM_ICCID_LEN_MAX 20 // 3gpp
+#define SIM_LANG_CNT_MAX 30 //telephony defined
+#define SIM_SST_SERVICE_CNT_MAX 56 //3gpp
+#define SIM_UST_SERVICE_CNT_MAX 64
+#define SIM_CDMA_ST_SERVICE_LEN_MAX 12
+#define SIM_CDMA_ST_SERVICE_CNT_MAX 47
+#define SIM_CSIM_ST_SERVICE_LEN_MAX 6
+#define SIM_CSIM_ST_SERVICE_CNT_MAX 41
+#define SIM_IST_BYTE_LEN_MAX 2 //telephony defined
+#define SIM_IST_SERVICE_CNT_MAX 11 //telephony defined
+#define SIM_SPN_LEN_MAX 16 //3gpp
+#define SIM_CDMA_SPN_LEN_MAX 32 //3gpp2
+#define SIM_SPDI_PLMN_MAX 41 //telephony defined
+#define SIM_XDN_ALPHA_ID_LEN_MAX 30 //telephony defined
+#define SIM_XDN_NUMBER_LEN_MAX 20 //telephony defined
+#define SIM_MSISDN_NUMBER_LEN_MAX 26 //telephony defined
+#define SIM_ECC_BYTE_LEN_MAX 3 //3gpp
+#define SIM_ECC_STRING_LEN_MAX 50 //telephony defined
+#define SIM_ECC_RECORD_CNT_MAX 15 //telephony defined
+#define SIM_EXT_RECORD_CNT_MAX 15 //telephony defined
+#define SIM_CF_RECORD_CNT_MAX 2 //telephony defined
+#define SIM_MSISDN_RECORD_CNT_MAX 10 //telephony defined
+#define SIM_GROUP_IDENTIFIER_LEN_MAX 10 //telephony defined
+#define SIM_MAIL_BOX_IDENTIFIER_LEN_MAX 5 //3gpp
+#define SIM_MSP_CNT_MAX 2 //telephony defined
+#define SIM_NW_FULL_NAME_LEN_MAX 40 //telephony defined TODO should be defined one value in all.
+#define SIM_OPLMNWACT_LEN_MAX 100 //telephony defined
+#define SIM_AUTH_REQ_DATA_LEN_MAX 256 //telephony defined
+#define SIM_AUTH_RESP_DATA_LEN_MAX 128 //telephony defined
+#define SIM_APDU_DATA_LEN_MAX 2048 //telephony defined. (2048 is for QMI definition. (1024 : general length, 1024 : extra length for additional response)).
+#define SIM_CPHS_CALL_FORWARDING_LEN_MIN 2 //telephony defined
+#define SIM_CPHS_CSP_ENTRY_CNT_MAX 11 //telephony defined
+#define SIM_CPHS_CSP_LEN_MAX 22 //telephony defined
+#define SIM_CPHS_VMWF_LEN_MAX 2 //telephony defined
+#define SIM_CPHS_OPERATOR_NAME_LEN_MAX 25 //telephony defined
+#define SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX 10 //CPHS spec
+#define SIM_CPHS_INFO_LEN_MAX 3 //telephony defined
+#define SIM_GID_LEN_MAX 16 //telephony defined
+#define SIM_IMPU_CNT_MAX 15 //telephony defined
+#define SIM_PCSCF_CNT_MAX 15 //telephony defined
+#define SIM_FILE_ID_LIST_MAX_COUNT 255 //followed SAT_FILE_ID_LIST_MAX_COUNT in sat.h
+
+#define SIM_APP_TYPE_SIM 0x01
+#define SIM_APP_TYPE_USIM 0x02
+#define SIM_APP_TYPE_CSIM 0x04
+#define SIM_APP_TYPE_ISIM 0x08
+
+enum tel_sim_file_id {
+       SIM_EF_DIR = 0x2F00,                                    /**< Root Directory for the USIM */
+       SIM_EF_ICCID = 0x2FE2,                                  /**< the ICC Identification file        */
+       SIM_EF_IMSI = 0x6F07,                                   /**< the IMSI file */
+       SIM_EF_SST = 0x6F38,                                    /**< the SIM Service Table file. EF UST has same address */
+       SIM_EF_EST = 0x6F56,                                    /**< the Enabled Service Table file   */
+       SIM_EF_OPLMN_ACT = 0x6F61,                              /**< the OPLMN List file*/
+       SIM_EF_GID1 = 0x6F3E,                                   /**< the Group Identifier Level 1 */
+       SIM_EF_GID2 = 0x6F3F,                                   /**< the Group Identifier Level 2 */
+
+       SIM_EF_ELP = 0x2F05,                                    /**< the Extended Language Preference file */
+       SIM_EF_LP = 0x6F05,                                     /**< SIM: Language preference */
+       SIM_EF_ECC = 0x6FB7,                                    /**< the Emergency Call Codes     */
+       SIM_EF_SPN = 0x6F46,                                    /**< the Service Provider Name    */
+       SIM_EF_SPDI = 0x6FCD,                                   /**< the Service provider display information*/
+       SIM_EF_PNN = 0x6FC5,                                    /**< the PLMN Network Name File*/
+       SIM_EF_OPL = 0x6FC6,                                    /**< the Operator PLMN List File*/
+       SIM_EF_MBDN = 0x6FC7,                                   /** < SIM Mail Box Dialing Number file */
+       SIM_EF_MSISDN = 0x6F40,                                 /**< MSISDN */
+       SIM_EF_EXT1 = 0x6F4A,                                   /**< Extension File-1 */
+       SIM_EF_EXT5 = 0x6F4E,                                   /**< Extension File-5 */
+       SIM_EF_EXT6 = 0x6FC8,                                   /**< Extension File-6 */
+       SIM_EF_IMG = 0x4F20,                                    /**Image file*/
+
+       SIM_EF_USIM_LI = 0x6A05,                                /**< USIM: Language Indication */
+       SIM_EF_USIM_PL = 0x2A05,                                /**< the Language Preference file of USIM */
+       SIM_EF_USIM_MBI = 0x6FC9,                               /** < Mailbox Identifier -linear fixed*/
+       SIM_EF_USIM_MWIS = 0x6FCA,                              /** < Message Waiting Indication Status -linear fixed*/
+       SIM_EF_USIM_CFIS = 0x6FCB,                              /** < Call forward indication status -linear fixed*/
+
+       SIM_EF_ISIM_IMPI = 0x6F02, /**< IMS private user identity */
+       SIM_EF_ISIM_DOMAIN = 0x6F03, /**< Home Network Domain Name */
+       SIM_EF_ISIM_IMPU = 0x6F04, /**< IMS public user identity */
+       SIM_EF_ISIM_IST = 0x6FFF, /**< IMS Service Table ,changing the value to 6FFF as it clashes with IMSI*/
+       SIM_EF_ISIM_PCSCF = 0x6F09, /**< P-CSCF Address */
+
+       /* CPHS FILE ID */
+       SIM_EF_CPHS_VOICE_MSG_WAITING = 0x6F11,                 /** < CPHS voice MSG waiting indication  */
+       SIM_EF_CPHS_SERVICE_STRING_TABLE = 0x6F12,              /** < CPHS service string table  */
+       SIM_EF_CPHS_CALL_FORWARD_FLAGS = 0x6F13,                /** < CPHS call forward flags  */
+       SIM_EF_CPHS_OPERATOR_NAME_STRING = 0x6F14,              /** < CPHS operator name string  */
+       SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE = 0x6F15,          /** < CPHS customer service profile  */
+       SIM_EF_CPHS_CPHS_INFO = 0x6F16,                         /** < CPHS information  */
+       SIM_EF_CPHS_MAILBOX_NUMBERS = 0x6F17,                   /** < CPHS mail box numbers  */
+       SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING = 0x6F18,   /** < CPHS operator name short form string  */
+       SIM_EF_CPHS_INFORMATION_NUMBERS = 0x6F19,               /** < CPHS information numbers  */
+       /*  CPHS ALS FILE ID */
+       SIM_EF_CPHS_DYNAMICFLAGS = 0x6F9F,                      /** < CPHS Dynamics flags  */
+       SIM_EF_CPHS_DYNAMIC2FLAG = 0x6F92,                      /** < CPHS Dynamics2 flags  */
+       SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE_LINE2 = 0x6F98,    /** < CPHS CSP2  */
+       SIM_EF_PBR = 0x4F30,
+
+       /* CDMA FILE ID*/
+       SIM_EF_CDMA_IMSI = 0x6F22,                              /** < CDMA IMSI_M  */
+       SIM_EF_CST = 0x6F32,                                    /** < CDMA Service table */
+       SIM_EF_CDMA_SPN = 0x6F41,                               /** < CDMA Service Provider Name  */
+       SIM_EF_MDN = 0x6F44,                                    /** < CDMA Mobile Directory Number  */
+       SIM_EF_CDMA_ECC = 0x6F47,                               /** < CDMA Emergency Call Codes  */
+       SIM_EF_CDMA_PL = 0x6F3A,                                /** < CDMA Preferred Languages  */
+
+       /* Invalid File ID, All the file ID are less than this Value*/
+       SIM_EF_INVALID = 0xFFFF,                                /**< Invalid file.*/
+       SIM_EF_OTHERS,                                          /**< Element to indicate an unknown file.*/
+};
+
+enum tel_sim_type {
+       SIM_TYPE_UNKNOWN,       /**< Unknown card */
+       SIM_TYPE_GSM,           /**< 2G GSM card*/
+       SIM_TYPE_USIM,          /**< 3G USIM card */
+       SIM_TYPE_RUIM,          /** CDMA based card*/
+       SIM_TYPE_NVSIM,         /**< CDMA NV SIM */
+       SIM_TYPE_ISIM           /**< Deprecated, do not use */
+};
+
+enum tel_sim_status {
+       SIM_STATUS_CARD_ERROR = 0x00,                   /**< Bad card / On the fly SIM gone bad **/
+       SIM_STATUS_CARD_NOT_PRESENT = 0x01,             /**<  Card not present **/
+       SIM_STATUS_INITIALIZING = 0x02,                 /**<  SIM is Initializing state **/
+       SIM_STATUS_INIT_COMPLETED = 0x03,               /**<  SIM Initialization OK **/
+       SIM_STATUS_PIN_REQUIRED = 0x04,                 /**<  PIN  required state **/
+       SIM_STATUS_PUK_REQUIRED = 0x05,                 /**<  PUK required state **/
+       SIM_STATUS_CARD_BLOCKED = 0x06,                 /**<  PIN/PUK blocked(permanently blocked- All the attempts for PIN/PUK failed) **/
+       SIM_STATUS_NCK_REQUIRED = 0x07,                 /**<  Network Control Key required state **/
+       SIM_STATUS_NSCK_REQUIRED = 0x08,                /**<  Network Subset Control Key required state **/
+       SIM_STATUS_SPCK_REQUIRED = 0x09,                /**<  Service Provider Control Key required state **/
+       SIM_STATUS_CCK_REQUIRED = 0x0a,                 /**<  Corporate Control Key required state **/
+       SIM_STATUS_CARD_REMOVED = 0x0b,                 /**<  Card removed **/
+       SIM_STATUS_LOCK_REQUIRED = 0x0c,                /**<  PH-SIM (phone-SIM) locked state **/
+       SIM_STATUS_CARD_CRASHED = 0x0d,                 /**< Runtime SIM card error **/
+       SIM_STATUS_CARD_POWEROFF = 0x0e,        /**< SIM Powered OFF **/
+       SIM_STATUS_UNKNOWN = 0xff                           /**<  unknown state. not checked yet. **/
+
+};
+
+enum tel_sim_facility_status {
+       SIM_FACILITY_STATUS_DISABLED = 0x00,    /**< PIN1 or PIN2 Disabled */
+       SIM_FACILITY_STATUS_ENABLED = 0x01,     /**< PIN1 or PIN2 Enabled */
+       SIM_FACILITY_STATUS_BLOCKED = 0x02,     /**< SIM is present, but PIN1 or PIN2  is blocked. need unblocking by PUK or PUK2 */
+       SIM_FACILITY_STATUS_PUK_BLOCKED = 0x03, /**< SIM is present, but PUK is blocked. */
+       SIM_FACILITY_STATUS_UNKNOWN = 0xFF      /**< SIM is in unknown state */
+};
+
+enum tel_sim_access_result {
+       SIM_ACCESS_SUCCESS,                     /**< Access to file successful.  */
+       SIM_ACCESS_CARD_ERROR,                  /**< SIM card error    */
+       SIM_ACCESS_FILE_NOT_FOUND,              /**< File not found  */
+       SIM_ACCESS_CONDITION_NOT_SATISFIED,     /**< Access condition is not fulfilled  */
+       SIM_ACCESS_FAILED,                      /**< Access failed.  */
+};
+
+enum tel_sim_pin_operation_result {
+       SIM_PIN_OPERATION_SUCCESS,      /**< Operation involving PIN (verification/change/enable/disable, etc) is successful.  */
+       SIM_BUSY,                       /**< SIM is busy  */
+       SIM_CARD_ERROR,                 /**< SIM card error - General errors   */
+       SIM_INCOMPATIBLE_PIN_OPERATION, /**< SIM Incompatible pin operation that is in case when invalid SIM command is given or incorrect parameters are supplied to the SIM. */
+       SIM_INCORRECT_PASSWORD,         /**< SIM PIN  Incorrect password */
+       SIM_PIN_REQUIRED,               /**< PIN Required */
+       SIM_PUK_REQUIRED,               /**< PUK Required */
+       SIM_NCK_REQUIRED,               /**< Network Control Key Required */
+       SIM_NSCK_REQUIRED,              /**< Network Subset Control Key Required */
+       SIM_SPCK_REQUIRED,              /**< Service Provider Control Key Required */
+       SIM_CCK_REQUIRED,               /**< Corporate Control Key Required */
+       SIM_LOCK_REQUIRED,              /**<  PH-SIM (phone-SIM) locked state **/
+       SIM_ADM_REQUIRED,               /**<  Admin key locked state **/
+       SIM_PERM_BLOCKED                /**< Permanently Blocked **/
+};
+
+enum tel_sim_language_type {
+       SIM_LANG_GERMAN = 0x00,         /**< German */
+       SIM_LANG_ENGLISH = 0x01,        /**< English */
+       SIM_LANG_ITALIAN = 0x02,        /**< Italian */
+       SIM_LANG_FRENCH = 0x03,         /**< French */
+       SIM_LANG_SPANISH = 0x04,        /**< Spanish */
+       SIM_LANG_DUTCH = 0x05,          /**< Dutch */
+       SIM_LANG_SWEDISH = 0x06,        /**< Swedish */
+       SIM_LANG_DANISH = 0x07,         /**< Danish */
+       SIM_LANG_PORTUGUESE = 0x08,     /**< Portuguese */
+       SIM_LANG_FINNISH = 0x09,        /**< Finnish */
+       SIM_LANG_NORWEGIAN = 0x0A,      /**< Norwegian */
+       SIM_LANG_GREEK = 0x0B,          /**< Greek */
+       SIM_LANG_TURKISH = 0x0C,        /**< Turkish */
+       SIM_LANG_HUNGARIAN = 0x0D,      /**< Hungarian */
+       SIM_LANG_POLISH = 0x0E,         /**< Polish */
+       SIM_LANG_KOREAN = 0x0F,         /**< Korean */
+       SIM_LANG_CHINESE = 0x10,        /**< Chinese */
+       SIM_LANG_RUSSIAN = 0x11,        /**< Russian */
+       SIM_LANG_JAPANESE = 0x12,       /**< Japanese */
+       SIM_LANG_UNSPECIFIED = 0xFF     /**< Unspecified */
+};
+
+enum tel_sim_msgwaiting_idication_mask {
+       SIM_MWIS_NONE = 0x00,   /**< MWIS none*/
+       SIM_MWIS_VOICE = 0x01,  /**< MWIS voice*/
+       SIM_MWIS_FAX = 0x02,    /**< MWIS FAX*/
+       SIM_MWIS_EMAIL = 0x04,  /**< MWIS email*/
+       SIM_MWIS_OTHER = 0x08,  /**< MWIS other*/
+       SIM_MWIS_VIDEO = 0x10,  /**< MWIS video*/
+       SIM_MWIS_RFU = 0xff     /**< MWIS RFU*/
+};
+
+enum tel_sim_pin_type {
+       SIM_PTYPE_PIN1 = 0x00,  /**< PIN 1 code */
+       SIM_PTYPE_PIN2 = 0x01,  /**< PIN 2 code */
+       SIM_PTYPE_PUK1 = 0x02,  /**< PUK 1 code */
+       SIM_PTYPE_PUK2 = 0x03,  /**< PUK 2 code */
+       SIM_PTYPE_UPIN = 0x04,  /**< Universal PIN - Unused now */
+       SIM_PTYPE_ADM = 0x05,   /**< Administrator - Unused now */
+       SIM_PTYPE_SIM = 0x06    /**< SIM Lock code */
+};
+
+enum tel_sim_facility_type {
+       SIM_FACILITY_PS, /**< PH-SIM, Lock PHone to SIM/UICC card*/
+       SIM_FACILITY_SC, /**< Lock SIM/UICC card, simply PIN1 */
+       SIM_FACILITY_FD, /**< Fixed Dialing Number feature, need PIN2 */
+       SIM_FACILITY_PN, /**< Network Personalization */
+       SIM_FACILITY_PU, /**< network sUbset Personalization */
+       SIM_FACILITY_PP, /**< service Provider Personalization */
+       SIM_FACILITY_PC, /**< Corporate Personalization */
+};
+
+enum tel_sim_lock_status {
+       SIM_LOCK_STATUS_UNLOCKED,       /**< 0x00 : Not necessary */
+       SIM_LOCK_STATUS_PIN,            /**< 0x01 : PIN required as a password */
+       SIM_LOCK_STATUS_PUK,            /**< 0x02 : PUK required as a password */
+       SIM_LOCK_STATUS_PIN2,           /**< 0x03 : PIN2 required as a password */
+       SIM_LOCK_STATUS_PUK2,           /**< 0x04 : PUK2 required as a password */
+       SIM_LOCK_STATUS_PERM_BLOCKED,   /**< 0x05 : PIN Permanent Blocked */
+};
+
+enum tel_sim_cphs_dynamic_flag_selected_line {
+       SIM_DYNAMIC_FLAGS_LINE1 = 0x01, /**< line 1 */
+       SIM_DYNAMIC_FLAGS_LINE2 = 0x00, /**< line 2*/
+       SIM_DYNAMIC_FLAGS_RFU = 0xff    /**< rfu*/
+};
+
+enum tel_sim_cphs_dynamic2_flag_als_status {
+       SIM_PIN2_ACCESSIBLE_FLAGS_LOCKED = 0x01,        /**< Dynamic flags locked */
+       SIM_PIN2_ACCESSIBLE_FLAGS_UNLOCKED = 0x00,      /**< Dynamic flags unlocked */
+       SIM_PIN2_ACCESSIBLE_FLAGS_RFU = 0xff            /**< rfu */
+};
+
+enum tel_sim_cphs_phase {
+       SIM_CPHS_PHASE1 = 0x01,         /**< phase1  */
+       SIM_CPHS_PHASE2 = 0x02,         /**< phase2  */
+       SIM_CPHS_PHASE_RFU = 0xff       /**< RFU  */
+};
+
+enum tel_sim_ton {
+       SIM_TON_UNKNOWN = 0,            /**< unknown */
+       SIM_TON_INTERNATIONAL = 1,      /**< international number */
+       SIM_TON_NATIONAL = 2,           /**< national number */
+       SIM_TON_NETWORK_SPECIFIC = 3,   /**< network specific number */
+       SIM_TON_DEDICATED_ACCESS = 4,   /**< subscriber number */
+       SIM_TON_ALPHA_NUMERIC = 5,      /**< alphanumeric, GSM 7-bit default alphabet) */
+       SIM_TON_ABBREVIATED_NUMBER = 6, /**< abbreviated number */
+       SIM_TON_RESERVED_FOR_EXT = 7    /**< reserved for extension */
+};
+
+enum tel_sim_npi {
+       SIM_NPI_UNKNOWN = 0,                    /**< Unknown */
+       SIM_NPI_ISDN_TEL = 1,                   /**< ISDN/Telephone numbering plan */
+       SIM_NPI_DATA_NUMBERING_PLAN = 3,        /**< Data numbering plan */
+       SIM_NPI_TELEX = 4,                      /**< Telex numbering plan */
+       SIM_NPI_SVC_CNTR_SPECIFIC_PLAN = 5,     /**< Service Center Specific plan */
+       SIM_NPI_SVC_CNTR_SPECIFIC_PLAN2 = 6,    /**< Service Center Specific plan */
+       SIM_NPI_NATIONAL = 8,                   /**< National numbering plan */
+       SIM_NPI_PRIVATE = 9,                    /**< Private numbering plan */
+       SIM_NPI_ERMES_NUMBERING_PLAN = 10,      /**< ERMES numbering plan */
+       SIM_NPI_RESERVED_FOR_EXT = 0xF          /**< Reserved for extension */
+};
+
+enum tel_sim_emergency_service_type {
+       SIM_ECC_POLICE = 0x01,          /**< Police */
+       SIM_ECC_AMBULANCE = 0x02,       /**< Ambulance */
+       SIM_ECC_FIREBRIGADE = 0x04,     /**< Fire brigade */
+       SIM_ECC_MARAINEGUARD = 0x08,    /**< Marine guard */
+       SIM_ECC_MOUTAINRESCUE = 0x10,   /**< Mountain rescue */
+       SIM_ECC_SPARE = 0x00            /**< Spare */
+};
+
+enum tel_sim_mailbox_type {
+       SIM_MAILBOX_VOICE = 0x01,       /**< Voicemail*/
+       SIM_MAILBOX_FAX = 0x02,         /**< Fax*/
+       SIM_MAILBOX_EMAIL = 0x03,       /**< Email*/
+       SIM_MAILBOX_OTHER = 0x04,       /**< Other*/
+       SIM_MAILBOX_VIDEO = 0x05,       /**< Videomail*/
+       SIM_MAILBOX_DATA = 0x06,        /**< Data*/
+};
+
+enum tel_sim_cphs_csp_group {
+       SIM_CPHS_CSP_GROUP_CALL_OFFERING = 0x01,        /**< Group CSP offering*/
+       SIM_CPHS_CSP_GROUP_CALL_RESTRICTION = 0x02,     /**< Group CSP restriction*/
+       SIM_CPHS_CSP_GROUP_OTHER_SUPP_SERVICES = 0x03,  /**< Group CSP supplementary services*/
+       SIM_CPHS_CSP_GROUP_CALL_COMPLETION = 0x04,      /**< Group CSP completion*/
+       SIM_CPHS_CSP_GROUP_TELESERVICES = 0x05,         /**< Group CSP teleservices*/
+       SIM_CPHS_CSP_GROUP_CPHS_TELESERVICES = 0x06,    /**< Group CSP CPHS teleservies*/
+       SIM_CPHS_CSP_GROUP_CPHS_FEATURES = 0x07,        /**< Group CSP CPHS features*/
+       SIM_CPHS_CSP_GROUP_NUMBER_IDENTIFIERS = 0x08,   /**< Group CSP number identifiers*/
+       SIM_CPHS_CSP_GROUP_PHASE_SERVICES = 0x09,       /**< Group CSP phase services*/
+       SIM_CPHS_CSP_GROUP_VALUE_ADDED_SERVICES = 0xC0, /**< Group CSP value added services*/
+       SIM_CPHS_CSP_GROUP_INFORMATION_NUMBERS = 0xD5   /**< Group CSP information numbers*/
+};
+
+enum tel_sim_cphs_index_level {
+       SIM_CPHS_INDEX_LEVEL_ONE = 0x01,        /**< SIM CPHS index level one */
+       SIM_CPHS_INDEX_LEVEL_TWO = 0x02,        /**< SIM CPHS index level two */
+       SIM_CPHS_INDEX_LEVEL_THREE = 0x03,      /**< SIM CPHS index level three */
+       SIM_CPHS_INDEX_LEVEL_RFU = 0xff         /**< SIM CPHS index level RFU */
+};
+
+enum tel_sim_auth_type {
+       SIM_AUTH_TYPE_IMS = 0x00,       /**< IMS Authentication */
+       SIM_AUTH_TYPE_GSM,              /**< GSM Authentication */
+       SIM_AUTH_TYPE_3G,               /**< 3G Authentication */
+       SIM_AUTH_RUIM_CAVE,             /**< CDMA CAVE Authentication */
+       SIM_AUTH_RUIM_CHAP,             /**< CDMA CHAP Authentication */
+       SIM_AUTH_RUIM_MNHA,             /**< CDMA MNHA Authentication */
+       SIM_AUTH_RUIM_MIPRRQ,           /**< CDMA MIPRRQ Authentication */
+       SIM_AUTH_RUIM_MNAAA,            /**< CDMA MNAAA Authentication */
+       SIM_AUTH_RUIM_HRPD,             /**< CDMA HRPD Authentication */
+       SIM_AUTH_TYPE_MAX               /**< TBD */
+};
+
+enum tel_sim_auth_result {
+       SIM_AUTH_NO_ERROR = 0x00,               /**< ISIM no error */
+       SIM_AUTH_CANNOT_PERFORM,                /**< status - can't perform authentication */
+       SIM_AUTH_SKIP_RESPONSE,                 /**< status - skip authentication response */
+       SIM_AUTH_MAK_CODE_FAILURE,              /**< status - MAK(Multiple Activation Key) code failure */
+       SIM_AUTH_SQN_FAILURE,                   /**< status - SQN(SeQuenceNumber) failure */
+       SIM_AUTH_SYNCH_FAILURE,                 /**< status - synch failure */
+       SIM_AUTH_UNSUPPORTED_CONTEXT,           /**< status - unsupported context */
+       SIM_AUTH_MAX                            /**< TBD */
+};
+
+enum tel_sim_power_set_result {
+       SIM_POWER_SET_SUCCESS = 0x00, /**< Change Power State Success */
+       SIM_POWER_SET_FAILURE         /**< Change Power State Failure*/
+};
+
+
+enum tel_sim_sst_service {
+       // service 1 ~ 8
+       SIM_SST_CHV1_DISABLE_FUNC = 0,                          /**< CHV1 disable function */
+       SIM_SST_ADN,                                            /**< abbreviated Dialing number */
+       SIM_SST_FDN,                                            /**< fixed Dialing number */
+       SIM_SST_SMS,                                            /**< short message storage */
+       SIM_SST_AOC,                                            /**< advice of charge */
+       SIM_SST_CCP,                                            /**< capability configuration parameters */
+       SIM_SST_PLMN_SELECTOR,                                  /**< plmn selector */
+       SIM_SST_RFU1,                                           /**< rfu */
+
+       // service 9 ~ 16
+       SIM_SST_MSISDN = 8,                                     /**< msisdn */
+       SIM_SST_EXT1,                                           /**< extension1 */
+       SIM_SST_EXT2,                                           /**< extension2 */
+       SIM_SST_SMS_PARAMS,                                     /**< sms parameteres */
+       SIM_SST_LND,                                            /**< last number dialed */
+       SIM_SST_CELL_BROADCAST_MSG_ID,                          /**< cell broadcast message identifier */
+       SIM_SST_GID_LV1,                                        /**< group identifier level 1 */
+       SIM_SST_GID_LV2,                                        /**< group identifier level 2 */
+
+       // service 17 ~ 24
+       SIM_SST_SPN = 16,                                       /**< service provider name */
+       SIM_SST_SDN,                                            /**< service Dialing number */
+       SIM_SST_EXT3,                                           /**< extension3 */
+       SIM_SST_RFU2,                                           /**< rfu */
+       SIM_SST_VGCS_GID_LIST,                                  /**< vgcs group identifier (EF-VGCS, EF-VGCSS) */
+       SIM_SST_VBS_GID_LIST,                                   /**< vbs group identifier (EF-VBS, EF-VBSS) */
+       SIM_SST_ENHANCED_MULTI_LV_PRECEDENCE_PREEMPTION_SRVC,   /**< enhanced multi-level precedence and pre-emption service */
+       SIM_SST_AUTO_ANSWER_FOR_EMLPP,                          /**< automatic answer fro eMLPP */
+
+       // service 25 ~ 32,
+       SIM_SST_DATA_DOWNLOAD_VIA_SMS_CB = 24,                  /**< data download via sms-cb */
+       SIM_SST_DATA_DOWNLOAD_VIA_SMS_PP,                       /**< data download via sms-pp */
+       SIM_SST_MENU_SELECTION,                                 /**< menu selection */
+       SIM_SST_CALL_CTRL,                                      /**< call control */
+       SIM_SST_PROACTIVE_SIM,                                  /**< proactive sim command */
+       SIM_SST_CELL_BROADCAST_MSG_ID_RANGES,                   /**< cell broadcast message identifier ranges */
+       SIM_SST_BDN,                                            /**< barred Dialing numbers */
+       SIM_SST_EXT4,                                           /**< extension 4 */
+
+       // service 33 ~ 40
+       SIM_SST_DEPERSONALIZATION_CTRL_KEYS = 32,               /**< de-personalization control keys */
+       SIM_SST_COOPERATIVE_NETWORK_LIST,                       /**< co-operative network list */
+       SIM_SST_SMS_STATUS_REPORTS,                             /**< short message status reports */
+       SIM_SST_NIA,                                            /**< network's indication of alerting in the MS (NIA) */
+       SIM_SST_MO_SMS_CTRL_BY_SIM,                             /**< mobile-originated short message control by sim */
+       SIM_SST_GPRS,                                           /**< gprs */
+       SIM_SST_IMG,                                            /**< image */
+       SIM_SST_SOLSA,                                          /**< support of local service area */
+
+       // service 41 ~ 48
+       SIM_SST_USSD_STR_DATA_OBJECT_SUPPORTED_IN_CALL_CTRL = 40,/**< ussd string data object supported in call control */
+       SIM_SST_RUN_AT_CMD_CMD,                                 /**< RUN AT COMMAND command */
+       SIM_SST_USER_CTRLED_PLMN_SELECTOR_WACT,                 /**< user controlled PLMN selector with Access technology */
+       SIM_SST_OPERATOR_CTRLED_PLMN_SELECTOR_WACT,             /**< operator controlled PLMN selector with Access technology */
+       SIM_SST_HPLMN_SELECTOR_WACT,                            /**< HPLMN selector with access technology */
+       SIM_SST_CPBCCH_INFO,                                    /**< CPBCCH information */
+       SIM_SST_INVESTIGATION_SCAN,                             /**< investigation scan */
+       SIM_SST_EXTENDED_CAPA_CONF_PARAMS,                      /**< extended capability configuration parameters */
+
+       //      service 49 ~ 56
+       SIM_SST_MEXE = 48,                                      /**< MExE */
+       SIM_SST_RPLMN_LAST_USED_ACCESS_TECH,                    /**< RPLMN last used access technology */
+       SIM_SST_PLMN_NETWORK_NAME,                              /**< PLMN Network Name*/
+       SIM_SST_OPERATOR_PLMN_LIST,                             /**< Operator PLMN List*/
+       SIM_SST_MBDN,                                           /**< Mailbox Dialling Numbers*/
+       SIM_SST_MWIS,                                           /**< Message Waiting Indication Status*/
+       SIM_SST_CFIS,                                           /**< Call Forwarding Indication Status*/
+       SIM_SST_SPDI,                                           /**< Service Provider Display Information*/
+};
+
+enum tel_sim_ust_service {
+       // service 1 ~ 8
+       SIM_UST_LOCAL_PB = 0,                                   /**< local phone book */
+       SIM_UST_FDN,                                            /**< fixed Dialing number */
+       SIM_UST_EXT2,                                           /**< extension2 */
+       SIM_UST_SDN,                                            /**< service Dialing number */
+       SIM_UST_EXT3,                                           /**< extension3 */
+       SIM_UST_BDN,                                            /**< barred Dialing numbers */
+       SIM_UST_EXT4,                                           /**< extension 4 */
+       SIM_UST_OUTGOING_CALL_INFO,                             /**< outgoing call information */
+
+       // service 9 ~ 16
+       SIM_UST_INCOMING_CALL_INFO = 8,                         /**< incoming call information */
+       SIM_UST_SMS,                                            /**< short message storage */
+       SIM_UST_SMS_STATUS_REPORTS,                             /**< short message status reports */
+       SIM_UST_SMS_PARAMS,                                     /**< sms parameteres */
+       SIM_UST_AOC,                                            /**< advice of charge */
+       SIM_UST_CCP,                                            /**< capability configuration parameters */
+       SIM_UST_CELL_BROADCAST_MSG_ID,                          /**< cell broadcast message identifier */
+       SIM_UST_CELL_BROADCAST_MSG_ID_RANGES,                   /**< cell broadcast message identifier ranges */
+
+       // service 17 ~ 24
+       SIM_UST_GID_LV1 = 16,                                   /**< group identifier level 1 */
+       SIM_UST_GID_LV2,                                        /**< group identifier level 2 */
+       SIM_UST_SPN,                                            /**< service provider name */
+       SIM_UST_USER_CTRLED_PLMN_SELECTOR_WACT,                 /**< user controlled PLMN selector with Access technology */
+       SIM_UST_MSISDN,                                         /**< msisdn */
+       SIM_UST_IMG,                                            /**< image */
+       SIM_UST_SOLSA,                                          /**< support of local service area */
+       SIM_UST_ENHANCED_MULTI_LV_PRECEDENCE_PREEMPTION_SRVC,   /**< enhanced multi-level precedence and pre-emption service */
+
+       // service 25 ~ 32
+       SIM_UST_AUTO_ANSWER_FOR_EMLPP = 24,                     /**< automatic answer fro eMLPP */
+       SIM_UST_RFU1,                                           /**< rfu */
+       SIM_UST_GSM_ACCESS,                                     /**< gsm access */
+       SIM_UST_DATA_DOWNLOAD_VIA_SMS_PP,                       /**< data download via sms-pp */
+       SIM_UST_DATA_DOWNLOAD_VIA_SMS_CB,                       /**< data download via sms-cb */
+       SIM_UST_CALL_CTRL,                                      /**< call control by usim*/
+       SIM_UST_MO_SMS_CTRL,                                    /**< mobile-originated short message control by usim */
+       SIM_UST_RUN_AT_CMD_CMD,                                 /**< RUN AT COMMAND command */
+
+       // service 33 ~ 40
+       SIM_UST_SHALL_BE_SET_TO_ONE = 32,                       /**< shall be set to 1 */
+       SIM_UST_ENABLED_SRVC_TABLE,                             /**< enabled service table */
+       SIM_UST_ACL,                                            /**< APN control list */
+       SIM_UST_DEPERSONALIZATION_CTRL_KEYS,                    /**< de-personalization control keys */
+       SIM_UST_COOPERATIVE_NETWORK_LIST,                       /**< co-operative network list */
+       SIM_UST_GSM_SEC_CONTEXT,                                /**< gsm security context */
+       SIM_UST_CPBCCH_INFO,                                    /**< CPBCCH information */
+       SIM_UST_INVESTIGATION_SCAN,                             /**< investigation scan */
+
+       // service 41 ~ 48
+       SIM_UST_MEXE = 40,                                      /**< MExE */
+       SIM_UST_OPERATOR_CTRLED_PLMN_SELECTOR_WACT,             /**< operator controlled PLMN selector with Access technology */
+       SIM_UST_HPLMN_SELECTOR_WACT,                            /**< HPLMN selector with access technology */
+       SIM_UST_EXT5,                                           /**< extension 5 */
+       SIM_UST_PLMN_NETWORK_NAME,                              /**< PLMN Network Name*/
+       SIM_UST_OPERATOR_PLMN_LIST,                             /**< Operator PLMN List*/
+       SIM_UST_MBDN,                                           /**< Mailbox Dialling Numbers*/
+       SIM_UST_MWIS,                                           /**< Message Waiting Indication Status*/
+
+       // service 49 ~ 56
+       SIM_UST_CFIS = 48,                                      /**<Call Forwarding Indication Status*/
+       SIM_UST_RPLMN_LAST_USED_ACCESS_TECH,                    /**< RPLMN last used access technology */
+       SIM_UST_SPDI,                                           /**< Service Provider Display Information*/
+       SIM_UST_MMS,                                            /**< multi media messaging service */
+       SIM_UST_EXT8,                                           /**< extension 8 */
+       SIM_UST_CALL_CTRL_ON_GPRS,                              /**< call control on gprs by usim */
+       SIM_UST_MMS_USER_CONNECTIVITY_PARAMS,                   /**< mms user connectivity parameters */
+       SIM_UST_NIA,                                            /**< network's indication of alerting in the MS (NIA) */
+
+       // service 57 ~ 64
+       SIM_UST_VGCS_GID_LIST,                                  /**< vgcs group identifier List (EF-VGCS, EF-VGCSS) */
+       SIM_UST_VBS_GID_LIST,                                   /**< vbs group identifier List (EF-VBS, EF-VBSS) */
+       SIM_UST_PSEUDONYM,
+       SIM_UST_USER_CTRLED_PLMN_SELECTOR_IWLAN,                /**< user controlled PLMN selector for I-WLAN access */
+       SIM_UST_OPERATOR_CTRLED_PLMN_SELECTOR_IWLAN,            /**< operator controlled PLMN selector for I-WLAN access */
+       SIM_UST_USER_CTRLED_WSID_LIST,
+       SIM_UST_OPERATOR_CTRLED_WSID_LIST,
+       SIM_UST_VGCS_SEC,
+};
+
+/**
+ * @enum tel_sim_cdma_service
+ *  This enumeration defines the list of CST services in CDMA Service Table.
+ */
+enum tel_sim_cdma_service {
+       // service 1 ~ 8
+       SIM_CDMA_ST_CHV_DISABLE = 0,    /**< CHV Disable Option*/
+       SIM_CDMA_ST_ADN,                /**< Abbreviated Dialing number */
+       SIM_CDMA_ST_FDN,                /**< Fixed Dialing number */
+       SIM_CDMA_ST_SMS,                /**< short message storage  */
+       SIM_CDMA_ST_HRPD,               /**< HRPD*/
+       SIM_CDMA_ST_EPB,                /**< Enhanced Phone Book */
+       SIM_CDMA_ST_MMD,                /**< Multimedia domain */
+       SIM_CDMA_ST_EUIMID,             /**< SF_EUIMID- based  EUIMID*/
+
+       // service 9 ~ 16
+       SIM_CDMA_ST_MEID = 8,           /**< MEID */
+       SIM_CDMA_ST_EXT1,               /**< Extension1 */
+       SIM_CDMA_ST_EXT2,               /**< Extension2 */
+       SIM_CDMA_ST_SMSP,               /**< sms parameteres */
+       SIM_CDMA_ST_LND,                /**< Last number dialled */
+       SIM_CDMA_ST_SCP,                /**< Service Category Program for BC-SMS */
+       SIM_CDMA_ST_RFU1,               /**< RFU */
+       SIM_CDMA_ST_RFU2,               /**< RFU */
+
+       // service 17 ~ 24
+       SIM_CDMA_ST_HSPN = 16,          /**< CDMA Home Service Provider Name */
+       SIM_CDMA_ST_SDN,                /**< Service Dialing number */
+       SIM_CDMA_ST_EXT3,               /**< Extension3 */
+       SIM_CDMA_ST_3GPDSIP,            /**< 3GPD-SIP */
+       SIM_CDMA_ST_RFU3,               /**< RFU */
+       SIM_CDMA_ST_RFU4,               /**< RFU */
+       SIM_CDMA_ST_RFU5,               /**< RFU */
+       SIM_CDMA_ST_RFU6,               /**< RFU */
+
+       // service 25 ~ 32
+       SIM_CDMA_ST_DDSMSB = 24,        /**< Data download by SMS broadcast */
+       SIM_CDMA_ST_DDSMSPP,            /**< Data download by SMS PP */
+       SIM_CDMA_ST_MENU,               /**< Menu Selection */
+       SIM_CDMA_ST_CALLC,              /**< Call Control */
+       SIM_CDMA_ST_PROACTIVE,          /**< Proactive RUIM */
+       SIM_CDMA_ST_AKA,                /**< AKA*/
+       SIM_CDMA_ST_RFU7,               /**< RFU */
+       SIM_CDMA_ST_RFU8,               /**< RFU */
+
+       // service 33 ~ 40
+       SIM_CDMA_ST_RFU9 = 32,          /**< RFU */
+       SIM_CDMA_ST_RFU10,              /**< RFU */
+       SIM_CDMA_ST_RFU11,              /**< RFU */
+       SIM_CDMA_ST_RFU12,              /**< RFU */
+       SIM_CDMA_ST_RFU13,              /**< RFU */
+       SIM_CDMA_ST_3GPDMIP,            /**< 3GPD- MIP */
+       SIM_CDMA_ST_BCMCS,              /**< BCMCS */
+       SIM_CDMA_ST_MMS,                /**< Multimedia messaging service */
+
+       // service 41 ~ 48
+       SIM_CDMA_ST_EXT8 = 40,          /**< Extension 8 */
+       SIM_CDMA_ST_MMSUCP,             /**< MMS User Connectivity Parameters */
+       SIM_CDMA_ST_AA,                 /**< Application Authentication */
+       SIM_CDMA_ST_GIL1,               /**< Group Identifier Level 1 */
+       SIM_CDMA_ST_GIL2,               /**< Group Identifier Level 2 */
+       SIM_CDMA_ST_DEPERSO,            /**< Depersonalisation control keys */
+       SIM_CDMA_ST_CNL                 /**< Co-operative Network List */
+};
+
+/**
+ * @enum tel_sim_csim_service
+ *  This enumeration defines the list of CST services in CSIM Service Table. (CSIM)
+ */
+enum tel_sim_csim_service {
+       // service 1 ~ 8
+       SIM_CSIM_ST_LOCAL_PHONEBOOK = 0,        /**< Local Phone book */
+       SIM_CSIM_ST_FDN,                        /**< Fixed Dialing Numbers (FDN) */
+       SIM_CSIM_ST_EXT2,                       /**< Extension 2 */
+       SIM_CSIM_ST_SDN,                        /**< Service Dialing Numbers (SDN)  */
+       SIM_CSIM_ST_EXT3,                       /**< Extension 3 */
+       SIM_CSIM_ST_SMS,                        /**< Short Message Storage (SMS) */
+       SIM_CSIM_ST_SMSP,                       /**< Short Message Parameters */
+       SIM_CSIM_ST_HRPD,                       /**< HRPD */
+
+       // service 9 ~ 16
+       SIM_CSIM_ST_SCP = 8,                    /**< Service Category Program for BC-SMS */
+       SIM_CSIM_ST_HSPN,                       /**< CDMA Home Service Provider Name */
+       SIM_CSIM_ST_DDSMSB,                     /**< Data Download via SMS Broadcast */
+       SIM_CSIM_ST_DDSMSPP,                    /**< Data Download via SMS-PP */
+       SIM_CSIM_ST_CALLC,                      /**< Call Control */
+       SIM_CSIM_ST_3GPDSIP,                    /**< 3GPD-SIP */
+       SIM_CSIM_ST_3GPDMIP,                    /**< 3GPD-MIP */
+       SIM_CSIM_ST_AKA,                        /**< AKA */
+
+       // service 17 ~ 24
+       SIM_CSIM_ST_IP_LCS = 16,                /**< IP-based Location Services (LCS) */
+       SIM_CSIM_ST_BCMCS,                      /**< BCMCS */
+       SIM_CSIM_ST_MMS,                        /**< Multimedia Messaging Service (MMS) */
+       SIM_CSIM_ST_EXT8,                       /**< Extension 8 */
+       SIM_CSIM_ST_MMSUCP,                     /**< MMS User Connectivity Parameters */
+       SIM_CSIM_ST_AA,                         /**< Application Authentication */
+       SIM_CSIM_ST_GIL1,                       /**< Group Identifier Level 1 */
+       SIM_CSIM_ST_GIL2,                       /**< Group Identifier Level 2 */
+
+       // service 25 ~ 32
+       SIM_CSIM_ST_DEPERSO = 24,               /**< De-Personalization Control Keys */
+       SIM_CSIM_ST_CNL,                        /**< Cooperative Network List */
+       SIM_CSIM_ST_OCI,                        /**< Outgoing Call Information (OCI) */
+       SIM_CSIM_ST_ICI,                        /**< Incoming Call Information (ICI) */
+       SIM_CSIM_ST_EXT5,                       /**< Extension 5 */
+       SIM_CSIM_ST_MM_STORAGE,                 /**< Multimedia Storage */
+       SIM_CSIM_ST_IMG,                        /**< Image (EFIMG) */
+       SIM_CSIM_ST_EST,                        /**< Enabled Services Table */
+
+       // service 33 ~ 41
+       SIM_CSIM_ST_CCP = 32,                   /**< Capability Configuration Parameters (CCP) */
+       SIM_CSIM_ST_EUIMIDl,                    /**< SF_EUIMID-based EUIMID */
+       SIM_CSIM_ST_3GPD_EXT,                   /**< Messaging and 3GPD Extensions */
+       SIM_CSIM_ST_ROOT_CERTI,                 /**< Root Certificates */
+       SIM_CSIM_ST_WAP,                        /**< WAP Browser */
+       SIM_CSIM_ST_JAVA,                       /**< Java */
+       SIM_CSIM_ST_RSVD_CDG1,                  /**< Reserved for CDG */
+       SIM_CSIM_ST_RSVD_CDG2,                  /**< Reserved for CDG */
+       SIM_CSIM_ST_IPV6 = 40,                  /**< IPv6 */
+};
+
+enum tel_sim_ist_service {
+       SIM_IST_PCSCF_ADDR = 0,         /**< P-CSCF address */
+       SIM_IST_GBA,                    /**< Generic Bootstrapping Architecture */
+       SIM_IST_HTTP_DIGEST,            /**< HTTP Digest */
+       SIM_IST_GBA_LOCAL_KEY,          /**< GBA-based Local Key Establishment Mechanism */
+       SIM_IST_PCSCF_LOCAL_BREAK_OUT,  /**< Support of P-CSCF discovery for IMS Local Break Out */
+       SIM_IST_SMS,                    /**< Short Message Storage */
+       SIM_IST_SMSR,                   /**< Short Message Status Reports */
+       SIM_IST_SM_OVER_IP,             /**< Support for SM-over-IP including data download via SMS-PP as defined in TS 31.111 [31] */
+
+       SIM_IST_COMMUNICATION_CONTROL = 8, /**< Communication Control for IMS by ISIM */
+       SIM_IST_ACCESS_TO_IMS,          /**< Support of UICC access to IMS */
+       SIM_IST_URI_SUPPORT,            /**< URI support by UICC */
+};
+
+enum tel_sim_refresh_command{
+       SIM_REFRESH_CMD_INIT_AND_FULL_FCN = 0,          /**<command qualifier for REFRESH SIM INIT AND FULL FILE CHANGE_NOTIFICATION */
+       SIM_REFRESH_CMD_FCN = 1,                        /**<command qualifier for REFRESH FILE CHANGE NOTIFICATION */
+       SIM_REFRESH_CMD_INIT_AND_FCN = 2,               /**<command qualifier for REFRESH SIM INIT AND FILE CHANGE NOTIFICATION */
+       SIM_REFRESH_CMD_INIT = 3,                       /**<command qualifier for REFRESH SIM INIT */
+       SIM_REFRESH_CMD_RESET = 4,                      /**<command qualifier for REFRESH SIM RESET */
+       SIM_REFRESH_CMD_3G_APPLICATION_RESET = 5,       /**<command qualifier for REFRESH 3G APPLICATION RESET */
+       SIM_REFRESH_CMD_3G_SESSION_RESET = 6,           /**<command qualifier for REFRESH 3G SESSION RESET */
+       SIM_REFRESH_CMD_RESERVED = 0xFF                 /**<command qualifier for REFRESH RESERVED */
+};
+
+enum tel_sim_cst_type {
+       SIM_CDMA_SVC_TABLE = 0,
+       SIM_CSIM_SVC_TABLE,
+       SIM_MAX_SVC_TABLE
+};
+
+enum tel_sim_pcscf_type {
+       SIM_PCSCF_TYPE_FQDN, /**< Fully Qualified Domain Name */
+       SIM_PCSCF_TYPE_IPV4, /**< IPv4 */
+       SIM_PCSCF_TYPE_IPV6, /**< IPv6 */
+};
+
+struct tel_sim_sst {
+       char service[SIM_SST_SERVICE_CNT_MAX];  /**< should accessed with 'enum tel_sim_sst_service' as index */
+};
+
+struct tel_sim_ust {
+       char service[SIM_UST_SERVICE_CNT_MAX];  /**< should accessed with 'enum tel_sim_ust_service' as index */
+};
+
+struct tel_sim_cst {
+       enum tel_sim_cst_type cdma_svc_table;
+       union {
+               char cdma_service[SIM_CDMA_ST_SERVICE_CNT_MAX]; /**< should accessed with 'enum tel_sim_cdma_service' as index */
+               char csim_service[SIM_CSIM_ST_SERVICE_CNT_MAX]; /**< should accessed with 'enum tel_sim_csim_service' as index */
+       } service;
+};
+
+struct tel_sim_ist {
+       char service[SIM_IST_SERVICE_CNT_MAX];  // should accessed with 'enum tel_sim_ist_service' as index
+};
+
+struct tel_sim_service_table {
+       enum tel_sim_type sim_type;
+       union {
+               struct tel_sim_sst sst;
+               struct tel_sim_ust ust;
+               struct tel_sim_cst cst;
+       } table;
+};
+
+struct tel_sim_est {
+       gboolean bFdnEnabled;
+       gboolean bBdnEnabled;
+       gboolean bAclEnabled;
+};
+
+struct tel_sim_imsi {
+       char plmn[6 + 1];       /**< SIM MCC, MNC code. MNC is 2 digit or 3digit */
+       char msin[10 + 1];      /**< Mobile Station Identification Number */
+};
+
+struct tel_sim_dialing_number {
+       int alpha_id_max_len;                           /**< alpha max length in SIM - READ ONLY*/
+       char alpha_id[SIM_XDN_ALPHA_ID_LEN_MAX + 1];    /**< Alpha Identifier */
+       enum tel_sim_ton ton;                           /**< Type Of Number */
+       enum tel_sim_npi npi;                           /**< Number Plan Identity */
+       char num[SIM_XDN_NUMBER_LEN_MAX + 1];           /**< Dialing Number/SSC String */
+       unsigned char cc_id;                            /**< Capability/Configuration Identifier */
+       unsigned char ext1_id;                          /**< Extensiion1 Record Identifier */
+};
+
+struct tel_sim_gid {
+       int GroupIdentifierLen;                                 /**< Group identifier length */
+       unsigned char szGroupIdentifier[SIM_GROUP_IDENTIFIER_LEN_MAX];  /**< Group identifier */
+};
+
+struct tel_sim_cphs_svc_call_offering_s {
+       int b_call_forwarding_unconditional; /**< CallForwarding Unconditional */
+       int b_call_forwarding_on_user_busy; /**< CallForwarding On UserBusy */
+       int b_call_forwarding_on_no_reply; /**< CallForwarding On NoReply */
+       int b_call_forwarding_on_user_not_reachable; /**< CallForwarding On User Not Reachable */
+       int b_call_transfer; /**< Call Transfer */
+};
+
+struct tel_sim_cphs_svc_call_restriction_s {
+       int b_barring_of_all_outgoing_calls; /**< Barring Of All Outgoing Calls*/
+       int b_barring_of_outgoing_international_calls; /**< Barring Of Outgoing International Calls */
+       int b_barring_of_outgoing_international_calls_except_hplmn; /**< Barring Of Outgoing International Calls Except HPLMN */
+       int b_barring_of_all_incoming_calls_roaming_outside_hplmn; /**< Barring Of All Incoming Calls Roaming Outside HPLMN */
+       int b_barring_of_incoming_calls_when_roaming; /**< Barring Of IncomingCalls When Roaming */
+};
+
+struct tel_sim_cphs_svc_other_ss_s {
+       int b_multi_party_service; /**< MultiPartyService*/
+       int b_closed_user_group; /**< ClosedUserGroup*/
+       int b_advice_of_charge; /**< AdviceOfCharge*/
+       int b_preferential_closed_user_group; /**< PreferentialClosedUserGroup*/
+       int b_closed_user_group_outgoing_access; /**< ClosedUserGroupOutgoingAccess*/
+};
+
+struct tel_sim_cphs_svc_call_complete_s {
+       int b_call_hold; /**< Call Hold*/
+       int b_call_waiting; /**< Call Waiting*/
+       int b_completion_of_call_to_busy_subscriber; /**< Completion Of Call To Busy Subscriber*/
+       int b_user_user_signalling; /**< User User Signaling*/
+};
+
+struct tel_sim_cphs_svc_teleservices_s {
+       int b_short_message_mobile_originated; /**< Short Message Mobile Originated*/
+       int b_short_message_mobile_terminated; /**< Short Message Mobile Terminated*/
+       int b_short_message_cell_broadcast; /**< Short Message Cell Broadcast*/
+       int b_short_message_reply_path; /**< Short      Message Reply Path*/
+       int b_short_message_delivery_conf; /**< Short Message Delivery Conf*/
+       int b_short_message_protocol_identifier; /**< Short Message Protocol Identifier*/
+       int b_short_message_validity_period; /**< Short Message Validity Period*/
+};
+
+struct tel_sim_cphs_svc_cphs_teleservices_s {
+       int b_alternative_line_service; /**< Alternative Line Service*/
+};
+
+struct tel_sim_cphs_svc_cphs_features_s {
+       int b_string_service_table; /**< String Service Table*/
+};
+
+struct tel_sim_cphs_svc_number_identifier_s {
+       int b_calling_line_identification_present; /**< Calling Line Identification Present*/
+       int b_connected_line_identification_restrict; /**< Connected Line Identification Restrict*/
+       int b_connected_line_identification_present; /**< Connected Line Identification Present*/
+       int b_malicious_call_identifier; /**< Malicious Call Identifier*/
+       int b_calling_line_identification_send; /**< Calling Line Identification Send*/
+       int b_calling_line_identification_block; /**< Calling Line Identification Block*/
+};
+
+struct tel_sim_cphs_svc_phase_services_s {
+       int b_menu_for_gprs; /**< Menu For GPRS*/
+       int b_menu_for_high_speed_csd; /**< Menu For HighSpeedCsd*/
+       int b_menu_for_voice_group_call; /**< Menu For VoiceGroupCall*/
+       int b_menu_for_voice_broadcast_service; /**< Menu For VoiceBroadcastService*/
+       int b_menu_for_multiple_subscriber_profile; /**< Menu For MultipleSubscriberProfile*/
+       int b_menu_for_multiple_band; /**< Menu For MultipleBand*/
+};
+
+struct tel_sim_cphs_svc_value_added_services_s {
+       int b_restrict_menu_for_manual_selection; /**< RestrictMenu For ManualSelection*/
+       int b_restrict_menu_for_voice_mail; /**< RestrictMenu For VoiceMail*/
+       int b_restrict_menu_for_mo_sms_and_paging; /**< RestrictMenu For MoSmsAndPaging*/
+       int b_restrict_menu_for_mo_sms_with_emial_type; /**< RestrictMenu For MoSmsWithEmialType*/
+       int b_restrict_menu_for_fax_calls; /**< RestrictMenu For FaxCalls*/
+       int b_restrict_menu_for_data_calls; /**< RestrictMenu For DataCalls*/
+       int b_restrict_menu_for_change_language; /**< RestrictMenu For ChangeLanguage*/
+};
+
+struct tel_sim_cphs_svc_information_numbers_s {
+       int b_information_numbers;      /**< Information Numbers*/
+};
+
+struct tel_sim_cphs_csp_entry_s {
+       enum tel_sim_cphs_csp_group customer_service_group; /**< customer service group*/
+       union {
+               struct tel_sim_cphs_svc_call_offering_s call_offering;                  /**< call offering*/
+               struct tel_sim_cphs_svc_call_restriction_s call_restriction;            /**< call restriction*/
+               struct tel_sim_cphs_svc_other_ss_s other_supp_services;                 /**< other SS services*/
+               struct tel_sim_cphs_svc_call_complete_s call_complete;                  /**< call complete*/
+               struct tel_sim_cphs_svc_teleservices_s teleservices;                    /**< teleservices*/
+               struct tel_sim_cphs_svc_cphs_teleservices_s cphs_teleservices;          /**< CPHS teleservices*/
+               struct tel_sim_cphs_svc_cphs_features_s cphs_features;                  /**< CPHS features*/
+               struct tel_sim_cphs_svc_number_identifier_s number_identifiers;         /**< number identifiers*/
+               struct tel_sim_cphs_svc_phase_services_s phase_services;                        /**< phase services*/
+               struct tel_sim_cphs_svc_value_added_services_s value_added_services;    /**< value added services*/
+               struct tel_sim_cphs_svc_information_numbers_s information_numbers;      /**< information numbers*/
+       } service;
+};
+
+struct tel_sim_cphs_csp {
+       struct tel_sim_cphs_csp_entry_s service_profile_entry[SIM_CPHS_CSP_ENTRY_CNT_MAX];      /**< service profile entry*/
+};
+
+#if defined TIZEN_GLOBALCONFIG_ENABLE_CSP
+struct treq_sim_set_cphs_csp_info {
+       struct tel_sim_cphs_csp cphs_csp_info;
+};
+#endif
+
+struct tel_sim_cphs_dflag {
+       enum tel_sim_cphs_dynamic_flag_selected_line DynamicFlags;      /**< Dynamic flags information */
+};
+
+struct tel_sim_cphs_dflag2 {
+       enum tel_sim_cphs_dynamic2_flag_als_status Dynamic2Flag;        /**< Dynamic flags status */
+};
+
+struct tel_sim_cphs_service_tablie_s {
+       /* Byte 2 - bit1 & 2*/
+       int bCustomerServiceProfile;    /**< Customer Service Profile (CSP)  */
+       /* Byte 2 - bit3 & 4*/
+       int bServiceStringTable;        /**< Service String Table (SST) */
+       /* Byte 2 - bit5 & 6*/
+       int bMailBoxNumbers;            /**< MailBoxNumbers */
+       /* Byte 2 - bit7 & 8*/
+       int bOperatorNameShortForm;     /**< Short form of operator name */
+       /* Byte 3 - bit1 & 2*/
+       int bInformationNumbers;        /**< Information numbers */
+};
+
+struct tel_sim_cphs_info {
+       enum tel_sim_cphs_phase CphsPhase;                      /**< CPHS phase type */
+       struct tel_sim_cphs_service_tablie_s CphsServiceTable;  /**< CPHS service table */
+};
+
+struct tel_sim_cphs_info_number {
+       int AlphaIdLength;                                      /**< length of alpha identifier */
+       enum tel_sim_cphs_index_level IndexLevelIndicator;      /**< SIM CPHS index level one */
+       int PremiumServiceIndicator;                            /**< SIM CPHS index level one */
+       int NetworkSpecificIndicator;                           /**< SIM CPHS index level one */
+       unsigned char Alpha_id[SIM_XDN_ALPHA_ID_LEN_MAX + 1];   /**<  Alpha Identifier */
+       unsigned long DiallingnumLength;                        /**< Length of BCD number/SSC contents */
+       enum tel_sim_ton TypeOfNumber;                          /**< TON */
+       enum tel_sim_npi NumberingPlanIdentity;                 /**< NPI */
+       char DiallingNum[SIM_XDN_NUMBER_LEN_MAX + 1];           /**< Dialing Number/SSC String */
+       unsigned char Ext1RecordId;                             /**< Extensiion1 Record Identifier */
+};
+
+enum tel_sim_powerstate {
+       SIM_POWER_OFF = 0x00, /**< OFF */
+       SIM_POWER_ON = 0x01, /**< ON */
+       SIM_POWER_UNSPECIFIED = 0xFF /**< Unspecified */
+};
+
+
+struct treq_sim_verify_pins {
+       enum tel_sim_pin_type pin_type;
+       unsigned int pin_length;
+       char pin[9];
+};
+
+struct treq_sim_verify_puks {
+       enum tel_sim_pin_type puk_type;
+       unsigned int puk_length;
+       char puk[9];
+       unsigned int pin_length;
+       char pin[9];
+};
+
+struct treq_sim_change_pins {
+       enum tel_sim_pin_type type;
+       unsigned int old_pin_length;
+       char old_pin[9];
+       unsigned int new_pin_length;
+       char new_pin[9];
+};
+
+struct treq_sim_get_facility_status {
+       enum tel_sim_facility_type type;
+};
+
+struct treq_sim_disable_facility {
+       enum tel_sim_facility_type type;
+       unsigned int password_length;
+       char password[39];
+};
+
+struct treq_sim_enable_facility {
+       enum tel_sim_facility_type type;
+       unsigned int password_length;
+       char password[39];
+};
+
+struct treq_sim_get_lock_info {
+       enum tel_sim_facility_type type;
+};
+
+struct treq_sim_transmit_apdu {
+       unsigned int apdu_length;
+       unsigned char apdu[SIM_APDU_DATA_LEN_MAX];
+};
+
+struct treq_sim_set_language {
+       enum tel_sim_language_type language;
+};
+
+struct treq_sim_req_authentication {
+       enum tel_sim_auth_type auth_type;               /**< Authentication type */
+       unsigned int rand_length;                       /**< the length of RAND */
+       unsigned int autn_length;                       /**< the length of AUTN. it is not used in case of GSM AUTH */
+       char rand_data[SIM_AUTH_REQ_DATA_LEN_MAX + 1];  /**< RAND data */
+       char autn_data[SIM_AUTH_REQ_DATA_LEN_MAX + 1];  /**< AUTN data. it is not used in case of GSM AUTH */
+};
+
+struct treq_sim_set_powerstate {
+       enum tel_sim_powerstate state;
+};
+
+struct tresp_sim_set_powerstate {
+       enum tel_sim_power_set_result result;
+};
+
+
+
+struct tresp_sim_verify_pins {
+       enum tel_sim_pin_operation_result result;
+       enum tel_sim_pin_type pin_type;
+       int retry_count;
+};
+
+struct tresp_sim_verify_puks {
+       enum tel_sim_pin_operation_result result;
+       enum tel_sim_pin_type pin_type;
+       int retry_count;
+};
+
+struct tresp_sim_change_pins {
+       enum tel_sim_pin_operation_result result;
+       enum tel_sim_pin_type pin_type;
+       int retry_count;
+};
+
+struct tresp_sim_get_facility_status {
+       enum tel_sim_pin_operation_result result;
+       enum tel_sim_facility_type type;
+       gboolean b_enable;
+};
+
+struct tresp_sim_disable_facility {
+       enum tel_sim_pin_operation_result result;
+       enum tel_sim_facility_type type;
+       int retry_count;
+};
+
+struct tresp_sim_enable_facility {
+       enum tel_sim_pin_operation_result result;
+       enum tel_sim_facility_type type;
+       int retry_count;
+};
+
+struct tresp_sim_get_lock_info {
+       enum tel_sim_pin_operation_result result;
+       enum tel_sim_facility_type type;
+       enum tel_sim_lock_status lock_status;
+       int retry_count;
+};
+
+struct tresp_sim_transmit_apdu {
+       enum tel_sim_access_result result;
+       unsigned int apdu_resp_length;
+       unsigned char *apdu_resp;
+};
+
+struct tresp_sim_get_atr {
+       enum tel_sim_access_result result;
+       unsigned int atr_length;
+       unsigned char atr[256 + 2];
+};
+
+struct tel_sim_ecc {
+       char ecc_num[SIM_ECC_BYTE_LEN_MAX * 2 + 1];             /**< Emergency Call Code info-ECC is coded in BCD format. null termination used*/
+       char ecc_string[SIM_ECC_STRING_LEN_MAX + 1];            /**< Alphabet identifier. null termination used*/
+       enum tel_sim_emergency_service_type ecc_category;       /**< ECC emergency service information */
+};
+
+struct tel_sim_ecc_list {
+       int ecc_count;
+       struct tel_sim_ecc ecc[SIM_ECC_RECORD_CNT_MAX];
+};
+
+struct tel_sim_ext {
+       int ext_len;
+       char ext[SIM_EXT_RECORD_CNT_MAX + 1];
+       unsigned short next_record;
+};
+
+struct tel_sim_language {
+       int language_count;
+       enum tel_sim_language_type language[SIM_LANG_CNT_MAX];
+};
+
+struct tresp_sim_set_data {
+       enum tel_sim_access_result result;
+};
+
+struct tel_sim_iccid {
+       char iccid[SIM_ICCID_LEN_MAX + 1];
+};
+
+struct tel_sim_mbi {
+       /* '00' - no mailbox dialing number associated with message waiting indication group type.
+        'xx' - record number in EFMBDN associated with message waiting indication group type.
+        */
+       int voice_index;        /**< voice mailbox identifier*/
+       int fax_index;          /**< FAX mailbox identifier*/
+       int email_index;        /**< email mailbox identifier*/
+       int other_index;        /**< other mailbox identifier*/
+       int video_index;        /**< video mailbox identifier*/
+};
+
+struct tel_sim_mbi_list {
+       int profile_count;
+       struct tel_sim_mbi mbi[SIM_MSP_CNT_MAX];
+};
+
+struct tel_sim_mb_number{
+       int rec_index;                  /**< SIM record index; */
+       int profile_number;             /**< Subscriber profile number(ex: line1, line2, lineX) */
+       enum tel_sim_mailbox_type mb_type;
+       struct tel_sim_dialing_number number_info;
+};
+
+struct tel_sim_mailbox {
+       gboolean b_cphs;
+       int count;
+       struct tel_sim_mb_number mb[SIM_MSP_CNT_MAX*5]; /**< each profile mailbox number can exist 5 numbers */
+};
+
+struct treq_sim_set_mailbox {
+       gboolean b_cphs;
+       struct tel_sim_mb_number mb_info;
+};
+
+struct tel_sim_cfis {
+       int rec_index;
+       unsigned char msp_num;                          /**< MSP number*/
+       unsigned char cfu_status;                       /**< call forwarding unconditional indication status*/
+       enum tel_sim_ton ton;                           /**< TON*/
+       enum tel_sim_npi npi;                           /**< NPI*/
+       char cfu_num[SIM_XDN_NUMBER_LEN_MAX + 1];       /**< Dialing Number/SSC String*/
+       unsigned char cc2_id;                           /**< Capability/Configuration2 Record Identifier */
+       unsigned char ext7_id;                          /**< Extension 7 Record Identifier */
+};
+
+struct tel_sim_cf_list {
+       int profile_count;
+       struct tel_sim_cfis cf[SIM_MSP_CNT_MAX];
+};
+
+struct tel_sim_cphs_cf {
+       gboolean b_line1;       /**< CallForwardUnconditionalLine 1 */
+       gboolean b_line2;       /**< CallForwardUnconditionalLine 2 */
+       gboolean b_fax;         /**< CallForwardUnconditional FAX */
+       gboolean b_data;        /**<CallForwardUnconditional data*/
+};
+
+struct tel_sim_callforwarding {
+       gboolean b_cphs;
+       struct tel_sim_cf_list cf_list;
+       struct tel_sim_cphs_cf cphs_cf;
+};
+
+struct treq_sim_set_callforwarding {
+       gboolean b_cphs;
+       struct tel_sim_cfis cf;
+       struct tel_sim_cphs_cf cphs_cf;
+};
+
+struct tel_sim_mw {
+       int rec_index;
+       unsigned char indicator_status; /**< Indicator status*/
+       int voice_count;                /**< VoiceMail Count*/
+       int fax_count;                  /**< FAX Count*/
+       int email_count;                /**< Email Count*/
+       int other_count;                /**< Other Count*/
+       int video_count;                /**< VideoMail Count*/
+};
+
+struct tel_sim_mw_list {
+       int profile_count;
+       struct tel_sim_mw mw[SIM_MSP_CNT_MAX];
+};
+
+struct tel_sim_cphs_mw {
+       gboolean b_voice1;      /**< VoiceMsgLine1 message waiting flag */
+       gboolean b_voice2;      /**< VoiceMsgLine2 message waiting flag */
+       gboolean b_fax;         /**< FAX message waiting flag */
+       gboolean b_data;        /**< Data message waiting flag */
+};
+
+struct tel_sim_messagewaiting {
+       gboolean b_cphs;
+       struct tel_sim_mw_list mw_list;
+       struct tel_sim_cphs_mw cphs_mw;
+};
+
+struct treq_sim_set_messagewaiting {
+       gboolean b_cphs;
+       struct tel_sim_mw mw;
+       struct tel_sim_cphs_mw cphs_mw;
+};
+
+struct tel_sim_msisdn {
+       unsigned char num[SIM_MSISDN_NUMBER_LEN_MAX + 1];
+       enum tel_sim_ton ton;
+       unsigned char name[SIM_XDN_ALPHA_ID_LEN_MAX + 1];
+       unsigned short next_record;
+};
+
+struct tel_sim_msisdn_list {
+       int count;
+       struct tel_sim_msisdn msisdn[SIM_MSISDN_RECORD_CNT_MAX];
+};
+
+struct tel_sim_spn {
+       unsigned char display_condition;                /**< display condition (1 byte) */
+       unsigned char spn[SIM_CDMA_SPN_LEN_MAX + 1];    /**< SPN */
+};
+
+struct tel_sim_spdi {
+       int plmn_count;
+       struct {
+               unsigned char plmn[6+1];
+       }list[SIM_SPDI_PLMN_MAX];
+};
+
+struct tel_sim_opl {
+       unsigned char plmn[6+1];
+       unsigned short lac_from;
+       unsigned short lac_to;
+       unsigned char rec_identifier;
+};
+
+struct tel_sim_opl_list {
+       int opl_count;
+       struct tel_sim_opl *list;
+};
+
+struct tel_sim_pnn{
+       unsigned char full_name[SIM_NW_FULL_NAME_LEN_MAX + 1];
+       unsigned char short_name[SIM_NW_FULL_NAME_LEN_MAX + 1];
+};
+
+struct tel_sim_pnn_list {
+       int pnn_count;
+       struct tel_sim_pnn *list;
+};
+
+struct tel_sim_cphs_netname {
+       unsigned char full_name[SIM_CPHS_OPERATOR_NAME_LEN_MAX+1];
+       unsigned char short_name[SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX+1];
+};
+
+struct tel_sim_oplmnwact {
+       unsigned char plmn[6+1];
+       gboolean b_umts;
+       gboolean b_gsm;
+};
+
+struct tel_sim_oplmnwact_list {
+       int opwa_count;
+       struct tel_sim_oplmnwact opwa[SIM_OPLMNWACT_LEN_MAX];
+};
+
+struct tel_sim_file_list{
+       int file_count;
+       enum tel_sim_file_id file_id[SIM_FILE_ID_LIST_MAX_COUNT];
+};
+
+enum img_coding_scheme{
+       IMAGE_CODING_SCHEME_BASIC = 0x11,
+       IMAGE_CODING_SCHEME_COLOUR = 0x21,
+       IMAGE_CODING_SCHEME_RESERVED = 0xFF
+};
+
+struct tel_sim_img{
+       unsigned char width;
+       unsigned char height;
+       enum img_coding_scheme ics;
+       unsigned short iidf_fileid;
+       unsigned short offset;
+       unsigned short length;
+       unsigned char icon_data[1000];  /*Data length should be telephony defined as no restriction as per spec - Need to decide*/
+};
+
+struct tel_sim_impi {
+       char *impi;
+};
+
+struct tel_sim_impu {
+       char *impu;
+};
+
+struct tel_sim_impu_list {
+       unsigned int count;
+       struct tel_sim_impu impu[SIM_IMPU_CNT_MAX];
+};
+
+struct tel_sim_domain {
+       char *domain;
+};
+
+struct tel_sim_pcscf {
+       enum tel_sim_pcscf_type type;
+       char *pcscf;
+};
+
+struct tel_sim_pcscf_list {
+       unsigned int count;
+       struct tel_sim_pcscf pcscf[SIM_PCSCF_CNT_MAX];
+};
+
+struct tresp_sim_read {
+       enum tel_sim_access_result result;
+       union {
+               struct tel_sim_ecc_list ecc;
+               struct tel_sim_language language;
+               struct tel_sim_iccid iccid;
+               struct tel_sim_mailbox mb;
+               struct tel_sim_callforwarding cf;
+               struct tel_sim_messagewaiting mw;
+               struct tel_sim_cphs_info cphs;
+               struct tel_sim_service_table svct;
+               struct tel_sim_msisdn_list msisdn_list;
+               struct tel_sim_spn spn;
+               struct tel_sim_spdi spdi;
+               struct tel_sim_opl_list opl;
+               struct tel_sim_pnn_list pnn;
+               struct tel_sim_cphs_netname cphs_net;
+               struct tel_sim_oplmnwact_list opwa;
+               struct tel_sim_img img;
+               struct tel_sim_gid gid;
+               struct tel_sim_impi impi;
+               struct tel_sim_impu_list impu_list;
+               struct tel_sim_domain domain;
+               struct tel_sim_pcscf_list pcscf_list;
+               struct tel_sim_ist ist;
+       } data;
+};
+
+struct tresp_sim_req_authentication {
+       enum tel_sim_access_result result;
+       enum tel_sim_auth_type auth_type; /**< authentication type */
+       enum tel_sim_auth_result auth_result; /**< authentication result */
+       unsigned int resp_length; /**< response length. IMS and 3G case, it stands for RES_AUTS. GSM case, it stands for SRES. */
+       char resp_data[SIM_AUTH_RESP_DATA_LEN_MAX + 1]; /**< response data. IMS and 3G case, it stands for RES_AUTS. GSM case, it stands for SRES. */
+       unsigned int authentication_key_length; /**< the length of authentication key, Kc*/
+       char authentication_key[SIM_AUTH_RESP_DATA_LEN_MAX + 1]; /**< the data of of authentication key, Kc*/
+       unsigned int cipher_length; /**< the length of cipher key length */
+       char cipher_data[SIM_AUTH_RESP_DATA_LEN_MAX + 1]; /**< cipher key */
+       unsigned int integrity_length; /**< the length of integrity key length */
+       char integrity_data[SIM_AUTH_RESP_DATA_LEN_MAX + 1]; /**< integrity key */
+};
+
+struct tnoti_sim_status {
+       enum tel_sim_status sim_status;
+       gboolean b_changed;
+};
+
+struct tnoti_sim_refreshed {
+       struct tel_sim_file_list file_list;
+       gboolean b_full_file_changed;
+       enum tel_sim_refresh_command cmd_type;
+};
+
+struct tnoti_sim_call_forward_state {
+       gboolean b_forward;
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/type/sms.h b/include/type/sms.h
new file mode 100644 (file)
index 0000000..2095e80
--- /dev/null
@@ -0,0 +1,538 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_SMS_H__
+#define __TYPE_SMS_H__
+
+__BEGIN_DECLS
+
+/*
+       TREQ_SMS_SEND_UMTS_MSG,
+       TREQ_SMS_READ_MSG,
+       TREQ_SMS_SAVE_MSG,
+       TREQ_SMS_DELETE_MSG,
+       TREQ_SMS_GET_COUNT,
+       TREQ_SMS_GET_SCA,
+       TREQ_SMS_SET_SCA,
+       TREQ_SMS_GET_CB_CONFIG,
+       TREQ_SMS_SET_CB_CONFIG,
+       TREQ_SMS_SET_MEM_STATUS,
+       TREQ_SMS_GET_PREF_BEARER,
+       TREQ_SMS_SET_PREF_BEARER,
+       TREQ_SMS_SET_DELIVERY_REPORT,
+       TREQ_SMS_SET_MSG_STATUS,
+       TREQ_SMS_GET_PARAMS,
+       TREQ_SMS_SET_PARAMS,
+       TREQ_SMS_GET_PARAMCNT,
+       TREQ_SMS_SEND_CDMA_MSG,
+
+       TREQ_PS_ACTIVATE_CONTEXT,
+       TREQ_PS_DEACTIVATE_CONTEXT,
+       TREQ_PS_PDP_ACTIVATE,
+       TREQ_PS_PDP_DEACTIVATE,
+       TREQ_PS_SET_DORMANT,
+       TREQ_PS_SET_PORT_LIST,
+       TREQ_PS_GET_PORT_LIST,
+       TREQ_PS_DUN_PIN_CONTROL,
+*/
+
+/*==================================================================================================
+                                            MACROS
+==================================================================================================*/
+/* NetText */
+
+#define SMS_SMSP_ADDRESS_LEN                           20              /* EF-SMSP digit length */
+#define SMS_SMSP_ALPHA_ID_LEN_MAX                      128             /* EF-SMSP alpha id length */
+#define SMS_MAX_EFSMSP_RECORD_LENGTH           156             /* Maximum number of bytes SMSP Record size (Y + 28), y : 0 ~ 128 */
+
+#define SMS_MSG_SIZE_MAX                                       918             /**< Maximum Message Size */
+#define SMS_CB_SIZE_MAX                                                1252            /** Maximum CB Message Size */
+#define SMS_ETWS_SIZE_MAX                                      1252    /** Maximum ETWS Message Size */
+
+#define SMS_ADDRESS_LEN_MAX                                    20              /* Nettext Address Length */
+#define SMS_SCADDRESS_LEN_MAX                          18              /* SC Address Length */
+
+#define SMS_CB_PAGE_SIZE_MAX                           9               /**< CB maximum page size*/
+#define SMS_GSM_SMS_MSG_NUM_MAX                                255             /**< Maximum GSM SMS message number*/
+#define SMS_GSM_SMS_CBMI_LIST_SIZE_MAX         50              /**< Maximum GSM SMS CBMI list size*/
+#define SMS_SMDATA_SIZE_MAX                                    255             /**< Maximum SMS data size that can be stored*/
+#define SMS_MAX_SMS_SERVICE_CENTER_ADDR                12              /**<Maximum SMS service center address*/
+#define SMS_MAX_INDEX                                          255             /**< Maximum index value for SMS */
+
+#define SMS_SMSP_PARAMS_MAX_LEN                                28
+
+/*==================================================================================================
+                                             ENUMS
+==================================================================================================*/
+/**
+ * @enum telephony_sms_ready_status
+ * This enumeration defines the ready status type.
+ */
+enum telephony_sms_ready_status {
+  SMS_READY_STATUS_NONE = 0x00,
+  SMS_READY_STATUS_3GPP = 0x01,
+  SMS_READY_STATUS_3GPP2 = 0x02,
+  SMS_READY_STATUS_3GPP_AND_3GPP2 = 0x03,
+};
+
+/**
+ * @enum telephony_sms_MsgStatus_t
+ * This enumeration defines the network text status type.
+ */
+enum telephony_sms_MsgStatus {
+       SMS_STATUS_READ,                                                /**< MT message, stored and read */
+       SMS_STATUS_UNREAD,                                      /**< MT message, stored and unread */
+       SMS_STATUS_SENT,                                                /**< MO message, stored and  sent */
+       SMS_STATUS_UNSENT,                                      /**< MO message, stored but not sent */
+       SMS_STATUS_DELIVERED,                                   /**< delivered destination */
+       SMS_STATUS_DELIVERY_UNCONFIRMED,        /**< Service centre forwarded message but is unable to confirm delivery*/
+       SMS_STATUS_MESSAGE_REPLACED,            /**< Message has been replaced*/
+       SMS_STATUS_RESERVED                                     /**< Reserved for future use*/
+};
+
+/**
+ * @enum telephony_sms_MemStatusType
+ * This enumeration defines the memory status type.
+ */
+enum telephony_sms_MemStatusType {
+       SMS_PDA_MEMORY_STATUS_AVAILABLE = 0x01, /**< PDA Memory Available */
+       SMS_PDA_MEMORY_STATUS_FULL                      = 0x02,  /**< PDAMemory is Full */
+       SMS_PHONE_MEMORY_STATUS_AVAILABLE       = 0x03, /**< Phone memory Available */
+       SMS_PHONE_MEMORY_STATUS_FULL            = 0x04, /**< phone memory is full */
+};
+
+/**
+ * @enum telephony_sms_BearerType_t
+ * This enum defines the different bearer types
+ */
+enum telephony_sms_BearerType {
+       SMS_BEARER_PS_ONLY = 0x01,       /**< Send SMS only on PS Bearer */
+       SMS_BEARER_CS_ONLY,                  /**< Send SMS only on CS Bearer */
+       SMS_BEARER_PS_PREFERRED,        /**<Send SMS preferably on PS Bearer*/
+       SMS_BEARER_CS_PREFERRED ,       /**<Send SMS preferably on CS Bearer*/
+       SMS_NO_PREFERRED_BEARER         /**<SMS is sent based on default preferred bearer set at OEM based on vendor/operator preference*/
+};
+
+
+/**
+* @enum telephony_sms_CbMsgType_t
+* This enumeration defines the different CB message types.
+*/
+enum telephony_sms_CbMsgType {
+               SMS_CB_MSG_GSM = 1,      /**< GSM Cell broadcast message */
+               SMS_CB_MSG_UMTS,     /**< UMTS Cell broadcast message */
+               SMS_CB_MSG_CDMA
+};
+
+/**
+* @enum telephony_sms_etws_type
+* This enumeration defines the different ETWS message types.
+*/
+enum telephony_sms_etws_type {
+               SMS_ETWS_MSG_PRIMARY = 0,                               /**< PRIMARY ETWS Message */
+               SMS_ETWS_MSG_SECONDARY_GSM,                             /**< SECONDARY GSM ETWS Message */
+               SMS_ETWS_MSG_SECONDARY_UMTS                             /**< SECONDARY UMTS ETWS Message */
+};
+
+/**
+ * @enum telephony_sms_Response_t
+ * This enum defines the different response types that come in the
+ * sent status acknowledgement/notification after sending a message to the network
+ */
+enum telephony_sms_Response {
+       SMS_SENDSMS_SUCCESS = 0x00,                                     /**<Message send success*/
+       SMS_ROUTING_NOT_AVAILABLE,                                      /**< Message routing not available*/
+       SMS_INVALID_PARAMETER,                                          /**< Invalid parameter present in TPDU*/
+       SMS_DEVICE_FAILURE,                                                     /**< Device failure*/
+       SMS_SERVICE_RESERVED,                                           /**< Reserved Service*/
+       SMS_INVALID_LOCATION,                                           /**< Invalid location*/
+       SMS_NO_SIM,                                                                     /**< No SIM error*/
+       SMS_SIM_NOT_READY,                                                      /**< SIM not ready error*/
+       SMS_NO_NETWORK_RESP,                                            /**< No response from network*/
+       SMS_DEST_ADDRESS_FDN_RESTRICTED,                        /**< Destination address restricted*/
+       SMS_SCADDRESS_FDN_RESTRICTED,                           /**< Service center address restricted*/
+       SMS_RESEND_ALREADY_DONE,                                        /**< Resend a operation already done*/
+       SMS_SCADDRESS_NOT_AVAILABLE,                            /**< SCA address not available*/
+       SMS_UNASSIGNED_NUMBER = 0x8001,                         /**< Unassigned number*/
+       SMS_OPERATOR_DETERMINED_BARRING = 0x8008,       /**< Operator determined barring*/
+       SMS_CALL_BARRED = 0x800A,                                       /**< Call barred*/
+       SMS_MESSAGE_TRANSFER_REJECTED = 0x8015,         /**< Message transfer rejected*/
+       SMS_MEMORY_CAPACITY_EXCEEDED = 0x8016,          /**< Memory capacity exceeded/memory full*/
+       SMS_DESTINAITION_OUTOFSERVICE = 0x801B,         /**< Destination number/address out of service*/
+       SMS_UNSPECIFIED_SUBSCRIBER = 0x801C,            /**< Unspecified subscriber*/
+       SMS_FACILITY_REJECTED = 0x801D,                         /**< Facility rejected*/
+       SMS_UNKNOWN_SUBSCRIBER = 0x801E,                        /**< Unknown subscriber*/
+       SMS_NETWORK_OUTOFORDER = 0x8026,                        /**< Network out of order*/
+       SMS_TEMPORARY_FAILURE = 0x8029,                         /**< Temporary failure*/
+       SMS_CONGESTION = 0x802A,                                        /**< Congestion happened*/
+       SMS_RESOURCES_UNAVAILABLE = 0x802F,                     /**< Resource unavailable*/
+       SMS_FACILITY_NOT_SUBSCRIBED = 0x8032,           /**< Facility not subscribed by the user*/
+       SMS_FACILITY_NOT_IMPLEMENTED = 0x8045,          /**< Facility not implemented*/
+       SMS_INVALID_REF_VALUE = 0x8051,                         /**< Invalid reference value*/
+       SMS_INVALID_MSG = 0x805F,                                       /**< Invalid message*/
+       SMS_INVALID_MANDATORY_INFO = 0x8060,            /**< Invalid Mandatory information*/
+       SMS_MESSAGE_TYPE_NOT_IMPLEMENTED = 0x8061,      /**< Message type not implemented*/
+       SMS_MESSAGE_NOT_COMPAT_PROTOCOL = 0x8062,       /**< Message not compact protocol*/
+       SMS_IE_NOT_IMPLEMENTED = 0x8063,                        /**< Information element not implemented*/
+       SMS_PROTOCOL_ERROR = 0x806F,                            /**< Protocol error*/
+       SMS_INTERWORKING = 0x807F,                                      /**< Networking error*/
+       SMS_ME_FULL = 0x8080,                                           /**< SMS ME FULL */
+       SMS_SIM_FULL = 0x8081,                                          /**< SMS SIM FULL */
+       SMS_TIMEOUT                                                                     /**< Timeout error */
+};
+
+ /** @enum  telephony_sms_Cause_t
+ * This enum defines the different cause types that come in the
+ * sent status acknowledgement/notification after sending a message to the network
+ */
+
+enum telephony_sms_Cause {
+
+       SMS_SUCCESS,                                            /**< SMS Operation successful*/
+       SMS_INVALID_PARAMETER_FORMAT,    /**< Invalid format for some parameters passed in Data package information(TPDU)*/
+       SMS_PHONE_FAILURE,                              /**<SMS operation failed due to Modem failure*/
+       SMS_SIM_BUSY,                                           /**< SMS SIM operation cannot be performed as SIM is busy with some other operation*/
+       SMS_SIM_FAILURE,                                        /**< SMS SIM operation cannot be performed due to SIM failure */
+       SMS_UNKNOWN,                                            /**< unknown error*/
+       SMS_MEMORY_FAILURE,                             /**< Error while accessing memory or allocation of memory for SMS operation.*/
+       SMS_OPERATION_NOT_SUPPORTED     /**< operation not allowed/supported*/
+} ;
+
+/**
+ * @enum telephony_sms_SetResponse
+ * This defines the response values
+ */
+enum telephony_sms_SetResponse {
+       SMS_CBSETCONFIG_RSP,                    /**<  cellbroadcast config response */
+       SMS_SETPREFERREDBEARER_RSP,     /**<  set preferred bearer response */
+       SMS_SETPARAMETERS_RSP,          /**<  set parameter response */
+       SMS_SETMEMORYSTATUS_RSP,        /**<   set memory status response*/
+       SMS_SETMESSAGESTATUS_RSP,       /**<   set message status response*/
+       SMS_SETDEVICESTATUS_RSP,                /**<   set device status response*/
+       SMS_SETSCADDR_RSP,                      /**<   set SCA address response */
+       SMS_SET_RSP_MAX                         /**<   maximum limit*/
+};
+
+/**
+ * @enum telephony_sms_3gpp_type
+ * This defines the type of 3gpp
+ */
+enum telephony_sms_3gpp_type {
+       SMS_NETTYPE_3GPP = 0x01,                                                /**< 3gpp type */
+       SMS_NETTYPE_3GPP2,    /**< 3gpp2 type (CDMA) */
+       SMS_NETTYPE_MWI,    /**< Message waiting indication */
+};
+
+
+/**
+ * This structure defines the fields related to an Sms like SIM index, TPDU  and length
+ */
+struct telephony_sms_DataPackageInfo {
+       enum telephony_sms_3gpp_type format;
+       unsigned char   sca[SMS_SMSP_ADDRESS_LEN];                      /* Service Centre address - an optional parameter. If this parameter is not present, then this field will be Null.If present, the valid service centre address information is filled as per 3GPP TS23.040 9.1.2.5 Address fields */
+       int                     msgLength;                                                      /* Size of array szData (which is actual TPDU message) */
+       unsigned char tpduData[SMS_SMDATA_SIZE_MAX + 1];        /* SMS TPDU message */
+};
+
+/**
+ *This structure defines the data Related to SimIndex,MessageStatus and SMS Data Stored.
+ */
+struct telephony_sms_Data {
+       int                                                                     simIndex;       /**< Index where SMS is stored. */
+       enum telephony_sms_MsgStatus                    msgStatus;      /**< Message status.*/
+       struct telephony_sms_DataPackageInfo    smsData;        /**<SMS message */
+};
+
+struct telephony_sms_AddressInfo {
+       unsigned int    dialNumLen;                                                             /* length of address. If Service center address is not set, then this will be zero */
+       int                     typeOfNum;                                                              /* Type of number*/
+       int                     numPlanId;                                                              /* Numbering plan identification*/
+       unsigned char diallingNum[SMS_SMSP_ADDRESS_LEN + 1];    /* destination address. If Address not set, then set to 0xFF */
+};
+
+/**
+ * This structure defines different fields involved in setting the parameters of
+ * a particular sms in EFsmsp.
+ */
+struct telephony_sms_Params {
+
+       unsigned char                                   recordIndex;                                            /**< Index*/
+       unsigned char                                   recordLen;                                                      /**< SMS Parameter Record length*/
+       unsigned long                                           alphaIdLen;                                                     /**< Alpha id length */
+       char                                                    szAlphaId[SMS_SMSP_ALPHA_ID_LEN_MAX + 1];       /**< Alpha id .It is a unique identifier for each row/record in EFsmsp */ //JYGU: TAPI_SIM_SMSP_ALPHA_ID_LEN_MAX 128
+       unsigned char                                   paramIndicator;                                         /**< SMS parameter indicator is a 1 byte value. Each bit in this value indicates the presence/absence of the sms header parameters.If the parameter is present the corresponding bit value is set to 0.If the parameter is absent then it is set as 1.Refer 3GPP TS 31.02 :4.4.23 */
+       struct telephony_sms_AddressInfo        tpDestAddr;                                                     /**< TP-destination address (TP-DA) */
+       struct telephony_sms_AddressInfo        tpSvcCntrAddr;                                          /**< TP-service center address */
+       unsigned short                                  tpProtocolId;                                           /**< TP-protocol Id */
+       unsigned short                                  tpDataCodingScheme;                             /**< TP-data coding scheme */
+       unsigned short                                  tpValidityPeriod;                                               /**< TP-validity period */
+};
+
+/**
+ * This structure defines the different parameters that are related to the message count
+ * in a particular memory(Phone/SIM)
+ */
+struct telephony_sms_StoredMsgCountInfo {
+       unsigned int    totalCount;                                                             /**< Total count of messages stored in SIM*/
+       int                     usedCount;                                                              /**< Stored message count in SIM in SIM*/
+       int                     indexList[SMS_GSM_SMS_MSG_NUM_MAX];     /**< Message index list stored in SIM. And the maximum size of this array can be of totalCount.This array contains the list of index values in which the messages are stored.i.e. index_list[totalcount] = [2,3] denotes that indexs 2 and 3 are stored(valid) and others not(empty).*/
+};
+
+/**
+ * This structure defines a cell broadcast message.
+ */
+struct telephony_sms_CbMsg {
+       enum telephony_sms_CbMsgType    cbMsgType;                                                      /**< Cell Broadcast  message type */
+       unsigned short                                  length;                                                         /**<Size of array szMsgData (which is actual TPDU message) */
+       char                                                    msgData[SMS_CB_SIZE_MAX + 1]; /**<Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1]*/
+};
+
+struct telephony_sms_etws_msg {
+       enum telephony_sms_etws_type    etwsMsgType;                                                    /**< ETWS  message type */
+       unsigned short                                  length;                                                         /**<Size of array msgData (which is actual TPDU message) */
+       char                                                    msgData[SMS_ETWS_SIZE_MAX + 1]; /**< ETWS message data[Refer 3GPP TS 23.041 9.4.1.3]*/
+};
+
+struct telephony_sms_cb_msg_info_3gpp {
+ unsigned short fromMsgId; /**< Starting point of the range of CBS message ID */
+ unsigned short toMsgId; /**< Ending point of the range of CBS message ID */
+ unsigned char selected; /**< 0x00 . Not selected. 0x01 . Selected */
+};
+
+struct telephony_sms_cb_msg_info_3gpp2 {
+ unsigned short cbCategory; /**< CB Service category */
+ unsigned short cbLanguage; /**< Language indicator value
+                                                               . 0x00 . LANGUAGE_UNKNOWN .
+                                                                       Unknown or Unspecified
+                                                               . 0x01 . LANGUAGE_ENGLISH . English
+                                                               . 0x02 . LANGUAGE_FRENCH . French
+                                                               . 0x03 . LANGUAGE_SPANISH . Spanish
+                                                               . 0x04 . LANGUAGE_JAPANESE . Japanese
+                                                               . 0x05 . LANGUAGE_KOREAN . Korean
+                                                               . 0x06 . LANGUAGE_CHINESE . Chinese
+                                                               . 0x07 . LANGUAGE_HEBREW . Hebrew*/
+ unsigned char selected; /**< 0x00 . Not selected. 0x01 . Selected */
+};
+
+union telephony_sms_cb_msg_info_u {
+       struct telephony_sms_cb_msg_info_3gpp net3gpp; /**< 3GPP Broadcast Configuration Information */
+       struct telephony_sms_cb_msg_info_3gpp2 net3gpp2; /**< 3GPP2 Broadcast Configuration Information, CDMA*/
+};
+
+struct telephony_sms_CbConfig {
+       int net3gppType;  /**< Type of 3gpp, 0x01 . 3gpp. 0x02 . 3gpp2(CDMA) */
+       int cbEnabled; /**< CB service state. If cb_enabled is true then cell broadcast service will be enabled and underlying modem will enable CB Channel to receiving CB messages. Otherwise CB service will be disabled, underlying modem will deactivate the CB channel. (enabled/disabled) */
+       unsigned char msgIdMaxCount; /**< CB Channel List Max Count For Response */
+       int msgIdRangeCount; /**< Range of CB message ID count */
+       union telephony_sms_cb_msg_info_u msgIDs[SMS_GSM_SMS_CBMI_LIST_SIZE_MAX]; /**< Range of CB message ID information */
+};
+
+/*-----------------------------------------------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------------------------------------------------*/
+
+
+/*---------------------------------*/
+/*                Structs of Requests              */
+/*---------------------------------*/
+/*Request structure common for both 3GPP and 3GPP2*/
+struct treq_sms_send_msg {
+       struct telephony_sms_DataPackageInfo msgDataPackage;
+       int more;
+};
+
+struct treq_sms_read_msg {
+       int     index;
+};
+
+struct treq_sms_save_msg {
+       int simIndex;                   /* Index where SMS is stored. */
+       enum telephony_sms_MsgStatus msgStatus;
+       struct telephony_sms_DataPackageInfo msgDataPackage;
+};
+
+struct treq_sms_delete_msg {
+       int     index;
+};
+
+struct treq_sms_get_msg_count {
+};
+
+struct treq_sms_get_sca {
+       int     index;
+};
+
+struct treq_sms_set_sca {
+       struct telephony_sms_AddressInfo scaInfo;
+       int index;
+};
+
+struct treq_sms_get_cb_config {
+};
+
+struct treq_sms_set_cb_config {
+       int net3gppType;  /**< Type of 3gpp, 0x01 . 3gpp. 0x02 . 3gpp2(CDMA) */
+       int cbEnabled; /**< CB service state. If cb_enabled is true then cell broadcast service will be enabled and underlying modem will enable CB Channel to receiving CB messages. Otherwise CB service will be disabled, underlying modem will deactivate the CB channel. (enabled/disabled) */
+       unsigned char msgIdMaxCount; /**< CB Channel List Max Count For Response */
+       int msgIdRangeCount; /**< Range of CB message ID count */
+       union telephony_sms_cb_msg_info_u msgIDs[SMS_GSM_SMS_CBMI_LIST_SIZE_MAX]; /**< Range of CB message ID information */
+};
+
+struct treq_sms_set_mem_status {
+       int     memory_status;
+};
+
+struct treq_sms_get_pref_bearer {
+};
+
+struct treq_sms_set_pref_bearer {
+       int     svc;
+};
+
+struct treq_sms_set_delivery_report {
+       struct telephony_sms_DataPackageInfo dataInfo;
+       int rspType;
+};
+
+struct treq_sms_set_msg_status {
+       int index;
+       enum telephony_sms_MsgStatus msgStatus;
+};
+
+struct treq_sms_get_params {
+       int     index;
+};
+
+struct treq_sms_set_params {
+       struct telephony_sms_Params     params;
+};
+
+struct treq_sms_get_paramcnt {
+};
+
+/*----------------------------------*/
+/*                Structs of Responses              */
+/*----------------------------------*/
+struct tresp_sms_send_msg {
+       int     result;
+};
+
+struct tresp_sms_read_msg {
+       struct telephony_sms_Data       dataInfo;
+       int     result;
+};
+
+struct tresp_sms_save_msg {
+       int     index;
+       int     result;
+};
+
+struct tresp_sms_delete_msg {
+       int     index;
+       int     result;
+};
+
+struct tresp_sms_get_storedMsgCnt {
+       struct telephony_sms_StoredMsgCountInfo storedMsgCnt;
+       int result;
+};
+
+struct tresp_sms_get_sca {
+       struct telephony_sms_AddressInfo        scaAddress;
+       int result;
+};
+
+struct tresp_sms_set_sca {
+       int     result;
+};
+
+struct tresp_sms_get_cb_config {
+       struct telephony_sms_CbConfig   cbConfig;
+       int result;
+};
+
+struct tresp_sms_set_cb_config {
+       int     result;
+};
+
+struct tresp_sms_set_mem_status {
+       int     result;
+};
+
+struct tresp_sms_get_pref_bearer {
+       int     svc;
+       int     result;
+};
+
+struct tresp_sms_set_pref_bearer {
+       int     svc;
+       int     result;
+};
+
+struct tresp_sms_set_delivery_report {
+       int     result;
+};
+
+struct tresp_sms_set_msg_status {
+       int     result;
+};
+
+struct tresp_sms_get_params {
+       struct telephony_sms_Params     paramsInfo;
+       int result;
+};
+
+struct tresp_sms_set_params {
+       int     result;
+};
+
+struct tresp_sms_get_paramcnt {
+       int     recordCount;
+       int     result;
+};
+
+/*-----------------------------------*/
+/*                Structs of Notifications              */
+/*-----------------------------------*/
+struct tnoti_sms_incoming_msg {
+       struct telephony_sms_DataPackageInfo msgInfo;
+};
+struct tnoti_sms_cellBroadcast_msg {
+       struct telephony_sms_CbMsg cbMsg;
+};
+
+struct tnoti_sms_etws_msg {
+       struct telephony_sms_etws_msg etwsMsg;
+};
+
+struct tnoti_sms_memory_status {
+       int     status;
+};
+
+struct tnoti_sms_ready_status {
+       enum telephony_sms_ready_status status;
+};
+
+__END_DECLS
+
+#endif
+
diff --git a/include/type/sound.h b/include/type/sound.h
new file mode 100644 (file)
index 0000000..b9a66d6
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_SOUND_H__
+#define __TYPE_SOUND_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+
+enum telephony_sound_path {
+       XXX_SOUND_PATH_HANDSET          = 0x01,
+       XXX_SOUND_PATH_HEADSET,
+       XXX_SOUND_PATH_HANDFREE,
+       XXX_SOUND_PATH_BLUETOOTH,
+       XXX_SOUND_PATH_STEREO_BLUETOOTH,
+       XXX_SOUND_PATH_SPEAKER,
+       XXX_SOUND_PATH_HEADSET_3_5PI,
+       XXX_SOUND_PATH_BT_NSEC_OFF,
+       XXX_SOUND_PATH_MIC1,
+       XXX_SOUND_PATH_MIC2,
+       XXX_SOUND_PATH_HEADSET_HAC,
+};
+
+enum telephony_sound_device {
+       XXX_SOUND_DEVICE_RECEIVER       = 0x10,
+       XXX_SOUND_DEVICE_SPEAKER        = 0x20,
+       XXX_SOUND_DEVICE_HFK            = 0x30,
+       XXX_SOUND_DEVICE_BLUETOOTH      = 0x40,
+       XXX_SOUND_DEVICE_ECHO_CANCELLER = 0xA0,
+};
+
+enum telephony_sound_type {
+       XXX_SOUND_TYPE_VOICE    = 0x1,
+       XXX_SOUND_TYPE_KEYTONE,
+       XXX_SOUND_TYPE_BELL,
+       XXX_SOUND_TYPE_MESSAGE,
+       XXX_SOUND_TYPE_ALARM,
+       XXX_SOUND_TYPE_MISCELLANEOUS,
+};
+
+enum telephony_sound_volume_level {
+       XXX_SOUND_MUTE,
+       XXX_SOUND_VOLUME_LEVEL_1,
+       XXX_SOUND_VOLUME_LEVEL_2,
+       XXX_SOUND_VOLUME_LEVEL_3,
+       XXX_SOUND_VOLUME_LEVEL_4,
+       XXX_SOUND_VOLUME_LEVEL_5,
+       XXX_SOUND_VOLUME_LEVEL_6,
+       XXX_SOUND_VOLUME_LEVEL_7,
+       XXX_SOUND_VOLUME_LEVEL_8,
+       XXX_SOUND_VOLUME_LEVEL_9,
+};
+
+
+struct treq_sound_set_path {
+       enum telephony_sound_path path;
+};
+
+struct treq_sound_set_volume_level {
+       enum telephony_sound_type                       sound;
+       enum telephony_sound_device             device;
+       enum telephony_sound_volume_level       volume;
+};
+
+struct treq_sound_get_volume_level {
+       enum telephony_sound_type                       sound;
+       enum telephony_sound_device             device;
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/type/ss.h b/include/type/ss.h
new file mode 100644 (file)
index 0000000..8e95351
--- /dev/null
@@ -0,0 +1,424 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TYPE_SS_H__
+#define __TYPE_SS_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+
+enum telephony_ss_class {
+
+       SS_CLASS_NONE=0x00,                               /* 0x00 */
+
+       /* TELESERVICE */
+       SS_CLASS_ALL_TELE=0x10,                        /* 0x10 : All Teleservices */
+       SS_CLASS_VOICE=0x11,                              /* 0x11 : All Voice ( telephony ) */
+       SS_CLASS_ALL_DATA_TELE=0x12,             /* 0x12 : All Data Teleservices */
+       SS_CLASS_FAX=0x13,                                /* 0x13 : All Fax Service */
+       SS_CLASS_SMS=0x16,                                /* 0x16 : SMS service  */
+       SS_CLASS_VGCS=0x17,                              /* 0x17 : Voice Group Call Service */
+       SS_CLASS_VBS=0x18,                                /* 0x18 : Voice Broadcast */
+       SS_CLASS_ALL_TELE_EXPT_SMS=0x19,    /* 0x19 : All teleservice except SMS */
+
+       /* BEARER SERVICE */
+       SS_CLASS_ALL_BEARER=0x20,                  /* 0X20 : all bearer services */
+       SS_CLASS_ALL_ASYNC=0x21,                    /* 0x21 : All Async services */
+       SS_CLASS_ALL_SYNC=0x22,                      /* 0x22 : All sync services*/
+       SS_CLASS_ALL_CS_SYNC=0x24,                /* 0x24 : All Circuit switched sync */
+       SS_CLASS_ALL_CS_ASYNC=0x25,              /* 0x25 : All Circuit switched async */
+       SS_CLASS_ALL_DEDI_PS=0x26,                /* 0x26 : All Dedicated packet Access */
+       SS_CLASS_ALL_DEDI_PAD=0x27,              /* 0x27 : All Dedicated PAD Access */
+       SS_CLASS_ALL_DATA_CDA=0x28,             /*0x28 : All Data CDA*/
+
+       /* PLMN SPECIFIC TELESERVICE */
+       SS_CLASS_PLMN_TELE_ALL = 0x50,         /*0x50 : PLMN specific teleservices*/
+       SS_CLASS_PLMN_TELE_1 = 0x51,              /*0x51 :PLMN specific teleservice 1*/
+       SS_CLASS_PLMN_TELE_2 = 0x52,             /*0x52 : PLMN specific teleservice 2*/
+       SS_CLASS_PLMN_TELE_3 = 0x53,             /*0x53 : PLMN specific teleservice 3*/
+       SS_CLASS_PLMN_TELE_4 = 0x54,             /*0x54 : PLMN specific teleservice 4*/
+       SS_CLASS_PLMN_TELE_5 = 0x55,             /*0x55 : PLMN specific teleservice 5*/
+       SS_CLASS_PLMN_TELE_6 = 0x56,             /*0x56 : PLMN specific teleservice 6*/
+       SS_CLASS_PLMN_TELE_7 = 0x57,             /*0x57 : PLMN specific teleservice 7*/
+       SS_CLASS_PLMN_TELE_8 = 0x58,             /*0x58 : PLMN specific teleservice 8*/
+       SS_CLASS_PLMN_TELE_9 = 0x59,             /*0x59 : PLMN specific teleservice 9*/
+       SS_CLASS_PLMN_TELE_A = 0x60,           /*0x60 :PLMN specific teleservice 10*/
+       SS_CLASS_PLMN_TELE_B = 0x61,           /*0x61 :PLMN specific teleservice 11*/
+       SS_CLASS_PLMN_TELE_C = 0x62,             /*0x62 : PLMN specific teleservice 12*/
+       SS_CLASS_PLMN_TELE_D = 0x63,             /*0x63 : PLMN specific teleservice 13*/
+       SS_CLASS_PLMN_TELE_E = 0x64,             /*0x64 : PLMN specific teleservice 14*/
+       SS_CLASS_PLMN_TELE_F = 0x65,             /*0x65 : PLMN specific teleservice 15*/
+
+       /* PLMN SPECIFIC BEARER SERVICE */
+       SS_CLASS_PLMN_BEAR_ALL = 0x70,         /*0x70 : All PLMN specific bearer services*/
+       SS_CLASS_PLMN_BEAR_1 = 0x71,              /*0x71 :PLMN specific bearer service 1*/
+       SS_CLASS_PLMN_BEAR_2 = 0x72,             /*0x72 : PLMN specific bearer service  2*/
+       SS_CLASS_PLMN_BEAR_3 = 0x73,             /*0x73 : PLMN specific bearer service  3*/
+       SS_CLASS_PLMN_BEAR_4 = 0x74,             /*0x74 : PLMN specific bearer service  4*/
+       SS_CLASS_PLMN_BEAR_5 = 0x75,             /*0x75 : PLMN specific bearer service  5*/
+       SS_CLASS_PLMN_BEAR_6 = 0x76,             /*0x76 : PLMN specific bearer service  6*/
+       SS_CLASS_PLMN_BEAR_7 = 0x77,             /*0x77 : PLMN specific bearer service  7*/
+       SS_CLASS_PLMN_BEAR_8 = 0x78,             /*0x78 : PLMN specific bearer service  8*/
+       SS_CLASS_PLMN_BEAR_9 = 0x79,             /*0x79 : PLMN specific bearer service  9*/
+       SS_CLASS_PLMN_BEAR_A = 0x80,            /*0x80 : PLMN specific bearer service  10*/
+       SS_CLASS_PLMN_BEAR_B = 0x81,             /*0x81 : PLMN specific bearer service  11*/
+       SS_CLASS_PLMN_BEAR_C = 0x82,            /*0x82 : PLMN specific bearer service  12*/
+       SS_CLASS_PLMN_BEAR_D = 0x83,            /*0x83 : PLMN specific bearer service  13*/
+       SS_CLASS_PLMN_BEAR_E = 0x84,             /*0x84 : PLMN specific bearer service  14*/
+       SS_CLASS_PLMN_BEAR_F = 0x85,             /*0x85 : PLMN specific bearer service  15*/
+
+       /* CPHS - AUXILIARY SERVICE */
+       SS_CLASS_AUX_VOICE = 0x89,                      /* 0x89 : All Auxiliary Voice ( Auxiliary telephony ) */
+
+       SS_CLASS_ALL_GPRS_BEARER=0x99,       /* 0x99 : All GPRS bearer services */
+       SS_CLASS_ALL_TELE_BEARER=0xFF,        /* 0xFF : all tele and bearer services */
+};
+
+enum telephony_ss_status {
+       SS_STATUS_REG=0x01,         /* 0x01 : Registration */
+       SS_STATUS_DEREG,              /* 0x02 : De-registration( erase ) */
+       SS_STATUS_ACTIVATE,        /* 0x03 : Activation */
+       SS_STATUS_DEACTIVATE,    /* 0x04 : De-activation */
+       SS_STATUS_MAX
+};
+
+enum telephony_ss_barring_mode {
+       SS_BARR_MODE_NONE,
+       SS_BARR_MODE_BAOC,                /* 0x01 : Barring All Outgoing Calls */
+       SS_BARR_MODE_BOIC,                /* 0x02 : Barring Outgoing International Calls */
+       SS_BARR_MODE_BOIC_NOT_HC, /* 0x03 : Barring Outgoing International Calls
+                                                                except to Home Country */
+       SS_BARR_MODE_BAIC,                /* 0x04 : Barring All Incoming Calls */
+       SS_BARR_MODE_BIC_ROAM,       /* 0x05 : Barring Incoming Calls when roam,
+                                                                       outside of the Home Country */
+       SS_BARR_MODE_AB,                   /* 0x06 : All Barring Services */
+       SS_BARR_MODE_AOB,                 /* 0x07 : All Outgoing Barring Services */
+       SS_BARR_MODE_AIB,                  /* 0x08 : All Incoming Barring Services */
+       SS_BARR_MODE_BIC_NOT_SIM, /* 0x09 : Barring Incoming Calls which is
+                                                                not stored in the SIM memory */
+       SS_BARR_MODE_MAX
+};
+
+enum telephony_ss_forwarding_mode {
+       SS_CF_MODE_CFU = 0x01, /* 0x01 : Call Forwarding Unconditional */
+       SS_CF_MODE_CFB,        /* 0x02 : Call Forwarding Mobile Busy */
+       SS_CF_MODE_CFNRy,      /* 0x03 : Call Forwarding No Reply */
+       SS_CF_MODE_CFNRc,      /* 0x04 : Call Forwarding Not Reachable */
+       SS_CF_MODE_CF_ALL,     /* 0x05 : All Call Forwarding */
+       SS_CF_MODE_CFC,        /* 0x06 : All Conditional Call Forwarding */
+       SS_CF_MODE_MAX         /* 0x07 : Max */
+};
+
+enum telephony_ss_forwarding_no_reply_time {
+       SS_CF_NO_REPLY_5_SEC    = 5,
+       SS_CF_NO_REPLY_10_SEC   = 10,
+       SS_CF_NO_REPLY_15_SEC   = 15,
+       SS_CF_NO_REPLY_20_SEC   = 20,
+       SS_CF_NO_REPLY_25_SEC   = 25,
+       SS_CF_NO_REPLY_30_SEC   = 30,
+};
+
+enum telephony_ss_forwarding_type_of_number {
+       SS_CF_TON_UNKNOWN = 0, /**< unknown */
+       SS_CF_TON_INTERNATIONAL = 1, /**< international number */
+       SS_CF_TON_NATIONAL = 2, /**< national number */
+       SS_CF_TON_NETWORK_SPECIFIC = 3, /**< network specific number */
+       SS_CF_TON_DEDICATED_ACCESS = 4, /**< subscriber number */
+       SS_CF_TON_ALPHA_NUMERIC = 5, /**< alphanumeric, GSM 7-bit default alphabet) */
+       SS_CF_TON_ABBREVIATED_NUMBER = 6, /**< abbreviated number */
+       SS_CF_TON_RESERVED_FOR_EXT = 7 /**< reserved for extension */
+};
+
+enum telephony_ss_forwarding_numbering_plan_identity {
+       SS_CF_NPI_UNKNOWN = 0, /**< Unknown */
+       SS_CF_NPI_ISDN_TEL = 1, /**< ISDN/Telephone numbering plan */
+       SS_CF_NPI_DATA_NUMBERING_PLAN = 3, /**< Data numbering plan */
+       SS_CF_NPI_TELEX = 4, /**< Telex numbering plan */
+       SS_CF_NPI_SVC_CNTR_SPECIFIC_PLAN = 5, /**< Service Center Specific plan */
+       SS_CF_NPI_SVC_CNTR_SPECIFIC_PLAN2 = 6, /**< Service Center Specific plan */
+       SS_CF_NPI_NATIONAL = 8, /**< National numbering plan */
+       SS_CF_NPI_PRIVATE = 9, /**< Private numbering plan */
+       SS_CF_NPI_ERMES_NUMBERING_PLAN = 10, /**< ERMES numbering plan */
+       SS_CF_NPI_RESERVED_FOR_EXT = 0xF /**< Reserved for extension */
+};
+
+
+
+enum telephony_ss_cli_type {
+       SS_CLI_TYPE_NONE,
+       SS_CLI_TYPE_CLIP,       /* 0x01 : Calling Line Identification Presentation */
+       SS_CLI_TYPE_CLIR,       /* 0x02 : Calling Line Identification Restriction */
+       SS_CLI_TYPE_COLP,      /* 0x03 : Connected Line Identification Presentation */
+       SS_CLI_TYPE_COLR,      /* 0x04 : Connected Line Identification Restriction */
+       SS_CLI_TYPE_CDIP,       /* 0x05 : Called Line Identification Presentation */
+       SS_CLI_TYPE_CNAP,      /* 0x06 : Calling Name Presentation */
+       SS_CLI_TYPE_MAX
+};
+
+enum telephony_ss_cli_status{
+       SS_CLI_STATUS_NOT_PROVISONED = 0x01, /**<Service not provided by the service provider */
+       SS_CLI_STATUS_PROVISIONED, /**<Service is provided by the service provider */
+       SS_CLI_STATUS_ACTIVATED, /**<Service is activated at the network */
+       SS_CLI_STATUS_UNKOWN, /**<Service status is unknown*/
+       SS_CLI_STATUS_TEMP_RESTRICTED, /**<Service is temporarily restricted */
+       SS_CLI_STATUS_TEMP_ALLOWED /**<Service is temporarily allowed */
+};
+
+enum telephony_ss_ussd_type {
+       SS_USSD_TYPE_USER_INITIATED=0x01,   /* User Initiated USSD Message */
+       SS_USSD_TYPE_USER_RES,                       /* User Response to Network Initiated Message */
+       SS_USSD_TYPE_USER_RELEASE,               /* SS Termination by user */
+       SS_USSD_TYPE_MAX,
+};
+
+enum telephony_ss_ussd_status {
+       SS_USSD_NO_ACTION_REQUIRE = 0x01,  /* 0x01 : no further user action required
+                                                                                         information needed after mobile initiated operation) */
+       SS_USSD_ACTION_REQUIRE,                     /* 0x02 : further user action required
+                                                                                                          (network initiated USSD Request, or further
+                                                                                                          information needed after mobile initiated operation) */
+       SS_USSD_TERMINATED_BY_NET,              /* 0x03 : USSD terminated by network */
+       SS_USSD_OTHER_CLIENT,                         /* 0x04 : other local client has responded */
+       SS_USSD_NOT_SUPPORT,                          /* 0x05 : operation not supported */
+       SS_USSD_TIME_OUT,                                 /* 0x06 : network time out */
+       SS_USSD_MAX
+};
+
+enum telephony_ss_info_type {
+       SS_INFO_TYPE_BARRING = 0x00,
+       SS_INFO_TYPE_FORWARDING,
+       SS_INFO_TYPE_WAITING,
+       SS_INFO_TYPE_CLI,
+       SS_INFO_TYPE_SEND_USSD,
+       SS_INFO_TYPE_MAX
+};
+
+enum telephony_ss_aoc_type {
+       SS_AOC_TYPE_RESET               =0x00,          /* AoC Reset Message */
+       SS_AOC_TYPE_ACM                 =0x01,          /* Accumulated call meter Message */
+       SS_AOC_TYPE_CCM                 =0x02,          /* Current call meter Message */
+       SS_AOC_TYPE_MAXACM      =0x04,          /* Max Accumulated call meter Message */
+       SS_AOC_TYPE_PUC                 =0x08,          /* Price per unit and currency Message */
+       SS_AOC_TYPE_MAX         =0x10
+};
+
+enum telephony_ss_error {
+       SS_ERROR_NONE =0x0, /**<  SS operation was successful */
+
+       SS_ERROR_UNKNOWNSUBSCRIBER =0x01, /**< SS error indicating unknown/illegal subscriber.  */
+       SS_ERROR_ILLEGALSUBSCRIBER= 0x09, /**<This error is returned when illegality of the access has been @n
+        established by use of authentication procedure. */
+       SS_ERROR_BEARERSERVICENOTPROVISIONED = 0x0a, /**<The network returns this error when it is requested to  @n
+        perform an operation on a supplementary service  */
+       SS_ERROR_TELESERVICENOTPROVISIONED= 0x0b, /**<The network returns this error when it is requested to perform  @n
+        an operation on a supplementary service  */
+       SS_ERROR_ILLEGALEQUIPMENT= 0x0c, /**<This error is returned when the IMEI check procedure has shown that  @n
+        the IMEI is blacklisted or not whitelisted  */
+       SS_ERROR_CALLBARRED= 0x0d, /**< This error is returned by the network to the MS when call independent subscriber control procedures are barred by the operator */
+
+       SS_ERROR_ILLEGALSSOPERATION= 0x10, /**<This error is returned by the network when it is requested to perform an illegal operation @n
+        which is defined as not applicable for the relevant supplementary service */
+       SS_ERROR_ERRORSTATUS= 0x11, /**<This error is returned by the network when it is requested to perform an operation @n
+        which is not compatible with the current status of the relevant supplementary service. */
+       SS_ERROR_NOTAVAILABLE= 0x12, /**< SS not available in network */
+       SS_ERROR_SUBSCRIPTIONVIOLATION= 0x13, /**< SS service subscription violation. */
+       SS_ERROR_INCOMPATIBILITY= 0x14, /**< This error is returned by the network when it is requested for a supplementary service operation incompatible with the @n
+        status of another supplementary service or with the teleservice or bearer service for which the operation is requested */
+       SS_ERROR_FACILITYNOTSUPPORTED= 0x15, /**< SS service facility not supported  */
+       SS_ERROR_ABSENTSUBSCRIBER= 0x1b, /**< This error is returned when the subscriber has activated the detach service or the system detects the absence condition */
+
+       SS_ERROR_SYSTEMFAILURE= 0x22, /**< This error is returned by the network, when it cannot perform an operation because of a failure in the network */
+       SS_ERROR_DATAMISSING= 0x23, /**< This error is returned by the network when an optional parameter is missing in an invoke component @n
+        or an inner data structure, while it is required by the context of the request. */
+       SS_ERROR_UNEXPECTEDDATAVALUE= 0x24, /**< SS error indicating unexpected data value on network side *//**< SS operation barred.  */
+       SS_ERROR_PWREGISTRATIONFAILURE= 0x25, /**< SS error indicating change password failure. */
+       SS_ERROR_NEGATIVEPWCHECK= 0x26, /**< SS error indicating negative password check.  */
+       SS_ERROR_NUMBEROFPWATTEMPTSVIOLATION= 0x2b, /**< SS error indicating barring password attempts violated.  */
+
+       SS_ERROR_UNKNOWNALPHABET= 0x47, /**< SS error indicating unknown SS data coding of alphabet */
+       SS_ERROR_USSDBUSY= 0x48, /**< SS error indicating USSD Busy(Already SS / USSD is ongoing).  */
+
+       SS_ERROR_FIXED_DIALING_NUMBER_ONLY = 0x5F, /**< SS error indicating Dialing number is not FDN */
+
+       SS_ERROR_REJECTEDBYUSER= 0x79, /**< SS operation rejected by user.  */
+       SS_ERROR_REJECTEDBYNETWORK= 0x7a, /**< SS operation rejected by network.  */
+       SS_ERROR_DEFLECTIONTOSERVEDSUBSCRIBER= 0x7b, /**< This error is returned if a diversion to the served  @n
+        subscriber's number was requested.  */
+       SS_ERROR_SPECIALSERVICECODE= 0x7c, /**< This error is returned if diversion to a special service code was requested.  */
+       SS_ERROR_INVALIDDEFLECTEDTONUMBER= 0x7d, /**< SS error indicating the invalid deflected to number.  */
+       SS_ERROR_MAXNOMPTYEXCEEDED= 0x7e, /**< SS error indicating Maximum MPTY is reached.  */
+       SS_ERROR_RESOURCESNOTAVAILABLE= 0x7f, /**< SS error indicating resources not available in network.  */
+       SS_ERROR_REJECTEDBYCALLCONTROL= 0x80, /**< SS operation rejected by call control.  */
+
+       SS_ERROR_TIMEREXPIRE, /**< SS operation timer expired on network. */
+
+       SS_ERROR_NET_NOT_ALLOWED_EMERGENCY_CALLS_ONLY, /**< SS operation is not allowed by network.  */
+       SS_ERROR_OEM_NOT_SUPPORTED, /**< If oem do not support any of SS requests, then this error will be returned back */
+       SS_ERROR_UNKNOWNERROR /**< SS error indicating unknown error  */
+};
+
+
+#define MAX_SS_BARRING_PASSWORD_LEN 4
+struct treq_ss_barring {
+       enum telephony_ss_class class;
+       enum telephony_ss_barring_mode mode;
+       char password[ MAX_SS_BARRING_PASSWORD_LEN ];
+};
+
+struct treq_ss_barring_change_password {
+       char password_old[ MAX_SS_BARRING_PASSWORD_LEN ];
+       char password_new[ MAX_SS_BARRING_PASSWORD_LEN ];
+       char password_confirm[ MAX_SS_BARRING_PASSWORD_LEN ];
+};
+
+#define MAX_SS_FORWARDING_NUMBER_LEN 32
+struct treq_ss_forwarding {
+       enum telephony_ss_class class;
+       enum telephony_ss_forwarding_mode mode;
+       enum telephony_ss_forwarding_no_reply_time time;
+       enum telephony_ss_forwarding_type_of_number ton;
+       enum telephony_ss_forwarding_numbering_plan_identity npi;
+       char number[ MAX_SS_FORWARDING_NUMBER_LEN ];
+};
+
+struct treq_ss_waiting {
+       enum telephony_ss_class class;
+
+};
+
+struct treq_ss_cli {
+       enum telephony_ss_cli_type type;
+};
+
+struct treq_ss_set_cli {
+       enum telephony_ss_cli_type type;
+       enum telephony_ss_cli_status status;
+};
+
+#define MAX_SS_USSD_LEN 208
+struct treq_ss_ussd {
+       enum telephony_ss_ussd_type type;
+       unsigned char dcs;
+       unsigned short len;
+       unsigned char str[ MAX_SS_USSD_LEN ];
+};
+
+// response
+
+struct tresp_ss_general {
+       enum telephony_ss_error err;
+};
+
+struct tresp_ss_barring {
+       int record_num;
+       struct barring_info {
+               enum telephony_ss_class class;
+               enum telephony_ss_status status;
+               enum telephony_ss_barring_mode mode;
+       } *record;
+       enum telephony_ss_error err;
+};
+
+struct tresp_ss_forwarding {
+       int record_num;
+       struct forwarding_info {
+               enum telephony_ss_class class;
+               enum telephony_ss_status status;
+               enum telephony_ss_forwarding_mode mode;
+               enum telephony_ss_forwarding_no_reply_time time;
+               enum telephony_ss_forwarding_type_of_number ton;
+               enum telephony_ss_forwarding_numbering_plan_identity npi;
+               gboolean number_present;
+               char     number[ MAX_SS_FORWARDING_NUMBER_LEN ];
+       } *record;
+       enum telephony_ss_error err;
+};
+
+struct tresp_ss_waiting {
+       int record_num;
+       struct waiting_info {
+               enum telephony_ss_class class;
+               enum telephony_ss_status status;
+       } *record;
+       enum telephony_ss_error err;
+};
+
+struct tresp_ss_set_cli {
+       enum telephony_ss_error err;
+};
+
+struct tresp_ss_cli {
+       enum telephony_ss_cli_type type;
+       enum telephony_ss_cli_status status;
+       enum telephony_ss_error err;
+};
+
+struct tresp_ss_ussd {
+       enum telephony_ss_ussd_type type;
+       enum telephony_ss_ussd_status status;
+       unsigned char dcs;
+       unsigned short len;
+       unsigned char str[ MAX_SS_USSD_LEN ];
+       enum telephony_ss_error err;
+};
+
+// notification
+
+struct tnoti_ss_ussd {
+       enum telephony_ss_ussd_status status;
+       unsigned char dcs;
+       unsigned short len;
+       unsigned char str[ MAX_SS_USSD_LEN ];
+};
+
+struct tnoti_ss_barring_status {
+       int record_num;
+       struct barring_info *record;
+};
+
+struct tnoti_ss_forwarding_status {
+       int record_num;
+       struct forwarding_info *record;
+};
+
+struct tnoti_ss_waiting_status {
+       int record_num;
+       struct waiting_info *record;
+};
+
+#define MAX_SS_RELEASE_COMPLETE_DATA_SIZE 260
+struct tnoti_ss_release_complete {
+       int data_len;
+       unsigned char data[ MAX_SS_RELEASE_COMPLETE_DATA_SIZE ];
+};
+
+struct tnoti_ss_information {
+       enum telephony_ss_error err;
+       enum telephony_ss_info_type ss_type;
+#if 0 /* To be expanded later with ss information */
+       void *data;                                                       /* ( struct barring_info *,   struct forwarding_info *, struct waiting_info * ...etc...) */
+#endif
+};
+
+
+__END_DECLS
+
+#endif
diff --git a/include/udev.h b/include/udev.h
deleted file mode 100644 (file)
index b271623..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * libtcore
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __UDEV_H__
-#define __UDEV_H__
-
-#include <gudev/gudev.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef gboolean (*TcoreUdevEnumerCallback)(TcoreUdev *udev, GList *list, void *user_data);
-typedef gboolean (*TcoreUdevCallback)(TcoreUdev *udev, GUdevDevice *device, void *user_data);
-
-TcoreUdev*       tcore_udev_new(Server *s, const gchar **subsystems);
-void             tcore_udev_free(TcoreUdev *udev);
-
-Server*          tcore_udev_ref_server(TcoreUdev *udev);
-GUdevClient*     tcore_udev_ref_client(TcoreUdev *udev);
-GUdevEnumerator* tcore_udev_ref_enumerator(TcoreUdev *udev);
-
-TelReturn          tcore_udev_add_enumerator_callback(TcoreUdev *udev, TcoreUdevEnumerCallback func, void *user_data);
-GList*           tcore_udev_exec_enumerator(TcoreUdev *udev, gboolean event_emit_flag);
-
-TelReturn          tcore_udev_add_callback(TcoreUdev *udev, const char *subsystem, const char *action, TcoreUdevCallback func, void *user_data);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __UDEV_H__ */
diff --git a/include/user_request.h b/include/user_request.h
new file mode 100644 (file)
index 0000000..8d5e75b
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __TCORE_USER_REQUEST_H__
+#define __TCORE_USER_REQUEST_H__
+
+__BEGIN_DECLS
+
+typedef void (*UserRequestFreeHook)(UserRequest *ur);
+typedef void (*UserRequestResponseHook)(UserRequest *ur,
+               enum tcore_response_command command,
+               unsigned int data_len, const void *data, void *user_data);
+
+UserRequest*  tcore_user_request_new(Communicator *comm, const char *modem_name);
+void          tcore_user_request_free(UserRequest *ur);
+
+UserRequest*  tcore_user_request_ref(UserRequest *ur);
+void          tcore_user_request_unref(UserRequest *ur);
+
+TReturn       tcore_user_request_set_free_hook(UserRequest *ur,
+                  UserRequestFreeHook free_hook);
+TReturn       tcore_user_request_set_response_hook(UserRequest *ur,
+                  UserRequestResponseHook resp_hook, void *user_data);
+
+Communicator* tcore_user_request_ref_communicator(UserRequest *ur);
+char*         tcore_user_request_get_modem_name(UserRequest *ur);
+
+TReturn tcore_user_request_set_user_info(UserRequest *ur, void *user_info);
+void *tcore_user_request_ref_user_info(UserRequest *ur);
+
+TReturn       tcore_user_request_send_response(UserRequest *ur,
+                  enum tcore_response_command command,
+                  unsigned int data_len, const void *data);
+
+TReturn       tcore_user_request_set_command(UserRequest *ur,
+                  enum tcore_request_command command);
+
+enum tcore_request_command
+              tcore_user_request_get_command(UserRequest *ur);
+
+TReturn       tcore_user_request_set_data(UserRequest *ur,
+                  unsigned int data_len, const void *data);
+const void*   tcore_user_request_ref_data(UserRequest *ur,
+                  unsigned int *data_len);
+
+TReturn       tcore_user_request_set_metainfo(UserRequest *ur,
+                  unsigned int metainfo_len, const void *metainfo);
+const void*   tcore_user_request_ref_metainfo(UserRequest *ur,
+                  unsigned int *metainfo_len);
+
+__END_DECLS
+
+#endif
index 510b49a..0c298da 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef __UTIL_H__
-#define __UTIL_H__
+#ifndef __TCORE_UTIL_H__
+#define __TCORE_UTIL_H__
 
 #include <glib-object.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Allocates 'n_bytes' bytes of memory and initialized to 0's to allocated memory.
- * If 'n_bytes' is 0 it returns NULL(in this case caller has to perfom sanity check for NULL),
- * else it aborts the program if unable to allocate requested memory.
- */
-#define tcore_malloc0(n_bytes) g_malloc0(n_bytes)
-/*
- * same as tcore_malloc0 but it does not initialized to 0's to allocated memory
- */
-#define tcore_malloc(n_bytes) g_malloc(n_bytes)
-/*
- * Attempts to allocate n_bytes and initialized to 0's to allocated memory.
- * It returns NULL if unable to allocate memory,unlike 'tcore_malloc0' which aborts on failure.
- */
-#define tcore_try_malloc0(n_bytes) g_try_malloc0(n_bytes)
-
-#define tcore_try_malloc(n_bytes) g_try_malloc(n_bytes)
-
-#define tcore_memdup(mem, byte_size) g_memdup(mem, byte_size)
-#define tcore_free(p) g_free(p)
-#define tcore_strdup(str) g_strdup(str)
-
-/* If Condition fails it assert if G_DISABLE_ASSERT is enabled, else it will return 'ret_val' */
-#define tcore_check_return_value_assert(cond, ret_val) \
-       do { \
-               if(!(cond)) { \
-                       err("*** Condition (%s) Fails ***", #cond); \
-                       g_assert(cond); \
-                       return ret_val; \
-               } \
-       } while (0)
-
-/* Same as 'tcore_assert_with_return_value' except return value 'ret_val' */
-#define tcore_check_return_assert(cond) \
-       do { \
-               if(!(cond)) { \
-                       err("*** Condition (%s) Fails ***", #cond); \
-                       g_assert(cond); \
-                       return ; \
-               } \
-       } while (0)
-
-/* If condition fails it retuns 'ret_val' without asserting program  */
-#define tcore_check_return_value(cond, ret_val) \
-       do { \
-               if(!(cond)) { \
-                       err("*** Condition (%s) Fails ***", #cond); \
-                       return ret_val; \
-               } \
-       } while (0)
-
-#define tcore_check_return(cond) \
-       do { \
-               if(!(cond)) { \
-                       err("*** Condition (%s) Fails ***", #cond); \
-                       return ; \
-               } \
-       } while (0)
-
-#define bitsize(type) (sizeof(type) * 8)
-
-#define copymask(type) ((0xffffffff) >> (32 - bitsize(type)))
-
-#define MASK(width, offset, data) \
-       (((width) == bitsize(data)) ? (data) :   \
-        ((((copymask(data) << (bitsize(data) - ((width) % bitsize(data)))) & copymask(data)) >> (offset)) & (data))) \
-
-
-#define MASK_AND_SHIFT(width, offset, shift, data)     \
-       ((((signed) (shift)) < 0) ?               \
-        MASK((width), (offset), (data)) << -(shift) :  \
-        MASK((width), (offset), (data)) >> (((signed) (shift)))) \
-
-#define TEL_UTIL_ENCODED_SCA_LEN_MAX   12
-
-typedef enum {
-       TEL_UTIL_ALPHABET_FORMAT_SMS_DEFAULT = 0x00, /**< Alphabet type -SMS default format */
-       TEL_UTIL_ALPHABET_FORMAT_8BIT_DATA = 0x01, /**< Alphabet type -8 bit format data */
-       TEL_UTIL_ALPHABET_FORMAT_UCS2 = 0x02, /**< Alphabet type -UCS2 format */
-       TEL_UTIL_ALPHABET_FORMAT_RESERVED = 0x03 /**< Alphabet type -format reserved */
-} TelUtilAlphabetFormat;
-
-typedef union {
-       guint i;
-       guchar s[4];
-} TcoreIp4Type;
-
-/*
- * Conversion APIs
- */
-
-/* BCD --> */
-gchar *tcore_util_convert_bcd_to_ascii(const gchar *bcd_str, guint bcd_str_len,
-       guint max_len);
-void tcore_util_convert_digit_to_bcd(char* bcd_code, char* digits, guint digit_len);
-guint tcore_util_convert_bcd_to_digit(char* digit, char* bcd_code, guint bcd_len);
-
-/* String --> */
-gboolean tcore_util_convert_str_to_utf8(guchar *dest, gushort *dest_len,
-       TelUtilAlphabetFormat dcs, const guchar *src, gushort src_len);
-
-/* UTF8 --> */
-gboolean tcore_util_convert_utf8_to_gsm(guchar *dest, guint *dest_len,
-       guchar* src, guint src_len);
-gboolean        tcore_util_convert_utf8_to_ucs2(guchar *dest, guint *dest_len,
-       guchar *src, guint src_len);
-
-/* Packing/Unpacking */
-guchar *tcore_util_pack_gsm7bit(const guchar *src, guint src_len);
-guchar *tcore_util_unpack_gsm7bit(const guchar *src, guint src_len);
-
-/*
- * Utility APIs
- */
-gchar *tcore_util_get_version(void);
-void tcore_util_hex_dump(gchar *pad, int size, const void *data);
-
-void tcore_util_swap_byte_order(gushort *dest,
-       const gushort* src, guint src_len);
-
-long tcore_util_encode_hex(const guchar *src,
-       long num_bytes, gchar *buf);
-
-guint tcore_util_encode_pdu(const TelSmsSca *sca,
-       const guchar *tpdu, guint tpdu_len, gchar *pdu);
-guint tcore_util_encode_sca(const TelSmsSca *sca,
-       gchar encoded_sca[TEL_UTIL_ENCODED_SCA_LEN_MAX]);
-
-gchar tcore_util_hexchar_to_int(gchar c);
-gboolean tcore_util_hexstring_to_bytes(gchar *hex_str, gchar **bytes, guint *bytes_len);
-guint tcore_util_get_string(unsigned char* alpha_id, unsigned char* record, guint alpha_id_max_len);
-void tcore_util_set_string(unsigned char* record, unsigned char* alpha_id, guint alpha_id_max_len);
-gboolean tcore_util_is_empty(unsigned char* in, guint in_length);
-guint tcore_util_get_valid_bcd_byte(unsigned char* bcd_data, guint bcd_max_len);
-
-gchar *tcore_util_get_string_by_ip4type(TcoreIp4Type ip);
-gboolean tcore_util_decode_sms_parameters(unsigned char *incoming,
-       unsigned int length, TelSmsParamsInfo *get_params);
-
-TelUtilAlphabetFormat tcore_util_get_cbs_coding_scheme(guchar encode);
-
-TelReturn tcore_util_netif(const char *name, gboolean enabled);
-
-TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
-               const char *gateway, const char *netmask);
+__BEGIN_DECLS
 
-gboolean tcore_util_byte_to_hex(const char *byte_pdu, char *hex_pdu, int num_bytes);
-char tcore_util_convert_byte_hexchar(char val);
-char tcore_util_unpackb(const char *src, int pos, int len);
+#define CONVERT_HEXCHAR_TO_INT(h, i) if ((h) >= '0' && (h) <= '9') (i) = (h) - '0'; \
+       else if ((h) >= 'A' && (h) <= 'F') (i) = (h) - 'A' + 10; \
+       else if ((h) >= 'a' && (h) <= 'f') (i) = (h) - 'a' + 10; \
+       else (i) = 0;
 
-gboolean tcore_util_encode_sms_parameters(TelSmsParamsInfo *set_params,
-       gchar *set_params_data, guint length);
-
-#if 0  /* To be UNBLOCKED on requirement basis */
-typedef enum {
+enum tcore_util_marshal_data_type {
        TCORE_UTIL_MARSHAL_DATA_CHAR_TYPE = G_TYPE_CHAR,
        TCORE_UTIL_MARSHAL_DATA_BOOLEAN_TYPE = G_TYPE_BOOLEAN,
        TCORE_UTIL_MARSHAL_DATA_INT_TYPE = G_TYPE_INT,
@@ -188,42 +38,70 @@ typedef enum {
        TCORE_UTIL_MARSHAL_DATA_STRING_TYPE = G_TYPE_STRING,
        TCORE_UTIL_MARSHAL_DATA_OBJECT_TYPE = G_TYPE_BOXED,
        TCORE_UTIL_MARSHAL_DATA_STRING_MAX = 0xFF,
-} TcoreUtilMarshalData;
+};
+
+
+union tcore_ip4_type {
+       uint32_t i;
+       unsigned char s[4];
+};
 
-typedef enum {
+enum tcore_dcs_type {
        TCORE_DCS_TYPE_NONE = 0xff,
        TCORE_DCS_TYPE_7_BIT = 0x00,
        TCORE_DCS_TYPE_8_BIT = 0x04,
        TCORE_DCS_TYPE_UCS2 = 0x08,
        TCORE_DCS_TYPE_UNSPECIFIED = 0x0F,
-} TcoreUtilDcs;
+};
 
-TelReturn tcore_util_netif(const char *name, gboolean enabled);
-TelReturn tcore_util_netif_set(const char *name,
-       const char *ipaddr, const char *gateway, const char *netmask);
+TReturn     tcore_util_netif_up(const char *name);
+TReturn     tcore_util_netif_down(const char *name);
+TReturn     tcore_util_netif_set(const char *name, const char *ipaddr,
+                const char *gateway, const char *netmask);
+TReturn     tcore_util_reset_ipv4_socket(const char *name, const char *ipaddr);
+TReturn tcore_util_netif_set_mtu(const char *name, unsigned int mtu);
 
-GHashTable *tcore_util_marshal_create();
-void tcore_util_marshal_destory(GHashTable *ht);
+char*       tcore_util_get_string_by_ip4type(union tcore_ip4_type ip);
+char*       tcore_util_get_string_by_ip6type(unsigned char ipv6_addr_type[IPV6_ADDR_LEN]);
 
-GHashTable *tcore_util_marshal_deserialize_string(const gchar *serialized_string);
-gchar *tcore_util_marshal_serialize(GHashTable *ht);
+GHashTable* tcore_util_marshal_create();
+void        tcore_util_marshal_destory(GHashTable *ht);
 
-gboolean tcore_util_marshal_add_data(GHashTable *ht, const gchar *key,
-       const void *data, TcoreUtilMarshalData type);
-gboolean tcore_util_marshal_get_data(GHashTable *ht, const gchar *key,
-       void **data, TcoreUtilMarshalData type);
+GHashTable* tcore_util_marshal_deserialize_string(const gchar *serialized_string);
+gchar*      tcore_util_marshal_serialize(GHashTable *ht);
 
-gint tcore_util_marshal_get_int(GHashTable *ht, const gchar *key);
-gchar *tcore_util_marshal_get_string(GHashTable *ht, const gchar *key);
-GHashTable *tcore_util_marshal_get_object(GHashTable *ht, const gchar *key);
+gboolean    tcore_util_marshal_add_data(GHashTable *ht, const gchar *key,
+                const void *data, enum tcore_util_marshal_data_type type);
+gboolean    tcore_util_marshal_get_data(GHashTable *ht, const gchar *key,
+                void **data, enum tcore_util_marshal_data_type type);
 
-TcoreUtilDcs tcore_util_get_cbs_coding_scheme(guchar encode);
+gint        tcore_util_marshal_get_int(GHashTable *ht, const gchar *key);
+gchar*      tcore_util_marshal_get_string(GHashTable *ht, const gchar *key);
+GHashTable* tcore_util_marshal_get_object(GHashTable *ht, const gchar *key);
 
-guchar *tcore_util_decode_hex(const char *src, int len);
-#endif /* #if 0 */
+enum tcore_dcs_type
+            tcore_util_get_cbs_coding_scheme(unsigned char encode);
 
-#ifdef __cplusplus
-}
-#endif
+unsigned char*      tcore_util_decode_hex(const char *src, int len);
+void                tcore_util_hex_dump(const char *pad, int size, const void *data);
+
+unsigned char*         tcore_util_unpack_gsm7bit(const unsigned char *src, unsigned int src_len);
+unsigned char*         tcore_util_pack_gsm7bit(const unsigned char *src, unsigned int src_len);
+char*                          tcore_util_convert_bcd_str_2_ascii_str(const char* src, int src_len);
+char*                          tcore_util_convert_bcd2ascii(const char *src, int src_len, int max_len);
+char*                          tcore_util_convert_digit2ascii(const char* src, int src_len);
+gboolean                       tcore_util_convert_utf8_to_gsm(unsigned char *dest, int *dest_len, unsigned char* src, int src_len);
+gboolean                       tcore_util_convert_utf8_to_ucs2(char **dest, int *dest_len, unsigned char *src, int src_len);
+gboolean                       tcore_util_convert_string_to_utf8(unsigned char *dest, unsigned short *dest_len,
+                                               enum alphabet_format dcs, const unsigned char *src, unsigned short src_len);
+gboolean                       tcore_util_convert_ascii_to_utf8(unsigned char **dest, int *dest_len, unsigned char *src, int src_len);
+int                                    tcore_util_convert_ucs2_to_utf8(char *out, unsigned short *out_len, char *in, unsigned short in_len);
 
-#endif /* __UTIL_H__ */
+void                           tcore_util_swap_byte_order(unsigned char* dest, const unsigned char* src, int src_len);
+
+char*          tcore_util_get_version(void);
+void           tcore_util_set_log(gboolean enable);
+
+__END_DECLS
+
+#endif
similarity index 66%
rename from packaging/libtcore.manifest
rename to libtcore.manifest
index 017d22d..dfdc35c 100644 (file)
@@ -1,5 +1,5 @@
 <manifest>
  <request>
-    <domain name="_"/>
+  <domain name="_"/>
  </request>
 </manifest>
old mode 100644 (file)
new mode 100755 (executable)
index 2fbd290..1208073
@@ -1,80 +1,61 @@
-%define major 3
-%define minor 0
-%define patchlevel 1
-%define dbus_gen_code_path %{_includedir}/tel-headers/introspection
-
-Name: libtcore
-Summary: Telephony-core library
-Version:    %{major}.%{minor}.%{patchlevel}
-Release:    1
-Group:      System/Libraries
-License:    Apache-2.0
-Source0:    libtcore-%{version}.tar.gz
-Source1001:    libtcore.manifest
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
+%define major 0
+%define minor 2
+%define patchlevel 63
+
+Name:           libtcore
+Version:        %{major}.%{minor}.%{patchlevel}
+Release:        1
+License:        Apache
+Summary:        Telephony-core library
+Group:          System/Libraries
+Source0:        libtcore-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(gudev-1.0)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
 
 %description
 Telephony-core library
 
 %package devel
 Summary:        Telephony-core library (Development)
-Requires:       %{name} = %{version}
 Group:          Development/Libraries
+Requires:       %{name} = %{version}
 
 %description devel
 Telephony-core library (Development)
 
-%package -n tel-headers
-Summary:        Telephony-common header files
-Group:          System/Libraries
-BuildRequires:  python
-BuildRequires:  python-xml
-BuildRequires:  pkgconfig(glib-2.0)
-BuildRequires:  pkgconfig(gudev-1.0)
-BuildRequires:  pkgconfig(gio-2.0)
-BuildRequires:  pkgconfig(gio-unix-2.0)
-BuildRequires:  pkgconfig(gobject-2.0)
-
-%description -n tel-headers
-Telephony-common header files
-
 %prep
 %setup -q
-cp %{SOURCE1001} .
 
 %build
-%cmake . -DDBUS_GEN_CODE_PATH=%{dbus_gen_code_path} -DVERSION=%{version}
-make %{?jobs:-j%jobs}
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DVERSION=%{version} \
+%ifarch %{arm}
+%else
+       -DARCH_EMUL=1 \
+%endif
+
+make %{?_smp_mflags}
 
-%post
-/sbin/ldconfig
+%post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
 
 %install
 %make_install
-mkdir -p %{buildroot}/usr/share/license
-cp LICENSE %{buildroot}/usr/share/license/%{name}
+mkdir -p %{buildroot}%{_datadir}/license
 
 %files
-%manifest %{name}.manifest
+%manifest libtcore.manifest
 %defattr(-,root,root,-)
+#%doc COPYING
 %{_libdir}/libtcore*
-/usr/share/license/%{name}
+#%{_bindir}/*
+%{_datadir}/license/libtcore
 
 %files devel
-%manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{_includedir}/*
 %{_libdir}/pkgconfig/tcore.pc
 
-%files -n tel-headers
-%defattr(-,root,root,-)
-%{_includedir}/tel-headers
-%{dbus_gen_code_path}/tel_generated_code.h
-%{_libdir}/pkgconfig/tel-headers.pc
-%{_libdir}/libtel-headers*
index 92216a3..f91d5c5 100644 (file)
--- a/src/at.c
+++ b/src/at.c
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
 #include "tcore.h"
 #include "hal.h"
 #include "queue.h"
+#include "user_request.h"
 #include "at.h"
 #include "core_object.h"
 
 #define CR '\r'
 #define LF '\n'
 
-#define MAX_AT_RESPONSE    255
+#define MAX_AT_RESPONSE    255  // for testing
+//#define MAX_AT_RESPONSE    8191
 
 typedef gboolean (*rfs_hook_cb) (const gchar *data);
 
 struct tcore_at_type {
        TcoreHal *hal;
 
-       TcoreAtCommandType cmd_type;
+       enum tcore_at_command_type cmd_type;
 
        GHashTable *unsolicited_table;
 
-       TcoreAtRequest *req;
-       TcoreAtResponse *resp;
+       struct tcore_at_request *req;
+       struct tcore_at_response *resp;
 
-       guint buf_size;
-       gchar *buf;
-       gchar *buf_read_pos;
-       gchar *buf_write_pos;
+       unsigned int buf_size;
+       char *buf;
+       char *buf_read_pos;
+       char *buf_write_pos;
 
        gboolean pdu_status;
        struct _notification *pdu_noti;
@@ -65,7 +68,7 @@ struct tcore_at_type {
 };
 
 struct _notification_callback {
-       TcoreAtNotificationCallback callback;
+       TcoreATNotificationCallback callback;
        void *user_data;
 };
 
@@ -74,75 +77,64 @@ struct _notification {
        GSList *callbacks;
 };
 
-typedef enum {
-       TCORE_AT_TOKEN_TYPE_NONE = 0,
-       TCORE_AT_TOKEN_TYPE_RAW,
-       TCORE_AT_TOKEN_TYPE_STR,
-       TCORE_AT_TOKEN_TYPE_STR_FIN,
-       TCORE_AT_TOKEN_TYPE_PAREN,
-       TCORE_AT_TOKEN_TYPE_PAREN_FIN
-} TcoreAtTokenType;
-
-typedef enum {
-       TCORE_AT_RECV_MSG_TYPE_NOTI,
-       TCORE_AT_RECV_MSG_TYPE_RESP_SUCCESS,
-       TCORE_AT_RECV_MSG_TYPE_RESP_FAILURE
-} TcoreAtRcvMsgType;
-
 /**
- * Returns TCORE_AT_RECV_MSG_TYPE_RESP_SUCCESS
- * if line is a final response indicating success
- *
+ * returns 1 if line is a final response indicating success
  * See 27.007 annex B
  */
-static const gchar *at_final_responses_success[] = {
-       "OK",
+static const char *list_final_responses_success[] = {
+    "OK",
        "CONNECT",
-       "ABORTED"
 };
 
 /**
- * Returns TCORE_AT_RECV_MSG_TYPE_RESP_FAILURE
- * if line is a final response indicating error
- *
+ * returns 1 if line is a final response indicating error
  * See 27.007 annex B
  */
-static const gchar *at_final_responses_error[] = {
-       "+CMS ERROR:",
-       "+CME ERROR:",
-       "ERROR",
-       "NO ANSWER",
-       "NO CARRIER",
-       "BUSY",
-       "NO DIALTONE"
+static const char *list_final_responses_error[] = {
+    "ERROR",
+    "+CMS ERROR:",
+    "+CME ERROR:",
+    "NO ANSWER",
+    "NO DIALTONE",
+    "NO CARRIER",
 };
 
-static TcoreAtRcvMsgType __check_final_response(const gchar *line)
+static int _check_final_response(const char *line)
 {
-       guint i;
+       unsigned int i;
 
-       for (i = 0; i < NUM_ELEMS(at_final_responses_success); i++)
-               if (g_str_has_prefix(line, at_final_responses_success[i]))
-                       return TCORE_AT_RECV_MSG_TYPE_RESP_SUCCESS;
+       for (i = 0; i < NUM_ELEMS(list_final_responses_success); i++) {
+               if (g_str_has_prefix(line, list_final_responses_success[i])) {
+                       return 1;
+               }
+       }
 
-       for (i = 0; i < NUM_ELEMS(at_final_responses_error); i++)
-               if (g_str_has_prefix(line, at_final_responses_error[i]))
-                       return TCORE_AT_RECV_MSG_TYPE_RESP_FAILURE;
+       for (i = 0; i < NUM_ELEMS(list_final_responses_error); i++) {
+               if (g_str_has_prefix(line, list_final_responses_error[i])) {
+                       return 2;
+               }
+       }
 
-       return TCORE_AT_RECV_MSG_TYPE_NOTI;
+       return 0;
 }
 
 
-static gchar *_find_next_EOL(gchar *cur)
+static char *_find_next_EOL(char *cur)
 {
-       if (cur[0] == '>' && cur[1] == ' ' && cur[2] == '\0')
-               return cur + 2; /* SMS prompt character...not \r terminated */
+       if ((cur[0] == '>' && cur[1] == ' ')
+                       && (cur[2] == '\0' || cur[2] == CR)) {
+               /* SMS prompt character...not \r terminated */
+               dbg("SMS prompt character: [%c]", cur[0]);
+               return cur + 2;
+       }
 
        /*
         * Find next newline
         *
-        * Avoid issue when AT response is having <CR> in between,
-        * before end of line ( <CR> <LF>) or '/0'
+        * Line should either end with -
+        *  - '\0' termination
+        * or
+        *  - Carriage Return '\r' and Line Feed  '\n'.
         */
        while (*cur != '\0' && !((*cur == CR) && (*(cur + 1) == LF)))
                cur++;
@@ -150,102 +142,68 @@ static gchar *_find_next_EOL(gchar *cur)
        return *cur == '\0' ? NULL : cur;
 }
 
-static TcoreAtResponse *__at_response_new()
+static struct tcore_at_response* _response_new()
 {
-       TcoreAtResponse *at_resp;
+       struct tcore_at_response *resp;
 
-       at_resp = tcore_try_malloc0(sizeof(TcoreAtResponse));
-       if (at_resp == NULL) {
-               err("Failed to allocate memory");
+       resp = calloc(1, sizeof(struct tcore_at_response));
+       if (!resp)
                return NULL;
-       }
 
-       return at_resp;
+       return resp;
 }
 
-static void __at_response_free(TcoreAtResponse *at_resp)
+static void _response_free(struct tcore_at_response *resp)
 {
-       if (at_resp == NULL) {
-               err("Response is NULL");
+       if (!resp)
                return;
-       }
-
-       g_slist_free_full(at_resp->lines, g_free);
-       tcore_free(at_resp->final_response);
-       tcore_free(at_resp);
-}
 
-static gboolean __at_is_abort(TcoreAtResponse *at_resp)
-{
-       gboolean aborted = FALSE;
-       if (at_resp == NULL) {
-               err("at_resp is NULL");
-               return FALSE;
+       if (resp->lines) {
+               g_slist_free_full(resp->lines, g_free);
        }
 
-       /* Request is ABORTED */
-       if (g_strcmp0(at_resp->final_response, "ABORTED") == 0)
-               aborted = TRUE;
-       dbg("Aborted: [%s]", (aborted ? "YES" : "NO"));
+       if (resp->final_response)
+               free(resp->final_response);
 
-       return aborted;
+       free(resp);
 }
 
-static void __at_response_add(TcoreAtResponse *at_resp, const gchar *line)
+
+static void _response_add(struct tcore_at_response *resp,
+               const char *line)
 {
-       if ((at_resp == NULL) || (line == NULL)) {
-               err("at_resp: [%p] line: [%p]", at_resp, line);
+       if (!resp || !line)
                return;
-       }
 
-       dbg("Current number of lines: [%d]", g_slist_length(at_resp->lines));
+       dbg("current lines = %d", g_slist_length(resp->lines));
 
-       at_resp->lines = g_slist_append(at_resp->lines, tcore_strdup(line));
+       resp->lines = g_slist_append(resp->lines, strdup(line));
 }
 
-static void __at_emit_pending_response(TcoreAT *at, gboolean abort)
+static void _emit_pending_response(TcoreAT *at)
 {
        TcorePending *p;
-       TcoreQueue *at_queue;
 
-       if (at == NULL) {
-               err("at is NULL");
+       if (!at)
                return;
+
+       p = tcore_queue_pop(tcore_hal_ref_queue(at->hal));
+       if (!p) {
+               dbg("no pending");
        }
 
+       tcore_pending_emit_response_callback(p, sizeof(TcoreATResponse), at->resp);
+       tcore_user_request_unref(tcore_pending_ref_user_request(p));
+
        tcore_at_request_free(at->req);
        at->req = NULL;
-
-       at_queue = tcore_hal_ref_queue(at->hal);
-
-       /*
-        * If 'abort' is TRUE,
-        * then Pop the first Abortable Request from Queue
-        */
-       if (abort) {
-               p = tcore_queue_pop_abortable_pending(at_queue);
-               if (p == NULL) {
-                       warn("No Abortable requests!!!");
-                       goto out;
-               }
-       }
-       else {
-               p = tcore_queue_pop(at_queue);
-               if (p == NULL) {
-                       warn("NO pending request!!!");
-                       goto out;
-               }
-       }
-
-       tcore_pending_emit_response_callback(p, sizeof(TcoreAtResponse), at->resp);
        tcore_pending_free(p);
 
-out:
-       __at_response_free(at->resp);
+       _response_free(at->resp);
        at->resp = NULL;
 }
 
-static void __at_emit_unsolicited_message(TcoreAT *at, const gchar *line)
+static void _emit_unsolicited_message(TcoreAT *at, const char *line)
 {
        struct _notification *noti = NULL;
        struct _notification_callback *item = NULL;
@@ -255,47 +213,38 @@ static void __at_emit_unsolicited_message(TcoreAT *at, const gchar *line)
        gboolean ret;
        GSList *data = NULL;
 
-       if ((at == NULL) || (line == NULL)) {
-               err("at: [%p] line: [%p]", at, line);
+       if (!at || !line)
                return;
-       }
-
-       dbg("PDU Status: [%s] Line: [%s] Data mode: [%s]",
-               (at->pdu_status ? "TRUE" : "FALSE"), line,
-               (at->data_mode ? "TRUE" : "FALSE"));
 
+       dbg("at->pdu_status  %d line 0x%x at->data_mode %d", at->pdu_status, line, at->data_mode);
        if (at->pdu_status == FALSE) {
                g_hash_table_iter_init(&iter, at->unsolicited_table);
+
                while (g_hash_table_iter_next(&iter, &key, &value)) {
-                       if (g_str_has_prefix(line, key) == 0)
+                       if (!g_str_has_prefix(line, key))
                                continue;
 
                        noti = value;
                        break;
                }
 
-               if (noti == NULL)
+               if (!noti)
                        return;
 
                if (noti->type_pdu == TRUE) {
-                       dbg("PDU mode");
-
                        at->pdu_status = TRUE;
                        at->pdu_noti = noti;
-                       at->pdu_lines =
-                               g_slist_append(NULL, tcore_strdup(line));
-
+                       at->pdu_lines = g_slist_append(NULL, g_strdup(line));
+                       dbg("PDU mode");
                        return;
                }
 
                if (at->data_mode == MODE_BIN) {
-                       at->pdu_lines =
-                               g_slist_append(at->pdu_lines, (gpointer)line);
-
+                       at->pdu_lines = g_slist_append(at->pdu_lines, (gpointer)line);
                        data = at->pdu_lines;
+               } else {
+                       data = g_slist_append(NULL, g_strdup(line));
                }
-               else
-                       data = g_slist_append(NULL, tcore_strdup(line));
        }
        else {
                noti = at->pdu_noti;
@@ -305,269 +254,281 @@ static void __at_emit_unsolicited_message(TcoreAT *at, const gchar *line)
                if (at->data_mode == MODE_BIN) {
                        dbg("Binary mode");
                        at->pdu_lines = g_slist_append(at->pdu_lines, (gpointer)line);
-                       dbg("at->pdu_lines: [%p]", at->pdu_lines);
+                       dbg("at->pdu_lines: 0x%x", at->pdu_lines);
+               } else {
+                       at->pdu_lines = g_slist_append(at->pdu_lines, g_strdup(line));
                }
-               else
-                       at->pdu_lines = g_slist_append(at->pdu_lines, tcore_strdup(line));
 
                data = at->pdu_lines;
        }
 
        p = noti->callbacks;
        while (p) {
-               GSList *tmp_list = p;
                item = p->data;
-               if (item != NULL) {
-                       if (item->callback != NULL) {
-                               ret = item->callback(at, data, item->user_data);
-                               if (ret == FALSE) {
-                                       noti->callbacks =
-                                               g_slist_remove(noti->callbacks, item);
-
-                                       tcore_free(item);
-                               }
-                       }
+               if (!item) {
+                       p = p->next;
+                       continue;
+               }
+
+               ret = item->callback(at, data, item->user_data);
+               if (ret == FALSE) {
+                       p = p->next;
+                       noti->callbacks = g_slist_remove(noti->callbacks, item);
+                       continue;
                }
 
-               p = tmp_list->next;
+               p = p->next;
        }
 
+       dbg(" Free the list");
        if (at->data_mode != MODE_BIN) {
-               dbg("Free the list");
                g_slist_free_full(data, g_free);
        }
-
        at->pdu_lines = NULL;
-       if (g_slist_length(noti->callbacks) == 0)
-               g_hash_table_remove(at->unsolicited_table, key);
 
+       if (g_slist_length(noti->callbacks) == 0) {
+               g_hash_table_remove(at->unsolicited_table, key);
+       }
        dbg("exit");
 }
 
-static void __free_noti_list(void *data)
+static void _free_noti_list(void *data)
 {
        struct _notification *noti = data;
 
-       if (noti != NULL)
-               g_slist_free_full(noti->callbacks, g_free);
+       if (!data)
+               return;
+
+       g_slist_free_full(noti->callbacks, g_free);
+}
+
+#if 0
+static void _msgat(const char *prefix, const char *str)
+{
+       unsigned int i;
+       char buf[8192] = {0,};
+       char *pos;
+
+       if (!str) {
+               msg("str is NULL");
+               return;
+       }
+
+       if (strlen(str) > 4096) {
+               msg("%s[%s]", prefix, str);
+               return;
+       }
+
+       pos = buf;
+       for (i = 0; i < strlen(str); i++) {
+               if (str[i] == '\r') {
+                       strncpy(pos, "<CR>", 4);
+                       pos += 4;
+               }
+               else if (str[i] == '\n') {
+                       strncpy(pos, "<LF>", 4);
+                       pos += 4;
+               }
+               else {
+                       *pos = str[i];
+                       pos++;
+               }
+
+       }
+
+       msg("%s[%s]", prefix, buf);
 }
+#endif
 
 TcoreAT *tcore_at_new(TcoreHal *hal)
 {
        TcoreAT *at;
 
-       at = g_try_new0(struct tcore_at_type, 1);
-       if (at == NULL) {
-               err("Failed to allocate memory");
+       at = calloc(1, sizeof(struct tcore_at_type));
+       if (!at)
                return NULL;
-       }
 
        at->hal = hal;
        at->buf_size = MAX_AT_RESPONSE;
-       at->buf = tcore_try_malloc0(at->buf_size + 1);
-       if (at->buf == NULL) {
-               err("Failed to allocate memory");
-               tcore_free(at);
-               return NULL;
-       }
-
+       at->buf = calloc(1, at->buf_size + 1);
        at->buf_read_pos = at->buf;
        at->buf_write_pos = at->buf;
        at->data_mode = MODE_HEX;
-       at->unsolicited_table = g_hash_table_new_full(g_str_hash,
-               g_str_equal, g_free, __free_noti_list);
+       at->unsolicited_table = g_hash_table_new_full(g_str_hash, g_str_equal,
+                       g_free, _free_noti_list );
 
        return at;
 }
 
 void tcore_at_free(TcoreAT *at)
 {
-       if (at == NULL) {
-               err("AT-Command is NULL");
+       if (!at)
                return;
-       }
 
-       g_hash_table_destroy(at->unsolicited_table);
-       tcore_free(at->buf);
-       tcore_free(at);
+       if (at->buf)
+               free(at->buf);
+
+       if (at->unsolicited_table)
+               g_hash_table_destroy(at->unsolicited_table);
+
+       free(at);
 }
 
-TelReturn tcore_at_remove_notification_full(TcoreAT *at, const gchar *prefix,
-       TcoreAtNotificationCallback callback, void *user_data)
+TReturn tcore_at_remove_notification_full(TcoreAT *at, const char *prefix,
+               TcoreATNotificationCallback callback, void *user_data)
 {
        struct _notification *noti;
        struct _notification_callback *item;
        GSList *p;
 
-       if ((at == NULL) || !prefix)
-               return TEL_RETURN_INVALID_PARAMETER;
+       if (!at || !prefix)
+               return TCORE_RETURN_EINVAL;
 
        if (!callback) {
                /* remove all callbacks for prefix */
                g_hash_table_remove(at->unsolicited_table, prefix);
-               return TEL_RETURN_SUCCESS;
+               return TCORE_RETURN_SUCCESS;
        }
 
        noti = g_hash_table_lookup(at->unsolicited_table, prefix);
        if (!noti)
-               return TEL_RETURN_SUCCESS;
+               return TCORE_RETURN_SUCCESS;
 
        p = noti->callbacks;
-       for (; p; p = p->next) {
+       for(; p; p = p->next) {
                item = p->data;
                if (!item)
                        continue;
 
                if (callback == item->callback) {
                        if (!user_data) {
-                               noti->callbacks =
-                                       g_slist_remove(noti->callbacks, item);
+                               noti->callbacks = g_slist_remove(noti->callbacks, item);
                                continue;
                        }
 
                        if (user_data == item->user_data) {
-                               noti->callbacks =
-                                       g_slist_remove(noti->callbacks, item);
+                               noti->callbacks = g_slist_remove(noti->callbacks, item);
                                continue;
                        }
                }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_at_remove_notification(TcoreAT *at,
-       const gchar *prefix, TcoreAtNotificationCallback callback)
+
+TReturn tcore_at_remove_notification(TcoreAT *at, const char *prefix,
+               TcoreATNotificationCallback callback)
 {
        return tcore_at_remove_notification_full(at, prefix, callback, NULL);
 }
 
-TelReturn tcore_at_add_notification(TcoreAT *at, const gchar *prefix,
-       gboolean pdu, TcoreAtNotificationCallback callback, void *user_data)
+TReturn tcore_at_add_notification(TcoreAT *at, const char *prefix,
+               gboolean pdu, TcoreATNotificationCallback callback,
+               void *user_data)
 {
        struct _notification *noti;
        struct _notification_callback *item;
 
-       if ((at == NULL) || !prefix || !callback)
-               return TEL_RETURN_INVALID_PARAMETER;
+       if (!at || !prefix || !callback)
+               return TCORE_RETURN_EINVAL;
 
        noti = g_hash_table_lookup(at->unsolicited_table, prefix);
-       if (noti == NULL) {
-               noti = g_try_new0(struct _notification, 1);
+       if (!noti) {
+               noti = calloc(1, sizeof(struct _notification));
                if (!noti)
-                       return TEL_RETURN_MEMORY_FAILURE;
+                       return TCORE_RETURN_ENOMEM;
 
                noti->type_pdu = pdu;
                noti->callbacks = NULL;
 
-               g_hash_table_insert(at->unsolicited_table, tcore_strdup(prefix), noti);
+               g_hash_table_insert(at->unsolicited_table, g_strdup(prefix), noti);
        }
 
        if (noti->type_pdu != pdu)
-               return TEL_RETURN_INVALID_PARAMETER;
+               return TCORE_RETURN_EINVAL;
 
-       item = g_try_new0(struct _notification_callback, 1);
-       if (item == NULL)
-               return TEL_RETURN_MEMORY_FAILURE;
+       item = calloc(1, sizeof(struct _notification_callback));
+       if (!item)
+               return TCORE_RETURN_ENOMEM;
 
        item->callback = callback;
        item->user_data = user_data;
 
        noti->callbacks = g_slist_append(noti->callbacks, item);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_at_set_request(TcoreAT *at, TcoreAtRequest *req)
+TReturn tcore_at_set_request(TcoreAT *at, TcoreATRequest *req, gboolean send)
 {
-       if (at == NULL) {
-               err("AT-Command is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       at->req = req;
+       TReturn ret;
+       char *end;
+       char next;
 
-       if (req) {
-               dbg("AT Request - Command: [%s] Pre-fix: [%s] Type: [%d])",
-                       at->req->cmd, at->req->prefix, at->req->type);
-       }
-       else {
-               err("AT request is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
+       if (!at || !req) {
+               dbg("Invalid data");
+               return TCORE_RETURN_EINVAL;
        }
 
-       return TEL_RETURN_SUCCESS;
-}
-
-TelReturn tcore_at_send_data(TcoreAT *at, TcoreAtRequest *req, gboolean send)
-{
-       TelReturn ret;
-       gchar *end;
-       gchar next;
-
-       if (at == NULL) {
-               err("AT-Command is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       if (req == NULL) {
-               err("AT request is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
+       if (!req->cmd) {
+               dbg("Invalid cmd");
+               return TCORE_RETURN_EINVAL;
        }
 
-       if ((ret = tcore_at_set_request(at, req)) != TEL_RETURN_SUCCESS) {
-               err("Failed to set AT request");
-               return ret;
-       }
+       at->req = req;
 
        if (send == FALSE)
-               return TEL_RETURN_SUCCESS;
+               return TCORE_RETURN_SUCCESS;
+
+#ifdef EMULATOR
+       if (strstr(at->req->cmd, "CMGS")) {
+               dbg("In case of emulator, do not check CR for CMGS");
+               return tcore_hal_send_data(at->hal, strlen(req->cmd), req->cmd);
+       }
+#endif
 
        end = strchr(at->req->cmd, CR);
        next = *(end + 1);
-       if (next == '\0')
+       if (next == '\0') {
                return tcore_hal_send_data(at->hal, strlen(req->cmd), req->cmd);
+       }
 
-       dbg("backup data = [%c]", next);
        at->req->next_send_pos = end + 1;
-       dbg("next data = [%s]", at->req->next_send_pos);
+       dbg("backup data = [%c] next data = [%s]", next, at->req->next_send_pos);
 
-       *(end + 1) = '\0';
+       *(end+1) = '\0';
        ret = tcore_hal_send_data(at->hal, strlen(req->cmd), req->cmd);
-       *(end + 1) = next;
+       *(end+1) = next;
 
        return ret;
 }
 
-TcoreAtRequest *tcore_at_get_request(TcoreAT *at)
+TcoreATRequest *tcore_at_get_request(TcoreAT *at)
 {
-       if (at == NULL) {
-               err("AT-Command is NULL");
+       if (!at)
                return NULL;
-       }
 
        return at->req;
 }
 
 
-TcoreAtResponse *tcore_at_get_response(TcoreAT *at)
+TcoreATResponse *tcore_at_get_response(TcoreAT *at)
 {
-       if (at == NULL) {
-               err("AT-Command is NULL");
+       if (!at)
                return NULL;
-       }
 
        return at->resp;
 }
 
-TelReturn tcore_at_buf_write(TcoreAT *at, guint data_len, const gchar *data)
+TReturn tcore_at_buf_write(TcoreAT *at, unsigned int data_len, const char *data)
 {
-       guint read_pos;
-       guint write_pos;
+       unsigned int read_pos;
+       unsigned int write_pos;
 
-       if (at == NULL) {
-               err("AT-Command is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
+       if (!at) {
+               err("at is NULL");
+               return TCORE_RETURN_EINVAL;
        }
 
        read_pos = at->buf_read_pos - at->buf;
@@ -581,9 +542,9 @@ TelReturn tcore_at_buf_write(TcoreAT *at, guint data_len, const gchar *data)
                at->buf_read_pos = at->buf;
                at->buf_write_pos = at->buf + write_pos - read_pos;
                dbg("after  read_pos=buf+%d, write_pos=buf+%d",
-                       at->buf_read_pos - at->buf, at->buf_write_pos - at->buf);
-               memset(at->buf_write_pos, 0x0,
-                       at->buf_size - (at->buf_write_pos - at->buf));
+                               at->buf_read_pos - at->buf,
+                               at->buf_write_pos - at->buf);
+               memset(at->buf_write_pos, 0, at->buf_size - (at->buf_write_pos - at->buf));
        }
 
        write_pos = at->buf_write_pos - at->buf;
@@ -593,74 +554,69 @@ TelReturn tcore_at_buf_write(TcoreAT *at, guint data_len, const gchar *data)
                        if (at->buf_size > write_pos + data_len)
                                break;
                }
-
                at->buf = realloc(at->buf, at->buf_size);
                at->buf_read_pos = at->buf;
                at->buf_write_pos = at->buf + write_pos;
-               memset(at->buf_write_pos, 0x0,
-                       at->buf_size - (at->buf_write_pos - at->buf));
+               memset(at->buf_write_pos, 0, at->buf_size - (at->buf_write_pos - at->buf));
+
                dbg("resize buffer to %d", at->buf_size);
        }
 
        memcpy(at->buf_write_pos, data, data_len);
 
        at->buf_write_pos += data_len;
-
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TcoreAtRequest *tcore_at_request_new(const gchar *cmd,
-       const gchar *prefix, TcoreAtCommandType type)
+TcoreATRequest* tcore_at_request_new(const char *cmd, const char *prefix, enum tcore_at_command_type type)
 {
-       TcoreAtRequest *at_req;
+       TcoreATRequest *req;
 
-       if (cmd == NULL) {
-               err("AT-Command is NULL");
+       if (!cmd)
                return NULL;
-       }
 
-       if (strlen(cmd) < 1) {
-               err("Invalid AT-Command length: [%d]", strlen(cmd));
+       if (strlen(cmd) < 1)
                return NULL;
-       }
 
-       at_req = g_try_new0(TcoreAtRequest, 1);
-       if (at_req == NULL) {
-               err("Failed to allocate memory");
+       req = calloc(1, sizeof(struct tcore_at_request));
+       if (!req)
                return NULL;
-       }
 
-       if (strchr(cmd, CR) == 0)
-               at_req->cmd = g_strdup_printf("%s%c", cmd, CR);
+       if (!strchr(cmd, CR))
+               req->cmd = g_strdup_printf("%s%c", cmd, CR);
        else
-               at_req->cmd = g_strdup_printf("%s%c", cmd, 26);
+               req->cmd = g_strdup_printf("%s%c", cmd, 26);
 
        if (prefix)
-               at_req->prefix = tcore_memdup(prefix, strlen(prefix) + 1);
+               req->prefix = strdup(prefix);
 
-       at_req->type = type;
-       dbg("AT-Command: [%s] Prefix(if any): [%s] AT-Command length: [%d]",
-               at_req->cmd, at_req->prefix, strlen(at_req->cmd));
+       req->type = type;
 
-       return at_req;
+       return req;
 }
 
-void tcore_at_request_free(TcoreAtRequest *at_req)
+void tcore_at_request_free(TcoreATRequest *req)
 {
-       if (at_req == NULL) {
-               err("AT-Command is NULL");
+       if (!req)
                return;
-       }
 
-       tcore_free(at_req->cmd);
-       tcore_free(at_req->prefix);
-       tcore_free(at_req);
+       if (req->cmd)
+               free(req->cmd);
+
+       if (req->prefix)
+               free(req->prefix);
+
+       free(req);
+}
+
+void tcore_at_response_free(TcoreATResponse *rsp){
+       _response_free(rsp);
 }
 
 /* To get the length value from little-endian bytes */
-static gint __sum_4_bytes(const gchar *posn)
+static int __sum_4_bytes(const char *posn)
 {
-       gint sum = 0;
+       int sum = 0;
        sum = sum | (*(posn+3)) << 24;
        sum = sum | (*(posn+2)) << 16;
        sum = sum | (*(posn+1)) << 8;
@@ -669,44 +625,43 @@ static gint __sum_4_bytes(const gchar *posn)
 }
 
 /* Function to process binary data received as part of XDRV Indication */
-void tcore_at_process_binary_data(TcoreAT *at, gchar *position, guint data_len)
+void tcore_at_process_binary_data(TcoreAT *at, char *position, int data_len)
 {
 
        #define NVM_PAYLOAD_LENGTH_0                    52
        #define NVM_PAYLOAD_LENGTH_1                    68
 
-       gint m_length_0 = ZERO , m_length_1 = ZERO;
-       static gint data_len_final = ZERO, actual_buffer_size = ZERO;
+       int m_length_0 = 0 , m_length_1 = 0;
+       static int data_len_final = 0, actual_buffer_size = 0;
        dbg("Entered");
 
        m_length_0 = __sum_4_bytes(&position[NVM_PAYLOAD_LENGTH_0]);
        m_length_1 = __sum_4_bytes(&position[NVM_PAYLOAD_LENGTH_1]);
        data_len_final = data_len_final + data_len;
 
-       dbg("m_length_0 = %d , m_length_1 = %d, data_len_final = %d actual_buffer_size: %d",
-               m_length_0, m_length_1, data_len_final, actual_buffer_size);
-       if (actual_buffer_size == ZERO) {
+       dbg("m_length_0 = %d , m_length_1 = %d, data_len_final = %d actual_buffer_size: %d", m_length_0, m_length_1, data_len_final, actual_buffer_size);
+       if (actual_buffer_size == 0) {
                actual_buffer_size = data_len + m_length_0 + m_length_1;
                dbg("Actual buffer size is %d", actual_buffer_size);
        }
 
        if (data_len_final == actual_buffer_size) {
-               __at_emit_unsolicited_message(at, position);
+               _emit_unsolicited_message(at, position);
                at->data_mode = MODE_HEX;
                at->buf_read_pos = at->buf_read_pos + (actual_buffer_size + 1);
-               data_len_final = ZERO;
-               actual_buffer_size = ZERO;
+               data_len_final = 0;
+               actual_buffer_size = 0;
        }
        dbg("Exit");
 }
 
-gboolean tcore_at_process(TcoreAT *at, guint data_len, const gchar *data)
+gboolean tcore_at_process(TcoreAT *at, unsigned int data_len, const char *data)
 {
-       gchar *pos;
-       gchar *next_pos;
-       TcoreAtRcvMsgType ret;
+       char *pos;
+       char *next_pos;
+       int ret;
 
-       if ((at == NULL) || (data == NULL))
+       if (!at || !data)
                return FALSE;
 
        tcore_at_buf_write(at, data_len, data);
@@ -715,6 +670,7 @@ gboolean tcore_at_process(TcoreAT *at, guint data_len, const gchar *data)
        dbg("On entry at->buf_read_pos: 0x%x", at->buf_read_pos);
 
        while (1) {
+
                while (*pos == CR || *pos == LF)
                        pos++;
 
@@ -731,109 +687,138 @@ gboolean tcore_at_process(TcoreAT *at, guint data_len, const gchar *data)
                                dbg("Rfs hook is not set !!");
                        break;
                }
+
                if (pos != next_pos)
                        *next_pos = '\0';
 
+               //dbg("complete line found.");
                dbg("line = [%s]", pos);
 
-               /* Check request */
-               if (at->req == NULL) {
-                       dbg("Not AT request" );
-                       __at_emit_unsolicited_message(at, pos);
+               // check request
+               if (!at->req) {
+                       _emit_unsolicited_message(at, pos);
                }
                else {
-                       dbg("AT request" );
                        if (g_strcmp0(pos, "> ") == 0) {
                                if (at->req->next_send_pos) {
                                        dbg("send next: [%s]", at->req->next_send_pos);
-                                       tcore_hal_send_data(at->hal,
-                                               strlen(at->req->next_send_pos),
-                                               at->req->next_send_pos);
-
-                                       pos += 2;
+                                       tcore_hal_send_data(at->hal, strlen(at->req->next_send_pos), at->req->next_send_pos);
+                                       pos += 3;       /* Including NULL character */
                                        at->buf_read_pos = pos;
                                        break;
                                }
                        }
 
-                       if (at->resp == NULL)
-                               at->resp = __at_response_new();
-
-                       ret = __check_final_response(pos);
-                       switch (ret) {
-                       case TCORE_AT_RECV_MSG_TYPE_RESP_SUCCESS:
-                       case TCORE_AT_RECV_MSG_TYPE_RESP_FAILURE: {
-                               at->resp->success =
-                                       (ret == TCORE_AT_RECV_MSG_TYPE_RESP_SUCCESS
-                                       ? TRUE : FALSE);
+                       if (!at->resp) {
+                               at->resp = _response_new();
+                       }
 
-                               at->resp->final_response = tcore_strdup(pos);
+                       ret = _check_final_response(pos);
+                       if (ret) {
+                               if (ret == 1)
+                                       at->resp->success = TRUE;
+                               else {
+                                       gchar *str_escape = NULL;
+                                       gchar str_secure[12] = {'\0'};
 
-                               __at_emit_pending_response(at, __at_is_abort(at->resp));
-                               at->buf_read_pos = next_pos + 1;
+                                       char *hal_name = tcore_hal_get_name(at->hal);
+                                       msg("=========== [%s] ERROR ===========", hal_name);
 
-                               return TRUE;
-                       }
+                                       str_escape = g_strescape(at->req->cmd, NULL);
+                                       (void)g_strlcpy(str_secure, str_escape, G_N_ELEMENTS(str_secure));
+                                       msg("Request: [%s]", str_secure);
+                                       g_free(str_escape); str_escape = NULL;
 
-                       case TCORE_AT_RECV_MSG_TYPE_NOTI: {
-                               switch (at->req->type) {
-                               case TCORE_AT_COMMAND_TYPE_NO_RESULT:
-                                       __at_emit_unsolicited_message(at, pos);
-                                       break;
+                                       str_escape = g_strescape(pos, NULL);
+                                       msg("Response: [%s]", str_escape);
+                                       g_free(str_escape); str_escape = NULL;
+                                       msg("===============================================");
 
-                               case TCORE_AT_COMMAND_TYPE_NUMERIC:
-                                       if (at->resp->lines == NULL && isdigit(pos[0]))
-                                               __at_response_add(at->resp, pos);
-                                       else
-                                               __at_emit_unsolicited_message(at, pos);
-                               break;
+                                       free(hal_name);
 
-                               case TCORE_AT_COMMAND_TYPE_SINGLELINE:
-                                       dbg("SINGLELINE");
-                                       if (at->resp->lines == NULL)
-                                               if (at->req->prefix)
-                                                       if (g_str_has_prefix(pos, at->req->prefix))
-                                                               __at_response_add(at->resp, pos);
-                                                       else
-                                                               __at_emit_unsolicited_message(at, pos);
-                                               else
-                                                       __at_response_add(at->resp, pos);
-                                       else
-                                               __at_emit_unsolicited_message(at, pos);
-                               break;
-
-                               case TCORE_AT_COMMAND_TYPE_MULTILINE:
-                                       dbg("MULTILINE");
-                                       if (at->req->prefix)
-                                               if (g_str_has_prefix(pos, at->req->prefix))
-                                                       __at_response_add(at->resp, pos);
-                                               else
-                                                       __at_emit_unsolicited_message(at, pos);
-                                       else
-                                               __at_response_add(at->resp, pos);
-                               break;
+                                       at->resp->success = FALSE;
+                               }
 
-                               case TCORE_AT_COMMAND_TYPE_PDU:
-                                       dbg("PDU");
-                                       if (at->req->prefix)
-                                               if (g_str_has_prefix(pos, at->req->prefix))
-                                                       __at_response_add(at->resp, pos);
-                                               else
-                                                       if (at->resp->lines != NULL)
-                                                               __at_response_add(at->resp, pos);
-                                                       else
-                                                               __at_emit_unsolicited_message(at, pos);
-                                       else
-                                               __at_response_add(at->resp, pos);
-                               break;
+                               at->resp->final_response = strdup(pos);
 
-                               default:
-                                       warn("UNKNOWN");
-                                       __at_emit_unsolicited_message(at, pos);
-                               break;
-                               }       /* switch (at->req->type) */
-                       } break;
-                       }       /* switch (ret) */
+                               _emit_pending_response(at);
+                               at->buf_read_pos = next_pos + 1;
+                               return TRUE;
+                       }
+                       else {
+                               switch (at->req->type) {
+                                       case TCORE_AT_NO_RESULT:
+                                               _emit_unsolicited_message(at, pos);
+                                               break;
+
+                                       case TCORE_AT_NUMERIC:
+                                               if (at->resp->lines == NULL && isdigit(pos[0])) {
+                                                       _response_add(at->resp, pos);
+                                               }
+                                               else {
+                                                       _emit_unsolicited_message(at, pos);
+                                               }
+
+                                               break;
+
+                                       case TCORE_AT_SINGLELINE:
+                                               if (at->resp->lines == NULL) {
+                                                       if (at->req->prefix) {
+                                                               if (g_str_has_prefix(pos, at->req->prefix)) {
+                                                                       _response_add(at->resp, pos);
+                                                               }
+                                                               else {
+                                                                       _emit_unsolicited_message(at, pos);
+                                                               }
+                                                       }
+                                                       else {
+                                                               _response_add(at->resp, pos);
+                                                       }
+                                               }
+                                               else {
+                                                       _emit_unsolicited_message(at, pos);
+                                               }
+                                               break;
+
+                                       case TCORE_AT_MULTILINE:
+                                               if (at->req->prefix) {
+                                                       if (g_str_has_prefix(pos, at->req->prefix)) {
+                                                               _response_add(at->resp, pos);
+                                                       }
+                                                       else {
+                                                               _emit_unsolicited_message(at, pos);
+                                                       }
+                                               }
+                                               else {
+                                                       _response_add(at->resp, pos);
+                                               }
+                                               break;
+
+                                       case TCORE_AT_PDU:
+                                               if (at->req->prefix) {
+                                                       if (g_str_has_prefix(pos, at->req->prefix)) {
+                                                               _response_add(at->resp, pos);
+                                                       }
+                                                       else {
+                                                               if (at->resp->lines != NULL) {
+                                                                       _response_add(at->resp, pos);
+                                                               }
+                                                               else {
+                                                                       _emit_unsolicited_message(at, pos);
+                                                               }
+                                                       }
+                                               }
+                                               else {
+                                                       _response_add(at->resp, pos);
+                                               }
+                                               break;
+
+                                       default:
+                                               dbg("unknown");
+                                               _emit_unsolicited_message(at, pos);
+                                               break;
+                               }
+                       }
                }
 
                //
@@ -841,26 +826,23 @@ gboolean tcore_at_process(TcoreAT *at, guint data_len, const gchar *data)
                at->buf_read_pos = pos;
        }
 
-       dbg("On exit at->buf_read_pos: 0x%x", at->buf_read_pos);
        return FALSE;
 }
 
-TcorePending *tcore_at_pending_new(CoreObject *co,
-       const gchar *cmd, const gchar *prefix, TcoreAtCommandType type,
-       TcorePendingResponseCallback func, void *user_data)
+TcorePending *tcore_at_pending_new(CoreObject *co, const char *cmd, const char *prefix, enum tcore_at_command_type type, TcorePendingResponseCallback func, void *user_data)
 {
        TcorePending *p;
-       TcoreAtRequest *req;
+       TcoreATRequest *req;
 
-       if (cmd == NULL)
+       if (!cmd)
                return NULL;
 
        req = tcore_at_request_new(cmd, prefix, type);
-       if (req == NULL)
+       if (!req)
                return NULL;
 
        p = tcore_pending_new(co, 0);
-       if (p == NULL) {
+       if (!p) {
                tcore_at_request_free(req);
                return NULL;
        }
@@ -871,16 +853,23 @@ TcorePending *tcore_at_pending_new(CoreObject *co,
        return p;
 }
 
-GSList *tcore_at_tok_new(const gchar *line)
+#define TYPE_NONE              0
+#define TYPE_RAW               1
+#define TYPE_STR               2
+#define TYPE_STR_FIN   3
+#define TYPE_PAREN             4
+#define TYPE_PAREN_FIN 5
+
+GSList *tcore_at_tok_new(const char *line)
 {
-       gchar *begin;
-       gchar *pos;
-       gchar *buf = NULL;
-       gchar *mark_end = NULL;
-       TcoreAtTokenType type = TCORE_AT_TOKEN_TYPE_NONE;
+       char *begin;
+       char *pos;
+       char *buf = NULL;
+       char *mark_end = NULL;
+       int type = TYPE_NONE;
        GSList *tokens = NULL;
 
-       if (line == NULL)
+       if (!line)
                return NULL;
 
        if (strlen(line) == 0)
@@ -888,77 +877,85 @@ GSList *tcore_at_tok_new(const gchar *line)
 
        if (line[0] == '(') {
                /* list token container */
-               pos = (gchar *) line;
-               if (line[strlen(line) - 1] == ')')
-                       mark_end = (gchar *) line + strlen(line) - 1;
-       } else {
-               /* normal AT message */
+               pos = (char *)line;
+               if (line[strlen(line)-1] == ')')
+                       mark_end = (char *)line + strlen(line) - 1;
+       }
+       else {
+               /* normal at message */
                pos = strchr(line, ':');
-               if (pos == NULL) {
-                       tokens = g_slist_append(tokens, tcore_strdup(line));
+               if (!pos) {
+                       tokens = g_slist_append(tokens, strdup(line));
                        return tokens;
                }
        }
 
        pos++;
 
-       /* skip whitespace(s) */
-       while (*pos != '\0' && isspace(*pos))
+       /* skip whitespace */
+       while (*pos != '\0' && isspace(*pos)) {
                pos++;
+       }
 
        begin = pos;
 
        do {
                switch (type) {
-               case TCORE_AT_TOKEN_TYPE_NONE: {
-                       if (*pos == '"')
-                               type = TCORE_AT_TOKEN_TYPE_STR;
-                       else if (*pos == ',')
-                               tokens = g_slist_append(tokens, tcore_strdup(""));
-                       else if (*pos == '(')
-                               type = TCORE_AT_TOKEN_TYPE_PAREN;
-                       else if (*pos == ' ')
-                               ;               /* skip */
-                       else
-                               type = TCORE_AT_TOKEN_TYPE_RAW;
-
+               case TYPE_NONE:
+                       if (*pos == '"') {
+                               type = TYPE_STR;
+                       }
+                       else if (*pos == ',') {
+                               tokens = g_slist_append(tokens, strdup(""));
+                       }
+                       else if (*pos == ' ') {
+                               // skip
+                       }
+                       else if (*pos == '(') {
+                               type = TYPE_PAREN;
+                       }
+                       else {
+                               type = TYPE_RAW;
+                       }
                        begin = pos;
-               } break;
+                       break;
 
-               case TCORE_AT_TOKEN_TYPE_STR: {
+               case TYPE_STR:
                        if (*pos == '"') {
-                               type = TCORE_AT_TOKEN_TYPE_STR_FIN;
-
-                               buf = tcore_try_malloc0(pos - begin + 2);
+                               type = TYPE_STR_FIN;
+                               buf = calloc(1, (pos - begin) + 2);
                                memcpy(buf, begin, pos - begin + 1);
                                tokens = g_slist_append(tokens, buf);
                        }
-               } break;
+                       break;
 
-               case TCORE_AT_TOKEN_TYPE_PAREN: {
+               case TYPE_PAREN:
                        if (*pos == ')') {
-                               type = TCORE_AT_TOKEN_TYPE_PAREN_FIN;
-
-                               buf = tcore_try_malloc0(pos - begin + 2);
+                               type = TYPE_PAREN_FIN;
+                               buf = calloc(1, (pos - begin) + 2);
                                memcpy(buf, begin, pos - begin + 1);
                                tokens = g_slist_append(tokens, buf);
                        }
-               } break;
+                       break;
 
-               case TCORE_AT_TOKEN_TYPE_RAW: {
+               case TYPE_RAW:
                        if (*pos == ',' || *pos == '\0') {
-                               type = TCORE_AT_TOKEN_TYPE_NONE;
-                               buf = tcore_try_malloc0(pos - begin + 1);
+                               type = TYPE_NONE;
+                               buf = calloc(1, (pos - begin) + 1);
                                memcpy(buf, begin, pos - begin);
                                tokens = g_slist_append(tokens, buf);
                        }
-               } break;
+                       break;
 
-               case TCORE_AT_TOKEN_TYPE_STR_FIN:
-               case TCORE_AT_TOKEN_TYPE_PAREN_FIN: {
-                       if (*pos == ',')
-                               type = TCORE_AT_TOKEN_TYPE_NONE;
-               } break;
+               case TYPE_STR_FIN:
+               case TYPE_PAREN_FIN:
+                       if (*pos == ',') {
+                               type = TYPE_NONE;
+                       }
+                       break;
+               default:
+                       err("invalid string type");
+                       break;
                }
 
                if (*pos == '\0' || pos == mark_end)
@@ -967,8 +964,8 @@ GSList *tcore_at_tok_new(const gchar *line)
                pos++;
        } while (1);
 
-       if (type == TCORE_AT_TOKEN_TYPE_RAW) {
-               buf = tcore_try_malloc0(pos - begin + 1);
+       if (type == TYPE_RAW) {
+               buf = calloc(1, (pos - begin) + 1);
                memcpy(buf, begin, pos - begin);
                tokens = g_slist_append(tokens, buf);
        }
@@ -978,54 +975,57 @@ GSList *tcore_at_tok_new(const gchar *line)
 
 void tcore_at_tok_free(GSList *tokens)
 {
-       if (tokens != NULL)
-               g_slist_free_full(tokens, g_free);
+       if (!tokens)
+               return;
+
+       g_slist_free_full(tokens, g_free);
 }
 
-gchar *tcore_at_tok_extract(const gchar *src)
+char *tcore_at_tok_extract(const char *src)
 {
-       gchar *dest = NULL;
-       gchar *last = NULL;
+       char *dest = NULL;
+       char *last = NULL;
 
-       if (src == NULL)
+       if (!src)
                return NULL;
 
        if (strlen(src) < 2)
-               return tcore_strdup(src);
+               return g_strdup(src);
 
-       last = (gchar *) src + strlen(src) - 1;
+       last = (char *)src + strlen(src) - 1;
 
        switch (*src) {
-       case '(':
-               if (*last == ')') {
-                       dest = tcore_strdup(src + 1);
-                       dest[strlen(dest) - 1] = '\0';
-               }
-               break;
+               case '(':
+                       if (*last == ')') {
+                               dest = g_strdup(src + 1);
+                               dest[strlen(dest) - 1] = '\0';
+                       }
+                       break;
 
-       case '"':
-               if (*last == '"') {
-                       dest = tcore_strdup(src + 1);
-                       dest[strlen(dest) - 1] = '\0';
-               }
-               break;
+               case '"':
+                       if (*last == '"') {
+                               dest = g_strdup(src + 1);
+                               dest[strlen(dest) - 1] = '\0';
+                       }
+                       break;
 
-       default:
-               return tcore_strdup(src);
+               default:
+                       return g_strdup(src);
+                       break;
        }
 
        return dest;
 }
 
-gchar *tcore_at_tok_nth(GSList *tokens, guint index)
+char *tcore_at_tok_nth(GSList *tokens, unsigned int token_index)
 {
-       if (tokens == NULL)
+       if (!tokens)
                return NULL;
 
-       if (index > g_slist_length(tokens))
+       if (token_index > g_slist_length(tokens))
                return NULL;
 
-       return (gchar *) g_slist_nth_data(tokens, index);
+       return (char *)g_slist_nth_data(tokens, token_index);
 }
 
 gboolean tcore_at_add_hook(TcoreHal *hal, void *hook_func)
@@ -1042,115 +1042,68 @@ gboolean tcore_at_add_hook(TcoreHal *hal, void *hook_func)
        return FALSE;
 }
 
-TelReturn tcore_at_prepare_and_send_request(CoreObject *co,
-       const gchar *cmd, const gchar *prefix,
-       TcoreAtCommandType type, void *request,
-       TcorePendingResponseCallback resp_cb, void *resp_cb_data,
-       TcorePendingSendCallback send_cb, void *send_cb_data)
+void tcore_free_pending_timeout_at_request(TcoreAT *at)
 {
-       TcorePending *pending;
-       TcoreAtRequest *at_req;
-       TcoreHal *hal;
-       TelReturn ret = TEL_RETURN_FAILURE;
-
-       hal = tcore_object_get_hal(co);
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return ret;
-       }
-       dbg("hal: [%p]", hal);
-
-       /* Create Pending Request */
-       pending = tcore_pending_new(co, 0);
-       if (pending == NULL) {
-               err("Pending is NULL");
-               return ret;
-       }
-
-       /* Create AT-Command Request */
-       at_req = tcore_at_request_new(cmd, prefix, type);
-       if (at_req == NULL) {
-               err("Request is NULL");
-
-               tcore_pending_free(pending);
-               return ret;
-       }
-
-       tcore_pending_set_request_data(pending, 0, at_req);
-       tcore_pending_link_request(pending, request);
-
-       tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT);
-
-       tcore_pending_set_response_callback(pending, resp_cb, resp_cb_data);
-       tcore_pending_set_send_callback(pending, send_cb, send_cb_data);
-
-       ret = tcore_hal_send_request(hal, pending);
-       dbg("ret: [0x%x]", ret);
+       if (!at)
+               return;
 
-       return ret;
+       tcore_at_request_free(at->req);
+       tcore_at_response_free(at->resp);
+       at->req = NULL;
+       at->resp = NULL;
 }
 
-/*
- * Extended API
- *     Provides more control on the AT-Command request being sent
- */
-TelReturn tcore_at_prepare_and_send_request_ex(CoreObject *co,
-       const gchar *cmd, const gchar *prefix, TcoreAtCommandType type,
-       TcorePendingPriority priority, void *request,
-       TcorePendingResponseCallback resp_cb, void *resp_cb_data,
-       TcorePendingSendCallback send_cb, void *send_cb_data,
-       guint timeout, TcorePendingTimeoutCallback timeout_cb, void *timeout_cb_data,
-       gboolean auto_free, gboolean abortable)
+TReturn tcore_prepare_and_send_at_request(CoreObject *co,
+                                                                                               const char *at_cmd,
+                                                                                               const char *at_cmd_prefix,
+                                                                                               enum tcore_at_command_type at_cmd_type,
+                                                                                               UserRequest *ur,
+                                                                                               TcorePendingResponseCallback resp_cb,
+                                                                                               void *resp_cb_data,
+                                                                                               TcorePendingSendCallback send_cb,
+                                                                                               void *send_cb_data,
+                                                                                               unsigned int timeout,
+                                                                                               TcorePendingTimeoutCallback timeout_cb,
+                                                                                               void *timeout_cb_data)
 {
-       TcorePending *pending;
-       TcoreAtRequest *at_req;
-       TcoreHal *hal;
-       TelReturn ret = TEL_RETURN_FAILURE;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req = NULL;
+       TcoreHal *hal = NULL;
+       TReturn ret = TCORE_RETURN_FAILURE;
 
        hal = tcore_object_get_hal(co);
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal) {
+               dbg("HAL is NULL");
                return ret;
        }
-       dbg("hal: [%p]", hal);
+       dbg("hal: [0x%x]", hal);
 
        /* Create Pending Request */
        pending = tcore_pending_new(co, 0);
-       if (pending == NULL) {
-               err("Pending is NULL");
+       if (!pending) {
+               dbg("Pending is NULL");
                return ret;
        }
 
        /* Create AT-Command Request */
-       at_req = tcore_at_request_new(cmd, prefix, type);
-       if (at_req == NULL) {
-               err("Request is NULL");
-
+       req = tcore_at_request_new(at_cmd, at_cmd_prefix, at_cmd_type);
+       if (req == NULL) {
+               dbg("Request is NULL");
                tcore_pending_free(pending);
                return ret;
        }
+       dbg("AT Command: [%s], Prefix(if any): [%s], AT-Command length: [%d]",
+                                                               req->cmd, req->prefix, strlen(req->cmd));
 
-       tcore_pending_set_request_data(pending, 0, at_req);
-       tcore_pending_link_request(pending, request);
-
-       tcore_pending_set_priority(pending, priority);
-
+       tcore_pending_set_request_data(pending, 0, req);
        tcore_pending_set_response_callback(pending, resp_cb, resp_cb_data);
        tcore_pending_set_send_callback(pending, send_cb, send_cb_data);
-
-       if (timeout > 0)
-               tcore_pending_set_timeout(pending, timeout);
+       tcore_pending_set_timeout(pending, timeout);
        tcore_pending_set_timeout_callback(pending, timeout_cb, timeout_cb_data);
-
-       if (auto_free)
-               tcore_pending_set_auto_free_status_after_sent(pending, auto_free);
-
-       if (abortable)
-               tcore_pending_set_abortable(pending, abortable);
+       tcore_pending_link_user_request(pending, ur);
 
        ret = tcore_hal_send_request(hal, pending);
        dbg("ret: [0x%x]", ret);
-
        return ret;
 }
 
index 33313f8..fdfdcd0 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+
 #include <glib.h>
 
 #include "tcore.h"
 #include "plugin.h"
+#include "queue.h"
+#include "user_request.h"
 #include "co_call.h"
 
-/* Max 6 Call Objects are supported */
-#define MAX_CALL_OBJECTS               6
 
-typedef struct {
-       GSList *cobjs;
-       TcoreCallOps *ops;
-} PrivateObject;
+#define MAX_CALL_OBJECTS               6
 
-typedef gboolean(*TcoreCompareCallObject)(CallObject *call_obj, void *data);
+#define _check_null( name, value, err ) { \
+       if ( !value ) { \
+               dbg("[error] %s : NULL", name ); \
+               return err; \
+       } \
+}
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
+struct call_cli_info {
+       enum tcore_call_cli_mode mode;
+       enum tcore_call_no_cli_cause no_cli_cause;
+       char number[MAX_CALL_NUMBER_LEN];
+       int number_len;
+};
+
+struct call_cna_info {
+       enum tcore_call_cna_mode mode;
+       int dcs;
+       char name[MAX_CALL_NAME_LEN];
+       int name_len;
+};
+
+struct call_object {
+       enum tcore_call_type type;
+       unsigned int id;
+       enum tcore_call_direction direction;
+       enum tcore_call_status status;
+       gboolean mpty;
+       struct call_cli_info cli;
+       struct call_cna_info cna;
+       unsigned int cug_id;
+       unsigned int active_line;
+       struct call_time { // second
+               long start;
+               long end;
+       } time;
+       gboolean is_volte_call;
+       int session_id; // VoLTE only
+       int conf_call_session_id; // Conference call session-id (VoLTE only)
+       gboolean early_media; // VoLTE only
+};
+
+struct private_object_data {
+       GSList* cobjs;
+       struct tcore_call_operations *ops;
+       struct tcore_call_control_operations *cops;
+       struct tcore_call_information_operations *iops;
+};
+
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       PrivateObject *src_po;
-       PrivateObject *dest_po;
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       tcore_check_return_assert(src != NULL);
-       tcore_check_return_assert(dest != NULL);
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->ops", po->ops, TCORE_RETURN_FAILURE);
+       _check_null( "ur", ur, TCORE_RETURN_FAILURE);
 
-       src_po = tcore_object_ref_object(src);
-       if (NULL == src_po) {
-               err("invalid source private object");
-               tcore_object_link_object(dest, NULL);
-               return;
-       }
+       command = tcore_user_request_get_command(ur);
+       switch (command) {
+               case TREQ_CALL_DIAL:
+                       _check_null( "po->ops->dial", po->ops->dial, TCORE_RETURN_FAILURE);
+                       return po->ops->dial(o, ur);
 
-       tcore_check_return_assert(src_po->ops != NULL);
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup((gconstpointer)src_po->ops, sizeof(TcoreCallOps));
-       tcore_object_link_object(dest, dest_po);
-}
+               case TREQ_CALL_ANSWER:
+                       _check_null( "po->ops->answer", po->ops->answer, TCORE_RETURN_FAILURE);
+                       return po->ops->answer(o, ur);
 
-static TelReturn _dispatcher(CoreObject *co, TcoreCommand command,
-               const void *request, TcoreObjectResponseCallback cb,
-               const void *user_data)
-{
-       PrivateObject *po;
+               case TREQ_CALL_END:
+                       _check_null( "po->ops->end", po->ops->end, TCORE_RETURN_FAILURE);
+                       return po->ops->end(o, ur);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL,  TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
+               case TREQ_CALL_HOLD:
+                       _check_null( "po->ops->hold", po->ops->hold, TCORE_RETURN_FAILURE);
+                       return po->ops->hold(o, ur);
 
-       dbg("command [0x%x]", command);
-       switch (command) {
-       case TCORE_COMMAND_CALL_DIAL:
-               if(po->ops->dial)
-                       return po->ops->dial(co,
-                       (const TelCallDial *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_ANSWER:
-               if(po->ops->answer)
-                       return po->ops->answer(co,
-                       *(TelCallAnswerType *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_END:
-               if(po->ops->end)
-                       return po->ops->end(co,
-                       (const TelCallEnd *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_SEND_DTMF:
-               if(po->ops->send_dtmf)
-                       return po->ops->send_dtmf(co,
-                       (const char *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_HOLD:
-               if(po->ops->hold)
-                       return po->ops->hold(co,
-                       cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_ACTIVE:
-               if(po->ops->active)
-                       return po->ops->active(co,
-                       cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_SWAP:
-               if(po->ops->swap)
-                       return po->ops->swap(co,
-                       cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_JOIN:
-               if(po->ops->join)
-                       return po->ops->join(co,
-                       cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_SPLIT:
-               if(po->ops->split)
-                       return po->ops->split(co,
-                       *(unsigned int *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_TRANSFER:
-               if(po->ops->transfer)
-                       return po->ops->transfer(co,
-                       cb, (void *) user_data);
-               break;
-       case TCORE_COMMAND_CALL_DEFLECT:
-               if(po->ops->deflect)
-                       return po->ops->deflect(co,
-                       (const char *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_SET_ACTIVE_LINE:
-               if(po->ops->set_active_line)
-                       return po->ops->set_active_line(co,
-                       *(TelCallActiveLine *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_GET_ACTIVE_LINE:
-               if(po->ops->get_active_line)
-                       return po->ops->get_active_line(co,
-                       cb, (void *) user_data);
-               break;
-       case TCORE_COMMAND_CALL_SET_VOLUME_INFO:
-               if(po->ops->set_volume_info)
-                       return po->ops->set_volume_info(co,
-                       (const TelCallVolumeInfo *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_GET_VOLUME_INFO:
-               if(po->ops->get_volume_info)
-                       return po->ops->get_volume_info(co,
-                       *(TelCallSoundDevice *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_SET_SOUND_PATH:
-               if(po->ops->set_sound_path)
-                       return po->ops->set_sound_path(co,
-                       (const TelCallSoundPathInfo *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_SET_MUTE:
-               if(po->ops->set_mute)
-                       return po->ops->set_mute(co,
-                       *(gboolean *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_GET_MUTE_STATUS:
-               if(po->ops->get_mute_status)
-                       return po->ops->get_mute_status(co,
-                       cb, (void *) user_data);
-               break;
-       case TCORE_COMMAND_CALL_SET_SOUND_RECORDING:
-               if(po->ops->set_sound_recording)
-                       return po->ops->set_sound_recording(co,
-                       *(TelCallSoundRecording *)request, cb, (void *)user_data);
-               break;
-       case TCORE_COMMAND_CALL_SET_SOUND_EQUALIZATION:
-               if(po->ops->set_sound_equalization)
-                       return po->ops->set_sound_equalization(co,
-                       (const TelCallSoundEqualization *)request, cb, (void *)user_data);
-               break;
-       default:
-               err("Invalid Command");
-               return TEL_RETURN_INVALID_PARAMETER;
+               case TREQ_CALL_ACTIVE:
+                       _check_null( "po->ops->active", po->ops->active, TCORE_RETURN_FAILURE);
+                       return po->ops->active(o, ur);
+
+               case TREQ_CALL_SWAP:
+                       _check_null( "po->ops->swap", po->ops->swap, TCORE_RETURN_FAILURE);
+                       return po->ops->swap(o, ur);
+
+               case TREQ_CALL_JOIN:
+                       _check_null( "po->ops->join", po->ops->join, TCORE_RETURN_FAILURE);
+                       return po->ops->join(o, ur);
+
+               case TREQ_CALL_SPLIT:
+                       _check_null( "po->ops->split", po->ops->split, TCORE_RETURN_FAILURE);
+                       return po->ops->split(o, ur);
+
+               case TREQ_CALL_DEFLECT:
+                       _check_null( "po->ops->deflect", po->ops->deflect, TCORE_RETURN_FAILURE);
+                       return po->ops->deflect(o, ur);
+
+               case TREQ_CALL_TRANSFER:
+                       _check_null( "po->ops->transfer", po->ops->transfer, TCORE_RETURN_FAILURE);
+                       return po->ops->transfer(o, ur);
+
+               case TREQ_CALL_START_CONT_DTMF:
+                       _check_null( "po->ops->start_cont_dtmf", po->ops->start_cont_dtmf, TCORE_RETURN_FAILURE);
+                       return po->ops->start_cont_dtmf(o, ur);
+
+               case TREQ_CALL_STOP_CONT_DTMF:
+                       _check_null( "po->ops->stop_cont_dtmf", po->ops->stop_cont_dtmf, TCORE_RETURN_FAILURE);
+                       return po->ops->stop_cont_dtmf(o, ur);
+
+               case TREQ_CALL_SEND_BURST_DTMF:
+                       _check_null( "po->ops->send_burst_dtmf", po->ops->send_burst_dtmf, TCORE_RETURN_FAILURE);
+                       return po->ops->send_burst_dtmf(o, ur);
+
+               case TREQ_CALL_GET_PRIVACY_MODE:
+                       _check_null( "po->ops->get_privacy_mode", po->ops->get_privacy_mode, TCORE_RETURN_FAILURE);
+                       return po->ops->get_privacy_mode(o, ur);
+
+               case TREQ_CALL_SET_PRIVACY_MODE:
+                       _check_null( "po->ops->set_privacy_mode", po->ops->set_privacy_mode, TCORE_RETURN_FAILURE);
+                       return po->ops->set_privacy_mode(o, ur);
+
+               case TREQ_CALL_SET_SOUND_PATH:
+                       _check_null( "po->ops->set_sound_path", po->ops->set_sound_path, TCORE_RETURN_FAILURE);
+                       return po->ops->set_sound_path(o, ur);
+
+               case TREQ_CALL_GET_SOUND_VOLUME_LEVEL:
+                       _check_null( "po->ops->get_sound_volume_level", po->ops->get_sound_volume_level, TCORE_RETURN_FAILURE);
+                       return po->ops->get_sound_volume_level(o, ur);
+
+               case TREQ_CALL_SET_SOUND_VOLUME_LEVEL:
+                       _check_null( "po->ops->set_sound_volume_level", po->ops->set_sound_volume_level, TCORE_RETURN_FAILURE);
+                       return po->ops->set_sound_volume_level(o, ur);
+
+               case TREQ_CALL_SET_SOUND_MUTE_STATUS:
+                       _check_null( "po->ops->set_sound_mute_status", po->ops->set_sound_mute_status, TCORE_RETURN_FAILURE);
+                       return po->ops->set_sound_mute_status(o, ur);
+
+               case TREQ_CALL_GET_SOUND_MUTE_STATUS:
+                       _check_null( "po->ops->get_sound_mute_status", po->ops->get_sound_mute_status, TCORE_RETURN_FAILURE);
+                       return po->ops->get_sound_mute_status(o, ur);
+
+               case TREQ_CALL_SET_SOUND_RECORDING:
+                       _check_null( "po->ops->set_sound_recording", po->ops->set_sound_recording, TCORE_RETURN_FAILURE);
+                       return po->ops->set_sound_recording(o, ur);
+
+               case TREQ_CALL_SET_SOUND_EQUALIZATION:
+                       _check_null( "po->ops->set_sound_equalization", po->ops->set_sound_equalization, TCORE_RETURN_FAILURE);
+                       return po->ops->set_sound_equalization(o, ur);
+
+               case TREQ_CALL_SET_SOUND_NOISE_REDUCTION:
+                       _check_null( "po->ops->set_sound_noise_reduction", po->ops->set_sound_noise_reduction, TCORE_RETURN_FAILURE);
+                       return po->ops->set_sound_noise_reduction(o, ur);
+
+               case TREQ_CALL_SET_SOUND_CLOCK_STATUS:
+                       _check_null( "po->ops->set_sound_clock_status", po->ops->set_sound_clock_status, TCORE_RETURN_FAILURE);
+                       return po->ops->set_sound_clock_status(o, ur);
+
+               case TREQ_CALL_SET_PREFERRED_VOICE_SUBSCRIPTION:
+                       _check_null( "po->ops->set_preferred_voice_subscription", po->ops->set_preferred_voice_subscription, TCORE_RETURN_FAILURE);
+                       return po->ops->set_preferred_voice_subscription(o, ur);
+
+               case TREQ_CALL_GET_PREFERRED_VOICE_SUBSCRIPTION:
+                       _check_null( "po->ops->get_preferred_voice_subscription", po->ops->get_preferred_voice_subscription, TCORE_RETURN_FAILURE);
+                       return po->ops->get_preferred_voice_subscription(o, ur);
+
+               default:
+                       break;
        }
-       err("Operation NOT Permitted");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-static void _po_free_hook(CoreObject *co)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *po;
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return;
 
        g_slist_free_full(po->cobjs, g_free);
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+       g_free(po);
+
+       tcore_object_link_object(o, NULL);
 }
 
-static CallObject *_find_object(GSList *objs, void  *data, TcoreCompareCallObject compare)
+typedef gboolean(*func)(struct call_object* co, void *data);
+static struct call_object *_find_object(GSList *objs, void* data, func compare)
 {
+       struct call_object *co = 0;
+       GSList *l = 0;
 
-       GSList *list = objs;
+       _check_null( "objs", objs, 0);
+       _check_null( "compare", compare, 0);
 
-       tcore_check_return_value(list != NULL, NULL);
-       tcore_check_return_value_assert(compare != NULL, NULL);
+       l = objs;
+       while (l) {
+               co = (struct call_object*) l->data;
 
-       while (list) {
-               CallObject *call_obj = (CallObject *) list->data;
-               if (compare(call_obj, data))
-                       return call_obj;
+               if (compare(co, data))
+                       return co;
 
-               list = g_slist_next(list);
+               l = g_slist_next( l );
        }
+
        return NULL;
 }
 
-static GSList *_find_object_all(GSList *objs, void  *data, TcoreCompareCallObject compare)
+static GSList* _find_object_all(GSList *objs, void* data, func compare)
 {
+       struct call_object *co = 0;
+       GSList *l = 0;
+       GSList *ret = 0;
 
-       GSList *list = objs;
-       GSList *obj_list = NULL;
+       _check_null( "objs", objs, 0);
+       _check_null( "compare", compare, 0);
 
-       tcore_check_return_value(list != NULL, NULL);
-       tcore_check_return_value_assert(compare != NULL, NULL);
+       l = objs;
+       while (l) {
+               co = (struct call_object*) l->data;
 
-       while (list) {
-               CallObject *call_obj = (CallObject *) list->data;
+               if (compare(co, data))
+                       ret = g_slist_append(ret, co);
 
-               if (compare(call_obj, data))
-                       obj_list = g_slist_append(obj_list, call_obj);
-
-               list = g_slist_next(list);
+               l = g_slist_next( l );
        }
 
-       return obj_list;
+       return ret;
 }
 
-static gboolean _compare_by_id(CallObject *call_obj, void *data)
+static gboolean _compare_by_id(struct call_object* co, void *data)
 {
+       unsigned int *id = (unsigned int*) data;
 
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(data != NULL, FALSE);
+       _check_null( "co", co, FALSE);
+       _check_null( "data", data, FALSE);
 
-       if (call_obj->call_id == *(unsigned int*) data)
+       if (co->id == *id)
                return TRUE;
 
        return FALSE;
 }
 
-static gboolean _compare_by_status(CallObject *call_obj, void *data)
+static gboolean _compare_by_session_id(struct call_object *co, void *data)
 {
+       int *session_id = data;
 
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(data != NULL, FALSE);
+       _check_null("co", co, FALSE);
+       _check_null("data", data, FALSE);
 
-       if (call_obj->call_state == *(TelCallState *) data)
+       if (co->session_id == *session_id)
                return TRUE;
 
        return FALSE;
 }
 
-static gboolean _compare_by_number(CallObject *call_obj, void *data)
+static gboolean _compare_by_status(struct call_object* co, void *data)
 {
+       enum tcore_call_status *ct = (enum tcore_call_status*) data;
 
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(data != NULL, FALSE);
+       _check_null( "co", co, FALSE);
+       _check_null( "data", data, FALSE);
 
-       if (0 == g_strcmp0(call_obj->number, (char *)data))
+       if (co->status == *ct)
                return TRUE;
 
        return FALSE;
 }
 
-static gboolean _check_cli_mode_by_number(
-       char num[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1],
-       TelCallCliValidity *cli_validity)
+static gboolean _compare_by_number(struct call_object* co, void *data)
 {
-       tcore_check_return_value_assert(cli_validity != NULL, FALSE);
+       char *number = (char*) data;
 
-       if (0 == strncmp(num, "*31#", 4))
-                *cli_validity = TEL_CALL_CLI_VALIDITY_VALID;
-       else if (0 == strncmp(num, "#31#", 4))
-               *cli_validity = TEL_CALL_CLI_VALIDITY_WITHHELD;
-       else
-               *cli_validity = TEL_CALL_CLI_VALIDITY_NOT_AVAILABLE;
+       _check_null( "co", co, FALSE);
+       _check_null( "data", data, FALSE);
 
-       return TRUE;
+       if (!strcmp(co->cli.number, number))
+               return TRUE;
+
+       return FALSE;
 }
 
-/* Call Object API */
-CallObject *tcore_call_object_new(CoreObject *co, unsigned int call_id)
+static enum tcore_call_cli_mode _check_cli_mode_by_number(char *num)
 {
-       PrivateObject *po;
-       CallObject *call_obj;
-       unsigned int my_call_id;
+       _check_null( "num", num, TCORE_CALL_CLI_MODE_DEFAULT);
+
+       if (!strncmp(num, "*31#", 4))
+               return TCORE_CALL_CLI_MODE_PRESENT;
+
+       if (!strncmp(num, "#31#", 4))
+               return TCORE_CALL_CLI_MODE_RESTRICT;
+
+       return TCORE_CALL_CLI_MODE_DEFAULT;
+}
+
+
+// Call Object API
+
+struct call_object *tcore_call_object_new(CoreObject *o, int id)
+{
+       struct private_object_data *po = 0;
+       struct call_object *co = 0;
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, 0);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
+       co = g_new0( struct call_object, 1 );
 
-       if (call_id > 0) {
-               if (NULL == _find_object(po->cobjs, (void *)&call_id,
-                       (TcoreCompareCallObject)_compare_by_id)) {
-                       my_call_id = call_id;
-               } else {
-                       warn(" call object exist already. [ %d ]", call_id);
+       if (id > 0) {
+               if (!_find_object(po->cobjs, (void*) &id, (void*) _compare_by_id))
+                       co->id = id;
+               else {
+                       dbg("[ error ] call object exist already. [ %d ]", id);
+                       g_free(co);
                        return NULL;
                }
-       } else {
-               unsigned int i;
-               for (i = 1; i <= MAX_CALL_OBJECTS; i++) {       /* Presently 6 is MAX call count */
-                       if (NULL == _find_object(po->cobjs, (void *)&i,
-                               (TcoreCompareCallObject) _compare_by_id)) {
-                               my_call_id = i;
+       }
+       else {
+               int i = 0;
+
+               for (i = 1; i <= MAX_CALL_OBJECTS; i++) {       /* 6 is MAX call count */
+                       if (!_find_object(po->cobjs, (void*) &i, (void*) _compare_by_id)) {
+                               co->id = i;
                                break;
                        }
                }
-               /* Free the allocated Core Object if ID is not allocated */
-               if(i > MAX_CALL_OBJECTS) {
-                       err("failed to assign call id");
+
+                /* Free the allocated Core Object if ID is not allocated */
+               if (i > MAX_CALL_OBJECTS) {
+                       err("[ error ] failed to assign call id");
+                       g_free(co);
                        return NULL;
                }
        }
 
-       call_obj = tcore_malloc0(sizeof(CallObject));
-       call_obj->call_id = my_call_id;
-       /* Appending the new Call object to Call Objects list */
-       po->cobjs = g_slist_append(po->cobjs, call_obj);
-       dbg("new call object id : [%d]", call_obj->call_id);
+       po->cobjs = g_slist_append(po->cobjs, co);
 
-       return call_obj;
+       dbg("new call object id : [%d]", co->id);
+
+       return co;
 }
 
-void tcore_call_object_free(CoreObject *co, CallObject *call_obj)
+gboolean tcore_call_object_free(CoreObject *o, struct call_object *co)
 {
-       PrivateObject *po;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->cobjs != NULL);
-       tcore_check_return_assert(call_obj != NULL);
+       _check_null( "po", po, FALSE);
+       _check_null( "po->cobjs", po->cobjs, FALSE);
+       _check_null( "co", co, FALSE);
 
-       po->cobjs = g_slist_remove(po->cobjs, call_obj);
-       dbg("Freeing call core object");
-       tcore_free(call_obj);
+       po->cobjs = g_slist_remove(po->cobjs, co);
+       g_free(co);
+
+       return TRUE;
 }
 
-gboolean tcore_call_object_get_count(CoreObject *co, unsigned int *count)
+int tcore_call_object_total_length( CoreObject *o )
 {
-       PrivateObject *po = NULL;
-
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, FALSE);
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(count != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       *count = g_slist_length(po->cobjs);
+       _check_null( "po", po, FALSE);
+       _check_null( "po->cobjs", po->cobjs, FALSE);
 
-       return TRUE;
+       return (int)g_slist_length(po->cobjs);
 }
 
-CallObject *tcore_call_object_current_on_mt_processing(CoreObject *co)
+struct call_object *tcore_call_object_current_on_mt_processing(CoreObject *o)
 {
-       PrivateObject *po;
-       CallObject *call_obj = NULL;
-       TelCallState call_state = TEL_CALL_STATE_INCOMING;
+       struct private_object_data *po = NULL;
+       struct call_object *call_obj = NULL;
+       GSList *l = 0;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
+       enum tcore_call_status cs = CALL_STATUS_INCOMING;
+       po = tcore_object_ref_object(o);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
-       tcore_check_return_value_assert(po->cobjs != NULL, NULL);
+       _check_null( "po", po, 0);
+       _check_null( "po->cobjs", po->cobjs, 0);
 
-       call_obj = _find_object(po->cobjs, (void *)&call_state,
-               (TcoreCompareCallObject)_compare_by_status);
-       if (NULL == call_obj) {
-               call_state = TEL_CALL_STATE_WAITING;
-               call_obj = _find_object(po->cobjs, (void *) &call_state,
-                               (TcoreCompareCallObject)_compare_by_status);
-               if (NULL == call_obj) {
-                       err("no mt call object available");
-                       return NULL;
-               }
+       l = _find_object_all(po->cobjs, (void*) &cs, (void*) _compare_by_status);
+       if (!l) {
+               cs = CALL_STATUS_WAITING;
+               l = _find_object_all(po->cobjs, (void*) &cs, (void*) _compare_by_status);
+               if (!l)
+                       return 0;
        }
+
+       call_obj = (struct call_object*) l ->data;
+       g_slist_free(l);
        return call_obj;
 }
 
-CallObject *tcore_call_object_current_on_mo_processing(CoreObject *co)
+struct call_object *tcore_call_object_current_on_mo_processing(CoreObject *o)
 {
-       PrivateObject *po;
-       CallObject *call_obj = NULL;
-       TelCallState call_state = TEL_CALL_STATE_DIALING;
+       struct private_object_data *po = NULL;
+       struct call_object *call_obj = NULL;
+       GSList *l = 0;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
+       enum tcore_call_status cs = CALL_STATUS_DIALING;
+       po = tcore_object_ref_object(o);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
-       tcore_check_return_value_assert(po->cobjs != NULL, NULL);
+       _check_null( "po", po, 0);
+       _check_null( "po->cobjs", po->cobjs, 0);
 
-       call_obj = _find_object(po->cobjs, (void *)&call_state,
-               (TcoreCompareCallObject) _compare_by_status);
-       if (NULL == call_obj) {
-               call_state = TEL_CALL_STATE_ALERT;
-               call_obj = _find_object(po->cobjs, (void *)&call_state,
-                       (TcoreCompareCallObject) _compare_by_status);
-               if (NULL == call_obj) {
-                       err("no mo call object available");
-                       return NULL;
-               }
+       l = _find_object_all(po->cobjs, (void*) &cs, (void*) _compare_by_status);
+       if (!l) {
+               cs = CALL_STATUS_ALERT;
+               l = _find_object_all(po->cobjs, (void*) &cs, (void*) _compare_by_status);
+               if (!l)
+                       return 0;
        }
+
+       call_obj = (struct call_object*) l ->data;
+       g_slist_free(l);
        return call_obj;
 }
 
-CallObject *tcore_call_object_find_by_id(CoreObject *co, unsigned int call_id)
+struct call_object *tcore_call_object_find_by_id(CoreObject *o, int id)
 {
-       PrivateObject *po;
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, 0);
+       _check_null( "po->cobjs", po->cobjs, 0);
 
-       return _find_object(po->cobjs, (void *)&call_id,
-               (TcoreCompareCallObject) _compare_by_id);
+       return _find_object(po->cobjs, (void*) &id, (void*) _compare_by_id);
 }
 
-CallObject *tcore_call_object_find_by_number(CoreObject *co,
-       const char num[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1])
+struct call_object *tcore_call_object_find_by_number(CoreObject *o, char *num)
 {
-       PrivateObject *po;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
+       po = tcore_object_ref_object(o);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
+       _check_null( "po", po, 0);
+       _check_null( "po->cobjs", po->cobjs, 0);
+       _check_null( "num", num, 0);
 
-       return _find_object(po->cobjs, (void *)num,
-               (TcoreCompareCallObject)_compare_by_number);
+       return _find_object(po->cobjs, (void*) num, (void*) _compare_by_number);
 }
 
-GSList *tcore_call_object_find_by_status(CoreObject *co, TelCallState call_state)
+GSList* tcore_call_object_find_by_status(CoreObject *o, enum tcore_call_status cs)
 {
-       PrivateObject *po;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
+       po = tcore_object_ref_object(o);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
+       _check_null( "po", po, 0);
+       _check_null( "po->cobjs", po->cobjs, 0);
 
-       return _find_object_all(po->cobjs, (void *) &call_state,
-                       (void *) _compare_by_status);
+       return _find_object_all(po->cobjs, (void*) &cs, (void*) _compare_by_status);
 }
 
-gboolean tcore_call_object_get_id(CallObject *call_obj, unsigned int *call_id)
+int tcore_call_object_get_id(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(call_id != NULL, FALSE);
+       _check_null( "co", co, -1);
 
-       *call_id = call_obj->call_id;
-       return TRUE;
+       return co->id;
 }
 
-gboolean tcore_call_object_set_type(CallObject *call_obj, TelCallType call_type)
+gboolean tcore_call_object_set_type(struct call_object *co, enum tcore_call_type ct)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
+       _check_null( "co", co, FALSE);
 
-       call_obj->call_type = call_type;
+       co->type = ct;
        return TRUE;
 }
 
-gboolean tcore_call_object_get_call_type(CallObject *call_obj, TelCallType *call_type)
+enum tcore_call_type tcore_call_object_get_type(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(call_type != NULL, FALSE);
+       _check_null( "co", co, -1);
 
-       *call_type = call_obj->call_type;
-       return TRUE;
+       return co->type;
 }
 
-gboolean tcore_call_object_set_direction(CallObject *call_obj, gboolean mo_call)
+gboolean tcore_call_object_set_direction(struct call_object *co, enum tcore_call_direction cd)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
+       _check_null( "co", co, FALSE);
 
-       call_obj->mo_call = mo_call;
+       co->direction = cd;
        return TRUE;
 }
 
-gboolean tcore_call_object_get_direction(CallObject *call_obj, gboolean *mo_call)
+enum tcore_call_direction tcore_call_object_get_direction(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(mo_call != NULL, FALSE);
+       _check_null( "co", co, -1);
 
-       *mo_call = call_obj->mo_call;
-       return TRUE;
+       return co->direction;
 }
 
-gboolean tcore_call_object_set_state(CallObject *call_obj, TelCallState call_state)
+gboolean tcore_call_object_set_status(struct call_object *co, enum tcore_call_status cs)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
+       _check_null( "co", co, FALSE);
 
-       call_obj->call_state = call_state;
+       co->status = cs;
        return TRUE;
 }
 
-gboolean tcore_call_object_get_state(CallObject *call_obj, TelCallState *call_state)
+enum tcore_call_status tcore_call_object_get_status(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(call_state != NULL, FALSE);
+       _check_null( "co", co, -1);
 
-       *call_state = call_obj->call_state;
-       return TRUE;
+       return co->status;
 }
 
-gboolean tcore_call_object_set_cli_info(CallObject *call_obj,
-               TelCallCliValidity cli_validity, char *num)
+gboolean tcore_call_object_set_cli_info(struct call_object *co,
+                                               enum tcore_call_cli_mode mode, enum tcore_call_no_cli_cause cause,
+                                               char *num, int num_len)
 {
-       char *pos;
-       tcore_check_return_value(call_obj != NULL, FALSE);
+       char *pos = 0;
+
+       _check_null( "co", co, FALSE);
+
+       dbg("num  : %s", num);
+       dbg("mode : 0x%x", mode);
+
+       if (!num) {
+               co->cli.mode = mode;
+               if (mode == TCORE_CALL_CLI_MODE_RESTRICT)
+                       co->cli.no_cli_cause = cause;
+               else
+                       co->cli.no_cli_cause = TCORE_CALL_NO_CLI_CAUSE_NONE;
+
+               co->cli.number_len = num_len ;
+               co->cli.number [0] = '\0';
 
-       if (NULL == num) {
-               call_obj->cli_validity = cli_validity;
                return TRUE;
        }
-       dbg("num  : %s, cli_validity:%d", num, cli_validity);
+
        pos = num;
-       if (TEL_CALL_CLI_VALIDITY_NOT_AVAILABLE == cli_validity) {
 
-               _check_cli_mode_by_number(num, &(call_obj->cli_validity));
+       if (mode == TCORE_CALL_CLI_MODE_DEFAULT) {
+               co->cli.mode = _check_cli_mode_by_number(num);
 
-               if (call_obj->cli_validity != TEL_CALL_CLI_VALIDITY_NOT_AVAILABLE)
+               if (co->cli.mode != TCORE_CALL_CLI_MODE_DEFAULT)
                        pos = (num + 4);
-       } else {
-               call_obj->cli_validity  = cli_validity;
        }
+       else {
+               co->cli.mode = mode;
+               if (mode == TCORE_CALL_CLI_MODE_RESTRICT)
+                       co->cli.no_cli_cause = cause;
+               else
+                       co->cli.no_cli_cause = TCORE_CALL_NO_CLI_CAUSE_NONE;
+       }
+
+       strncpy(co->cli.number, pos, ((num_len - (pos - num)) + 1));
+       co->cli.number_len = strlen(co->cli.number);
+
+       dbg("co->cli.mode: [0x%x]", co->cli.mode);
+       dbg("co->cli.no_cli_cause: [0x%x]", co->cli.no_cli_cause);
+       dbg("co->cli.number: [%s]", co->cli.number);
+       dbg("co->cli.number_len: [%d]", co->cli.number_len);
 
-       g_strlcpy(call_obj->number, pos,  TEL_CALL_CALLING_NAME_LEN_MAX + 1);
-       dbg("co->cli_validity: %d ,co->number : %s",
-               call_obj->cli_validity, call_obj->number);
        return TRUE;
 }
 
-gsize tcore_call_object_get_number(CallObject *call_obj,
-       char num[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1])
+int tcore_call_object_get_number(struct call_object *co, char *num)
 {
-       tcore_check_return_value(call_obj != NULL, 0);
+       _check_null( "co", co, -1);
+       _check_null( "num", num, -1);
 
-       return g_strlcpy(num, call_obj->number,
-               TEL_CALL_CALLING_NUMBER_LEN_MAX + 1);
+       strncpy(num, co->cli.number, MAX_CALL_NUMBER_LEN);
+       return co->cli.number_len;
 }
 
-gboolean tcore_call_object_get_cli_validity(CallObject *call_obj,
-       TelCallCliValidity *cli_validity)
+enum tcore_call_cli_mode tcore_call_object_get_cli_mode(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       *cli_validity = call_obj->cli_validity;
-       return TRUE;
+       _check_null( "co", co, -1);
+       return co->cli.mode;
 }
 
-gboolean tcore_call_object_set_cni_info(CallObject *call_obj,
-       TelCallCniValidity cni_validity,
-       char name[TEL_CALL_CALLING_NAME_LEN_MAX + 1])
+enum tcore_call_no_cli_cause tcore_call_object_get_no_cli_cause(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
+       _check_null( "co", co, -1);
+       return co->cli.no_cli_cause;
+}
+
+
+gboolean tcore_call_object_set_cna_info(struct call_object *co, enum tcore_call_cna_mode mode, char *name, int dcs)
+{
+       int len;
+       _check_null( "co", co, FALSE);
+       _check_null( "name", name, FALSE);
+
+       len = strlen(name);
+       if (len >= MAX_CALL_NAME_LEN)
+               return FALSE;
+
+       strncpy(co->cna.name, name, len);
+       co->cna.name[len] = '\0';
+
+       co->cna.mode = mode;
 
-       g_strlcpy(call_obj->name, name,  TEL_CALL_CALLING_NAME_LEN_MAX + 1);
-       call_obj->cni_validity = cni_validity;
        return TRUE;
 }
 
-gsize tcore_call_object_get_name(CallObject *call_obj,
-       char name[TEL_CALL_CALLING_NAME_LEN_MAX + 1])
+int tcore_call_object_get_name(struct call_object *co, char *name)
 {
-       tcore_check_return_value(call_obj != NULL, 0);
+       _check_null( "co", co, -1);
+       _check_null( "name", name, -1);
 
-       return g_strlcpy(name, call_obj->name,
-               TEL_CALL_CALLING_NAME_LEN_MAX + 1);
+       strncpy(name, co->cna.name, MAX_CALL_NAME_LEN);
+       return co->cna.name_len;
 }
 
-gboolean tcore_call_object_get_cni_validity(CallObject *call_obj,
-       TelCallCniValidity *cni_validity)
+enum tcore_call_cna_mode tcore_call_object_get_cna_mode(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(cni_validity != NULL, FALSE);
+       _check_null( "co", co, -1);
 
-       *cni_validity = call_obj->cni_validity;
-       return TRUE;
+       return co->cna.mode;
 }
 
-gboolean tcore_call_object_set_multiparty_state (CallObject *call_obj,
-       gboolean mpty_state)
+gboolean tcore_call_object_set_multiparty_state(struct call_object *co, gboolean is)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       call_obj->mpty = mpty_state;
+       _check_null( "co", co, FALSE);
+
+       co->mpty = is;
        return TRUE;
 }
 
-gboolean tcore_call_object_get_multiparty_state(CallObject *call_obj,
-       gboolean *mpty_state)
+gboolean tcore_call_object_get_multiparty_state(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(mpty_state != NULL, FALSE);
+       _check_null( "co", co, FALSE);
 
-       *mpty_state = call_obj->mpty;
+       return co->mpty;
+}
+
+gboolean tcore_call_object_set_active_line(struct call_object *co, unsigned int line)
+{
+       _check_null( "co", co, FALSE);
+
+       co->active_line = line;
        return TRUE;
 }
 
-gboolean tcore_call_object_set_mt_forward (CallObject *call_obj,
-       gboolean forward)
+int tcore_call_object_get_active_line(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
+       _check_null( "co", co, -1);
 
-       call_obj->forward = forward;
+       return co->active_line;
+}
+
+gboolean tcore_call_object_set_is_volte_call(struct call_object *co, gboolean flag)
+{
+       _check_null( "co", co, FALSE);
+
+       co->is_volte_call = flag;
        return TRUE;
 }
 
-gboolean tcore_call_object_get_mt_forward(CallObject *call_obj,
-       gboolean *forward)
+gboolean tcore_call_object_get_is_volte_call(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(forward != NULL, FALSE);
+       _check_null( "co", co, FALSE);
+
+       return co->is_volte_call;
+}
 
-       *forward = call_obj->forward;
+gboolean tcore_call_object_set_session_id(struct call_object *co, int session_id)
+{
+       _check_null( "co", co, FALSE);
+
+       co->session_id = session_id;
        return TRUE;
 }
 
-gboolean tcore_call_object_set_active_line(CallObject *call_obj,
-       TelCallActiveLine active_line)
+int tcore_call_object_get_session_id(struct call_object *co)
+{
+       _check_null( "co", co, FALSE);
+
+       return co->session_id;
+}
+
+gboolean tcore_call_object_set_conf_call_session_id(struct call_object *co, int session_id)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
+       _check_null( "co", co, FALSE);
 
-       call_obj->active_line = active_line;
+       co->conf_call_session_id = session_id;
        return TRUE;
 }
 
-gboolean tcore_call_object_get_active_line(CallObject *call_obj,
-       TelCallActiveLine *active_line)
+gboolean tcore_call_object_get_conf_call_session_id(struct call_object *co)
 {
-       tcore_check_return_value(call_obj != NULL, FALSE);
-       tcore_check_return_value_assert(active_line != NULL, FALSE);
+       _check_null( "co", co, FALSE);
+
+       return co->conf_call_session_id;
+}
 
-       *active_line = call_obj->active_line;
+gboolean tcore_call_object_set_early_media(struct call_object *co, gboolean flag)
+{
+       _check_null( "co", co, FALSE);
+
+       co->early_media = flag;
        return TRUE;
 }
 
-void tcore_call_override_ops(CoreObject *o, TcoreCallOps *call_ops)
+gboolean tcore_call_object_get_early_media(struct call_object *co)
 {
-       PrivateObject *po;
+       _check_null( "co", co, FALSE);
+
+       return co->early_media;
+}
+
+struct call_object *tcore_call_object_find_by_session_id(CoreObject *o, int session_id)
+{
+       struct private_object_data *po = NULL;
        po = tcore_object_ref_object(o);
 
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(call_ops != NULL);
+       _check_null( "po", po, 0);
+       _check_null( "po->cobjs", po->cobjs, 0);
 
-       if (call_ops->dial)
-               po->ops->dial = call_ops->dial;
+       return _find_object(po->cobjs, &session_id, _compare_by_session_id);
+}
 
-       if (call_ops->answer)
-               po->ops->answer = call_ops->answer;
+gboolean tcore_call_object_check_cs_call_existence(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       struct call_object *call_obj = NULL;
+       GSList *call_list = NULL;
 
-       if (call_ops->end)
-               po->ops->end = call_ops->end;
+       po = tcore_object_ref_object(o);
+       _check_null("po", po, FALSE);
+
+       call_list = po->cobjs;
+       while (call_list) {
+               call_obj = call_list->data;
+               if (call_obj->is_volte_call == FALSE)
+                       return TRUE;
+               call_list = g_slist_next(call_list);
+       }
+       return FALSE;
+}
 
-       if (call_ops->send_dtmf)
-               po->ops->send_dtmf = call_ops->send_dtmf;
+GSList *tcore_call_object_get_all_session_ids(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       struct call_object *call_obj = NULL;
+       GSList *call_list = NULL;
+       GSList *session_ids = NULL;
 
-       if (call_ops->hold)
-               po->ops->hold = call_ops->hold;
+       po = tcore_object_ref_object(o);
+       _check_null("po", po, FALSE);
 
-       if (call_ops->active)
-               po->ops->active = call_ops->active;
+       call_list = po->cobjs;
+       while (call_list) {
+               call_obj = call_list->data;
+               if (call_obj->is_volte_call == TRUE)
+                       session_ids = g_slist_append(session_ids, (gpointer)call_obj->session_id);
 
-       if (call_ops->swap)
-               po->ops->swap = call_ops->swap;
+               call_list = g_slist_next(call_list);
+       }
 
-       if (call_ops->join)
-               po->ops->join = call_ops->join;
+       return session_ids;
+}
 
-       if (call_ops->split)
-               po->ops->split = call_ops->split;
+TReturn tcore_call_control_answer_hold_and_accept(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       if (call_ops->transfer)
-               po->ops->transfer = call_ops->transfer;
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
 
-       if (call_ops->deflect)
-               po->ops->deflect = call_ops->deflect;
+       return po->cops->answer_hold_and_accept(o, ur, cb, user_data);
+}
 
-       if (call_ops->set_active_line)
-               po->ops->set_active_line = call_ops->set_active_line;
+TReturn tcore_call_control_answer_replace(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       if (call_ops->get_active_line)
-               po->ops->get_active_line = call_ops->get_active_line;
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
 
-       if (call_ops->set_volume_info)
-               po->ops->set_volume_info = call_ops->set_volume_info;
+       return po->cops->answer_replace(o, ur, cb, user_data);
+}
 
-       if (call_ops->get_volume_info)
-               po->ops->get_volume_info = call_ops->get_volume_info;
+TReturn tcore_call_control_answer_reject(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       if (call_ops->set_sound_path)
-               po->ops->set_sound_path = call_ops->set_sound_path;
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
 
-       if (call_ops->set_mute)
-               po->ops->set_mute = call_ops->set_mute;
+       return po->cops->answer_reject(o, ur, cb, user_data);
+}
 
-       if (call_ops->get_mute_status)
-               po->ops->get_mute_status = call_ops->get_mute_status;
+TReturn tcore_call_control_end_specific(CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb,
+               void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       if (call_ops->set_sound_recording)
-               po->ops->set_sound_recording = call_ops->set_sound_recording;
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
 
-       if (call_ops->set_sound_equalization)
-               po->ops->set_sound_equalization = call_ops->set_sound_equalization;
+       return po->cops->end_specific(o, ur, id, cb, user_data);
 }
 
-gboolean tcore_call_set_ops(CoreObject *co, TcoreCallOps *ops)
+TReturn tcore_call_control_end_all_active(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
-       }
+       return po->cops->end_all_active(o, ur, cb, user_data);
+}
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreCallOps));
+TReturn tcore_call_control_end_all_held(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       return TRUE;
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
+
+       return po->cops->end_all_held(o, ur, cb, user_data);
 }
 
-CoreObject *tcore_call_new(TcorePlugin *p, TcoreCallOps *ops, TcoreHal *hal)
+TReturn tcore_call_control_active(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
 {
-       CoreObject *co;
-       PrivateObject *po;
-       tcore_check_return_value_assert(p != NULL, NULL);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
 
-       po = tcore_malloc0(sizeof(PrivateObject));
+       return po->cops->active(o, ur, cb, user_data);
+}
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreCallOps));
+TReturn tcore_call_control_hold(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_CALL);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
 
-       return co;
+       return po->cops->hold(o, ur, cb, user_data);
+}
+
+TReturn tcore_call_control_swap(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
+
+       return po->cops->swap(o, ur, cb, user_data);
+}
+
+TReturn tcore_call_control_join(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
+
+       return po->cops->join(o, ur, cb, user_data);
+}
+
+TReturn tcore_call_control_split(CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
+
+       return po->cops->split(o, ur, id, cb, user_data);
+}
+
+TReturn tcore_call_control_transfer(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
+
+       return po->cops->transfer(o, ur, cb, user_data);
+}
+
+TReturn tcore_call_control_deflect(CoreObject* o, UserRequest* ur, const char* number, ConfirmCallback cb,
+               void* user_data)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
+
+       return po->cops->deflect(o, ur, number, cb, user_data);
+}
+
+void tcore_call_control_set_operations(CoreObject *o, struct tcore_call_control_operations *ops)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return;
+
+       po->cops = ops;
+}
+
+void tcore_call_information_mo_col(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, );
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_col(o, number);
+}
+
+void tcore_call_information_mo_waiting(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, );
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_waiting(o);
+}
+
+void tcore_call_information_mo_cug(CoreObject *o, int cug_index)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, );
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_cug(o, cug_index);
+}
+
+void tcore_call_information_mo_forwarded(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_forwarded(o);
+}
+
+void tcore_call_information_mo_barred_incoming(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_barred_incoming(o);
+}
+
+void tcore_call_information_mo_barred_outgoing(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_barred_outgoing(o);
+}
+
+void tcore_call_information_mo_deflected(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_deflected(o);
+}
+
+void tcore_call_information_mo_clir_suppression_reject(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_clir_suppression_reject(o);
+}
+
+void tcore_call_information_mo_cfu(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_cfu(o);
+}
+
+void tcore_call_information_mo_cfc(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mo_call_cfc(o);
+}
+
+void tcore_call_information_mt_cli(CoreObject *o, enum tcore_call_cli_mode mode, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po, );
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mt_call_cli(o, mode, number);
+}
+
+void tcore_call_information_mt_cna(CoreObject *o, enum tcore_call_cna_mode mode, char* name, int dcs)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mt_call_cna(o, mode, name, dcs);
+}
+
+void tcore_call_information_mt_forwarded_call(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mt_call_forwarded_call(o, number);
+}
+
+void tcore_call_information_mt_cug_call(CoreObject *o, int cug_index, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mt_call_cug_call(o, cug_index, number);
+}
+
+void tcore_call_information_mt_deflected_call(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mt_call_deflected_call(o, number);
+}
+
+void tcore_call_information_mt_transfered(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->mt_call_transfered(o, number);
+}
+
+void tcore_call_information_held(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->call_held(o, number);
+}
+
+void tcore_call_information_active(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->call_active(o, number);
+}
+
+void tcore_call_information_joined(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->call_joined(o, number);
+}
+
+void tcore_call_information_released_on_hold(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->call_released_on_hold(o, number);
+}
+
+void tcore_call_information_transfer_alert(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->call_transfer_alert(o, number);
+}
+
+void tcore_call_information_transfered(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->call_transfered(o, number);
+}
+
+void tcore_call_information_cf_check_ss_message(CoreObject *o, char* number)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+
+       _check_null( "po", po,);
+       _check_null( "po->iops", po->iops,);
+
+       po->iops->call_cf_check_message(o, number);
+}
+
+void tcore_call_information_set_operations(CoreObject *o, struct tcore_call_information_operations *ops)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return;
+
+       po->iops = ops;
+}
+
+CoreObject *tcore_call_new(TcorePlugin *p, const char *name, struct tcore_call_operations *ops, TcoreHal *hal)
+{
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
+
+       if (!p)
+               return NULL;
+
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = g_try_new0(struct private_object_data, 1);
+       if (po == NULL) {
+               tcore_object_free(o);
+               return NULL;
+       }
+
+       po->ops = ops;
+
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_CALL);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
+
+       return o;
 }
 
 void tcore_call_free(CoreObject *o)
@@ -751,3 +1315,17 @@ void tcore_call_free(CoreObject *o)
        CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
        tcore_object_free(o);
 }
+
+void tcore_call_set_ops(CoreObject *o, struct tcore_call_operations *ops)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
+
+       po->ops = ops;
+}
index 3364df8..80b8f84 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "tcore.h"
 #include "util.h"
 #include "plugin.h"
+#include "user_request.h"
 #include "co_context.h"
 
-#define DEVNAME_LEN_MAX 16
-
-typedef struct {
-       TcoreContextState state;
-       guint id;
-       TcoreContextRole role;
-
-       gchar *apn;
-       gchar *addr;
-       TcoreContextType type;
-       TcoreContextDComp d_comp;
-       TcoreContextHComp h_comp;
-
-       gchar *username;
-       gchar *password;
-       gchar *dns1;
-       gchar *dns2;
-       TcoreContextAuth auth;
-
-       TcoreIp4Type ip_v4;
-       TcoreIp4Type gateway_v4;
-       TcoreIp4Type dns_primary_v4;
-       TcoreIp4Type dns_secondary_v4;
-
-       /* IPv6 will be supported */
-
-       gchar *proxy;
-       gchar *mmsurl;
-       gchar *profile_name;
-       gchar devname[DEVNAME_LEN_MAX];
-} PrivateObject;
-
-static void __context_set_ipv4_atoi(guchar *ip4, const gchar *str)
-{
-       gchar *token = NULL;
-       gchar *temp = NULL;
-       guint index = 0;
-
-       temp = tcore_strdup(str);
-       token = strtok(temp, ".");
-       while (token != NULL) {
-               ip4[index++] = atoi(token);
-               msg("   [%c]", ip4[index-1]);
-               token = strtok(NULL, ".");
+struct private_object_data {
+       enum co_context_state state;
+       unsigned char id;
+       enum co_context_role role;
+       gboolean default_profile;
+       gboolean attach_apn;
+
+       char *apn;
+       char *addr;
+       enum co_context_type type;
+       enum co_context_d_comp d_comp;
+       enum co_context_h_comp h_comp;
+       enum co_context_tech tech_pref;
+       char *username;
+       char *password;
+       char *dns1;
+       char *dns2;
+       enum co_context_auth auth;
+
+       union tcore_ip4_type ip_v4;
+       union tcore_ip4_type gateway_v4;
+       union tcore_ip4_type dns_primary_v4;
+       union tcore_ip4_type dns_secondary_v4;
+
+       /*IPv6 will be supported*/
+       char* ip_v6;
+       char* gateway_v6;
+       char* dns_primary_v6;
+       char* dns_secondary_v6;
+
+       pcscf_addr *pcscf_ipv4;
+       pcscf_addr *pcscf_ipv6;
+
+       char *proxy;
+       char *mmsurl;
+       char *profile_name;
+       char devname[16];
+
+       /* Dedicated bearer information */
+       unsigned char dedicated_bearer_cnt;
+       struct dedicated_bearer_info dedicated_bearer[MAX_NUM_DEDICATED_BEARER];
+};
+
+static void _free_hook(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       po = tcore_object_ref_object(o);
+       if (po) {
+               free(po);
+               tcore_object_link_object(o, NULL);
        }
-       tcore_free(temp);
 }
 
-static void __po_free_hook(CoreObject *co)
+CoreObject *tcore_context_new(TcorePlugin *p, const char *name, TcoreHal *hal)
 {
-       PrivateObject *po = NULL;
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
+       if (!p)
+               return NULL;
+
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
+       }
 
-       tcore_free(po->apn);
-       tcore_free(po->addr);
-       tcore_free(po->username);
-       tcore_free(po->password);
-       tcore_free(po->dns1);
-       tcore_free(po->dns2);
-       tcore_free(po->proxy);
-       tcore_free(po->mmsurl);
-       tcore_free(po->profile_name);
-       tcore_free(po);
+       po->type = CONTEXT_TYPE_IP;
+       po->d_comp = CONTEXT_D_COMP_OFF;
+       po->h_comp = CONTEXT_H_COMP_OFF;
+       po->role = CONTEXT_ROLE_UNKNOWN;
+       po->auth = CONTEXT_AUTH_NONE;
+       po->tech_pref = CONTEXT_TECH_3GPP;
 
-       tcore_object_link_object(co, NULL);
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_PS_CONTEXT);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+
+       return o;
 }
 
-CoreObject *tcore_context_new(TcorePlugin *p, TcoreHal *hal)
+void tcore_context_free(CoreObject *o)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PS_CONTEXT);
+       tcore_object_free(o);
+}
 
-       tcore_check_return_value_assert(p != NULL, NULL);
+TReturn tcore_context_set_state(CoreObject *o, enum co_context_state state)
+{
+       struct private_object_data *po = NULL;
 
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_malloc0(sizeof(PrivateObject));
-       po->type = TCORE_CONTEXT_TYPE_IP;
-       po->d_comp = TCORE_CONTEXT_D_COMP_OFF;
-       po->h_comp = TCORE_CONTEXT_H_COMP_OFF;
-       po->role = TCORE_CONTEXT_ROLE_UNKNOWN;
-       po->auth = TCORE_CONTEXT_AUTH_NONE;
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_PS_CONTEXT);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, __po_free_hook);
+       po->state = state;
 
-       return co;
+       return TCORE_RETURN_SUCCESS;
 }
 
-void tcore_context_free(CoreObject *co)
+enum co_context_state    tcore_context_get_state(CoreObject *o)
 {
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_PS_CONTEXT);
-       tcore_object_free(co);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
+
+       return po->state;
 }
 
-gboolean tcore_context_set_state(CoreObject *co, TcoreContextState state)
+TReturn tcore_context_set_id(CoreObject *o, unsigned char id)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       dbg("Set State: [%s]",
-               ((state == TCORE_CONTEXT_STATE_ACTIVATED) ? "ACTIVATED"
-               : (state == TCORE_CONTEXT_STATE_ACTIVATING) ? "ACTIVATING"
-               : (state == TCORE_CONTEXT_STATE_DEACTIVATED) ? "DEACTIVATED"
-               : "DEACTIVATING"));
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po->id = id;
 
-       po->state = state;
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_state(CoreObject *co, TcoreContextState *state)
+unsigned char  tcore_context_get_id(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
 
-       *state = po->state;
-       return TRUE;
+       return po->id;
 }
 
-gboolean tcore_context_set_id(CoreObject *co, guint id)
+TReturn tcore_context_set_apn(CoreObject *o, const char *apn)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return FALSE;
 
-       po->id = id;
+       if (po->apn) {
+               free(po->apn);
+               po->apn = NULL;
+       }
 
-       return TRUE;
+       if (apn) {
+               po->apn = g_strdup(apn);
+       }
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_id(CoreObject *co, guint *id)
+char *tcore_context_get_apn(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!po->apn)
+               return NULL;
 
-       *id = po->id;
-       return TRUE;
+       return g_strdup(po->apn);
 }
 
-gboolean tcore_context_set_apn(CoreObject *co, const gchar *apn)
+TReturn tcore_context_set_address(CoreObject *o, const char *addr)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       if (po->addr) {
+               free(po->addr);
+               po->addr = NULL;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (addr) {
+               po->addr = g_strdup(addr);
+       }
 
-       tcore_free(po->apn);
-       po->apn = tcore_strdup(apn);
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_apn(CoreObject *co, gchar **apn)
+char *tcore_context_get_address(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       *apn =  tcore_strdup(po->apn);
-       return TRUE;
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
+
+       if (!po->addr)
+               return NULL;
+
+       return g_strdup(po->addr);
 }
 
-gboolean tcore_context_set_role(CoreObject *co, TcoreContextRole role)
+TReturn tcore_context_set_role(CoreObject *o, enum co_context_role role)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->role = role;
-       return TRUE;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_role(CoreObject *co, TcoreContextRole *role)
+enum co_context_role tcore_context_get_role(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
 
-       *role = po->role;
-       return TRUE;
+       return po->role;
 }
 
-gboolean tcore_context_set_type(CoreObject *co, TcoreContextType type)
+TReturn tcore_context_set_type(CoreObject *o, enum co_context_type type)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->type = type;
-       return TRUE;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_type(CoreObject *co, TcoreContextType *type)
+enum co_context_type tcore_context_get_type(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
 
-       *type = po->type;
-       return TRUE;
+       return po->type;
 }
 
-gboolean tcore_context_set_data_compression(CoreObject *co, TcoreContextDComp comp)
+TReturn tcore_context_set_data_compression(CoreObject *o, enum co_context_d_comp comp)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->d_comp = comp;
-       return TRUE;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_data_compression(CoreObject *co, TcoreContextDComp *comp)
+enum co_context_d_comp tcore_context_get_data_compression(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
 
-       *comp = po->d_comp;
-       return TRUE;
+       return po->d_comp;
 }
 
-gboolean tcore_context_set_header_compression(CoreObject *co, TcoreContextHComp comp)
+TReturn tcore_context_set_header_compression(CoreObject *o, enum co_context_h_comp comp)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->h_comp = comp;
-       return TRUE;
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+enum co_context_h_comp tcore_context_get_header_compression(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
+
+       return po->h_comp;
+}
+
+TReturn tcore_context_set_tech_preference(CoreObject *o, enum co_context_tech tech)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       po->tech_pref = tech;
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+enum co_context_tech tcore_context_get_tech_preference(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return CONTEXT_TECH_INVALID;
+
+       return po->tech_pref;
+}
+
+TReturn tcore_context_set_username(CoreObject *o, const char *username)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       if (po->username) {
+               free(po->username);
+               po->username = NULL;
+       }
+
+       if (username) {
+               po->username = g_strdup(username);
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+char *tcore_context_get_username(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
+
+       if (!po->username)
+               return NULL;
+
+       return g_strdup(po->username);
+}
+
+TReturn tcore_context_set_password(CoreObject *o, const char *password)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       if (po->password) {
+               free(po->password);
+               po->password = NULL;
+       }
+
+       if (password) {
+               po->password = g_strdup(password);
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+char *tcore_context_get_password(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
+
+       if (!po->password)
+               return NULL;
+
+       return g_strdup(po->password);
+}
+
+TReturn tcore_context_set_dns1(CoreObject *o, const char *dns)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       if (po->dns1) {
+               free(po->dns1);
+               po->dns1 = NULL;
+       }
+
+       if (dns) {
+               po->dns1 = g_strdup(dns);
+       }
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_header_compression(CoreObject *co, TcoreContextHComp *comp)
+TReturn tcore_context_set_ipv6_dns1(CoreObject *o, const char *dns)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       if (po->dns_primary_v6) {
+               free(po->dns_primary_v6);
+               po->dns_primary_v6 = NULL;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (dns) {
+               po->dns_primary_v6 = g_strdup(dns);
+       }
 
-       *comp = po->h_comp;
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_set_username(CoreObject *co, const gchar *username)
+char *tcore_context_get_dns1(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!po->dns1)
+               return NULL;
 
-       tcore_free(po->username);
-       po->username = tcore_strdup(username);
-       return TRUE;
+       return g_strdup(po->dns1);
 }
 
-gboolean tcore_context_get_username(CoreObject *co, gchar **username)
+TReturn tcore_context_set_dns2(CoreObject *o, const char *dns)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       *username = tcore_strdup(po->username);
-       return TRUE;
+       if (po->dns2) {
+               free(po->dns2);
+               po->dns2 = NULL;
+       }
+
+       if (dns) {
+               po->dns2 = g_strdup(dns);
+       }
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_set_password(CoreObject *co, const gchar *password)
+TReturn tcore_context_set_ipv6_dns2(CoreObject *o, const char *dns)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (po->dns_secondary_v6) {
+               free(po->dns_secondary_v6);
+               po->dns_secondary_v6 = NULL;
+       }
+
+       if (dns) {
+               po->dns_secondary_v6 = g_strdup(dns);
+       }
 
-       tcore_free(po->password);
-       po->password = tcore_strdup(password);
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_password(CoreObject *co, gchar **password)
+char *tcore_context_get_dns2(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       *password =  tcore_strdup(po->password);
-       return TRUE;
+       if (!po->dns2)
+               return NULL;
+
+       return g_strdup(po->dns2);
 }
 
-gboolean tcore_context_set_auth(CoreObject *co, TcoreContextAuth auth)
+TReturn tcore_context_set_auth(CoreObject *o, enum co_context_auth auth)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->auth = auth;
-       return TRUE;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_get_auth(CoreObject *co, TcoreContextAuth *auth)
+enum co_context_auth tcore_context_get_auth(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
+
+       return po->auth;
+}
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+TReturn tcore_context_set_proxy(CoreObject *o, const char *proxy)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return FALSE;
+
+       if (po->proxy) {
+               free(po->proxy);
+               po->apn = NULL;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (proxy) {
+               po->proxy = g_strdup(proxy);
+       }
 
-       *auth = po->auth;
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_set_proxy(CoreObject *co, const gchar *proxy)
+char *tcore_context_get_proxy(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!po->proxy)
+               return NULL;
 
-       tcore_free(po->proxy);
-       po->proxy = tcore_strdup(proxy);
-       return TRUE;
+       return g_strdup(po->proxy);
 }
 
-gboolean tcore_context_get_proxy(CoreObject *co, gchar **proxy)
+TReturn tcore_context_set_mmsurl(CoreObject *o, const char *mmsurl)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return FALSE;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (po->mmsurl) {
+               free(po->mmsurl);
+               po->mmsurl = NULL;
+       }
+
+       if (mmsurl) {
+               po->mmsurl = g_strdup(mmsurl);
+       }
 
-       *proxy = tcore_strdup(po->proxy);
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_set_mmsurl(CoreObject *co, const gchar *mmsurl)
+char *tcore_context_get_mmsurl(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       tcore_free(po->mmsurl);
-       po->mmsurl = tcore_strdup(mmsurl);
-       return TRUE;
+       if (!po->mmsurl)
+               return NULL;
+
+       return g_strdup(po->mmsurl);
 }
 
-gboolean tcore_context_get_mmsurl(CoreObject *co, gchar **mmsurl)
+TReturn tcore_context_set_profile_name(CoreObject *o, const char *profile_name)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return FALSE;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (po->profile_name) {
+               free(po->profile_name);
+               po->profile_name = NULL;
+       }
+
+       if (profile_name) {
+               po->profile_name = g_strdup(profile_name);
+       }
 
-       *mmsurl = tcore_strdup(po->mmsurl);
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_set_profile_name(CoreObject *co, const gchar *profile_name)
+char *tcore_context_get_profile_name(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       tcore_free(po->profile_name);
-       po->profile_name = tcore_strdup(profile_name);
-       return TRUE;
+       if (!po->profile_name)
+               return NULL;
+
+       return g_strdup(po->profile_name);
 }
 
-gboolean tcore_context_get_profile_name(CoreObject *co, gchar **profile_name)
+TReturn tcore_context_set_default_profile(CoreObject *o, gboolean default_conn)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po->default_profile = default_conn;
 
-       *profile_name =  tcore_strdup(po->profile_name);
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_set_devinfo(CoreObject *co, TcorePsPdpIpConf *devinfo)
+gboolean tcore_context_get_default_profile(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       dbg("Setup device information");
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return FALSE;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(devinfo != NULL, FALSE);
+       return po->default_profile;
+}
 
-       memcpy(&(po->ip_v4), devinfo->ip_address, sizeof(TcoreIp4Type));
-       memcpy(&(po->dns_primary_v4), devinfo->primary_dns, sizeof(TcoreIp4Type));
-       memcpy(&(po->dns_secondary_v4), devinfo->secondary_dns, sizeof(TcoreIp4Type));
-       memcpy(&(po->gateway_v4), devinfo->gateway, sizeof(TcoreIp4Type));
-       memcpy(po->devname, devinfo->devname, sizeof(gchar) * 16);
+TReturn tcore_context_set_devinfo(CoreObject *o, struct tnoti_ps_pdp_ipconfiguration *devinfo)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+       if (!devinfo)
+               return TCORE_RETURN_EINVAL;
+
+       /* Free context resource if it was already allocated */
+       tcore_context_reset_devinfo(o);
+
+       po->ip_v6 = g_strdup((gchar *)devinfo->ipv6_address);
+       po->dns_primary_v6 = g_strdup((gchar *)devinfo->ipv6_primary_dns);
+       po->dns_secondary_v6 = g_strdup((gchar *)devinfo->ipv6_secondary_dns);
+       po->gateway_v6 = g_strdup((gchar *)devinfo->ipv6_gateway);
+       memcpy(&(po->ip_v4), devinfo->ip_address, sizeof(union tcore_ip4_type));
+       memcpy(&(po->dns_primary_v4), devinfo->primary_dns, sizeof(union tcore_ip4_type));
+       memcpy(&(po->dns_secondary_v4), devinfo->secondary_dns, sizeof(union tcore_ip4_type));
+       memcpy(&(po->gateway_v4), devinfo->gateway, sizeof(union tcore_ip4_type));
+       memcpy(po->devname, devinfo->devname, sizeof(char) * 16);
+
+       po->pcscf_ipv4 = g_malloc0(sizeof(pcscf_addr));
+       po->pcscf_ipv4->count = devinfo->pcscf_ipv4_count;
+       if (po->pcscf_ipv4->count > 0) {
+               unsigned int i;
+               po->pcscf_ipv4->addr = g_malloc0(sizeof(char *) * po->pcscf_ipv4->count);
+               for (i = 0; i < po->pcscf_ipv4->count; i++) {
+                       po->pcscf_ipv4->addr[i] = g_strdup(devinfo->pcscf_ipv4[i]);
+               }
+       }
 
-       msg("   IP Address: [0x%x]", po->ip_v4);
-       msg("   DNS - Primary: [0x%x] Secondary: [0x%x]", po->dns_primary_v4, po->dns_secondary_v4);
-       msg("   Gateway: [0x%x]", po->gateway_v4);
-       msg("   Device Name: [%s]", po->devname);
+       po->pcscf_ipv6 = g_malloc0(sizeof(pcscf_addr));
+       po->pcscf_ipv6->count = devinfo->pcscf_ipv6_count;
+       if (po->pcscf_ipv6->count > 0) {
+               unsigned int i;
+               po->pcscf_ipv6->addr = g_malloc0(sizeof(char *) * po->pcscf_ipv6->count);
+               for (i = 0; i < po->pcscf_ipv6->count; i++) {
+                       po->pcscf_ipv6->addr[i] = g_strdup(devinfo->pcscf_ipv6[i]);
+               }
+       }
 
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_context_reset_devinfo(CoreObject *co)
+TReturn tcore_context_reset_devinfo(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+       unsigned int i;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       if(po->ip_v6) g_free(po->ip_v6);
+       po->ip_v6 = NULL;
+
+       if(po->dns_primary_v6) g_free(po->dns_primary_v6);
+       po->dns_primary_v6 = NULL;
+
+       if(po->dns_secondary_v6) g_free(po->dns_secondary_v6);
+       po->dns_secondary_v6 = NULL;
 
-       dbg("Reset device information");
+       if(po->gateway_v6) g_free(po->gateway_v6);
+       po->gateway_v6 = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       if (po->pcscf_ipv4) {
+               for (i = 0; i < po->pcscf_ipv4->count; i++)
+                       g_free(po->pcscf_ipv4->addr[i]);
+               g_free(po->pcscf_ipv4);
+               po->pcscf_ipv4 = NULL;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (po->pcscf_ipv6) {
+               for (i = 0; i < po->pcscf_ipv6->count; i++)
+                       g_free(po->pcscf_ipv6->addr[i]);
+               g_free(po->pcscf_ipv6);
+               po->pcscf_ipv6 = NULL;
+       }
 
-       memset(&(po->ip_v4), 0, sizeof(TcoreIp4Type));
-       memset(&(po->dns_primary_v4), 0, sizeof(TcoreIp4Type));
-       memset(&(po->dns_secondary_v4), 0, sizeof(TcoreIp4Type));
-       memset(&(po->gateway_v4), 0, sizeof(TcoreIp4Type));
-       memset(po->devname, 0, sizeof(gchar) * 16);
+       memset(&(po->ip_v4), 0, sizeof(union tcore_ip4_type));
+       memset(&(po->dns_primary_v4), 0, sizeof(union tcore_ip4_type));
+       memset(&(po->dns_secondary_v4), 0, sizeof(union tcore_ip4_type));
+       memset(&(po->gateway_v4), 0, sizeof(union tcore_ip4_type));
+       memset(po->devname, 0, sizeof(char) * 16);
 
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
 void tcore_context_cp_service_info(CoreObject *dest, CoreObject *src)
 {
-       PrivateObject *d_po = NULL;
-       PrivateObject *s_po = NULL;
+       struct private_object_data *d_po = NULL;
+       struct private_object_data *s_po = NULL;
 
        CORE_OBJECT_CHECK(dest, CORE_OBJECT_TYPE_PS_CONTEXT);
        CORE_OBJECT_CHECK(src, CORE_OBJECT_TYPE_PS_CONTEXT);
@@ -535,146 +867,217 @@ void tcore_context_cp_service_info(CoreObject *dest, CoreObject *src)
 
        d_po->state = s_po->state;
        d_po->id = s_po->id;
-       memcpy(&(d_po->ip_v4), &(s_po->ip_v4), sizeof(TcoreIp4Type));
-       memcpy(&(d_po->dns_primary_v4), &(s_po->dns_primary_v4), sizeof(TcoreIp4Type));
-       memcpy(&(d_po->dns_secondary_v4), &(s_po->dns_secondary_v4), sizeof(TcoreIp4Type));
-       memcpy(&(d_po->gateway_v4), &(s_po->gateway_v4), sizeof(TcoreIp4Type));
-       memcpy(d_po->devname, s_po->devname, sizeof(gchar) * 16);
 
-       return;
+       d_po->ip_v6 = g_strdup(s_po->ip_v6);
+       d_po->dns_primary_v6 = g_strdup(s_po->dns_primary_v6);
+       d_po->dns_secondary_v6 = g_strdup(s_po->dns_secondary_v6);
+       d_po->gateway_v6 = g_strdup(s_po->gateway_v6);
+
+       memcpy(&(d_po->ip_v4), &(s_po->ip_v4), sizeof(union tcore_ip4_type));
+       memcpy(&(d_po->dns_primary_v4), &(s_po->dns_primary_v4), sizeof(union tcore_ip4_type));
+       memcpy(&(d_po->dns_secondary_v4), &(s_po->dns_secondary_v4), sizeof(union tcore_ip4_type));
+       memcpy(&(d_po->gateway_v4), &(s_po->gateway_v4), sizeof(union tcore_ip4_type));
+       memcpy(d_po->devname, s_po->devname, sizeof(char) * 16);
 }
 
-gboolean tcore_context_set_ipv4_addr(CoreObject *co, const gchar *addr)
+char* tcore_context_get_ipv4_addr(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       if (po->addr) {
-               tcore_free(po->addr);
-               po->addr = NULL;
-       }
+       return tcore_util_get_string_by_ip4type(po->ip_v4);
+}
 
-       if (addr) {
-               po->addr = tcore_strdup(addr);
-               __context_set_ipv4_atoi(po->ip_v4.s, addr);
-               dbg("IP Address: [%s]", addr);
-       }
+char* tcore_context_get_ipv4_dns1(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       return TRUE;
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
+
+       return tcore_util_get_string_by_ip4type(po->dns_primary_v4);
 }
 
-gboolean tcore_context_get_ipv4_addr(CoreObject *co, gchar **ip)
+char* tcore_context_get_ipv4_dns2(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       *ip =  tcore_util_get_string_by_ip4type(po->ip_v4);
-       return TRUE;
+       return tcore_util_get_string_by_ip4type(po->dns_secondary_v4);
 }
 
-gboolean tcore_context_set_ipv4_dns(CoreObject *co, const gchar *dns1, const gchar *dns2)
+char* tcore_context_get_ipv4_gw(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       tcore_free(po->dns1);
-       po->dns1 = NULL;
+       return tcore_util_get_string_by_ip4type(po->gateway_v4);
+}
 
-       tcore_free(po->dns2);
-       po->dns2 = NULL;
+char* tcore_context_get_ipv4_devname(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
 
-       if (dns1) {
-               po->dns1 = tcore_strdup(dns1);
-               __context_set_ipv4_atoi(po->dns_primary_v4.s, dns1);
-       }
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       if (dns2) {
-               po->dns2 = tcore_strdup(dns2);
-               __context_set_ipv4_atoi(po->dns_secondary_v4.s, dns2);
-       }
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       return TRUE;
+       if (po->devname[0] == 0)
+               return NULL;
+
+       return g_strdup(po->devname);
 }
 
-gboolean tcore_context_get_ipv4_dns1(CoreObject *co, gchar **ip)
+char* tcore_context_get_ipv6_addr(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       *ip = tcore_util_get_string_by_ip4type(po->dns_primary_v4);
-       return TRUE;
+       return g_strdup(po->ip_v6);
 }
 
-gboolean tcore_context_get_ipv4_dns2(CoreObject *co, gchar **ip)
+char* tcore_context_get_ipv6_dns1(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       *ip = tcore_util_get_string_by_ip4type(po->dns_secondary_v4);
-       return TRUE;
+       return g_strdup(po->dns_primary_v6);
 }
 
-gboolean tcore_context_get_ipv4_gw(CoreObject *co, gchar **ip)
+char* tcore_context_get_ipv6_dns2(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-       *ip =  tcore_util_get_string_by_ip4type(po->gateway_v4);
-       return TRUE;
+       return g_strdup(po->dns_secondary_v6);
 }
 
-gboolean tcore_context_set_ipv4_devname(CoreObject *co, const gchar *name)
+char* tcore_context_get_ipv6_gw(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
+
+       return g_strdup(po->gateway_v6);
+}
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+pcscf_addr *tcore_context_get_pcscf_ipv4_addr(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       pcscf_addr *pcscf_tmp;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
+
+       if (!po->pcscf_ipv4)
+               return NULL;
+
+       pcscf_tmp = g_malloc0(sizeof(pcscf_addr));
+       pcscf_tmp->count = po->pcscf_ipv4->count;
+       if (pcscf_tmp->count > 0) {
+               unsigned int i;
+               pcscf_tmp->addr = g_malloc0(sizeof(char *) * po->pcscf_ipv4->count);
+               for (i = 0; i < po->pcscf_ipv4->count; i++) {
+                       pcscf_tmp->addr[i] = g_strdup(po->pcscf_ipv4->addr[i]);
+               }
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       return pcscf_tmp;
+}
 
-       if (name) {
-               snprintf(po->devname, DEVNAME_LEN_MAX, "%s", name);
+pcscf_addr *tcore_context_get_pcscf_ipv6_addr(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       pcscf_addr *pcscf_tmp;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
+
+       if (!po->pcscf_ipv6)
+               return NULL;
+
+       pcscf_tmp = g_malloc0(sizeof(pcscf_addr));
+       pcscf_tmp->count = po->pcscf_ipv6->count;
+       if (pcscf_tmp->count > 0) {
+               unsigned int i;
+               pcscf_tmp->addr = g_malloc0(sizeof(char *) * po->pcscf_ipv6->count);
+               for (i = 0; i < po->pcscf_ipv6->count; i++) {
+                       pcscf_tmp->addr[i] = g_strdup(po->pcscf_ipv6->addr[i]);
+               }
        }
 
-       return TRUE;
+       return pcscf_tmp;
 }
 
-gboolean tcore_context_get_ipv4_devname(CoreObject *co, gchar **dev_name)
+TReturn tcore_context_set_attach_apn(CoreObject *o, gboolean flag)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       if (po->devname[0] == 0)
-               return TRUE;
+       po->attach_apn = flag;
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+gboolean tcore_context_get_attach_apn(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return FALSE;
 
-       *dev_name = tcore_strdup(po->devname);
-       return TRUE;
+       return po->attach_apn;
 }
diff --git a/src/co_custom.c b/src/co_custom.c
new file mode 100644 (file)
index 0000000..c9b6284
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * custom
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Anga Santhosh Kumar <santhosh.a@samsung.com>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include "tcore.h"
+#include "core_object.h"
+#include "co_custom.h"
+
+static void _free_hook(CoreObject *co)
+{
+       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_CUSTOM);
+
+       tcore_object_link_object(co, NULL);
+}
+
+CoreObject *tcore_custom_new(TcorePlugin *p,
+       const char *name, tcore_custom_operations ops,
+       CoreObjectDispatcher dispatcher, TcoreHal *hal)
+{
+       CoreObject *co = NULL;
+
+       if (!p)
+               return NULL;
+
+       co = tcore_object_new(p, name, hal);
+       if (!co)
+               return NULL;
+
+       tcore_object_set_type(co, CORE_OBJECT_TYPE_CUSTOM);
+
+       tcore_object_link_object(co, ops);
+       tcore_object_set_free_hook(co, _free_hook);
+       tcore_object_set_dispatcher(co, dispatcher);
+
+       return co;
+}
+
+void tcore_custom_free(CoreObject *co)
+{
+       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_CUSTOM);
+
+       tcore_object_free(co);
+}
index 0b71f2e..5bf7838 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include <glib.h>
 
 #include "tcore.h"
 #include "plugin.h"
+#include "user_request.h"
 #include "co_gps.h"
 
-typedef struct {
-       TcoreGpsOps *ops;
-} PrivateObject;
+struct private_object_data {
+       struct tcore_gps_operations *ops;
+};
 
-static void _po_free_hook(CoreObject *co)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
+       struct private_object_data *po = NULL;
 
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+       po = tcore_object_ref_object(o);
+       if (po) {
+               free(po);
+               tcore_object_link_object(o, NULL);
+       }
 }
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       PrivateObject *dest_po = NULL;
-       PrivateObject *src_po = tcore_object_ref_object(src);
-       tcore_check_return_assert(src_po != NULL);
-       tcore_check_return_assert(src_po->ops != NULL);
-       tcore_check_return_assert(dest != NULL);
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
 
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreGpsOps));
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
 
-       tcore_object_link_object(dest, dest_po);
-}
+       po = tcore_object_ref_object(o);
+       if (!po || !po->ops)
+               return TCORE_RETURN_ENOSYS;
 
-static TelReturn _dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data)
-{
-       TcoreGpsOps *gps = NULL;
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
+       command = tcore_user_request_get_command(ur);
+       switch (command) {
+               case TREQ_GPS_CONFIRM_MEASURE_POS:
+                       dbg("TREQ_GPS_CONFIRM_MEASURE_POS");
+                       if (!po->ops->confirm_measure_pos)
+                               return TCORE_RETURN_ENOSYS;
 
-       gps = po->ops;
+                       return po->ops->confirm_measure_pos(o, ur);
 
-       switch (command) {
-       case TCORE_COMMAND_GPS_CONFIRM_MEASURE_POS:
-               if (gps->confirm_measure_pos)
-                       return gps->confirm_measure_pos(co,
-                               (TelGpsDataInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_GPS_SET_FREQUENCY_AIDING:
-               if (gps->set_frequency_aiding)
-                       return gps->set_frequency_aiding(co,
-                               *(gboolean *)request,
-                               cb, (void *)user_data);
-               break;
-
-       default:
-               err("Unsupported Command [0x%x]", command);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-       err("Operation NOT Supported");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
-}
+               case TREQ_GPS_SET_FREQUENCY_AIDING:
+                       dbg("TREQ_GPS_SET_FREQUENCY_AIDING");
+                       if (!po->ops->set_frequency_aiding)
+                               return TCORE_RETURN_ENOSYS;
 
-void tcore_gps_override_ops(CoreObject *co, TcoreGpsOps *ops)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
+                       return po->ops->set_frequency_aiding(o, ur);
+
+               case TREQ_ENABLE_SMART_ASSISTANT:
+                       dbg("TREQ_ENABLE_SMART_ASSISTANT");
+                       if (!po->ops->enable_smart_assistant)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->enable_smart_assistant(o, ur);
+
+               case TREQ_DISABLE_SMART_ASSISTANT:
+                       dbg("TREQ_DISABLE_SMART_ASSISTANT");
+                       if (!po->ops->disable_smart_assistant)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->disable_smart_assistant(o, ur);
+
+               case TREQ_SYNC_SMART_ASSISTANT_AREA_LIST:
+                       dbg("TREQ_SYNC_SMART_ASSISTANT_AREA_LIST");
+                       if (!po->ops->sync_smart_assistant_area_list)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->sync_smart_assistant_area_list(o, ur);
 
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(ops != NULL);
+               case TREQ_DEL_SMART_ASSISTANT_AREA_LIST:
+                       dbg("TREQ_DEL_SMART_ASSISTANT_AREA_LIST");
+                       if (!po->ops->del_smart_assistant_area_list)
+                               return TCORE_RETURN_ENOSYS;
 
-       if (ops->confirm_measure_pos)
-               po->ops->confirm_measure_pos = ops->confirm_measure_pos;
-       if (ops->set_frequency_aiding)
-               po->ops->set_frequency_aiding = ops->set_frequency_aiding;
+                       return po->ops->del_smart_assistant_area_list(o, ur);
+
+               case TREQ_ADD_SMART_ASSISTANT_AREA:
+                       dbg("TREQ_ADD_SMART_ASSISTANT_AREA");
+                       if (!po->ops->add_smart_assistant_area)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->add_smart_assistant_area(o, ur);
+
+               case TREQ_MODIFY_SMART_ASSISTANT_AREA:
+                       dbg("TREQ_MODIFY_SMART_ASSISTANT_AREA");
+                       if (!po->ops->modify_smart_assistant_area)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->modify_smart_assistant_area(o, ur);
+
+               case TREQ_SET_SMART_ASSISTANT_INFO:
+                       dbg("TREQ_SET_SMART_ASSISTANT_INFO");
+                       if (!po->ops->set_smart_assistant_info)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_smart_assistant_info(o, ur);
+
+               default:
+                       dbg("not supported cmd");
+                       break;
+       }
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_gps_set_ops(CoreObject *co, TcoreGpsOps *ops)
+CoreObject *tcore_gps_new(TcorePlugin *p, const char *name,
+               struct tcore_gps_operations *ops, TcoreHal *hal)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!p)
+               return NULL;
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreGpsOps));
+       po->ops = ops;
+
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_GPS);
+       tcore_object_link_object(o, po);
+       tcore_object_set_dispatcher(o, _dispatcher);
+       tcore_object_set_free_hook(o, _free_hook);
 
-       return TRUE;
+       return o;
 }
 
-CoreObject *tcore_gps_new(TcorePlugin *p,
-                       TcoreGpsOps *ops, TcoreHal *hal)
+void tcore_gps_free(CoreObject *o)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-       tcore_check_return_value_assert(p != NULL, NULL);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_GPS);
 
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       tcore_object_free(o);
+}
 
-       po = tcore_malloc0(sizeof(PrivateObject));
+void tcore_gps_set_ops(CoreObject *o, struct tcore_gps_operations *ops)
+{
+       struct private_object_data *po = NULL;
 
-       if (ops != NULL)
-               po->ops = tcore_memdup(ops, sizeof(TcoreGpsOps));
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_GPS);
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_GPS);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
-       return co;
-}
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
 
-void tcore_gps_free(CoreObject *co)
-{
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_GPS);
-       tcore_object_free(co);
+       po->ops = ops;
 }
index c4ef066..ffbd27c 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include <glib.h>
 
 #include "tcore.h"
 #include "plugin.h"
+#include "user_request.h"
 #include "co_modem.h"
+#include "hal.h"
 
-typedef struct {
-       TcoreModemOps *ops;
+struct private_object_data {
+       struct tcore_modem_operations *ops;
 
        gboolean flight_mode;
        gboolean powered;
-} PrivateObject;
+};
 
-static void _po_free_hook(CoreObject *co)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
+       struct private_object_data *po = NULL;
 
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+       po = tcore_object_ref_object(o);
+       if (po) {
+               free(po);
+               tcore_object_link_object(o, NULL);
+       }
 }
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       PrivateObject *dest_po = NULL;
-       PrivateObject *src_po = tcore_object_ref_object(src);
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po || !po->ops)
+               return TCORE_RETURN_ENOSYS;
+
+       command = tcore_user_request_get_command(ur);
+       switch (command) {
+               case TREQ_MODEM_POWER_ON:
+                       if (!po->ops->power_on)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->power_on(o, ur);
+                       break;
+
+               case TREQ_MODEM_POWER_OFF:
+                       if (!po->ops->power_off)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->power_off(o, ur);
+                       break;
+
+               case TREQ_MODEM_POWER_RESET:
+                       if (!po->ops->power_reset)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->power_reset(o, ur);
+                       break;
+
+               case TREQ_MODEM_POWER_LOW:
+                       if (!po->ops->power_low)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->power_low(o, ur);
+                       break;
+
+               case TREQ_MODEM_SET_FLIGHTMODE:
+                       if (!po->ops->set_flight_mode)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_flight_mode(o, ur);
+                       break;
+
+               case TREQ_MODEM_GET_IMEI:
+                       if (!po->ops->get_imei)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_imei(o, ur);
+                       break;
+
+               case TREQ_MODEM_GET_VERSION:
+                       if (!po->ops->get_version)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_version(o, ur);
+                       break;
+
+               case TREQ_MODEM_GET_SN:
+                       if (!po->ops->get_sn)
+                               return TCORE_RETURN_ENOSYS;
 
-       tcore_check_return_assert(src_po != NULL);
-       tcore_check_return_assert(src_po->ops != NULL);
+                       return po->ops->get_sn(o, ur);
+                       break;
 
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreModemOps));
-       tcore_object_link_object(dest, dest_po);
+               case TREQ_MODEM_SET_DUN_PIN_CONTROL:
+                       if (!po->ops->dun_pin_ctrl)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->dun_pin_ctrl(o, ur);
+                       break;
+
+               case TREQ_MODEM_GET_FLIGHTMODE:
+                       if (!po->ops->get_flight_mode)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_flight_mode(o, ur);
+                       break;
+
+               default:
+                       return TCORE_RETURN_EINVAL;
+       }
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-static TelReturn _dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data)
+CoreObject *tcore_modem_new(TcorePlugin *p, const char *name,
+               struct tcore_modem_operations *ops, TcoreHal *hal)
 {
-       TcoreModemOps *modem = NULL;
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
-       modem = po->ops;
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
 
-       switch (command) {
-       case TCORE_COMMAND_MODEM_SET_POWER_STATUS:
-               if (modem->set_power_status)
-                       return modem->set_power_status(co,
-                                       *((TelModemPowerStatus *)request),
-                                       cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_MODEM_SET_FLIGHTMODE:
-               if (modem->set_flight_mode)
-                       return modem->set_flight_mode(co,
-                                       *(gboolean *)request,
-                                       cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_MODEM_GET_IMEI:
-               if (modem->get_imei)
-                       return modem->get_imei(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_MODEM_GET_VERSION:
-               if (modem->get_version)
-                       return modem->get_version(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_MODEM_GET_FLIGHTMODE:
-               if (modem->get_flight_mode)
-                       return modem->get_flight_mode(co, cb, (void *)user_data);
-               break;
-
-       default:
-               err("Unsupported Command [0x%x]", command);
-               break;
+       if (!p)
+               return NULL;
+
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
        }
-       err("Operation NOT Supported");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+
+       po->ops = ops;
+
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_MODEM);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
+
+       return o;
 }
 
-void tcore_modem_override_ops(CoreObject *co, TcoreModemOps *ops)
+void tcore_modem_free(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(ops != NULL);
-
-       if (ops->set_power_status)
-               po->ops->set_power_status = ops->set_power_status;
-       if (ops->set_flight_mode)
-               po->ops->set_flight_mode = ops->set_flight_mode;
-       if (ops->get_imei)
-               po->ops->get_imei = ops->get_imei;
-       if (ops->get_version)
-               po->ops->get_version = ops->get_version;
-       if (ops->get_flight_mode)
-               po->ops->get_flight_mode = ops->get_flight_mode;
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_MODEM);
+       tcore_object_free(o);
 }
 
-gboolean tcore_modem_set_ops(CoreObject *co, TcoreModemOps *ops)
+void tcore_modem_set_ops(CoreObject *o, struct tcore_modem_operations *ops)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_MODEM);
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreModemOps));
-
-       return TRUE;
+       po->ops = ops;
 }
 
-CoreObject *tcore_modem_new(TcorePlugin *p,
-                       TcoreModemOps *ops, TcoreHal *hal)
+TReturn tcore_modem_set_flight_mode_state(CoreObject *o, gboolean flag)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-       tcore_check_return_value_assert(p != NULL, NULL);
+       struct private_object_data *po = NULL;
 
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, TCORE_RETURN_EINVAL);
 
-       po = tcore_malloc0(sizeof(PrivateObject));
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       if (ops != NULL)
-               po->ops = tcore_memdup(ops, sizeof(TcoreModemOps));
+       po->flight_mode = flag;
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_MODEM);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
-       return co;
+       return TCORE_RETURN_SUCCESS;
 }
 
-void tcore_modem_free(CoreObject *co)
+gboolean tcore_modem_get_flight_mode_state(CoreObject *o)
 {
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_MODEM);
-       tcore_object_free(co);
-}
+       struct private_object_data *po = NULL;
 
-gboolean tcore_modem_set_flight_mode_state(CoreObject *co, gboolean state)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, FALSE);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return FALSE;
 
-       po->flight_mode = state;
-       return TRUE;
+       return po->flight_mode;
 }
 
-gboolean tcore_modem_get_flight_mode_state(CoreObject *co, gboolean *state)
+TReturn tcore_modem_set_powered(CoreObject *o, gboolean pwr)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       TcoreHal *h;
 
-       *state = po->flight_mode;
-       return TRUE;
-}
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, TCORE_RETURN_EINVAL);
 
-gboolean tcore_modem_set_powered(CoreObject *co, gboolean pwr)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       h = tcore_object_get_hal(o);
+       if (!h)
+               return TCORE_RETURN_FAILURE;
+
+       tcore_hal_set_power_state(h, pwr);
 
-       po->powered = pwr;
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_modem_get_powered(CoreObject *co, gboolean *pwr)
+gboolean tcore_modem_get_powered(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       TcoreHal *h;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, FALSE);
+
+       h = tcore_object_get_hal(o);
+       if (!h)
+               return FALSE;
 
-       *pwr = po->powered;
-       return TRUE;
+       return tcore_hal_get_power_state(h);
 }
index 7d9c47f..a26400f 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include <glib.h>
 
 #include "tcore.h"
 #include "plugin.h"
+#include "queue.h"
+#include "user_request.h"
 #include "co_network.h"
 
-typedef struct {
-       TcoreNetworkOps *ops;
-
-       TelNetworkRegStatus cs_status;
-       TelNetworkRegStatus ps_status;
-       TelNetworkAct act;
-       gboolean roam_state;
+struct private_object_data {
+       struct tcore_network_operations *ops;
 
+       enum telephony_network_service_type service_type;
+       enum telephony_network_access_technology act;
+       enum telephony_network_service_domain_status cs_domain_status;
+       enum telephony_network_service_domain_status ps_domain_status;
+       char *plmn;
+       gboolean roaming_state;
+       int restricted_state;
        unsigned int lac;
        unsigned int rac;
        unsigned int cell_id;
+       gboolean gsm_dtm_support; // DTM (Dual Transfer Mode)
 
-       char *plmn;
-       char *short_name;
-       char *long_name;
-
-       GHashTable *operator_name_hash;
-} PrivateObject;
+       char *network_name_short;
+       char *network_name_full;
+       char *network_name_spn;
+       enum tcore_network_name_priority network_name_priority;
+       GHashTable *operator_info_hash;
+};
 
-static TelReturn _dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data)
+static TReturn _dispatcher(CoreObject *co, UserRequest *ur)
 {
-       TcoreNetworkOps *network = NULL;
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
 
-       network = po->ops;
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po || !po->ops)
+               return TCORE_RETURN_ENOSYS;
 
+       command = tcore_user_request_get_command(ur);
        switch (command) {
-       case TCORE_COMMAND_NETWORK_GET_IDENTITY_INFO:
-               if (network->get_identity_info)
-                       return network->get_identity_info(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_SEARCH:
-               if (network->search)
-                       return network->search(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_CANCEL_SEARCH:
-               if (network->cancel_search)
-                       return network->cancel_search(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_SELECT_AUTOMATIC:
-               if (network->select_automatic)
-                       return network->select_automatic(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_SELECT_MANUAL:
-               if (network->select_manual)
-                       return network->select_manual(co,
-                               (TelNetworkSelectManualInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_GET_SELECTION_MODE:
-               if (network->get_selection_mode)
-                       return network->get_selection_mode(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_SET_PREFERRED_PLMN:
-               if (network->set_preferred_plmn)
-                       return network->set_preferred_plmn(co,
-                               (const TelNetworkPreferredPlmnInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_GET_PREFERRED_PLMN:
-               if (network->get_preferred_plmn)
-                       return network->get_preferred_plmn(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_SET_MODE:
-               if (network->set_mode)
-                       return network->set_mode(co,
-                               *((TelNetworkMode *)request),
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_GET_MODE:
-               if (network->get_mode)
-                       return network->get_mode(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_NETWORK_GET_NEIGHBORING_CELL_INFO:
-               if (network->get_neighboring_cell_info)
-                       return network->get_neighboring_cell_info(co,
-                               cb, (void *)user_data);
-               break;
-
-       default:
-               err("Unsupported Command: [0x%x]",command);
-               return TEL_NETWORK_RESULT_INVALID_PARAMETER;
+               case TREQ_NETWORK_SEARCH:
+                       if (!po->ops->search)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->search(co, ur);
+
+               case TREQ_NETWORK_SET_PLMN_SELECTION_MODE:
+                       if (!po->ops->set_plmn_selection_mode)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_plmn_selection_mode(co, ur);
+
+               case TREQ_NETWORK_GET_PLMN_SELECTION_MODE:
+                       if (!po->ops->get_plmn_selection_mode)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_plmn_selection_mode(co, ur);
+
+               case TREQ_NETWORK_SET_SERVICE_DOMAIN:
+                       if (!po->ops->set_service_domain)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_service_domain(co, ur);
+
+               case TREQ_NETWORK_GET_SERVICE_DOMAIN:
+                       if (!po->ops->get_service_domain)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_service_domain(co, ur);
+
+               case TREQ_NETWORK_SET_BAND:
+                       if (!po->ops->set_band)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_band(co, ur);
+
+               case TREQ_NETWORK_GET_BAND:
+                       if (!po->ops->get_band)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_band(co, ur);
+
+               case TREQ_NETWORK_SET_PREFERRED_PLMN:
+                       if (!po->ops->set_preferred_plmn)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_preferred_plmn(co, ur);
+
+               case TREQ_NETWORK_GET_PREFERRED_PLMN:
+                       if (!po->ops->get_preferred_plmn)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_preferred_plmn(co, ur);
+
+               case TREQ_NETWORK_SET_ORDER:
+                       if (!po->ops->set_order)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_order(co, ur);
+
+               case TREQ_NETWORK_GET_ORDER:
+                       if (!po->ops->get_order)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_order(co, ur);
+
+               case TREQ_NETWORK_SET_POWER_ON_ATTACH:
+                       if (!po->ops->set_power_on_attach)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_power_on_attach(co, ur);
+
+               case TREQ_NETWORK_GET_POWER_ON_ATTACH:
+                       if (!po->ops->get_power_on_attach)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_power_on_attach(co, ur);
+
+               case TREQ_NETWORK_SET_CANCEL_MANUAL_SEARCH:
+                       if (!po->ops->set_cancel_manual_search)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_cancel_manual_search(co, ur);
+
+               case TREQ_NETWORK_GET_SERVING_NETWORK:
+                       if (!po->ops->get_serving_network)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_serving_network(co, ur);
+
+               case TREQ_NETWORK_SET_MODE:
+                       if (!po->ops->set_mode)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_mode(co, ur);
+
+               case TREQ_NETWORK_GET_MODE:
+                       if (!po->ops->get_mode)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_mode(co, ur);
+
+               case TREQ_NETWORK_SET_NEIGHBORING_CELL_INFO:
+                       if (!po->ops->set_neighboring_cell_info)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_neighboring_cell_info(co, ur);
+
+               case TREQ_NETWORK_GET_NEIGHBORING_CELL_INFO:
+                       if (!po->ops->get_neighboring_cell_info)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_neighboring_cell_info(co, ur);
+
+               case TREQ_NETWORK_SET_DEFAULT_DATA_SUBSCRIPTION:
+                       if (!po->ops->set_default_data_subscription)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_default_data_subscription(co, ur);
+
+               case TREQ_NETWORK_GET_DEFAULT_DATA_SUBSCRIPTION:
+                       if (!po->ops->get_default_data_subscription)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_default_data_subscription(co, ur);
+
+               case TREQ_NETWORK_SET_DEFAULT_SUBSCRIPTION:
+                       if (!po->ops->set_default_subscription)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_default_subscription(co, ur);
+
+               case TREQ_NETWORK_GET_DEFAULT_SUBSCRIPTION:
+                       if (!po->ops->get_default_subscription)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_default_subscription(co, ur);
+
+               case TREQ_NETWORK_SET_EMERGENCY_CALLBACK_MODE:
+                       if (!po->ops->set_emergency_callback_mode)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_emergency_callback_mode(co, ur);
+
+               case TREQ_NETWORK_SET_ROAMING_PREFERENCE:
+                       if (!po->ops->set_roaming_preference)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_roaming_preference(co, ur);
 
+               case TREQ_NETWORK_GET_ROAMING_PREFERENCE:
+                       if (!po->ops->get_roaming_preference)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_roaming_preference(co, ur);
+
+               case TREQ_NETWORK_GET_SUBSCRIPTION_INFO:
+                       if (!po->ops->get_subscription_info)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_subscription_info(co, ur);
+
+               default:
+                       break;
        }
-       err("Unsupported Operation");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-static void _po_free_hook(CoreObject *co)
+static void _free_hook(CoreObject *co)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
-
-       g_hash_table_destroy(po->operator_name_hash);
-       tcore_free(po->plmn);
-       tcore_free(po->short_name);
-       tcore_free(po->long_name);
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_NETWORK);
+
+       po = tcore_object_ref_object(co);
+       if (po) {
+               free(po);
+               tcore_object_link_object(co, NULL);
+       }
 }
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
+CoreObject *tcore_network_new(TcorePlugin *plugin, const char *name,
+               struct tcore_network_operations *ops, TcoreHal *hal)
 {
-       PrivateObject *dest_po = NULL;
-       PrivateObject *src_po = tcore_object_ref_object(src);
-       tcore_check_return_assert(src_po != NULL);
-       tcore_check_return_assert(src_po->ops != NULL);
-
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreNetworkOps));
-       tcore_object_link_object(dest, dest_po);
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
+
+       if (!plugin)
+               return NULL;
+
+       o = tcore_object_new(plugin, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
+       }
+
+       po->ops = ops;
+       po->operator_info_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_NETWORK);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
+
+       return o;
 }
 
-void tcore_network_override_ops(CoreObject *co, TcoreNetworkOps *ops)
+void tcore_network_free(CoreObject *co)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(ops != NULL);
-
-       if (ops->get_identity_info)
-               po->ops->get_identity_info = ops->get_identity_info;
-       if (ops->search)
-               po->ops->search = ops->search;
-       if (ops->cancel_search)
-               po->ops->cancel_search = ops->cancel_search;
-       if (ops->select_automatic)
-               po->ops->select_automatic = ops->select_automatic;
-       if (ops->select_manual)
-               po->ops->select_manual = ops->select_manual;
-       if (ops->get_selection_mode)
-               po->ops->get_selection_mode = ops->get_selection_mode;
-       if (ops->set_preferred_plmn)
-               po->ops->set_preferred_plmn = ops->set_preferred_plmn;
-       if (ops->get_preferred_plmn)
-               po->ops->get_preferred_plmn = ops->get_preferred_plmn;
-       if (ops->set_mode)
-               po->ops->set_mode = ops->set_mode;
-       if (ops->get_mode)
-               po->ops->get_mode = ops->get_mode;
-       if (ops->get_neighboring_cell_info)
-               po->ops->get_neighboring_cell_info = ops->get_neighboring_cell_info;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_NETWORK);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return;
+
+       if (po->network_name_short)
+               free(po->network_name_short);
+       if (po->network_name_full)
+               free(po->network_name_full);
+       if (po->network_name_spn)
+               free(po->network_name_spn);
+       if (po->plmn)
+               free(po->plmn);
+
+       if (po->operator_info_hash)
+               g_hash_table_destroy(po->operator_info_hash);
+
+       tcore_object_free(co);
 }
 
-gboolean tcore_network_set_ops(CoreObject *co, TcoreNetworkOps *ops)
+void tcore_network_set_ops(CoreObject *o, struct tcore_network_operations *ops)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_NETWORK);
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreNetworkOps));
+       po->ops = ops;
+}
+
+char* tcore_network_get_plmn(CoreObject *co)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, NULL);
 
-       return TRUE;
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return NULL;
+
+       return g_strdup(po->plmn);
 }
 
-CoreObject *tcore_network_new(TcorePlugin *plugin,
-                       TcoreNetworkOps *ops, TcoreHal *hal)
+TReturn tcore_network_set_plmn(CoreObject *co, const char *plmn)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-       tcore_check_return_value_assert(plugin != NULL, NULL);
+       struct private_object_data *po = NULL;
 
-       co = tcore_object_new(plugin, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
 
-       po = tcore_malloc0(sizeof(PrivateObject));
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       if (ops != NULL)
-               po->ops = tcore_memdup(ops, sizeof(TcoreNetworkOps));
+       if (po->plmn)
+               free(po->plmn);
 
-       po->operator_name_hash = g_hash_table_new_full(g_str_hash,
-                       g_str_equal, g_free, g_free);
+       po->plmn = g_strdup(plmn);
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_NETWORK);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
-       return co;
+       return TCORE_RETURN_SUCCESS;
 }
 
-void tcore_network_free(CoreObject *co)
+
+char* tcore_network_get_network_name(CoreObject *co,
+               enum tcore_network_name_type type)
 {
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_NETWORK);
-       tcore_object_free(co);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, NULL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return NULL;
+
+       if (type == TCORE_NETWORK_NAME_TYPE_SHORT)
+               return g_strdup(po->network_name_short);
+       else if (type == TCORE_NETWORK_NAME_TYPE_FULL)
+               return g_strdup(po->network_name_full);
+       else if (type == TCORE_NETWORK_NAME_TYPE_SPN)
+               return g_strdup(po->network_name_spn);
+       else
+               return NULL;
+}
+
+TReturn tcore_network_set_network_name(CoreObject *co,
+               enum tcore_network_name_type type, const char *network_name)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       switch (type) {
+               case TCORE_NETWORK_NAME_TYPE_SHORT:
+                       if (po->network_name_short) {
+                               free (po->network_name_short);
+                               po->network_name_short = NULL;
+                       }
+
+                       if (network_name)
+                               po->network_name_short = g_strdup (network_name);
+
+                       break;
+
+               case TCORE_NETWORK_NAME_TYPE_FULL:
+                       if (po->network_name_full) {
+                               free (po->network_name_full);
+                               po->network_name_full = NULL;
+                       }
+
+                       if (network_name)
+                               po->network_name_full = g_strdup (network_name);
+
+                       break;
+
+               case TCORE_NETWORK_NAME_TYPE_SPN:
+                       if (po->network_name_spn) {
+                               free (po->network_name_spn);
+                               po->network_name_spn = NULL;
+                       }
+
+                       if (network_name)
+                               po->network_name_spn = g_strdup (network_name);
+
+                       break;
+
+               default:
+                       return TCORE_RETURN_EINVAL;
+       }
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_cs_reg_status(CoreObject *co,
-               TelNetworkRegStatus *cs_status)
+TReturn tcore_network_get_network_name_priority(CoreObject *co,
+               enum tcore_network_name_priority *priority)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(cs_status != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       if (!priority)
+               return TCORE_RETURN_EINVAL;
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return FALSE;
+
+       *priority = po->network_name_priority;
 
-       *cs_status = po->cs_status;
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_cs_reg_status(CoreObject *co,
-               TelNetworkRegStatus cs_status)
+TReturn tcore_network_set_network_name_priority(CoreObject *co,
+               enum tcore_network_name_priority priority)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       po->cs_status = cs_status;
-       return TRUE;
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       po->network_name_priority  = priority;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_ps_reg_status(CoreObject *co,
-               TelNetworkRegStatus *ps_status)
+gboolean tcore_network_get_roaming_state(CoreObject *co)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(ps_status != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, FALSE);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return FALSE;
 
-       *ps_status = po->ps_status;
-       return TRUE;
+       return po->roaming_state;
 }
 
-gboolean tcore_network_set_ps_reg_status(CoreObject *co,
-               TelNetworkRegStatus ps_status)
+TReturn tcore_network_set_roaming_state(CoreObject *co, gboolean state)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       po->ps_status = ps_status;
-       return TRUE;
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       po->roaming_state = state;
+       dbg("roaming_state = 0x%x", state);
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_access_technology(CoreObject *co,
-               TelNetworkAct act)
+int tcore_network_get_restricted_state(CoreObject *co)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       po->act = act;
-       return TRUE;
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, FALSE);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return FALSE;
 
+       return po->restricted_state;
 }
 
-gboolean tcore_network_get_access_technology(CoreObject *co,
-               TelNetworkAct *act)
+TReturn tcore_network_set_restricted_state(CoreObject *co, int state)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(act != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       *act = po->act;
-       return TRUE;
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       po->restricted_state = state;
+       dbg("restricted_state = 0x%x", state);
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_roam_state(CoreObject *co, gboolean *state)
+TReturn tcore_network_get_service_status(CoreObject *co,
+               enum tcore_network_service_domain_type type,
+               enum telephony_network_service_domain_status *result)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(state != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       *state = po->roam_state;
-       return TRUE;
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       if (!result)
+               return TCORE_RETURN_EINVAL;
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       switch (type) {
+               case TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT:
+                       *result = po->cs_domain_status;
+                       break;
+
+               case TCORE_NETWORK_SERVICE_DOMAIN_TYPE_PACKET:
+                       *result = po->ps_domain_status;
+                       break;
+               default:
+                       err("invalid network type");
+                       break;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_network_set_service_status(CoreObject *co,
+               enum tcore_network_service_domain_type type,
+               enum telephony_network_service_domain_status status)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       switch (type) {
+               case TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT:
+                       po->cs_domain_status = status;
+                       dbg("cs.status = 0x%x", status);
+                       break;
+
+               case TCORE_NETWORK_SERVICE_DOMAIN_TYPE_PACKET:
+                       po->ps_domain_status = status;
+                       dbg("ps.status = 0x%x", status);
+                       break;
+               default:
+                       err("invalid network type");
+                       break;
+
+       }
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_roam_state(CoreObject *co, gboolean state)
+TReturn tcore_network_set_access_technology(CoreObject *co,
+               enum telephony_network_access_technology act)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       po->roam_state = state;
-       return TRUE;
+       po->act = act;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_lac(CoreObject *co, unsigned int *lac)
+TReturn tcore_network_get_access_technology(CoreObject *co,
+               enum telephony_network_access_technology *result)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(lac != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       if (!result)
+               return TCORE_RETURN_EINVAL;
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       *result = po->act;
 
-       *lac = po->lac;
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_lac(CoreObject *co, unsigned int lac)
+TReturn tcore_network_set_lac(CoreObject *co, unsigned int lac)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->lac = lac;
-       return TRUE;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_rac(CoreObject *co, unsigned int *rac)
+TReturn tcore_network_get_lac(CoreObject *co, unsigned int *result)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(rac != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       *rac = po->rac;
-       return TRUE;
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       if (!result)
+               return TCORE_RETURN_EINVAL;
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       *result = po->lac;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_rac(CoreObject *co, unsigned int rac)
+TReturn tcore_network_set_rac(CoreObject *co, unsigned int rac)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->rac = rac;
-       return TRUE;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_cell_id(CoreObject *co, unsigned int *cell_id)
+TReturn tcore_network_get_rac(CoreObject *co, unsigned int *result)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(cell_id != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
 
-       *cell_id = po->cell_id;
-       return TRUE;
+       if (!result)
+               return TCORE_RETURN_EINVAL;
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       *result = po->rac;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id)
+TReturn tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->cell_id = cell_id;
-       return TRUE;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_plmn(CoreObject *co, char **plmn)
+TReturn tcore_network_get_cell_id(CoreObject *co, unsigned int *result)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(plmn != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
 
-       *plmn = tcore_strdup(po->plmn);
-       return TRUE;
+       if (!result)
+               return TCORE_RETURN_EINVAL;
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       *result = po->cell_id;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_plmn(CoreObject *co, const char *plmn)
+gboolean tcore_network_get_gsm_dtm_support(CoreObject *co)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(plmn != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, FALSE);
 
-       tcore_free(po->plmn);
-       po->plmn = tcore_strdup(plmn);
-       return TRUE;
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return FALSE;
+
+       return po->gsm_dtm_support;
 }
 
-gboolean tcore_network_get_short_name(CoreObject *co, char **short_name)
+TReturn tcore_network_set_gsm_dtm_support(CoreObject *co, gboolean state)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(short_name != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       *short_name = tcore_strdup(po->short_name);
-       return TRUE;
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       po->gsm_dtm_support = state;
+       dbg("gsm_dtm_support = %d", state);
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_short_name(CoreObject *co, const char *short_name)
+TReturn tcore_network_set_service_type(CoreObject *co,
+               enum telephony_network_service_type service_type)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(short_name != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
 
-       tcore_free(po->short_name);
-       po->short_name = tcore_strdup(short_name);
-       return TRUE;
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       po->service_type = service_type;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_long_name(CoreObject *co, char **long_name)
+TReturn tcore_network_get_service_type(CoreObject *co,
+               enum telephony_network_service_type *result)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(long_name != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       if (!result)
+               return TCORE_RETURN_EINVAL;
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       *long_name = tcore_strdup(po->long_name);
-       return TRUE;
+       *result = po->service_type;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_set_long_name(CoreObject *co, const char *long_name)
+TReturn tcore_network_operator_info_add(CoreObject *co,
+               const struct tcore_network_operator_info *noi)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(long_name != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       char plmn[7];
+       int mcc_index, mnc_index;
+
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+
+       if (!noi)
+               return TCORE_RETURN_EINVAL;
+
+       mcc_index = atoi(noi->mcc);
+       mnc_index = atoi(noi->mnc);
+
+       if (mcc_index > 999 || mnc_index > 999) {
+               err("mcc_index %d mnc_index %d", mcc_index, mnc_index);
+               return TCORE_RETURN_EINVAL;
+       }
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       g_strlcpy(plmn, noi->mcc, 4);
+       g_strlcpy(plmn+3, noi->mnc, 3);
+
+       if (g_hash_table_lookup(po->operator_info_hash, plmn)) {
+               //dbg("Remove existed (key:%s)", plmn);
+               g_hash_table_remove(po->operator_info_hash, plmn);
+       }
 
-       tcore_free(po->long_name);
-       po->long_name = tcore_strdup(long_name);
-       return TRUE;
+       //dbg("Adding mcc[%s] mnc[%s] name[%s] type[%d] in operator info table", noi->mcc, noi->mnc, noi->name, noi->type);
+       g_hash_table_insert(po->operator_info_hash, g_strdup(plmn), g_memdup(noi, sizeof(struct tcore_network_operator_info)));
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_network_get_operator_name(CoreObject *co,
-               const char *plmn, char **name)
+struct tcore_network_operator_info *
+tcore_network_operator_info_find(CoreObject *co, const char *mcc, const char *mnc)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       char *network_name;
-       tcore_check_return_value_assert(plmn != NULL, FALSE);
-       tcore_check_return_value_assert(name != NULL, FALSE);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-
-       network_name = (char *)g_hash_table_lookup(po->operator_name_hash, plmn);
-       *name = tcore_strdup(network_name);
-       return TRUE;
-}
+       struct private_object_data *po = NULL;
+       struct tcore_network_operator_info *data;
+       char plmn[7];
+       int mcc_index, mnc_index;
 
+       CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, NULL);
 
-gboolean tcore_network_set_operator_name(CoreObject *co,
-               const char *plmn, const char *name)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(plmn != NULL, FALSE);
-       tcore_check_return_value_assert(name != NULL, FALSE);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!mcc || !mnc)
+               return NULL;
 
-       dbg("Set Operator Name, PLMN: [%s], Name: [%s]", plmn, name);
+       mcc_index = atoi(mcc);
+       mnc_index = atoi(mnc);
 
-       g_hash_table_insert(po->operator_name_hash,
-                       tcore_strdup(plmn), tcore_strdup(name));
+       if (mcc_index > 999 || mnc_index > 999) {
+               err("mcc_index %d mnc_index %d", mcc_index, mnc_index);
+               return NULL;
+       }
+
+       po = tcore_object_ref_object(co);
+       if (!po)
+               return NULL;
+
+       g_strlcpy(plmn, mcc, 4);
+       g_strlcpy(plmn+3, mnc, 3);
+
+       data =  g_hash_table_lookup(po->operator_info_hash, plmn);
+
+       if (data) {
+               dbg("found mcc[%s], mnc[%s] name[%s] type[%d] in operator info table (%p)",
+                       data->mcc, data->mnc, data->name, data->type, po->operator_info_hash);
+       } else {
+               dbg("mcc[%s] mnc[%s] not present in operator table (%p)",
+                       mcc, mnc, po->operator_info_hash);
+       }
 
-       return TRUE;
+       return data;
 }
index 056c951..98a1e5a 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
+#include <glib.h>
+
 #include "tcore.h"
 #include "plugin.h"
+#include "queue.h"
+#include "user_request.h"
+#include "core_object.h"
 #include "co_phonebook.h"
 
-typedef struct {
-       TcorePbOps *ops;
-       gboolean init;
-       TelPbList support_list;
-       TelPbType pb_type;
-} PrivateObject;
+struct private_object_data {
+       struct tcore_phonebook_operations *ops;
+       gboolean b_init;
+       struct tel_phonebook_support_list support_list;
+       struct tel_phonebook_field_support_list field_support_list;
+       enum tel_phonebook_type selected;
+};
 
-static TelReturn _dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data)
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       TcorePbOps *phonebook = NULL;
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
-       phonebook = po->ops;
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, TCORE_RETURN_EINVAL);
 
+       po = tcore_object_ref_object(o);
+       if (!po || !po->ops)
+               return TCORE_RETURN_ENOSYS;
+
+       command = tcore_user_request_get_command(ur);
        switch (command) {
-       case TCORE_COMMAND_PHONEBOOK_GET_INFO:
-               if (phonebook->get_info)
-                       return phonebook->get_info(co,
-                               *(TelPbType *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_PHONEBOOK_READ_RECORD:
-               if (phonebook->read_record)
-                       return phonebook->read_record(co,
-                               (TelPbRecordInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_PHONEBOOK_UPDATE_RECORD:
-               if (phonebook->update_record)
-                       return phonebook->update_record(co,
-                               (TelPbUpdateRecord *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_PHONEBOOK_DELETE_RECORD:
-               if (phonebook->delete_record)
-                       return phonebook->delete_record(co,
-                               (TelPbRecordInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       default:
-               err("Unsupported Command:[%d]",command);
-               return TEL_RETURN_INVALID_PARAMETER;
+               case TREQ_PHONEBOOK_GETCOUNT:
+                       if (!po->ops->get_count)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_count(o, ur);
+                       break;
+
+               case TREQ_PHONEBOOK_GETMETAINFO:
+                       if (!po->ops->get_info)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_info(o, ur);
+                       break;
+
+               case TREQ_PHONEBOOK_GETUSIMINFO:
+                       if (!po->ops->get_usim_info)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_usim_info(o, ur);
+                       break;
+
+               case TREQ_PHONEBOOK_READRECORD:
+                       if (!po->ops->read_record)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->read_record(o, ur);
+                       break;
+
+               case TREQ_PHONEBOOK_UPDATERECORD:
+                       if (!po->ops->update_record)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->update_record(o, ur);
+                       break;
+
+               case TREQ_PHONEBOOK_DELETERECORD:
+                       if (!po->ops->delete_record)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->delete_record(o, ur);
+                       break;
+
+               default:
+                       break;
        }
-       err("Operation NOT supported");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *dest_po = NULL;
-       PrivateObject *src_po = tcore_object_ref_object(src);
+       struct private_object_data *po = NULL;
 
-       tcore_check_return_assert(src_po != NULL);
-       tcore_check_return_assert(src_po->ops != NULL);
-       tcore_check_return_assert(dest != NULL);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PHONEBOOK);
 
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcorePbOps));
-       tcore_object_link_object(dest, dest_po);
+       po = tcore_object_ref_object(o);
+       if (po) {
+               free(po);
+               tcore_object_link_object(o, NULL);
+       }
 }
 
-static void _po_free_hook(CoreObject *co)
+gboolean tcore_phonebook_get_status(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_assert(po != NULL);
-
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+       struct private_object_data *po = NULL;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE);
+       po = tcore_object_ref_object(o);
+       return po->b_init;
 }
 
-void tcore_phonebook_override_ops(CoreObject *co, TcorePbOps *ops)
+gboolean tcore_phonebook_set_status(CoreObject *o, gboolean b_init)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(ops != NULL);
-
-       if (ops->get_info)
-               po->ops->get_info = ops->get_info;
-       if (ops->read_record)
-               po->ops->read_record = ops->read_record;
-       if (ops->update_record)
-               po->ops->update_record = ops->update_record;
-       if (ops->delete_record)
-               po->ops->delete_record = ops->delete_record;
+       struct private_object_data *po = NULL;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE);
+       po = tcore_object_ref_object(o);
+       po->b_init = b_init;
+       return TRUE;
 }
 
-gboolean tcore_phonebook_get_status(CoreObject *co, gboolean *init_status)
+struct tel_phonebook_support_list* tcore_phonebook_get_support_list(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(init_status != NULL, FALSE);
-
-        *init_status = po->init;
-        return TRUE;
+       struct tel_phonebook_support_list *tmp;
+       struct private_object_data *po = NULL;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, NULL);
+       po = tcore_object_ref_object(o);
+       tmp = calloc(1, sizeof(struct tel_phonebook_support_list));
+       memcpy(tmp, &po->support_list, sizeof(struct tel_phonebook_support_list));
+       return tmp;
 }
 
-gboolean tcore_phonebook_set_status(CoreObject *co, gboolean init_status)
+gboolean tcore_phonebook_set_support_list(CoreObject *o, struct tel_phonebook_support_list *list)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-
-       po->init = init_status;
+       struct private_object_data *po = NULL;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE);
+       po = tcore_object_ref_object(o);
+       memcpy(&po->support_list, list, sizeof(struct tel_phonebook_support_list));
        return TRUE;
 }
 
-gboolean tcore_phonebook_get_support_list(CoreObject *co, TelPbList **pb_list)
+struct tel_phonebook_field_support_list* tcore_phonebook_get_field_support_list(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(pb_list != NULL, FALSE);
-
-       *pb_list = tcore_memdup(&po->support_list, sizeof(TelPbList));
-       return TRUE;
+       struct tel_phonebook_field_support_list *tmp;
+       struct private_object_data *po = NULL;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, NULL);
+       po = tcore_object_ref_object(o);
+       tmp = calloc(1, sizeof(struct tel_phonebook_field_support_list));
+       memcpy(tmp, &po->field_support_list, sizeof(struct tel_phonebook_field_support_list));
+       return tmp;
 }
 
-gboolean tcore_phonebook_set_support_list(CoreObject *co, TelPbList *pb_list)
+gboolean tcore_phonebook_set_field_support_list(CoreObject *o, struct tel_phonebook_field_support_list *list)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-
-       memcpy(&po->support_list, pb_list, sizeof(TelPbList));
+       struct private_object_data *po = NULL;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE);
+       po = tcore_object_ref_object(o);
+       memcpy(&po->field_support_list, list, sizeof(struct tel_phonebook_field_support_list));
        return TRUE;
 }
 
-gboolean tcore_phonebook_get_selected_type(CoreObject *co, TelPbType *pb_type)
+enum tel_phonebook_type tcore_phonebook_get_selected_type(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(pb_type != NULL, FALSE);
-
-       *pb_type = po->pb_type;
-       return TRUE;
+       struct private_object_data *po = NULL;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, PB_TYPE_UNKNOWNN);
+       po = tcore_object_ref_object(o);
+       return po->selected;
 }
 
-gboolean tcore_phonebook_set_selected_type(CoreObject *co, TelPbType pb_type)
+gboolean tcore_phonebook_set_selected_type(CoreObject *o, enum tel_phonebook_type t)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-
-       po->pb_type = pb_type;
+       struct private_object_data *po = NULL;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE);
+       po = tcore_object_ref_object(o);
+       po->selected = t;
        return TRUE;
 }
 
-gboolean tcore_phonebook_set_ops(CoreObject *co, TcorePbOps *ops)
+CoreObject *tcore_phonebook_new(TcorePlugin *p, const char *name,
+               struct tcore_phonebook_operations *ops, TcoreHal *hal)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!p)
+               return NULL;
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcorePbOps));
+       po->ops = ops;
+       po->selected = PB_TYPE_UNKNOWNN;
 
-       return TRUE;
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_PHONEBOOK);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
+
+       return o;
 }
 
-CoreObject *tcore_phonebook_new(TcorePlugin *p, TcorePbOps *ops, TcoreHal *hal)
+void tcore_phonebook_free(CoreObject *o)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-       tcore_check_return_value_assert(p != NULL, NULL);
-
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PHONEBOOK);
+       tcore_object_free(o);
+}
 
-       po = tcore_malloc0(sizeof(PrivateObject));
+void tcore_phonebook_set_ops(CoreObject *o, struct tcore_phonebook_operations *ops)
+{
+       struct private_object_data *po = NULL;
 
-       if (ops != NULL)
-               po->ops = tcore_memdup(ops, sizeof(TcorePbOps));
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PHONEBOOK);
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_PHONEBOOK);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
-       return co;
-}
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
 
-void tcore_phonebook_free(CoreObject *co)
-{
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_PHONEBOOK);
-       tcore_object_free(co);
+       po->ops = ops;
 }
index 6d93a0c..a5af014 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include "tcore.h"
 #include "plugin.h"
+#include "user_request.h"
 #include "co_ps.h"
+#include "co_network.h"
 
-typedef struct {
-       guint cid;
+struct p_callid_type{
+       unsigned int cid;
+       gboolean active;
+       gboolean connected;
+       gchar *apn;
        GSList *contexts;
-} TcorePsContextInfo;
+};
 
-typedef struct {
-       TcorePsOps *ops;
+struct private_object_data {
+       struct tcore_ps_operations *ops;
 
        gboolean online;
+       gint num_of_pdn;
 
-       TcorePsContextInfo context_id[TCORE_PS_MAX_CID + 1];
-} PrivateObject;
+       /* 1 ~ UMTS_PS_MAX_CID */
+       struct p_callid_type cid[PS_MAX_CID + 1];
+       //CoreObject *cid[PS_MAX_CID + 1];
 
-static TelReturn __ps_define_context(CoreObject *o, CoreObject *ps_context,
-       TcoreObjectResponseCallback cb, void *user_data);
-static TelReturn __ps_activate_context(CoreObject *o, CoreObject *ps_context,
-       TcoreObjectResponseCallback cb, void *user_data);
-static TelReturn __ps_deactivate_context(CoreObject *o, CoreObject *ps_context,
-       TcoreObjectResponseCallback cb, void *user_data);
+       GSList *context_list;
+};
 
-static TelReturn __dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data)
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       TcorePsOps *ps = NULL;
-       CoreObject **co_context;
-       PrivateObject *po = tcore_object_ref_object(co);
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
 
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
 
-       ps = po->ops;
-       co_context = (CoreObject **)request;
+       po = tcore_object_ref_object(o);
+       if (!po || !po->ops)
+               return TCORE_RETURN_ENOSYS;
 
+       command = tcore_user_request_get_command(ur);
        switch (command) {
-       case TCORE_COMMAND_PS_DEFINE_CONTEXT:
-               if (ps->define_context)
-                       return __ps_define_context(co, *co_context, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_PS_ACTIVATE_CONTEXT:
-               if (ps->activate_context)
-                       return __ps_activate_context (co, *co_context, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_PS_DEACTIVATE_CONTEXT:
-               if (ps->deactivate_context)
-                       return __ps_deactivate_context (co, *co_context, cb, (void *)user_data);
-               break;
-
-       default:
-               err("Unsupported Command: [0x%x]", command);
-               return TEL_RETURN_INVALID_PARAMETER;
+               default:
+                       break;
        }
 
-       err("Unsupported Operation");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
-}
-
-static void __po_free_hook(CoreObject *co)
-{
-       PrivateObject *po = NULL;
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
-
-       tcore_free(po->ops);
-       tcore_free(po);
-
-       tcore_object_link_object(co, NULL);
+       return TCORE_RETURN_SUCCESS;
 }
 
-static void __po_clone_hook(CoreObject *src, CoreObject *dest)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *src_po = tcore_object_ref_object(src);
-       PrivateObject *dest_po = NULL;
-
-       tcore_check_return_assert(src_po != NULL);
-       tcore_check_return_assert(src_po->ops != NULL);
+       struct private_object_data *po = NULL;
+       GSList *list;
 
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcorePsOps));
-       tcore_object_link_object(dest, dest_po);
-}
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return;
 
-void tcore_ps_override_ops(CoreObject *co, TcorePsOps *ops)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(ops != NULL);
+       if (po->context_list) {
+               for (list = po->context_list; list; list = list->next) {
+                       if (list->data)
+                               free(list->data);
 
-       if (ops->define_context)
-               po->ops->define_context = ops->define_context;
+                       list->data = NULL;
+               }
 
-       if (ops->activate_context)
-               po->ops->activate_context = ops->activate_context;
+               g_slist_free(po->context_list);
+               po->context_list = NULL;
+       }
 
-       if (ops->deactivate_context)
-               po->ops->deactivate_context = ops->deactivate_context;
+       free(po);
+       tcore_object_link_object(o, NULL);
 }
 
-gboolean tcore_ps_set_ops(CoreObject *co, TcorePsOps *ops)
+static gboolean _ps_is_active_context(CoreObject *o, CoreObject *ps_context)
 {
-       PrivateObject *po;
-       tcore_check_return_value (co != NULL, FALSE);
+       GSList *contexts = NULL;
+       CoreObject *s_context = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       int idx_cid = 0;
+       struct private_object_data *po = NULL;
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
-       }
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcorePsOps));
+       po = tcore_object_ref_object(o);
 
-       return TRUE;
-}
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) {
+               if (po->cid[idx_cid].cid == 0)
+                       continue;
 
-static gboolean  __ps_is_context_active(CoreObject *o, CoreObject *ps_context)
-{
-       guint idx_cid = 0;
-       PrivateObject *po = NULL;
+               contexts = po->cid[idx_cid].contexts;
+               if (!contexts)
+                       continue;
 
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+               while (contexts) {
+                       s_context = contexts->data;
+                       if (!s_context) {
+                               contexts = contexts->next;
+                               continue;
+                       }
 
-       dbg("Context [%p] to be checked for Activeness", ps_context);
+                       if (ps_context == s_context) {
+                               dbg("find contexts(%p) in cid(%d)", ps_context, idx_cid);
+                               return TRUE;
+                       }
 
-       po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert (po != NULL, FALSE);
-
-       for (idx_cid = 1; idx_cid <= TCORE_PS_MAX_CID; idx_cid++) {
-               if (po->context_id[idx_cid].cid) {
-                       CoreObject *s_context;
-                       GSList *contexts = po->context_id[idx_cid].contexts;
-                       while (contexts) {
-                               s_context = contexts->data;
-                               if (s_context) {
-                                               if (ps_context == s_context) {
-                                               dbg("Context: [%p] found with context ID: [%d] - [ACTIVE]",
-                                                       s_context, idx_cid);
-                                               return TRUE;
-                                       }
-                               }
-                               contexts = g_slist_next(contexts);
-                       }
+                       contexts = contexts->next;
                }
        }
 
-       dbg("Cannot find context: [%p] - [INACTIVE]", ps_context);
+       dbg("cannot find contexts(%p) ", ps_context);
+
        return FALSE;
 }
 
-static gboolean __ps_is_apn_duplicated(CoreObject *o, CoreObject *ps_context, guint *cid)
+static gboolean _ps_is_duplicated_apn(CoreObject *o, CoreObject *ps_context)
 {
-       PrivateObject *po = NULL;
-       gchar *t_apn = NULL;
-       guint idx_cid = 0;
+       GSList *contexts = NULL;
+       CoreObject *s_context = NULL;
+       gchar *t_apn = NULL, *s_apn = NULL;
+
+       int idx_cid = 0;
+       struct private_object_data *po = NULL;
 
-       dbg("Entered");
        CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
 
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert (po != NULL, FALSE);
-       if (FALSE == tcore_context_get_apn(ps_context, &t_apn)) {
-               dbg("No APN present for the given context");
-               return FALSE;
-       }
+       t_apn = tcore_context_get_apn(ps_context);
 
-       for (idx_cid = 1; idx_cid <= TCORE_PS_MAX_CID; idx_cid++) {
-               CoreObject *s_context;
-               gchar *s_apn = NULL;
-               GSList *contexts;
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) {
+               if (po->cid[idx_cid].cid == 0)
+                       continue;
 
-               if (po->context_id[idx_cid].cid == 0)
+               contexts = po->cid[idx_cid].contexts;
+               if (!contexts)
                        continue;
 
-               contexts = po->context_id[idx_cid].contexts;
-               for (; contexts; contexts = contexts->next) {
+               while (contexts) {
                        s_context = contexts->data;
-                       if ((s_context == NULL) || (ps_context == s_context))
+                       if (!s_context) {
+                               contexts = contexts->next;
                                continue;
+                       }
 
-                       if (FALSE == tcore_context_get_apn(s_context, &s_apn)) {
-                               tcore_free(s_apn);
+                       if (ps_context == s_context) {
+                               contexts = contexts->next;
                                continue;
                        }
 
+                       s_apn = tcore_context_get_apn(s_context);
                        if (g_strcmp0(t_apn, s_apn) == 0) {
-                               dbg("Target and Source have same APN");
-
+                               dbg("target and source context have same APN");
                                tcore_context_cp_service_info(ps_context, s_context);
-                               *cid = idx_cid;
-
-                               tcore_free(t_apn);
-                               tcore_free(s_apn);
+                               g_free(t_apn);
+                               g_free(s_apn);
                                return TRUE;
                        }
+                       g_free (s_apn);
 
-                       tcore_free(s_apn);
-                       s_apn = NULL;
+                       contexts = contexts->next;
                }
        }
 
-       dbg("No Duplicate APN present for the given context: [%p]", ps_context);
-       tcore_free(t_apn);
+       g_free(t_apn);
        return FALSE;
 }
 
-CoreObject *tcore_ps_new(TcorePlugin *plugin,
-       TcorePsOps *ops, TcoreHal *hal)
+static void _deactivate_context (gpointer context, gpointer user_data)
+{
+       if (!context || !user_data)
+               return;
+
+       tcore_ps_deactivate_context(user_data, context, NULL);
+}
+
+CoreObject *tcore_ps_new(TcorePlugin *p, const char *name,
+               struct tcore_ps_operations *ops, TcoreHal *hal)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-       tcore_check_return_value_assert(plugin != NULL, NULL);
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
+
+       if (!p)
+               return NULL;
+
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
 
-       co = tcore_object_new(plugin, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
+       }
 
-       po = tcore_malloc0(sizeof(PrivateObject));
-       if (ops != NULL)
-               po->ops = tcore_memdup(ops, sizeof(TcorePsOps));
+       po->ops = ops;
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_PS);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, __po_free_hook);
-       tcore_object_set_clone_hook(co, __po_clone_hook);
-       tcore_object_set_dispatcher(co, __dispatcher);
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_PS);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
 
-       return co;
+       return o;
 }
 
-void tcore_ps_free(CoreObject *co)
+void tcore_ps_free(CoreObject *o)
 {
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_PS);
-       tcore_object_free(co);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PS);
+       tcore_object_free(o);
 }
 
-gboolean tcore_ps_set_online(CoreObject *o, gboolean state)
+void tcore_ps_set_ops(CoreObject *o, struct tcore_ps_operations *ops)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PS);
+
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
+
+       po->ops = ops;
+}
+
+TReturn tcore_ps_add_context(CoreObject *o, CoreObject *ctx_o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+       CORE_OBJECT_CHECK_RETURN(ctx_o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       po->context_list = g_slist_insert(po->context_list, ctx_o, 0);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_ps_remove_context(CoreObject *o, CoreObject *ctx_o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+       CORE_OBJECT_CHECK_RETURN(ctx_o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       tcore_ps_clear_context_id(o, ctx_o);
+       po->context_list = g_slist_remove(po->context_list, ctx_o);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_ps_set_online(CoreObject *o, gboolean state)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
 
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert (po != NULL, FALSE);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        po->online = state;
-       dbg("PS Status: [%s]", (po->online ? "ONLINE" : "OFFLINE"));
+       dbg("ps status = %d", po->online);
 
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, guint cid)
+TReturn tcore_ps_set_num_of_pdn(CoreObject *o, gint numbers)
 {
-       PrivateObject *po = NULL;
-       guint idx;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
-       CORE_OBJECT_CHECK_RETURN(context, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
 
-       dbg("Entered");
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert (po != NULL, FALSE);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       if (cid == 0) {
-               /* Automatic assign */
-               dbg("Automatic assigning of CID");
-               for (idx = 1; idx <= TCORE_PS_MAX_CID; idx++) {
-                       if (po->context_id[idx].cid == 0) {
-                               po->context_id[idx].cid = idx;
+       if(numbers <= 0 || numbers > PS_MAX_CID) {
+               po->num_of_pdn = PS_MAX_CID;
+       } else {
+               po->num_of_pdn = numbers;
+       }
+       dbg("ps num of pdn = %d, numbers = %d", po->num_of_pdn, numbers);
 
-                               po->context_id[idx].contexts =
-                                       g_slist_append(po->context_id[idx].contexts, context);
+       return TCORE_RETURN_SUCCESS;
+}
 
-                               dbg("Assign CID [%d] to context: [%p]", idx, context);
-                               return tcore_context_set_id(context, idx);
-                       }
-                       else {
-                               dbg("CID: [%d] is not available", idx);
-                       }
+unsigned int tcore_ps_get_num_of_pdn(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
+
+       return po->num_of_pdn;
+}
+
+unsigned int tcore_ps_set_cid_active(CoreObject *o, unsigned int cid, unsigned int enable)
+{
+       int idx_cid = 0;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0);
+       if(cid == 0){
+               return 0;
+       }
+       po = tcore_object_ref_object(o);
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) {
+               if (po->cid[idx_cid].cid == cid){
+                       po->cid[idx_cid].active = enable;
+                       return 1;
                }
+       }
+
+       return 0;
+}
+
+unsigned int tcore_ps_get_cid_active(CoreObject *o, unsigned int cid)
+{
+       int idx_cid = 0;
+       struct private_object_data *po = NULL;
 
-               dbg("Can't find free CID");
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0);
+       if(cid == 0){
+               return 0;
        }
-       else {
-               /* Manual assign */
-               dbg("Manual assigning of CID: [%d]", cid);
-               if (po->context_id[cid].cid == cid) {
-                       po->context_id[cid].contexts =
-                               g_slist_append(po->context_id[cid].contexts, context);
 
-                       dbg("Assign CID [%d] to context: [%p]", cid, context);
-                       return tcore_context_set_id(context, cid);
+       po = tcore_object_ref_object(o);
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) {
+               if (po->cid[idx_cid].cid == cid){
+                       return po->cid[idx_cid].active;
                }
-               else {
-                       dbg("CID: [%d] is not available", cid);
+       }
+
+       return 0;
+}
+
+GSList* tcore_ps_get_active_cids(CoreObject *o)
+{
+       int idx_cid = 0;
+       GSList *active_list = NULL;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL);
+
+       po = tcore_object_ref_object(o);
+
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) {
+               if (po->cid[idx_cid].active){
+                       active_list = g_slist_append(active_list, &po->cid[idx_cid].cid);
                }
        }
 
-       dbg("Exiting");
-       return FALSE;
+       return active_list;
 }
 
-gboolean tcore_ps_clear_context_id(CoreObject *o, CoreObject *context)
+unsigned int tcore_ps_set_cid_connected(CoreObject *o, unsigned int cid, unsigned int connected)
 {
-       PrivateObject *po = NULL;
-       guint cid = 0, cnt = 0;
+       int idx_cid = 0;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
-       CORE_OBJECT_CHECK_RETURN(context, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0);
+       if(cid == 0){
+               return 0;
+       }
 
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert (po != NULL, FALSE);
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) {
+               if (po->cid[idx_cid].cid == cid){
+                       po->cid[idx_cid].connected = connected;
+                       return 1;
+               }
+       }
 
-       if (FALSE == tcore_context_get_id(context, &cid))
-               return FALSE;
+       return 0;
+}
 
-       if ((cid == 0) || (cid > TCORE_PS_MAX_CID))
-               return FALSE;
+unsigned int tcore_ps_get_cid_connected(CoreObject *o, unsigned int cid)
+{
+       int idx_cid = 0;
+       struct private_object_data *po = NULL;
 
-       /* Remove context */
-       po->context_id[cid].contexts = g_slist_remove(po->context_id[cid].contexts, context);
-       cnt = g_slist_length(po->context_id[cid].contexts);
-       if (cnt == 0)
-               po->context_id[cid].cid = 0;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0);
+       if(cid == 0){
+               return 0;
+       }
 
-       return tcore_context_set_id(context, 0);
+       po = tcore_object_ref_object(o);
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) {
+               if (po->cid[idx_cid].cid == cid){
+                       return po->cid[idx_cid].connected;
+               }
+       }
+
+       return 0;
 }
 
-CoreObject *tcore_ps_ref_context_by_role(CoreObject *o, TcoreContextRole role)
+GSList* tcore_ps_get_connected_cids(CoreObject *o)
 {
-       PrivateObject *po = NULL;
-       TcoreContextRole context_role;
-       guint idx_cid;
+       int idx_cid = 0;
+       GSList *active_list = NULL;
+       struct private_object_data *po = NULL;
+
        CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL);
 
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert (po != NULL, NULL);
 
-       for (idx_cid = 1; idx_cid <= TCORE_PS_MAX_CID; idx_cid++) {
-               CoreObject *s_context;
-               GSList *contexts;
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) {
+               if (po->cid[idx_cid].connected){
+                       active_list = g_slist_append(active_list, &po->cid[idx_cid].cid);
+               }
+       }
+
+       return active_list;
+}
 
-               if (po->context_id[idx_cid].cid == 0)
+unsigned int tcore_ps_is_active_apn(CoreObject *o, const char* apn)
+{
+       int idx_cid = 0;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0);
+
+       po = tcore_object_ref_object(o);
+
+       for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++){
+               if (po->cid[idx_cid].cid == 0)
                        continue;
 
-               contexts = po->context_id[idx_cid].contexts;
-               for (; contexts; contexts = contexts->next) {
-                       s_context = contexts->data;
+               if (g_strcmp0((const char*)po->cid[idx_cid].apn, apn) == 0 && po->cid[idx_cid].active) {
+                       return 1;
+               }
+       }
+
+       return 0;
+}
+
+CoreObject *tcore_ps_ref_context_by_role(CoreObject *o, enum co_context_role role)
+{
+       struct private_object_data *po = NULL;
+       GSList *list;
+       CoreObject *pdp_o;
+       TcorePlugin *p;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
 
-                       if (s_context == NULL)
+       p = tcore_object_ref_plugin(o);
+       if (!p)
+               return NULL;
+
+       if (po->context_list) {
+               for (list = po->context_list; list; list = list->next) {
+                       if (!list->data)
                                continue;
 
-                       if (FALSE == tcore_context_get_role(s_context, &context_role)) {
+                       pdp_o = list->data;
+                       if (!pdp_o)
                                continue;
-                       }
 
-                       if (context_role == role) {
-                               dbg("Target and Source have same Same role");
-                               return s_context;
-                       }
+                       if (tcore_object_get_type(pdp_o) != CORE_OBJECT_TYPE_PS_CONTEXT)
+                               continue;
+
+                       if (tcore_context_get_role(pdp_o) == role)
+                               return pdp_o;
                }
        }
+
        return NULL;
 }
 
-gboolean tcore_ps_ref_context_by_id(CoreObject *o, guint id, GSList **list)
+GSList *tcore_ps_ref_context_by_id(CoreObject *o, unsigned int id)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return NULL;
+
+       if (id == 0 || id > (unsigned int)po->num_of_pdn)
+               return NULL;
+
+       if (po->cid[id].cid != id)
+               return NULL;
+
+       return po->cid[id].contexts;
+}
+
+gboolean tcore_ps_any_context_activating_activated(CoreObject *o, int * state)
+{
+       struct private_object_data *po = NULL;
+       CoreObject *pdp_o;
+       gboolean ret = FALSE;
+       GSList *list = NULL;
+       enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED;
 
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(list != NULL, FALSE);
+       if (!po)
+               return ret;
 
-       if ((id == 0) || (id > TCORE_PS_MAX_CID))
-               return FALSE;
+       if (po->context_list) {
+               for (list = po->context_list; list; list = list->next) {
+                       if (!list->data)
+                               continue;
+
+                       pdp_o = list->data;
 
-       if (po->context_id[id].cid != id)
-               return FALSE;
+                       if (tcore_object_get_type(pdp_o) != CORE_OBJECT_TYPE_PS_CONTEXT)
+                               continue;
 
-       *list = po->context_id[id].contexts;
+                       context_state = tcore_context_get_state(pdp_o);
 
-       return TRUE;
+                       if(CONTEXT_STATE_ACTIVATED == context_state) {
+                               *state = CONTEXT_STATE_ACTIVATED;
+                               return  TRUE;
+                       }
+                       else if (CONTEXT_STATE_ACTIVATING == context_state){
+                               *state = CONTEXT_STATE_ACTIVATING;
+                               ret = TRUE;
+                               continue;
+                       }
+                       else if (CONTEXT_STATE_DEACTIVATING == context_state){
+                               *state = CONTEXT_STATE_DEACTIVATING;
+                               ret = TRUE;
+                               continue;
+                       }
+               }
+       }
+       return ret;
 }
 
-static TelReturn __ps_define_context(CoreObject *o, CoreObject *ps_context,
-       TcoreObjectResponseCallback cb, void *user_data)
+
+TReturn tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, unsigned char cid)
 {
-       PrivateObject *po = NULL;
-       guint cid = 0;
+       struct private_object_data *po = NULL;
+       unsigned char idx;
 
-       dbg(" Entered ps_context: [%p]", ps_context);
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TEL_RETURN_INVALID_PARAMETER);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+       CORE_OBJECT_CHECK_RETURN(context, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
 
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(ps_context != NULL, TEL_RETURN_INVALID_PARAMETER);
-
-       if (TRUE == __ps_is_context_active(o, ps_context)) {
-               dbg("Return, requested context is already in active state");
-               return TEL_RETURN_SUCCESS;
-       }
-
-       /*
-        * Check if APN of requested context is same as any active context
-        * if yes simply append context to list of that Context ID
-        */
-       if (TRUE == __ps_is_apn_duplicated(o, ps_context, &cid)) {
-               /* Append to Context ID list */
-               po->context_id[cid].contexts =
-                       g_slist_append(po->context_id[cid].contexts, ps_context);
-
-               /* Set Context ID */
-               tcore_context_set_id(ps_context, cid);
-               dbg("Duplicate APN present, added context[%p] to list of CID: [%d]",
-                       ps_context, cid);
-
-               return TEL_RETURN_SUCCESS;
-       }
-
-       /* New context to be defined assgin Context ID */
-       if (TRUE == tcore_context_get_id(ps_context, &cid)) {
-               dbg("Current context [%p] has context ID: [%d]", ps_context, cid);
-               if (cid == 0) {
-                       if (tcore_ps_assign_context_id(o, ps_context, 0) != TRUE) {
-                               err("Failed to assign context id to context");
-                               return TEL_RETURN_FAILURE;
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       if (cid > (unsigned int)po->num_of_pdn)
+               return TCORE_RETURN_PS_CID_ERROR;
+
+       if (cid == 0) {
+               /* Automatic assign */
+               for (idx = 1; idx <= po->num_of_pdn; idx++) {
+                       if (po->cid[idx].cid == 0) {
+                               po->cid[idx].cid = idx;
+                               po->cid[idx].contexts = g_slist_append(po->cid[idx].contexts, context);
+                               po->cid[idx].apn = tcore_context_get_apn(context);
+                               dbg("assign contexts(%p) in cid(%d), apn(%s)", context, idx, po->cid[idx].apn);
+                               return tcore_context_set_id(context, idx);
+                       }
+                       else {
+                               dbg("cid[%d] is not null", idx);
                        }
                }
-       } else {
-               err("Failed to get Context ID for context: [%p]", ps_context);
-               return TEL_RETURN_FAILURE;
+
+               dbg("can't find empty cid");
+       }
+       else {
+               /* Manual assign */
+               if (po->cid[cid].cid == cid) {
+                       po->cid[cid].contexts = g_slist_append(po->cid[cid].contexts, context);
+                       return tcore_context_set_id(context, cid);
+               }
+               else {
+                       dbg("cid[%d] is not null", cid);
+               }
        }
 
-       if (FALSE == tcore_context_get_id(ps_context, &cid))
-               return TEL_RETURN_FAILURE;
-       dbg("Context: [%p] CID: [%d]", ps_context, cid);
+       return TCORE_RETURN_PS_CID_ERROR;
+}
+
+TReturn tcore_ps_send_dormant_request(CoreObject *o, void *user_data)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
 
-       dbg("Sending 'Define Context' request to modem");
-       return po->ops->define_context(o, ps_context, cb, user_data);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       if (!po->online) {
+               dbg("ps network is not online !");
+               return TCORE_RETURN_PS_NETWORK_NOT_READY;
+       }
+
+       return po->ops->send_dormant_request(o, user_data);
+}
+
+TReturn tcore_ps_clear_context_id(CoreObject *o, CoreObject *context)
+{
+       struct private_object_data *po = NULL;
+       unsigned char i = 0, cnt = 0;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+       CORE_OBJECT_CHECK_RETURN(context, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       i = tcore_context_get_id(context);
+       if (i == 0) {
+               return TCORE_RETURN_PS_CID_ERROR;
+       }
+
+       if (i > po->num_of_pdn)
+               return TCORE_RETURN_PS_CID_ERROR;
+
+       po->cid[i].contexts = g_slist_remove(po->cid[i].contexts, context);
+       cnt = g_slist_length(po->cid[i].contexts);
+       if (cnt <= 0){
+               po->cid[i].cid = 0;
+               po->cid[i].active = FALSE;
+               po->cid[i].connected = FALSE;
+               g_free(po->cid[i].apn);
+               po->cid[i].apn = NULL;
+       }
+
+       return tcore_context_set_id(context, 0);
 }
 
-static TelReturn __ps_activate_context(CoreObject *o, CoreObject *ps_context,
-       TcoreObjectResponseCallback cb, void *user_data)
+TReturn tcore_ps_define_context(CoreObject *o, CoreObject *ps_context, void *user_data)
 {
-       PrivateObject *po = NULL;
-       TcoreContextState context_state = TCORE_CONTEXT_STATE_DEACTIVATED;
+       int rv;
+       struct private_object_data *po = NULL;
+       CoreObject *co_nw = NULL;
+       enum telephony_network_access_technology act = NETWORK_ACT_UNKNOWN;
 
-       dbg("Entered");
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
 
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TEL_RETURN_INVALID_PARAMETER);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       if (!ps_context)
+               return TCORE_RETURN_EINVAL;
+
+       rv = _ps_is_active_context(o, ps_context);
+       if (rv)
+               return TCORE_RETURN_SUCCESS;
+
+       co_nw = tcore_plugin_ref_core_object(tcore_object_ref_plugin(o), CORE_OBJECT_TYPE_NETWORK);
+       tcore_network_get_access_technology(co_nw, &act);
+       if( act >= NETWORK_ACT_IS95A && act <= NETWORK_ACT_EHRPD ){
+               tcore_context_set_tech_preference(ps_context,CONTEXT_TECH_3GPP2);
+       } else if ((act >= NETWORK_ACT_GSM && act <= NETWORK_ACT_GSM_UTRAN) || act == NETWORK_ACT_LTE){
+               tcore_context_set_tech_preference(ps_context,CONTEXT_TECH_3GPP);
+       } else {
+               tcore_context_set_tech_preference(ps_context,CONTEXT_TECH_INVALID);
+               err("Invalid tech preference");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       rv = _ps_is_duplicated_apn(o, ps_context);
+       if (rv) {
+               unsigned char cid = 0;
+               cid = tcore_context_get_id(ps_context);
+               po->cid[cid].contexts = g_slist_append(po->cid[cid].contexts, ps_context);
+               return TCORE_RETURN_SUCCESS;
+       }
+
+       if (tcore_context_get_id(ps_context) == 0) {
+               if (tcore_ps_assign_context_id(o, ps_context, 0) != TCORE_RETURN_SUCCESS)
+                       return TCORE_RETURN_PS_CID_ERROR;
+       }
+
+       dbg("contexts(%p), cid = %d", ps_context, tcore_context_get_id(ps_context));
+
+       return po->ops->define_context(o, ps_context, user_data);
+}
+
+TReturn tcore_ps_activate_context(CoreObject *o, CoreObject *ps_context, void *user_data)
+{
+       int rv;
+       struct private_object_data *po = NULL;
+       enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
 
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(ps_context != NULL, TEL_RETURN_INVALID_PARAMETER);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
        if (!po->online) {
-               err("PS service is NOT Online");
-               return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+               dbg("ps network is not online !");
+               return TCORE_RETURN_PS_NETWORK_NOT_READY;
        }
 
-       if (FALSE ==  __ps_is_context_active(o, ps_context)) {
-               err("Context: [%p] is NOT yet Defined!!!", ps_context);
-               return TEL_RETURN_INVALID_PARAMETER;
+       if (!ps_context)
+               return TCORE_RETURN_EINVAL;
+
+       rv = _ps_is_active_context(o, ps_context);
+       if (!rv)
+       {
+               dbg("it is not defined context");
+               return TCORE_RETURN_EINVAL;
        }
 
-       (void)tcore_context_get_state(ps_context, &context_state);
-       dbg("Context: [%p] Current state: [%d] ", ps_context, context_state);
+       rv = _ps_is_duplicated_apn(o, ps_context);
+       if (rv) {
+               dbg("context activation is already requested for the same apn(%s)",
+                       tcore_context_get_apn(ps_context));
+               return TCORE_RETURN_SUCCESS;
+       }
 
-       if (context_state == TCORE_CONTEXT_STATE_ACTIVATED)
-               return TEL_RETURN_SUCCESS;
-       else if (context_state == TCORE_CONTEXT_STATE_ACTIVATING)
-               return TEL_RETURN_SUCCESS;
-       else if (context_state == TCORE_CONTEXT_STATE_DEACTIVATING)
-               return TEL_RETURN_FAILURE;
+       context_state = tcore_context_get_state(ps_context);
 
-       /* Set state to ACTIVATING */
-       (void)tcore_context_set_state(ps_context, TCORE_CONTEXT_STATE_ACTIVATING);
+       if (context_state == CONTEXT_STATE_ACTIVATED){
+               dbg("Context state : CONTEXT_STATE_ACTIVATED");
+               return TCORE_RETURN_SUCCESS;
+       }
+       else if (context_state == CONTEXT_STATE_ACTIVATING){
+               dbg("Context state : CONTEXT_STATE_ACTIVATING");
+               return TCORE_RETURN_SUCCESS;
+       }
+       else if (context_state == CONTEXT_STATE_DEACTIVATING){
+               dbg("Context state : CONTEXT_STATE_DEACTIVATING");
+               return TCORE_RETURN_PS_DEACTIVATING;
+       }
+
+       dbg("cid = %d", tcore_context_get_id(ps_context));
+
+       tcore_context_set_state(ps_context, CONTEXT_STATE_ACTIVATING);
+       rv = po->ops->activate_context(o, ps_context, user_data);
+       if(rv != TCORE_RETURN_SUCCESS)
+               tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATED);
 
-       dbg("Sending 'Activate Context' request for context: [%p]", ps_context);
-       return po->ops->activate_context(o, ps_context, cb, user_data);
+       return rv;
 }
 
-static TelReturn __ps_deactivate_context(CoreObject *o, CoreObject *ps_context,
-       TcoreObjectResponseCallback cb, void *user_data)
+TReturn tcore_ps_deactivate_context(CoreObject *o, CoreObject *ps_context, void *user_data)
 {
-       PrivateObject *po = NULL;
-       TcoreContextState context_state = TCORE_CONTEXT_STATE_DEACTIVATED;
-       guint cid = 0;
+       int rv;
+       struct private_object_data *po = NULL;
+       enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED;
 
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TEL_RETURN_INVALID_PARAMETER);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
 
        po = tcore_object_ref_object(o);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(ps_context != NULL, TEL_RETURN_INVALID_PARAMETER);
-       dbg("Sending deactivation request for context[%p]", ps_context);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
        if (!po->online) {
-               dbg("PS service is not online");
-               return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+               dbg("ps network is not online !");
+               return TCORE_RETURN_PS_NETWORK_NOT_READY;
+       }
+
+       if (!ps_context)
+               return TCORE_RETURN_EINVAL;
+
+       rv = _ps_is_active_context(o, ps_context);
+       if (!rv)
+               return TCORE_RETURN_EINVAL;
+
+       rv = _ps_is_duplicated_apn(o, ps_context);
+       if (rv) {
+               unsigned char cid = 0;
+               cid = tcore_context_get_id(ps_context);
+               po->cid[cid].contexts = g_slist_remove(po->cid[cid].contexts, ps_context);
+               tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATED);
+               return TCORE_RETURN_SUCCESS;
        }
 
-       if (FALSE ==  __ps_is_context_active(o, ps_context)) {
-               dbg("Context is not in active state");
-               return TEL_RETURN_INVALID_PARAMETER;
+       context_state = tcore_context_get_state(ps_context);
+       if (context_state == CONTEXT_STATE_DEACTIVATED){
+               dbg("Context State : CONTEXT_STATE_DEACTIVATED");
+               return TCORE_RETURN_SUCCESS;
+       }
+       else if (context_state == CONTEXT_STATE_DEACTIVATING){
+               dbg("Context State : CONTEXT_STATE_DEACTIVATING");
+               return TCORE_RETURN_SUCCESS;
        }
+       else if (context_state == CONTEXT_STATE_ACTIVATING){
+               dbg("Context State :CONTEXT_STATE_ACTIVATING");
+               return TCORE_RETURN_PS_ACTIVATING;
+       }
+       tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATING);
+
+       rv = po->ops->deactivate_context(o, ps_context, user_data);
+       if(rv != TCORE_RETURN_SUCCESS)
+               tcore_context_set_state(ps_context, CONTEXT_STATE_ACTIVATED);
 
-       (void)tcore_context_get_id(ps_context, &cid);
-       if (g_slist_length(po->context_id[cid].contexts) > 1) {
-               /* Remove context from list and return Success */
-               po->context_id[cid].contexts =
-                       g_slist_remove(po->context_id[cid].contexts, ps_context);
+       return rv;
+}
+
+TReturn tcore_ps_deactivate_contexts(CoreObject *o)
+{
+       int temp_index = 0;
+       struct private_object_data *po = NULL;
+       GSList *contexts = NULL;
 
-               /* Set duplicated apn profile state to deactivated */
-               tcore_context_set_state(ps_context, TCORE_CONTEXT_STATE_DEACTIVATED);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
 
-               return TEL_RETURN_SUCCESS;
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
+
+       if (!po->online) {
+               dbg("ps network is not online !");
+               return TCORE_RETURN_PS_NETWORK_NOT_READY;
        }
 
-       (void)tcore_context_get_state(ps_context, &context_state);
-       dbg("Context: [%p] State: [%d]", ps_context, context_state);
-       if (context_state == TCORE_CONTEXT_STATE_DEACTIVATED)
-               return TEL_RETURN_SUCCESS;
-       else if (context_state == TCORE_CONTEXT_STATE_DEACTIVATING)
-               return TEL_RETURN_SUCCESS;
-       else if (context_state == TCORE_CONTEXT_STATE_ACTIVATING)
-               return TEL_RETURN_FAILURE;
+       for (temp_index = 1; temp_index <= po->num_of_pdn; temp_index++) {
+               if (po->cid[temp_index].cid != 0) {
+                       contexts = po->cid[temp_index].contexts;
+                       if(!contexts)
+                               continue;
 
-       tcore_context_set_state(ps_context, TCORE_CONTEXT_STATE_DEACTIVATING);
+                       g_slist_foreach (contexts, _deactivate_context, o);
+               }
+       }
 
-       dbg("Sending 'Deactivate Context' request for context: [%p]", ps_context);
-       return po->ops->deactivate_context(o, ps_context, cb , user_data);
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_ps_is_active_apn(CoreObject *o, const char *apn)
+TReturn tcore_ps_deactivate_cid(CoreObject *o, unsigned int cid)
 {
-       guint idx_cid = 0;
-       PrivateObject *po = NULL;
-       CoreObject *s_context  = NULL;
-       gchar *s_apn = NULL;
-       GSList *contexts;
+       int temp_index = 0;
+       struct private_object_data *po = NULL;
+       GSList *contexts = NULL;
 
-       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
 
        po = tcore_object_ref_object(o);
+       if (!po)
+               return TCORE_RETURN_EINVAL;
 
-       for (idx_cid = 1 ; idx_cid <= TCORE_PS_MAX_CID ; idx_cid++) {
-               contexts = po->context_id[idx_cid].contexts;
-               if (g_slist_length(contexts) == 0)
-                       continue;
+       if (!po->online) {
+               dbg("ps network is not online !");
+               return TCORE_RETURN_PS_NETWORK_NOT_READY;
+       }
 
-               if (contexts->data == NULL) {
-                       contexts = g_slist_next(contexts);
-                       continue;
-               }
+       for (temp_index = 1; temp_index <= po->num_of_pdn; temp_index++) {
+               if (po->cid[temp_index].cid != 0 && po->cid[temp_index].cid == cid) {
+                       contexts = po->cid[temp_index].contexts;
+                       if(!contexts)
+                               continue;
 
-               s_context = (CoreObject *)(contexts->data);
-               tcore_context_get_apn(s_context, &s_apn);
-               if (0 == g_strcmp0(apn, s_apn)) {
-                       dbg("'%s' APN is - [ACTIVE]", apn);
-                       tcore_free(s_apn);
-                       return TRUE;
+                       g_slist_foreach (contexts, _deactivate_context, o);
                }
-
-               tcore_free(s_apn);
-               s_apn = NULL;
-               contexts = g_slist_next(contexts);
        }
 
-       dbg("'%s' APN - [INACTIVE]", apn);
-       return FALSE;
+       return TCORE_RETURN_SUCCESS;
 }
index 142849f..c4adb6e 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include <glib.h>
 
 #include "tcore.h"
 #include "plugin.h"
+#include "queue.h"
+#include "user_request.h"
 #include "co_sap.h"
 
-typedef struct {
-       TcoreSapOps *ops;
-} PrivateObject;
+struct private_object_data {
+       struct tcore_sap_operations *ops;
+};
 
-static TelReturn _dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data)
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       TcoreSapOps *sap = NULL;
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
 
-       sap = po->ops;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_SAP, TCORE_RETURN_EINVAL);
 
+       po = tcore_object_ref_object(o);
+       if (!po || !po->ops)
+               return TCORE_RETURN_ENOSYS;
+
+       command = tcore_user_request_get_command(ur);
        switch (command) {
-       case TCORE_COMMAND_SAP_REQ_CONNECT:
-               if (sap->req_connect)
-                       return sap->req_connect(co,
-                               *(unsigned int *)request,
-                               cb, (void*)user_data);
-               break;
-
-       case TCORE_COMMAND_SAP_REQ_DISCONNECT:
-               if (sap->req_disconnect)
-                       return sap->req_disconnect(co, cb, (void*)user_data);
-               break;
-
-       case TCORE_COMMAND_SAP_GET_ATR:
-               if (sap->get_atr)
-                       return sap->get_atr(co, cb, (void*)user_data);
-               break;
-
-       case TCORE_COMMAND_SAP_REQ_TRANSFER_APDU:
-               if (sap->req_transfer_apdu)
-                       return sap->req_transfer_apdu(co,
-                               (const TelSapApdu *)request,
-                               cb, (void*)user_data);
-               break;
-
-       case TCORE_COMMAND_SAP_REQ_TRANSPORT_PROTOCOL:
-               if (sap->req_transport_protocol)
-                       return sap->req_transport_protocol(co,
-                               *(TelSimSapProtocol *)request,
-                               cb, (void*)user_data);
-               break;
-
-       case TCORE_COMMAND_SAP_REQ_POWER_OPERATION:
-               if (sap->req_power_operation)
-                       return sap->req_power_operation(co,
-                               *(TelSapPowerMode *)request,
-                               cb, (void*)user_data);
-               break;
-
-       case TCORE_COMMAND_SAP_GET_CARDREADER_STATUS:
-               if (sap->get_cardreader_status)
-                       return sap->get_cardreader_status(co, cb, (void*)user_data);
-               break;
-
-       default:
-               err("Unsupported command [0x%x]", command);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+               case TREQ_SAP_REQ_CONNECT:
+                       po = tcore_object_ref_object(o);
+                       if (!po->ops->connect)
+                               return TCORE_RETURN_ENOSYS;
 
-       err("Operation not Supported");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
-}
+                       return po->ops->connect(o, ur);
+                       break;
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
-{
-       PrivateObject *dest_po = NULL;
-       PrivateObject *src_po = tcore_object_ref_object(src);
+               case TREQ_SAP_REQ_DISCONNECT:
+                       if (!po->ops->disconnect)
+                               return TCORE_RETURN_ENOSYS;
 
-       tcore_check_return_assert(src_po != NULL);
-       tcore_check_return_assert(src_po->ops != NULL);
-       tcore_check_return_assert(dest != NULL);
+                       return po->ops->disconnect(o, ur);
+                       break;
 
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreSapOps));
+               case TREQ_SAP_REQ_STATUS:
+                       if (!po->ops->req_status)
+                               return TCORE_RETURN_ENOSYS;
 
-       tcore_object_link_object(dest, dest_po);
-}
+                       return po->ops->req_status(o, ur);
+                       break;
 
-static void _po_free_hook(CoreObject *co)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
+               case TREQ_SAP_REQ_ATR:
+                       if (!po->ops->get_atr)
+                               return TCORE_RETURN_ENOSYS;
 
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
-}
+                       return po->ops->get_atr(o, ur);
+                       break;
 
-void tcore_sap_override_ops(CoreObject *co, TcoreSapOps *ops)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
+               case TREQ_SAP_TRANSFER_APDU:
+                       if (!po->ops->transfer_apdu)
+                               return TCORE_RETURN_ENOSYS;
 
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(ops != NULL);
+                       return po->ops->transfer_apdu(o, ur);
+                       break;
 
-       if (ops->req_connect)
-               po->ops->req_connect = ops->req_connect;
+               case TREQ_SAP_SET_PROTOCOL:
+                       if (!po->ops->set_transport_protocol)
+                               return TCORE_RETURN_ENOSYS;
 
-       if (ops->req_disconnect)
-               po->ops->req_disconnect = ops->req_disconnect;
+                       return po->ops->set_transport_protocol(o, ur);
+                       break;
 
-       if (ops->get_atr)
-               po->ops->get_atr = ops->get_atr;
+               case TREQ_SAP_SET_POWER:
+                       if (!po->ops->set_power)
+                               return TCORE_RETURN_ENOSYS;
 
-       if (ops->req_transfer_apdu)
-               po->ops->req_transfer_apdu = ops->req_transfer_apdu;
+                       return po->ops->set_power(o, ur);
+                       break;
 
-       if (ops->req_transport_protocol)
-               po->ops->req_transport_protocol = ops->req_transport_protocol;
+               case TREQ_SAP_REQ_CARDREADERSTATUS:
+                       if (!po->ops->get_cardreader_status)
+                               return TCORE_RETURN_ENOSYS;
 
-       if (ops->req_power_operation)
-               po->ops->req_power_operation = ops->req_power_operation;
+                       return po->ops->get_cardreader_status(o, ur);
+                       break;
 
-       if (ops->get_cardreader_status)
-               po->ops->get_cardreader_status = ops->get_cardreader_status;
+               default:
+                       break;
+       }
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_sap_set_ops(CoreObject *co, TcoreSapOps *ops)
+static void _clone_hook(CoreObject *src, CoreObject *dest)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       struct private_object_data *src_po = NULL;
+       struct private_object_data *dest_po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!src || !dest)
+               return;
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+       dest_po = calloc(1, sizeof(struct private_object_data));
+       if (!dest_po) {
+               tcore_object_link_object(dest, NULL);
+               return;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSapOps));
+       src_po = tcore_object_ref_object(src);
+       dest_po->ops = src_po->ops;
 
-       return TRUE;
+       tcore_object_link_object(dest, dest_po);
 }
 
-CoreObject *tcore_sap_new(TcorePlugin *plugin, TcoreSapOps *ops, TcoreHal *hal)
+static void _free_hook(CoreObject *o)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-       tcore_check_return_value_assert(plugin != NULL, NULL);
+       struct private_object_data *po = NULL;
 
-       co = tcore_object_new(plugin, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAP);
 
-       po = tcore_malloc0(sizeof(PrivateObject));
+       po = tcore_object_ref_object(o);
+       if (po) {
+               free(po);
+               tcore_object_link_object(o, NULL);
+       }
+}
+
+CoreObject *tcore_sap_new(TcorePlugin *p, const char *name,
+               struct tcore_sap_operations *ops, TcoreHal *hal)
+{
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
+
+       if (!p)
+               return NULL;
+
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
+       }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup(ops, sizeof(TcoreSapOps));
+       po->ops = ops;
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_SAP);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_SAP);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_clone_hook(o, _clone_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
 
-       return co;
+       return o;
 }
 
-void tcore_sap_free(CoreObject *co)
+void tcore_sap_free(CoreObject *o)
 {
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SAP);
-       tcore_object_free(co);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAP);
+       tcore_object_free(o);
 }
+
+void tcore_sap_set_ops(CoreObject *o, struct tcore_sap_operations *ops)
+{
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAP);
+
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
+
+       po->ops = ops;
+}
\ No newline at end of file
index 7238983..baff4c6 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "tcore.h"
 #include "plugin.h"
 #include "queue.h"
+#include "user_request.h"
 #include "core_object.h"
 #include "util.h"
 #include "co_sat.h"
-#include "co_sim.h"
 
 #define SATK_PROACTIVE_CMD_TAG 0xD0  /*Proactive Command Tag*/
 #define SATK_MENU_SELECTION_TAG        0xD3  /*Menu Selection Tag*/
@@ -89,7 +90,9 @@
 #define SATK_OTHER_ADDRESS_TAG 0x3E /* OTHER ADDRESS        */
 #define SATK_NETWORK_ACCESS_TAG        0x47 /* NETWORK ACCESS NAME TAG */
 #define SATK_CDMA_SMS_TPDU_TAG 0x48 /* CDMA SMS TPDU TAG */
-#define SATK_REMOTE_ENTITY_ADDRESS_TAG 0x48 /* REMOTE ENTITY ADDRESS TAG */
+#define SATK_REMOTE_ENTITY_ADDRESS_TAG 0x49 /* REMOTE ENTITY ADDRESS TAG */
+#define SATK_TEXT_ATTRIBUTE_TAG        0x50    /* TEXT ATTRIBUTE TAG */
+#define SATK_TEXT_ATTRIBUTE_LIST_TAG   0x51    /* TEXT ATTRIBUTE LIST TAG */
 
 /* general data object lengths */
 #define SATK_DCS_LENGTH 0x01
 #define SATK_CHANNEL_DATA_LENGTH_VALUE_LENGTH  0x01 /*  CHANNEL DATA LENGTH VALUE LENGTH */
 #define SATK_CHANNEL_STATUS_LENGTH     0x02 /*  CHANNEL STATUS LENGTH */
 
-typedef struct {
-       TcoreSatOps *ops;
-} PrivateObject;
+struct private_object_data {
+       struct tcore_sat_operations *ops;
+};
 
-gboolean is_comprehensive = FALSE;
+gboolean b_comprehensive = FALSE;
 
-static TelReturn _dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, void *user_data)
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       PrivateObject *po = NULL;
-       po = tcore_object_ref_object(co);
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_SAT, TCORE_RETURN_EINVAL);
 
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
+       po = tcore_object_ref_object(o);
+       if (!po || !po->ops)
+               return TCORE_RETURN_ENOSYS;
 
-       dbg("Tcore SAT Command: %d", command);
+       command = tcore_user_request_get_command(ur);
        switch (command) {
-       case TCORE_COMMAND_SAT_REQ_ENVELOPE:
-               if (po->ops->send_envelope)
-                       return po->ops->send_envelope(co, request, cb, (void *)user_data);
-               break;
+               case TREQ_SAT_REQ_ENVELOPE:
+                       if (!po->ops->envelope)
+                               return TCORE_RETURN_ENOSYS;
 
-       case TCORE_COMMAND_SAT_REQ_TERMINAL_RESPONSE:
-               if (po->ops->send_terminal_response)
-                       return po->ops->send_terminal_response(co, request, cb, (void *)user_data);
-               break;
+                       return po->ops->envelope(o, ur);
+                       break;
 
-       case TCORE_COMMAND_SAT_REQ_USER_CONFIRMATION:
-               if (po->ops->send_user_confirmation)
-                       return po->ops->send_user_confirmation(co, request, cb, (void *)user_data);
-               break;
+               case TREQ_SAT_REQ_TERMINALRESPONSE:
+                       if (!po->ops->terminal_response)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->terminal_response(o, ur);
+                       break;
 
-       default:
-               err("unsupported operation");
-               return  TEL_RETURN_INVALID_PARAMETER;;
+               case TREQ_SAT_REQ_USERCONFIRMATION:
+                       if (!po->ops->user_confirmation)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->user_confirmation(o, ur);
+                       break;
+
+               default:
+                       break;
        }
-       err("Operation NOT Permitted");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
+static void _clone_hook(CoreObject *src, CoreObject *dest)
 {
-       PrivateObject *src_po = NULL;
-       PrivateObject *dest_po = NULL;
+       struct private_object_data *src_po = NULL;
+       struct private_object_data *dest_po = NULL;
 
-       tcore_check_return_assert(src != NULL);
-       tcore_check_return_assert(dest != NULL);
+       if (!src || !dest)
+               return;
 
-       src_po = tcore_object_ref_object(src);
-       if (NULL == src_po) {
-               err("invalid source private object");
+       dest_po = calloc(1, sizeof(struct private_object_data));
+       if (!dest_po) {
                tcore_object_link_object(dest, NULL);
                return;
        }
-       tcore_check_return_assert(src_po->ops != NULL);
 
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops  = tcore_memdup(src_po->ops, sizeof(TcoreSatOps));
+       src_po = tcore_object_ref_object(src);
+       dest_po->ops = src_po->ops;
 
        tcore_object_link_object(dest, dest_po);
 }
 
-static void _po_free_hook(CoreObject *co)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *po = NULL;
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
+       struct private_object_data *po = NULL;
 
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAT);
 
+       po = tcore_object_ref_object(o);
+       if (po) {
+               free(po);
+               tcore_object_link_object(o, NULL);
+       }
 }
 
-static gboolean _check_file_for_refresh(TelSimFileId file_id)
+static gboolean _check_file_for_refresh(enum tel_sim_file_id file_id)
 {
        int i;
-       TelSimFileId ef_under_mf[3] = { TEL_SIM_EF_DIR, TEL_SIM_EF_ELP, TEL_SIM_EF_ICCID };
-       TelSimFileId ef_under_df[29] = {
-               TEL_SIM_EF_IMSI,        TEL_SIM_EF_SST,
-               TEL_SIM_EF_EST, TEL_SIM_EF_OPLMN_ACT,
-               TEL_SIM_EF_GID1, TEL_SIM_EF_GID2,
-               TEL_SIM_EF_LP, TEL_SIM_EF_ECC,
-               TEL_SIM_EF_SPN, TEL_SIM_EF_SPDI,
-               TEL_SIM_EF_PNN, TEL_SIM_EF_OPL,
-               TEL_SIM_EF_MBDN,        TEL_SIM_EF_MSISDN,
-               //TEL_SIM_EF_UTEL_SIM_MBI, TEL_SIM_EF_UTEL_SIM_MWIS,
-               /*TEL_SIM_EF_UTEL_SIM_CFIS,*/   TEL_SIM_EF_CPHS_VOICE_MSG_WAITING,
-               TEL_SIM_EF_CPHS_SERVICE_STRING_TABLE, TEL_SIM_EF_CPHS_CALL_FORWARD_FLAGS,
-               TEL_SIM_EF_CPHS_OPERATOR_NAME_STRING,   TEL_SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE,
-               TEL_SIM_EF_CPHS_CPHS_INFO,      TEL_SIM_EF_CPHS_MAILBOX_NUMBERS,
-               TEL_SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING, TEL_SIM_EF_CPHS_INFORMATION_NUMBERS,
-               TEL_SIM_EF_CPHS_DYNAMICFLAGS, TEL_SIM_EF_CPHS_DYNAMIC2FLAG,
-               TEL_SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE_LINE2 };
+       enum tel_sim_file_id ef_under_mf[3] = { SIM_EF_DIR, SIM_EF_ELP, SIM_EF_ICCID };
+       enum tel_sim_file_id ef_under_df[29] = {
+               SIM_EF_IMSI,    SIM_EF_SST,
+               SIM_EF_EST,     SIM_EF_OPLMN_ACT,
+               SIM_EF_GID1, SIM_EF_GID2,
+               SIM_EF_LP, SIM_EF_ECC,
+               SIM_EF_SPN,     SIM_EF_SPDI,
+               SIM_EF_PNN,     SIM_EF_OPL,
+               SIM_EF_MBDN,    SIM_EF_MSISDN,
+               SIM_EF_USIM_MBI, SIM_EF_USIM_MWIS,
+               SIM_EF_USIM_CFIS,       SIM_EF_CPHS_VOICE_MSG_WAITING,
+               SIM_EF_CPHS_SERVICE_STRING_TABLE, SIM_EF_CPHS_CALL_FORWARD_FLAGS,
+               SIM_EF_CPHS_OPERATOR_NAME_STRING,       SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE,
+               SIM_EF_CPHS_CPHS_INFO,  SIM_EF_CPHS_MAILBOX_NUMBERS,
+               SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING, SIM_EF_CPHS_INFORMATION_NUMBERS,
+               SIM_EF_CPHS_DYNAMICFLAGS, SIM_EF_CPHS_DYNAMIC2FLAG,
+               SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE_LINE2 };
 
        dbg("[SAT] SAT PARSER - FILE ID=0x%04x", (unsigned int)file_id);
 
-       if ( (file_id & 0x2F00) == 0x2F00 )
+       if( (file_id & 0x2F00) == 0x2F00 )
        {
                dbg("[SAT] SAT PARSER - MF, EF=0x%04x",file_id);
-               for(i=0;i<3;i++) {
-                       if (file_id == ef_under_mf[i]) {
+               for(i=0;i<3;i++){
+                       if(file_id == ef_under_mf[i]){
                                dbg("[SAT] SAT PARSER - MATCH!");
                                return TRUE;
                        }
                }
        }
-       else if ( (file_id & 0x6F00) == 0x6F00)
+       else if( (file_id & 0x6F00) == 0x6F00)
        {
                dbg("[SAT] SAT PARSER - ADF_USIM EF=0x%04x",file_id);
-               for(i=0;i<29;i++) {
-                       if (file_id == ef_under_df[i]) {
+               for(i=0;i<29;i++){
+                       if(file_id == ef_under_df[i]){
                                dbg("[SAT] SAT PARSER - MATCH!");
                                return TRUE;
                        }
@@ -235,63 +242,63 @@ static gboolean _check_file_for_refresh(TelSimFileId file_id)
        return FALSE;
 }
 
-static int _get_length_filed_size(unsigned char first_len_byte)
+static int _get_length_filed_size(unsigned char firstLenByte)
 {
-       if (first_len_byte <= 0x7F) return 1;
-       else if (first_len_byte == 0x81) return 2;
+       if (firstLenByte <= 0x7F) return 1;
+       else if (firstLenByte == 0x81) return 2;
        else return 0; //return zero, as the length field can only be 1 or 2.
 }
 
 static void _get_string_data(unsigned char* src, int len,
-               TelSatTextTypeInfo *text_obj)
+               struct tel_sat_text_string_object *text_obj)
 {
-       tcore_check_return_assert(src != NULL);
-       tcore_check_return_assert(text_obj != NULL);
+       if (!src || !text_obj) return;
 
        switch (text_obj->dcs.a_format) {
-       case TEL_SAT_ALPHABET_FORMAT_SMS_DEFAULT: {
-               char* unpacked_str;
+               case ALPHABET_FORMAT_SMS_DEFAULT: {
+                       char* unpacked_str;
 
-               text_obj->string_length = 0;
-               unpacked_str = (char *)tcore_util_unpack_gsm7bit(src, (unsigned int)len);
-               if (!unpacked_str) {
-                       err("unpacked_str is null");
-                       return;
-               }
+                       text_obj->string_length = 0;
+                       unpacked_str = (char *)tcore_util_unpack_gsm7bit(src, (unsigned int)len);
+                       if (!unpacked_str) return;
 
-               text_obj->dcs.a_format = TEL_SAT_ALPHABET_FORMAT_8BIT_DATA;
-               text_obj->string_length = strlen(unpacked_str);
+                       text_obj->dcs.a_format = ALPHABET_FORMAT_8BIT_DATA;
+                       text_obj->string_length = strlen(unpacked_str);
 
-               if (text_obj->string_length >= TEL_SAT_TEXT_STRING_LEN_MAX) {
-                       text_obj->string_length = TEL_SAT_TEXT_STRING_LEN_MAX;
-                       memcpy(text_obj->string, unpacked_str, TEL_SAT_TEXT_STRING_LEN_MAX);
-                       text_obj->string[TEL_SAT_TEXT_STRING_LEN_MAX] = 0x00;
-               }
-               else {
-                       memcpy(text_obj->string, unpacked_str, text_obj->string_length);
-                       text_obj->string[text_obj->string_length] = 0x00;
-               }
+                       if (text_obj->string_length >= SAT_TEXT_STRING_LEN_MAX) {
+                               text_obj->string_length = SAT_TEXT_STRING_LEN_MAX;
+                               memcpy(text_obj->string, unpacked_str, SAT_TEXT_STRING_LEN_MAX);
+                               text_obj->string[SAT_TEXT_STRING_LEN_MAX] = 0x00;
+                       }
+                       else {
+                               memcpy(text_obj->string, unpacked_str, text_obj->string_length);
+                               text_obj->string[text_obj->string_length] = 0x00;
+                       }
 
-               tcore_free(unpacked_str);
-       } break;
-       case TEL_SAT_ALPHABET_FORMAT_UCS2:
-       case TEL_SAT_ALPHABET_FORMAT_8BIT_DATA:
-               if (text_obj->string_length >= TEL_SAT_TEXT_STRING_LEN_MAX) {
-                       text_obj->string_length = TEL_SAT_TEXT_STRING_LEN_MAX;
-                       memcpy(text_obj->string, src, TEL_SAT_TEXT_STRING_LEN_MAX);
-                       text_obj->string[TEL_SAT_TEXT_STRING_LEN_MAX] = 0x00;
-               }
-               else {
-                       memcpy(text_obj->string, src, text_obj->string_length);
-                       text_obj->string[text_obj->string_length] = 0x00;
-               }
-       break;
-       default:
-               err("[SAT] SAT PARSER -  Unknown alphabet format(%d)", text_obj->dcs.a_format);
+                       g_free(unpacked_str);
+               }break;
+               case ALPHABET_FORMAT_UCS2:
+               case ALPHABET_FORMAT_8BIT_DATA: {
+                       text_obj->string_length = len;
+                       if (text_obj->string_length >= SAT_TEXT_STRING_LEN_MAX) {
+                               text_obj->string_length = SAT_TEXT_STRING_LEN_MAX;
+                               memcpy(text_obj->string, src, SAT_TEXT_STRING_LEN_MAX);
+                               text_obj->string[SAT_TEXT_STRING_LEN_MAX] = 0x00;
+                       }
+                       else {
+                               memcpy(text_obj->string, src, text_obj->string_length);
+                               text_obj->string[text_obj->string_length+1] = 0x00;
+                       }
+               }break;
+               default: {
+                       dbg("[SAT] SAT PARSER -  Unknown alphabet format(%d)", text_obj->dcs.a_format);
+               }break;
        }
+
+       return;
 }
 
-static void _sat_decode_dcs(unsigned char dcs, TelSatDataCodingSchemeInfo* dsc_obj)
+static void _sat_decode_dcs(unsigned char dcs, struct data_coding_scheme* dsc_obj)
 {
        dbg("[SAT] SAT PARSER - dcs=[0x%x]", dcs);
        dsc_obj->raw_dcs = dcs;
@@ -303,37 +310,45 @@ static void _sat_decode_dcs(unsigned char dcs, TelSatDataCodingSchemeInfo* dsc_o
                dsc_obj->is_compressed_format = FALSE;
 
        //bit 4 when set, indicates that bits 0 & 1 have message class meaning.
-       dsc_obj->m_class = TEL_SAT_MSG_CLASS_NONE;
+       dsc_obj->m_class = MSG_CLASS_NONE;
        if (dcs & 0x10) {
                switch (dcs & 0x03) {
-               case 0x00:
-                       dsc_obj->m_class = TEL_SAT_MSG_CLASS_0;
-               break;
-               case 0x01:
-                       dsc_obj->m_class = TEL_SAT_MSG_CLASS_1;
-               break;
-               case 0x02:
-                       dsc_obj->m_class = TEL_SAT_MSG_CLASS_2;
-               break;
-               case 0x03:
-                       dsc_obj->m_class = TEL_SAT_MSG_CLASS_3;
+                       case 0x00:
+                               dsc_obj->m_class = MSG_CLASS_0;
+                               break;
+                       case 0x01:
+                               dsc_obj->m_class = MSG_CLASS_1;
+                               break;
+                       case 0x02:
+                               dsc_obj->m_class = MSG_CLASS_2;
+                               break;
+                       case 0x03:
+                               dsc_obj->m_class = MSG_CLASS_3;
+                               break;
+                       default:
+                               err("invalid dcs type");
+                               break;
                }
        }
 
        /*bits 2 & 3 indicate the character set being used*/
        switch (dcs & 0x0C) {
-       case 0x00:
-       case 0x0C:
-               dsc_obj->a_format = TEL_SAT_ALPHABET_FORMAT_SMS_DEFAULT;
-       break;
-       case 0x04:
-               dsc_obj->a_format = TEL_SAT_ALPHABET_FORMAT_8BIT_DATA;
-       break;
-       case 0X08:
-               dsc_obj->a_format = TEL_SAT_ALPHABET_FORMAT_UCS2;
-       break;
-       default:
-               dsc_obj->a_format = TEL_SAT_ALPHABET_FORMAT_RESERVED;
+               case 0x00:
+               case 0x0C:
+                       dsc_obj->a_format = ALPHABET_FORMAT_SMS_DEFAULT;
+                       break;
+
+               case 0x04:
+                       dsc_obj->a_format = ALPHABET_FORMAT_8BIT_DATA;
+                       break;
+
+               case 0X08:
+                       dsc_obj->a_format = ALPHABET_FORMAT_UCS2;
+                       break;
+
+               default:
+                       dsc_obj->a_format = ALPHABET_FORMAT_RESERVED;
+                       break;
        }
 
        dbg("[SAT] SAT PARSER - is_compressed_format(%d), msgClass(0x%x), alpha_format(0x%x)",
@@ -342,201 +357,204 @@ static void _sat_decode_dcs(unsigned char dcs, TelSatDataCodingSchemeInfo* dsc_o
        return;
 }
 
-static void _sat_decode_ton_npi(unsigned char ton_npi, TelSatTypeOfNum *ton, TelSatNumberingPlanIdentity *npi)
+static void _sat_decode_ton_npi(unsigned char ton_npi, enum type_of_number *ton, enum numbering_plan_identifier *npi)
 {
        int ton_value = 0;
        int npi_value = 0;
 
-       tcore_check_return_assert(ton != NULL);
-       tcore_check_return_assert(npi != NULL);
+       if(!ton || !npi)
+               return;
 
        ton_value = (ton_npi & 0x70) >> 4;
        *ton = ton_value;
-       if (*ton > TEL_SAT_TON_NETWORK_SPECIFIC)
-               *ton = TEL_SAT_TON_UNKNOWN;
+       if(*ton > TON_NETWORK_SPECIFIC)
+               *ton = TON_RESERVED_FOR_EXT;
 
        npi_value = (ton_npi & 0x0F);
-       switch(npi_value) {
-       case TEL_SAT_NPI_ISDN_TEL:
-       case TEL_SAT_NPI_DATA_NUMBERING_PLAN:
-       case TEL_SAT_NPI_TELEX:
-       case TEL_SAT_NPI_PRIVATE:
-       case TEL_SAT_NPI_RESERVED_FOR_EXT:
-               *npi = npi_value;
-       break;
-       default:
-               *npi = TEL_SAT_NPI_UNKNOWN;
+       switch(npi_value){
+               case NPI_ISDN_TEL:
+               case NPI_DATA_NUMBERING_PLAN:
+               case NPI_TELEX:
+               case NPI_PRIVATE:
+               case NPI_RESERVED_FOR_EXT:
+                       *npi = npi_value;
+                       break;
+               default:
+                       *npi = NPI_UNKNOWN;
+                       break;
        }
 
        dbg("[SAT] SAT PATSER - ton(0x%x) npi(0x%x)", *ton, *npi);
        return;
 }
 
-static TelSatLanguageInfo _sat_decode_language(unsigned char byte1, unsigned char byte2)
+static enum tel_sim_language_type _sat_decode_language(unsigned char byte1, unsigned char byte2)
 {
-       if ((byte1 == 'e')&&(byte2 == 'n')) {
-               return TEL_SAT_LP_ENGLISH;
-       } else if ((byte1 == 'd')&&(byte2 == 'e')) {
-               return TEL_SAT_LP_GERMAN;
-       } else if ((byte1 == 'i')&&(byte2 == 't')) {
-               return TEL_SAT_LP_ITALIAN;
-       } else if ((byte1 == 'f')&&(byte2 == 'r')) {
-               return TEL_SAT_LP_FRENCH;
-       } else if ((byte1 == 'e')&&(byte2 == 's')) {
-               return TEL_SAT_LP_SPANISH;
-       } else if ((byte1 == 'n')&&(byte2 == 'l')) {
-               return TEL_SAT_LP_DUTCH;
-       } else if ((byte1 == 's')&&(byte2 == 'v')) {
-               return TEL_SAT_LP_SWEDISH;
-       } else if ((byte1 == 'd')&&(byte2 == 'a')) {
-               return TEL_SAT_LP_DANISH;
-       } else if ((byte1 == 'p')&&(byte2 == 't')) {
-               return TEL_SAT_LP_PORTUGUESE;
-       } else if ((byte1 == 'f')&&(byte2 == 'i')) {
-               return TEL_SAT_LP_FINNISH;
-       } else if ((byte1 == 'n')&&(byte2 == 'o')) {
-               return TEL_SAT_LP_NORWEGIAN;
-       } else if ((byte1 == 'e')&&(byte2 == 'l')) {
-               return TEL_SAT_LP_GREEK;
-       } else if ((byte1 == 't')&&(byte2 == 'r')) {
-               return TEL_SAT_LP_TURKISH;
-       } else if ((byte1 == 'h')&&(byte2 == 'u')) {
-               return TEL_SAT_LP_HUNGARIAN;
-       } else if ((byte1 == 'p')&&(byte2 == 'i')) {
-               return TEL_SAT_LP_POLISH;
+       if((byte1 == 'e')&&(byte2 == 'n')){
+               return SIM_LANG_ENGLISH;
+       } else if((byte1 == 'd')&&(byte2 == 'e')){
+               return SIM_LANG_GERMAN;
+       } else if((byte1 == 'i')&&(byte2 == 't')){
+               return SIM_LANG_ITALIAN;
+       } else if((byte1 == 'f')&&(byte2 == 'r')){
+               return SIM_LANG_FRENCH;
+       } else if((byte1 == 'e')&&(byte2 == 's')){
+               return SIM_LANG_SPANISH;
+       } else if((byte1 == 'n')&&(byte2 == 'l')){
+               return SIM_LANG_DUTCH;
+       } else if((byte1 == 's')&&(byte2 == 'v')){
+               return SIM_LANG_SWEDISH;
+       } else if((byte1 == 'd')&&(byte2 == 'a')){
+               return SIM_LANG_DANISH;
+       } else if((byte1 == 'p')&&(byte2 == 't')){
+               return SIM_LANG_PORTUGUESE;
+       } else if((byte1 == 'f')&&(byte2 == 'i')){
+               return SIM_LANG_FINNISH;
+       } else if((byte1 == 'n')&&(byte2 == 'o')){
+               return SIM_LANG_NORWEGIAN;
+       } else if((byte1 == 'e')&&(byte2 == 'l')){
+               return SIM_LANG_GREEK;
+       } else if((byte1 == 't')&&(byte2 == 'r')){
+               return SIM_LANG_TURKISH;
+       } else if((byte1 == 'h')&&(byte2 == 'u')){
+               return SIM_LANG_HUNGARIAN;
+       } else if((byte1 == 'p')&&(byte2 == 'i')){
+               return SIM_LANG_POLISH;
        } else  {
-               err("[SAT] SAT PARSER -  unknown language, default to english.");
-               return TEL_SAT_LP_ENGLISH;
+               dbg("[SAT] SAT PARSER -  unknown language, default to english.");
+               return SIM_LANG_ENGLISH;
        }
 }
 
 /*
  * Decode TLV data object
  */
-static TelSatResult _sat_decode_address_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatAddressInfo* address_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_address_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_address* address_obj, int* consumed_data_len)
 {
        unsigned char* src_data;
-       int index, len_of_len = 0;
+       int temp_index, len_of_len = 0;
        int address_len = 0;
        gboolean comprehensive_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(address_obj!= NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || consumed_data_len == NULL || address_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || address_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index] & 0x7F) != SATK_ADDRESS_TAG) {
-               err("[SAT] SAT PARSER -  address TAG missing");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+       if ((src_data[temp_index] & 0x7F) != SATK_ADDRESS_TAG) {
+               dbg("[SAT] SAT PARSER -  address TAG missing");
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
        }
 
        //comprehensive required
-       if ((src_data[index++] & 0x80))
+       if((src_data[temp_index++] & 0x80))
                comprehensive_req = TRUE;
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
        if (!len_of_len) {
-               err("[SAT] SAT PARSER -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       address_len = src_data[index + len_of_len - 1];
+       address_len = src_data[temp_index + len_of_len - 1];
 
        //check the address length
-       index += len_of_len;
-       if ((index + address_len) > tlv_len) {
-               err("[SAT] SAT PARSER  -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       temp_index += len_of_len;
+       if ((temp_index + address_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER  -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        address_obj->dialing_number_len = 0;
-       if (address_len > 1) {
+       if(address_len > 1){
                char* str_ascii = NULL;
-               _sat_decode_ton_npi(src_data[index++], &address_obj->ton, &address_obj->npi);
-               str_ascii = tcore_util_convert_bcd_to_ascii((const char*)&src_data[index], address_len-1, TEL_SAT_DIALING_NUMBER_LEN_MAX);
-               if (str_ascii) {
+               _sat_decode_ton_npi(src_data[temp_index++], &address_obj->ton, &address_obj->npi);
+               str_ascii = tcore_util_convert_bcd2ascii((const char*)&src_data[temp_index], address_len-1, SAT_DIALING_NUMBER_LEN_MAX);
+               if(str_ascii){
                        memcpy(address_obj->dialing_number, str_ascii, strlen(str_ascii));
                        address_obj->dialing_number_len = strlen(str_ascii);
-                       tcore_free(str_ascii);
+                       g_free(str_ascii);
                }
        }
 
-       if (address_obj->dialing_number_len == 0) {
-               if (comprehensive_req) {
+       if(address_obj->dialing_number_len == 0){
+               if(comprehensive_req){
                        err("[SAT] SAT PARSER -  incorrect address");
-                       return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+                       return TCORE_SAT_REQUIRED_VALUE_MISSING;
                }
                dbg("comprehensive partial proactive command");
                //global variable (comprehensive_partial= TRUE)
        }
 
        *consumed_data_len = 1 + len_of_len + address_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_subaddress_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatSubAddressInfo* sub_address_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_subaddress_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_subaddress* sub_address_obj, int* consumed_data_len)
 {
        unsigned char* src_data;
-       int index, len_of_len = 0;
+       int temp_index, len_of_len = 0;
        int sub_address_len = 0;
        gboolean comprehensive_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(sub_address_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || consumed_data_len == NULL || sub_address_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || sub_address_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index] & 0x7F) != SATK_SUB_ADDRESS_TAG) {
-               err("[SAT] SAT PARSER -  sub address TAG missing");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+       if ((src_data[temp_index] & 0x7F) != SATK_SUB_ADDRESS_TAG) {
+               dbg("[SAT] SAT PARSER -  sub address TAG missing");
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
        }
 
        //comprehensive required
-       if ((src_data[index++] & 0x80))
+       if((src_data[temp_index++] & 0x80))
                comprehensive_req = TRUE;
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
        if (!len_of_len) {
-               err("[SAT] SAT PARSER -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       sub_address_len = src_data[index + len_of_len - 1];
+       sub_address_len = src_data[temp_index + len_of_len - 1];
 
        //check the address length
-       index += len_of_len;
-       if ((index + sub_address_len) > tlv_len) {
-               err("[SAT] SAT PARSER  -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       temp_index += len_of_len;
+       if ((temp_index + sub_address_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER  -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //sub address
-       if (sub_address_len <= 0) {
-               err("[SAT] SAT PARSER - no sub address data");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(sub_address_len <= 0){
+               dbg("[SAT] SAT PARSER - no sub address data");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        sub_address_obj->subaddress_len = sub_address_len;
-       if ( sub_address_obj->subaddress_len > TEL_SAT_CCP_DATA_LEN_MAX) {
-               if (comprehensive_req) {
-                       err("[SAT] SAT PARSER - sub address is too big");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if( sub_address_obj->subaddress_len > SAT_CCP_DATA_LEN_MAX){
+               if(comprehensive_req){
+                       dbg("[SAT] SAT PARSER - sub address is too big");
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                }
                else{
                        //bIsComprehensionPartial = TRUE;
@@ -544,64 +562,65 @@ static TelSatResult _sat_decode_subaddress_tlv(unsigned char* tlv_str, int tlv_l
                }
        }
        else{
-               memcpy(sub_address_obj->subaddress, &src_data[index], sub_address_obj->subaddress_len);
+               memcpy(sub_address_obj->subaddress, &src_data[temp_index], sub_address_obj->subaddress_len);
        }
 
        *consumed_data_len = 1 + len_of_len + sub_address_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_alpha_identifier_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatAlphaIdentifierInfo* alpha_id_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_alpha_identifier_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_alpha_identifier* alpha_id_obj, int* consumed_data_len)
 {
        unsigned char* src_data;
-       int index, len_of_len = 0;
+       int temp_index, len_of_len = 0;
        int alpha_len = 0;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(alpha_id_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || consumed_data_len == NULL || alpha_id_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || alpha_id_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++] & 0x7F) != SATK_ALPHA_IDENTIFIER_TAG) {
-               err("[SAT] SAT PARSER -  alphaID TAG missing");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if ((src_data[temp_index++] & 0x7F) != SATK_ALPHA_IDENTIFIER_TAG) {
+               dbg("[SAT] SAT PARSER -  alphaID TAG missing");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //length
        alpha_id_obj->is_exist = TRUE;
-       len_of_len = _get_length_filed_size(src_data[index]);
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
        if (!len_of_len) {
-               err("[SAT] SAT PARSER -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       alpha_len = alpha_id_obj->alpha_data_len = src_data[index + len_of_len - 1];
+       alpha_len = alpha_id_obj->alpha_data_len = src_data[temp_index + len_of_len - 1];
 
        //alpha identifier
-       index += len_of_len;
-       if ((index + alpha_len) > tlv_len) {
-               err("[SAT] SAT PARSER  -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       temp_index += len_of_len;
+       if ((temp_index + alpha_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER  -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        if (alpha_id_obj->alpha_data_len > 0) {
 
                unsigned char dcs;
 
-               if (alpha_id_obj->alpha_data_len >= TEL_SAT_ALPHA_ID_LEN_MAX)
-                       alpha_id_obj->alpha_data_len = TEL_SAT_ALPHA_ID_LEN_MAX - 1;
+               if (alpha_id_obj->alpha_data_len >= SAT_ALPHA_ID_LEN_MAX)
+                       alpha_id_obj->alpha_data_len = SAT_ALPHA_ID_LEN_MAX - 1;
 
-               memcpy(alpha_id_obj->alpha_data, &src_data[index], alpha_id_obj->alpha_data_len);
+               memcpy(alpha_id_obj->alpha_data, &src_data[temp_index], alpha_id_obj->alpha_data_len);
                alpha_id_obj->alpha_data[alpha_id_obj->alpha_data_len] = 0x00;
 
-               if (src_data[index] == 0x80 || src_data[index] == 0x81 || src_data[index] == 0x82)
+               if (src_data[temp_index] == 0x80 || src_data[temp_index] == 0x81 || src_data[temp_index] == 0x82)
                        dcs = 0X08;
                else
                        dcs = 0x04;
@@ -611,70 +630,69 @@ static TelSatResult _sat_decode_alpha_identifier_tlv(unsigned char* tlv_str, int
 
        *consumed_data_len = 1 + len_of_len + alpha_len;
        dbg("[SAT] SAT PARSER alphaId= %s", alpha_id_obj->alpha_data);
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_sub_address_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatSubAddressInfo* sub_address_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_sub_address_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_subaddress* sub_address_obj, int* consumed_data_len)
 {
-       unsigned int i = 0;
-       int index, len_of_len = 0;
+       int i = 0;
+       int temp_index, len_of_len = 0;
        int sub_address_len = 0;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(sub_address_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || consumed_data_len == NULL || sub_address_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || sub_address_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index] & 0x7F) != SATK_SUB_ADDRESS_TAG) {
-               err("[SAT] SAT PARSER -  address TAG missing");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+       if ((src_data[temp_index] & 0x7F) != SATK_SUB_ADDRESS_TAG) {
+               dbg("[SAT] SAT PARSER -  address TAG missing");
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
        }
 
        //comprehensive required
-       if ((src_data[index++] & 0x80))
+       if((src_data[temp_index++] & 0x80))
                comprehension_req = TRUE;
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
        if (!len_of_len) {
-               err("[SAT] SAT PARSER -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       sub_address_len = src_data[index + len_of_len - 1];
+       sub_address_len = src_data[temp_index + len_of_len - 1];
 
        //check the address length
-       index += len_of_len;
-       if ((index + sub_address_len) > tlv_len) {
-               err("[SAT] SAT PARSER  -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       temp_index += len_of_len;
+       if ((temp_index + sub_address_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER  -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (sub_address_len <= 0) {
-               err("[SAT] SAT PARSER  -  no sub address");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(sub_address_len <= 0){
+               dbg("[SAT] SAT PARSER  -  no sub address");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        sub_address_obj->subaddress_len = sub_address_len;
-       if (sub_address_obj->subaddress_len > TEL_SAT_SUB_ADDR_LEN_MAX) {
-               if (comprehension_req) {
-                       err("[SAT] SAT PARSER  -  comprehension_req");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
-               }
+       if(sub_address_obj->subaddress_len > SAT_SUB_ADDR_LEN_MAX){
+               if(comprehension_req)
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                else
                        sub_address_obj->subaddress_len = 0;
        }
        else{
-               memcpy(sub_address_obj->subaddress, &src_data[index],sub_address_obj->subaddress_len);
+               memcpy(sub_address_obj->subaddress, &src_data[temp_index],sub_address_obj->subaddress_len);
        }
 
        dbg("[SAT] SAT PARSER -  subAddressLen=%d",sub_address_obj->subaddress_len);
@@ -682,70 +700,69 @@ static TelSatResult _sat_decode_sub_address_tlv(unsigned char* tlv_str, int tlv_
                dbg("[SAT] SAT PARSER - 0x%02x\t",sub_address_obj->subaddress[i]);
 
        *consumed_data_len = 1+len_of_len+sub_address_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_ccp_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatCcpInfo* ccp_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_ccp_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_ccp* ccp_obj, int* consumed_data_len)
 {
-       unsigned int i = 0;
-       int index, len_of_len = 0;
+       int i = 0;
+       int temp_index, len_of_len = 0;
        int ccp_len = 0;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(ccp_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || consumed_data_len == NULL || ccp_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || ccp_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index] & 0x7F) != SATK_CAPABILITY_CONFIGURATION_PARAMETERS_TAG) {
-               err("[SAT] SAT PARSER -  CCP TAG missing");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+       if ((src_data[temp_index] & 0x7F) != SATK_CAPABILITY_CONFIGURATION_PARAMETERS_TAG) {
+               dbg("[SAT] SAT PARSER -  CCP TAG missing");
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
        }
 
        //comprehensive required
-       if ((src_data[index++] & 0x80))
+       if((src_data[temp_index++] & 0x80))
                comprehension_req = TRUE;
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
        if (!len_of_len) {
-               err("[SAT] SAT PARSER -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       ccp_len = src_data[index + len_of_len - 1];
+       ccp_len = src_data[temp_index + len_of_len - 1];
 
        //check the address length
-       index += len_of_len;
-       if ((index + ccp_len) > tlv_len) {
-               err("[SAT] SAT PARSER  -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       temp_index += len_of_len;
+       if ((temp_index + ccp_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER  -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (ccp_len <= 0) {
-               err("[SAT] SAT PARSER  -  no ccp data");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(ccp_len <= 0){
+               dbg("[SAT] SAT PARSER  -  no ccp data");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        ccp_obj->data_len = ccp_len;
-       if (ccp_obj->data_len > TEL_SAT_CCP_DATA_LEN_MAX) {
-               if (comprehension_req) {
-                       err("[SAT] SAT PARSER -  comprehension_req.");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
-               }
+       if(ccp_obj->data_len > SAT_CCP_DATA_LEN_MAX){
+               if(comprehension_req)
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                else
                        ccp_obj->data_len = 0;
        }
        else{
-               memcpy(ccp_obj->data, &src_data[index],ccp_obj->data_len);
+               memcpy(ccp_obj->data, &src_data[temp_index],ccp_obj->data_len);
        }
 
        dbg("[SAT] SAT PARSER -  ccp len=%d",ccp_obj->data_len);
@@ -753,1933 +770,2073 @@ static TelSatResult _sat_decode_ccp_tlv(unsigned char* tlv_str, int tlv_len,
                dbg("[SAT] SAT PARSER - 0x%02x\t",ccp_obj->data[i]);
 
        *consumed_data_len = 1+len_of_len+ccp_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_device_identities_tlv(unsigned char* tlv_str,
-               TelSatDeviceIdentitiesInfo* dev_id_obj)
+static enum tcore_sat_result _sat_decode_device_identities_tlv(unsigned char* tlv_str,
+               struct tel_sat_device_identities* dev_id_obj)
 {
-       int index = 0, i;
+       int temp_index = 0, i;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(dev_id_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || dev_id_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str ==NULL || dev_id_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if ((tlv_str[index++] & 0x7F) != SATK_DEVICE_IDENTITY_TAG) {
-               err("[SAT] SAT PARSER -  device identity tag missing.");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING; //send TR
+       if ((tlv_str[temp_index++] & 0x7F) != SATK_DEVICE_IDENTITY_TAG) {
+               dbg("[SAT] SAT PARSER -  device identity tag missing.");
+               return TCORE_SAT_REQUIRED_VALUE_MISSING; //send TR
        }
 
-       if (tlv_str[index++] != SATK_DEVICE_IDENTITY_LENGTH) {
-               err("[SAT] SAT PARSER -  device identity length incorrect.");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING; //send TR
+       if (tlv_str[temp_index++] != SATK_DEVICE_IDENTITY_LENGTH) {
+               dbg("[SAT] SAT PARSER -  device identity length incorrect.");
+               return TCORE_SAT_REQUIRED_VALUE_MISSING; //send TR
        }
 
        for (i = 0; i < 2; i++) {
-               switch (tlv_str[index]) {
-               case TEL_SAT_DEVICE_ID_KEYPAD:
-               case TEL_SAT_DEVICE_ID_DISPLAY:
-               case TEL_SAT_DEVICE_ID_EARPIECE:
-               case TEL_SAT_DEVICE_ID_SIM:
-               case TEL_SAT_DEVICE_ID_ME:
-               case TEL_SAT_DEVICE_ID_NETWORK:
-                       if (i == 0) dev_id_obj->src = tlv_str[index];
-                       if (i == 1) dev_id_obj->dest = tlv_str[index];
-               break;
-               default:
-                       if (tlv_str[index] >= 0x21 && tlv_str[index] <= 0x27) {
-                               dbg("BIP channel id(0x%x)", tlv_str[index]);
-                               if (i == 0) dev_id_obj->src = tlv_str[index];
-                               if (i == 1) dev_id_obj->dest = tlv_str[index];
-                       }
-                       else{
-                               err("unmatched device id");
-                               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
-                       }
+               switch (tlv_str[temp_index]) {
+                       case DEVICE_ID_KEYPAD:
+                       case DEVICE_ID_DISPLAY:
+                       case DEVICE_ID_EARPIECE:
+                       case DEVICE_ID_SIM:
+                       case DEVICE_ID_ME:
+                       case DEVICE_ID_NETWORK:
+                               if (i == 0) dev_id_obj->src = tlv_str[temp_index];
+                               if (i == 1) dev_id_obj->dest = tlv_str[temp_index];
+                               break;
+                       default:{
+                               if(tlv_str[temp_index] >= 0x21 && tlv_str[temp_index] <= 0x27){
+                                       dbg("BIP channel id(0x%x)", tlv_str[temp_index])
+                                       if (i == 0) dev_id_obj->src = tlv_str[temp_index];
+                                       if (i == 1) dev_id_obj->dest = tlv_str[temp_index];
+                               }
+                               else{
+                                       dbg("unmatched device id");
+                                       return TCORE_SAT_REQUIRED_VALUE_MISSING;
+                               }
+                       }break;
                }
-               index++;
+               temp_index++;
        }
 
        dbg("[SAT] SAT PARSER -  source=%d, dest=%d", dev_id_obj->src, dev_id_obj->dest);
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_duration_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatDurationInfo *duration_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_duration_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_duration *duration_obj, int* consumed_data_len)
 {
-       int index = 0;
+       int temp_index = 0;
        unsigned char* src_data = NULL;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(duration_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (!tlv_str || !duration_obj || !consumed_data_len) {
+               err("[SAT] SAT PARSER data is null");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len < curr_offset + 3) {
                err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++] & 0x7F) != SATK_DURATION_TAG) {
+       if ((src_data[temp_index++] & 0x7F) != SATK_DURATION_TAG) {
                err("[SAT] SAT PARSER -  duration tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       if (src_data[index++] != SATK_DURATION_LENGTH) {
+       if (src_data[temp_index++] != SATK_DURATION_LENGTH) {
                err("[SAT] SAT PARSER -  incorrect length value.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //time unit
-       switch (src_data[index]) {
-       case TEL_SAT_TIME_UNIT_MINUTES:
-       case TEL_SAT_TIME_UNIT_SECONDS:
-       case TEL_SAT_TIME_UNIT_TENTHS_OF_SECONDS:
-               duration_obj->time_unit = src_data[index];
-       break;
-       default:
-               duration_obj->time_unit = TEL_SAT_TIME_UNIT_RESERVED;
+       switch (src_data[temp_index]) {
+               case TIME_UNIT_MINUTES:
+               case TIME_UNIT_SECONDS:
+               case TIME_UNIT_TENTHS_OF_SECONDS:
+                       duration_obj->time_unit = src_data[temp_index];
+                       break;
+               default:
+                       duration_obj->time_unit = TIME_UNIT_RESERVED;
+                       break;
        }
 
        //interval
-       index++;
-       duration_obj->time_interval = src_data[index];
+       temp_index++;
+       duration_obj->time_interval = src_data[temp_index];
        *consumed_data_len = 4;
 
        dbg("[SAT] SAT PARSER -  timeUnit=%d, interval=%d", duration_obj->time_unit, duration_obj->time_interval);
 
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_item_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatMenuItemInfo* item_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_item_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_item_info* item_obj, int* consumed_data_len)
 {
-       int index, len_of_len=0, i=0;
+       int temp_index, len_of_len=0, i=0;
        int item_len =0;
+       unsigned char dcs;
        unsigned char* src_data = NULL;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(item_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || item_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || item_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT PARSER] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       /* ITEM TAG - 0x0F */
-       index = curr_offset;
+       //tag
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++]&0x7F) != SATK_ITEM_TAG) {
-               err("[SAT PARSER] ITEM TAG not found: [0x%02x]", src_data[index-1]);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((src_data[temp_index++]&0x7F) != SATK_ITEM_TAG){
+               dbg("[SAT] SAT PARSER -  tag not found.=%d",src_data[temp_index-1]);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       /* Item Length */
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
-               err("[SAT PARSER] Incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       //length
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       item_len = src_data[index+len_of_len-1];
+       item_len = src_data[temp_index+len_of_len-1];
 
-       index+=len_of_len;              /* index pointing to item */
-       if ((index+item_len) > tlv_len) {
-               err("[SAT PARSER] Incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       temp_index+=len_of_len; //temp_index pointing to item.
+       if((temp_index+item_len) > tlv_len){
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       memset(item_obj->text, 0x00,(TEL_SAT_ITEM_TEXT_LEN_MAX+1));
-       if (item_len <= 0) {
-               err("[SAT PARSER] Menu Text is NULL, remove the Menu");
+       memset(item_obj->text, 0x00,(SAT_ITEM_TEXT_LEN_MAX+1));
+       if(item_len <= 0){
+               dbg("[SAT] SAT PARSER -  menu_text is NULL, remove the menu");
                *consumed_data_len = 1+len_of_len+item_len;
-               return TEL_SAT_RESULT_SUCCESS;
+               return TCORE_SAT_SUCCESS;
        }
 
-       /* Item */
-       item_obj->item_id = src_data[index++];
-       dbg("[SAT PARSER] Item ID: [%d]", item_obj->item_id);
+       //item
+       item_obj->item_id = src_data[temp_index++];
        // fix for orange SIM issue
        // H0100078487 Strange Character display on SIM SAT
        // The string length was less than its real length
        // So garbage characters was displayed. To fix it, we would recalculate the real length.
-       dbg("[SAT PARSER] Text");
-       for(i = 0 ; i < (item_len - 1) ; i++) {
-               msg("   [SAT PARSER] - [%d]: [%c]", i, src_data[index+i]);
-               if (src_data[index+i] == 0xFF)
-                       break;
+       for(i=0; i<item_len-1;i++){
+               dbg("[SAT] %d: %c", i, src_data[temp_index+i]);
+               if(src_data[temp_index+i] == 0xFF) break;
        }
        item_obj->text_len = i;
 
-       if (item_obj->text_len <= 0) {
-               err("[SAT PARSER] Text length: [%d]", item_obj->text_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(item_obj->text_len <= 0){
+               dbg("[SAT] SAT PARSER -  text len = 0");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (item_obj->text_len > TEL_SAT_ITEM_TEXT_LEN_MAX)
-               item_obj->text_len = TEL_SAT_ITEM_TEXT_LEN_MAX;
+       if(item_obj->text_len >= SAT_ITEM_TEXT_LEN_MAX)
+               item_obj->text_len = SAT_ITEM_TEXT_LEN_MAX-1;
+
+       memcpy(item_obj->text, &src_data[temp_index], item_obj->text_len);
+       if (src_data[temp_index] == 0x80 || src_data[temp_index] == 0x81 || src_data[temp_index] == 0x82)
+               dcs = 0X08;
+       else
+               dcs = 0x04;
 
-       memcpy(item_obj->text, &src_data[index], item_obj->text_len);
-       dbg("[SAT PARSER] Item Text: [%s]", item_obj->text);
+       _sat_decode_dcs(dcs, &item_obj->dcs);
 
-       *consumed_data_len = 1+len_of_len+item_len;
 
-       return TEL_SAT_RESULT_SUCCESS;
+       dbg("[SAT] SAT PARSER -  item_text=%s", item_obj->text);
+       *consumed_data_len = 1+len_of_len+item_len;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_response_length_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatResponseLength *response_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_response_length_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_response_length *response_obj, int* consumed_data_len)
 {
-       int index = 0;
+       int temp_index = 0;
        unsigned char* src_data = NULL;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(response_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (!tlv_str || !response_obj || !consumed_data_len) {
+               err("[SAT] SAT PARSER data is null");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= curr_offset + 1) {
                err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++] & 0x7F) != SATK_RESPONSE_LENGTH_TAG) {
+       if ((src_data[temp_index++] & 0x7F) != SATK_RESPONSE_LENGTH_TAG) {
                err("[SAT] SAT PARSER -  response length tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       if (src_data[index++] != SATK_RESPONSE_LENGTH_LENGTH) {
+       if (src_data[temp_index++] != SATK_RESPONSE_LENGTH_LENGTH) {
                err("[SAT] SAT PARSER -  incorrect length value.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       response_obj->min = src_data[index++];
-       response_obj->max = src_data[index++];
+       response_obj->min = src_data[temp_index++];
+       response_obj->max = src_data[temp_index++];
        dbg("[SAT] SAT PARSER  min length(%d), max length(%d)", response_obj->min, response_obj->max);
 
        *consumed_data_len = 4;
-       if (response_obj->min > response_obj->max) {
+       if(response_obj->min > response_obj->max){
                err("[SAT] SAT PARSER - : min length is larger than max length");
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_sms_tpdu_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatSmsTpduInfo *sms_tpdu_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_sms_tpdu_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_sms_tpdu *sms_tpdu_obj, int* consumed_data_len)
 {
-       int index = 0, len_of_len = 0;
+       int temp_index = 0, len_of_len = 0;
        int tpdu_len = 0;
        unsigned char* src_data = NULL;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(sms_tpdu_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (!tlv_str || !sms_tpdu_obj || !consumed_data_len) {
+               err("[SAT] SAT PARSER data is null");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= curr_offset + 1) {
                err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++] & 0x7F) != SATK_SMS_TPDU_TAG) {
+       if ((src_data[temp_index++] & 0x7F) != SATK_SMS_TPDU_TAG) {
                err("[SAT] SAT PARSER -  sat tpdu tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       tpdu_len = src_data[index+len_of_len-1];
-       index += len_of_len;
+       tpdu_len = src_data[temp_index+len_of_len-1];
+       temp_index += len_of_len;
 
-       if (tpdu_len <= 0) {
-               err("[SAT] parser: invalid tpdu_len.");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
-       }
+       if(tpdu_len <= 0)
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
 
        //data len
        sms_tpdu_obj->data_len = tpdu_len;
-       if (sms_tpdu_obj->data_len > TEL_SAT_SMS_TPDU_SMS_DATA_LEN_MAX) {
-               sms_tpdu_obj->data_len = TEL_SAT_SMS_TPDU_SMS_DATA_LEN_MAX;
+       if(sms_tpdu_obj->data_len > SAT_SMS_TPDU_SMS_DATA_LEN_MAX){
+               sms_tpdu_obj->data_len = SAT_SMS_TPDU_SMS_DATA_LEN_MAX;
        }
 
        //data
-       memcpy(sms_tpdu_obj->data, &src_data[index], sms_tpdu_obj->data_len);
+       memcpy(sms_tpdu_obj->data, &src_data[temp_index], sms_tpdu_obj->data_len);
        dbg("[SAT] SAT PARSER tpdu_len (%d)", sms_tpdu_obj->data_len);
 
        *consumed_data_len = 1+len_of_len+tpdu_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_item_identifier_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, unsigned char *item_identifier, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_item_identifier_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_item_identifier *item_identifier_obj, int* consumed_data_len)
 {
-       int index = 0;
+       int temp_index = 0;
        unsigned char* src_data = NULL;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(item_identifier != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (!tlv_str || !item_identifier_obj || !consumed_data_len) {
+               err("[SAT] SAT PARSER data is null");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= curr_offset + 1) {
                err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++] & 0x7F) != SATK_ITEM_IDENTIFIER_TAG) {
+       if ((src_data[temp_index++] & 0x7F) != SATK_ITEM_IDENTIFIER_TAG) {
                err("[SAT] SAT PARSER -  Item identifier tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       if (src_data[index++] != SATK_ITEM_IDENTIFIER_LENGTH) {
+       if (src_data[temp_index++] != SATK_ITEM_IDENTIFIER_LENGTH) {
                err("[SAT] SAT PARSER -  incorrect length value.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       *item_identifier = src_data[index++];
+       item_identifier_obj->item_identifier = src_data[temp_index++];
        *consumed_data_len = 3;
-       dbg("[SAT] SAT PARSER item identifier(0x%02x)", item_identifier);
+       dbg("[SAT] SAT PARSER item identifier(0x%02x)", item_identifier_obj->item_identifier);
 
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_ss_string_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatSsStringInfo *ss_str_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_ss_string_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_ss_string *ss_str_obj, int* consumed_data_len)
 {
        char* str_ascii = NULL;
-       int index, len_of_len=0;
+       int temp_index, len_of_len=0;
        int ss_len =0;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(ss_str_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (!tlv_str || !ss_str_obj || !consumed_data_len) {
+               err("[SAT] SAT PARSER data is null");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= curr_offset + 1) {
                err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index] & 0x7F) != SATK_SS_STRING_TAG) {
+       if ((src_data[temp_index] & 0x7F) != SATK_SS_STRING_TAG) {
                err("[SAT] SAT PARSER -  SS string tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       if (src_data[index++]&0x80)
+       if(src_data[temp_index++]&0x80)
                comprehension_req = TRUE;
 
+       dbg("comprehension_req=[%d]", comprehension_req);
+
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       ss_len = src_data[index+len_of_len-1];
+       ss_len = src_data[temp_index+len_of_len-1];
        dbg("[SAT] parser: ss_tlv len=%d",ss_len);
 
-       index += len_of_len;
+       temp_index += len_of_len;
        ss_str_obj->string_len = 0;
 
        //ss data
-       if (ss_len <= 1) {
-               err("[SAT] parser: invalid ss_len.");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
-       }
+       if(ss_len <= 1)
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
 
-       _sat_decode_ton_npi(src_data[index++], &ss_str_obj->ton, &ss_str_obj->npi);
-       str_ascii = tcore_util_convert_bcd_to_ascii((const char*)&src_data[index], ss_len-1, TEL_SAT_SS_STRING_LEN_MAX);
-       if (str_ascii) {
+       _sat_decode_ton_npi(src_data[temp_index++], &ss_str_obj->ton, &ss_str_obj->npi);
+       str_ascii = tcore_util_convert_bcd2ascii((const char*)&src_data[temp_index], ss_len-1, SAT_SS_STRING_LEN_MAX);
+       if(str_ascii){
                memcpy(ss_str_obj->ss_string, str_ascii, strlen(str_ascii));
                ss_str_obj->string_len = strlen(str_ascii);
-               tcore_free(str_ascii);
+               g_free(str_ascii);
        }
 
         // 1 is the length of Tag.
        *consumed_data_len = 1 + len_of_len + ss_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_text_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatTextTypeInfo *text_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_text_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_text_string_object *text_obj, int* consumed_data_len)
 {
-       int index, len_of_len=0;
+       int temp_index, len_of_len=0;
        int text_len =0;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (!tlv_str || !consumed_data_len ) {
+               err("[SAT] parser: data is null");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
+       if(tlv_len <= (curr_offset+1)){
                err("[SAT] parser: incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index]&0x7F) != SATK_TEXT_STRING_TAG && (src_data[index]&0x7F) != SATK_DEFAULT_TEXT_TAG) {
-               err("[SAT] parser: text string tag missing, tag=0x%x",src_data[index]);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((src_data[temp_index]&0x7F) != SATK_TEXT_STRING_TAG && (src_data[temp_index]&0x7F) != SATK_DEFAULT_TEXT_TAG){
+               err("[SAT] parser: text string tag missing, tag=0x%x",src_data[temp_index]);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (src_data[index++]&0x80)
+       if(src_data[temp_index++]&0x80)
                comprehension_req = TRUE;
 
+       dbg("comprehension_req=[%d]", comprehension_req);
+
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       text_len = src_data[index+len_of_len-1];
-       dbg("[SAT] parser: text_tlv_len=%d",text_len);
-
-       index += len_of_len;
-       memset(text_obj->string, 0x00, TEL_SAT_TEXT_STRING_LEN_MAX);
+       text_len = src_data[temp_index+len_of_len-1];
+       temp_index += len_of_len;
+       memset(text_obj->string, 0x00, SAT_TEXT_STRING_LEN_MAX);
 
        //text
-       if (text_len <=1) {
+       if(text_len <=1){
                text_obj->string_length = 0;
        }else{
-               text_obj->string_length = text_len-1;
-               _sat_decode_dcs(src_data[index++], &text_obj->dcs);
-               _get_string_data(&src_data[index], text_obj->string_length, text_obj);
+               _sat_decode_dcs(src_data[temp_index++], &text_obj->dcs);
+               _get_string_data(&src_data[temp_index], text_len-1, text_obj);
        }
 
-        // 1 is the length of Tag.
+       dbg("[SAT] parser: text_tlv_len=%d, parsed text length=%d", text_len, text_obj->string_length);
+
+       // 1 is the length of Tag.
        *consumed_data_len = 1 + len_of_len + text_len;
 
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_tone_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatToneType *tone_type, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_tone_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_tone *tone_obj, int* consumed_data_len)
 {
-       int index;
+       int temp_index;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(tone_type != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || tone_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || tone_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index]&0x7F) != SATK_TONE_TAG) {
+       if((src_data[temp_index]&0x7F) != SATK_TONE_TAG){
                err("[SAT] parser: tone tag missing");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (src_data[index++]&0x80)
+       if(src_data[temp_index++]&0x80)
                comprehension_req = TRUE;
 
        //length
-       if (src_data[index++] != SATK_TONE_LENGTH) {
+       if (src_data[temp_index++] != SATK_TONE_LENGTH) {
                err("[SAT] SAT PARSER -  incorrect length value.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       if ((index+SATK_TONE_LENGTH) > tlv_len)
+       if((temp_index+SATK_TONE_LENGTH) > tlv_len)
        {
-               err("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (index+SATK_TONE_LENGTH),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               err("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+SATK_TONE_LENGTH),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tone
-       switch(src_data[index]) {
-       // standard supervisory tones
-       case TEL_SAT_DIAL_TONE:
-       case TEL_SAT_CALLED_SUBSCRIBER_BUSY:
-       case TEL_SAT_CONGESTION:
-       case TEL_SAT_RADIO_PATH_ACK:
-       case TEL_SAT_RADIO_PATH_NOT_AVAILABLE_CALL_DROPPED:
-       case TEL_SAT_ERR_SPECIAL_INFO:
-       case TEL_SAT_CALL_WAITING_TONE:
-       case TEL_SAT_RINGING_TONE:
-       // ME proprietary tones
-       case TEL_SAT_GENERAL_BEEP:
-       case TEL_SAT_POSITIVE_ACK_TONE:
-       case TEL_SAT_NEGATIVE_ACK_OR_ERROR_TONE:
-       case TEL_SAT_RINGING_TONE_SLCTD_BY_USR_FOR_INCOM_SPEECH_CALL:
-       case TEL_SAT_ALERT_TONE_SELECTED_BY_USER_FOR_INCOMING_SMS:
-       case TEL_SAT_CRITICAL_ALERT:
-       //Themed tones
-       case TEL_SAT_HAPPY_TONE:
-       case TEL_SAT_SAD_TONE:
-       case TEL_SAT_URGENT_ACTION_TONE :
-       case TEL_SAT_QUESTION_TONE:
-       case TEL_SAT_MESSAGE_RECEIVED_TONE      :
-       //Melody tones
-       case TEL_SAT_MELODY_1:
-       case TEL_SAT_MELODY_2:
-       case TEL_SAT_MELODY_3:
-       case TEL_SAT_MELODY_4:
-       case TEL_SAT_MELODY_5:
-       case TEL_SAT_MELODY_6:
-       case TEL_SAT_MELODY_7:
-       case TEL_SAT_MELODY_8:
-               dbg("[SAT] SAT PARSER -  Tone =0x%x", src_data[index]);
-               *tone_type = (TelSatToneType)src_data[index];
-       break;
-       case TEL_SAT_TONE_TYPE_RESERVED:
-       default:
-               err("[SAT] SAT PARSER -  Reserved value of Tone =0x%x", src_data[index]);
-               if (comprehension_req) {
-                       err("[SAT] parser: comprehension_req.");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
-               }
+       switch(src_data[temp_index])
+       {
+               // standard supervisory tones
+               case DIAL_TONE:
+               case CALLED_SUBSCRIBER_BUSY     :
+               case CONGESTION :
+               case RADIO_PATH_ACK:
+               case RADIO_PATH_NOT_AVAILABLE_CALL_DROPPED:
+               case ERR_SPECIAL_INFO:
+               case CALL_WAITING_TONE:
+               case RINGING_TONE:
+               // ME proprietary tones
+               case GENERAL_BEEP:
+               case POSITIVE_ACK_TONE:
+               case NEGATIVE_ACK_OR_ERROR_TONE:
+               case RINGING_TONE_SLCTD_BY_USR_FOR_INCOM_SPEECH_CALL:
+               case ALERT_TONE_SELECTED_BY_USER_FOR_INCOMING_SMS:
+               case CRITICAL_ALERT:
+               //Themed tones
+               case HAPPY_TONE:
+               case SAD_TONE:
+               case URGENT_ACTION_TONE :
+               case QUESTION_TONE:
+               case MESSAGE_RECEIVED_TONE      :
+               //Melody tones
+               case MELODY_1:
+               case MELODY_2:
+               case MELODY_3:
+               case MELODY_4:
+               case MELODY_5:
+               case MELODY_6:
+               case MELODY_7:
+               case MELODY_8:
+                       dbg("[SAT] SAT PARSER -  Tone =0x%x", src_data[temp_index]);
+                       tone_obj->tone_type = src_data[temp_index];
+                       break;
+
+               case TONE_TYPE_RESERVED:
+               default:
+                       dbg("[SAT] SAT PARSER -  Reserved value of Tone =0x%x", src_data[temp_index]);
+                       if(comprehension_req)
+                               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+                       break;
        }
 
        *consumed_data_len = 3;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_ussd_string_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatUssdStringInfo *ussd_str_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_ussd_string_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_ussd_string *ussd_str_obj, int* consumed_data_len)
 {
-       int index, len_of_len=0;
+       int temp_index, len_of_len=0;
        int ussd_len =0;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(ussd_str_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (!tlv_str || !ussd_str_obj || !consumed_data_len) {
+               err("[SAT] SAT PARSER data is null");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= curr_offset + 1) {
                err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index] & 0x7F) != SATK_USSD_STRING_TAG) {
+       if ((src_data[temp_index] & 0x7F) != SATK_USSD_STRING_TAG) {
                err("[SAT] SAT PARSER -  SS string tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       if (src_data[index++]&0x80)
+       if(src_data[temp_index++]&0x80)
                comprehension_req = TRUE;
 
+       dbg("comprehension_req=[%d]", comprehension_req);
+
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       ussd_len = src_data[index+len_of_len-1];
+       ussd_len = src_data[temp_index+len_of_len-1];
        dbg("[SAT] parser: ussd_tlv len=%d",ussd_len);
 
-       index += len_of_len;
+       temp_index += len_of_len;
        ussd_str_obj->string_len = 0;
 
        //ussd data
-       if (ussd_len <= 1) {
-               err("[SAT] parser: invalid  ussd_len");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
-       }
+       if(ussd_len <= 1)
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
 
-       _sat_decode_dcs(src_data[index++], &ussd_str_obj->dsc);
+       _sat_decode_dcs(src_data[temp_index++], &ussd_str_obj->dsc);
        ussd_str_obj->string_len = ussd_len - 1;
-       memcpy(ussd_str_obj->ussd_string, &src_data[index], ussd_str_obj->string_len);
+       memcpy(ussd_str_obj->ussd_string, &src_data[temp_index], ussd_str_obj->string_len);
 
         // 1 is the length of Tag.
        *consumed_data_len = 1 + len_of_len + ussd_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_file_list_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatFileListInfo *file_list_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_file_list_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_file_list *file_list_obj, int* consumed_data_len)
 {
        //tmp
-       int tmp_cnt, tmp_path_len;
+       int tmp_cnt;
        int f_count;
        unsigned int ef = 0x0000;
 
-       int index, len_of_len=0;
+       int temp_index, len_of_len=0;
        int file_list_len = 0;
        unsigned char* src_data;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(file_list_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || file_list_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || file_list_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index]&0x7F) != SATK_FILE_LIST_TAG) {
-               err("[SAT] parser: tag missing, tag=0x%x",src_data[index]);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((src_data[temp_index]&0x7F) != SATK_FILE_LIST_TAG){
+               err("[SAT] parser: tag missing, tag=0x%x",src_data[temp_index]);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       file_list_len = src_data[index+len_of_len-1];
-       index += len_of_len;
+       file_list_len = src_data[temp_index+len_of_len-1];
+       temp_index += len_of_len;
 
-       if ((index+file_list_len) > tlv_len) {
-               err("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+file_list_len),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((temp_index+file_list_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+file_list_len),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       tmp_cnt = src_data[index++];
-       tmp_path_len = file_list_len - 1;
+       tmp_cnt = src_data[temp_index++];
        file_list_obj->file_count = 0;
-       memset(file_list_obj->file_id, 0, TEL_SAT_FILE_ID_LIST_MAX_COUNT);
+       memset(file_list_obj->file_id, 0, SAT_FILE_ID_LIST_MAX_COUNT);
 
-       if (!tmp_cnt) {
-               err("file cnt = 0");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(!tmp_cnt){
+               dbg("file cnt = 0");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        f_count = 0;
        do{
                ef = 0x0000;
-               if ( src_data[index] != 0x3F || src_data[index+1] != 0x00) {
-                       index++;
-                       if (index > tlv_len) break;
+               if( src_data[temp_index] != 0x3F || src_data[temp_index+1] != 0x00){
+                       temp_index++;
+                       if(temp_index > tlv_len) break;
                        else continue;
                }
-               index+=2; //MASTER FILE (DIR) 0x3F00
+               temp_index+=2; //MASTER FILE (DIR) 0x3F00
 
-               if (src_data[index] == 0x2F) {
+               if(src_data[temp_index] == 0x2F){
                //ELEMENTRY FILE (VALUE)
-                       ef = src_data[index] << 8;
-                       index++;
-                       ef = ef | src_data[index];
+                       ef = src_data[temp_index] << 8;
+                       temp_index++;
+                       ef = ef | src_data[temp_index];
 
-                       if ( _check_file_for_refresh((TelSimFileId)ef) ) {//check file registered for refresh?
+                       if( _check_file_for_refresh((enum tel_sim_file_id)ef) ){//check file registered for refresh?
                                file_list_obj->file_id[file_list_obj->file_count] = ef;
                                file_list_obj->file_count++;
                        }
-
                }
-               else if (src_data[index] == 0x7F && src_data[index+1] == 0xFF) {
+               else if(src_data[temp_index] == 0x7F && src_data[temp_index+1] == 0xFF){
                //USIM DIRECTORY FILE (DIR) 0x7FFF
-                       index+=2;
-                       if (src_data[index] == 0x6F) {
+                       temp_index+=2;
+                       if(src_data[temp_index] == 0x6F){
                                ef = 0x6A << 8;
-                               index++;
-                               ef = ef | src_data[index];
+                               temp_index++;
+                               ef = ef | src_data[temp_index];
 
-                               if ( _check_file_for_refresh((TelSimFileId)ef) ) {//check file registered for refresh?
+                               if( _check_file_for_refresh((enum tel_sim_file_id)ef) ){//check file registered for refresh?
                                        file_list_obj->file_id[file_list_obj->file_count] = ef;
                                        file_list_obj->file_count++;
                                }
                        }
                        else{
-                               index++;
+                               temp_index++;
                        }
                }
-               else if (src_data[index] == 0x7F && (src_data[index+1] == 0x10 || src_data[index+1] == 0x20) ) {
+               else if(src_data[temp_index] == 0x7F && (src_data[temp_index+1] == 0x10 || src_data[temp_index+1] == 0x20) ){
                //TELECOM DIRECTORY FILE 0x7F10 or GSM DIRECTORY FILE 0x7F20
-                       index+=2;
-                       if (src_data[index] == 0x6F) {
-                               ef = src_data[index] << 8;
-                               index++;
-                               ef = ef | src_data[index];
+                       temp_index+=2;
+                       if(src_data[temp_index] == 0x6F){
+                               ef = src_data[temp_index] << 8;
+                               temp_index++;
+                               ef = ef | src_data[temp_index];
 
-                               if ( _check_file_for_refresh((TelSimFileId)ef) ) {//check file registered for refresh?
+                               if( _check_file_for_refresh((enum tel_sim_file_id)ef) ){//check file registered for refresh?
                                        file_list_obj->file_id[file_list_obj->file_count] = ef;
                                        file_list_obj->file_count++;
                                }
                        }
                        else{
-                               index++;
+                               temp_index++;
                        }
                }
 
                f_count++;
-               index++;
+               temp_index++;
        }while( f_count < tmp_cnt);
 
        dbg("[SAT] SAT PARSER -  total file count=%d, PDA file count = %d", tmp_cnt, file_list_obj->file_count);
        *consumed_data_len = 1 + len_of_len + file_list_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_item_next_action_indicator_tlv(unsigned char* tlv_str,
+static enum tcore_sat_result _sat_decode_item_next_action_indicator_tlv(unsigned char* tlv_str,
                int tlv_len, int curr_offset,
-               TelSatItemsNextActionIndiListInfo* item_next_act_indi_obj,
+               struct tel_sat_item_next_action_indicatior_list* item_next_act_indi_obj,
                int* consumed_data_len)
 {
-       int index;
+       int temp_index;
        int item_nai_len;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(item_next_act_indi_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || item_next_act_indi_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || item_next_act_indi_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index]&0x7F) != SATK_ITEMS_NEXT_ACTION_INDICATOR_TAG) {
-               err("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((src_data[temp_index]&0x7F) != SATK_ITEMS_NEXT_ACTION_INDICATOR_TAG){
+               dbg("[SAT] SAT PARSER - tag not found.=%d",src_data[temp_index]);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if ((src_data[index++]&0x7F))
+       if((src_data[temp_index++]&0x7F))
                comprehension_req = TRUE;
 
        //item cnt
-       item_nai_len = item_next_act_indi_obj->cnt = src_data[index++];
-       if ((index+item_nai_len) > tlv_len) {
-               err("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+item_nai_len),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       item_nai_len = item_next_act_indi_obj->cnt = src_data[temp_index++];
+       if((temp_index+item_nai_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+item_nai_len),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (item_next_act_indi_obj->cnt > TEL_SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT) {
-               if (comprehension_req == TRUE) {
-                       err("[SAT] SAT PARSER - list count exceeds maximum allowed count=%d",item_next_act_indi_obj->cnt);
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(item_next_act_indi_obj->cnt > SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT) {
+               if(comprehension_req == TRUE) {
+                       dbg("[SAT] SAT PARSER - list count exceeds maximum allowed count=%d",item_next_act_indi_obj->cnt);
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                }
                item_next_act_indi_obj->cnt = 0;
        }
 
-       memset(item_next_act_indi_obj->indicator_list, 0xFF, TEL_SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT);
-       if (item_next_act_indi_obj->cnt > 0)
-               memcpy(item_next_act_indi_obj->indicator_list, &src_data[index], item_next_act_indi_obj->cnt);
+       memset(item_next_act_indi_obj->indicator_list, 0xFF, SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT);
+       if(item_next_act_indi_obj->cnt > 0)
+               memcpy(item_next_act_indi_obj->indicator_list, &src_data[temp_index], item_next_act_indi_obj->cnt);
 
        *consumed_data_len = 1+1+item_nai_len;
        dbg("[SAT] SAT PARSER - listCount=%d, consumed_data_len = %d",item_next_act_indi_obj->cnt, *consumed_data_len);
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_event_list_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatEventListInfo* event_list_obj,  TelSatEventListInfo* modem_event_list_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_event_list_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_event_list* event_list_obj, int* consumed_data_len)
 {
        int i = 0;
-       int index, len_of_len=0;
+       int temp_index, len_of_len=0;
        int evt_list_len;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(event_list_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || event_list_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || event_list_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index]&0x7F) != SATK_EVENT_LIST_TAG) {
-               err("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((src_data[temp_index]&0x7F) != SATK_EVENT_LIST_TAG){
+               dbg("[SAT] SAT PARSER - tag not found.=%d",src_data[temp_index]);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if ((src_data[index++]&0x80))
+       if((src_data[temp_index++]&0x80))
                comprehension_req = TRUE;
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       evt_list_len = src_data[index+len_of_len-1];
+       evt_list_len = src_data[temp_index+len_of_len-1];
        dbg("[SAT] parser: evt_list_len=%d",evt_list_len);
-       index += len_of_len;
+       temp_index += len_of_len;
 
-       if ((index+evt_list_len) > tlv_len) {
-               err("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+evt_list_len),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((temp_index+evt_list_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+evt_list_len),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (evt_list_len > TEL_SAT_EVENT_LIST_MAX) {
+       if(evt_list_len > SAT_EVENT_LIST_MAX){
                dbg("[SAT] SAT PARSER - event list contains more items than it is supposed to have! len=%d", evt_list_len);
-               if (comprehension_req) {
-                       err("[SAT] SAT PARSER -  comprehension_required ");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
-               }
+               if(comprehension_req)
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                else
-                       evt_list_len = TEL_SAT_EVENT_LIST_MAX;
+                       evt_list_len = SAT_EVENT_LIST_MAX;
        }
 
        event_list_obj->event_list_cnt = 0;
-       memset(event_list_obj->evt_list, 0xFF, TEL_SAT_EVENT_LIST_MAX);
-
-       modem_event_list_obj->event_list_cnt = 0;
-       memset(modem_event_list_obj->evt_list, 0xFF, TEL_SAT_EVENT_LIST_MAX);
+       memset(event_list_obj->evt_list, 0xFF, SAT_EVENT_LIST_MAX);
 
        //event list
-       for(i = 0; i < evt_list_len; i++) {
-               dbg("[SAT] SAT PARSER - event[%d]=0x%x", i, src_data[index]);
-               switch(src_data[index]) {
-               /*PDA events*/
-               case TEL_SAT_EVENT_USER_ACTIVITY:
-               case TEL_SAT_EVENT_IDLE_SCREEN_AVAILABLE:
-               case TEL_SAT_EVENT_LANGUAGE_SELECTION:
-               case TEL_SAT_EVENT_BROWSER_TERMINATION:
-               case TEL_SAT_EVENT_DATA_AVAILABLE:
-               case TEL_SAT_EVENT_CHANNEL_STATUS:
-                       event_list_obj->evt_list[i] = src_data[index];
-                       event_list_obj->event_list_cnt++;
-               break;
-               /*MODEM events*/
-               case TEL_SAT_EVENT_MT_CALL      :
-               case TEL_SAT_EVENT_CALL_CONNECTED:
-               case TEL_SAT_EVENT_CALL_DISCONNECTED:
-               case TEL_SAT_EVENT_LOCATION_STATUS:
-               case TEL_SAT_EVENT_ACCESS_TECHNOLOGY_CHANGED:
-                       modem_event_list_obj->evt_list[i] = src_data[index];
-                       modem_event_list_obj->event_list_cnt++;
-               break;
-               case TEL_SAT_EVENT_UNKNOWN:
-               default:
-                       if (comprehension_req) {
-                               err("[SAT] SAT PARSER -  comprehension_required ");
-                               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
-                       }
+       for(i = 0; i < evt_list_len; i++){
+               dbg("[SAT] SAT PARSER - event[%d]=0x%x", i, src_data[temp_index]);
+               switch(src_data[temp_index]){
+                       /*PDA events*/
+                       case EVENT_USER_ACTIVITY:
+                       case EVENT_IDLE_SCREEN_AVAILABLE:
+                       case EVENT_LANGUAGE_SELECTION:
+                       case EVENT_BROWSER_TERMINATION:
+                       case EVENT_DATA_AVAILABLE:
+                       case EVENT_CHANNEL_STATUS:
+                       case EVENT_MT_CALL      :
+                       case EVENT_CALL_CONNECTED:
+                       case EVENT_CALL_DISCONNECTED:
+                       case EVENT_LOCATION_STATUS:
+                       case EVENT_ACCESS_TECHNOLOGY_CHANGED:
+                               event_list_obj->evt_list[i] = src_data[temp_index];
+                               event_list_obj->event_list_cnt++;
+                               break;
+                       case EVENT_UNKNOWN:
+                       default:
+                               if(comprehension_req)
+                                       return TCORE_SAT_BEYOND_ME_CAPABILITY;
+                               break;
                }
-               index++;
+               temp_index++;
        }
 
         // 1 is the length of Tag.
        *consumed_data_len = 1 + len_of_len + evt_list_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_icon_identifier_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatIconIdentifierInfo* icon_id_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_icon_identifier_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_icon_identifier* icon_id_obj, int* consumed_data_len)
 {
        unsigned char* src_data;
-       int index = 0;
+       int temp_index = 0;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(icon_id_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || icon_id_obj == NULL ||consumed_data_len == NULL)  {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || icon_id_obj == NULL ||consumed_data_len == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {//length of icon id tlv is 4
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {//length of icon id tlv is 4
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++]&0x7F) != SATK_ICON_IDENTIFIER_TAG) {
-               err("[SAT] SAT PARSER -  icon identity tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if((src_data[temp_index++]&0x7F) != SATK_ICON_IDENTIFIER_TAG) {
+               dbg("[SAT] SAT PARSER -  icon identity tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       if (src_data[index++] != SATK_ICON_IDENTITY_LENGTH) {
-               err("[SAT] SAT PARSER -  incorrect length value.");
+       if(src_data[temp_index++] != SATK_ICON_IDENTITY_LENGTH) {
+               dbg("[SAT] SAT PARSER -  incorrect length value.");
                return FALSE; //send TR
        }
 
-       if ((index+SATK_ICON_IDENTITY_LENGTH) > tlv_len) {
-               err("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (index+SATK_ICON_IDENTITY_LENGTH),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((temp_index+SATK_ICON_IDENTITY_LENGTH) > tlv_len) {
+               dbg("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+SATK_ICON_IDENTITY_LENGTH),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
        icon_id_obj->is_exist = TRUE;
 
-       if ((src_data[index++]&0x01))
-               icon_id_obj->icon_qualifer = TEL_SAT_ICON_QUALI_NOT_SELF_EXPLANATORY;
+       if((src_data[temp_index++]&0x01))
+               icon_id_obj->icon_qualifer = ICON_QUALI_NOT_SELF_EXPLANATORY;
        else
-               icon_id_obj->icon_qualifer = TEL_SAT_ICON_QUALI_SELF_EXPLANATORY;
+               icon_id_obj->icon_qualifer = ICON_QUALI_SELF_EXPLANATORY;
 
-       if (src_data[index] > 0x00) {
-               icon_id_obj->icon_identifier = src_data[index];
+       if(src_data[temp_index] > 0x00) {
+               icon_id_obj->icon_identifier = src_data[temp_index];
        }
        else {
-               err("[SAT] SAT PARSER -  incorrect icon identifier");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+               dbg("[SAT] SAT PARSER -  incorrect icon identifier");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        dbg("[SAT] SAT PARSER -  icon_qual=%d, iconId=%d",icon_id_obj->icon_qualifer, icon_id_obj->icon_identifier);
        *consumed_data_len = 4;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_icon_identifier_list_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, TelSatIconIdentifierListInfo* icon_list_obj,
+static enum tcore_sat_result _sat_decode_icon_identifier_list_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_icon_identifier_list* icon_list_obj,
                int* consumed_data_len)
 {
-       int index, i;
+       int temp_index, i;
        int len_value =0;
        unsigned char* src_data;
        gboolean comprehension_req = FALSE;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(icon_list_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || icon_list_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || icon_list_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)+1) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)+1) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index]&0x7F) != SATK_ITEM_ICON_IDENTIFIER_LIST_TAG) {
-               err("[SAT] SAT PARSER -  icon identity tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if((src_data[temp_index]&0x7F) != SATK_ITEM_ICON_IDENTIFIER_LIST_TAG) {
+               dbg("[SAT] SAT PARSER -  icon identity tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        icon_list_obj->is_exist = TRUE;
-       if (src_data[index++]&0x80)
+       if(src_data[temp_index++]&0x80)
                comprehension_req = TRUE;
 
-       len_value = src_data[index++];
-       if (src_data[index++]&0x01)
-               icon_list_obj->icon_qualifer = TEL_SAT_ICON_QUALI_NOT_SELF_EXPLANATORY;
+       len_value = src_data[temp_index++];
+       if(src_data[temp_index++]&0x01)
+               icon_list_obj->icon_qualifer = ICON_QUALI_NOT_SELF_EXPLANATORY;
        else
-               icon_list_obj->icon_qualifer = TEL_SAT_ICON_QUALI_SELF_EXPLANATORY;
+               icon_list_obj->icon_qualifer = ICON_QUALI_SELF_EXPLANATORY;
 
        icon_list_obj->icon_cnt = len_value-1;
-       if (icon_list_obj->icon_cnt > TEL_SAT_ICON_LIST_MAX_COUNT) {
-               if (comprehension_req == TRUE) {
-                       err("[SAT] SAT PARSER -  list count exceeds maximum allowed count=%d",icon_list_obj->icon_cnt);
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(icon_list_obj->icon_cnt > SAT_ICON_LIST_MAX_COUNT){
+               if(comprehension_req == TRUE) {
+                       dbg("[SAT] SAT PARSER -  list count exceeds maximum allowed count=%d",icon_list_obj->icon_cnt);
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                }
                icon_list_obj->icon_cnt = 0;
        }
        else{
 
                for(i=0;i<icon_list_obj->icon_cnt;i++) {
-                       if (src_data[index] > 0x00) {
-                               icon_list_obj->icon_id_list[i]= src_data[index++];
+                       if(src_data[temp_index] > 0x00) {
+                               icon_list_obj->icon_id_list[i]= src_data[temp_index++];
                        } else  {
-                               err("[SAT] SAT PARSER -  incorrect icon identifier");
-                               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+                               dbg("[SAT] SAT PARSER -  incorrect icon identifier");
+                               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
                        }
                }
        }
 
        *consumed_data_len = 1+1+len_value;
        dbg("[SAT] SAT PARSER -  icon_qual=%d, iconCount=%d",icon_list_obj->icon_qualifer, icon_list_obj->icon_cnt);
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_dtmf_string_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatDtmfStringInfo* dtmf_string_obj, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_dtmf_string_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tel_sat_dtmf_string* dtmf_string_obj, int* consumed_data_len)
 {
        unsigned char* src_data;
-       int index, len_of_len = 0;
+       int temp_index, len_of_len = 0;
        int dtmf_len = 0;
        gboolean comprehension_req = FALSE;
        char* str_ascii = NULL;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(dtmf_string_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || consumed_data_len == NULL || dtmf_string_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || dtmf_string_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        src_data = &tlv_str[0];
 
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //Tag
-       index = curr_offset;
-       if ((src_data[index] & 0x7F) != SATK_DTMF_STRING_TAG) {
-               err("[SAT] SAT PARSER - address tag missing");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+       temp_index = curr_offset;
+       if ((src_data[temp_index] & 0x7F) != SATK_DTMF_STRING_TAG) {
+               dbg("[SAT] SAT PARSER - address tag missing");
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
        }
 
        //comprehensive required
-       if ((src_data[index++] & 0x80))
+       if((src_data[temp_index++] & 0x80))
                comprehension_req = TRUE;
 
+       dbg("comprehension_req=[%d]", comprehension_req);
+
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       dtmf_len = src_data[index + len_of_len - 1];
-       index += len_of_len; //index pointing to TON/NPI
+       dtmf_len = src_data[temp_index + len_of_len - 1];
+       temp_index += len_of_len; //temp_index pointing to TON/NPI
 
-       if ((index + dtmf_len) > tlv_len) {
-               err("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+dtmf_len), tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if ((temp_index + dtmf_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+dtmf_len), tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        dtmf_string_obj->dtmf_length = 0;
 
-       if (dtmf_len > 0) {
-               str_ascii = tcore_util_convert_bcd_to_ascii((const char*)&src_data[index], dtmf_len, TEL_SAT_DTMF_STRING_LEN_MAX);
-               if (str_ascii) {
+       if(dtmf_len > 0){
+               str_ascii = tcore_util_convert_bcd2ascii((const char*)&src_data[temp_index], dtmf_len, SAT_DTMF_STRING_LEN_MAX);
+               if(str_ascii){
                        memcpy(dtmf_string_obj->dtmf_string, str_ascii, strlen(str_ascii));
                        dtmf_string_obj->dtmf_length = strlen(str_ascii);
-                       tcore_free(str_ascii);
+                       g_free(str_ascii);
                }
        }
 
        if (dtmf_string_obj->dtmf_length == 0) {
-               err("[SAT] SAT PARSER - DTMF string length is either 0 or it is too long for the ME to handle.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER - DTMF string length is either 0 or it is too long for the ME to handle.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        *consumed_data_len = 1 + len_of_len + dtmf_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_language_tlv(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatLanguageInfo* language_obj)
+static enum tcore_sat_result _sat_decode_language_tlv(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, enum tel_sim_language_type* language_obj)
 {
        unsigned char* src_data;
-       int index = 0;
+       int temp_index = 0;
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        src_data = &tlv_str[0];
-       index = curr_offset;
+       temp_index = curr_offset;
 
-       if ((src_data[index++]&0x7F) != SATK_LANGUAGE_TAG)      {
-               err("[SAT] SAT PARSER -  Language tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((src_data[temp_index++]&0x7F) != SATK_LANGUAGE_TAG)  {
+               dbg("[SAT] SAT PARSER -  Language tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       if (src_data[index++] != SATK_LANGUAGE_LENGTH) {
-               err("[SAT] SAT PARSER -  incorrect length value.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(src_data[temp_index++] != SATK_LANGUAGE_LENGTH) {
+               dbg("[SAT] SAT PARSER -  incorrect length value.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if ((index+SATK_LANGUAGE_LENGTH) > tlv_len) {
-               err("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (index+SATK_LANGUAGE_LENGTH),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((temp_index+SATK_LANGUAGE_LENGTH) > tlv_len) {
+               dbg("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+SATK_LANGUAGE_LENGTH),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       *language_obj = _sat_decode_language(src_data[index], src_data[index+1]);
-       dbg("[SAT] SAT PARSER -  <in> %c %c, <out> %d", src_data[index], src_data[index+1], *language_obj);
-       return TEL_SAT_RESULT_SUCCESS;
+       *language_obj = _sat_decode_language(src_data[temp_index], src_data[temp_index+1]);
+       dbg("[SAT] SAT PARSER -  <in> %c %c, <out> %d", src_data[temp_index], src_data[temp_index+1], *language_obj);
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_browser_identity_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
-               TelSatBrowserIdentityType* browser_id, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_browser_identity_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
+               enum browser_identity* browser_id, int* consumed_data_len)
 {
        unsigned char* src_data;
-       int index = 0;
+       int temp_index = 0;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(browser_id != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || browser_id == NULL || consumed_data_len == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || browser_id == NULL ||consumed_data_len == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
 
-       if ((src_data[index++] & 0x7F) != SATK_BROWSER_IDENTITY_TAG) {
-               err("[SAT] SAT PARSER -  Browser ID tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if ((src_data[temp_index++] & 0x7F) != SATK_BROWSER_IDENTITY_TAG) {
+               dbg("[SAT] SAT PARSER -  Browser ID tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       if (src_data[index++] != SATK_BROWSER_ID_LENGTH) {
-               err("[SAT] SAT PARSER -  incorrect length value.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
-       }
-
-       dbg("[SAT] SAT PARSER - : browser ID value:ox%x", src_data[index]);
-
-       switch (src_data[index]) {
-       case 0x00:
-               *browser_id = TEL_SAT_BROWSER_ID_DEFAULT;
-       break;
-       case 0x01:
-               *browser_id = TEL_SAT_BROWSER_ID_WML;
-       break;
-       case 0x02:
-               *browser_id = TEL_SAT_BROWSER_ID_HTML;
-       break;
-       case 0x03:
-               *browser_id = TEL_SAT_BROWSER_ID_XHTML;
-       break;
-       case 0x04:
-               *browser_id = TEL_SAT_BROWSER_ID_CHTML;
-       break;
-       default:
-               *browser_id = TEL_SAT_BROWSER_ID_RESERVED;
+       if (src_data[temp_index++] != SATK_BROWSER_ID_LENGTH) {
+               dbg("[SAT] SAT PARSER -  incorrect length value.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+       }
+
+       dbg("[SAT] SAT PARSER - : browser ID value:ox%x", src_data[temp_index]);
+
+       switch (src_data[temp_index]) {
+               case 0x00:
+                       *browser_id = BROWSER_ID_DEFAULT;
+                       break;
+               case 0x01:
+                       *browser_id = BROWSER_ID_WML;
+                       break;
+               case 0x02:
+                       *browser_id = BROWSER_ID_HTML;
+                       break;
+               case 0x03:
+                       *browser_id = BROWSER_ID_XHTML;
+                       break;
+               case 0x04:
+                       *browser_id = BROWSER_ID_CHTML;
+                       break;
+               default:
+                       *browser_id = BROWSER_ID_RESERVED;
+                       break;
        }
 
        *consumed_data_len = 3;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_url_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
-               TelSatUrlInfo* url, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_url_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
+               struct tel_sat_url* url, int* consumed_data_len)
 {
        unsigned char* src_data;
-       int index= curr_offset;
+       int temp_index= curr_offset;
        int len_of_len=0, url_len=0;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(url != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || url == NULL || consumed_data_len == NULL)        {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || url == NULL ||consumed_data_len == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        src_data = &tlv_str[0];
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if ((src_data[index++]&0x7F) != SATK_URL_TAG) {
-               err("[SAT] SAT PARSER -  Browser URL tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if((src_data[temp_index++]&0x7F) != SATK_URL_TAG) {
+               dbg("[SAT] SAT PARSER -  Browser URL tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       url_len =  src_data[index+len_of_len-1];
-       index+=len_of_len; //index pointing to url.
+       url_len =  src_data[temp_index+len_of_len-1];
+       url->url_length = url_len;
+       temp_index+=len_of_len; //temp_index pointing to url.
+       dbg("URL length (%d)", url_len);
 
-       if (url_len > 0) {
-               if (url_len > TEL_SAT_URL_LEN_MAX) {
-                       err("[SAT] SAT PARSER -  URL length is invalid");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
-               }
-               else
-                       memcpy(url->url, &src_data[index], url_len);
-       } else  {
-               err("[SAT] SAT PARSER -  NULL string for URL");
+       if(url_len < 0){
+               dbg("[SAT] URL is null");
+               *consumed_data_len = 1+len_of_len+url_len;
+               return TCORE_SAT_SUCCESS;
+       }
+
+       if(url_len > SAT_URL_LEN_MAX){
+               dbg("[SAT] URL length is wrong");
+               *consumed_data_len = 1+len_of_len+url_len;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
+       memcpy(url->url, &src_data[temp_index], url_len);
+       dbg("[SAT] url(%s)", url->url);
        *consumed_data_len = 1+len_of_len+url_len;
-       return TEL_SAT_RESULT_SUCCESS;
+
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_bearer_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
-               TelSatBearerList* satk_bearer, int* consumed_data_len)
+static enum tcore_sat_result _sat_decode_bearer_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
+               struct tel_sat_bearer_list* satk_bearer, int* consumed_data_len)
 {
        unsigned char* src_data;
-       int index, len_of_len = 0;
+       int temp_index, len_of_len = 0;
        int list_len = 0, list_idx = 0;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(satk_bearer != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || consumed_data_len == NULL || satk_bearer == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || satk_bearer == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d",     tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d",     tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        src_data = &tlv_str[0];
-       index = curr_offset;
+       temp_index = curr_offset;
 
-       if ((src_data[index++] & 0x7F) != SATK_BEARER_TAG) {
-               err("[SAT] SAT PARSER - _sat_decode_bearer_tlv: alphaID TAG missing");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if ((src_data[temp_index++] & 0x7F) != SATK_BEARER_TAG) {
+               dbg("[SAT] SAT PARSER - _sat_decode_bearer_tlv: alphaID TAG missing");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       satk_bearer->count = src_data[index + len_of_len - 1];
+       satk_bearer->count = src_data[temp_index + len_of_len - 1];
        list_len = satk_bearer->count;
-       index += len_of_len;
+       temp_index += len_of_len;
 
-       if ((index + list_len) > tlv_len) {
-               err("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d",    (index + list_len), tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if ((temp_index + list_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d",    (temp_index + list_len), tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        if (satk_bearer->count > 0) {
-               if (list_len > TEL_SAT_BEARER_LIST_MAX_COUNT)
-                       list_len = TEL_SAT_BEARER_LIST_MAX_COUNT;
+               if (list_len > SAT_BEARER_LIST_MAX_COUNT)
+                       list_len = SAT_BEARER_LIST_MAX_COUNT;
 
                for (list_idx = 0; list_idx < list_len; list_idx++) {
-                       switch (src_data[index]) {
-                       case 0x00:
-                               satk_bearer->bear[list_idx] = TEL_SAT_BEARER_LIST_SMS;
-                       break;
-                       case 0x01:
-                               satk_bearer->bear[list_idx] = TEL_SAT_BEARER_LIST_CSD;
-                       break;
-                       case 0x02:
-                               satk_bearer->bear[list_idx] = TEL_SAT_BEARER_LIST_USSD;
-                       break;
-                       case 0x03:
-                               satk_bearer->bear[list_idx] = TEL_SAT_BEARER_LIST_GPRS;
-                       break;
-                       default:
-                               satk_bearer->bear[list_idx] = TEL_SAT_BEARER_LIST_RESERVED;
+                       switch (src_data[temp_index]) {
+                               case 0x00:
+                                       satk_bearer->bear[list_idx] = BEARER_LIST_SMS;
+                                       break;
+                               case 0x01:
+                                       satk_bearer->bear[list_idx] = BEARER_LIST_CSD;
+                                       break;
+                               case 0x02:
+                                       satk_bearer->bear[list_idx] = BEARER_LIST_USSD;
+                                       break;
+                               case 0x03:
+                                       satk_bearer->bear[list_idx] = BEARER_LIST_GPRS;
+                                       break;
+                               default:
+                                       satk_bearer->bear[list_idx] = BEARER_LIST_RESERVED;
+                                       break;
                        }
                        dbg("[SAT] SAT PARSER -  bearer[%d]=0x%x", list_idx, satk_bearer->bear[list_idx]);
-                       index++;
+                       temp_index++;
                }
        } else {
-               err("[SAT] SAT PARSER -  invalid bearer count");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        *consumed_data_len = 1 + len_of_len + list_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_provisioning_file_ref_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, TelSatProvisioningFileRef* prf, int* data_len_consumed)
+static enum tcore_sat_result _sat_decode_provisioning_file_ref_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_provisioning_file_ref* prf, int* data_len_consumed)
 {
        unsigned char* src_data;
-       int index = curr_offset;
+       int temp_index = curr_offset;
        int len_of_len = 0, prf_len = 0;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(prf != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(data_len_consumed != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if (tlv_str == NULL || prf == NULL || data_len_consumed == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || prf == NULL ||data_len_consumed == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        src_data = &tlv_str[0];
        if (tlv_len <= (curr_offset + 1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d",tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d",tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if ((src_data[index++] & 0x7F) != SATK_PROVISIONING_REF_FILE_TAG) {
-               err("[SAT] SAT PARSER -  PRF tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if ((src_data[temp_index++] & 0x7F) != SATK_PROVISIONING_REF_FILE_TAG) {
+               dbg("[SAT] SAT PARSER -  PRF tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       prf_len = src_data[index + len_of_len - 1];
+       prf_len = src_data[temp_index + len_of_len - 1];
        prf->file_path_length = prf_len;
-       index += len_of_len; //index pointing to prf.
+       temp_index += len_of_len; //temp_index pointing to prf.
 
        if (prf_len > 0) {
-               if (prf_len > TEL_SAT_PROVISIONING_FILE_PATH_LEN_MAX) {
-                       err("[SAT] SAT PARSER -  PRF length is invalid");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
-               }
+               if (prf_len > SAT_PROVISIONING_FILE_PATH_LEN_MAX)
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                else
-                       memcpy(prf->file_path, &src_data[index], prf_len);
+                       memcpy(prf->file_path, &src_data[temp_index], prf_len);
        } else {
-               err("[SAT] SAT PARSER -  NULL string for PRF");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               dbg("[SAT] SAT PARSER -  NULL string for PRF");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        *data_len_consumed = 1 + len_of_len + prf_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_bearer_description_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, TelSatBearerDescriptionInfo *bearer_desc_obj,
+static enum tcore_sat_result _sat_decode_bearer_description_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_bearer_description *bearer_desc_obj,
                int* consumed_data_len)
 {
-       int index, length=0;
+       int temp_index, length=0;
        unsigned char* src_data;
 
-       if (tlv_len <= (curr_offset+1)+1) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)+1) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       while(1) {
-               if (index >= tlv_len) {
+       while(1){
+               if(temp_index >= tlv_len){
                        dbg("bearer desc cannot find. UICC Server mode");
                        *consumed_data_len = 0;
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               if ( (src_data[index]&0x7F) == SATK_BEARER_DISCRIPTION_TAG ) {
-                       dbg("find bearer description tag index(%d)", index);
-                       index++;
+               if( (src_data[temp_index]&0x7F) == SATK_BEARER_DISCRIPTION_TAG ){
+                       dbg("find bearer description tag temp_index(%d)", temp_index);
+                       temp_index++;
                        break;
                }
-               index++;
+               temp_index++;
        }
 
        //length
-       length = src_data[index++];
+       length = src_data[temp_index++];
        dbg("bearer description length (%d)", length);
 
        //bearer parameter
-       switch(src_data[index++]) {
-       case TEL_SAT_BEARER_CSD:
-               bearer_desc_obj->bearer_type = TEL_SAT_BEARER_CSD;
-               bearer_desc_obj->bearer_parameter.cs_bearer_param.data_rate = src_data[index++];
-               bearer_desc_obj->bearer_parameter.cs_bearer_param.service_type = src_data[index++];
-               bearer_desc_obj->bearer_parameter.cs_bearer_param.connection_element_type = src_data[index++];
-       break;
-       case TEL_SAT_BEARER_GPRS:
-               bearer_desc_obj->bearer_type = TEL_SAT_BEARER_GPRS;
-               bearer_desc_obj->bearer_parameter.ps_bearer_param.precedence_class = src_data[index++];
-               bearer_desc_obj->bearer_parameter.ps_bearer_param.delay_class = src_data[index++];
-               bearer_desc_obj->bearer_parameter.ps_bearer_param.reliability_class = src_data[index++];
-               bearer_desc_obj->bearer_parameter.ps_bearer_param.peak_throughput_class = src_data[index++];
-               bearer_desc_obj->bearer_parameter.ps_bearer_param.mean_throughput_class = src_data[index++];
-               bearer_desc_obj->bearer_parameter.ps_bearer_param.pdp_type = TEL_SAT_BIP_GPRS_PDP_TYPE_RESERVED;
-               if (src_data[index] == TEL_SAT_BIP_GPRS_PDP_TYPE_IP)
-                       bearer_desc_obj->bearer_parameter.ps_bearer_param.pdp_type = TEL_SAT_BIP_GPRS_PDP_TYPE_IP;
-       break;
-       case TEL_SAT_BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER:
-               bearer_desc_obj->bearer_type = TEL_SAT_BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER;
-       break;
-       case TEL_SAT_BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT:
-               bearer_desc_obj->bearer_type = TEL_SAT_BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER;
-       break;
-       default:
-               bearer_desc_obj->bearer_type = TEL_SAT_BEARER_RESERVED;
-               err("bearer type not supported");
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+       switch(src_data[temp_index++]){
+               case BEARER_CSD:
+                       bearer_desc_obj->bearer_type = BEARER_CSD;
+                       bearer_desc_obj->bearer_parameter.cs_bearer_param.data_rate = src_data[temp_index++];
+                       bearer_desc_obj->bearer_parameter.cs_bearer_param.service_type = src_data[temp_index++];
+                       bearer_desc_obj->bearer_parameter.cs_bearer_param.connection_element_type = src_data[temp_index++];
+                       break;
+               case BEARER_GPRS:
+                       bearer_desc_obj->bearer_type = BEARER_GPRS;
+                       bearer_desc_obj->bearer_parameter.ps_bearer_param.precedence_class = src_data[temp_index++];
+                       bearer_desc_obj->bearer_parameter.ps_bearer_param.delay_class = src_data[temp_index++];
+                       bearer_desc_obj->bearer_parameter.ps_bearer_param.reliability_class = src_data[temp_index++];
+                       bearer_desc_obj->bearer_parameter.ps_bearer_param.peak_throughput_class = src_data[temp_index++];
+                       bearer_desc_obj->bearer_parameter.ps_bearer_param.mean_throughput_class = src_data[temp_index++];
+                       bearer_desc_obj->bearer_parameter.ps_bearer_param.pdp_type = BIP_GPRS_PDP_TYPE_RESERVED;
+                       if(src_data[temp_index] == BIP_GPRS_PDP_TYPE_IP)
+                               bearer_desc_obj->bearer_parameter.ps_bearer_param.pdp_type = BIP_GPRS_PDP_TYPE_IP;
+                       break;
+               case BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER:
+                       bearer_desc_obj->bearer_type = BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER;
+                       break;
+               case BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT:
+                       bearer_desc_obj->bearer_type = BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER;
+                       break;
+               default:
+                       bearer_desc_obj->bearer_type = BEARER_RESERVED;
+                       dbg("bearer type not supported");
+                       return TCORE_SAT_BEYOND_ME_CAPABILITY;
        }
 
        *consumed_data_len = 1+1+length;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_channel_data_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, TelSatChannelDataInfo *channel_data_obj,
+static enum tcore_sat_result _sat_decode_channel_data_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_channel_data *channel_data_obj,
                int* consumed_data_len)
 {
-       int index = 0;
+       int temp_index = 0;
        int len_of_len = 0, channel_data_len = 0;
        unsigned char* src_data;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(channel_data_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || channel_data_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || channel_data_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++]&0x7F) != SATK_CHANNEL_DATA_TAG) {
-               err("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((src_data[temp_index++]&0x7F) != SATK_CHANNEL_DATA_TAG){
+               dbg("[SAT] SAT PARSER - tag not found.=%d",src_data[temp_index]);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       channel_data_len = src_data[index+len_of_len-1];
+       channel_data_len = src_data[temp_index+len_of_len-1];
        dbg("[SAT] parser: channel_data_len=%d",channel_data_len);
-       index += len_of_len;
+       temp_index += len_of_len;
 
-       if ((index+channel_data_len) > tlv_len) {
-               err("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+channel_data_len),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((temp_index+channel_data_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+channel_data_len),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //data
        channel_data_obj->data_string_len = channel_data_len;
-       memcpy(channel_data_obj->data_string, &src_data[index], channel_data_len);
+       memcpy(channel_data_obj->data_string, &src_data[temp_index], channel_data_len);
 
        *consumed_data_len = 1+len_of_len+channel_data_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_channel_data_length_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, unsigned char *data_len,
+static enum tcore_sat_result _sat_decode_channel_data_length_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_channel_data_len *data_len_obj,
                int* consumed_data_len)
 {
-       int index;
+       int temp_index;
        unsigned char* src_data;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || data_len_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || data_len_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++]&0x7F) != SATK_CHANNEL_DATA_LEN_TAG) {
-               err("[SAT] SAT PARSER -  channel data tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if((src_data[temp_index++]&0x7F) != SATK_CHANNEL_DATA_LEN_TAG) {
+               dbg("[SAT] SAT PARSER -  channel data tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //length
-       if (src_data[index++] != SATK_CHANNEL_DATA_LENGTH_VALUE_LENGTH) {
-               err("[SAT] SAT PARSER -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if(src_data[temp_index++] != SATK_CHANNEL_DATA_LENGTH_VALUE_LENGTH) {
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //data
-       *data_len = (unsigned char)src_data[index];
+       data_len_obj->data_len = src_data[temp_index];
 
        *consumed_data_len = 3;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_buffer_size_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, unsigned char buffer_size[2],
+static enum tcore_sat_result _sat_decode_buffer_size_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_buffer_size *buffer_size_obj,
                int* consumed_data_len)
 {
-       int index;
+       int temp_index;
        unsigned char* src_data;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || buffer_size_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || buffer_size_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)+SATK_BUFFER_SIZE_LENGTH) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)+SATK_BUFFER_SIZE_LENGTH) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++]&0x7F) != SATK_BUFFER_SIZE_TAG) {
-               err("[SAT] SAT PARSER -  buffer size tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if((src_data[temp_index++]&0x7F) != SATK_BUFFER_SIZE_TAG) {
+               dbg("[SAT] SAT PARSER -  buffer size tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //length
-       if (src_data[index++] != SATK_BUFFER_SIZE_LENGTH) {
-               err("[SAT] SAT PARSER -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if(src_data[temp_index++] != SATK_BUFFER_SIZE_LENGTH) {
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       buffer_size[0] = src_data[index++];
-       buffer_size[1] = src_data[index];
+       buffer_size_obj->size[0] = src_data[temp_index++];
+       buffer_size_obj->size[1] = src_data[temp_index];
 
        *consumed_data_len = 4;
-       dbg("[SAT] SAT PARSER -  buffer size = 0x%x%x", buffer_size[0], buffer_size[1]);
-       return TEL_SAT_RESULT_SUCCESS;
+       dbg("[SAT] SAT PARSER -  buffer size = 0x%x%x", buffer_size_obj->size[0], buffer_size_obj->size[1]);
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_other_address_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, TelSatOtherAddressInfo *other_address_obj,
+static enum tcore_sat_result _sat_decode_other_address_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_other_address *other_address_obj,
                int* consumed_data_len)
 {
        gchar* address = NULL;
-       int index, address_len;
+       int temp_index, address_len;
        unsigned char* src_data;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(other_address_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || other_address_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || other_address_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++]&0x7F) != SATK_OTHER_ADDRESS_TAG) {
-               err("[SAT] SAT PARSER -  other address tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if((src_data[temp_index++]&0x7F) != SATK_OTHER_ADDRESS_TAG) {
+               dbg("[SAT] SAT PARSER -  other address tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //length
-       address_len = src_data[index++];
-       if ((index+address_len) > tlv_len) {
-               err("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (index+address_len),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       address_len = src_data[temp_index++];
+       if((temp_index+address_len) > tlv_len) {
+               dbg("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+address_len),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (address_len-1 > TEL_SAT_OTHER_ADDR_LEN_MAX) {
-               err("[SAT] SAT PARSER - address is longer than capability");
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+       if(address_len-1 > SAT_OTHER_ADDR_LEN_MAX){
+               dbg("[SAT] SAT PARSER - address is longer than capability");
+               return TCORE_SAT_BEYOND_ME_CAPABILITY;
        }
 
        //other address type
-       switch(src_data[index++]) {
-       case TEL_SAT_ADDR_TYPE_IPv4:
-               other_address_obj->address_type = TEL_SAT_ADDR_TYPE_IPv4;
-               address = g_strdup_printf("%d.%d.%d.%d", src_data[index], src_data[index+1], src_data[index+2], src_data[index+3]);
-       break;
-       case TEL_SAT_ADDR_TYPE_IPv6:
-               other_address_obj->address_type = TEL_SAT_ADDR_TYPE_IPv6;
-               address = g_strdup_printf("%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:",
-                               src_data[index], src_data[index+1], src_data[index+2], src_data[index+3],
-                               src_data[index+4], src_data[index+5], src_data[index+6], src_data[index+7],
-                               src_data[index+8], src_data[index+9], src_data[index+10], src_data[index+11],
-                               src_data[index+12], src_data[index+13], src_data[index+14], src_data[index+15]);
-       break;
-       default:
-               other_address_obj->address_type = TEL_SAT_ADDR_RESERVED;
-               address = tcore_strdup("");
-       } //end of switch
+       switch(src_data[temp_index++]){
+               case ADDR_TYPE_IPv4:{
+                       other_address_obj->address_type = ADDR_TYPE_IPv4;
+                       address = g_strdup_printf("%d.%d.%d.%d", src_data[temp_index], src_data[temp_index+1], src_data[temp_index+2], src_data[temp_index+3]);
+               }break;
+               case ADDR_TYPE_IPv6:{
+                       other_address_obj->address_type = ADDR_TYPE_IPv6;
+                       address = g_strdup_printf("%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:",
+                                       src_data[temp_index], src_data[temp_index+1], src_data[temp_index+2], src_data[temp_index+3],
+                                       src_data[temp_index+4], src_data[temp_index+5], src_data[temp_index+6], src_data[temp_index+7],
+                                       src_data[temp_index+8], src_data[temp_index+9], src_data[temp_index+10], src_data[temp_index+11],
+                                       src_data[temp_index+12], src_data[temp_index+13], src_data[temp_index+14], src_data[temp_index+15]);
+               }break;
+               default:{
+                       other_address_obj->address_type = ADDR_RESERVED;
+                       address = g_strdup("");
+               }break;
+       }//end of switch
 
        //address
        if (address) {
+               memcpy(other_address_obj->address, address, strlen(address));
                other_address_obj->address_len = strlen(address);
-               memcpy(other_address_obj->address, address, other_address_obj->address_len);
 
-               tcore_free(address);
+               g_free(address);
                dbg("destination address(%s)", other_address_obj->address);
        }
 
        *consumed_data_len = 2+address_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_uicc_terminal_interface_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, TelSatSimMeInterfaceTransportLevelInfo *level_obj,
+static enum tcore_sat_result _sat_decode_uicc_terminal_interface_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_uicc_terminal_interface_transport_level *level_obj,
                int* consumed_data_len)
 {
-       int index;
+       int temp_index;
        unsigned char* src_data;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(level_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || level_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || level_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)+SATK_UICC_ME_TRANS_INTERFACE_LEVEL_LENGTH) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)+SATK_UICC_ME_TRANS_INTERFACE_LEVEL_LENGTH) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++]&0x7F) != SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG) {
-               err("[SAT] SAT PARSER - UICC/TERMINAL Interface transport level tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if((src_data[temp_index++]&0x7F) != SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG) {
+               dbg("[SAT] SAT PARSER - UICC/TERMINAL Interface transport level tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //length
-       if (src_data[index++] != SATK_UICC_ME_TRANS_INTERFACE_LEVEL_LENGTH) {
-               err("[SAT] SAT PARSER -  incorrect length");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if(src_data[temp_index++] != SATK_UICC_ME_TRANS_INTERFACE_LEVEL_LENGTH) {
+               dbg("[SAT] SAT PARSER -  incorrect length");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
-       level_obj->protocol_type = src_data[index++];
-       level_obj->port_number = src_data[index++] << 8;
-       level_obj->port_number |= src_data[index];
+       level_obj->protocol_type = src_data[temp_index++];
+       level_obj->port_number = src_data[temp_index++] << 8;
+       level_obj->port_number |= src_data[temp_index];
 
        *consumed_data_len = 2+SATK_UICC_ME_TRANS_INTERFACE_LEVEL_LENGTH;
        dbg("[SAT] SAT PARSER -  protocol type(%d) , port number(%d)", level_obj->protocol_type, level_obj->port_number);
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_remote_entity_address_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, TelSatRemoteEntityAddressInfo *remote_address_obj,
+static enum tcore_sat_result _sat_decode_remote_entity_address_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_remote_entity_address *remote_address_obj,
                int* consumed_data_len)
 {
-       int index = 0;
+       int temp_index = 0;
        int len_of_len = 0, remote_data_len = 0;
        unsigned char* src_data;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(remote_address_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || remote_address_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || remote_address_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index]&0x7F) != SATK_REMOTE_ENTITY_ADDRESS_TAG) {
-               err("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if((src_data[temp_index]&0x7F) != SATK_REMOTE_ENTITY_ADDRESS_TAG){
+               dbg("[SAT] SAT PARSER - tag not found.=%d",src_data[temp_index]);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //length
-       len_of_len = _get_length_filed_size(src_data[index]);
-       if (!len_of_len) {
+       len_of_len = _get_length_filed_size(src_data[temp_index]);
+       if(!len_of_len){
                err("[SAT] parser: invalid length.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       remote_data_len = src_data[index+len_of_len-1];
+       remote_data_len = src_data[temp_index+len_of_len-1];
        dbg("[SAT] parser: remote_data_len=%d",remote_data_len);
-       index += len_of_len;
+       temp_index += len_of_len;
 
        //data
-       switch(src_data[index++]) {
-       case TEL_SAT_REMOTE_ENTITY_ADDR_CODING_TYPE_IEEE802_48BIT:
-               remote_address_obj->coding_type = TEL_SAT_REMOTE_ENTITY_ADDR_CODING_TYPE_IEEE802_48BIT;
-       break;
-       case TEL_SAT_REMOTE_ENTITY_ADDR_CODING_TYPE_IRDA_32BIT:
-               remote_address_obj->coding_type = TEL_SAT_REMOTE_ENTITY_ADDR_CODING_TYPE_IRDA_32BIT;
-       break;
-       default:
-               remote_address_obj->coding_type = TEL_SAT_REMOTE_ENTITY_ADDR_CODING_TYPE_RESERVED;
+       switch(src_data[temp_index++]){
+               case REMOTE_ENTITY_ADDR_CODING_TYPE_IEEE802_48BIT:
+                       remote_address_obj->coding_type = REMOTE_ENTITY_ADDR_CODING_TYPE_IEEE802_48BIT;
+                       break;
+               case REMOTE_ENTITY_ADDR_CODING_TYPE_IRDA_32BIT:
+                       remote_address_obj->coding_type = REMOTE_ENTITY_ADDR_CODING_TYPE_IRDA_32BIT;
+                       break;
+               default:
+                       remote_address_obj->coding_type =REMOTE_ENTITY_ADDR_CODING_TYPE_RESERVED;
+                       break;
        }
 
        remote_address_obj->length = remote_data_len - 1;
-       memcpy(remote_address_obj->remote_entity_address, &src_data[index], remote_address_obj->length);
+       memcpy(remote_address_obj->remote_entity_address, &src_data[temp_index], remote_address_obj->length);
 
        *consumed_data_len = 1+len_of_len+remote_data_len;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-static TelSatResult _sat_decode_network_access_name_tlv(unsigned char* tlv_str,
-               int tlv_len, int curr_offset, TelSatNetworkAccessNameInfo *access_name_obj,
+static enum tcore_sat_result _sat_decode_network_access_name_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_network_access_name *access_name_obj,
                int* consumed_data_len)
 {
-       int index, idx, name_idx, name_length;
+       int temp_index, idx, name_idx, name_length;
        unsigned char* src_data;
 
-       tcore_check_return_value_assert(tlv_str != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(consumed_data_len != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(access_name_obj != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(tlv_str == NULL || consumed_data_len == NULL || access_name_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || access_name_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
-       if (tlv_len <= (curr_offset+1)) {
-               err("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER -  incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        //tag
-       index = curr_offset;
+       temp_index = curr_offset;
        src_data = &tlv_str[0];
-       if ((src_data[index++]&0x7F) != SATK_NETWORK_ACCESS_TAG) {
-               err("[SAT] SAT PARSER -  network access name tag missing.");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
+       if((src_data[temp_index++]&0x7F) != SATK_NETWORK_ACCESS_TAG) {
+               dbg("[SAT] SAT PARSER -  network access name tag missing.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
        }
 
        //length
-       name_length = src_data[index++];
-       if ((index+name_length) > tlv_len) {
-               err("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (index+name_length),tlv_len);
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       name_length = src_data[temp_index++];
+       if((temp_index+name_length) > tlv_len) {
+               dbg("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+name_length),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        access_name_obj->length = name_length;
-       if (access_name_obj->length > TEL_SAT_NET_ACC_NAM_LEN_MAX) {
-               err("[SAT] SAT PARSER - network access name is longer than capability");
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+       if(access_name_obj->length > SAT_NET_ACC_NAM_LEN_MAX){
+               dbg("[SAT] SAT PARSER - network access name is longer than capability");
+               return TCORE_SAT_BEYOND_ME_CAPABILITY;
        }
 
        name_idx = 0;
-       for(idx = 0; idx < access_name_obj->length; idx++) {
-               dbg("data (%c) Bool(%d)",src_data[index], g_ascii_isalpha(src_data[index]) );
+       for(idx = 0; idx < access_name_obj->length; idx++){
+               dbg("data (%c) Bool(%d)",src_data[temp_index], g_ascii_isalpha(src_data[temp_index]) );
 
-               if ( g_ascii_isalpha(src_data[index]) ) {
-                       access_name_obj->network_access_name[name_idx] = src_data[index];
+               if( g_ascii_isalpha(src_data[temp_index]) ){
+                       access_name_obj->network_access_name[name_idx] = src_data[temp_index];
                        name_idx++;
                }
                else{
 
-                       if (src_data[index] == 0x02) {//02 convert to "."
+                       if(src_data[temp_index] == 0x02){//02 convert to "."
                                access_name_obj->network_access_name[name_idx] = '.';
                                name_idx++;
                        }
                }
-               index++;
+               temp_index++;
        }
 
        //network access name
        dbg("network access name(%s)", access_name_obj->network_access_name);
 
        *consumed_data_len = 2+name_length;
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
+}
+
+static enum tcore_sat_result _sat_decode_text_attribute_tlv(unsigned char* tlv_str,
+               int tlv_len, int curr_offset, struct tel_sat_text_attribute *text_attribute_obj,
+               int* consumed_data_len)
+{
+       int temp_index, length;
+       unsigned char* src_data;
+
+       if(tlv_str == NULL || consumed_data_len == NULL || text_attribute_obj == NULL) {
+               dbg("[SAT] SAT PARSER -  tlv_str == NULL || consumed_data_len == NULL || text_attribute_obj == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
+
+       if(tlv_len <= (curr_offset+1)) {
+               dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+       }
+
+       //tag
+       temp_index = curr_offset;
+       src_data = &tlv_str[0];
+       if((src_data[temp_index++]&0x7F) != SATK_TEXT_ATTRIBUTE_TAG) {
+               dbg("[SAT] SAT PARSER - text attribute tag is missing");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+       }
+
+       //length
+       length = src_data[temp_index++];
+       if((temp_index+length) > tlv_len) {
+               dbg("[SAT] SAT PARSER -  incorrect cmd len, expected len = %d, orig_len=%d", (temp_index+length),tlv_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+       }
+
+       //attribute data
+       text_attribute_obj->b_txt_attr = TRUE;
+       memcpy(text_attribute_obj->text_formatting, &src_data[temp_index], length);
+
+       *consumed_data_len = 2+length;
+       return TCORE_SAT_SUCCESS;
 }
 
 //decode proactive cmd
 //6.4.1 DISPLAY TEXT
-static TelSatResult _sat_decode_display_text(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_display_text(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
+       int tlv_length = 0, remain_len = 0, expected_len = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.display_text.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.display_text.command_detail.cmd_type = cmd_data[index++];
+       tlv_length = cmd_data[curr_offset-1];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.display_text.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.display_text.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       if (cmd_data[index] & 0x01) {
+       if (cmd_data[temp_index] & 0x01) {
                sat_cmd_ind_data->data.display_text.command_detail.cmd_qualifier.display_text.text_priority =
-                               TEL_SAT_TEXT_PRIORITY_HIGH;
+                               TEXT_PRIORITY_HIGH;
                dbg("[SAT] SAT PARSER -  msg_prio=TAPI_SAT_MSG_PRIORITY_HIGH.");
        }
        else {
                sat_cmd_ind_data->data.display_text.command_detail.cmd_qualifier.display_text.text_priority =
-                               TEL_SAT_TEXT_PRIORITY_NORMAL;
+                               TEXT_PRIORITY_NORMAL;
                dbg("[SAT] SAT PARSER - : msg_prio=TAPI_SAT_MSG_PRIORITY_NORMAL.");
        }
 
-       if (cmd_data[index] & 0x80) {
+       if (cmd_data[temp_index] & 0x80) {
                sat_cmd_ind_data->data.display_text.command_detail.cmd_qualifier.display_text.text_clear_type =
-                               TEL_SAT_TEXT_WAIT_FOR_USER_TO_CLEAR_MSG;
+                               TEXT_WAIT_FOR_USER_TO_CLEAR_MSG;
                dbg("[SAT] SAT PARSER - : msgClear=TAPI_SAT_WAIT_FOR_USER_TO_CLEAR_MSG.");
        }
        else {
                sat_cmd_ind_data->data.display_text.command_detail.cmd_qualifier.display_text.text_clear_type =
-                               TEL_SAT_TEXT_AUTO_CLEAR_MSG_AFTER_A_DELAY;
+                               TEXT_AUTO_CLEAR_MSG_AFTER_A_DELAY;
                dbg("[SAT] SAT PARSER -  msgClear=TAPI_SAT_AUTO_CLEAR_MSG_AFTER_A_DELAY.");
        }
 
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.display_text.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
+
+       temp_index+=4; // device identities consumes 4 bytes.
+
+       remain_len = o_length-temp_index;
+       expected_len = tlv_length-5-4;
+       if(remain_len!=expected_len){
+               dbg("[SAT] SAT PARSER - : mismatch!! remain_len=%d, expected_len=%d", remain_len, expected_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       index+=4;
-       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.display_text.text, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding text tlv failed");
+       rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.display_text.text, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
-       if (sat_cmd_ind_data->data.display_text.text.string_length <= 0) {
+       if(sat_cmd_ind_data->data.display_text.text.string_length <= 0){
                err("[SAT] SAT PARSER - :string length is 0");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        dbg("[SAT] SAT PARSER  text(%s)",sat_cmd_ind_data->data.display_text.text.string);
-       dbg("[SAT] SAT PARSER o_len(%d) index(%d) data_len_consumed(%d)",o_length , index, data_len_consumed);
+       dbg("[SAT] SAT PARSER o_len(%d) temp_index(%d) data_len_consumed(%d)",o_length , temp_index, data_len_consumed);
 
-       if (index+data_len_consumed > o_length) {
-               err("[SAT] SAT PARSER - Wrong String TLV");
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+       if(o_length-temp_index < data_len_consumed){
+               dbg("[SAT] SAT PARSER - :wrong text TLV.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       else if (index+data_len_consumed == o_length) {
+
+       if(o_length-temp_index == data_len_consumed){
                dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
-               return TEL_SAT_RESULT_SUCCESS;
+               return TCORE_SAT_SUCCESS;
        }
+       temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
 
        //icon identifier
-       index+=data_len_consumed;
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
-               data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.display_text.icon_id, &data_len_consumed);
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.display_text.icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
                }
 
-               if (index+data_len_consumed >= o_length) {
-                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
                }
-
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //immediate response
        sat_cmd_ind_data->data.display_text.immediate_response_requested = FALSE;
-       if ((cmd_data[index]&0x7F) == SATK_IMMEDIATE_RESPONSE_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_IMMEDIATE_RESPONSE_TAG){
+               data_len_consumed = 2;
                dbg("[SAT] SAT PARSER - :immediate response required.");
                sat_cmd_ind_data->data.display_text.immediate_response_requested = TRUE;
-               index+=2;
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
-       if (index >= o_length) {
-               dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
-               return TEL_SAT_RESULT_SUCCESS;
+       //time duration - optional
+       if((cmd_data[temp_index]&0x7F)==SATK_DURATION_TAG){
+               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.display_text.duration, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
+               }
+
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
-       //time duration
-       if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
-               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.display_text.duration, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding duration tlv failed");
+       //text attribute - optional
+       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_ATTRIBUTE_TAG){
+               rv =_sat_decode_text_attribute_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.display_text.text_attribute, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
+
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
+
+       if(o_length > temp_index){
+               dbg("[SAT] SAT PARSER - : wrong text TLV, remaining data is found!!");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.2 GET INKEY
-static TelSatResult _sat_decode_get_inkey(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_get_inkey(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
+       int tlv_length = 0, remain_len = 0, expected_len = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.get_inkey.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.get_inkey.command_detail.cmd_type = cmd_data[index++];
+       tlv_length = cmd_data[curr_offset-1];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.get_inkey.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.get_inkey.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       if (cmd_data[index] & 0x01) {
+       if (cmd_data[temp_index] & 0x01) {
                sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.alphabet_set = TRUE;
                dbg("[SAT] SAT PARSER - Alphabet set");
        }
 
-       if (cmd_data[index]&0x02) {
-               sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.alphabet_type = TEL_SAT_INPUT_ALPHABET_TYPE_UCS2;
+       if(cmd_data[temp_index]&0x02){
+               sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.alphabet_type = INPUT_ALPHABET_TYPE_UCS2;
                dbg("[SAT] SAT PARSER -  INPUT_ALPHABET_TYPE_UCS2");
        }
        else{
-               sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.alphabet_type = TEL_SAT_INPUT_ALPHABET_TYPE_SMS_DEFAULT;
+               sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.alphabet_type = INPUT_ALPHABET_TYPE_SMS_DEFAULT;
                dbg("[SAT] SAT PARSER -  INPUT_ALPHABET_TYPE_SMS_DEFAULT");
        }
 
-       if (cmd_data[index]&0x04) {
-               sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.inkey_type = TEL_SAT_INKEY_TYPE_YES_NO_REQUESTED;
+       if(cmd_data[temp_index]&0x04){
+               sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.inkey_type = INKEY_TYPE_YES_NO_REQUESTED;
                dbg("[SAT] SAT PARSER -  INKEY_TYPE_YES_NO_REQUESTED");
        }
        else{
-               sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.inkey_type = TEL_SAT_INKEY_TYPE_CHARACTER_SET_ENABLED;
+               sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.inkey_type = INKEY_TYPE_CHARACTER_SET_ENABLED;
                dbg("[SAT] SAT PARSER -  INKEY_TYPE_YES_NO_REQUESTED");
        }
 
-       if (cmd_data[index]&0x08) {
+       if(cmd_data[temp_index]&0x08){
                sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.immediate_rsp_required = TRUE;
                dbg("[SAT] SAT PARSER -  immediate response requested");
        }
 
-       if (cmd_data[index] & 0x80) {
+       if (cmd_data[temp_index] & 0x80) {
                sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.help_info = TRUE;
                dbg("[SAT] SAT PARSER - Help info");
        }
 
        //device identities
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.get_inkey.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //text
-       index+=4;
-       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.get_inkey.text, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding text tlv failed");
-               return rv;
+       temp_index+=4;
+
+       remain_len = o_length-temp_index;
+       expected_len = tlv_length-5-4;
+       if(remain_len!=expected_len){
+               dbg("[SAT] SAT PARSER - : mismatch!! remain_len=%d, expected_len=%d", remain_len, expected_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       if (sat_cmd_ind_data->data.get_inkey.text.string_length <= 0) {
+       rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_inkey.text, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS)
+               return rv;
+
+       if(sat_cmd_ind_data->data.get_inkey.text.string_length <= 0){
                err("[SAT] SAT PARSER - :string length is 0");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        dbg("[SAT] SAT PARSER  text(%s)",sat_cmd_ind_data->data.get_inkey.text.string);
-       dbg("[SAT] SAT PARSER o_len(%d) index(%d) data_len_consumed(%d)",o_length , index, data_len_consumed);
+       dbg("[SAT] SAT PARSER o_len(%d) temp_index(%d) data_len_consumed(%d)",o_length , temp_index, data_len_consumed);
 
-       if (index+data_len_consumed > o_length) {
-               err("[SAT] SAT PARSER - Wrong String TLV");
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+       if(o_length-temp_index < data_len_consumed){
+               dbg("[SAT] SAT PARSER - :wrong text TLV.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
-       else if (index+data_len_consumed == o_length) {
+
+       if(o_length-temp_index == data_len_consumed){
                dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
-               return TEL_SAT_RESULT_SUCCESS;
+               return TCORE_SAT_SUCCESS;
        }
+       temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
 
-       //icon identifier
-       index+=data_len_consumed;
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
-               data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.get_inkey.icon_id, &data_len_consumed);
+       //icon identifier - optional
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_inkey.icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
                }
 
-               if (index+data_len_consumed >= o_length) {
-                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
+
+       //time duration - optional
+       if((cmd_data[temp_index]&0x7F)==SATK_DURATION_TAG){
+               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_inkey.duration, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
                }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
-       //time duration
-       if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
-               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.get_inkey.duration, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding duration tlv failed");
+       //text attribute - optional
+       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_ATTRIBUTE_TAG){
+               rv =_sat_decode_text_attribute_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_inkey.text_attribute, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
+
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
+
+       if(o_length > temp_index){
+               dbg("[SAT] SAT PARSER - : wrong text TLV, remaining data is found!!");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.3 GET INPUT
-static TelSatResult _sat_decode_get_input(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_get_input(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
+       int tlv_length = 0, remain_len = 0, expected_len = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.get_input.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.get_input.command_detail.cmd_type = cmd_data[index++];
+       tlv_length = cmd_data[curr_offset-1];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.get_input.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.get_input.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       if (cmd_data[index] & 0x01) {
+       if (cmd_data[temp_index] & 0x01) {
                sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.alphabet_set = TRUE;
                dbg("[SAT] SAT PARSER - Alphabet set");
        }
@@ -2688,16 +2845,16 @@ static TelSatResult _sat_decode_get_input(unsigned char* o_cmd_data, int o_lengt
                dbg("[SAT] SAT PARSER - Numeric info");
        }
 
-       if (cmd_data[index]&0x02) {
-               sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.alphabet_type = TEL_SAT_INPUT_ALPHABET_TYPE_UCS2;
+       if(cmd_data[temp_index]&0x02){
+               sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.alphabet_type = INPUT_ALPHABET_TYPE_UCS2;
                dbg("[SAT] SAT PARSER -  INPUT_ALPHABET_TYPE_UCS2");
        }
        else{
-               sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.alphabet_type = TEL_SAT_INPUT_ALPHABET_TYPE_SMS_DEFAULT;
+               sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.alphabet_type = INPUT_ALPHABET_TYPE_SMS_DEFAULT;
                dbg("[SAT] SAT PARSER -  INPUT_ALPHABET_TYPE_SMS_DEFAULT");
        }
 
-       if (cmd_data[index]&0x04) {
+       if(cmd_data[temp_index]&0x04){
                sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.me_echo_user_input = FALSE;
                dbg("[SAT] SAT PARSER -  user input not be revealed");
        }
@@ -2706,7 +2863,7 @@ static TelSatResult _sat_decode_get_input(unsigned char* o_cmd_data, int o_lengt
                dbg("[SAT] SAT PARSER -  Me echo user input");
        }
 
-       if (cmd_data[index]&0x08) {
+       if(cmd_data[temp_index]&0x08){
                sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.user_input_unpacked_format = FALSE;
                dbg("[SAT] SAT PARSER - packing required");
        }
@@ -2715,303 +2872,349 @@ static TelSatResult _sat_decode_get_input(unsigned char* o_cmd_data, int o_lengt
                dbg("[SAT] SAT PARSER - unpacked format");
        }
 
-       if (cmd_data[index] & 0x80) {
+       if (cmd_data[temp_index] & 0x80) {
                sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.help_info = TRUE;
                dbg("[SAT] SAT PARSER - Help info");
        }
 
        //device identities
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.get_input.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
+
+       //text - mandatory
+       temp_index+=4;
+
+       remain_len = o_length-temp_index;
+       expected_len = tlv_length-5-4;
+       if(remain_len!=expected_len){
+               dbg("[SAT] SAT PARSER - : mismatch!! remain_len=%d, expected_len=%d", remain_len, expected_len);
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
-       //text
-       index+=4;
-       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.get_input.text, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding text tlv failed");
+       rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_input.text, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
-       if (sat_cmd_ind_data->data.get_input.text.string_length <= 0) {
+       if(sat_cmd_ind_data->data.get_input.text.string_length <= 0){
                err("[SAT] SAT PARSER - :string length is 0");
        }
        dbg("[SAT] SAT PARSER  text(%s)",sat_cmd_ind_data->data.get_input.text.string);
+       dbg("[SAT] SAT PARSER o_len(%d) temp_index(%d) data_len_consumed(%d)",o_length , temp_index, data_len_consumed);
 
-       //response length
-       index+=data_len_consumed;
-       rv = _sat_decode_response_length_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.get_input.rsp_len, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding response_length failed");
-               return rv;
+       if(o_length-temp_index < data_len_consumed){
+               dbg("[SAT] SAT PARSER - :wrong text TLV.");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+       }
+
+       if(o_length-temp_index == data_len_consumed){
+               dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+               return TCORE_SAT_SUCCESS;
        }
+       temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+
+       //response length - mandatory
+       rv = _sat_decode_response_length_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_input.rsp_len, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS)
+               return rv;
 
-       if (index+data_len_consumed >= o_length) {
-               err("[SAT] SAT PARSER - no more TLVs");
-               return TEL_SAT_RESULT_SUCCESS;
+       if(o_length-temp_index == data_len_consumed){
+               dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+               return TCORE_SAT_SUCCESS;
        }
+       temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
 
-       //default text
-       index+=data_len_consumed;
-       if ((o_cmd_data[index]&0x7F) == SATK_DEFAULT_TEXT_TAG) {
-               rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.get_input.default_text, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding text tlv failed");
+       //default text - optional
+       if((o_cmd_data[temp_index]&0x7F) == SATK_DEFAULT_TEXT_TAG){
+               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_input.default_text, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS)
                        return rv;
-               }
 
-               if (sat_cmd_ind_data->data.get_input.default_text.string_length <= 0) {
+               if(sat_cmd_ind_data->data.get_input.default_text.string_length <= 0){
                        err("[SAT] SAT PARSER - :string length is 0");
                }
                dbg("[SAT] SAT PARSER default text(%s)",sat_cmd_ind_data->data.get_input.default_text.string);
-               index+=data_len_consumed;
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //icon identifier
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
-               data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.display_text.icon_id, &data_len_consumed);
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_input.icon_id, &data_len_consumed);
+
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
+               }
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
                }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
 
-               if (index+data_len_consumed >= o_length) {
-                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+       //text attribute - optional
+       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_ATTRIBUTE_TAG){
+               rv =_sat_decode_text_attribute_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.get_input.text_attribute, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
+               }
+
+               if(o_length-temp_index == data_len_consumed){
+                       dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
                }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+       if(o_length > temp_index){
+               dbg("[SAT] SAT PARSER - : wrong text TLV, remaining data is found!!");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.4 MORE TIME
-static TelSatResult _sat_decode_more_time(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_more_time(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_type = cmd_data[temp_index++];
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_event_list.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
-       index+=4;
+       temp_index+=4;
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.5 PLAY TONE
-static TelSatResult _sat_decode_play_tone(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_play_tone(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.play_tone.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.play_tone.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.play_tone.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.play_tone.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       if (cmd_data[index] & 0x01)
-               sat_cmd_ind_data->data.play_tone.command_detail.cmd_qualifier.play_tone = TEL_SAT_VIBRATE_ALERT_REQUIRED;
+       if (cmd_data[temp_index] & 0x01)
+               sat_cmd_ind_data->data.play_tone.command_detail.cmd_qualifier.play_tone.vibration_alert = VIBRATE_ALERT_REQUIRED;
        else
-               sat_cmd_ind_data->data.play_tone.command_detail.cmd_qualifier.play_tone = TEL_SAT_VIBRATE_ALERT_OPTIONAL;
+               sat_cmd_ind_data->data.play_tone.command_detail.cmd_qualifier.play_tone.vibration_alert = VIBRATE_ALERT_OPTIONAL;
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.play_tone.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha id - optional
-       index+=4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.play_tone.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index+=4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.play_tone.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
+               temp_index+=data_len_consumed;
+               if(temp_index >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
                        dbg("[SAT] SAT PARSER - default value is set - tone type, duration");
-                       sat_cmd_ind_data->data.play_tone.tone = TEL_SAT_GENERAL_BEEP;
-                       sat_cmd_ind_data->data.play_tone.duration.time_unit = TEL_SAT_TIME_UNIT_SECONDS;
+                       sat_cmd_ind_data->data.play_tone.tone.tone_type = GENERAL_BEEP;
+                       sat_cmd_ind_data->data.play_tone.duration.time_unit = TIME_UNIT_SECONDS;
                        sat_cmd_ind_data->data.play_tone.duration.time_interval = 2;
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
        }
 
        //tone - optional
-       if ((cmd_data[index]&0x7F) == SATK_TONE_TAG) {
-               rv = _sat_decode_tone_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.play_tone.tone, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding tone tlv failed");
+       if((cmd_data[temp_index]&0x7F) == SATK_TONE_TAG){
+               rv = _sat_decode_tone_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.play_tone.tone, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
        else{
-               sat_cmd_ind_data->data.play_tone.tone = TEL_SAT_GENERAL_BEEP;
+               sat_cmd_ind_data->data.play_tone.tone.tone_type = GENERAL_BEEP;
        }
 
        //time duration - optional
-       if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
-               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.play_tone.duration, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding duration failed");
+       if((cmd_data[temp_index]&0x7F)==SATK_DURATION_TAG){
+               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.play_tone.duration, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
+               temp_index+=data_len_consumed;
+               if(temp_index >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
        }
        else{
                dbg("[SAT] SAT PARSER -  Duration TLV not present, ME should use a default value.");
-               sat_cmd_ind_data->data.play_tone.duration.time_unit = TEL_SAT_TIME_UNIT_SECONDS;
+               sat_cmd_ind_data->data.play_tone.duration.time_unit = TIME_UNIT_SECONDS;
                sat_cmd_ind_data->data.play_tone.duration.time_interval = 2;
        }
 
        //icon identifier
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.play_tone.icon_id, &data_len_consumed);
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.play_tone.icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(rv != TCORE_SAT_SUCCESS){
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               }
+
+               if(temp_index+data_len_consumed >= o_length){
+                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
+
+       //text attribute - optional
+       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_ATTRIBUTE_TAG){
+               rv =_sat_decode_text_attribute_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.play_tone.text_attribute, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
                }
 
-               if (index+data_len_consumed >= o_length) {
+               if(temp_index+data_len_consumed >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
-//ToDo:  Text Attribute and frames
+//ToDo: frames
+
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.7 REFRESH
-static TelSatResult _sat_decode_refresh(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_refresh(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.refresh.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.refresh.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.refresh.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.refresh.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       switch(cmd_data[index]) {
-       case TEL_SAT_REFRESH_SIM_INIT_AND_FULL_FCN:
-       case TEL_SAT_REFRESH_FCN:
-       case TEL_SAT_REFRESH_SIM_INIT_AND_FCN:
-       case TEL_SAT_REFRESH_SIM_INIT   :
-       case TEL_SAT_REFRESH_SIM_RESET:
-               sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh = cmd_data[index];
-               dbg("[SAT] SAT PARSER - : refresh mode=[0x%02x]:0-init&FFCN, 1-FCN, 2-init&FCN, 3-init, 4-reset", cmd_data[index]);
-       break;
-       case TEL_SAT_REFRESH_3G_APPLICATION_RESET:
-       case TEL_SAT_REFRESH_3G_SESSION_RESET:
-       case TEL_SAT_REFRESH_RESERVED:
-       default:
-               err("[SAT] SAT PARSER - : refresh mode=0x%02x Not Supported", cmd_data[index]);
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+       switch(cmd_data[temp_index]){
+               case SIM_REFRESH_CMD_INIT_AND_FULL_FCN:
+               case SIM_REFRESH_CMD_FCN:
+               case SIM_REFRESH_CMD_INIT_AND_FCN:
+               case SIM_REFRESH_CMD_INIT       :
+               case SIM_REFRESH_CMD_RESET:
+                       sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh.refresh = cmd_data[temp_index];
+                       dbg("[SAT] SAT PARSER - : refresh mode=[0x%02x]:0-init&FFCN, 1-FCN, 2-init&FCN, 3-init, 4-reset", cmd_data[temp_index]);
+                       break;
+
+               case SIM_REFRESH_CMD_3G_APPLICATION_RESET:
+               case SIM_REFRESH_CMD_3G_SESSION_RESET:
+               case SIM_REFRESH_CMD_RESERVED:
+               default:
+                       dbg("[SAT] SAT PARSER - : refresh mode=0x%02x Not Supported", cmd_data[temp_index]);
+                       return TCORE_SAT_BEYOND_ME_CAPABILITY;
+                       break;
        }
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.refresh.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //check file list
-       index+=4;
-       if ( (sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh == TEL_SAT_REFRESH_FCN)
-               || (sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh == TEL_SAT_REFRESH_SIM_INIT_AND_FCN) ) {
+       temp_index+=4;
+       if( (sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh.refresh == SIM_REFRESH_CMD_FCN)
+               || (sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh.refresh == SIM_REFRESH_CMD_INIT_AND_FCN) ){
 
-               rv = _sat_decode_file_list_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.refresh.file_list, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding file_list failed");
+               rv = _sat_decode_file_list_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.refresh.file_list, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS)
                        return rv;
-               }
        }
        else
                sat_cmd_ind_data->data.refresh.file_list.file_count = 0;
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.8 SETUP MENU
-static TelSatResult _sat_decode_setup_menu(unsigned char* tlv_str, int tlv_len,
-               int curr_offset, TelSatDecodedProactiveData *pactive_cmd_ind_obj)
+static enum tcore_sat_result _sat_decode_setup_menu(unsigned char* tlv_str, int tlv_len,
+               int curr_offset, struct tcore_sat_proactive_command *pactive_cmd_ind_obj)
 {
-       int index = 0;
+       int temp_index = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* src_data;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
        //access command detail
-       index = curr_offset+2; //move the index to command detail info +2(tag and length)
+       temp_index = curr_offset+2; //move the temp_index to command detail info +2(tag and length)
        src_data = &tlv_str[0];
 
-// In this time, the point of index is COMMAND NUMBER
+// In this time, the point of temp_index is COMMAND NUMBER
 // [1] insert command detail information into each proactive command data structure.
-       pactive_cmd_ind_obj->data.setup_menu.command_detail.cmd_num = src_data[index++];
-       pactive_cmd_ind_obj->data.setup_menu.command_detail.cmd_type = src_data[index++];
+       pactive_cmd_ind_obj->data.setup_menu.command_detail.cmd_num = src_data[temp_index++];
+       pactive_cmd_ind_obj->data.setup_menu.command_detail.cmd_type = src_data[temp_index++];
 
 // [2] decode COMMAND QUALIFIER
 /*
@@ -3023,19 +3226,19 @@ static TelSatResult _sat_decode_setup_menu(unsigned char* tlv_str, int tlv_len,
 */
 
 //[2-1] selection preference
-       if (src_data[index] & 0x01) {
+       if (src_data[temp_index] & 0x01) {
                pactive_cmd_ind_obj->data.setup_menu.command_detail.cmd_qualifier.setup_menu.select_preference =
-                               TEL_SAT_SELECTION_PREFERENCE_USING_SOFT_KEY;
+                               SELECTION_PREFERENCE_USING_SOFT_KEY;
                dbg("[SAT] SAT PARSER -  sel_pref=SAT_SELECTION_PREFERENCE_USING_SOFT_KEY.");
        }
        else {
                pactive_cmd_ind_obj->data.setup_menu.command_detail.cmd_qualifier.setup_menu.select_preference =
-                               TEL_SAT_SELECTION_PREFERENCE_NONE_REQUESTED;
+                               SELECTION_PREFERENCE_NONE_REQUESTED;
                dbg("[SAT] SAT PARSER - : sel_pref=SAT_SELECTION_PREFERENCE_NONE_REQUESTED.");
        }
 
 //[2-2] help available
-       if (src_data[index] & 0x80) {
+       if (src_data[temp_index] & 0x80) {
                pactive_cmd_ind_obj->data.setup_menu.command_detail.cmd_qualifier.setup_menu.help_info =
                                TRUE;
                ;dbg("[SAT] SAT PARSER - : is help Available=TRUE.");
@@ -3046,203 +3249,239 @@ static TelSatResult _sat_decode_setup_menu(unsigned char* tlv_str, int tlv_len,
                dbg("[SAT] SAT PARSER -  is help Available=FALSE.");
        }
 
-// In this time, the point of index is DEVICE IDENTITIES.
+// In this time, the point of temp_index is DEVICE IDENTITIES.
 //[3] decode DEVICE IDENTITIES TLV
-       index++;
-       memcpy(dev_id, &src_data[index], 4);
+       temp_index++;
+       memcpy(dev_id, &src_data[temp_index], 4);
        rv = _sat_decode_device_identities_tlv(dev_id, &pactive_cmd_ind_obj->data.setup_menu.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
+       if (rv != TCORE_SAT_SUCCESS) {
                //send TR in SatkProcessProactiveCmdInd()
-               err("[SAT] SAT PARSER - decoding device_identities failed");
                return rv;
        }
 
 
-// In this time, the point of index is ALPHA IDENTIFIER. 11 or 12.
+// In this time, the point of temp_index is ALPHA IDENTIFIER. 11 or 12.
 //[4] decode ALPHA IDENTIFIER TLV
-       index+=4;
-       dbg("[SAT] SAT PARSER - :index=%d",index);
-       rv = _sat_decode_alpha_identifier_tlv(src_data, tlv_len, index,
+       temp_index+=4;
+       dbg("[SAT] SAT PARSER - :temp_index=%d",temp_index);
+       rv = _sat_decode_alpha_identifier_tlv(src_data, tlv_len, temp_index,
                        &pactive_cmd_ind_obj->data.setup_menu.alpha_id, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       if(rv != TCORE_SAT_SUCCESS) {
                return rv;
        }
 
-// In this time, the point of index is ITEM  TLV
+// In this time, the point of temp_index is ITEM  TLV
 //[5] decode ITEM LIST (at least one is mandatory)
-       index+= data_len_consumed;
+       temp_index+= data_len_consumed;
        pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt = 0;
        do{
                data_len_consumed=0;
-               if ((src_data[index]&0x7F) == SATK_ITEM_TAG) {
-                       rv = _sat_decode_item_tlv(src_data, tlv_len, index,
+               if((src_data[temp_index]&0x7F) == SATK_ITEM_TAG) {
+                       rv = _sat_decode_item_tlv(src_data, tlv_len, temp_index,
                                                &pactive_cmd_ind_obj->data.setup_menu.menu_item[pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt],
                                                &data_len_consumed);
 
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding item failed");
+                       if(rv != TCORE_SAT_SUCCESS)
                                return rv;
-                       }
+
+                       if(!pactive_cmd_ind_obj->data.setup_menu.menu_item[0].text_len)
+                               break;
                }
                else {
-                       if (pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt == 0) {
-                               err("menu item is not exist.");
-                               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+                       if(pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt == 0) {
+                               dbg("menu item is not exist.");
+                               return TCORE_SAT_REQUIRED_VALUE_MISSING;
                        }
                        //else
                        break;  //???
                }
                pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt++;
-               index += data_len_consumed;
+               temp_index += data_len_consumed;
 
-               if (index >= tlv_len)
+               if(temp_index >= tlv_len)
                        break;
-       }while(pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt < TEL_SAT_MENU_ITEM_COUNT_MAX);
+       }while(pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt < SAT_MENU_ITEM_COUNT_MAX);
 
        dbg("[SAT] SAT PARSER - :setup menu item_count=%d",pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt);
-       if (index >= tlv_len) {
+       if(temp_index >= tlv_len){
                dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
                //send TR in SatkProcessProactiveCmdInd()
-               return TEL_SAT_RESULT_SUCCESS;
+               return TCORE_SAT_SUCCESS;
        }
 
 //[6] (optional TLV) decode ITEMS NEXT ACTION INDICATOR TLV
-       if ((src_data[index]&0x7F) == SATK_ITEMS_NEXT_ACTION_INDICATOR_TAG) {
+       if((src_data[temp_index]&0x7F) == SATK_ITEMS_NEXT_ACTION_INDICATOR_TAG) {
                data_len_consumed = 0;
-               rv = _sat_decode_item_next_action_indicator_tlv(tlv_str, tlv_len, index,
+               rv = _sat_decode_item_next_action_indicator_tlv(tlv_str, tlv_len, temp_index,
                                &pactive_cmd_ind_obj->data.setup_menu.next_act_ind_list, &data_len_consumed);
-               if (rv!=TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding item_next_action_indicator failed");
-                       return rv;
-               }
+               if(rv!=TCORE_SAT_SUCCESS) return rv;
 
-               if (index+data_len_consumed >= tlv_len) {
+               if(temp_index+data_len_consumed >= tlv_len) {
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
                        //send the data to Noti manager.
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
        else {
                dbg("[SAT] SAT PARSER -  ITEMS NEXT ACTION INDICATOR TLV Not present");
        }
 
 //[7] (optional TLV) decode ICON IDENTIFIER TLV
-       if ((src_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((src_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(tlv_str, tlv_len, index,
+               rv = _sat_decode_icon_identifier_tlv(tlv_str, tlv_len, temp_index,
                                &pactive_cmd_ind_obj->data.setup_menu.icon_id, &data_len_consumed);
-               if (rv !=TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return rv;
-               }
+               if(rv !=TCORE_SAT_SUCCESS) return rv;
 
-               if (index+data_len_consumed >= tlv_len) {
+               if(temp_index+data_len_consumed >= tlv_len) {
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
                        //send the data to Noti manager.
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
        else{
                dbg("[SAT] SAT PARSER - ICON IDENTIFIER TLV Not present");
        }
 
 //[8] (optional TLV) decode ICON IDENTIFIER LIST TLV
-       if ((src_data[index]&0x7F) == SATK_ITEM_ICON_IDENTIFIER_LIST_TAG) {
+       if((src_data[temp_index]&0x7F) == SATK_ITEM_ICON_IDENTIFIER_LIST_TAG) {
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_list_tlv(tlv_str, tlv_len, index,
+               rv = _sat_decode_icon_identifier_list_tlv(tlv_str, tlv_len, temp_index,
                                &pactive_cmd_ind_obj->data.setup_menu.icon_list, &data_len_consumed);
-               if (rv !=TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier_list failed");
-                       return rv; //SEND TR
-               }
+               if(rv !=TCORE_SAT_SUCCESS) return rv; //SEND TR
 
-               if (index+data_len_consumed >= tlv_len) {
+               if(temp_index+data_len_consumed >= tlv_len){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
                        //send the data to Noti manager.
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
 
        }
        else {
                dbg("[SAT] SAT PARSER - ICON IDENTIFIER LIST TLV not present");
        }
 
-//ToDo:  Text Attribute, Text Attribute list. refer ETSI 102.223.
+       //text attribute - optional
+       if((src_data[temp_index]&0x7F)==SATK_TEXT_ATTRIBUTE_TAG){
+               rv =_sat_decode_text_attribute_tlv(tlv_str, tlv_len, temp_index, &pactive_cmd_ind_obj->data.setup_menu.text_attribute, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
+               }
+
+               if(temp_index+data_len_consumed >= tlv_len){
+                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
+
+       //text attribute list - optional
+       if((src_data[temp_index]&0x7F) == SATK_TEXT_ATTRIBUTE_LIST_TAG){
+               int attr_item_temp_index = 0, item_cnt = 0;
+               int txt_attr_list_len = 0;
+
+               struct tel_sat_text_attribute_list *txt_attr_list = NULL;
+
+               txt_attr_list = &pactive_cmd_ind_obj->data.setup_menu.text_attribute_list;
+
+               //length
+               temp_index++;
+               txt_attr_list_len = src_data[temp_index];
+               if(txt_attr_list_len == 0){
+                       dbg("[SAT] - Text Attribute List is nothing");
+                       return TCORE_SAT_REQUIRED_VALUE_MISSING;
+               }
+
+               //item cnt - each text attribute length is 4byte
+               item_cnt = txt_attr_list_len/4;
+               txt_attr_list->list_cnt = item_cnt;
+               dbg("[SAT] - text attribute item cnt(%d)", item_cnt);
+
+               //get attribute data
+               temp_index++;
+               for(attr_item_temp_index = 0; attr_item_temp_index < item_cnt; attr_item_temp_index++){
+                       memcpy(txt_attr_list->text_attribute_list[attr_item_temp_index].text_formatting, &src_data[temp_index], 4);
+                       temp_index += 4;
+               }
+
+               dbg("[SAT] SAT PARSER - done to decode text attribute list");
+       }
+
        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.9 SELECT ITEM
-static TelSatResult _sat_decode_select_item(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_select_item(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.select_item.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.select_item.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.select_item.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.select_item.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       if (cmd_data[index] & 0x01) {
-               if (cmd_data[index] & 0x02) {
-                       sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = TEL_SAT_PRESENTATION_TYPE_NAVIGATION_OPTION;
+       if (cmd_data[temp_index] & 0x01) {
+               if (cmd_data[temp_index] & 0x02) {
+                       sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = PRESENTATION_TYPE_NAVIGATION_OPTION;
                        dbg("[SAT] SAT PARSER - PRESENTATION_TYPE_NAVIGATION_OPTION");
                }
                else{
-                       sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = TEL_SAT_PRESENTATION_TYPE_DATA_VALUE;
+                       sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = PRESENTATION_TYPE_DATA_VALUE;
                        dbg("[SAT] SAT PARSER - PRESENTATION_TYPE_DATA_VALUE");
                }
        }
        else {
-               sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = TEL_SAT_PRESENTATION_TYPE_NOT_SPECIFIED;
+               sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = PRESENTATION_TYPE_NOT_SPECIFIED;
                dbg("[SAT] SAT PARSER - PRESENTATION_TYPE_NOT_SPECIFIED");
        }
 
-       if (cmd_data[index] & 0x04) {
-               sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.select_preference = TEL_SAT_SELECTION_PREFERENCE_USING_SOFT_KEY;
+       if (cmd_data[temp_index] & 0x04) {
+               sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.select_preference = SELECTION_PREFERENCE_USING_SOFT_KEY;
                dbg("[SAT] SAT PARSER - SELECTION_PREFERENCE_USING_SOFT_KEY");
        }
        else {
-               sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.select_preference = TEL_SAT_SELECTION_PREFERENCE_NONE_REQUESTED;
+               sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.select_preference = SELECTION_PREFERENCE_NONE_REQUESTED;
                dbg("[SAT] SAT PARSER - SELECTION_PREFERENCE_NONE_REQUESTED");
        }
 
-       if (cmd_data[index] & 0x80) {
+       if (cmd_data[temp_index] & 0x80) {
                sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.help_info = TRUE;
                dbg("[SAT] SAT PARSER - Help info");
        }
 
        //device identities
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.select_item.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier
-       index+=4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.select_item.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index+=4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.select_item.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //item objects
@@ -3250,3716 +3489,3921 @@ static TelSatResult _sat_decode_select_item(unsigned char* o_cmd_data, int o_len
        do{
                data_len_consumed=0;
 
-               if ((cmd_data[index]&0x7F) == SATK_ITEM_TAG) {
-                       rv = _sat_decode_item_tlv(o_cmd_data, o_length, index,
+               if((cmd_data[temp_index]&0x7F) == SATK_ITEM_TAG) {
+                       rv = _sat_decode_item_tlv(o_cmd_data, o_length, temp_index,
                                &sat_cmd_ind_data->data.select_item.menu_item[sat_cmd_ind_data->data.select_item.menu_item_cnt],
                                &data_len_consumed);
 
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding item failed");
+                       if(rv != TCORE_SAT_SUCCESS)
                                return rv;
-                       }
                }
                else {
-                       if (sat_cmd_ind_data->data.select_item.menu_item_cnt == 0) {
-                               err("menu item is not exist.");
-                               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+                       if(sat_cmd_ind_data->data.select_item.menu_item_cnt == 0) {
+                               dbg("menu item is not exist.");
+                               return TCORE_SAT_REQUIRED_VALUE_MISSING;
                        }
                        //else
                        break;  //???
                }
                sat_cmd_ind_data->data.select_item.menu_item_cnt++;
-               index += data_len_consumed;
+               temp_index += data_len_consumed;
 
-               if (index >= o_length)
+               if(temp_index >= o_length)
                        break;
 
-       }while(sat_cmd_ind_data->data.select_item.menu_item_cnt < TEL_SAT_MENU_ITEM_COUNT_MAX);
+       }while(sat_cmd_ind_data->data.select_item.menu_item_cnt < SAT_MENU_ITEM_COUNT_MAX);
 
        dbg("[SAT] SAT PARSER - select menu item_count=%d",sat_cmd_ind_data->data.select_item.menu_item_cnt);
-       if (index >= o_length) {
+       if(temp_index >= o_length){
                dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
-               return TEL_SAT_RESULT_SUCCESS;
+               return TCORE_SAT_SUCCESS;
        }
 
        //item next action indicator
-       if ((cmd_data[index]&0x7F) == SATK_ITEMS_NEXT_ACTION_INDICATOR_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ITEMS_NEXT_ACTION_INDICATOR_TAG) {
                data_len_consumed = 0;
-               rv = _sat_decode_item_next_action_indicator_tlv(o_cmd_data, o_length, index,
+               rv = _sat_decode_item_next_action_indicator_tlv(o_cmd_data, o_length, temp_index,
                                &sat_cmd_ind_data->data.select_item.item_next_act_ind_list, &data_len_consumed);
-               if (rv!=TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding item_next_action_indicator failed");
+               if(rv!=TCORE_SAT_SUCCESS)
                        return rv;
-               }
 
-               if (index+data_len_consumed >= o_length) {
+               if(temp_index+data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //item identifier
-       if ((cmd_data[index]&0x7F) == SATK_ITEM_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ITEM_IDENTIFIER_TAG) {
                data_len_consumed = 0;
-               rv = _sat_decode_item_identifier_tlv(o_cmd_data, o_length, index,
+               rv = _sat_decode_item_identifier_tlv(o_cmd_data, o_length, temp_index,
                                &sat_cmd_ind_data->data.select_item.item_identifier, &data_len_consumed);
-               if (rv !=TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding item_identifier failed");
+               if(rv !=TCORE_SAT_SUCCESS)
                        return rv;
-               }
 
-               if (index+data_len_consumed >= o_length) {
+               if(temp_index+data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //icon identifier
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index,
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index,
                                &sat_cmd_ind_data->data.select_item.icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(rv != TCORE_SAT_SUCCESS){
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //SEND TR
                }
 
-               if (index+data_len_consumed >= o_length) {
+               if(temp_index+data_len_consumed >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
-       if ((cmd_data[index]&0x7F) == SATK_ITEM_ICON_IDENTIFIER_LIST_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ITEM_ICON_IDENTIFIER_LIST_TAG) {
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_list_tlv(o_cmd_data, o_length, index,
+               rv = _sat_decode_icon_identifier_list_tlv(o_cmd_data, o_length, temp_index,
                                &sat_cmd_ind_data->data.select_item.icon_list, &data_len_consumed);
-               if (rv !=TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier_list failed");
+               if(rv !=TCORE_SAT_SUCCESS)
+                       return rv; //SEND TR
+
+               if(temp_index+data_len_consumed >= o_length){
+                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                       return TCORE_SAT_SUCCESS;
+               }
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
+
+       //text attribute - optional
+       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_ATTRIBUTE_TAG){
+               rv =_sat_decode_text_attribute_tlv(o_cmd_data, o_length, temp_index,
+                               &sat_cmd_ind_data->data.select_item.text_attribute, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
 
-               if (index+data_len_consumed >= o_length) {
+               if(temp_index+data_len_consumed >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
+               }
+
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
+       }
+
+       //text attribute list - optional
+       if((cmd_data[temp_index]&0x7F) == SATK_TEXT_ATTRIBUTE_LIST_TAG){
+               int attr_item_temp_index = 0, item_cnt = 0;
+               int txt_attr_list_len = 0;
+
+               struct tel_sat_text_attribute_list *txt_attr_list = NULL;
+
+               txt_attr_list = &sat_cmd_ind_data->data.select_item.text_attribute_list;
+
+               //length
+               temp_index++;
+               txt_attr_list_len = cmd_data[temp_index];
+               if(txt_attr_list_len == 0){
+                       dbg("[SAT] - Text Attribute List is nothing");
+                       return TCORE_SAT_REQUIRED_VALUE_MISSING;
                }
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+
+               //item cnt - each text attribute length is 4byte
+               item_cnt = txt_attr_list_len/4;
+               txt_attr_list->list_cnt = item_cnt;
+               dbg("[SAT] - text attribute item cnt(%d)", item_cnt);
+
+               //get attribute data
+               temp_index++;
+               for(attr_item_temp_index = 0; attr_item_temp_index < item_cnt; attr_item_temp_index++){
+                       memcpy(txt_attr_list->text_attribute_list[attr_item_temp_index].text_formatting, &cmd_data[temp_index], 4);
+                       temp_index += 4;
+               }
+
+               dbg("[SAT] SAT PARSER - done to decode text attribute list");
        }
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.10 SEND SMS
-static TelSatResult _sat_decode_send_sms(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_send_sms(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.send_sms.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.send_sms.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.send_sms.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.send_sms.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       if (cmd_data[index] & 0x01) {
-               sat_cmd_ind_data->data.send_sms.command_detail.cmd_qualifier.cmd_quali_send_sms = TRUE;
+       if (cmd_data[temp_index] & 0x01) {
+               sat_cmd_ind_data->data.send_sms.command_detail.cmd_qualifier.send_sms.packing_by_me_required = TRUE;
        }
        else {
-               sat_cmd_ind_data->data.send_sms.command_detail.cmd_qualifier.cmd_quali_send_sms = FALSE;
+               sat_cmd_ind_data->data.send_sms.command_detail.cmd_qualifier.send_sms.packing_by_me_required = FALSE;
                dbg("[SAT] SAT PARSER - packing by me required is false");
        }
 
        //device identities
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_sms.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier
-       index+=4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
+       temp_index+=4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_sms.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_sms.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //address
-       if ((cmd_data[index]&0x7F) == SATK_ADDRESS_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ADDRESS_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_sms.address, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding address failed");
+               rv = _sat_decode_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_sms.address, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //SMS-TPDU
        data_len_consumed = 0;
-       rv = _sat_decode_sms_tpdu_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_sms.sms_tpdu, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding sms_tpdu failed");
+       rv = _sat_decode_sms_tpdu_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_sms.sms_tpdu, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
-       if (index+data_len_consumed >= o_length) {
+       if(temp_index+data_len_consumed >= o_length){
                dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-               return TEL_SAT_RESULT_SUCCESS;
+               return TCORE_SAT_SUCCESS;
        }
 
        //icon identifier
-       index+=data_len_consumed;
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       temp_index+=data_len_consumed;
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index,
-                               &sat_cmd_ind_data->data.select_item.icon_id, &data_len_consumed);
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index,
+                               &sat_cmd_ind_data->data.send_sms.icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(rv != TCORE_SAT_SUCCESS){
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //SEND TR
                }
 
-               if (index+data_len_consumed >= o_length) {
+               if(temp_index+data_len_consumed >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.11 SEND SS
-static TelSatResult _sat_decode_send_ss(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_send_ss(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(sat_cmd_ind_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL || sat_cmd_ind_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.send_ss.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.send_ss.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.send_ss.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.send_ss.command_detail.cmd_type = cmd_data[temp_index++];
 
        /** command detail **/
-       index++; //RFU
+       temp_index++; //RFU
 
        //device identities
-       memcpy(dev_id,&cmd_data[index],4);
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_ss.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier - optional
-       index += 4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_ss.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index += 4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_ss.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //ss string
-       rv = _sat_decode_ss_string_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_ss.ss_string, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding ss_string failed");
+       rv = _sat_decode_ss_string_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_ss.ss_string, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //icon identifier- optional
-       index+=data_len_consumed;
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       temp_index+=data_len_consumed;
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
 
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_ss.icon_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_ss.icon_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //SEND TR
                }
 
        }
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.12 SEND USSD
-static TelSatResult _sat_decode_send_ussd(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_send_ussd(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(sat_cmd_ind_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL || sat_cmd_ind_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.send_ussd.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.send_ussd.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.send_ussd.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.send_ussd.command_detail.cmd_type = cmd_data[temp_index++];
 
        /** command detail **/
-       index++; //RFU
+       temp_index++; //RFU
 
        //device identities
-       memcpy(dev_id,&cmd_data[index],4);
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_ussd.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier - optional
-       index += 4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_ussd.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index += 4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_ussd.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //ussd string
-       rv = _sat_decode_ussd_string_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_ussd.ussd_string, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding ussd_string failed");
+       rv = _sat_decode_ussd_string_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_ussd.ussd_string, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //icon identifier- optional
-       index+=data_len_consumed;
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       temp_index+=data_len_consumed;
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
 
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_ussd.icon_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_ussd.icon_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //SEND TR
                }
 
        }
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.13 SETUP CALL
-static TelSatResult _sat_decode_setup_call(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_setup_call(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
-       tcore_check_return_value_assert(sat_cmd_ind_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL || sat_cmd_ind_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.setup_call.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.setup_call.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.setup_call.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.setup_call.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       switch(cmd_data[index]) {
-       case TEL_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY:
-       case TEL_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY_WITH_REDIAL:
-       case TEL_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD:
-       case TEL_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD_WITH_REDIAL:
-       case TEL_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS:
-       case TEL_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS_WITH_REDIAL:
-               sat_cmd_ind_data->data.setup_call.command_detail.cmd_qualifier.setup_call = cmd_data[index];
-               dbg("[SAT] SAT PARSER -  setup_call.cmd_qualifier= 0x%02x", sat_cmd_ind_data->data.setup_call.command_detail.cmd_qualifier.setup_call);
-       break;
-       case TEL_SAT_SETUP_CALL_RESERVED:
-       default:
-               err("[SAT] SAT PARSER -  setup_call.cmd_qualifier= 0x%02x", cmd_data[index]);
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+       switch(cmd_data[temp_index]){
+               case SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY:
+               case SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY_WITH_REDIAL:
+               case SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD:
+               case SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD_WITH_REDIAL:
+               case SETUP_CALL_DISCONN_ALL_OTHER_CALLS:
+               case SETUP_CALL_DISCONN_ALL_OTHER_CALLS_WITH_REDIAL:
+                       sat_cmd_ind_data->data.setup_call.command_detail.cmd_qualifier.setup_call.setup_call = cmd_data[temp_index];
+                       dbg("[SAT] SAT PARSER -  setup_call.cmd_qualifier= 0x%02x", sat_cmd_ind_data->data.setup_call.command_detail.cmd_qualifier.setup_call.setup_call);
+                       break;
+               case SETUP_CALL_RESERVED:
+               default:
+                       dbg("[SAT] SAT PARSER -  setup_call.cmd_qualifier= 0x%02x", cmd_data[temp_index]);
+                       return TCORE_SAT_BEYOND_ME_CAPABILITY;
+                       break;
        }
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_call.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier (user confirmation) - optional
-       index+=4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_call.user_confirm_alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index+=4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_call.user_confirm_alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //address
-       rv = _sat_decode_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_call.address, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding address failed");
+       rv = _sat_decode_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_call.address, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS) {
                return rv;
        }
 
-       index+=data_len_consumed;
-       if (index >= o_length) {
+       temp_index+=data_len_consumed;
+       if(temp_index >= o_length){
                dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-               return TEL_SAT_RESULT_SUCCESS;
+               return TCORE_SAT_SUCCESS;
        }
 
        //capability configuration parameter - optional
-       if ((cmd_data[index]&0x7F)==SATK_CAPABILITY_CONFIGURATION_PARAMETERS_TAG) {
-               rv =_sat_decode_ccp_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_call.ccp, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding ccp failed");
+       if((cmd_data[temp_index]&0x7F)==SATK_CAPABILITY_CONFIGURATION_PARAMETERS_TAG){
+               rv =_sat_decode_ccp_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_call.ccp, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
+               temp_index+=data_len_consumed;
+               if(temp_index >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
        }
 
        //sub address - optional
-       if ((cmd_data[index]&0x7F)==SATK_SUB_ADDRESS_TAG) {
-               rv =_sat_decode_sub_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_call.subaddress, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding sub_address failed");
+       if((cmd_data[temp_index]&0x7F)==SATK_SUB_ADDRESS_TAG){
+               rv =_sat_decode_sub_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_call.subaddress, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
+               temp_index+=data_len_consumed;
+               if(temp_index >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
        }
 
        //time duration - optional
-       if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
-               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_call.duration, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding duration failed");
+       if((cmd_data[temp_index]&0x7F)==SATK_DURATION_TAG){
+               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_call.duration, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
+               temp_index+=data_len_consumed;
+               if(temp_index >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
        }
 
        //icon identifier (user confirmation) - optional
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_call.user_confirm_icon_id, &data_len_consumed);
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_call.user_confirm_icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(rv != TCORE_SAT_SUCCESS){
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //SEND TR
                }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
+               temp_index+=data_len_consumed;
+               if(temp_index >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
        }
 
        //alpha identifier (call setup) - optional
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_call.call_setup_alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_call.call_setup_alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
+               temp_index+=data_len_consumed;
+               if(temp_index >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
        }
 
        //icon identifier (call setup) - optional
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_call.call_setup_icon_id, &data_len_consumed);
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_call.call_setup_icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(rv != TCORE_SAT_SUCCESS){
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //SEND TR
                }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
+               temp_index+=data_len_consumed;
+               if(temp_index >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
        }
 
        //ToDo:  Text Attribute (user_confirmation , call_setup)
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.15 PROVIDE LOCAL INFO
-static TelSatResult _sat_decode_provide_local_info(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_provide_local_info(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       switch(cmd_data[index]) {
-       case TEL_SAT_LOCAL_INFO_DATE_TIME_AND_TIMEZONE:
-       case TEL_SAT_LOCAL_INFO_LANGUAGE:
-               sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_qualifier.provide_local_info = cmd_data[index];
-       break;
-       //TODO - Other cases
-       default:
-               sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_qualifier.provide_local_info = TEL_SAT_LOCAL_INFO_RESERVED;
+       switch(cmd_data[temp_index]){
+               case LOCAL_INFO_DATE_TIME_AND_TIMEZONE:
+               case LOCAL_INFO_LANGUAGE:
+                       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_qualifier.provide_local_info.provide_local_info = cmd_data[temp_index];
+                       break;
+               //TODO - Other cases
+               default:
+                       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_qualifier.provide_local_info.provide_local_info = LOCAL_INFO_RESERVED;
+                       break;
        }
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_event_list.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //TODO - UTRAN Measurement Qualifier
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.16 SETUP EVENT LIST
-static TelSatResult _sat_decode_setup_event_list(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_setup_event_list(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.setup_event_list.command_detail.cmd_type = cmd_data[temp_index++];
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_event_list.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //event list
-       index+=4;
-       rv = _sat_decode_event_list_tlv(o_cmd_data, o_length, index,
-                       &sat_cmd_ind_data->data.setup_event_list.event_list,
+       temp_index+=4;
+       rv = _sat_decode_event_list_tlv(o_cmd_data, o_length, temp_index,
                        &sat_cmd_ind_data->data.setup_event_list.event_list, &data_len_consumed);
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.22 SETUP IDLE MODE TEXT
-static TelSatResult _sat_decode_setup_idle_mode_text(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_setup_idle_mode_text(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.setup_idle_mode_text.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.setup_idle_mode_text.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.setup_idle_mode_text.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.setup_idle_mode_text.command_detail.cmd_type = cmd_data[temp_index++];
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_idle_mode_text.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //text string
-       index+=4;
-       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_idle_mode_text.text, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding text failed");
+       temp_index+=4;
+       rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_idle_mode_text.text, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
-       if (sat_cmd_ind_data->data.setup_idle_mode_text.text.string_length <= 0) {
-               err("[SAT] SAT PARSER - :string length is 0");
-               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       if(sat_cmd_ind_data->data.setup_idle_mode_text.text.string_length < 0){
+               err("[SAT] SAT PARSER - :string length is less than 0");
+               return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
        }
 
        dbg("[SAT] SAT PARSER  text(%s)",sat_cmd_ind_data->data.setup_idle_mode_text.text.string);
-       dbg("[SAT] SAT PARSER o_len(%d) index(%d) data_len_consumed(%d)",o_length , index, data_len_consumed);
+       dbg("[SAT] SAT PARSER o_len(%d) temp_index(%d) data_len_consumed(%d)",o_length , temp_index, data_len_consumed);
 
-       if (index+data_len_consumed > o_length) {
+       if(temp_index+data_len_consumed > o_length){
                err("[SAT] SAT PARSER - Wrong String TLV");
-               return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
+               return TCORE_SAT_BEYOND_ME_CAPABILITY;
        }
-       else if (index+data_len_consumed == o_length) {
+       else if(temp_index+data_len_consumed == o_length){
                dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
-               return TEL_SAT_RESULT_SUCCESS;
+               return TCORE_SAT_SUCCESS;
        }
 
        //icon identifier
-       index+=data_len_consumed;
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       temp_index+=data_len_consumed;
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.setup_idle_mode_text.icon_id, &data_len_consumed);
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.setup_idle_mode_text.icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //SEND TR
+               if(rv != TCORE_SAT_SUCCESS){
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //SEND TR
                }
 
-               if (index+data_len_consumed >= o_length) {
+               if(temp_index+data_len_consumed >= o_length){
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
 
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //ToDo:  Text Attribute
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.24 SEND DTMF
-static TelSatResult _sat_decode_send_dtmf(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_send_dtmf(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.send_dtmf.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.send_dtmf.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.send_dtmf.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.send_dtmf.command_detail.cmd_type = cmd_data[temp_index++];
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_dtmf.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier - optional
-       index+=4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_dtmf.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index+=4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_dtmf.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        // DTMF string - mandatory
-       if ((cmd_data[index] & 0x7F) == SATK_DTMF_STRING_TAG) {
-               rv = _sat_decode_dtmf_string_tlv(o_cmd_data, o_length, index,
+       if ((cmd_data[temp_index] & 0x7F) == SATK_DTMF_STRING_TAG) {
+               rv = _sat_decode_dtmf_string_tlv(o_cmd_data, o_length, temp_index,
                                &sat_cmd_ind_data->data.send_dtmf.dtmf_string, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding dtmf_string failed");
+               if (rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
 
-               if (index + data_len_consumed >= o_length) {
+               if (temp_index + data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
-               index += data_len_consumed;
+               temp_index += data_len_consumed;
        } else {
                dbg("[SAT] SAT PARSER - DTMF tlv is missed.");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
        }
 
        //icon identifier - optional
-       if ((cmd_data[index] & 0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if ((cmd_data[temp_index] & 0x7F) == SATK_ICON_IDENTIFIER_TAG) {
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index,
-                               &sat_cmd_ind_data->data.setup_idle_mode_text.icon_id, &data_len_consumed);
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index,
+                               &sat_cmd_ind_data->data.send_dtmf.icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               if (rv != TCORE_SAT_SUCCESS) {
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                }
 
-               if (index + data_len_consumed >= o_length) {
+               if (temp_index + data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
-               index += data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index += data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //ToDo:  Text Attribute, Frame Identifier
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.25 LANGUAGE NOTIFICATION
-static TelSatResult _sat_decode_language_notification(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_language_notification(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.language_notification.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.language_notification.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.language_notification.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.language_notification.command_detail.cmd_type = cmd_data[temp_index++];
 
        /* ******decode command qualifier****** */
-       if (cmd_data[index]&0x01)
-               sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.cmd_quali_language_notification = TRUE;
+       if(cmd_data[temp_index]&0x01)
+               sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.language_notification.specific_language = TRUE;
        else
-               sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.cmd_quali_language_notification = FALSE;
+               sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.language_notification.specific_language = FALSE;
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.language_notification.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //language - conditional
-       index+=4;
-       if (sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.cmd_quali_language_notification == TRUE) {
-               if ((cmd_data[index]&0x7F) == SATK_LANGUAGE_TAG) {
-                       rv = _sat_decode_language_tlv(cmd_data, o_length, index, &sat_cmd_ind_data->data.language_notification.language);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding language failed");
+       temp_index+=4;
+       if (sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.language_notification.specific_language == TRUE) {
+               if((cmd_data[temp_index]&0x7F) == SATK_LANGUAGE_TAG) {
+                       rv = _sat_decode_language_tlv(cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.language_notification.language);
+                       if(rv != TCORE_SAT_SUCCESS)
                                return rv;
-                       }
                } else  {
                        dbg("[SAT] SAT PARSER -  Language TLV is required but missing.");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                }
        } else {
-               sat_cmd_ind_data->data.language_notification.language = TEL_SAT_LP_LANG_UNSPECIFIED;
+               sat_cmd_ind_data->data.language_notification.language = SIM_LANG_UNSPECIFIED;
                dbg("[SAT] SAT PARSER -  non-specific language");
        }
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.26 LAUNCH BROWSER
-static TelSatResult _sat_decode_launch_browser(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_launch_browser(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0, data_len_consumed = 0;
+       int temp_index = 0, data_len_consumed = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        //command detail
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_type = cmd_data[temp_index++];
 
        // decode command qualifier
-       switch (cmd_data[index]) {
-       case 0x00:
-               sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser =
-                               TEL_SAT_LAUNCH_BROWSER_IF_NOT_ALREADY_LAUNCHED;
-       break;
-       case 0x01:
-               sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser =
-                               TEL_SAT_LAUNCH_BROWSER_NOT_USED;
-       break;
-       case 0x02:
-               sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser =
-                               TEL_SAT_LAUNCH_BROWSER_USE_EXISTING_BROWSER;
-       break;
-       case 0x03:
-               sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser =
-                               TEL_SAT_LAUNCH_BROWSER_CLOSE_AND_LAUNCH_NEW_BROWSER;
-       break;
-       case 0x04:
-               sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser =
-                               TEL_SAT_LAUNCH_BROWSER_NOT_USED2;
-       break;
-       default:
-               sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser =
-                               TEL_SAT_LAUNCH_BROWSER_RESERVED;
+       switch (cmd_data[temp_index]) {
+               case 0x00:
+                       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser.launch_browser =
+                                       LAUNCH_BROWSER_IF_NOT_ALREADY_LAUNCHED;
+                       break;
+               case 0x01:
+                       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser.launch_browser =
+                                       LAUNCH_BROWSER_NOT_USED;
+                       break;
+               case 0x02:
+                       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser.launch_browser =
+                                       LAUNCH_BROWSER_USE_EXISTING_BROWSER;
+                       break;
+               case 0x03:
+                       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser.launch_browser =
+                                       LAUNCH_BROWSER_CLOSE_AND_LAUNCH_NEW_BROWSER;
+                       break;
+               case 0x04:
+                       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser.launch_browser =
+                                       LAUNCH_BROWSER_NOT_USED2;
+                       break;
+               default:
+                       sat_cmd_ind_data->data.launch_browser.command_detail.cmd_qualifier.launch_browser.launch_browser =
+                                       LAUNCH_BROWSER_RESERVED;
+                       break;
        }
 
        //device identifier
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.language_notification.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
-       index += 4;
+       temp_index += 4;
 
        //Browser Identity TLV - Optional
-       if ((cmd_data[index] & 0x7F) == SATK_BROWSER_IDENTITY_TAG) {
-               rv = _sat_decode_browser_identity_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.launch_browser.browser_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding browser_identity failed");
+       if ((cmd_data[temp_index] & 0x7F) == SATK_BROWSER_IDENTITY_TAG) {
+               rv = _sat_decode_browser_identity_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.launch_browser.browser_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS)
                        return rv;
-               }
-               index += data_len_consumed;
+               temp_index += data_len_consumed;
        } else {
                dbg("[SAT] SAT PARSER - Browser ID NOT present");
        }
 
        //URL TLV - Mandatory
-       if ((cmd_data[index] & 0x7F) == SATK_URL_TAG) {
-               rv = _sat_decode_url_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.launch_browser.url, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding url failed");
+       if ((cmd_data[temp_index] & 0x7F) == SATK_URL_TAG) {
+               rv = _sat_decode_url_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.launch_browser.url, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS)
                        return rv;
-               }
 
-               if (index + data_len_consumed >= o_length) {
+               if (temp_index + data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER -  No more TLVs to decode, decoding done.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                } else {
                        dbg("[SAT] SAT PARSER -  more TLVs to decode, decoding continue.");
-                       index += data_len_consumed;
+                       temp_index += data_len_consumed;
                }
        } else {
                dbg("[SAT] SAT PARSER - Browser URL NOT present! BUG! this value is mandatory!!!");
-               return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+               return TCORE_SAT_REQUIRED_VALUE_MISSING;
        }
 
        //bearer - optional
-       if ((cmd_data[index] & 0x7F) == SATK_BEARER_TAG) {
-               rv = _sat_decode_bearer_tlv(o_cmd_data, o_length, index,        &sat_cmd_ind_data->data.launch_browser.bearer, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS)
+       if ((cmd_data[temp_index] & 0x7F) == SATK_BEARER_TAG) {
+               rv = _sat_decode_bearer_tlv(o_cmd_data, o_length, temp_index,   &sat_cmd_ind_data->data.launch_browser.bearer, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS)
                        return rv;
 
-               if (index + data_len_consumed >= o_length) {
+               if (temp_index + data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER -  No more TLVs to decode, decoding done.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                } else {
-                       index += data_len_consumed;
+                       temp_index += data_len_consumed;
                }
        } else {
-               err("[SAT] SAT PARSER -  Bearer TLV Not present.");
+               dbg("[SAT] SAT PARSER -  Bearer TLV Not present.");
        }
 
        //Provisioning reference file - optional
        sat_cmd_ind_data->data.launch_browser.file_ref_count = 0;
-       while ((cmd_data[index] & 0x7F) == SATK_PROVISIONING_REF_FILE_TAG) {
-               if (sat_cmd_ind_data->data.launch_browser.file_ref_count >= TEL_SAT_PROVISIONING_REF_MAX_COUNT) {
-                       err("[SAT] SAT PARSER -  More number of PRF entries than can be handled");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+       while ((cmd_data[temp_index] & 0x7F) == SATK_PROVISIONING_REF_FILE_TAG) {
+               if (sat_cmd_ind_data->data.launch_browser.file_ref_count >= SAT_PROVISIONING_REF_MAX_COUNT) {
+                       dbg("[SAT] SAT PARSER -  More number of PRF entries than can be handled");
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                }
 
                rv = _sat_decode_provisioning_file_ref_tlv(
                                                                o_cmd_data,
                                                                o_length,
-                                                               index,
+                                                               temp_index,
                                                                &sat_cmd_ind_data->data.launch_browser.file_list[sat_cmd_ind_data->data.launch_browser.file_ref_count],
                                                                &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding provisioning_file_ref failed");
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                } else {
                        sat_cmd_ind_data->data.launch_browser.file_ref_count++;
                }
 
-               if (index + data_len_consumed >= o_length) {
+               if (temp_index + data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER -  No more TLVs to decode, decoding done.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                } else {
-                       index += data_len_consumed;
+                       temp_index += data_len_consumed;
                }
        }
 
        //text string(gateway/proxy identity) - optional
-       if ((cmd_data[index] & 0x7F) == SATK_TEXT_STRING_TAG) {
-               rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.launch_browser.gateway_proxy_text, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding text failed");
+       if ((cmd_data[temp_index] & 0x7F) == SATK_TEXT_STRING_TAG) {
+               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.launch_browser.gateway_proxy_text, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS)
                        return rv;
-               }
 
-               if (index + data_len_consumed >= o_length) {
+               if (temp_index + data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER -  No more TLVs to decode, decoding done.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                } else {
-                       index += data_len_consumed;
+                       temp_index += data_len_consumed;
                }
        }
 
        //alpha identifier - optional
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.launch_browser.user_confirm_alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.launch_browser.user_confirm_alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               if (index + data_len_consumed >= o_length) {
+               if (temp_index + data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER -  No more TLVs to decode, decoding done.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        } else {
                dbg("[SAT] SAT PARSER -  No Alpha ID TLV.");
        }
 
        //icon identifier - optional
-       if ((cmd_data[index] & 0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if ((cmd_data[temp_index] & 0x7F) == SATK_ICON_IDENTIFIER_TAG) {
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index,
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index,
                                &sat_cmd_ind_data->data.launch_browser.user_confirm_icon_id, &data_len_consumed);
 
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
-                       return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+               if (rv != TCORE_SAT_SUCCESS) {
+                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
                }
 
-               if (index + data_len_consumed >= o_length) {
+               if (temp_index + data_len_consumed >= o_length) {
                        dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
+                       return TCORE_SAT_SUCCESS;
                }
-               index += data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index += data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //ToDo:  Text Attribute, Frame Identifier
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.27 OPEN CHANNEL
-static TelSatResult _sat_decode_open_channel(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_open_channel(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
-       gboolean is_first_duration = FALSE;
+       int temp_index = 0;
+       gboolean b_1st_duration = FALSE;
        int bearer_desc_len =0, data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.open_channel.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.open_channel.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.open_channel.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.open_channel.command_detail.cmd_type = cmd_data[temp_index++];
 
        /** command detail **/
        sat_cmd_ind_data->data.open_channel.command_detail.cmd_qualifier.open_channel.immediate_link = FALSE;
        sat_cmd_ind_data->data.open_channel.command_detail.cmd_qualifier.open_channel.automatic_reconnection = FALSE;
        sat_cmd_ind_data->data.open_channel.command_detail.cmd_qualifier.open_channel.background_mode = FALSE;
 
-       if (cmd_data[index]&0x01) {
+       if(cmd_data[temp_index]&0x01){
                sat_cmd_ind_data->data.open_channel.command_detail.cmd_qualifier.open_channel.immediate_link = TRUE;
                dbg("[SAT] SAT PARSER - Immediate Link Establishment");
        }
 
-       if (cmd_data[index]&0x02) {
+       if(cmd_data[temp_index]&0x02){
                sat_cmd_ind_data->data.open_channel.command_detail.cmd_qualifier.open_channel.automatic_reconnection = TRUE;
                dbg("[SAT] SAT PARSER - Auto Reconnection");
        }
 
-       if (cmd_data[index]&0x04) {
+       if(cmd_data[temp_index]&0x04){
                sat_cmd_ind_data->data.open_channel.command_detail.cmd_qualifier.open_channel.background_mode = TRUE;
                dbg("[SAT] SAT PARSER - Background mode");
        }
 
        //device identities
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.open_channel.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS){
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier - optional
-       index += 4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index += 4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //icon id - optional
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.icon_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.icon_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //bearer description
-       rv =_sat_decode_bearer_description_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_desc, &data_len_consumed);
+       rv =_sat_decode_bearer_description_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_desc, &data_len_consumed);
        bearer_desc_len = data_len_consumed;
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding bearer_description failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
        //TODO UICC SERVER MODE
 
-       switch(sat_cmd_ind_data->data.open_channel.bearer_desc.bearer_type) {
-       case TEL_SAT_BEARER_CSD:
-               //address
-               rv = _sat_decode_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.address, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding address failed");
-                       return rv;
-               }
-               index+=data_len_consumed;
+       switch(sat_cmd_ind_data->data.open_channel.bearer_desc.bearer_type){
+               case BEARER_CSD:
 
-               //sub address - optional
-               if ((cmd_data[index]&0x7F) == SATK_SUB_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_subaddress_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.subaddress, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding subaddress failed");
+                       //address
+                       rv = _sat_decode_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.address, &data_len_consumed);
+                       if(rv != TCORE_SAT_SUCCESS) {
                                return rv;
                        }
-                       index+=data_len_consumed;
-               }
-
-               //time duration 1- optional
-               if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_duration_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.duration1, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding duration failed");
-                               return rv; //SEND TR
+                       temp_index+=data_len_consumed;
+
+                       //sub address - optional
+                       if((cmd_data[temp_index]&0x7F) == SATK_SUB_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_subaddress_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.subaddress, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS) {
+                                       return rv;
+                               }
+                               temp_index+=data_len_consumed;
                        }
-                       index+=data_len_consumed;
-                       is_first_duration = TRUE;
-               }
-
-               //time duration 2- optional
-               if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
 
-                       if (!is_first_duration) {
-                               err("duration 1 does not present!");
-                               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+                       //time duration 1- optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_DURATION_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.duration1, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
+                               temp_index+=data_len_consumed;
+                               b_1st_duration = TRUE;
                        }
 
-                       data_len_consumed = 0;
-                       rv =_sat_decode_duration_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.duration2, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding duration failed");
-                               return rv; //SEND TR
-                       }
-                       index+=data_len_consumed;
-               }
+                       //time duration 2- optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_DURATION_TAG){
 
-               //bearer description - already did it
-               index+=bearer_desc_len;
+                               if(!b_1st_duration){
+                                       dbg("duration 1 does not present!");
+                                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+                               }
 
-               //buffer size
-               rv =_sat_decode_buffer_size_tlv(o_cmd_data, o_length, index, sat_cmd_ind_data->data.open_channel.buffer_size, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding buffer_size failed");
-                       return rv; //SEND TR
-               }
+                               data_len_consumed = 0;
+                               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.duration2, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
+                               temp_index+=data_len_consumed;
+                       }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
-                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
-               }
+                       //bearer description - already did it
+                       temp_index+=bearer_desc_len;
 
-               //other address - optional
-               if ((cmd_data[index]&0x7F)==SATK_OTHER_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.other_address, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding other_address failed");
+                       //buffer size
+                       rv =_sat_decode_buffer_size_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.buffer_size, &data_len_consumed);
+                       if(rv != TCORE_SAT_SUCCESS){
                                return rv; //SEND TR
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
+                       temp_index+=data_len_consumed;
+                       if(temp_index >= o_length){
                                dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                               return TCORE_SAT_SUCCESS;
                        }
-               }
 
-               //text string - user login - optional
-               if ((cmd_data[index]&0x7F)==SATK_TEXT_STRING_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.text_user_login, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding text failed");
-                               return rv;
-                       }
+                       //other address - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_OTHER_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.other_address, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
-               }
 
-               //text string - user password - optional
-               if ((cmd_data[index]&0x7F)==SATK_TEXT_STRING_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.text_user_pwd, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding text failed");
-                               return rv;
+                       //text string - user login - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_STRING_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.text_user_login, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                       //text string - user password - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_STRING_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.cs_bearer.text_user_pwd, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
-               }
 
-               //UICC/TERMINAL interface transport level - optional
-               if ((cmd_data[index]&0x7F)==SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_uicc_terminal_interface_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.interface_transport_level, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding uicc_terminal_interface failed");
-                               return rv;
+                       //UICC/TERMINAL interface transport level - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_uicc_terminal_interface_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.interface_transport_level, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                       //destination address - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_OTHER_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.data_destination_address, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
-               }
 
-               //destination address - optional
-               if ((cmd_data[index]&0x7F)==SATK_OTHER_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.data_destination_address, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding other_address failed");
+                       break;
+               case BEARER_GPRS:
+                       //bearer description - already did it
+                       temp_index+=bearer_desc_len;
+
+                       //buffer size
+                       rv =_sat_decode_buffer_size_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.buffer_size, &data_len_consumed);
+                       if(rv != TCORE_SAT_SUCCESS){
                                return rv; //SEND TR
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
+                       temp_index+=data_len_consumed;
+                       if(temp_index >= o_length){
                                dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                               return TCORE_SAT_SUCCESS;
                        }
-               }
-       break;
-       case TEL_SAT_BEARER_GPRS:
-               //bearer description - already did it
-               index+=bearer_desc_len;
 
-               //buffer size
-               rv =_sat_decode_buffer_size_tlv(o_cmd_data, o_length, index, sat_cmd_ind_data->data.open_channel.buffer_size, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding buffer_size failed");
-                       return rv; //SEND TR
-               }
+                       //Network Access Name - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_NETWORK_ACCESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_network_access_name_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.ps_bearer.network_access_name, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
-                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
-               }
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
+                       }
 
-               //Network Access Name - optional
-               if ((cmd_data[index]&0x7F)==SATK_NETWORK_ACCESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_network_access_name_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.ps_bearer.network_access_name, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding network_access_name failed");
-                               return rv; //SEND TR
+                       //other address - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_OTHER_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.ps_bearer.other_address, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                       //text string - user login - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_STRING_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.ps_bearer.text_user_login, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
-               }
 
-               //other address - optional
-               if ((cmd_data[index]&0x7F)==SATK_OTHER_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.ps_bearer.other_address, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding other_address failed");
-                               return rv; //SEND TR
+                       //text string - user password - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_STRING_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.ps_bearer.text_user_pwd, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                       //UICC/TERMINAL interface transport level - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_uicc_terminal_interface_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.interface_transport_level, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
-               }
 
-               //text string - user login - optional
-               if ((cmd_data[index]&0x7F)==SATK_TEXT_STRING_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.ps_bearer.text_user_login, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding text failed");
-                               return rv;
+                       dbg("the value (0x%x) after interface transport level", cmd_data[temp_index]&0x7F);
+
+                       //destination address - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_OTHER_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.data_destination_address, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
+                       }
+
+                       break;
+               case BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER:
+                       //bearer description - already did it
+                       temp_index+=bearer_desc_len;
+
+                       //buffer size
+                       rv =_sat_decode_buffer_size_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.buffer_size, &data_len_consumed);
+                       if(rv != TCORE_SAT_SUCCESS){
+                               return rv; //SEND TR
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
+                       temp_index+=data_len_consumed;
+                       if(temp_index >= o_length){
                                dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                               return TCORE_SAT_SUCCESS;
                        }
-               }
 
-               //text string - user password - optional
-               if ((cmd_data[index]&0x7F)==SATK_TEXT_STRING_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.ps_bearer.text_user_pwd, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding text failed");
-                               return rv;
+                       //other address - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_OTHER_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.default_bearer.other_address, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                       //text string - user login - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_STRING_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.default_bearer.text_user_login, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
-               }
 
-               //UICC/TERMINAL interface transport level - optional
-               if ((cmd_data[index]&0x7F)==SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_uicc_terminal_interface_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.interface_transport_level, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding uicc_terminal_interface failed");
-                               return rv;
+                       //text string - user password - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_STRING_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.default_bearer.text_user_pwd, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                       //UICC/TERMINAL interface transport level - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_uicc_terminal_interface_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.interface_transport_level, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
-               }
 
-               dbg("the value (0x%x) after interface transport level", cmd_data[index]&0x7F);
+                       //destination address - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_OTHER_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.data_destination_address, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
 
-               //destination address - optional
-               if ((cmd_data[index]&0x7F)==SATK_OTHER_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.data_destination_address, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding other_address failed");
-                               return rv; //SEND TR
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                       break;
+               case BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT:
+
+                       //time duration 1- optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_DURATION_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.local_bearer.duration1, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
+                               temp_index+=data_len_consumed;
+                               b_1st_duration = TRUE;
                        }
-               }
-       break;
-       case TEL_SAT_BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER:
-               //bearer description - already did it
-               index+=bearer_desc_len;
 
-               //buffer size
-               rv =_sat_decode_buffer_size_tlv(o_cmd_data, o_length, index, sat_cmd_ind_data->data.open_channel.buffer_size, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding buffer_size failed");
-                       return rv; //SEND TR
-               }
+                       //time duration 2- optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_DURATION_TAG){
 
-               index+=data_len_consumed;
-               if (index >= o_length) {
-                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
-               }
+                               if(!b_1st_duration){
+                                       dbg("duration 1 does not present!");
+                                       return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+                               }
+
+                               data_len_consumed = 0;
+                               rv =_sat_decode_duration_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.local_bearer.duration2, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
+                               temp_index+=data_len_consumed;
+                       }
 
-               //other address - optional
-               if ((cmd_data[index]&0x7F)==SATK_OTHER_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.default_bearer.other_address, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding other_address failed");
+                       //bearer description - already did it
+                       temp_index+=bearer_desc_len;
+
+                       //buffer size
+                       rv =_sat_decode_buffer_size_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.buffer_size, &data_len_consumed);
+                       if(rv != TCORE_SAT_SUCCESS){
                                return rv; //SEND TR
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
+                       temp_index+=data_len_consumed;
+                       if(temp_index >= o_length){
                                dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
+                               return TCORE_SAT_SUCCESS;
                        }
-               }
 
-               //text string - user login - optional
-               if ((cmd_data[index]&0x7F)==SATK_TEXT_STRING_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.default_bearer.text_user_login, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding text failed");
-                               return rv;
+                       //text string - user password - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_TEXT_STRING_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_text_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.local_bearer.text_user_pwd, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
-                       }
-               }
-
-               //text string - user password - optional
-               if ((cmd_data[index]&0x7F)==SATK_TEXT_STRING_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.default_bearer.text_user_pwd, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding text failed");
-                               return rv;
-                       }
-
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
-                       }
-               }
-
-               //UICC/TERMINAL interface transport level - optional
-               if ((cmd_data[index]&0x7F)==SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_uicc_terminal_interface_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.interface_transport_level, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding uicc_terminal_interface failed");
-                               return rv;
-                       }
-
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
-                       }
-               }
-
-               //destination address - optional
-               if ((cmd_data[index]&0x7F)==SATK_OTHER_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.data_destination_address, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding other_address failed");
-                               return rv; //SEND TR
-                       }
-
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
-                       }
-               }
-       break;
-       case TEL_SAT_BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT:
-               //time duration 1- optional
-               if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_duration_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.local_bearer.duration1, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding duration failed");
-                               return rv; //SEND TR
-                       }
-                       index+=data_len_consumed;
-                       is_first_duration = TRUE;
-               }
-
-               //time duration 2- optional
-               if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
-
-                       if (!is_first_duration) {
-                               dbg("duration 1 does not present!");
-                               return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
-                       }
-
-                       data_len_consumed = 0;
-                       rv =_sat_decode_duration_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.local_bearer.duration2, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding duration failed");
-                               return rv; //SEND TR
-                       }
-                       index+=data_len_consumed;
-               }
-
-               //bearer description - already did it
-               index+=bearer_desc_len;
-
-               //buffer size
-               rv =_sat_decode_buffer_size_tlv(o_cmd_data, o_length, index, sat_cmd_ind_data->data.open_channel.buffer_size, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding buffer_size failed");
-                       return rv; //SEND TR
-               }
-
-               index+=data_len_consumed;
-               if (index >= o_length) {
-                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                       return TEL_SAT_RESULT_SUCCESS;
-               }
-
-               //text string - user password - optional
-               if ((cmd_data[index]&0x7F)==SATK_TEXT_STRING_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_text_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.local_bearer.text_user_pwd, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding text failed");
-                               return rv;
-                       }
-
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
-                       }
-               }
-
-               //UICC/TERMINAL interface transport level - optional
-               if ((cmd_data[index]&0x7F)==SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG) {
-                       data_len_consumed = 0;
-                       rv = _sat_decode_uicc_terminal_interface_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.interface_transport_level, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding uicc_terminal_interface failed");
-                               return rv;
+                       //UICC/TERMINAL interface transport level - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_USIM_ME_INTERFACE_TRANSPORT_LEVEL_TAG){
+                               data_len_consumed = 0;
+                               rv = _sat_decode_uicc_terminal_interface_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.interface_transport_level, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS)
+                                       return rv;
+
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
-                       }
-               }
+                       //destination address - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_OTHER_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.data_destination_address, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
 
-               //destination address - optional
-               if ((cmd_data[index]&0x7F)==SATK_OTHER_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_other_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.data_destination_address, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding other_address failed");
-                               return rv; //SEND TR
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
-                       }
-               }
+                       //remote entity address - optional
+                       if((cmd_data[temp_index]&0x7F)==SATK_REMOTE_ENTITY_ADDRESS_TAG){
+                               data_len_consumed = 0;
+                               rv =_sat_decode_remote_entity_address_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.open_channel.bearer_detail.local_bearer.remote_entity_address, &data_len_consumed);
+                               if(rv != TCORE_SAT_SUCCESS){
+                                       return rv; //SEND TR
+                               }
 
-               //remote entity address - optional
-               if ((cmd_data[index]&0x7F)==SATK_REMOTE_ENTITY_ADDRESS_TAG) {
-                       data_len_consumed = 0;
-                       rv =_sat_decode_remote_entity_address_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.open_channel.bearer_detail.local_bearer.remote_entity_address, &data_len_consumed);
-                       if (rv != TEL_SAT_RESULT_SUCCESS) {
-                               err("[SAT] SAT PARSER - decoding remote_entity_address failed");
-                               return rv; //SEND TR
+                               temp_index+=data_len_consumed;
+                               if(temp_index >= o_length){
+                                       dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+                                       return TCORE_SAT_SUCCESS;
+                               }
                        }
 
-                       index+=data_len_consumed;
-                       if (index >= o_length) {
-                               dbg("[SAT] SAT PARSER - no more TLVs to decode.");
-                               return TEL_SAT_RESULT_SUCCESS;
-                       }
-               }
-       break;
-       default:
-               err("invalid bearer type", sat_cmd_ind_data->data.open_channel.bearer_desc.bearer_type);
+                       break;
+               default:
+                       break;
        }//end of switch
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.28 CLOSE CHANNEL
-static TelSatResult _sat_decode_close_channel(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_close_channel(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.close_channel.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.close_channel.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.close_channel.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.close_channel.command_detail.cmd_type = cmd_data[temp_index++];
 
        /** command detail **/
-       index++; //RFU
+       temp_index++; //RFU
 
        //device identities
-       memcpy(dev_id,&cmd_data[index],4);
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.close_channel.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier - optional
-       index += 4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.close_channel.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index += 4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.close_channel.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //icon id - optional
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.close_channel.icon_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.close_channel.icon_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //ToDo:  Text Attribute and frames
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.29 RECEIVE DATA
-static TelSatResult _sat_decode_receive_data(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_receive_data(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.receive_data.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.receive_data.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.receive_data.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.receive_data.command_detail.cmd_type = cmd_data[temp_index++];
 
        /** command detail **/
-       index++; //RFU
+       temp_index++; //RFU
 
        //device identities
-       memcpy(dev_id,&cmd_data[index],4);
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.receive_data.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier - optional
-       index += 4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.receive_data.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index += 4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.receive_data.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //icon id - optional
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.receive_data.icon_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.receive_data.icon_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //channel data length
-       rv =_sat_decode_channel_data_length_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.receive_data.channel_data_len, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding channel_data_length failed");
+       rv =_sat_decode_channel_data_length_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.receive_data.channel_data_len, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS){
                return rv; //SEND TR
        }
 
        //ToDo:  Text Attribute and frames
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.30 SEND DATA
-static TelSatResult _sat_decode_send_data(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_send_data(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        int data_len_consumed=0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.send_data.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.send_data.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.send_data.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.send_data.command_detail.cmd_type = cmd_data[temp_index++];
 
        /** command detail **/
-       sat_cmd_ind_data->data.send_data.command_detail.cmd_qualifier.cmd_quali_send_data = FALSE;
-       if (cmd_data[index]&0x01) {
-               sat_cmd_ind_data->data.send_data.command_detail.cmd_qualifier.cmd_quali_send_data = TRUE;
+       sat_cmd_ind_data->data.send_data.command_detail.cmd_qualifier.send_data.send_data_immediately = FALSE;
+       if(cmd_data[temp_index]&0x01){
+               sat_cmd_ind_data->data.send_data.command_detail.cmd_qualifier.send_data.send_data_immediately = TRUE;
                dbg("[SAT] SAT PARSER - Send data immediately");
        }
 
        //device identities
-       index++;
-       memcpy(dev_id,&cmd_data[index],4);
+       temp_index++;
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_data.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device_identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
-       }
 
        //alpha identifier - optional
-       index += 4;
-       if ((cmd_data[index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG) {
-               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_data.alpha_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding alpha_identifier failed");
+       temp_index += 4;
+       if((cmd_data[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_data.alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
                        return rv;
                }
-               index+=data_len_consumed;
+               temp_index+=data_len_consumed;
        }
 
        //icon id - optional
-       if ((cmd_data[index]&0x7F) == SATK_ICON_IDENTIFIER_TAG) {
+       if((cmd_data[temp_index]&0x7F) == SATK_ICON_IDENTIFIER_TAG){
                data_len_consumed = 0;
-               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_data.icon_id, &data_len_consumed);
-               if (rv != TEL_SAT_RESULT_SUCCESS) {
-                       err("[SAT] SAT PARSER - decoding icon_identifier failed");
+               rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_data.icon_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
                        return rv; //SEND TR
                }
-               index+=data_len_consumed; //index pointing to the Tag of next TLV
+               temp_index+=data_len_consumed; //temp_index pointing to the Tag of next TLV
        }
 
        //channel data
-       rv =_sat_decode_channel_data_tlv(o_cmd_data, o_length, index, &sat_cmd_ind_data->data.send_data.channel_data, &data_len_consumed);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding channel_data failed");
+       rv =_sat_decode_channel_data_tlv(o_cmd_data, o_length, temp_index, &sat_cmd_ind_data->data.send_data.channel_data, &data_len_consumed);
+       if(rv != TCORE_SAT_SUCCESS){
                return rv; //SEND TR
        }
 
        //ToDo:  Text Attribute and frames
 
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
 //6.4.31 GET CHANNEL STATUS
-static TelSatResult _sat_decode_get_channel_status(unsigned char* o_cmd_data, int o_length,
-               int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
+static enum tcore_sat_result _sat_decode_get_channel_status(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
 {
-       int index = 0;
+       int temp_index = 0;
        unsigned char dev_id[4];
        unsigned char* cmd_data = NULL;
-       TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
+       }
 
        cmd_data = &o_cmd_data[0];
-       index = curr_offset+2;
-       sat_cmd_ind_data->data.get_channel_status.command_detail.cmd_num = cmd_data[index++];
-       sat_cmd_ind_data->data.get_channel_status.command_detail.cmd_type = cmd_data[index++];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.get_channel_status.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.get_channel_status.command_detail.cmd_type = cmd_data[temp_index++];
 
        /** command detail **/
-       index++; //RFU
+       temp_index++; //RFU
 
        //device identities
-       memcpy(dev_id,&cmd_data[index],4);
+       memcpy(dev_id,&cmd_data[temp_index],4);
        rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.get_channel_status.device_id);
-       if (rv != TEL_SAT_RESULT_SUCCESS) {
-               err("[SAT] SAT PARSER - decoding device identities failed");
+       if(rv != TCORE_SAT_SUCCESS)
                return rv;
+
+       dbg("[SAT] SAT PARSER - :decoding done!.");
+       return TCORE_SAT_SUCCESS;
+}
+
+//6.4.XX Unsupported Command
+static enum tcore_sat_result _sat_decode_unsupported_command(unsigned char* o_cmd_data, int o_length,
+               int curr_offset, struct tcore_sat_proactive_command *sat_cmd_ind_data)
+{
+       int temp_index = 0;
+       unsigned char dev_id[4];
+       unsigned char* cmd_data = NULL;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+
+       if(o_cmd_data == NULL){
+               dbg("[SAT] SAT PARSER -  o_cmd_data == NULL");
+               return TCORE_SAT_ERROR_FATAL;
        }
 
+       cmd_data = &o_cmd_data[0];
+       temp_index = curr_offset+2;
+       sat_cmd_ind_data->data.unsupport_cmd.command_detail.cmd_num = cmd_data[temp_index++];
+       sat_cmd_ind_data->data.unsupport_cmd.command_detail.cmd_type = cmd_data[temp_index++];
+
+       /** command detail **/
+       temp_index++; //RFU
+
+       //device identities
+       memcpy(dev_id,&cmd_data[temp_index],4);
+       rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.unsupport_cmd.device_id);
+       if(rv != TCORE_SAT_SUCCESS)
+               return rv;
+
        dbg("[SAT] SAT PARSER - :decoding done!.");
-       return TEL_SAT_RESULT_SUCCESS;
+       return TCORE_SAT_SUCCESS;
 }
 
-gboolean tcore_sat_decode_proactive_command(unsigned char* tlv_origin, unsigned int tlv_length,
-               TelSatDecodedProactiveData* decoded_tlv, int* decode_err_code)
+int tcore_sat_decode_proactive_command(unsigned char* tlv_origin, unsigned int tlv_length,
+               struct tcore_sat_proactive_command* decoded_tlv)
 {
-       unsigned int index = 0;
+       unsigned int temp_index = 0;
        int length_field_len = 0;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
 
-       if (tlv_origin == NULL || tlv_length <=2) {
-               err("[SAT] SAT PARSER - pointer pData passed is NULL or invalid length.");
-               *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
-               return FALSE;
+       if(tlv_origin == NULL || tlv_length <=2) {
+               dbg("[SAT] SAT PARSER - pointer pData passed is NULL or invalid length.");
+               return TCORE_SAT_ERROR_FATAL;
        }
-       tcore_check_return_value_assert(decoded_tlv != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
 
        //tag
-       if (tlv_origin[index++]!= SATK_PROACTIVE_CMD_TAG) {
-               err("[SAT] SAT PARSER - Did not find Proactive command tag.tag=%d", tlv_origin[index-1]);
-               *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
-               return FALSE;
+       if(tlv_origin[temp_index++]!= SATK_PROACTIVE_CMD_TAG) {
+               dbg("[SAT] SAT PARSER - Did not find Proactive command tag.tag=%d", tlv_origin[temp_index-1]);
+               return TCORE_SAT_ERROR_FATAL;
        }
 
        //length
-       length_field_len = _get_length_filed_size(tlv_origin[index]);
-       if (length_field_len == 0) {
-               err("[SAT] SAT PARSER - Invalid length.");
-               *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
-               return FALSE;
+       length_field_len = _get_length_filed_size(tlv_origin[temp_index]);
+       if(length_field_len == 0) {
+               dbg("[SAT] SAT PARSER - Invalid length.");
+               return TCORE_SAT_ERROR_FATAL;
        }
-
-       index+=length_field_len;
+       //length
+       dbg("[SAT] SAT PARSER - tlv_length=%d", tlv_length);
+       temp_index+=length_field_len;
 
        //check command validation
-       if (tlv_length < index+5+4) {//command detail(5) and device identities(4)
-               err("[SAT] SAT PARSER - Invalid length.");
-               *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
-               return FALSE;
-       }
+       if(tlv_length < temp_index+5+4)//command detail(5) and device identities(4)
+               return TCORE_SAT_ERROR_FATAL;
 
        //check comprehensive value
-       if ((tlv_origin[index] | 0x7F) != 0x7F) {
-               dbg("comprehensive value 0x%x", tlv_origin[index] | 0x7F);
-               is_comprehensive = TRUE;
+       if((tlv_origin[temp_index] | 0x7F) != 0x7F){
+               dbg("comprehensive value 0x%x", tlv_origin[temp_index] | 0x7F);
+               b_comprehensive = TRUE;
        }
 
-       if ( (tlv_origin[index] & 0x7F) != SATK_COMMAND_DETAILS_TAG) {
+       if( (tlv_origin[temp_index] & 0x7F) != SATK_COMMAND_DETAILS_TAG){
                err("[SAT] no command detail info");
-               *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
-               return FALSE;
+               return TCORE_SAT_ERROR_FATAL;
        }
 
-       if ( tlv_origin[index+1] != SATK_COMMAND_DETAILS_LENGTH) {
+       if( tlv_origin[temp_index+1] != SATK_COMMAND_DETAILS_LENGTH){
                err("[SAT] invalid command detail length");
-               *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
-               return FALSE;
+               return TCORE_SAT_ERROR_FATAL;
        }
 
-       decoded_tlv->cmd_num= tlv_origin[index+2];
-       decoded_tlv->cmd_type = tlv_origin[index+3];
+       decoded_tlv->cmd_num= tlv_origin[temp_index+2];
+       decoded_tlv->cmd_type = tlv_origin[temp_index+3];
 
        switch(decoded_tlv->cmd_type) {
-       case TEL_SAT_PROATV_CMD_DISPLAY_TEXT: //6.4.1
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_DISPLAY_TEXT");
-               *decode_err_code = _sat_decode_display_text(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_GET_INKEY: //6.4.2
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_GET_INKEY");
-               *decode_err_code = _sat_decode_get_inkey(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_GET_INPUT: //6.4.3
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_GET_INPUT");
-               *decode_err_code = _sat_decode_get_input(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_MORE_TIME: //6.4.4
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_MORE_TIME");
-               *decode_err_code = _sat_decode_more_time(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_PLAY_TONE: //6.4.5
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_PLAY TONE");
-               *decode_err_code = _sat_decode_play_tone(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       //case POLL INTERVAL //6.4.6 processing by cp
-       case TEL_SAT_PROATV_CMD_REFRESH: //6.4.7
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_REFRESH");
-               *decode_err_code = _sat_decode_refresh(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_MENU: //6.4.8
-               dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_SETUP_MENU");
-               *decode_err_code = _sat_decode_setup_menu(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SELECT_ITEM: //6.4.9
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SELECT_ITEM");
-               *decode_err_code = _sat_decode_select_item(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_SMS: //6.4.10
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SEND_SMS");
-               *decode_err_code = _sat_decode_send_sms(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_SS: //6.4.11
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SEND_SS");
-               *decode_err_code = _sat_decode_send_ss(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_USSD: //6.4.12
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SEND_USSD");
-               *decode_err_code = _sat_decode_send_ussd(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_CALL: //6.4.13
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SETUP_CALL");
-               *decode_err_code = _sat_decode_setup_call(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_PROVIDE_LOCAL_INFO: //6.4.15
-               dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_PROVIDE_LOCAL_INFO");
-               *decode_err_code = _sat_decode_provide_local_info(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_EVENT_LIST: //6.4.16
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SETUP_EVENT_LIST");
-               *decode_err_code = _sat_decode_setup_event_list(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT: //6.4.22
-               dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT");
-               *decode_err_code = _sat_decode_setup_idle_mode_text(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_DTMF: //6.4.24
-               dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_SEND_DTMF");
-               *decode_err_code = _sat_decode_send_dtmf(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_LANGUAGE_NOTIFICATION: //6.4.25
-               dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_LANGUAGE_NOTIFICATION");
-               *decode_err_code = _sat_decode_language_notification(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_LAUNCH_BROWSER: //6.4.26
-               dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_LAUNCH_BROWSER");
-               *decode_err_code = _sat_decode_launch_browser(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_OPEN_CHANNEL://6.4.27
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_OPEN_CHANNEL");
-               *decode_err_code = _sat_decode_open_channel(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_CLOSE_CHANNEL://6.4.28
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_CLOSE_CHANNEL");
-               *decode_err_code = _sat_decode_close_channel(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_RECEIVE_DATA://6.4.29
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_RECEIVE_DATA");
-               *decode_err_code = _sat_decode_receive_data(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_DATA://6.4.30
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SEND_DATA");
-               *decode_err_code = _sat_decode_send_data(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       case TEL_SAT_PROATV_CMD_GET_CHANNEL_STATUS://6.4.31
-               dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_GET_CHANNEL_STATUS");
-               *decode_err_code = _sat_decode_get_channel_status(tlv_origin, tlv_length, index, decoded_tlv);
-       break;
-       default:
-               err("[SAT] SAT PARSER - ME cannot perform this command =0x[%02x]", decoded_tlv->cmd_type);
-               //SEND TR with command not understood by ME, those command that are defined but not implemented by ME should be sent as beyond me's capability.
-               *decode_err_code = TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
-               return FALSE;
-       }
-
-       //return value will be success if the proactive command has been successfuly decoded, then send it to clients.
+               case SAT_PROATV_CMD_DISPLAY_TEXT: //6.4.1
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_DISPLAY_TEXT");
+                       rv = _sat_decode_display_text(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_GET_INKEY: //6.4.2
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_GET_INKEY");
+                       rv = _sat_decode_get_inkey(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_GET_INPUT: //6.4.3
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_GET_INPUT");
+                       rv = _sat_decode_get_input(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_MORE_TIME: //6.4.4
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_MORE_TIME");
+                       rv = _sat_decode_more_time(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_PLAY_TONE: //6.4.5
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_PLAY TONE");
+                       rv = _sat_decode_play_tone(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               //case POLL INTERVAL //6.4.6 processing by cp
+               case SAT_PROATV_CMD_REFRESH: //6.4.7
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_REFRESH");
+                       rv = _sat_decode_refresh(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SETUP_MENU: //6.4.8
+                       dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_SETUP_MENU");
+                       rv = _sat_decode_setup_menu(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SELECT_ITEM: //6.4.9
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SELECT_ITEM");
+                       rv = _sat_decode_select_item(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SEND_SMS: //6.4.10
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SEND_SMS");
+                       rv = _sat_decode_send_sms(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SEND_SS: //6.4.11
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SEND_SS");
+                       rv = _sat_decode_send_ss(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SEND_USSD: //6.4.12
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SEND_USSD");
+                       rv = _sat_decode_send_ussd(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SETUP_CALL: //6.4.13
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SETUP_CALL");
+                       rv = _sat_decode_setup_call(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_PROVIDE_LOCAL_INFO: //6.4.15
+                       dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_PROVIDE_LOCAL_INFO");
+                       rv = _sat_decode_provide_local_info(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SETUP_EVENT_LIST: //6.4.16
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SETUP_EVENT_LIST");
+                       rv = _sat_decode_setup_event_list(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT: //6.4.22
+                       dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT");
+                       rv = _sat_decode_setup_idle_mode_text(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SEND_DTMF: //6.4.24
+                       dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_SEND_DTMF");
+                       rv = _sat_decode_send_dtmf(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_LANGUAGE_NOTIFICATION: //6.4.25
+                       dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_LANGUAGE_NOTIFICATION");
+                       rv = _sat_decode_language_notification(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_LAUNCH_BROWSER: //6.4.26
+                       dbg("[SAT] SAT PARSER - SAT_PROATV_CMD_LAUNCH_BROWSER");
+                       rv = _sat_decode_launch_browser(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_OPEN_CHANNEL://6.4.27
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_OPEN_CHANNEL");
+                       rv = _sat_decode_open_channel(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_CLOSE_CHANNEL://6.4.28
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_CLOSE_CHANNEL");
+                       rv = _sat_decode_close_channel(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_RECEIVE_DATA://6.4.29
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_RECEIVE_DATA");
+                       rv = _sat_decode_receive_data(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_SEND_DATA://6.4.30
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_SEND_DATA");
+                       rv = _sat_decode_send_data(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               case SAT_PROATV_CMD_GET_CHANNEL_STATUS://6.4.31
+                       dbg("[SAT] SAT PARSER - SAT_CMD_TYPE_GET_CHANNEL_STATUS");
+                       rv = _sat_decode_get_channel_status(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+               default:
+                       dbg("[SAT] SAT PARSER - ME cannot perform this command =0x[%02x]", decoded_tlv->cmd_type);
+                       rv = _sat_decode_unsupported_command(tlv_origin, tlv_length, temp_index, decoded_tlv);
+                       break;
+       }
+
        dbg("[SAT] SAT PARSER - each command parsing done.");
-       return TRUE;
+       return rv;
+}
+
+int tcore_sat_decode_call_control_result(unsigned char* tlv_origin, unsigned int tlv_length, struct tnoti_sat_call_control_result_ind* call_ctrl_result_tlv)
+{
+       unsigned int temp_index = 0;
+       int length = 0, data_len = 0, data_len_consumed = 0;
+       enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+
+       if(tlv_origin == NULL || tlv_length <=2) {
+               dbg("[SAT] SAT PARSER - pointer pData passed is NULL or invalid length.");
+               return TCORE_SAT_ERROR_FATAL;
+       }
+
+       //call conrol result
+       call_ctrl_result_tlv->cc_result = tlv_origin[temp_index++];
+       length = _get_length_filed_size(tlv_origin[temp_index]);
+       if(length == 0){
+               dbg("[SAT] fail to get the call control result length");
+               return TCORE_SAT_ERROR_FATAL;
+       }
+       temp_index = temp_index+length-1;
+       data_len = tlv_origin[temp_index];
+       dbg("[SAT] call control result (%d), data len(%d)",call_ctrl_result_tlv->cc_result, data_len);
+       if(data_len == 0){
+               dbg("no more call control result - decoding done");
+               return rv;
+       }
+       temp_index++;
+
+       //address - optional (voice call)
+       if((tlv_origin[temp_index]&0x7F) == SATK_ADDRESS_TAG){
+               rv = _sat_decode_address_tlv(tlv_origin, tlv_length, temp_index, &call_ctrl_result_tlv->address, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
+                       return rv;
+               }
+               temp_index+=data_len_consumed;
+
+               if(temp_index >= tlv_length){
+                       dbg("[SAT] call control decoding done");
+                       return TCORE_SAT_SUCCESS;
+               }
+       }
+
+       //ss string - optional (ss)
+       if((tlv_origin[temp_index]&0x7F) == SATK_SS_STRING_TAG){
+               rv = _sat_decode_ss_string_tlv(tlv_origin, tlv_length, temp_index, &call_ctrl_result_tlv->ss_string, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
+                       return rv;
+               }
+               temp_index+=data_len_consumed;
+
+               if(temp_index >= tlv_length){
+                       dbg("[SAT] call control decoding done");
+                       return TCORE_SAT_SUCCESS;
+               }
+       }
+
+       //ccp1 - optional
+       if((tlv_origin[temp_index]&0x7F)==SATK_CAPABILITY_CONFIGURATION_PARAMETERS_TAG){
+               rv =_sat_decode_ccp_tlv(tlv_origin, tlv_length, temp_index, &call_ctrl_result_tlv->ccp1, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
+               }
+               temp_index+=data_len_consumed;
+
+               if(temp_index >= tlv_length){
+                       dbg("[SAT] call control decoding done");
+                       return TCORE_SAT_SUCCESS;
+               }
+       }
+
+       //sub address
+       if((tlv_origin[temp_index]&0x7F) == SATK_SUB_ADDRESS_TAG){
+               rv = _sat_decode_sub_address_tlv(tlv_origin, tlv_length, temp_index, &call_ctrl_result_tlv->sub_address, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
+                       return rv;
+               }
+               temp_index+=data_len_consumed;
+
+               if(temp_index >= tlv_length){
+                       dbg("[SAT] call control decoding done");
+                       return TCORE_SAT_SUCCESS;
+               }
+       }
+
+       //alpha id
+       if((tlv_origin[temp_index]&0x7F) == SATK_ALPHA_IDENTIFIER_TAG){
+               rv = _sat_decode_alpha_identifier_tlv(tlv_origin, tlv_length, temp_index, &call_ctrl_result_tlv->alpha_id, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS) {
+                       return rv;
+               }
+               temp_index+=data_len_consumed;
+
+               if(temp_index >= tlv_length){
+                       dbg("[SAT] call control decoding done");
+                       return TCORE_SAT_SUCCESS;
+               }
+       }
+
+       //bc repeated indicator
+       if((tlv_origin[temp_index]&0x7F) == SATK_BC_REPEAT_INDICATOR_TAG){
+               int tag = 0;
+               int bc_repeat_ind_len = 0;
+
+               tag = tlv_origin[temp_index++];
+               bc_repeat_ind_len = tlv_origin[temp_index++];
+               call_ctrl_result_tlv->bc_repeat_type.bc_indi_repeat_type = tlv_origin[temp_index++];
+
+               dbg("bc repeated indication tag(%x) len(%x) type(%x)", tag, bc_repeat_ind_len, call_ctrl_result_tlv->bc_repeat_type.bc_indi_repeat_type);
+               if(temp_index >= tlv_length){
+                       dbg("[SAT] call control decoding done");
+                       return TCORE_SAT_SUCCESS;
+               }
+       }
+
+       //ccp2
+       if((tlv_origin[temp_index]&0x7F)==SATK_CAPABILITY_CONFIGURATION_PARAMETERS_TAG){
+               rv =_sat_decode_ccp_tlv(tlv_origin, tlv_length, temp_index, &call_ctrl_result_tlv->ccp2, &data_len_consumed);
+               if(rv != TCORE_SAT_SUCCESS){
+                       return rv; //SEND TR
+               }
+               temp_index+=data_len_consumed;
+
+               if(temp_index >= tlv_length){
+                       dbg("[SAT] call control decoding done");
+                       return TCORE_SAT_SUCCESS;
+               }
+       }
+
+       return rv;
 }
 
-static unsigned char _sat_encode_dcs_tlv(const TelSatDataCodingSchemeInfo* src)
+static unsigned char _sat_encode_dcs_tlv(const struct data_coding_scheme* src)
 {
        unsigned char rv = 0x00;
 
-       tcore_check_return_value_assert(src != NULL, 0);
+       if(src == NULL)
+               return 0;
 
-       if (src->is_compressed_format)
+       if(src->is_compressed_format)
                rv |= 0x20;
 
        //msg class
-       switch(src->m_class) {
-       case TEL_SAT_MSG_CLASS_0:
-       case TEL_SAT_MSG_CLASS_1:
-       case TEL_SAT_MSG_CLASS_2:
-       case TEL_SAT_MSG_CLASS_3:
-               rv |= 0x10;
-               rv |= src->m_class;
-       break;
-       case TEL_SAT_MSG_CLASS_RESERVED:
-       case TEL_SAT_MSG_CLASS_NONE:
-       default:
-               rv &= 0xEF;
+       switch(src->m_class){
+               case MSG_CLASS_0:
+               case MSG_CLASS_1:
+               case MSG_CLASS_2:
+               case MSG_CLASS_3:
+                       rv |= 0x10;
+                       rv |= src->m_class;
+               break;
+
+               case MSG_CLASS_RESERVED:
+               case MSG_CLASS_NONE:
+               default:
+                       rv &= 0xEF;
+                       break;
        }
 
        //alphabet format
-       switch(src->a_format) {
-       case TEL_SAT_ALPHABET_FORMAT_SMS_DEFAULT:
-               rv &= 0xF3;
-       break;
-       case TEL_SAT_ALPHABET_FORMAT_8BIT_DATA:
-               rv |= 0x04;
-       break;
-       case TEL_SAT_ALPHABET_FORMAT_UCS2:
-               rv |= 0x08;
-       break;
-       default:
-               rv |= 0x0C;
+       switch(src->a_format)
+       {
+               case ALPHABET_FORMAT_SMS_DEFAULT:
+                       rv &= 0xF3;
+                       break;
+
+               case ALPHABET_FORMAT_8BIT_DATA:
+                       rv |= 0x04;
+                       break;
+
+               case ALPHABET_FORMAT_UCS2:
+                       rv |= 0x08;
+                       break;
+
+               default:
+                       rv |= 0x0C;
+                       break;
        }
 
        return rv;
 }
 
-static int _sat_encode_command_detail_tlv(const TelSatCmdDetailInfo* src, char *dst, int current_index)
+static int _sat_encode_command_detail_tlv(const struct tel_sat_cmd_detail_info* src, char *dst, int current_temp_index)
 {
-       dst[current_index++] = (is_comprehensive ? (SATK_COMMAND_DETAILS_TAG | 0x80) : SATK_COMMAND_DETAILS_TAG);
-       dst[current_index++] = SATK_COMMAND_DETAILS_LENGTH;
-       dst[current_index++] = src->cmd_num;
-       dst[current_index++] = src->cmd_type;
-       dst[current_index] = 0x00;
-
-       switch(src->cmd_type) {
-       case TEL_SAT_PROATV_CMD_DISPLAY_TEXT:
-               //command detail text priority
-               if (src->cmd_qualifier.display_text.text_priority == TEL_SAT_TEXT_PRIORITY_HIGH)
-                       dst[current_index] += 0x01;
-
-               //command detail text clear type
-               if (src->cmd_qualifier.display_text.text_clear_type == TEL_SAT_TEXT_WAIT_FOR_USER_TO_CLEAR_MSG)
-                       dst[current_index] += 0x80;
-       break;
-       case TEL_SAT_PROATV_CMD_GET_INKEY:
-               //command detail alphabet set
-               if (src->cmd_qualifier.get_inkey.alphabet_set)
-                       dst[current_index] += 0x01;
-
-               //command detail alphabet type
-               if (src->cmd_qualifier.get_inkey.alphabet_type == TEL_SAT_INPUT_ALPHABET_TYPE_UCS2)
-                       dst[current_index] += 0x02;
-
-               //command detail get inkey type
-               if (src->cmd_qualifier.get_inkey.inkey_type == TEL_SAT_INKEY_TYPE_YES_NO_REQUESTED)
-                       dst[current_index] += 0x04;
-
-
-               //command detail immediate response required
-               if (src->cmd_qualifier.get_inkey.immediate_rsp_required)
-                       dst[current_index] += 0x08;
-
-               //command detail help available
-               if (src->cmd_qualifier.get_inkey.help_info)
-                       dst[current_index] += 0x80;
-       break;
-       case TEL_SAT_PROATV_CMD_GET_INPUT:
-               //command detail alphabet set
-               if (src->cmd_qualifier.get_input.alphabet_set)
-                       dst[current_index] += 0x01;
-
-               //command detail alphabet type
-               if (src->cmd_qualifier.get_input.alphabet_type == TEL_SAT_INPUT_ALPHABET_TYPE_UCS2)
-                       dst[current_index] += 0x02;
-
-               //command detail echo user input
-               if (!src->cmd_qualifier.get_input.me_echo_user_input)
-                       dst[current_index] += 0x04;
-
-               //command detail user input unpacked format
-               if (!src->cmd_qualifier.get_input.user_input_unpacked_format)
-                       dst[current_index] += 0x08;
-
-               //command detail help available
-               if (src->cmd_qualifier.get_input.help_info)
-                       dst[current_index] += 0x80;
-       break;
-       case TEL_SAT_PROATV_CMD_MORE_TIME:
-               dbg("more time : 1bit RFU");
-       break;
-       case TEL_SAT_PROATV_CMD_PLAY_TONE:
-               //command detail vibration alert
-               if (src->cmd_qualifier.play_tone == TEL_SAT_VIBRATE_ALERT_REQUIRED)
-                       dst[current_index] += 0x01;
-       break;
-       case TEL_SAT_PROATV_CMD_REFRESH:
-               //command detail refresh command
-               dst[current_index] += src->cmd_qualifier.refresh;
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_MENU:
-               //command detail preferences
-               if (src->cmd_qualifier.setup_menu.select_preference == TEL_SAT_SELECTION_PREFERENCE_USING_SOFT_KEY)
-                       dst[current_index] += 0x01;
-
-               //command detail help available
-               if (src->cmd_qualifier.setup_menu.help_info)
-                       dst[current_index] += 0x80;
-       break;
-       case TEL_SAT_PROATV_CMD_SELECT_ITEM:
-               //command detail presentation
-               if (src->cmd_qualifier.select_item.presentation_type != TEL_SAT_PRESENTATION_TYPE_NOT_SPECIFIED) {
-                       dst[current_index] += 0x01;
-                       if (src->cmd_qualifier.select_item.presentation_type == TEL_SAT_PRESENTATION_TYPE_NAVIGATION_OPTION) {
-                               dst[current_index] += TEL_SAT_PRESENTATION_TYPE_NAVIGATION_OPTION;
+       dst[current_temp_index++] = (b_comprehensive ? (SATK_COMMAND_DETAILS_TAG | 0x80) : SATK_COMMAND_DETAILS_TAG);
+       dst[current_temp_index++] = SATK_COMMAND_DETAILS_LENGTH;
+       dst[current_temp_index++] = src->cmd_num;
+       dst[current_temp_index++] = src->cmd_type;
+       dst[current_temp_index] = 0x00;
+
+       switch(src->cmd_type){
+               case SAT_PROATV_CMD_DISPLAY_TEXT:{
+                       //command detail text priority
+                       if (src->cmd_qualifier.display_text.text_priority == TEXT_PRIORITY_HIGH)
+                               dst[current_temp_index] += 0x01;
+
+                       //command detail text clear type
+                       if (src->cmd_qualifier.display_text.text_clear_type == TEXT_WAIT_FOR_USER_TO_CLEAR_MSG)
+                               dst[current_temp_index] += 0x80;
+               }break;
+               case SAT_PROATV_CMD_GET_INKEY:{
+                       //command detail alphabet set
+                       if(src->cmd_qualifier.get_inkey.alphabet_set)
+                               dst[current_temp_index] += 0x01;
+
+                       //command detail alphabet type
+                       if(src->cmd_qualifier.get_inkey.alphabet_type == INPUT_ALPHABET_TYPE_UCS2)
+                               dst[current_temp_index] += 0x02;
+
+                       //command detail get inkey type
+                       if(src->cmd_qualifier.get_inkey.inkey_type == INKEY_TYPE_YES_NO_REQUESTED)
+                               dst[current_temp_index] += 0x04;
+
+
+                       //command detail immediate response required
+                       if(src->cmd_qualifier.get_inkey.immediate_rsp_required)
+                               dst[current_temp_index] += 0x08;
+
+                       //command detail help available
+                       if (src->cmd_qualifier.get_inkey.help_info)
+                               dst[current_temp_index] += 0x80;
+               }break;
+               case SAT_PROATV_CMD_GET_INPUT:{
+                       //command detail alphabet set
+                       if(src->cmd_qualifier.get_input.alphabet_set)
+                               dst[current_temp_index] += 0x01;
+
+                       //command detail alphabet type
+                       if(src->cmd_qualifier.get_input.alphabet_type == INPUT_ALPHABET_TYPE_UCS2)
+                               dst[current_temp_index] += 0x02;
+
+                       //command detail echo user input
+                       if(!src->cmd_qualifier.get_input.me_echo_user_input)
+                               dst[current_temp_index] += 0x04;
+
+                       //command detail user input unpacked format
+                       if(!src->cmd_qualifier.get_input.user_input_unpacked_format)
+                               dst[current_temp_index] += 0x08;
+
+                       //command detail help available
+                       if (src->cmd_qualifier.get_input.help_info)
+                               dst[current_temp_index] += 0x80;
+               }break;
+               case SAT_PROATV_CMD_MORE_TIME:{
+                       dbg("more time : 1bit RFU")
+               }break;
+               case SAT_PROATV_CMD_PLAY_TONE:{
+                       //command detail vibration alert
+                       if(src->cmd_qualifier.play_tone.vibration_alert == VIBRATE_ALERT_REQUIRED)
+                               dst[current_temp_index] += 0x01;
+               }break;
+               case SAT_PROATV_CMD_REFRESH:{
+                       //command detail refresh command
+                       dst[current_temp_index] += src->cmd_qualifier.refresh.refresh;
+               }break;
+               case SAT_PROATV_CMD_SETUP_MENU:{
+                       //command detail preferences
+                       if (src->cmd_qualifier.setup_menu.select_preference == SELECTION_PREFERENCE_USING_SOFT_KEY)
+                               dst[current_temp_index] += 0x01;
+
+                       //command detail help available
+                       if (src->cmd_qualifier.setup_menu.help_info)
+                               dst[current_temp_index] += 0x80;
+               }break;
+               case SAT_PROATV_CMD_SELECT_ITEM:{
+                       //command detail presentation
+                       if(src->cmd_qualifier.select_item.presentation_type != PRESENTATION_TYPE_NOT_SPECIFIED){
+                               dst[current_temp_index] += 0x01;
+                               if(src->cmd_qualifier.select_item.presentation_type == PRESENTATION_TYPE_NAVIGATION_OPTION){
+                                       dst[current_temp_index] += PRESENTATION_TYPE_NAVIGATION_OPTION;
+                               }
                        }
-               }
 
-               //command detail selection preference
-               if (src->cmd_qualifier.select_item.select_preference == TEL_SAT_SELECTION_PREFERENCE_USING_SOFT_KEY)
-                       dst[current_index] += 0x04;
-
-               //command detail help available
-               if (src->cmd_qualifier.select_item.help_info)
-                       dst[current_index] += 0x80;
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_SMS:
-               //command detail sms packing by me required
-               if (src->cmd_qualifier.cmd_quali_send_sms)
-                       dst[current_index] += 0x01;
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_CALL:
-               //command detail setup call command;
-               dst[current_index] += src->cmd_qualifier.setup_call;
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_EVENT_LIST:
-               dbg("setup evnet list : 1bit RFU");
-       break;
-       case TEL_SAT_PROATV_CMD_OPEN_CHANNEL:
-               if (src->cmd_qualifier.open_channel.immediate_link)
-                       dst[current_index] += 0x01;
-               if (src->cmd_qualifier.open_channel.automatic_reconnection)
-                       dst[current_index] += 0x02;
-               if (src->cmd_qualifier.open_channel.background_mode)
-                       dst[current_index] += 0x04;
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_DATA:
-               if (src->cmd_qualifier.cmd_quali_send_data)
-                       dst[current_index] += 0x01;
-       break;
-       case TEL_SAT_PROATV_CMD_PROVIDE_LOCAL_INFO:
-               dst[current_index] += src->cmd_qualifier.provide_local_info;
-       break;
-       case TEL_SAT_PROATV_CMD_LANGUAGE_NOTIFICATION:
-               if (src->cmd_qualifier.cmd_quali_language_notification)
-                       dst[current_index] += 0x01;
-       break;
-       case TEL_SAT_PROATV_CMD_LAUNCH_BROWSER:
-                       dst[current_index] += src->cmd_qualifier.launch_browser;
-       break;
-       default:
-               err("no matched cmd type(%d)", src->cmd_type);
+                       //command detail selection preference
+                       if(src->cmd_qualifier.select_item.select_preference == SELECTION_PREFERENCE_USING_SOFT_KEY)
+                               dst[current_temp_index] += 0x04;
+
+                       //command detail help available
+                       if (src->cmd_qualifier.select_item.help_info)
+                               dst[current_temp_index] += 0x80;
+               }break;
+               case SAT_PROATV_CMD_SEND_SMS:{
+                       //command detail sms packing by me required
+                       if(src->cmd_qualifier.send_sms.packing_by_me_required)
+                               dst[current_temp_index] += 0x01;
+               }break;
+               case SAT_PROATV_CMD_SETUP_CALL:{
+                       //command detail setup call command;
+                       dst[current_temp_index] += src->cmd_qualifier.setup_call.setup_call;
+               }break;
+               case SAT_PROATV_CMD_SETUP_EVENT_LIST:{
+                       dbg("setup evnet list : 1bit RFU")
+               }break;
+               case SAT_PROATV_CMD_OPEN_CHANNEL:{
+                       if(src->cmd_qualifier.open_channel.immediate_link)
+                               dst[current_temp_index] += 0x01;
+                       if(src->cmd_qualifier.open_channel.automatic_reconnection)
+                               dst[current_temp_index] += 0x02;
+                       if(src->cmd_qualifier.open_channel.background_mode)
+                               dst[current_temp_index] += 0x04;
+               }break;
+               case SAT_PROATV_CMD_SEND_DATA:{
+                       if(src->cmd_qualifier.send_data.send_data_immediately)
+                               dst[current_temp_index] += 0x01;
+               }break;
+               case SAT_PROATV_CMD_PROVIDE_LOCAL_INFO:{
+                       dst[current_temp_index] += src->cmd_qualifier.provide_local_info.provide_local_info;
+               }break;
+               case SAT_PROATV_CMD_LANGUAGE_NOTIFICATION:{
+                       if(src->cmd_qualifier.language_notification.specific_language)
+                               dst[current_temp_index] += 0x01;
+               }break;
+               case SAT_PROATV_CMD_LAUNCH_BROWSER:{
+                               dst[current_temp_index] += src->cmd_qualifier.launch_browser.launch_browser;
+               }break;
+               default:
+                       err("no matched cmd type(%d)", src->cmd_type);
+                       break;
        }
 
        return 5;
 }
 
-static int _sat_encode_device_identities_tlv(const TelSatDeviceIdentitiesInfo* src, char *dst, int current_index)
+static int _sat_encode_device_identities_tlv(const struct tel_sat_device_identities* src, char *dst, int current_temp_index)
 {
-       dst[current_index++] = (is_comprehensive ? (SATK_DEVICE_IDENTITY_TAG | 0x80) : SATK_DEVICE_IDENTITY_TAG);
-       dst[current_index++] =SATK_DEVICE_IDENTITY_LENGTH;
-       dst[current_index++] = src->src;
-       dst[current_index++] = src->dest;
+       dst[current_temp_index++] = SATK_DEVICE_IDENTITY_TAG;
+       dst[current_temp_index++] = SATK_DEVICE_IDENTITY_LENGTH;
+       dst[current_temp_index++] = src->src;
+       dst[current_temp_index++] = src->dest;
 
        //device identities total len 4
        return 4;
 }
 
-static int _sat_encode_item_identifier_tlv(const unsigned char src, char *dst, int current_index)
+static int _sat_encode_item_identifier_tlv(const struct tel_sat_item_identifier* src, char *dst, int current_temp_index)
 {
-       dst[current_index++] =SATK_ITEM_IDENTIFIER_TAG;
-       dst[current_index++] =SATK_ITEM_IDENTIFIER_LENGTH;
-       dst[current_index++] = src;
+       dst[current_temp_index++] =SATK_ITEM_IDENTIFIER_TAG;
+       dst[current_temp_index++] =SATK_ITEM_IDENTIFIER_LENGTH;
+       dst[current_temp_index++] = src->item_identifier;
 
        //item identifier total len 3
        return 3;
 }
 
-/*static int _sat_encode_duration_tlv(const TelSatDurationInfo* src, char *dst, int current_index)
+/*static int _sat_encode_duration_tlv(const struct tel_sat_duration* src, char *dst, int current_temp_index)
 {
-       dst[current_index++] =SATK_DURATION_TAG;
-       dst[current_index++] =SATK_DURATION_LENGTH;
-       dst[current_index++] = src->time_unit;
-       dst[current_index++] = src->time_interval;
+       dst[current_temp_index++] =SATK_DURATION_TAG;
+       dst[current_temp_index++] =SATK_DURATION_LENGTH;
+       dst[current_temp_index++] = src->time_unit;
+       dst[current_temp_index++] = src->time_interval;
 
        //duration total len 4
        return 4;
 }*/
 
-static int _sat_encode_text_tlv(const TelSatTextTypeInfo* src, char *dst, int current_index, gboolean raw_dcs)
+static int _sat_encode_text_tlv(const struct tel_sat_text_string_object* src, char *dst, int current_temp_index, gboolean raw_dcs)
 {
        int total_len = 0;
-       int length_index = 0;
+       int length_temp_index = 0;
 
        //tag
-       dst[current_index++] =SATK_TEXT_STRING_TAG;
+       dst[current_temp_index++] =SATK_TEXT_STRING_TAG;
 
        //length
-       if (src->string_length <= 0x7F) {
-               dst[current_index++] =SATK_DCS_LENGTH+src->string_length;
-               length_index = 1;
+       if(src->string_length <= 0x7F){
+               dst[current_temp_index++] =SATK_DCS_LENGTH+src->string_length;
+               length_temp_index = 1;
        }
        else{
-               dst[current_index++] = 0x81;
-               dst[current_index++] =SATK_DCS_LENGTH+src->string_length;
-               length_index = 2;
+               dst[current_temp_index++] = 0x81;
+               dst[current_temp_index++] =SATK_DCS_LENGTH+src->string_length;
+               length_temp_index = 2;
        }
 
        //dcs
-       if (raw_dcs)
-               dst[current_index++] = src->dcs.raw_dcs;
+       if(raw_dcs)
+               dst[current_temp_index++] = src->dcs.raw_dcs;
        else
-               dst[current_index++] =_sat_encode_dcs_tlv(&(src->dcs));
+               dst[current_temp_index++] =_sat_encode_dcs_tlv(&(src->dcs));
 
        //value
-       if (src->string_length > 0) {
-               memcpy(&(dst[current_index]), src->string, src->string_length);
+       if(src->string_length > 0){
+               memcpy(&(dst[current_temp_index]), src->string, src->string_length);
        }
 
-       //tag+index+dcs+data
-       total_len = 1+length_index+1+src->string_length;
+       //tag+temp_index+dcs+data
+       total_len = 1+length_temp_index+1+src->string_length;
 
        return total_len;
 }
 
-static int _sat_encode_eventlist_tlv(const TelSatEventListType src, char *dst, int current_index)
+static int _sat_encode_eventlist_tlv(const enum event_list src, char *dst, int current_temp_index)
 {
-       dst[current_index++] =SATK_EVENT_LIST_TAG;
-       dst[current_index++] =0x01;
-       dst[current_index++] =src;
+       dst[current_temp_index++] =SATK_EVENT_LIST_TAG;
+       dst[current_temp_index++] =0x01;
+       dst[current_temp_index++] =src;
 
        return 3;
 }
 
-static int _sat_encode_date_time_and_timezone_tlv(const TelSatDateTimeZoneInfo *src, char *dst, int current_index)
+static int _sat_encode_date_time_and_timezone_tlv(const struct tel_sat_date_time_and_timezone *src, char *dst, int current_temp_index)
 {
-       dst[current_index++] = SATK_DATE_TIME_AND_TIME_ZONE_TAG;
-       dst[current_index++] = SATK_DATE_TIME_AND_TIME_ZONE_LENGTH;
-       dst[current_index++] = src->year;
-       dst[current_index++] = src->month;
-       dst[current_index++] = src->day;
-       dst[current_index++] = src->hour;
-       dst[current_index++] = src->minute;
-       dst[current_index++] = src->second;
-       dst[current_index++] = src->time_zone;
+       dst[current_temp_index++] = SATK_DATE_TIME_AND_TIME_ZONE_TAG;
+       dst[current_temp_index++] = SATK_DATE_TIME_AND_TIME_ZONE_LENGTH;
+       dst[current_temp_index++] = src->year;
+       dst[current_temp_index++] = src->month;
+       dst[current_temp_index++] = src->day;
+       dst[current_temp_index++] = src->hour;
+       dst[current_temp_index++] = src->minute;
+       dst[current_temp_index++] = src->second;
+       dst[current_temp_index++] = src->timeZone;
 
        return 1+1+SATK_DATE_TIME_AND_TIME_ZONE_LENGTH; //tag length+len field length+value length;
 }
 
-static int _sat_encode_language_tlv(const TelSatLanguageInfo src, char *dst, int current_index)
+static int _sat_encode_language_tlv(const enum tel_sim_language_type src, char *dst, int current_temp_index)
 {
-       dst[current_index++] =SATK_LANGUAGE_TAG;
-       dst[current_index++] =SATK_LANGUAGE_LENGTH;
+       dst[current_temp_index++] =SATK_LANGUAGE_TAG;
+       dst[current_temp_index++] =SATK_LANGUAGE_LENGTH;
 
        dbg("language (%d)", src);
 
-       switch(src) {
-       case TEL_SAT_LP_GERMAN :
-               dst[current_index++] = 'd';
-               dst[current_index++] = 'e';
-       break;
-       case TEL_SAT_LP_ENGLISH :
-               dst[current_index++] = 'e';
-               dst[current_index++] = 'n';
-       break;
-       case TEL_SAT_LP_ITALIAN :
-               dst[current_index++] = 'i';
-               dst[current_index++] = 't';
-       break;
-       case TEL_SAT_LP_FRENCH :
-               dst[current_index++] = 'f';
-               dst[current_index++] = 'r';
-       break;
-       case TEL_SAT_LP_SPANISH :
-               dst[current_index++] = 'e';
-               dst[current_index++] = 's';
-       break;
-       case TEL_SAT_LP_DUTCH :
-               dst[current_index++] = 'n';
-               dst[current_index++] = 'l';
-       break;
-       case TEL_SAT_LP_SWEDISH :
-               dst[current_index++] = 's';
-               dst[current_index++] = 'v';
-       break;
-       case TEL_SAT_LP_DANISH :
-               dst[current_index++] = 'd';
-               dst[current_index++] = 'a';
-       break;
-       case TEL_SAT_LP_PORTUGUESE :
-               dst[current_index++] = 'p';
-               dst[current_index++] = 't';
-       break;
-       case TEL_SAT_LP_FINNISH :
-               dst[current_index++] = 'f';
-               dst[current_index++] = 'i';
-       break;
-       case TEL_SAT_LP_NORWEGIAN :
-               dst[current_index++] = 'n';
-               dst[current_index++] = 'b';
-       break;
-       case TEL_SAT_LP_GREEK :
-               dst[current_index++] = 'e';
-               dst[current_index++] = 'l';
-       break;
-       case TEL_SAT_LP_TURKISH :
-               dst[current_index++] = 't';
-               dst[current_index++] = 'k';
-       break;
-       case TEL_SAT_LP_HUNGARIAN :
-               dst[current_index++] = 'h';
-               dst[current_index++] = 'u';
-       break;
-       case TEL_SAT_LP_POLISH :
-               dst[current_index++] = 'p';
-               dst[current_index++] = 'l';
-       break;
-       default:
-               dst[current_index++] = 'e';
-               dst[current_index++] = 'n';
-               err("[SAT] SAT PARSER - Unknown Language: 0x%x",src);
+       switch(src){
+
+               case SIM_LANG_GERMAN :
+                       dst[current_temp_index++] = 'd';
+                       dst[current_temp_index++] = 'e';
+                       break;
+
+               case SIM_LANG_ENGLISH :
+                       dst[current_temp_index++] = 'e';
+                       dst[current_temp_index++] = 'n';
+                       break;
+
+               case SIM_LANG_ITALIAN :
+                       dst[current_temp_index++] = 'i';
+                       dst[current_temp_index++] = 't';
+                       break;
+
+               case SIM_LANG_FRENCH :
+                       dst[current_temp_index++] = 'f';
+                       dst[current_temp_index++] = 'r';
+                       break;
+
+               case SIM_LANG_SPANISH :
+                       dst[current_temp_index++] = 'e';
+                       dst[current_temp_index++] = 's';
+                       break;
+
+               case SIM_LANG_DUTCH :
+                       dst[current_temp_index++] = 'n';
+                       dst[current_temp_index++] = 'l';
+                       break;
+
+               case SIM_LANG_SWEDISH :
+                       dst[current_temp_index++] = 's';
+                       dst[current_temp_index++] = 'v';
+                       break;
+
+               case SIM_LANG_DANISH :
+                       dst[current_temp_index++] = 'd';
+                       dst[current_temp_index++] = 'a';
+                       break;
+
+               case SIM_LANG_PORTUGUESE :
+                       dst[current_temp_index++] = 'p';
+                       dst[current_temp_index++] = 't';
+                       break;
+
+               case SIM_LANG_FINNISH :
+                       dst[current_temp_index++] = 'f';
+                       dst[current_temp_index++] = 'i';
+                       break;
+
+               case SIM_LANG_NORWEGIAN :
+                       dst[current_temp_index++] = 'n';
+                       dst[current_temp_index++] = 'b';
+                       break;
+
+               case SIM_LANG_GREEK :
+                       dst[current_temp_index++] = 'e';
+                       dst[current_temp_index++] = 'l';
+                       break;
+
+               case SIM_LANG_TURKISH :
+                       dst[current_temp_index++] = 't';
+                       dst[current_temp_index++] = 'k';
+                       break;
+
+               case SIM_LANG_HUNGARIAN :
+                       dst[current_temp_index++] = 'h';
+                       dst[current_temp_index++] = 'u';
+                       break;
+
+               case SIM_LANG_POLISH :
+                       dst[current_temp_index++] = 'p';
+                       dst[current_temp_index++] = 'l';
+                       break;
+
+               case SIM_LANG_KOREAN :
+                       dst[current_temp_index++] = 'k';
+                       dst[current_temp_index++] = 'o';
+                       break;
+
+               case SIM_LANG_CHINESE :
+                       dst[current_temp_index++] = 'z';
+                       dst[current_temp_index++] = 'h';
+                       break;
+
+               case SIM_LANG_RUSSIAN :
+                       dst[current_temp_index++] = 'r';
+                       dst[current_temp_index++] = 'u';
+                       break;
+
+               case SIM_LANG_JAPANESE:
+                       dst[current_temp_index++] = 'j';
+                       dst[current_temp_index++] = 'a';
+                       break;
+
+               default:{
+                       dst[current_temp_index++] = 'e';
+                       dst[current_temp_index++] = 'n';
+                       dbg("[SAT] SAT PARSER - Unknown Language: 0x%x",src);
+                       break;
+               }
        }
        return 4;
 }
 
-static int _sat_encode_browser_termination_tlv(const TelSatBrowserTerminationCauseType src, char *dst, int current_index)
+static int _sat_encode_browser_termination_tlv(const enum browser_termination_cause src, char *dst, int current_temp_index)
 {
-       dst[current_index++] =SATK_BROWSER_TERMINATION_CAUSE_TAG;
-       dst[current_index++] =SATK_BROWSER_TERMINATION_CAUSE_LENGTH;
-       dst[current_index++] =src;
+       dst[current_temp_index++] =SATK_BROWSER_TERMINATION_CAUSE_TAG;
+       dst[current_temp_index++] =SATK_BROWSER_TERMINATION_CAUSE_LENGTH;
+       dst[current_temp_index++] =src;
 
        return 3;
 }
-
-static int _sat_encode_bearer_desc_tlv(const TelSatBearerDescriptionInfo* src, char *dst, int current_index)
+#if 0
+static int _sat_encode_bearer_desc_tlv(const struct tel_sat_bearer_description* src, char *dst, int current_temp_index)
 {
        int total_len = 0;
-       int length_index = 0;
+       int length_temp_index = 0;
 
-       dst[current_index++] =SATK_BEARER_DISCRIPTION_TAG;
+       dst[current_temp_index++] =SATK_BEARER_DISCRIPTION_TAG;
 
-       //length index
-       length_index = current_index++;
+       //length temp_index
+       length_temp_index = current_temp_index++;
 
        //bearer type
-       dst[current_index++] = src->bearer_type;
-
-       switch(src->bearer_type) {
-       case TEL_SAT_BEARER_CSD:
-               dst[current_index++] = src->bearer_parameter.cs_bearer_param.data_rate;
-               dst[current_index++] = src->bearer_parameter.cs_bearer_param.service_type;
-               dst[current_index++] = src->bearer_parameter.cs_bearer_param.connection_element_type;
-       break;
-       case TEL_SAT_BEARER_GPRS:
-               dst[current_index++] = src->bearer_parameter.ps_bearer_param.precedence_class;
-               dst[current_index++] = src->bearer_parameter.ps_bearer_param.delay_class;
-               dst[current_index++] = src->bearer_parameter.ps_bearer_param.reliability_class;
-               dst[current_index++] = src->bearer_parameter.ps_bearer_param.peak_throughput_class;
-               dst[current_index++] = src->bearer_parameter.ps_bearer_param.mean_throughput_class;
-               dst[current_index++] = src->bearer_parameter.ps_bearer_param.pdp_type;
-       break;
-       case TEL_SAT_BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER:
-       case TEL_SAT_BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT:
-       default:
-               err("invalid bearer_type", src->bearer_type);
-       }
-
-       dst[length_index] = (current_index-1) - length_index;
-       total_len = (current_index-1) - length_index + 2; //tag and length
+       dst[current_temp_index++] = src->bearer_type;
+
+       switch(src->bearer_type){
+               case BEARER_CSD:{
+                       dst[current_temp_index++] = src->bearer_parameter.cs_bearer_param.data_rate;
+                       dst[current_temp_index++] = src->bearer_parameter.cs_bearer_param.service_type;
+                       dst[current_temp_index++] = src->bearer_parameter.cs_bearer_param.connection_element_type;
+               }break;
+               case BEARER_GPRS:{
+                       dst[current_temp_index++] = src->bearer_parameter.ps_bearer_param.precedence_class;
+                       dst[current_temp_index++] = src->bearer_parameter.ps_bearer_param.delay_class;
+                       dst[current_temp_index++] = src->bearer_parameter.ps_bearer_param.reliability_class;
+                       dst[current_temp_index++] = src->bearer_parameter.ps_bearer_param.peak_throughput_class;
+                       dst[current_temp_index++] = src->bearer_parameter.ps_bearer_param.mean_throughput_class;
+                       dst[current_temp_index++] = src->bearer_parameter.ps_bearer_param.pdp_type;
+               }break;
+               case BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER:
+               case BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT:
+               default:
+               break;
+       }
+
+       dst[length_temp_index] = (current_temp_index-1) - length_temp_index;
+       total_len = (current_temp_index-1) - length_temp_index + 2; //tag and length
 
        return total_len;
 }
 
-static int _sat_encode_buffer_size_tlv(const unsigned char buffer_size[2], char *dst, int current_index)
+static int _sat_encode_buffer_size_tlv(const struct tel_sat_buffer_size* src, char *dst, int current_temp_index)
 {
-       dst[current_index++] = SATK_BUFFER_SIZE_TAG;
-       dst[current_index++] = SATK_BUFFER_SIZE_LENGTH;
-       dst[current_index++] = buffer_size[0];
-       dst[current_index++] = buffer_size[1];
+       dst[current_temp_index++] = SATK_BUFFER_SIZE_TAG;
+       dst[current_temp_index++] = SATK_BUFFER_SIZE_LENGTH;
+       dst[current_temp_index++] = src->size[0];
+       dst[current_temp_index++] = src->size[1];
 
        return 4;
 }
-
-static int _sat_encode_channel_data_tlv(const TelSatChannelDataInfo* src, char *dst, int current_index)
+#endif
+static int _sat_encode_channel_data_tlv(const struct tel_sat_channel_data* src, char *dst, int current_temp_index)
 {
        int total_len = 0;
-       int length_index = 0;
+       int length_temp_index = 0;
 
-       dst[current_index++] = SATK_CHANNEL_DATA_TAG;
+       dst[current_temp_index++] = SATK_CHANNEL_DATA_TAG;
 
-       if (src->data_string_len <= 0x7F) {
-               dst[current_index++] = src->data_string_len;
-               length_index = 1;
+       if(src->data_string_len <= 0x7F){
+               dst[current_temp_index++] = src->data_string_len;
+               length_temp_index = 1;
        }
        else{
-               dst[current_index++] = 0x81;
-               dst[current_index++] = src->data_string_len;
-               length_index = 2;
+               dst[current_temp_index++] = 0x81;
+               dst[current_temp_index++] = src->data_string_len;
+               length_temp_index = 2;
        }
 
-       memcpy(&(dst[current_index]), src->data_string, src->data_string_len);
+       memcpy(&(dst[current_temp_index]), src->data_string, src->data_string_len);
 
-       total_len = 1+length_index+src->data_string_len;
+       total_len = 1+length_temp_index+src->data_string_len;
 
        return total_len;
 }
 
-static int _sat_encode_channel_data_length_tlv(const unsigned char data_len, char *dst, int current_index)
+static int _sat_encode_channel_data_length_tlv(const struct tel_sat_channel_data_len* src, char *dst, int current_temp_index)
 {
-       dst[current_index++] = SATK_CHANNEL_DATA_LEN_TAG;
-       dst[current_index++] = SATK_CHANNEL_DATA_LENGTH_VALUE_LENGTH;
-       dst[current_index++] = data_len;
+       dst[current_temp_index++] = SATK_CHANNEL_DATA_LEN_TAG;
+       dst[current_temp_index++] = SATK_CHANNEL_DATA_LENGTH_VALUE_LENGTH;
+       dst[current_temp_index++] = src->data_len;
 
        return 3;
 }
 
-static int _sat_encode_channel_status_tlv(const TelSatChannelStatusInfo* src, char *dst, int current_index)
+static int _sat_encode_channel_status_tlv(const struct tel_sat_channel_status* src, char *dst, int current_temp_index)
 {
-       dst[current_index++] = SATK_CHANNEL_STATUS_TAG;
-       dst[current_index++] = SATK_CHANNEL_STATUS_LENGTH;
+       dst[current_temp_index++] = SATK_CHANNEL_STATUS_TAG;
+       dst[current_temp_index++] = SATK_CHANNEL_STATUS_LENGTH;
 
-       if (src->status == TEL_SAT_LINK_OR_PACKET_SERVICE_ACTIVATED) //(bit 8)
-               dst[current_index] += 0x80;
+       if(src->status == link_or_packet_service_activated) //(bit 8)
+               dst[current_temp_index] += 0x80;
 
-       dst[current_index++] += src->channel_id; //(bit 1~3)
-       dst[current_index++] = src->status_info;
+       dst[current_temp_index++] += src->channel_id; //(bit 1~3)
+       dst[current_temp_index++] = src->status_info;
 
        return 4;
 }
 
-static int _sat_encode_download_event(const TelSatEnvelopEventDownloadTlv *evt_dl, char *dst_envelop)
+static int _sat_encode_download_event(const struct tel_sat_envelop_event_download_tlv *evt_dl, char *dst_envelop)
 {
-       int index = 2;
+       int temp_index = 2;
        int encoded_len = 0;
 
        dbg("event type(%d)", evt_dl->event);
 
        //event list
-       encoded_len = _sat_encode_eventlist_tlv(evt_dl->event, dst_envelop, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_eventlist_tlv(evt_dl->event, dst_envelop, temp_index);
+       temp_index += encoded_len;
 
        //device id - len 4
-       encoded_len =_sat_encode_device_identities_tlv(&(evt_dl->device_identitie), dst_envelop, index);
-       index += encoded_len;
-
-       switch(evt_dl->event) {
-       case TEL_SAT_EVENT_LANGUAGE_SELECTION:
-               encoded_len = _sat_encode_language_tlv(evt_dl->language, dst_envelop, index);
-               index += encoded_len;
-       break;
-       case TEL_SAT_EVENT_BROWSER_TERMINATION:
-               encoded_len = _sat_encode_browser_termination_tlv(evt_dl->browser_termination, dst_envelop, index);
-               index += encoded_len;
-       break;
-       case TEL_SAT_EVENT_DATA_AVAILABLE:
-               encoded_len = _sat_encode_channel_status_tlv(&(evt_dl->channel_status), dst_envelop, index);
-               index += encoded_len;
-
-               encoded_len = _sat_encode_channel_data_length_tlv(evt_dl->channel_data_len, dst_envelop, index);
-               index += encoded_len;
-       break;
-       case TEL_SAT_EVENT_CHANNEL_STATUS:
-               encoded_len = _sat_encode_channel_status_tlv(&(evt_dl->channel_status), dst_envelop, index);
-               index += encoded_len;
-       break;
-       default:
-               err("invalid event type", evt_dl->event);
+       encoded_len =_sat_encode_device_identities_tlv(&(evt_dl->device_identitie), dst_envelop, temp_index);
+       temp_index += encoded_len;
+
+       switch(evt_dl->event){
+               case EVENT_LANGUAGE_SELECTION:
+                       encoded_len = _sat_encode_language_tlv(evt_dl->language, dst_envelop, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               case EVENT_BROWSER_TERMINATION:
+                       encoded_len = _sat_encode_browser_termination_tlv(evt_dl->browser_termination, dst_envelop, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               case EVENT_DATA_AVAILABLE:
+                       encoded_len = _sat_encode_channel_status_tlv(&(evt_dl->channel_status), dst_envelop, temp_index);
+                       temp_index += encoded_len;
+
+                       encoded_len = _sat_encode_channel_data_length_tlv(&(evt_dl->channel_data_len), dst_envelop, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               case EVENT_CHANNEL_STATUS:
+                       encoded_len = _sat_encode_channel_status_tlv(&(evt_dl->channel_status), dst_envelop, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               default:
+                       break;
        }
 
        dst_envelop[0] = SATK_EVENT_DOWNLOAD_TAG;
-       dst_envelop[1] = index-2;
+       dst_envelop[1] = temp_index-2;
 
-       dbg("download envelop cmd len(%d)", index);
+       dbg("download envelop cmd len(%d)", temp_index);
 
-       if (index-2 > 0x7F) {
+       if(temp_index-2 > 0x7F){
                int idx = 0;
-               for(idx = index; idx > 0; idx--) {
+               for(idx = temp_index; idx > 0; idx--){
                        dst_envelop[idx] = dst_envelop[idx+1];
                }
                dst_envelop[1] = 0x81;
-               index += 1;
-               dbg("download envelop added cmd len(%d)", index);
+               temp_index += 1;
+               dbg("download envelop added cmd len(%d)", temp_index);
        }
 
-       return index;
+       return temp_index;
 }
 
-gboolean tcore_sat_encode_envelop_cmd(const TelSatRequestEnvelopCmdData *src_envelop, char *dst_envelop, int* envelope_length)
+int tcore_sat_encode_envelop_cmd(const struct treq_sat_envelop_cmd_data *src_envelop, char *dst_envelop)
 {
-       int index = 0, encoded_len= 0;
+       int temp_index = 0, encoded_len= 0;
 
-       if (!dst_envelop) {
-               *envelope_length = 0;
-               return FALSE;
-       }
+       if(!dst_envelop)
+               return 0;
 
-       if (src_envelop->sub_cmd == TEL_SAT_ENVELOP_MENU_SELECTION) {
-               index = 2; //set the cursor to device identity
-               dbg("item id(%d)", src_envelop->envelop_data.menu_select.item_identifier);
-               encoded_len =_sat_encode_device_identities_tlv(&(src_envelop->envelop_data.menu_select.device_identitie), dst_envelop, index);
-               index += encoded_len;
+       if(src_envelop->sub_cmd == ENVELOP_MENU_SELECTION){
+               temp_index = 2; //set the cursor to device identity
+               dbg("item id(%d)", src_envelop->envelop_data.menu_select.item_identifier.item_identifier);
+               encoded_len =_sat_encode_device_identities_tlv(&(src_envelop->envelop_data.menu_select.device_identitie), dst_envelop, temp_index);
+               temp_index += encoded_len;
 
                //item identifier
-               encoded_len = _sat_encode_item_identifier_tlv(src_envelop->envelop_data.menu_select.item_identifier, dst_envelop, index);
-               index += encoded_len;
+               encoded_len = _sat_encode_item_identifier_tlv(&(src_envelop->envelop_data.menu_select.item_identifier), dst_envelop, temp_index);
+               temp_index += encoded_len;
 
-               if (src_envelop->envelop_data.menu_select.help_request) {
+               if(src_envelop->envelop_data.menu_select.help_request){
                        encoded_len = 2;//help request
-                       dst_envelop[index++] = SATK_HELP_REQUEST_TAG;
-                       dst_envelop[index++] = SATK_HELP_REQUEST_LENGTH;
+                       dst_envelop[temp_index++] = SATK_HELP_REQUEST_TAG;
+                       dst_envelop[temp_index++] = SATK_HELP_REQUEST_LENGTH;
                }
 
-               dbg("menu selection cmd len(%d)", index);
+               dbg("menu selection cmd len(%d)", temp_index);
 
                //main cmd
                dst_envelop[0] = SATK_MENU_SELECTION_TAG;
-               dst_envelop[1] = index-2;
+               dst_envelop[1] = temp_index-2;
        }
-       else if (src_envelop->sub_cmd == TEL_SAT_ENVELOP_EVENT_DOWNLOAD) {
-               index = _sat_encode_download_event(&(src_envelop->envelop_data.event_download),dst_envelop);
+       else if(src_envelop->sub_cmd == ENVELOP_EVENT_DOWNLOAD){
+               temp_index = _sat_encode_download_event(&(src_envelop->envelop_data.event_download),dst_envelop);
        }
-       *envelope_length = index;
 
-       return TRUE;
+       return temp_index;
 }
 
 
 
-static int _sat_encode_display_text(const TelSatTrDisplayTextTlv *src_tr, char *dst_tr)
+static int _sat_encode_display_text(const struct tel_sat_tr_display_text_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BACKWARD_MOVE_BY_USER:
-       case TEL_SAT_RESULT_NO_RESPONSE_FROM_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BACKWARD_MOVE_BY_USER:
+               case RESULT_NO_RESPONSE_FROM_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_get_inkey(const TelSatTrGetInkeyTlv *src_tr, char *dst_tr)
+static int _sat_encode_get_inkey(const struct tel_sat_tr_get_inkey_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-
-               encoded_len = _sat_encode_text_tlv(&(src_tr->text), dst_tr, index, FALSE);
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BACKWARD_MOVE_BY_USER:
-       case TEL_SAT_RESULT_HELP_INFO_REQUIRED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-       case TEL_SAT_RESULT_NO_RESPONSE_FROM_USER:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+
+                       encoded_len = _sat_encode_text_tlv(&(src_tr->text), dst_tr, temp_index, FALSE);
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BACKWARD_MOVE_BY_USER:
+               case RESULT_HELP_INFO_REQUIRED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+               case RESULT_NO_RESPONSE_FROM_USER:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_get_input(const TelSatTrGetInputTlv *src_tr, char *dst_tr)
+static int _sat_encode_get_input(const struct tel_sat_tr_get_input_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-
-               encoded_len = _sat_encode_text_tlv(&(src_tr->text), dst_tr, index, FALSE);
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BACKWARD_MOVE_BY_USER:
-       case TEL_SAT_RESULT_NO_RESPONSE_FROM_USER:
-       case TEL_SAT_RESULT_HELP_INFO_REQUIRED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index =0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+
+                       encoded_len = _sat_encode_text_tlv(&(src_tr->text), dst_tr, temp_index, FALSE);
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BACKWARD_MOVE_BY_USER:
+               case RESULT_NO_RESPONSE_FROM_USER:
+               case RESULT_HELP_INFO_REQUIRED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index =0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_more_time(const TelSatTrMoreTimeTlv *src_tr, char *dst_tr)
+static int _sat_encode_more_time(const struct tel_sat_tr_more_time_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_play_tone(const TelSatTrPlayToneTlv *src_tr, char *dst_tr)
+static int _sat_encode_play_tone(const struct tel_sat_tr_play_tone_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_SUCCESS_BUT_TONE_NOT_PLAYED:
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_SUCCESS_BUT_TONE_NOT_PLAYED:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_refresh(const TelSatTrRefreshTlv *src_tr, char *dst_tr)
+static int _sat_encode_refresh(const struct tel_sat_tr_refresh_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_REFRESH_PERFORMED_WITH_ADDITIONAL_EFS_READ:
-       case TEL_SAT_RESULT_REFRESH_PRFRMD_BUT_INDICATED_USIM_NOT_ACTIVE:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_REFRESH_PERFORMED_WITH_ADDITIONAL_EFS_READ:
+               case RESULT_REFRESH_PRFRMD_BUT_INDICATED_USIM_NOT_ACTIVE:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_setup_menu(const TelSatTrSetupMenuTlv *src_tr, char *dst_tr)
+static int _sat_encode_setup_menu(const struct tel_sat_tr_setup_menu_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_select_item(const TelSatTrSelectItemTlv *src_tr, char *dst_tr)
+static int _sat_encode_select_item(const struct tel_sat_tr_select_item_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_HELP_INFO_REQUIRED_BY_USER:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-               encoded_len = _sat_encode_item_identifier_tlv(src_tr->item_identifier, dst_tr, index);
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BACKWARD_MOVE_BY_USER:
-       case TEL_SAT_RESULT_NO_RESPONSE_FROM_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_HELP_INFO_REQUIRED_BY_USER:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       encoded_len = _sat_encode_item_identifier_tlv(&(src_tr->item_identifier), dst_tr, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BACKWARD_MOVE_BY_USER:
+               case RESULT_NO_RESPONSE_FROM_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_send_sms(const TelSatTrSendSmsTlv *src_tr, char *dst_tr)
+static int _sat_encode_send_sms(const struct tel_sat_tr_send_sms_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_SMS_RP_ERROR:
-       case TEL_SAT_RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_SMS_RP_ERROR:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               case RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->cc_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_send_ss(const TelSatTrSendSsTlv *src_tr, char *dst_tr)
+static int _sat_encode_send_ss(const struct tel_sat_tr_send_ss_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_SUCCESS_BUT_MODIFIED_BY_CALL_CONTROL_BY_SIM:
-       case TEL_SAT_RESULT_USSD_OR_SS_TRANSACTION_TERMINATED_BY_USER:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-
-               memcpy(&(dst_tr[index]), src_tr->text.string, src_tr->text.string_length);
-               encoded_len = src_tr->text.string_length;
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->cc_problem_type;
-       break;
-       case TEL_SAT_RESULT_SS_RETURN_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->ss_problem;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_SUCCESS_BUT_MODIFIED_BY_CALL_CONTROL_BY_SIM:
+               case RESULT_USSD_OR_SS_TRANSACTION_TERMINATED_BY_USER:
+                       dst_tr[temp_index++] = 1+src_tr->text.string_length;
+                       dst_tr[temp_index++] = src_tr->result_type;
+
+                       memcpy(&(dst_tr[temp_index]), src_tr->text.string, src_tr->text.string_length);
+                       encoded_len = src_tr->text.string_length;
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               case RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->cc_problem_type;
+                       break;
+               case RESULT_SS_RETURN_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->ss_problem;
+                       break;
+               case RESULT_BEYOND_ME_CAPABILITIES:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_send_ussd(const TelSatTrSendUssdTlv *src_tr, char *dst_tr)
+static int _sat_encode_send_ussd(const struct tel_sat_tr_send_ussd_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_SUCCESS_BUT_MODIFIED_BY_CALL_CONTROL_BY_SIM:
-       case TEL_SAT_RESULT_USSD_OR_SS_TRANSACTION_TERMINATED_BY_USER:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-
-               encoded_len = _sat_encode_text_tlv(&(src_tr->text), dst_tr, index, TRUE);
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->cc_problem_type;
-       break;
-       case TEL_SAT_RESULT_USSD_RETURN_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->ussd_problem;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_SUCCESS_BUT_MODIFIED_BY_CALL_CONTROL_BY_SIM:
+               case RESULT_USSD_OR_SS_TRANSACTION_TERMINATED_BY_USER:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+
+                       encoded_len = _sat_encode_text_tlv(&(src_tr->text), dst_tr, temp_index, TRUE);
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               case RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->cc_problem_type;
+                       break;
+               case RESULT_USSD_RETURN_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->ussd_problem;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_setup_call(const TelSatTrSetupCallTlv *src_tr, char *dst_tr)
+static int _sat_encode_setup_call(const struct tel_sat_tr_setup_call_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_SUCCESS_BUT_MODIFIED_BY_CALL_CONTROL_BY_SIM:
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-       case TEL_SAT_RESULT_SS_RETURN_ERROR:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_USER_DID_NOT_ACCEPT_CALL_SETUP_REQ:
-       case TEL_SAT_RESULT_USER_CLEAR_DOWN_CALL_BEFORE_CONN:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->network_problem_type;
-       break;
-       case TEL_SAT_RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->cc_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_SUCCESS_BUT_MODIFIED_BY_CALL_CONTROL_BY_SIM:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+               case RESULT_SS_RETURN_ERROR:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_USER_DID_NOT_ACCEPT_CALL_SETUP_REQ:
+               case RESULT_USER_CLEAR_DOWN_CALL_BEFORE_CONN:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->network_problem_type;
+                       break;
+               case RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->cc_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_provide_local_info(const TelSatTrProvideLocalInfoTlv *src_tr, char *dst_tr)
+static int _sat_encode_provide_local_info(const struct tel_sat_tr_provide_local_info_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_LIMITED_SERVICE:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-               switch(src_tr->command_detail.cmd_qualifier.provide_local_info) {
-               case TEL_SAT_LOCAL_INFO_DATE_TIME_AND_TIMEZONE:
-                       encoded_len = _sat_encode_date_time_and_timezone_tlv(&(src_tr->other.date_time_and_timezone), dst_tr, index);
-               break;
-               case TEL_SAT_LOCAL_INFO_LANGUAGE:
-                       encoded_len = _sat_encode_language_tlv(src_tr->other.language, dst_tr, index);
-               break;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_LIMITED_SERVICE:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       switch(src_tr->command_detail.cmd_qualifier.provide_local_info.provide_local_info){
+                               case LOCAL_INFO_DATE_TIME_AND_TIMEZONE:
+                                       encoded_len = _sat_encode_date_time_and_timezone_tlv(&(src_tr->other.date_time_and_timezone), dst_tr, temp_index);
+                                       break;
+                               case LOCAL_INFO_LANGUAGE:
+                                       encoded_len = _sat_encode_language_tlv(src_tr->other.language, dst_tr, temp_index);
+                                       break;
+                               default:
+                                       dbg("local info type[%d] is not handled", src_tr->command_detail.cmd_qualifier.provide_local_info.provide_local_info);
+                                       break;
+                       }
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
                default:
-                       err("local info type[%d] is not handled", src_tr->command_detail.cmd_qualifier.provide_local_info);
-               }
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_setup_event_list(const TelSatTrSetupEventListTlv *src_tr, char *dst_tr)
+static int _sat_encode_setup_event_list(const struct tel_sat_tr_setup_event_list_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_setup_idle_mode_text(const TelSatTrSetupIdleModeTextTlv *src_tr, char *dst_tr)
+static int _sat_encode_setup_idle_mode_text(const struct tel_sat_tr_setup_idle_mode_text_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_send_dtmf(const TelSatTrSendDtmfTlv *src_tr, char *dst_tr)
+static int _sat_encode_send_dtmf(const struct tel_sat_tr_send_dtmf_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_language_notification(const TelSatTrLanguageNotificationTlv *src_tr, char *dst_tr)
+static int _sat_encode_language_notification(const struct tel_sat_tr_language_notification_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_launch_browser(const TelSatTrLaunchBrowserTlv *src_tr, char *dst_tr)
+static int _sat_encode_launch_browser(const struct tel_sat_tr_launch_browser_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_LAUNCH_BROWSER_GENERIC_ERROR_CODE:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->browser_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BACKWARD_MOVE_BY_USER:
+               case RESULT_NO_RESPONSE_FROM_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               case RESULT_LAUNCH_BROWSER_GENERIC_ERROR_CODE:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->browser_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_open_channel(const TelSatTrOpenChannelTlv *src_tr, char *dst_tr)
+static int _sat_encode_open_channel(const struct tel_sat_tr_open_channel_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MODIFICATION:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-
-               //set channel status
-               encoded_len = _sat_encode_channel_status_tlv(&(src_tr->channel_status), dst_tr, index);
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_REFRESH_PRFRMD_BUT_INDICATED_USIM_NOT_ACTIVE:
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_INTERACTION_WITH_CC_BY_SIM_IN_TMP_PRBLM:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-       case TEL_SAT_RESULT_USER_DID_NOT_ACCEPT_CALL_SETUP_REQ:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->bip_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               return 0;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_SUCCESS_WITH_MODIFICATION:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+
+                       //set channel status
+                       encoded_len = _sat_encode_channel_status_tlv(&(src_tr->channel_status), dst_tr, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_REFRESH_PRFRMD_BUT_INDICATED_USIM_NOT_ACTIVE:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_INTERACTION_WITH_CC_BY_SIM_IN_TMP_PRBLM:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+               case RESULT_USER_DID_NOT_ACCEPT_CALL_SETUP_REQ:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               case RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->bip_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       return 0;
+                       break;
        }
 
-       //set buffer desc
-       encoded_len = _sat_encode_bearer_desc_tlv(&(src_tr->bearer_desc), dst_tr, index);
-       index += encoded_len;
-
-       //set buffer size
-       encoded_len = _sat_encode_buffer_size_tlv(src_tr->buffer_size, dst_tr, index);
-       index += encoded_len;
-
-       return index;
+       return temp_index;
 }
 
-static int _sat_encode_close_channel(const TelSatTrCloseChannelTlv *src_tr, char *dst_tr)
+static int _sat_encode_close_channel(const struct tel_sat_tr_close_channel_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->bip_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               case RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->bip_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_send_data(const TelSatTrSendDataTlv *src_tr, char *dst_tr)
+static int _sat_encode_send_data(const struct tel_sat_tr_send_data_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-               encoded_len = _sat_encode_channel_data_length_tlv(src_tr->channel_data_len, dst_tr, index);
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->bip_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       encoded_len = _sat_encode_channel_data_length_tlv(&(src_tr->channel_data_len), dst_tr, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+
+               case RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->bip_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_receive_data(const TelSatTrReceiveDataTlv *src_tr, char *dst_tr)
+static int _sat_encode_receive_data(const struct tel_sat_tr_receive_data_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-               encoded_len = _sat_encode_channel_data_tlv(&(src_tr->channel_data), dst_tr, index);
-               index += encoded_len;
-               encoded_len = _sat_encode_channel_data_length_tlv(src_tr->channel_data_len, dst_tr, index);
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_FRAMES_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->bip_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       encoded_len = _sat_encode_channel_data_tlv(&(src_tr->channel_data), dst_tr, temp_index);
+                       temp_index += encoded_len;
+                       encoded_len = _sat_encode_channel_data_length_tlv(&(src_tr->channel_data_len), dst_tr, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_FRAMES_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+
+               case RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->bip_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
+       }
+
+       return temp_index;
 }
 
-static int _sat_encode_get_channel_status(const TelSatTrGetChannelStatusTlv *src_tr, char *dst_tr)
+static int _sat_encode_get_channel_status(const struct tel_sat_tr_get_channel_status_tlv *src_tr, char *dst_tr)
 {
-       int index = 0, encoded_len = 0;
+       int temp_index = 0, encoded_len = 0;
 
        //set command detail info
-       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set device identities info
-       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, index);
-       index += encoded_len;
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
        //set result info
-       dst_tr[index++] = (is_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
-       switch(src_tr->result_type) {
-       case TEL_SAT_RESULT_SUCCESS:
-       case TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
-       case TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO:
-       case TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-               encoded_len = _sat_encode_channel_status_tlv(&(src_tr->channel_status), dst_tr, index);
-               index += encoded_len;
-       break;
-       case TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
-       case TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES:
-       case TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
-       case TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
-       case TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
-               dst_tr[index++] = 1;
-               dst_tr[index++] = src_tr->result_type;
-       break;
-       case TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
-       case TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->me_problem_type;
-       break;
-       case TEL_SAT_RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
-               dst_tr[index++] = 2;
-               dst_tr[index++] = src_tr->result_type;
-               dst_tr[index++] = src_tr->bip_problem_type;
-       break;
-       default:
-               err("invalid response value[0x%x] in current TR",src_tr->result_type);
-               index = 0;
-       }
-
-       return index;
-}
-
-gboolean tcore_sat_encode_terminal_response(const TelSatRequestTerminalResponseData *src_tr, char *dst_tr, int* tr_length)
-{
-       if (!dst_tr) {
-               err("dst_tr is null");
-               *tr_length = 0;
-               return 0;
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       switch(src_tr->result_type){
+               case RESULT_SUCCESS:
+               case RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION:
+               case RESULT_SUCCESS_WITH_MISSING_INFO:
+               case RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       encoded_len = _sat_encode_channel_status_tlv(&(src_tr->channel_status), dst_tr, temp_index);
+                       temp_index += encoded_len;
+                       break;
+               case RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER:
+               case RESULT_BEYOND_ME_CAPABILITIES:
+               case RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME:
+               case RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME:
+               case RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING:
+                       dst_tr[temp_index++] = 1;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       break;
+               case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
+               case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->me_problem_type;
+                       break;
+               case RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR:
+                       dst_tr[temp_index++] = 2;
+                       dst_tr[temp_index++] = src_tr->result_type;
+                       dst_tr[temp_index++] = src_tr->bip_problem_type;
+                       break;
+               default:
+                       dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
+                       temp_index = 0;
+                       break;
        }
 
-       switch(src_tr->cmd_type) {
-       case TEL_SAT_PROATV_CMD_DISPLAY_TEXT:
-               *tr_length = _sat_encode_display_text(&(src_tr->terminal_rsp_data.display_text), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_GET_INKEY:
-               *tr_length = _sat_encode_get_inkey(&(src_tr->terminal_rsp_data.get_inkey), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_GET_INPUT:
-               *tr_length = _sat_encode_get_input(&(src_tr->terminal_rsp_data.get_input), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_MORE_TIME:
-               *tr_length = _sat_encode_more_time(&(src_tr->terminal_rsp_data.more_time), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_PLAY_TONE:
-               *tr_length = _sat_encode_play_tone(&(src_tr->terminal_rsp_data.play_tone), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_REFRESH:
-               *tr_length = _sat_encode_refresh(&(src_tr->terminal_rsp_data.refresh), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_MENU:
-               *tr_length = _sat_encode_setup_menu(&(src_tr->terminal_rsp_data.setup_menu), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SELECT_ITEM:
-               *tr_length = _sat_encode_select_item(&(src_tr->terminal_rsp_data.select_item), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_SMS:
-               *tr_length = _sat_encode_send_sms(&(src_tr->terminal_rsp_data.send_sms), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_SS:
-               *tr_length = _sat_encode_send_ss(&(src_tr->terminal_rsp_data.send_ss), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_USSD:
-               *tr_length = _sat_encode_send_ussd(&(src_tr->terminal_rsp_data.send_ussd), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_CALL:
-               *tr_length = _sat_encode_setup_call(&(src_tr->terminal_rsp_data.setup_call), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_PROVIDE_LOCAL_INFO:
-               *tr_length = _sat_encode_provide_local_info(&(src_tr->terminal_rsp_data.provide_local_info), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_EVENT_LIST:
-               *tr_length = _sat_encode_setup_event_list(&(src_tr->terminal_rsp_data.setup_event_list), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT:
-               *tr_length = _sat_encode_setup_idle_mode_text(&(src_tr->terminal_rsp_data.setup_idle_mode_text), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_DTMF:
-               *tr_length = _sat_encode_send_dtmf(&(src_tr->terminal_rsp_data.send_dtmf), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_LANGUAGE_NOTIFICATION:
-               *tr_length = _sat_encode_language_notification(&(src_tr->terminal_rsp_data.language_notification), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_LAUNCH_BROWSER:
-               *tr_length = _sat_encode_launch_browser(&(src_tr->terminal_rsp_data.launch_browser), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_OPEN_CHANNEL:
-               *tr_length = _sat_encode_open_channel(&(src_tr->terminal_rsp_data.open_channel), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_CLOSE_CHANNEL:
-               *tr_length = _sat_encode_close_channel(&(src_tr->terminal_rsp_data.close_channel), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_SEND_DATA:
-               *tr_length = _sat_encode_send_data(&(src_tr->terminal_rsp_data.send_data), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_RECEIVE_DATA:
-               *tr_length = _sat_encode_receive_data(&(src_tr->terminal_rsp_data.receive_data), dst_tr);
-       break;
-       case TEL_SAT_PROATV_CMD_GET_CHANNEL_STATUS:
-               *tr_length = _sat_encode_get_channel_status(&(src_tr->terminal_rsp_data.get_channel_status), dst_tr);
-       break;
-       default:
-               err("no matched cmd type(%d)", src_tr->cmd_type);
-               *tr_length = 0;
-               return FALSE;
-       }
-
-       return TRUE;
+       return temp_index;
 }
 
-void tcore_sat_override_ops(CoreObject *co, TcoreSatOps *sat_ops)
+static int _sat_encode_unsupport_command(const struct tel_sat_tr_unsupport_command_tlv *src_tr, char *dst_tr)
 {
-       PrivateObject *po = NULL;
+       int temp_index = 0, encoded_len = 0;
+
+       //set command detail info
+       encoded_len = _sat_encode_command_detail_tlv(&(src_tr->command_detail), dst_tr, temp_index);
+       temp_index += encoded_len;
 
-       po = (PrivateObject *)tcore_object_ref_object(co);
+       //set device identities info
+       encoded_len = _sat_encode_device_identities_tlv(&(src_tr->device_id), dst_tr, temp_index);
+       temp_index += encoded_len;
 
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(sat_ops != NULL);
+       //set result info
+       dst_tr[temp_index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+       dst_tr[temp_index++] = 1;
+       dst_tr[temp_index++] = src_tr->result_type;
 
-       if (sat_ops->send_envelope) {
-               po->ops->send_envelope = sat_ops->send_envelope;
-       }
-       if (sat_ops->send_terminal_response) {
-               po->ops->send_terminal_response = sat_ops->send_terminal_response;
-       }
-       if (sat_ops->send_user_confirmation) {
-               po->ops->send_user_confirmation = sat_ops->send_user_confirmation;
-       }
+       return temp_index;
 }
 
-gboolean tcore_sat_set_ops(CoreObject *co, TcoreSatOps *ops)
+int tcore_sat_encode_terminal_response(const struct treq_sat_terminal_rsp_data *src_tr, char *dst_tr){
+       int tr_len = 0;
+
+       if(!dst_tr)
+               return 0;
+
+       switch(src_tr->cmd_type){
+               case SAT_PROATV_CMD_DISPLAY_TEXT:{
+                       tr_len = _sat_encode_display_text(&(src_tr->terminal_rsp_data.display_text), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_GET_INKEY:{
+                       tr_len = _sat_encode_get_inkey(&(src_tr->terminal_rsp_data.get_inkey), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_GET_INPUT:{
+                       tr_len = _sat_encode_get_input(&(src_tr->terminal_rsp_data.get_input), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_MORE_TIME:{
+                       tr_len = _sat_encode_more_time(&(src_tr->terminal_rsp_data.more_time), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_PLAY_TONE:{
+                       tr_len = _sat_encode_play_tone(&(src_tr->terminal_rsp_data.play_tone), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_REFRESH:{
+                       tr_len = _sat_encode_refresh(&(src_tr->terminal_rsp_data.refresh), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SETUP_MENU:{
+                       tr_len = _sat_encode_setup_menu(&(src_tr->terminal_rsp_data.setup_menu), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SELECT_ITEM:{
+                       tr_len = _sat_encode_select_item(&(src_tr->terminal_rsp_data.select_item), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SEND_SMS:{
+                       tr_len = _sat_encode_send_sms(&(src_tr->terminal_rsp_data.send_sms), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SEND_SS:{
+                       tr_len = _sat_encode_send_ss(&(src_tr->terminal_rsp_data.send_ss), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SEND_USSD:{
+                       tr_len = _sat_encode_send_ussd(&(src_tr->terminal_rsp_data.send_ussd), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SETUP_CALL:{
+                       tr_len = _sat_encode_setup_call(&(src_tr->terminal_rsp_data.setup_call), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_PROVIDE_LOCAL_INFO:{
+                       tr_len = _sat_encode_provide_local_info(&(src_tr->terminal_rsp_data.provide_local_info), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SETUP_EVENT_LIST:{
+                       tr_len = _sat_encode_setup_event_list(&(src_tr->terminal_rsp_data.setup_event_list), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT:{
+                       tr_len = _sat_encode_setup_idle_mode_text(&(src_tr->terminal_rsp_data.setup_idle_mode_text), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SEND_DTMF:{
+                       tr_len = _sat_encode_send_dtmf(&(src_tr->terminal_rsp_data.send_dtmf), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_LANGUAGE_NOTIFICATION:{
+                       tr_len = _sat_encode_language_notification(&(src_tr->terminal_rsp_data.language_notification), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_LAUNCH_BROWSER:{
+                       tr_len = _sat_encode_launch_browser(&(src_tr->terminal_rsp_data.launch_browser), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_OPEN_CHANNEL:{
+                       tr_len = _sat_encode_open_channel(&(src_tr->terminal_rsp_data.open_channel), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_CLOSE_CHANNEL:{
+                       tr_len = _sat_encode_close_channel(&(src_tr->terminal_rsp_data.close_channel), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_SEND_DATA:{
+                       tr_len = _sat_encode_send_data(&(src_tr->terminal_rsp_data.send_data), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_RECEIVE_DATA:{
+                       tr_len = _sat_encode_receive_data(&(src_tr->terminal_rsp_data.receive_data), dst_tr);
+               }break;
+               case SAT_PROATV_CMD_GET_CHANNEL_STATUS:{
+                       tr_len = _sat_encode_get_channel_status(&(src_tr->terminal_rsp_data.get_channel_status), dst_tr);
+               }break;
+               default:{
+                       tr_len = _sat_encode_unsupport_command(&(src_tr->terminal_rsp_data.unsupport_cmd), dst_tr);
+               }break;
+       }
+
+       return tr_len;
+}
+
+CoreObject *tcore_sat_new(TcorePlugin *p, const char *name,
+               struct tcore_sat_operations *ops, TcoreHal *hal)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!p)
+               return NULL;
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSatOps));
+       po->ops = ops;
+
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_SAT);
+       tcore_object_link_object(o, po);
+       tcore_object_set_clone_hook(o, _clone_hook);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
 
-       return TRUE;
+       return o;
 }
 
-CoreObject *tcore_sat_new(TcorePlugin *p,
-                       TcoreSatOps *ops, TcoreHal *hal)
+void tcore_sat_free(CoreObject *o)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-
-       tcore_check_return_value_assert(p != NULL, NULL);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAT);
 
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       tcore_object_free(o);
+}
 
-       po = tcore_malloc0(sizeof(PrivateObject));
-       po->ops = tcore_memdup(ops, sizeof(TcoreSatOps));
+void tcore_sat_set_ops(CoreObject *o, struct tcore_sat_operations *ops)
+{
+       struct private_object_data *po = NULL;
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_SAT);
-       tcore_object_link_object(co, po);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_dispatcher(co, (TcoreObjectDispatcher)_dispatcher);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAT);
 
-       return co;
-}
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
 
-void tcore_sat_free(CoreObject *co)
-{
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SAT);
-       tcore_object_free(co);
+       po->ops = ops;
 }
index 0008e97..ca9b180 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "tcore.h"
 #include "plugin.h"
 #include "queue.h"
+#include "user_request.h"
 #include "core_object.h"
 #include "co_sim.h"
 
-typedef struct {
-       TcoreSimOps *ops;
-
-       TelSimCardType type; /**< Provides the SIM card type*/
-       TelSimCardStatus sim_status; /**< Provides the card status*/
-       TelSimCardChangeStatus change_status; /**< Provides SIM card change status */
-       TelSimImsiInfo imsi; /**< Provides IMSI information*/
-       gboolean is_cphs; /**< Whether current SIM is for CPHS or not*/
-       TelSimServiceTable svct; /**< (U)SIM Service Table information*/
-       gchar *spn;
-       TelSimSpnDispCondition disp_condition;
+struct private_object_data {
+       struct tcore_sim_operations *ops;
+
+       unsigned char app_list;
+       enum tel_sim_type type; /**< Provides the SIM card type*/
+       enum tel_sim_status sim_status; /**< Provides the card status*/
+       struct tel_sim_imsi imsi; /**< Provides IMSI information*/
+       gboolean b_sim_changed; /**< Provides SIM card Identification- 0:no changed, 1:changed*/
+       gboolean b_cphs; /**< Whether current SIM is for CPHS or not*/
+       struct tel_sim_service_table *svct; /**< (U)SIM Service Table information*/
+       struct tel_sim_ecc_list *ecc_list;
+       struct tel_sim_msisdn_list *msisdn_list;
+       struct tel_sim_spn *spn;
+       struct tel_sim_cphs_netname *cphs_netname;
+       struct tel_sim_iccid *iccid;
+       struct tel_sim_cphs_csp *csp;
+       struct tel_sim_ist *ist;
        void *userdata; /**< free use data*/
-} PrivateObject;
+};
+
+/*
+ * Below table is created by referring two sites:
+ *
+ * 1) ITU "Mobile Network Code (MNC) for the international
+ *   identification plan for mobile terminals and mobile users"
+ *   which is available as an annex to the ITU operational bulletin
+ *   available here: http://www.itu.int/itu-t/bulletin/annex.html
+ *
+ * 2) The ISO 3166 country codes list, available here:
+ *    http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html
+ *
+ */
+static const char* mcc_having_3digits_mnc[] = {
+       "302",  // Canada
+       "310", "311", "312", "313", "314", "315", "316",        // United States of America
+       //"334",        // Mexico (uses 3-digits MNC only partially.)
+       "338",  // Jamaica
+       "342",  // Barbados
+       "344",  // Antigua and Barbuda
+       "346",  // Cayman Islands
+       "348",  // British Virgin Islands
+       "365",  // Anguilla
+       "708",  // Honduras (Republic of)
+       //"722",        // Argentine Republic (uses 3-digits MNC only partially.)
+       "732",  // Colombia (Republic of)
+};
+
+static const char* plmn_having_3digits_mnc[] = {
+       /* Mexico */
+       "334020",       // Telcel
+       "334050",       // Iusacell/Unefon
+       /* India */
+       "405025", "405026", "405027", "405028", "405029", "405030", "405031", "405032",
+       "405033", "405034", "405035", "405036", "405037", "405038", "405039", "405040",
+       "405041", "405042", "405043", "405044", "405045", "405046", "405047", "405750",
+       "405751", "405752", "405753", "405754", "405755", "405756", "405799", "405800",
+       "405801", "405802", "405803", "405804", "405805", "405806", "405807", "405808",
+       "405809", "405810", "405811", "405812", "405813", "405814", "405815", "405816",
+       "405817", "405818", "405819", "405820", "405821", "405822", "405823", "405824",
+       "405825", "405826", "405827", "405828", "405829", "405830", "405831", "405832",
+       "405833", "405834", "405835", "405836", "405837", "405838", "405839", "405840",
+       "405841", "405842", "405843", "405844", "405845", "405846", "405847", "405848",
+       "405849", "405850", "405851", "405852", "405853", "405875", "405876", "405877",
+       "405878", "405879", "405880", "405881", "405882", "405883", "405884", "405885",
+       "405886", "405908", "405909", "405910", "405911", "405912", "405913", "405914",
+       "405915", "405916", "405917", "405918", "405919", "405920", "405921", "405922",
+       "405923", "405924", "405925", "405926", "405927", "405928", "405929", "405930",
+       "405931", "405932",
+       /* Malaysia */
+       "502142", "502143", "502145", "502146", "502147", "502148",
+       /* Argentina */
+       "722070",       // Movistar AR
+       "722310",       // Claro AR
+       "722341",       // Personal AR
+};
+
+gboolean tcore_sim_check_plmn_having_3digits_mnc(char* plmn)
+{
+       int num = 0;
+       int i = 0;
+       char *mcc = NULL;
+
+       mcc = g_strndup(plmn, 3 + 1);
+       if (mcc) {
+               mcc[3] = '\0';
+               num = G_N_ELEMENTS(mcc_having_3digits_mnc);
+               for (i = 0; i < num; i++) {
+                       if (strcmp((const char *)mcc, mcc_having_3digits_mnc[i]) == 0) {
+                               g_free(mcc);
+                               return TRUE;
+                       }
+               }
+               g_free(mcc);
+       }
+
+       num = G_N_ELEMENTS(plmn_having_3digits_mnc);
+       for (i = 0; i < num; i++) {
+               if (strcmp((const char *)plmn, plmn_having_3digits_mnc[i]) == 0) {
+                       return TRUE;
+               }
+       }
 
-static TelReturn _dispatcher(CoreObject *co, TcoreCommand command,
-       const void *request, TcoreObjectResponseCallback cb, const void *user_data)
+       return FALSE;
+}
+
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       PrivateObject *po = NULL;
-       po = tcore_object_ref_object(co);
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_SIM, TCORE_RETURN_EINVAL);
 
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
+       po = tcore_object_ref_object(o);
+       if (!po || !po->ops)
+               return TCORE_RETURN_ENOSYS;
 
-       dbg("command [0x%x]", command);
+       command = tcore_user_request_get_command(ur);
 
        switch (command) {
-       case TCORE_COMMAND_SIM_GET_IMSI:
-               if (po->ops->get_imsi)
-                       return po->ops->get_imsi(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_ECC:
-               if (po->ops->get_ecc)
-                       return po->ops->get_ecc(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_ICCID:
-               if (po->ops->get_iccid)
-                       return po->ops->get_iccid(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_LANGUAGE:
-               if (po->ops->get_language)
-                       return po->ops->get_language(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_SET_LANGUAGE:
-               if (po->ops->set_language)
-                       return po->ops->set_language(co, *(TelSimLanguagePreferenceCode *) request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_CALL_FORWARDING_INFO:
-               if (po->ops->get_callforwarding_info)
-                       return po->ops->get_callforwarding_info(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_MESSAGE_WAITING_INFO:
-               if (po->ops->get_messagewaiting_info)
-                       return po->ops->get_messagewaiting_info(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_SET_MESSAGE_WAITING_INFO:
-               if (po->ops->set_messagewaiting_info)
-                       return po->ops->set_messagewaiting_info(co, (TelSimMwis *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_MAILBOX_INFO:
-               if (po->ops->get_mailbox_info)
-                       return po->ops->get_mailbox_info(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_SET_MAILBOX_INFO:
-               if (po->ops->set_mailbox_info)
-                       return po->ops->set_mailbox_info(co, (TelSimMailBoxNumber *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_MSISDN:
-               if (po->ops->get_msisdn)
-                       return po->ops->get_msisdn(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_SPN:
-               if (po->ops->get_spn)
-                       return po->ops->get_spn(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_CPHS_NET_NAME:
-               if (po->ops->get_cphs_netname)
-                       return po->ops->get_cphs_netname(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_SP_DISPLAY_INFO:
-               if (po->ops->get_sp_display_info)
-                       return po->ops->get_sp_display_info(co, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_REQ_AUTHENTICATION:
-               if (po->ops->req_authentication)
-                       return po->ops->req_authentication(co, (TelSimAuthenticationData *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_VERIFY_PINS:
-               if (po->ops->verify_pins)
-                       return po->ops->verify_pins(co, (TelSimSecPinPw *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_VERIFY_PUKS:
-               if (po->ops->verify_puks)
-                       return po->ops->verify_puks(co, (TelSimSecPukPw *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_CHANGE_PINS:
-               if (po->ops->change_pins)
-                       return po->ops->change_pins(co, (TelSimSecChangePinPw *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_DISABLE_FACILITY:
-               if (po->ops->disable_facility)
-                       return po->ops->disable_facility(co, (TelSimFacilityPw *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_ENABLE_FACILITY:
-               if (po->ops->enable_facility)
-                       return po->ops->enable_facility(co, (TelSimFacilityPw *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_FACILITY:
-               if (po->ops->get_facility)
-                       return po->ops->get_facility(co, *(TelSimLockType *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_GET_LOCK_INFO:
-               if (po->ops->get_lock_info)
-                       return po->ops->get_lock_info(co, *(TelSimLockType *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_REQ_APDU:
-               if (po->ops->req_apdu)
-                       return po->ops->req_apdu(co, (TelSimApdu *)request, cb, (void *)user_data);
-       break;
-       case TCORE_COMMAND_SIM_REQ_ATR:
-               if (po->ops->req_atr)
-                       return po->ops->req_atr(co, cb, (void *)user_data);
-       break;
-       default:
-               err("Unsupported operation");
-               return  TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       err("Operation NOT Permitted");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
-}
-
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
-{
-       PrivateObject *src_po = NULL;
-       PrivateObject *dest_po = NULL;
-
-       tcore_check_return_assert(src != NULL);
-       tcore_check_return_assert(dest != NULL);
+               case TREQ_SIM_VERIFY_PINS:
+                       if (!po->ops->verify_pins)
+                               return TCORE_RETURN_ENOSYS;
 
-       src_po = tcore_object_ref_object(src);
-       if (NULL == src_po) {
-               err("invalid source private object");
+                       return po->ops->verify_pins(o, ur);
+                       break;
+
+               case TREQ_SIM_VERIFY_PUKS:
+                       if (!po->ops->verify_puks)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->verify_puks(o, ur);
+                       break;
+
+               case TREQ_SIM_CHANGE_PINS:
+                       if (!po->ops->change_pins)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->change_pins(o, ur);
+                       break;
+
+               case TREQ_SIM_GET_FACILITY_STATUS:
+                       if (!po->ops->get_facility_status)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_facility_status(o, ur);
+                       break;
+
+               case TREQ_SIM_DISABLE_FACILITY:
+                       if (!po->ops->disable_facility)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->disable_facility(o, ur);
+                       break;
+
+               case TREQ_SIM_ENABLE_FACILITY:
+                       if (!po->ops->enable_facility)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->enable_facility(o, ur);
+                       break;
+
+               case TREQ_SIM_GET_LOCK_INFO:
+                       if (!po->ops->get_lock_info)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_lock_info(o, ur);
+                       break;
+
+               case TREQ_SIM_TRANSMIT_APDU:
+                       if (!po->ops->transmit_apdu)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->transmit_apdu(o, ur);
+                       break;
+
+               case TREQ_SIM_GET_ATR:
+                       if (!po->ops->get_atr)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->get_atr(o, ur);
+                       break;
+
+               case TREQ_SIM_SET_LANGUAGE:
+               case TREQ_SIM_SET_CALLFORWARDING:
+               case TREQ_SIM_SET_MESSAGEWAITING:
+               case TREQ_SIM_SET_MAILBOX:
+#if defined TIZEN_GLOBALCONFIG_ENABLE_CSP
+               case TREQ_SIM_SET_CPHS_CSP_INFO:
+#endif
+                       if (!po->ops->update_file)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->update_file(o, ur);
+                       break;
+
+               case TREQ_SIM_GET_ECC:
+               case TREQ_SIM_GET_LANGUAGE:
+               case TREQ_SIM_GET_ICCID:
+               case TREQ_SIM_GET_MAILBOX:
+               case TREQ_SIM_GET_CALLFORWARDING:
+               case TREQ_SIM_GET_MESSAGEWAITING:
+               case TREQ_SIM_GET_CPHS_INFO:
+               case TREQ_SIM_GET_SERVICE_TABLE:
+               case TREQ_SIM_GET_MSISDN:
+               case TREQ_SIM_GET_SPN:
+               case TREQ_SIM_GET_SPDI:
+               case TREQ_SIM_GET_OPL:
+               case TREQ_SIM_GET_PNN:
+               case TREQ_SIM_GET_CPHS_NETNAME:
+               case TREQ_SIM_GET_OPLMNWACT:
+               case TREQ_SIM_GET_ICON:
+               case TREQ_SIM_GET_IMPI:
+               case TREQ_SIM_GET_IMPU:
+               case TREQ_SIM_GET_GID:
+               case TREQ_SIM_GET_DOMAIN:
+               case TREQ_SIM_GET_PCSCF:
+               case TREQ_SIM_GET_ISIM_SERVICE_TABLE:
+                       if (!po->ops->read_file)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->read_file(o, ur);
+                       break;
+
+               case TREQ_SIM_REQ_AUTHENTICATION:
+                       if (!po->ops->req_authentication)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->req_authentication(o, ur);
+                       break;
+
+               case TREQ_SIM_SET_POWERSTATE:
+                       if (!po->ops->set_powerstate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       return po->ops->set_powerstate(o, ur);
+                       break;
+
+               default:
+                       warn("unhandled request command[%d]", command);
+                       break;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static void _clone_hook(CoreObject *src, CoreObject *dest)
+{
+       struct private_object_data *src_po = NULL;
+       struct private_object_data *dest_po = NULL;
+
+       if (!src || !dest)
+               return;
+
+       dest_po = calloc(1, sizeof(struct private_object_data));
+       if (!dest_po) {
                tcore_object_link_object(dest, NULL);
                return;
        }
 
-       tcore_check_return_assert(src_po->ops != NULL);
-
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreSimOps));
+       src_po = tcore_object_ref_object(src);
+       dest_po->ops = src_po->ops;
 
        tcore_object_link_object(dest, dest_po);
 }
 
-static void _po_free_hook(CoreObject *co)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *po = NULL;
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return(po != NULL);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SIM);
+
+       po = tcore_object_ref_object(o);
+       if (po) {
+               if (po->svct)
+                       free(po->svct);
+               if (po->ecc_list)
+                       free(po->ecc_list);
+               if (po->msisdn_list)
+                       free(po->msisdn_list);
+               if (po->spn)
+                       free(po->spn);
+               if (po->cphs_netname)
+                       free(po->cphs_netname);
+               if (po->iccid)
+                       free(po->iccid);
+               if (po->csp)
+                       free(po->csp);
+               if (po->ist)
+                       free(po->ist);
+               free(po);
+               tcore_object_link_object(o, NULL);
+       }
+}
 
-       tcore_free(po->spn);
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+static void _reverse(char* p_in, int length)
+{
+       int i, j = length - 1;
+       for (i = 0; i < j; i++) {
+               int t = p_in[i];
+               p_in[i] = p_in[j];
+               p_in[j--] = t;
+       }
 }
 
-/**
- * According to ETSI 102.221 ( 3GPP specification refers it ), EF-ICCID is coded by BCD, left justified and padded with 'F'.
- * This EF is mandatory and byte length is fixed with 10 bytes. So actual maximum length of ICCID is 20 digits.
- */
-gboolean tcore_sim_decode_iccid(unsigned char *enc_iccid, int enc_iccid_len, char *dec_iccid)
+static char* _acitoa(int n, char* str, int b)
 {
-       int bcd_byte = 0;
-       guint char_length = 0;
+       int i = 0;
 
-       tcore_check_return_value_assert(enc_iccid != NULL, FALSE);
-       tcore_check_return_value_assert(enc_iccid_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_iccid != NULL, FALSE);
+       do {
+               str[i++] = "0123456789ABCDEF"[n % b];
+       } while ((n /= b) > 0);
 
-       if (enc_iccid_len == 0 || enc_iccid_len > 10) {
-               err("invalid length");
-               return FALSE;
-       }
-       memset((void*) dec_iccid, 0, TEL_SIM_ICCID_LEN_MAX+1);
+       _reverse(str, i);
+
+       str[i] = '\0';
 
-       bcd_byte = (int) tcore_util_get_valid_bcd_byte(enc_iccid, enc_iccid_len);
+       return str;
+}
 
-       char_length = tcore_util_convert_bcd_to_digit(dec_iccid, (char*)enc_iccid, bcd_byte);
-       dbg("ICCID string length is[%d]", char_length);
+/*******************************************************************************
+ Convert Digit to BCD (BCD to Digit)
 
-       dec_iccid[char_length] = '\0';
+ bcd           <--->   digit
+ 0xa                           0x2a '*'
+ 0xb                           0x23 '#'
+ 0xc                           0x70 'P'
+ 0xd                           '?'
+ 0xf                           0
+ 1032547698            0123456789
 
-       return TRUE;
+ ********************************************************************************/
+/**
+ * This function is used to Convert Digit to BCD (Digit to BCD)
+ *
+ * @return             None
+ * @param[out] bcdCode - BCD output
+ * @param[in]          digits - Digit input
+ * @param[in]          digitLen - digit length
+ * @Interface          Synchronous.
+ * @remark
+ * @Refer
+ */
+static void _digit_to_bcd(char* bcdCode, char* digits, int digitLen)
+{
+       int i, j, digit;
+       unsigned char higher, lower;
+
+       // 0123456789 -> 1032547698
+       for (i = 0, j = 0; i < digitLen; i = i + 2, j++) {
+               if (digits[i] == '*')
+                       digit = 0x0A;
+               else if (digits[i] == '#')
+                       digit = 0x0B;
+               else if (toupper((int) digits[i]) == 'P')
+                       digit = 0x0C;
+               else if ((digits[i]) == '?')
+                       digit = 0x0D;
+               else
+                       digit = (int) digits[i];
+
+               lower = digit & 0x0F;
+
+               if (digitLen != i + 1) {
+                       if (digits[i + 1] == '*')
+                               digit = 0x0A;
+                       else if (digits[i + 1] == '#')
+                               digit = 0x0B;
+                       else if (toupper((int) digits[i + 1]) == 'P')
+                               digit = 0x0C;
+                       else if (digits[i + 1] == '?')
+                               digit = 0x0D;
+                       else
+                               digit = (int) digits[i + 1];
+                       higher = digit & 0x0F;
+               } else {
+                       higher = 0xFF;
+               }
+               bcdCode[j] = (higher << 4) | lower;
+       }
 }
 
 /**
- * This function is used to decode EFLP (2G)
+ * This function is used to Convert BCD to Digit (BCD to Digit)
+ *
+ * @return             None
+ * @param[out] digit - Digit output output
+ * @param[in]          bcdCode - BCD Input
+ * @param[in]          bcdLen - BCD length
+ * @Interface          Synchronous.
+ * @remark
+ * @Refer
  */
-gboolean tcore_sim_decode_lp(unsigned char *enc_lang, int enc_lang_len, TelSimLanguagePreferenceCode *dec_lang)
+static unsigned long _bcd_to_digit(char* digit, char* bcdCode, int bcdLen)
 {
-       tcore_check_return_value_assert(enc_lang != NULL, FALSE);
-       tcore_check_return_value_assert(enc_lang_len != 0, FALSE);
+       int i, h, l;
+       char c[2];
+       unsigned char higher, lower;
+       unsigned long digitLen = 0;
+
+       // 0123456789 <- 1032547698
+       memset((void*) digit, 0, bcdLen * 2);
+
+       for (i = 0; i < bcdLen; i++) {
+               higher = (bcdCode[i] >> 4) & 0x0F; // get high nibble
+
+               if (higher == 0x0A)
+                       higher = '*'; // =0x2A
+               else if (higher == 0x0B)
+                       higher = '#'; // =0x23
+               else if (higher == 0x0C)
+                       higher = 'P'; // =0x70, DTMF Control digit
+               else if (higher == 0x0D)
+                       higher = '?';
+               else if (higher == 0x0F)
+                       higher = 0;
+               else {
+                       h = (int) higher;
+                       _acitoa(h, c, 16);
+                       higher = (char) toupper(*c);
+               }
 
-       *dec_lang = TEL_SIM_LP_LANG_UNSPECIFIED;
-       /*Consider only highest priority language */
-       if (enc_lang[0] != 0xFF)
-               *dec_lang = (TelSimLanguagePreferenceCode)enc_lang[0];
+               lower = bcdCode[i] & 0x0F; // get low nibble
+
+               if (lower == 0x0A)
+                       lower = '*';
+               else if (lower == 0x0B)
+                       lower = '#';
+               else if (lower == 0x0C)
+                       lower = 'P'; //DTMF Control digit
+               else if (lower == 0x0D)
+                       lower = '?';
+               else if (lower == 0x0F)
+                       lower = 0;
+               else {
+                       l = (int) lower;
+                       _acitoa(l, c, 16);
+                       lower = (char) toupper(*c);
+               }
+               digit[i * 2] = lower;
+               digit[i * 2 + 1] = higher;
+       }
 
-       dbg("enc_lang_len [%d] language[0x%x]", enc_lang_len, *dec_lang);
-       return TRUE;
+       digitLen = (unsigned long) strlen(digit);
+       return digitLen;
 }
 
 /**
- * This function is used to encode EFLP (2G)
+ * This function is used to get(decode) string name
+ *
+ * @return             length of string
+ * @param[out] palpha_id - Alpha string
+ * @param[in]          pRecord - Input raw data
+ * @param[in]          alphaIDMaxLen - Max size of alpha id array
+ * @Interface          Synchronous.
+ * @remark
+ * @Refer
  */
-gboolean tcore_sim_encode_lp(TelSimLanguagePreferenceCode dec_lang,
-       char **enc_lang, int *enc_lang_len)
+static unsigned long _get_string(unsigned char* palpha_id, unsigned char* pRecord,     unsigned long alphaIDMaxLen)
 {
-       char *language_code[] = {"00", "01", "02", "03", "04", "05", "06", "07",
-               "08", "09", "10", "11","12", "13", "14", "15", "16", "17", "18"};
+       unsigned long i, alphaIDLen = 0;
+       unsigned char *pAlphaID = (unsigned char*) palpha_id;
 
-       tcore_check_return_value_assert(enc_lang != NULL, FALSE);
-       tcore_check_return_value_assert(enc_lang_len != NULL, FALSE);
+       memset((void*) pAlphaID, 0, alphaIDMaxLen);
 
-       *enc_lang = g_strdup_printf("%s", language_code[dec_lang]);
-       *enc_lang_len = 1;
-       dbg("Encoded Language: [%s] Length: [%d]", *enc_lang, *enc_lang_len);
+       if (pRecord[0] == 0xFF)
+               return alphaIDLen;
 
-       return TRUE;
+       for (i = 0; i < alphaIDMaxLen; i++) {
+               if (pRecord[0] <= 0x7F && pRecord[i] == 0xFF)
+                       break;
+
+               pAlphaID[i] = pRecord[i];
+               alphaIDLen++;
+       }
+       return alphaIDLen;
 }
 
 /**
- * This function is used to decode LI (3G)
+ * This function is used to set(encode) string name
+ *
+ * @return             length of string
+ * @param[in]          palpha_id - Alpha string input
+ * @param[out] pRecord - output raw data
+ * @param[in]          alphaIDMaxLen - Max size of alpha id array
+ * @Interface          Synchronous.
+ * @remark
+ * @Refer
  */
-gboolean tcore_sim_decode_li(unsigned char *enc_lang, int enc_lang_len,
-       TelSimFileId file_id, TelSimLanguagePreferenceCode *dec_lang)
+static void _set_string(unsigned char* pRecord, unsigned char* palpha_id, unsigned long alphaIDMaxLen)
 {
-       gint default_li;
+       unsigned long i;
+       unsigned char* pAlphaID = (unsigned char*) palpha_id;
 
-       tcore_check_return_value_assert(enc_lang != NULL, FALSE);
-       tcore_check_return_value_assert(enc_lang_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_lang != NULL, FALSE);
+       memset((void*) pRecord, 0xFF, alphaIDMaxLen);
 
-       *dec_lang = TEL_SIM_LP_LANG_UNSPECIFIED;
+       for (i = 0; i < alphaIDMaxLen; i++)
+               pRecord[i] = pAlphaID[i];
+}
 
-       /*
-        * Description of problem: language decoding was not correctly done
-        * if we used 7layers's test SIM Patch Description : TS31.102
-        * If the EFLI has the value 'FFFF' in its highest priority position,
-        * then the preferred language selection shall be the language
-        * preference in the EFPL
-        */
-       if ((file_id == TEL_SIM_EF_USIM_LI)
-                       || (file_id == TEL_SIM_EF_LP)) {
-               default_li = enc_lang[0];
-               default_li = ((default_li << 8) & 0xFF00) + enc_lang[1];
-
-               /* Validate the 'default' language */
-               if (default_li == 0xFFFF) {
-                       dbg("'default' Laguage is UNDEFINED: [0x%x]",
-                               default_li);
+static gboolean _is_empty(unsigned char* p_in, int in_length)
+{
+       int i;
+       for (i = 0; i < in_length; i++) {
+               if (p_in[i] != 0xFF)
                        return FALSE;
-               }
        }
-
-       if (enc_lang[0] == 'e') {
-               switch (enc_lang[1]) {
-               case 'n':
-                       *dec_lang = TEL_SIM_LP_ENGLISH;
-               break;
-               case 's':
-                       *dec_lang = TEL_SIM_LP_SPANISH;
-               break;
-               case 'l':
-                       *dec_lang = TEL_SIM_LP_GREEK;
-               break;
-               }
-       } else if (enc_lang[0] == 'd') {
-               switch (enc_lang[1]) {
-               case 'e':
-                       *dec_lang = TEL_SIM_LP_GERMAN;
-               break;
-               case 'a':
-                       *dec_lang = TEL_SIM_LP_DANISH;
-               break;
-               }
-       } else if (enc_lang[0] == 'p') {
-               switch (enc_lang[1]) {
-               case 'l':
-                       *dec_lang = TEL_SIM_LP_POLISH;
-               break;
-               case 't':
-                       *dec_lang = TEL_SIM_LP_PORTUGUESE;
-               break;
-               }
-       } else if (enc_lang[0] == 'i' && enc_lang[1] == 't') {
-               *dec_lang = TEL_SIM_LP_ITALIAN;
-       } else if (enc_lang[0] == 'f' && enc_lang[1] == 'r') {
-               *dec_lang = TEL_SIM_LP_FRENCH;
-       } else if (enc_lang[0] == 'n' && enc_lang[1] == 'l') {
-               *dec_lang = TEL_SIM_LP_DUTCH;
-       } else if (enc_lang[0] == 's' && enc_lang[1] == 'v') {
-               *dec_lang = TEL_SIM_LP_SWEDISH;
-       } else if (enc_lang[0] == 'f' && enc_lang[1] == 'i') {
-               *dec_lang = TEL_SIM_LP_FINNISH;
-       } else if (enc_lang[0] == 'n' && enc_lang[1] == 'o') {
-               *dec_lang = TEL_SIM_LP_NORWEGIAN;
-       } else if (enc_lang[0] == 't' && enc_lang[1] == 'r') {
-               *dec_lang = TEL_SIM_LP_TURKISH;
-       } else if (enc_lang[0] == 'h' && enc_lang[1] == 'u') {
-               *dec_lang = TEL_SIM_LP_HUNGARIAN;
-       } else if (enc_lang[0] == 'k' && enc_lang[1] == 'o') {
-               *dec_lang = TEL_SIM_LP_KOREAN;
-       } else if (enc_lang[0] == 'z' && enc_lang[1] == 'h') {
-               *dec_lang = TEL_SIM_LP_CHINESE;
-       } else if (enc_lang[0] == 'r' && enc_lang[1] == 'u') {
-               *dec_lang = TEL_SIM_LP_RUSSIAN;
-       } else if (enc_lang[0] == 'j' && enc_lang[1] == 'a') {
-               *dec_lang = TEL_SIM_LP_JAPANESE;
-       }
-
-       dbg( "Language %d ", *dec_lang);
-       return TRUE;
+       dbg("current index has empty data");
+       return TRUE;            // this is empty record.
 }
 
 /**
- * This function is used to encode EFLI (3G)
+ * This function is used to get BCD length
+ *
+ * @return             length of string
+ * @param[in]          pBcdData - BCD Input data
+ * @param[in]          bcdMaxLen - BCD Max data Length
+ * @Interface          Synchronous.
+ * @remark
+ * @Refer
  */
-gboolean tcore_sim_encode_li(TelSimLanguagePreferenceCode dec_lang,
-       char **en_lang, int *en_lang_len)
+static int _get_valid_bcd_byte(unsigned char* pBcdData, int bcdMaxLen)
 {
-       char *language_code[] = {"de", "en", "it", "fr", "es", "nl", "sv", "da",
-               "pt", "fi", "no", "el", "tr", "hu", "pl", "ko", "zh", "ru", "ja" };
+       int i, bcd_length = 0;
 
-       tcore_check_return_value_assert(en_lang != NULL, FALSE);
-       tcore_check_return_value_assert(en_lang_len != NULL, FALSE);
-
-       *en_lang_len = 0;
+       for (i = 0; i < bcdMaxLen; i++) {
+               if (pBcdData[i] == 0xFF)
+                       break;
 
-       if (dec_lang <= TEL_SIM_LP_JAPANESE) {
-               *en_lang = (char *) tcore_strdup((gchar *)language_code[dec_lang]);
-               *en_lang_len = strlen(*en_lang);
-               dbg("Encoded Language: [%s] Length: [%d]", *en_lang, *en_lang_len);
+               bcd_length++;
        }
-
-       return TRUE;
+       return bcd_length;
 }
 
-gboolean tcore_sim_decode_imsi(unsigned char *en_imsi, int en_imsi_len, TelSimImsiInfo *dec_imsi)
+/**
+ * This function is used to get unpacked 8bit Format from GSM 7bit packed string.
+ *
+ * @return          the length of unpacked characters  .
+ * @param[out] out_string      Specifies the unpacked output string
+ * @param[in]          in_string       Contains the input string to be unpacked
+ * @param[in]          in_string_len   Contains the input string length
+ * @remark
+ */
+static int _unpack_7bit28bit(unsigned char* pInString, unsigned int inStringLen, unsigned char * pOutString)
 {
-       int i, j=0;
-       char imsi_raw[16];
-       unsigned int mnc_len = 0;
+       int i = 0;
+       unsigned int pos = 0;
+       unsigned short shift = 0;
+       int outlen = 0;
+       outlen = (short int) ((inStringLen * 8) / 7);
 
-       dbg( "Func Entrance");
+       for (i = 0; pos < inStringLen; i++, pos++) {
+               pOutString[i] = (pInString[pos] << shift) & 0x7F;
 
-       tcore_check_return_value_assert(dec_imsi != NULL, FALSE);
-       tcore_check_return_value_assert(en_imsi != NULL, FALSE);
+               if (pos != 0) {
+                       /* except the first byte, a character contains some bits from the previous byte.*/
+                       pOutString[i] |= pInString[pos - 1] >> (8 - shift);
+               }
 
-       /*
-               According to 3GPP specification, the length of raw IMSI data is 9 bytes.
-               first byte is length of IMSI
-               second byte byte has parity nibble, so second byte has one digit of IMSI. other byte has two digit of IMSI
-       */
-       if ((en_imsi_len == 0) || (en_imsi_len == 0xff) || (4 > en_imsi_len) || (9 <en_imsi_len)) {
-               dbg("No valid IMSI present to convert - length:[%x]",   en_imsi_len);
-               return FALSE;
-       }
-       dbg("imsi length[%d], input data length[%d]", en_imsi[0], en_imsi_len);
+               shift++;
 
-       /* Decode IMSI value from nibbles */
-       for (i = 1; i < en_imsi_len; i++) {
-               if (i == 1) { /* first byte, ignore lower nibble */
-                       imsi_raw[j++] = ((en_imsi[i] & 0xF0) >> 4) + '0';
-               } else if (i == en_imsi[0]+1) { /* last byte */
-                       imsi_raw[j++] = (en_imsi[i] & 0x0F)+ '0';
-                       if (en_imsi[0]%2) /* count the last one if odd digits */
-                               imsi_raw[j++] = ((en_imsi[i] & 0xF0) >> 4) + '0';
-               } else {
-                       imsi_raw[j++] = (en_imsi[i]  & 0x0F) + '0';
-                       imsi_raw[j++] = ((en_imsi[i] & 0xF0) >> 4) + '0';
+               if (shift == 7) {
+                       shift = 0;
+
+                       /* a possible extra complete character is available */
+                       i++;
+                       pOutString[i] = pInString[pos] >> 1;
                }
        }
-       /* Terminate string */
-       imsi_raw[j] = '\0';
-       dbg("imsi_raw[%s], size[%d]", imsi_raw, strlen(imsi_raw));
 
-       mnc_len = strlen(imsi_raw) - TEL_SIM_MSIN_LEN_MAX - TEL_SIM_MCC_MNC_LEN_MAX;
+       /*If a character is '\r'(13), change it to space(32) */
+       for (i = 0; i < outlen; i++)
+               if (pOutString[i] == 13) pOutString[i] = 32;
+
+       pOutString[outlen] = '\0';
+
+       dbg( "unpack is done with outlen[%d] and array index[%d], out string[%s]", outlen, i, pOutString);
+       return (unsigned int) (i);
+}
 
-       memcpy(dec_imsi->mcc, imsi_raw, TEL_SIM_MCC_MNC_LEN_MAX);
-       dec_imsi->mcc[TEL_SIM_MCC_MNC_LEN_MAX] = '\0';
-       memcpy(dec_imsi->mnc, imsi_raw+TEL_SIM_MCC_MNC_LEN_MAX, mnc_len);
-       dec_imsi->mnc[mnc_len] = '\0';
-       memcpy(dec_imsi->msin, imsi_raw+TEL_SIM_MCC_MNC_LEN_MAX+mnc_len, TEL_SIM_MSIN_LEN_MAX);
-       dec_imsi->msin[TEL_SIM_MSIN_LEN_MAX] = '\0';
+static int _ucs2_to_utf8(int in_length, unsigned char *in_data, int *out_length,       unsigned char *out_data)
+{
+       int i, j;
+       i = j = 0;
+       if (in_length == 0 || in_data == NULL || out_data == NULL) {
+               dbg( "Unicode Decode Failed as text length is 0");
+               return FALSE;
+       }
 
-       dbg("dec_imsi->mcc[%s], dec_imsi->mcc[%s], dec_imsi->msin[%s]",
-                               dec_imsi->mcc, dec_imsi->mnc, dec_imsi->msin);
+       if (0 != (in_length % 2)) {
+               dbg( " ##### Unicode decoding failed due to invalid text length [%d]",  in_length);
+               return FALSE;
+       }
 
+       for (i = 0; i < in_length; i++) {
+               out_data[i] = in_data[j];
+               j = j + 2;
+       }
+       *out_length = (in_length / 2);
+       out_data[i] = '\0';
        return TRUE;
 }
 
-gboolean tcore_sim_decode_sst(unsigned char *enc_sst, int enc_sst_len, char *dec_sst)
+static int _decode_cdma_imsi_util(char *imsi, unsigned short *mcc, unsigned char *mnc,
+                                                                                                               unsigned long *min1, unsigned short *min2)
 {
-       unsigned char sst_byte, rast, mask = 0;
-       char sim_service_id = 1;        // set "CHV1 disable function"
-       int i, svc_count;
+       unsigned short country_code = *mcc;
+       unsigned char nw_code = *mnc;
+       unsigned long imsi_min1 = *min1;
+       unsigned short imsi_min2 = *min2;
+       unsigned short second_three = 0;
+       unsigned char thousands = 0;
+       unsigned short last_three = 0;
+       unsigned char min_to_digit[] = {'1','2','3','4','5','6','7','8','9','0'};
+       unsigned char bcd_to_num[] = {0xFF,'1','2','3','4','5','6','7','8','9','0',0xFF,0xFF,0xFF,0xFF,0xFF};
+       int p_digit = 0;
+       int digit = 0;
+
+       /* Convert Country code of IMSI */
+       if(country_code <= 999) {
+               digit = min_to_digit[country_code/100];
+               imsi[p_digit++] = digit;
+               country_code %= 100;
+
+               digit = min_to_digit[country_code / 10];
+               imsi[p_digit++] = digit;
+
+               digit = min_to_digit[country_code % 10];
+               imsi[p_digit++] = digit;
+
+       } else {
+               err("Invalid Country code");
+               return -1;
+       }
 
-       tcore_check_return_value_assert(enc_sst != NULL, FALSE);
-       tcore_check_return_value_assert(enc_sst_len != 0, FALSE);
+       /* Convert Network code of IMSI */
+       if(nw_code <= 99) {
+               digit = min_to_digit[nw_code / 10];
+               imsi[p_digit++] = digit;
 
-       memset((void*)dec_sst, 0, TEL_SIM_SST_SERVICE_CNT_MAX);
+               digit = min_to_digit[nw_code % 10];
+               imsi[p_digit++] = digit;
+       } else {
+               err("Invalid Network code");
+               return -1;
+       }
 
-       if (enc_sst_len == 0 || enc_sst_len > TEL_SIM_SST_LEN_MAX) {
-               err("invalid length");
-               return FALSE;
+       /* Convert First Three Digits of IMSI */
+       if (imsi_min2 <= 999) {
+               digit = min_to_digit[imsi_min2 / 100];
+               imsi[p_digit++] = digit;
+               imsi_min2 %= 100;
+
+               digit = min_to_digit[imsi_min2 / 10];
+               imsi[p_digit++] = digit;
+
+               digit = min_to_digit[imsi_min2 % 10];
+               imsi[p_digit++] = digit;
+       } else {
+               err("Invalid IMSI_MIN2 code");
+               return -1;
        }
 
-       // get count of SIM service id. one byte has four service status.
-       svc_count = enc_sst_len * 4;
+       /* Convert Last Seven digits of IMSI */
+    second_three = (imsi_min1 & 0x00FFC000) >> 14;
+    thousands = (imsi_min1 & 0x00003C00) >> 10;
+    last_three = (imsi_min1 & 0x000003FF) >> 0;
 
-       /*3GPP 51.011 SST shows 56 kinds of service types. current char *p_sst has also 56 elements*/
-       if (svc_count > TEL_SIM_SST_SERVICE_CNT_MAX)
-               svc_count = TEL_SIM_SST_SERVICE_CNT_MAX;
+    thousands = bcd_to_num[thousands];
+    if ((thousands != 0xFF) && (second_three <= 999) && (last_three <= 999)) {
+               digit = min_to_digit[second_three / 100];
+               imsi[p_digit++] = digit;
 
-       for (i = 0; i < svc_count; i++) {
-               sst_byte = enc_sst[(sim_service_id - 1) / 4];
-               rast = sim_service_id - 4 * (sim_service_id / 4);
+               second_three %= 100;
 
-               switch (rast) {
-               case 0:
-                       mask = 0x80;
-               break;
-               case 1:
-                       mask = 0x02;
-               break;
-               case 2:
-                       mask = 0x08;
-               break;
-               case 3:
-                       mask = 0x20;
-               break;
-               }
+               digit = min_to_digit[second_three / 10];
+               imsi[p_digit++] = digit;
 
-               if (sst_byte & mask)
-                       *dec_sst = 1;
-               else
-                       *dec_sst = 0;
+               digit = min_to_digit[second_three % 10];
+               imsi[p_digit++] = digit;
+
+               imsi[p_digit++] = thousands;
 
-               *dec_sst += sizeof(char);
-               sim_service_id++;       // next service id
+               digit = min_to_digit[last_three / 100];
+               imsi[p_digit++] = digit;
+
+               last_three %= 100;
+
+               digit = min_to_digit[last_three / 10];
+               imsi[p_digit++] = digit;
+
+               digit = min_to_digit[last_three % 10];
+               imsi[p_digit++] = digit;
+    } else {
+               err("Invalid IMSI_MIN1 code");
+               return -1;
        }
-       return TRUE;
+       return p_digit;
 }
 
-gboolean tcore_sim_decode_spn(unsigned char *enc_spn, int enc_spn_len, TelSimSpn *dec_spn)
+/**
+ * This function is used to decode 3 bytes of plmn string encoded as TS 24.008 to 6 bytes char string.
+ *
+ * @return          void       .
+ * @param[out]         out     decoded output string (must be 6 + 1 bytes)
+ * @param[in]          in      encoded input string (must be 3 bytes)
+ * @remark
+ */
+static void _decode_plmn(const unsigned char* in, unsigned char* out)
 {
+       unsigned char temp[6 + 1] = {0,};
        int i;
+       unsigned char higher, lower;
+
+       for (i = 0; i < 3; i++) {
+               higher = (in[i] >> 4) & 0x0F;   // get high nibble
+               if (higher < 0x0A) {
+                       // if it is a number
+                       temp[i*2] = higher + 0x30;
+               } else if (higher == 0x0D) {
+                       // 0x0D (BCD digit) is regarded as wild character by TS 24.008
+                       temp[i*2] = 'D';
+               } else {
+                       temp[i*2] = 0x00;
+               }
 
-       tcore_check_return_value_assert(enc_spn != NULL, FALSE);
-       tcore_check_return_value_assert(enc_spn_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_spn != NULL, FALSE);
+               lower = in[i] & 0x0F;   // get low nibble
+               if (lower < 0x0A) {
+                       // if it is a number
+                       temp[i*2 + 1] = lower + 0x30;
+               } else if (lower == 0x0D) {
+                       // 0x0D (BCD digit) is regarded as wild character by TS 24.008
+                       temp[i*2 + 1] = 'D';
+               } else {
+                       temp[i*2 + 1] = 0x00;
+               }
+       }
 
-       dec_spn->display_condition = enc_spn[0];
-       dbg( "The display condition is [%d]", dec_spn->display_condition);
+       // according to PLMN digits order by TS 24.008
+       // MCC
+       out[0] = temp[1];
+       out[1] = temp[0];
+       out[2] = temp[3];
+       // MNC
+       out[3] = temp[5];
+       out[4] = temp[4];
+       out[5] = temp[2];
 
-       for (i = 1; i < TEL_SIM_SPN_LEN_MAX + 1; i++) {
-               if (enc_spn[i] == 0xFF)
-                       break; /* loop break*/
+       out[6] = '\0';
 
-               dec_spn->spn[i - 1] = enc_spn[i];
-               dbg("EF-SPN name[%d][%c]", i, enc_spn[i]);
+       /*
+        * [14.08.21]
+        * As NA Operators requested,
+        * for NA operators (MCC 310 ~ 316),
+        * if 6th digit of MNC is 'F' then should be regarded as '0'.
+        */
+       if (out[5] == 0x00 &&
+                       strncmp((const char*)out, "31", 2) == 0 &&
+                       ('0' <= out[2] && out[2] <= '6')){
+               out[5] = '0';
        }
-       dec_spn->spn[i-1] = '\0';
-
-       return TRUE;
 }
 
-gboolean tcore_sim_decode_spdi(unsigned char *enc_spdi, int enc_spdi_len, TelSimSpPlmnList *dec_spdi)
+/**
+ * According to ETSI 102.221 ( 3GPP specification refers it ), EF-ICCID is coded by BCD, left justified and padded with 'F'.
+ * This EF is mandatory and byte length is fixed with 10 bytes. So actual maximum length of ICCID is 20 digits.
+ */
+gboolean tcore_sim_decode_iccid(struct tel_sim_iccid *p_out, unsigned char *p_in, int in_length)
 {
-       unsigned int i, src_plmn_start_len;
+       int bcd_byte = 0;
+       int char_length = 0;
 
-       tcore_check_return_value_assert(enc_spdi != NULL, FALSE);
-       tcore_check_return_value_assert(enc_spdi_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_spdi != NULL, FALSE);
+       if (p_in == NULL || p_out == NULL)
+               return FALSE;
 
-       if (enc_spdi[0] == 0xff){
-               dbg("file is exist but there is no valid records");
-               dec_spdi->count = 0;
-               dec_spdi->list = NULL;
-               return TRUE;
-       }
+       if (in_length == 0 || in_length > 10)
+               return FALSE;
 
-       //Display info tag('A3')
-       if (enc_spdi[0] == 0xA3) {
-                //PLMN list tag('80')
-               if (enc_spdi[2] == 0x80) {
-                       dec_spdi->count = enc_spdi[3] / 3;
+       memset((void*) p_out->iccid, 0, SIM_ICCID_LEN_MAX+1);
 
-                       /*
-                        *  plmn tag 1byte
-                        *  length 1byte
-                        *  each plmn entry 3byte
-                        */
-                       if (dec_spdi->count > TEL_SIM_SPDI_PLMN_MAX)
-                               dec_spdi->count = TEL_SIM_SPDI_PLMN_MAX;
-
-                       src_plmn_start_len = 4;
-
-                       dbg( "dec_spdi->num_of_plmn_entries[%d]", dec_spdi->count);
-                       /* Allocate resources */
-                       dec_spdi->list = tcore_malloc0(sizeof(TelSimSpPlmn) * dec_spdi->count);
-
-                       for (i = 0; i < dec_spdi->count; i++) {
-                               unsigned char packet_in_digit[3 * 2 + 1];
-                               tcore_util_convert_bcd_to_digit((char*) packet_in_digit, (char*) &enc_spdi[src_plmn_start_len], 3);
-                               /* Allocate resources */
-                               dec_spdi->list[i].plmn = tcore_malloc0(6 + 1);
-                               // get MCC (mobile country code)
-                               memcpy(dec_spdi->list[i].plmn, &(packet_in_digit[0]), 6);
-                               dec_spdi->list[i].plmn[6] = '\0';
-                               dbg( "SPDI PLMN[%d][%s]", i, dec_spdi->list[i].plmn);
-
-                               src_plmn_start_len = src_plmn_start_len + 3;
-                       }
-                       return TRUE;
-               }
-               dbg("Current EF-SPDI has invalid data");
-               return FALSE;
-       }
-       dbg("Current EF-SPDI has invalid data");
-       return FALSE;
+       bcd_byte = _get_valid_bcd_byte(p_in, in_length);
+       char_length = _bcd_to_digit(p_out->iccid, (char*) p_in, bcd_byte);
+       dbg( "bcd byte:[%d] string length:[%d]", bcd_byte, char_length);
+
+       *(p_out->iccid+char_length) = '\0';
+
+       return TRUE;
 }
 
-gboolean tcore_sim_decode_msisdn(unsigned char *enc_msisdn,
-       int enc_msisdn_len, TelSimSubscriberInfo *dec_msisdn)
+/**
+ * This function is used to decode EFLP (2G)
+ */
+gboolean tcore_sim_decode_lp(struct tel_sim_language *p_out, unsigned char *p_in, int in_length)
 {
-       int X = 0;      // alpha id max length
-       int alpha_id_length = 0;
-       int value_length = 0;
-       int bcd_byte = 0;       // dialing number max length
+       int i = 0;
 
-       tcore_check_return_value_assert(enc_msisdn != NULL, FALSE);
-       tcore_check_return_value_assert(enc_msisdn_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_msisdn != NULL, FALSE);
+       memset((void*) p_out, 0xFF, sizeof(struct tel_sim_language));
+       p_out->language_count = 0;
 
-       if (tcore_util_is_empty(enc_msisdn, enc_msisdn_len) == TRUE) {
-               err("empty record");
+       if (in_length == 0)
                return FALSE;
-       }
+       /*
+        * Description of problem: language decoding was not correctly done if we used 7layers's test SIM
+        * Patch Description : The tested SIM  at 7layers has 3 language codes like [ff][ff][01].
+        In this case we could not decode 3rd language code.
+        So, the below 2 lines checking the UNSPECIFIED language are commented.
+        */
 
-       X = enc_msisdn_len - 14;        // get alpha id max length
+       if (in_length > SIM_LANG_CNT_MAX)
+               in_length = SIM_LANG_CNT_MAX;
 
-       if (X != 0) {
-               alpha_id_length = X;
-               dbg("alpha_id_length[%d]", alpha_id_length);
-               if (alpha_id_length > TEL_SIM_XDN_ALPHA_ID_LEN_MAX)
-                       alpha_id_length = TEL_SIM_XDN_ALPHA_ID_LEN_MAX;
+       for (i = 0; i < in_length; i++) {
+               /*
+                * Description of problem: Language decoding was not correctly done if we used some test SIM
+                * Patch Description : Test SIM at some place has 3 language codes like  [ff][ff][01].
+                * In this case we could not decode 3rd language code.
+                * So, the below 2 lines checking the UNSPECIFIED language are commented.
+                */
+               if (p_in[i] == 0xFF)
+                       continue;
 
-               dec_msisdn->alpha_id = tcore_malloc0(alpha_id_length + 1);
-               value_length = tcore_util_get_string((guchar *)dec_msisdn->alpha_id,
-                       enc_msisdn, alpha_id_length);
-               dec_msisdn->alpha_id[value_length] = '\0';
+               p_out->language[p_out->language_count] = (enum tel_sim_language_type) p_in[i];
+               dbg( "p_out->language[%d]=[%d] ", i, p_out->language[p_out->language_count]);
+               p_out->language_count++;
        }
+       dbg( "in_length %d, lang_cnt %d ", in_length, p_out->language_count);
+       return TRUE;
+}
 
-       // get dialing number length
-       // in[X] is BCD length of dialing number length plus TON/NPI 1 bytes.
-       // Convert to digit length and subtract TON/NPI length.
-       if (enc_msisdn[X] != 0xFF) {
-               dbg( "Dialing number Length %d, BCD length 0x%x ",  (enc_msisdn[X] - 1) * 2, enc_msisdn[X]);
+/**
+ * This function is used to encode EFLP (2G)
+ */
+char* tcore_sim_encode_lp( int *out_length, struct tel_sim_language *p_in)
+{
+    int i = 0;
+    char *tmp_out = NULL;
 
-               // get TON and NPI
-               //p_msisdn->ton = (in[X + 1] >> 4) & 0x07;
+    if ( out_length == NULL || p_in == NULL ){
+        dbg("out_length or p_in is null");
+        return NULL;
+    }
 
-               // get actual dialing number length
-               bcd_byte = (int) tcore_util_get_valid_bcd_byte(&enc_msisdn[X + 2], TEL_SIM_XDN_NUMBER_LEN_MAX / 2);
-               dbg( "bcd_byte[%x]", bcd_byte);
+    tmp_out = (char*)malloc(p_in->language_count);
+    memset((void*) tmp_out, 0xff, p_in->language_count);
 
-               // get dialing number/SSC string
-               dec_msisdn->num = tcore_malloc0((bcd_byte * 2) + 1);
-               value_length = tcore_util_convert_bcd_to_digit((char*)dec_msisdn->num,
-                       (char*) &enc_msisdn[X + 2], bcd_byte); // actual dialing number length in BCD.
-               dec_msisdn->num[value_length] = '\0';
-               dbg( "dec_msisdn->num[%s]", dec_msisdn->num);
-       }
-       return TRUE;
+    for (i = 0; i < p_in->language_count; i++)
+        tmp_out[i] = p_in->language[i];
+
+    *out_length = i;
+    return tmp_out;
 }
 
-gboolean tcore_sim_decode_xdn(unsigned char *enc_xdn, int enc_xdn_len,
-       char *alpha_id, unsigned int *alpha_id_len, char *num)
+/**
+ * This function is used to decode LI (3G)
+ */
+gboolean tcore_sim_decode_li(enum tel_sim_file_id file_id, struct tel_sim_language *p_out, unsigned char *p_in, int in_length)
 {
-       int X = 0;      // alpha id max length
-       int bcd_byte;   // dialing number max length
+       int i;
+       unsigned short defaultLi;
+       unsigned char tempLi[3] = { 0, 0, 0 };
 
-       memset((void*) alpha_id, 0, TEL_SIM_XDN_ALPHA_ID_LEN_MAX);
-       memset((void*) num, 0, TEL_SIM_XDN_NUMBER_LEN_MAX);
+       memset((void*) p_out, 0xFF, sizeof(struct tel_sim_language));
+       p_out->language_count  = 0;
 
-       tcore_check_return_value_assert(enc_xdn != NULL, FALSE);
-       tcore_check_return_value_assert(enc_xdn_len != 0, FALSE);
+       if (in_length == 0)
+               return FALSE;
 
-       if (tcore_util_is_empty(enc_xdn, enc_xdn_len) == TRUE) {
-               err("empty record");
-               return FALSE;   // this is empty record
+       /*
+        * Description of problem: language decoding was not correctly done if we used 7layers's test SIM
+        * Patch Description : TS31.102 If the EFLI has the value 'FFFF' in its highest priority position,
+        then the preferred language selection shall be the language preference in the EFPL
+        */
+       if (/*TODO g_sim.CardType == SIM_TYPE_USIM && */(file_id == SIM_EF_USIM_LI || file_id == SIM_EF_LP)) {
+               defaultLi = p_in[0];
+               defaultLi = ((defaultLi << 8) & 0xFF00) + p_in[1];
+
+               if (defaultLi == 0xFFFF)        // 1st language is default.
+                       return FALSE;
+       }
+
+       if (in_length > SIM_LANG_CNT_MAX)
+               in_length = SIM_LANG_CNT_MAX;
+
+       for (i = 0; i < in_length; i++) {
+               tempLi[0] = p_in[i++];
+               tempLi[1] = p_in[i];
+/*
+                Description of problem: language decoding was not correctly done if we used 7layers's test SIM
+                Patch Description : The tested SIM at specific test lab has 3 language codes like [ff][ff][ff][ff][64][65].
+                In this case we could not decode 3rd language code.
+                So, the below 2 lines checking the UNSPECIFIED language are commented.
+*/
+               if (tempLi[0] == 0xFF || tempLi[1] == 0xFF)  //this is always 2 bytes
+                       continue;
+
+               p_out->language[p_out->language_count] = SIM_LANG_UNSPECIFIED;
+
+               if (tempLi[0] == 'e') {
+                       switch (tempLi[1]) {
+                               case 'n':
+                                       p_out->language[p_out->language_count] = SIM_LANG_ENGLISH;
+                                       break;
+                               case 's':
+                                       p_out->language[p_out->language_count] = SIM_LANG_SPANISH;
+                                       break;
+                               case 'l':
+                                       p_out->language[p_out->language_count] = SIM_LANG_GREEK;
+                                       break;
+                               default:
+                                       warn("invalid language");
+                                       break;
+                       }
+               } else if (tempLi[0] == 'd') {
+                       switch (tempLi[1]) {
+                               case 'e':
+                                       p_out->language[p_out->language_count] = SIM_LANG_GERMAN;
+                                       break;
+
+                               case 'a':
+                                       p_out->language[p_out->language_count] = SIM_LANG_DANISH;
+                                       break;
+                               default:
+                                       warn("invalid language");
+                                       break;
+                       }
+               } else if (tempLi[0] == 'i' && tempLi[1] == 't') {
+                       p_out->language[p_out->language_count] = SIM_LANG_ITALIAN;
+               } else if (tempLi[0] == 'f' && tempLi[1] == 'r') {
+                       p_out->language[p_out->language_count] = SIM_LANG_FRENCH;
+               } else if (tempLi[0] == 'n' && tempLi[1] == 'l') {
+                       p_out->language[p_out->language_count] = SIM_LANG_DUTCH;
+               } else if (tempLi[0] == 's' && tempLi[1] == 'v') {
+                       p_out->language[p_out->language_count] = SIM_LANG_SWEDISH;
+               } else if (tempLi[0] == 'f' && tempLi[1] == 'i') {
+                       p_out->language[p_out->language_count] = SIM_LANG_FINNISH;
+               } else if (tempLi[0] == 'n' && tempLi[1] == 'o') {
+                       p_out->language[p_out->language_count] = SIM_LANG_NORWEGIAN;
+               } else if (tempLi[0] == 't' && tempLi[1] == 'r') {
+                       p_out->language[p_out->language_count] = SIM_LANG_TURKISH;
+               } else if (tempLi[0] == 'h' && tempLi[1] == 'u') {
+                       p_out->language[p_out->language_count] = SIM_LANG_HUNGARIAN;
+               } else if (tempLi[0] == 'p') {
+                       switch (tempLi[1]) {
+                               case 'l':
+                                       p_out->language[p_out->language_count] = SIM_LANG_POLISH;
+                                       break;
+                               case 't':
+                                       p_out->language[p_out->language_count] = SIM_LANG_PORTUGUESE;
+                                       break;
+                               default:
+                                       warn("invalid language");
+                                       break;
+                       }
+               } else if (tempLi[0] == 'k' && tempLi[1] == 'o') {
+                       p_out->language[p_out->language_count] = SIM_LANG_KOREAN;
+               } else if (tempLi[0] == 'z' && tempLi[1] == 'h') {
+                       p_out->language[p_out->language_count] = SIM_LANG_CHINESE;
+               } else if (tempLi[0] == 'r' && tempLi[1] == 'u') {
+                       p_out->language[p_out->language_count] = SIM_LANG_RUSSIAN;
+               } else if (tempLi[0] == 'j' && tempLi[1] == 'a') {
+                       p_out->language[p_out->language_count] = SIM_LANG_JAPANESE;
+               }
+
+               dbg( "count %d & Codes %d ", p_out->language_count, p_out->language[p_out->language_count]);
+               p_out->language_count++;
+       }
+
+       if (p_out->language_count == 0) {
+               dbg( "p_out->language_count = %d ", p_out->language_count);
+               return FALSE;
+       }
+       else {
+               return TRUE;
+       }
+}
+
+/**
+ * This function is used to encode EFLI (3G)
+ */
+char* tcore_sim_encode_li( int *out_length, struct tel_sim_language *p_in)
+{
+       int i = 0;
+       char *tmp_out = NULL; 
+       const char *LanguageCode[] = { "de", "en", "it", "fr", "es", "nl", "sv", "da", "pt", "fi", "no", "el",
+                                                                                                       "tr", "hu", "pl", "ko", "zh", "ru", "ja" };
+
+    if ( out_length == NULL || p_in == NULL ){
+        dbg("out_length or p_in is null");
+        return NULL;
+    }
+
+    tmp_out = (char*)malloc((p_in->language_count) *2);
+    memset((void*) tmp_out, 0xff, (p_in->language_count)*2);
+
+       for (i = 0; i < p_in->language_count; i++) {
+               if (p_in->language[i] < SIM_LANG_UNSPECIFIED) {
+                       strncpy((char *) &tmp_out[i * 2], LanguageCode[p_in->language[i]], 2);
+                       dbg( "sim_encode_li: p_out[%s]:[%x][%x]", tmp_out, tmp_out[i*2], tmp_out[(i*2)+1]);
+               }
+       }
+       *out_length = i*2;
+       return tmp_out;
+}
+
+gboolean tcore_sim_decode_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length)
+{
+       int i = 0, j = 0;
+       char imsi_raw[16];
+       char *plmn = NULL;
+       int plmn_digits = 5;
+
+       if ((NULL == p_out) || (NULL == p_in))
+               return FALSE;
+
+       /*
+               According to 3GPP specification, the length of raw IMSI data is 9 bytes.
+               first byte is length of IMSI
+               second byte byte has parity nibble, so second byte has one digit of IMSI. other byte has two digit of IMSI
+       */
+       if ((in_length == 0) || (in_length == 0xff) || (4 > in_length) || (9 <in_length)) {
+               dbg("No valid IMSI present to convert - length:[%x]",   in_length);
+               return FALSE;
+       }
+
+       /* Decode IMSI value from nibbles */
+       for (i = 1; i < in_length; i++) {
+               if (i == 1) { /* first byte, ignore lower nibble */
+                       imsi_raw[j++] = ((p_in[i] & 0xF0) >> 4) + '0';
+               } else if (i == p_in[0]+1) { /* last byte */
+                       imsi_raw[j++] = (p_in[i] & 0x0F)+ '0';
+                       if (p_in[0]%2) /* count the last one if odd digits */
+                               imsi_raw[j++] = ((p_in[i] & 0xF0) >> 4) + '0';
+               } else {
+                       imsi_raw[j++] = (p_in[i]  & 0x0F) + '0';
+                       imsi_raw[j++] = ((p_in[i] & 0xF0) >> 4) + '0';
+               }
+       }
+
+       /* Determine # of PLMN digits (5 or 6) */
+       plmn = g_strndup(imsi_raw, 6 + 1);
+       if (plmn) {
+               plmn[6] = '\0';
+               if(tcore_sim_check_plmn_having_3digits_mnc(plmn)) {
+                       plmn_digits = 6;
+               }
+               g_free(plmn);
+       }
+
+       /* Terminate string */
+       imsi_raw[j] = '\0';
+       memcpy(p_out->plmn, imsi_raw, plmn_digits);
+       p_out->plmn[plmn_digits] = '\0';
+       memcpy(p_out->msin, imsi_raw + plmn_digits, strlen(imsi_raw) - plmn_digits);
+       p_out->msin[strlen(imsi_raw) - plmn_digits] = '\0';
+
+       dbg("plmn in imsi = [%s]", p_out->plmn);
+
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_cdma_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length)
+{
+       char imsi_raw[16]={0,};
+       int digits = 0;
+       unsigned short mcc;
+       unsigned char mnc;
+       unsigned long min1;
+       unsigned short min2;
+       char *plmn = NULL;
+       int plmn_digits = 5;
+
+       if ((NULL == p_out) || (NULL == p_in))
+               return FALSE;
+
+       /*
+       According to 3GPP2 specification, the length of raw IMSI data is 10 bytes.
+               byte    Description
+                  1            Class assignment of IMSI_M
+                2-3    IMSI_M_S2 : MSIN2
+                4-6    IMSI_M_S1 : MSIN1
+                  7            IMSI_M_11_12 : MNC
+                  8            IMSI_M_ADDR_NUM : No of IMSI_M address digits.
+                9-10   MCC_M : MCC
+
+       */
+       if ((in_length == 0) || (in_length == 0xff) || (4 > in_length) || (10 < in_length)) {
+               dbg("No valid IMSI present to convert - length:[%x]",   in_length);
+               return FALSE;
+       }
+
+       /* Decode IMSI value from nibbles */
+       mcc = (p_in[9] << 8) | p_in[8];
+       mnc = p_in[6];
+       min1 = (p_in[5] << 16) | (p_in[4] << 8) | (p_in[3]);
+       min2 = (p_in[2] << 8) | p_in[1];
+
+       digits = _decode_cdma_imsi_util(imsi_raw, &mcc, &mnc, &min1, &min2);
+
+       if (digits < 0)
+               return FALSE;
+
+       /* Determine # of PLMN digits (5 or 6) */
+       plmn = g_strndup(imsi_raw, 6 + 1);
+       if (plmn) {
+               plmn[6] = '\0';
+               if(tcore_sim_check_plmn_having_3digits_mnc(plmn)) {
+                       plmn_digits = 6;
+               }
+               g_free(plmn);
+       }
+
+       /* Terminate string */
+       imsi_raw[digits] = '\0';
+       memcpy(p_out->plmn, imsi_raw, plmn_digits);
+       p_out->plmn[plmn_digits] = '\0';
+       memcpy(p_out->msin, imsi_raw + plmn_digits, strlen(imsi_raw) - plmn_digits);
+       p_out->msin[strlen(imsi_raw) - plmn_digits] = '\0';
+
+       dbg("plmn in imsi = [%s]", p_out->plmn);
+
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_sst(struct tel_sim_sst *p_sst, unsigned char *p_in, int in_length)
+{
+       unsigned char sstByte, rast, mask = 0;
+       char simServiceID = 1;  // set "CHV1 disable function"
+       int i, svc_count;
+       char *p_index;
+
+       memset((void*)p_sst, 0, sizeof(struct tel_sim_sst));
+
+       if (in_length == 0) {
+               err("invalid length. return FALSE.");
+               return FALSE;
+       }
+
+       // get count of SIM service id. one byte has four service status.
+       svc_count = in_length * 4;
+
+       /*3GPP 51.011 SST shows 56 kinds of service types. current tel_sim_sst has also 56 elements*/
+       if (svc_count > SIM_SST_SERVICE_CNT_MAX) {
+               warn("out of range[%d]. cut off the tail.", svc_count);
+               svc_count = SIM_SST_SERVICE_CNT_MAX;
+       }
+
+       p_index = (char*)p_sst;
+
+       for (i = 0; i < svc_count; i++) {
+               sstByte = p_in[(simServiceID - 1) / 4];
+               rast = simServiceID - 4 * (simServiceID / 4);
+
+               switch (rast) {
+                       case 1:
+                               mask = 0x02;
+                               break;
+                       case 2:
+                               mask = 0x08;
+                               break;
+                       case 3:
+                               mask = 0x20;
+                               break;
+                       case 0:
+                               mask = 0x80;
+                               break;
+                       default:
+                               warn("invalid rast");
+                               break;
+               }
+
+               if (sstByte & mask)
+                       *p_index = 1;
+               else
+                       *p_index = 0;
+
+               p_index += sizeof(char);
+               simServiceID++; // next service id
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_cdma_st(struct tel_sim_cst *p_cdma_st, unsigned char *p_in, int in_length)
+{
+       unsigned char sstByte, rast, mask = 0;
+       char simServiceID = 1;  // set "CHV1 disable function"
+       int i, svc_count;
+       char *p_index;
+
+       memset((void*)p_cdma_st, 0, sizeof(struct tel_sim_cst));
+
+       if (in_length == 0 || in_length > SIM_CDMA_ST_SERVICE_LEN_MAX)
+               return FALSE;
+
+       // get count of SIM service id. one byte has four service status.
+       svc_count = in_length * 4;
+
+       /*CDMA_ST service is described to 47(1 byte includes 4 service status) in C.S0023 3.4.18.
+           Current tel_sim_cst.serivce.cdma_service has 47 services. so in_length should be under 12 byte. */
+       if (svc_count > SIM_CDMA_ST_SERVICE_CNT_MAX)
+               svc_count = SIM_CDMA_ST_SERVICE_CNT_MAX;
+
+       p_cdma_st->cdma_svc_table = SIM_CDMA_SVC_TABLE;
+
+       p_index = (char*)p_cdma_st->service.cdma_service;
+
+       for (i = 0; i < svc_count; i++) {
+               sstByte = p_in[(simServiceID - 1) / 4];
+               rast = simServiceID - 4 * (simServiceID / 4);
+
+               switch (rast) {
+                       case 1:
+                               mask = 0x02;
+                               break;
+                       case 2:
+                               mask = 0x08;
+                               break;
+                       case 3:
+                               mask = 0x20;
+                               break;
+                       case 0:
+                               mask = 0x80;
+                               break;
+                       default:
+                               warn("invalid rast");
+                               break;
+               }
+
+               if (sstByte & mask)
+                       *p_index = 1;
+               else
+                       *p_index = 0;
+
+               p_index += sizeof(char);
+               simServiceID++; // next service id
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_csim_st(struct tel_sim_cst *p_csim_st, unsigned char *p_in, int in_length)
+{
+       int i, j;
+       char mask;
+       char *p_index;
+       memset((void*) p_csim_st, 0, sizeof(struct tel_sim_cst));
+
+       p_csim_st->cdma_svc_table = SIM_CSIM_SVC_TABLE;
+       p_index = (char*)p_csim_st->service.csim_service;
+
+       /*CSIM_ST service is described to 41(1 byte includes 8 service status) in C.S0065 5.2.18.
+           Current tel_sim_cst.serivce.csim_service has 41 services. so in_length should be under 6 byte. */
+       if (in_length > SIM_CSIM_ST_SERVICE_LEN_MAX)
+               in_length = SIM_CSIM_ST_SERVICE_LEN_MAX;
+
+       for (i = 0; i < in_length; i++) {
+               mask = 0x01;    // reset mask to check first bit
+
+               for (j = 0; j < 8; j++) {
+                       if (p_in[i] & mask) {
+                               *p_index = 1;
+                       }
+                       p_index += sizeof(char);
+                       mask = mask << 1;
+               }
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_spn(struct tel_sim_spn *p_spn, unsigned char *p_in, int in_length)
+{
+       int i;
+
+       if (in_length == 0)
+               return FALSE;
+
+       p_spn->display_condition = p_in[0] & 0x3;
+
+       for (i = 1; i < SIM_SPN_LEN_MAX + 1; i++) {
+               if (p_in[i] == 0xFF)
+                       break; /* loop break*/
+
+               p_spn->spn[i - 1] = p_in[i];
+       }
+       p_spn->spn[i-1] = '\0';
+
+       dbg( "spn:[%s] display condition : [%d]", p_spn->spn, p_spn->display_condition);
+
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_cdma_spn(struct tel_sim_spn *p_spn, unsigned char *p_in, int in_length)
+{
+       int i=0;
+
+       if (in_length == 0)
+               return FALSE;
+
+       p_spn->display_condition = p_in[0] & 0x1;
+
+       /*Note : Character Encoding (1 byte) and Language Indicator (1 byte)
+           are ignored, will be added later if required by Application */
+
+       for (i = 3; i < SIM_CDMA_SPN_LEN_MAX + 1; i++) {
+               if (p_in[i] == 0xFF)
+                       break; /* loop break*/
+
+               p_spn->spn[i - 3] = p_in[i];
+       }
+       p_spn->spn[i-3] = '\0';
+
+       dbg( "spn:[%s] display condition : [%d]", p_spn->spn, p_spn->display_condition);
+
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_spdi(struct tel_sim_spdi *p_spdi, unsigned char *p_in, int in_length)
+{
+       int i, Src_plmn_start_len, total_data_len;
+
+       if (in_length == 0)
+               return FALSE;
+
+       if(p_in[0] == 0xff){
+               dbg("file is exist but there is no valid records");
+               p_spdi->plmn_count = 0;
+               memset(p_spdi->list, 0x00, sizeof(unsigned char)*7*SIM_SPDI_PLMN_MAX);
+               return TRUE;
+       }
+
+       //Display info tag('A3')
+       if (p_in[0] == 0xA3) {
+               total_data_len = p_in[1];
+               dbg("total_data_len=[%d]", total_data_len);
+                //PLMN list tag('80')
+               if (p_in[2] == 0x80) {
+                       p_spdi->plmn_count = p_in[3] / 3;
+
+                       /*
+                        *  plmn tag 1byte
+                        *  length 1byte
+                        *  each plmn entry 3byte
+                        */
+                       if (p_spdi->plmn_count > SIM_SPDI_PLMN_MAX)
+                               p_spdi->plmn_count =    SIM_SPDI_PLMN_MAX;
+
+                       Src_plmn_start_len = 4;
+
+                       dbg( "p_spdi->num_of_plmn_entries[%d]", p_spdi->plmn_count);
+
+                       for (i = 0; i < p_spdi->plmn_count; i++) {
+                               _decode_plmn(&p_in[Src_plmn_start_len], p_spdi->list[i].plmn);
+                               dbg( "SPDI PLMN[%d][%s]", i, p_spdi->list[i].plmn);
+
+                               Src_plmn_start_len = Src_plmn_start_len + 3;
+                       }
+                       return TRUE;
+               }
+               dbg("Current EF-SPDI has invalid data");
+               return FALSE;
+       }
+       dbg("Current EF-SPDI has invalid data");
+       return FALSE;
+}
+
+gboolean tcore_sim_decode_msisdn(struct tel_sim_msisdn *p_msisdn, unsigned char *p_in, int in_length)
+{
+       int X = 0;      // alpha id max length
+       int alpha_id_length = 0;
+       int value_length = 0;
+       int bcd_byte = 0;       // dialing number max length
+
+       memset((void*) p_msisdn, 0, sizeof(struct tel_sim_msisdn));
+
+       if (in_length < 14) {
+               err("invalid in_length[%d]", in_length);
+               return FALSE;
+       }
+
+       if (_is_empty(p_in, in_length) == TRUE) {
+               memset(p_msisdn, 0, sizeof(struct tel_sim_msisdn));
+               return FALSE;
+       }
+
+       X = in_length - 14;     // get alpha id max length
+
+       if (X != 0) {
+               alpha_id_length = X;
+               dbg("alpha_id_length[%d]", alpha_id_length);
+               if(alpha_id_length > SIM_XDN_ALPHA_ID_LEN_MAX)
+                       alpha_id_length = SIM_XDN_ALPHA_ID_LEN_MAX;
+
+               value_length =  _get_string((unsigned char *)p_msisdn->name, p_in, alpha_id_length);
+               p_msisdn->name[value_length] = '\0';
+       }
+
+       // get dialing number length
+       // p_in[X] is BCD length of dialing number length plus TON/NPI 1 bytes.
+       // Convert to digit length and subtract TON/NPI length.
+       if (p_in[X] != 0xFF) {
+               dbg( "Dialing number Length %d, BCD length 0x%x ",  (p_in[X] - 1) * 2, p_in[X]);
+
+               // get TON and NPI
+               p_msisdn->ton = (p_in[X + 1] >> 4) & 0x07;
+
+               // get actual dialing number length
+               bcd_byte = _get_valid_bcd_byte(&p_in[X + 2], SIM_XDN_NUMBER_LEN_MAX / 2);
+               dbg( "bcd_byte[%x]", bcd_byte);
+
+               // get dialing number/SSC string
+               value_length = _bcd_to_digit((char*) p_msisdn->num, (char*) &p_in[X + 2], bcd_byte); // actual dialing number length in BCD.
+               p_msisdn->num[value_length] = '\0';
+               p_msisdn->next_record = p_in[X+13];
+               dbg( "p_msisdn->num[%s]", p_msisdn->num);
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_mdn(struct tel_sim_msisdn *p_msisdn, unsigned char *p_in, int in_length)
+{
+       int value_length = 0;
+       int bcd_byte = 0;       // dialing number max length
+
+       memset((void*) p_msisdn, 0, sizeof(struct tel_sim_msisdn));
+
+       if (in_length == 0)
+               return FALSE;
+
+       if (_is_empty(p_in, in_length) == TRUE) {
+               return FALSE;
+       }
+
+       /*Note : Alpha identifier is not present in EF-MDN file.*/
+       if (p_in[0] != 0xFF) {
+               dbg( "Dialing number Length %d, BCD length 0x%x ",  (p_in[0] - 1) * 2, p_in[0]);
+
+               // get TON and NPI
+               p_msisdn->ton = (p_in[9] >> 4) & 0x07;
+
+               // get actual dialing number length
+               bcd_byte = _get_valid_bcd_byte(&p_in[1], 8);
+               dbg( "bcd_byte[%x]", bcd_byte);
+
+               // get dialing number/SSC string
+               value_length = _bcd_to_digit((char*) p_msisdn->num, (char*) &p_in[1], bcd_byte); // actual dialing number length in BCD.
+               p_msisdn->num[value_length] = '\0';
+               /*p_msisdn->next_record = p_in[];*/ //Need to check with next_record field
+               dbg("p_msisdn->num[%s]", p_msisdn->num);
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_xdn(struct tel_sim_dialing_number *p_xdn, unsigned char *p_in, int in_length)
+{
+       int X;  // alpha id max length
+       int bcd_byte;   // dialing number max length
+
+       memset((void*) p_xdn, 0, sizeof(struct tel_sim_dialing_number));
+
+       if (in_length == 0)
+               return FALSE;
+
+       if (_is_empty(p_in, in_length) == TRUE) {
+               return FALSE;   // this is empty record
+       }
+
+       X = in_length - 14;     // get alpha id max length
+
+       if (X != 0) {
+               _get_string((unsigned char *)p_xdn->alpha_id, p_in, X);
+               p_xdn->alpha_id_max_len = X;
+       }
+
+       // get dialing number length
+       // p_in[X] is BCD length of dialing number length plus TON/NPI 1 bytes.
+       // Convert to digit length and subtract TON/NPI length.
+       if (p_in[X] != 0xFF) {
+               dbg( "Dialing number Length %d, BCD length 0x%x ",      (p_in[X] - 1) * 2, p_in[X]);
+
+/*             if (p_xdn->num_max_len > SIM_XDN_NUMBER_LEN_MAX)        {
+
+                        this may be broken record.
+                        p_xdn->b_used = FALSE;
+                        memset((void*)p_xdn, 0, sizeof(tapi_sim_dialing_number_info_t));
+                        return FALSE;
+
+                        ADN record cannot have more than 20 digits. Anyway we can restrict this as per 31.102
+                        X+1    Length of BCD number/SSC contents       M       1 byte
+                        X+2    TON and NPI     M       1 byte
+                        X+3 to X+12    Dialing Number/SSC String       M       10 bytes
+                        X+13   Capability/Configuration1 Identifier    M       1 byte
+                        X+14   Extension1 Record Identifier    M       1 byte
+
+                        Anyway we are doing this check @
+                        bcd_byte = _get_valid_bcd_byte (&p_in[X+2], TAPI_SIM_XDN_DIALING_NUMBER_LEN/2);
+                        by using the 20/2; so don`t return false.
+
+                       if (p_in[X] == 0x00)
+                               p_xdn->num_max_len = 0;
+                       else
+                               p_xdn->num_max_len = SIM_XDN_NUMBER_LEN_MAX;
+               }*/
+
+               // get TON and NPI
+               p_xdn->ton = (p_in[X + 1] >> 4) & 0x07;
+               p_xdn->npi = p_in[X + 1] & 0x0F;
+
+               // get actual dialing number length
+               bcd_byte = _get_valid_bcd_byte(&p_in[X + 2], SIM_XDN_NUMBER_LEN_MAX / 2);
+               dbg( "bcd_byte[%x]", bcd_byte);
+
+               // get dialing number/SSC string
+               _bcd_to_digit((char*) p_xdn->num, (char*) &p_in[X + 2], bcd_byte); // actual dialing number length in BCD.
+               dbg( "p_xdn->DiallingNum[%s]", p_xdn->num);
+               // get Capability/Configuration id
+               p_xdn->cc_id = p_in[X + 12];
+               // get Extension1 id
+               p_xdn->ext1_id = p_in[X + 13];
+       }
+       return TRUE;
+}
+
+char* tcore_sim_encode_xdn(int in_length, struct tel_sim_dialing_number *p_xdn)
+{
+       int alpha_id_space =0, digit_len =0, str_len = 0;
+       char bcdCode[SIM_XDN_NUMBER_LEN_MAX / 2];
+       char * p_out = NULL;
+
+       if (in_length < 14) {
+               dbg("in_length[%d] should be greater than or equal to 14.", in_length)
+               return NULL;
+       }
+
+       p_out = calloc(1, in_length + 1);
+       memset((void*) p_out, 0xFF, in_length);
+
+       // get alpha id max length
+       alpha_id_space = in_length - 14;
+
+       // alpha id is too big
+       str_len = strlen(p_xdn->alpha_id);
+       if (alpha_id_space < str_len) {
+               dbg("SIM space for alpha_id is [%d] but input alpha_id length is [%d]. so we will use [%d] byte",
+                               alpha_id_space, str_len, alpha_id_space);
+               str_len = alpha_id_space;
+       }
+
+       digit_len = strlen(p_xdn->num);
+       // this is digit length
+       if ( digit_len > SIM_XDN_NUMBER_LEN_MAX) {
+               dbg("SIM space for number is [%d] but input number length is [%d]. so we will use [%d] byte",
+                               SIM_XDN_NUMBER_LEN_MAX, digit_len, SIM_XDN_NUMBER_LEN_MAX);
+               digit_len = SIM_XDN_NUMBER_LEN_MAX;
+       }
+
+       _set_string((unsigned char *)p_out, (unsigned char *)p_xdn->alpha_id, str_len);
+
+       // set length of BCD number/SSC contents
+       // p_xdn->diallingnumLen is maximum digit length. = 20 bytes.
+       // convert to BCD length and add 1 byte.
+       p_out[alpha_id_space] = ( (digit_len + 1) / 2 ) + 1;
+
+       // set TON and NPI
+       p_out[alpha_id_space + 1] = 0x80;
+       p_out[alpha_id_space + 1] |= (p_xdn->ton & 0x07) << 4;
+       p_out[alpha_id_space + 1] |= p_xdn->npi & 0x0F;
+
+       // set dialing number/SSC string
+       memset((void*) bcdCode, 0xFF, SIM_XDN_NUMBER_LEN_MAX / 2);
+
+       _digit_to_bcd((char*) bcdCode, (char*) p_xdn->num, digit_len);
+
+       memcpy((void*) &p_out[alpha_id_space + 2], bcdCode, SIM_XDN_NUMBER_LEN_MAX / 2);
+
+       // set Capability/Configuration Identifier
+       if (p_xdn->cc_id == 0x00)
+               p_out[alpha_id_space + 12] = 0xff;
+       else
+               p_out[alpha_id_space + 12] = (unsigned char) p_xdn->cc_id;
+       // set extension1 record Identifier
+       if (p_xdn->ext1_id == 0x00)
+               p_out[alpha_id_space + 13] = 0xff;
+       else
+               p_out[alpha_id_space + 13] = (unsigned char) p_xdn->ext1_id;
+
+       return p_out;
+}
+
+gboolean tcore_sim_decode_ecc(struct tel_sim_ecc_list *p_ecc, unsigned char *p_in, int in_length)
+{
+       int bcd_byte;   // dialing number max length
+       int i;
+       int valid_ecc_length;
+       memset((void*)p_ecc, 0x00, sizeof(struct tel_sim_ecc_list));
+
+       if(in_length%3 != 0) {
+               dbg("error - invalid data length");
+               return FALSE;
+       }
+
+       for(i=0; i < in_length/3; i++){
+               //get the BCD length of the ECC
+               bcd_byte = _get_valid_bcd_byte((unsigned char*) p_in+(i*3), 3);
+               if(bcd_byte != 0) {
+                       valid_ecc_length = _bcd_to_digit(p_ecc->ecc[p_ecc->ecc_count].ecc_num, (char *)p_in+(i*3), bcd_byte);
+                       p_ecc->ecc[p_ecc->ecc_count].ecc_num[valid_ecc_length] = '\0';
+                       p_ecc->ecc_count++;
+               }
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_ext(struct tel_sim_ext *p_ext, unsigned char *p_in, int in_length)
+{
+       int bcd_byte;   // dialing number max length
+       gboolean res = FALSE;
+       memset((void*)p_ext, 0x00, sizeof(struct tel_sim_ext));
+
+       if(*p_in & 0x01) {
+               dbg("Record type - Called Party Subaddress - NOT SUPPORTED");
+       } else if(*p_in & 0x02) {
+               dbg("Record type - Additional data");
+               bcd_byte = _get_valid_bcd_byte(&p_in[2], SIM_XDN_NUMBER_LEN_MAX / 2);
+               p_ext->ext_len = _bcd_to_digit((char*) p_ext->ext, (char*) &p_in[2], bcd_byte); // actual dialing number length in BCD.
+               p_ext->next_record = p_in[12];
+               dbg( "Dialing number Length[%d]", p_ext->ext_len);
+               res = TRUE;
+       } else {
+               dbg("Record type - Invalid");
+       }
+       return res;
+}
+
+gboolean tcore_sim_decode_ust(struct tel_sim_ust *p_ust, unsigned char *p_in, int in_length)
+{
+       int i, j;
+       char mask;
+       char *p_index;
+       memset((void*) p_ust, 0, sizeof(struct tel_sim_ust));
+       p_index = (char*)p_ust;
+
+       if (in_length == 0) {
+               err("invalid length. return FALSE.");
+               return FALSE;
+       }
+
+       /*
+        * UST service is described to 74(1 byte includes 8 service status) in 31.102 r7.
+        * current sim_ust_s has 64 services. so in_length should be under 8 byte.
+        */
+       if (in_length > (SIM_UST_SERVICE_CNT_MAX / 8)) {
+               warn("out of range[%d]. cut off the tail.", in_length);
+               in_length = SIM_SST_SERVICE_CNT_MAX / 8;
+       }
+
+       for (i = 0; i < in_length; i++) {
+               mask = 0x01;    // reset mast to check first bit
+
+               for (j = 0; j < 8; j++) {
+                       if (p_in[i] & mask) {
+                               *p_index = 1;
+                       }
+                       p_index += sizeof(char);
+                       mask = mask << 1;
+               }
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_ist(struct tel_sim_ist *p_ist, unsigned char *p_in, int in_length)
+{
+       int i, j;
+       char mask;
+       char *p_index;
+       memset((void *)p_ist, 0, sizeof(struct tel_sim_ist));
+       p_index = (char *)p_ist;
+
+       /*
+        * IST service is described to 11(1 byte includes 8 service status) in 31.103 release12.
+        * current tel_sim_ist_service has 11 services. so in_length should be under 2 byte.
+        */
+       if (in_length > SIM_IST_BYTE_LEN_MAX)
+               in_length = SIM_IST_BYTE_LEN_MAX;
+
+       for (i = 0; i < in_length; i++) {
+               mask = 0x01; /* reset mast to check first bit */
+
+               for (j = 0; j < 8; j++) {
+                       if (p_in[i] & mask) {
+                               *p_index = 1;
+                       }
+                       p_index += sizeof(char);
+                       mask = mask << 1;
+               }
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_est(struct tel_sim_est *p_est, unsigned char *p_in, int in_length)
+{
+       memset((void*) p_est, 0, sizeof(struct tel_sim_est));
+
+       if (*p_in & 0x01)
+               p_est->bFdnEnabled = TRUE;
+       if (*p_in & 0x02)
+               p_est->bBdnEnabled = TRUE;
+       if (*p_in & 0x04)
+               p_est->bAclEnabled = TRUE;
+
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_uecc(struct tel_sim_ecc *p_ecc, unsigned char* p_in, int in_length)
+{
+       int bcd_byte;   // dialing number max length
+       unsigned char eccServiceCategory;
+
+       if (_is_empty(p_in, in_length) == TRUE) {
+               memset(p_ecc, 0, sizeof(struct tel_sim_ecc));
+               return FALSE;
+       }
+
+       //get the BCD length of the ECC
+       bcd_byte = _get_valid_bcd_byte(&p_in[0], SIM_ECC_BYTE_LEN_MAX);
+
+       //get the ECC codes in digits and the length as well
+       _bcd_to_digit((char*) p_ecc->ecc_num, (char*) &p_in[0], bcd_byte);
+
+       //get the alpha identifier of ECC (
+       _get_string((unsigned char*) p_ecc->ecc_string, (unsigned char*) &p_in[3], in_length - 3);
+
+       eccServiceCategory = p_in[in_length - 1];
+
+       /*
+        Assign the service category
+        3GPP TS24.008 Emergency Service Category Value.
+        Bit 8,7,6 are spare, 5~1 bit is used.
+        The meaning of the Emergency Category Value is derived from the following settings
+        (see 3GPP TS 22.101 clause 10):
+        Bit 1  Police 0x01
+        Bit 2  Ambulance 0x02
+        Bit 3  Fire Brigade 0x04
+        Bit 4  Marine Guard 0x08
+        Bit 5  Mountain Rescue 0x10
+        Bit 6  manually initiated eCall
+        Bit 7  automatically initiated eCall
+        Bit 8  is spare and set to "0"
+        */
+
+       if (eccServiceCategory == 0xFF) {       // if category vaule is unused (unchecked) then just return 0xff
+               p_ecc->ecc_category = eccServiceCategory;
+       } else {
+               p_ecc->ecc_category = eccServiceCategory & 0x1F;        // Check for the first 5 bits
+       }
+
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_gid( struct tel_sim_gid *p_gid, unsigned char* p_in, int in_length)
+{
+       int i;
+
+       memset((void*) p_gid, 0, sizeof(struct tel_sim_gid ));
+
+       if (in_length == 0)
+               return FALSE;
+
+/*regarding 31.102, EF-GID data byte is not defined. currently 10.*/
+       if (in_length >= SIM_GROUP_IDENTIFIER_LEN_MAX)
+               in_length = SIM_GROUP_IDENTIFIER_LEN_MAX;
+
+       for (i = 0; i < in_length; i++) {
+               if (p_in[i] == 0xFF)
+                       break;
+
+               p_gid->szGroupIdentifier[i] = p_in[i];
+               p_gid->GroupIdentifierLen++;
+       }
+       return TRUE;
+}
+
+gboolean tcore_sim_decode_mbi(struct tel_sim_mbi *p_mbi, unsigned char *p_in, int in_length)
+{
+       /* EF-MBI is defined 4 mandatory, 1 optional byte in 31.102 */
+       if (in_length == 0 || in_length > SIM_MAIL_BOX_IDENTIFIER_LEN_MAX)
+               return FALSE;
+
+       if ( _is_empty(p_in, in_length) == TRUE) {
+               return FALSE; // this is empty record
+       }
+
+       p_mbi->voice_index = p_in[0];
+       p_mbi->fax_index = p_in[1];
+       p_mbi->email_index = p_in[2];
+       p_mbi->other_index = p_in[3];
+
+       // 5th byte is optional
+       if (in_length == 5)
+               p_mbi->video_index = p_in[4];
+
+       return TRUE;
+}
+
+char* tcore_sim_encode_mbi(const struct tel_sim_mbi *p_mbi, int in_length)
+{
+       char *p_out = NULL;
+
+       if (in_length < 4) {
+               dbg("in_length[%d] should be greater than or equal to 4.", in_length)
+               return NULL;
+       }
+
+       p_out = calloc(1, in_length);
+
+       p_out[0] = p_mbi->voice_index;
+       p_out[1] = p_mbi->fax_index;
+       p_out[2] = p_mbi->email_index;
+       p_out[3] = p_mbi->other_index;
+
+       if (in_length == 5)
+               p_out[4] = p_mbi->video_index;
+
+       return p_out;
+}
+
+gboolean tcore_sim_decode_cff(struct tel_sim_cphs_cf *p_cff, unsigned char *p_in, int in_length)
+{
+       if (in_length == 0)
+               return FALSE;
+
+       dbg( "flag(0)=%x, packetlen=%d ", (unsigned int)p_in[0], in_length);
+       dbg( "flag(1)=%x", p_in[1]);
+
+       if ((p_in[0] & 0x0F) == 0x0A) {
+               p_cff->b_line1 = TRUE;
+       }
+       if ((p_in[0] & 0xF0) == 0xA0) {
+               p_cff->b_line2 = TRUE;
+       }
+
+       if (in_length > 1) {
+               if ((p_in[1] & 0x0F) == 0x0A) {
+                       p_cff->b_fax = TRUE;
+               }
+               if ((p_in[1] & 0xF0) == 0xA0) {
+                       p_cff->b_data = TRUE;
+               }
+       }
+
+       dbg("Line1 = %d, line2 = %d, Fax = %d, Data = %d ",
+                       p_cff->b_line1,
+                       p_cff->b_line2,
+                       p_cff->b_fax,
+                       p_cff->b_data);
+       return TRUE;
+}
+
+char* tcore_sim_encode_cff(const struct tel_sim_cphs_cf *cff, int in_length)
+{
+       int i, j = 0;
+       char *p_out = NULL;
+       unsigned char* pTemp = (unsigned char*) cff;
+       unsigned char present = 0x0A;
+       unsigned char absent = 0x05;
+
+       if (in_length < SIM_CPHS_CALL_FORWARDING_LEN_MIN) {
+               err("in_length[%d] is smaller than SIM_CPHS_CALL_FORWARDING_LEN_MIN[%d]", in_length, SIM_CPHS_CALL_FORWARDING_LEN_MIN);
+               return NULL;
+       }
+
+       p_out =  calloc(1, SIM_CPHS_CALL_FORWARDING_LEN_MIN+1);
+       if (!p_out) {
+               return NULL;
+       }
+
+       for (i = 0; i < SIM_CPHS_CALL_FORWARDING_LEN_MIN; i++) {
+               present = 0x0A;
+               absent = 0x05;
+
+               for (j = 0; j < 2; j++) {
+                       if (*pTemp) {
+                               p_out[i] = p_out[i] | present;
+                       } else {
+                               p_out[i] = p_out[i] | absent;
+                       }
+                       pTemp += sizeof(gboolean);
+                       present = present << 4;
+                       absent = absent << 4;
+               }
+       }
+
+       p_out[SIM_CPHS_CALL_FORWARDING_LEN_MIN] = '\0';
+       return p_out;
+}
+
+gboolean tcore_sim_decode_csp(struct tel_sim_cphs_csp *p_csp, unsigned char *p_in, int in_length)
+{
+       int i, j, k = 0;
+       unsigned char byteSignificance = 0x00;
+       unsigned char mask = 0x80;
+
+       if (in_length == 0)
+               return FALSE;
+
+       memset((void*) p_csp, 0, sizeof(struct tel_sim_cphs_csp));
+
+       /* current telephony supports 22 byte cphs-csp data. 18 byte is mandatory, the other is optional. */
+       for (i = 0, j = 0; i < SIM_CPHS_CSP_LEN_MAX && j < SIM_CPHS_CSP_ENTRY_CNT_MAX; i++, j++) {
+               p_csp->service_profile_entry[j].customer_service_group = (enum tel_sim_cphs_csp_group) p_in[i];
+               byteSignificance = p_in[++i];
+               mask = 0x80;
+
+               switch (p_csp->service_profile_entry[j].customer_service_group) {
+                       case 0x01:
+                               for (k = 0; k < 5; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_unconditional = TRUE;
+                                                       break;
+                                               case 0x40:
+                                                       p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_user_busy = TRUE;
+                                                       break;
+                                               case 0x20:
+                                                       p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_no_reply = TRUE;
+                                                       break;
+                                               case 0x10:
+                                                       p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_user_not_reachable = TRUE;
+                                                       break;
+                                               case 0x08:
+                                                       p_csp->service_profile_entry[j].service.call_offering.b_call_transfer = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0x02:
+                               for (k = 0; k < 5; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_all_outgoing_calls = TRUE;
+                                                       break;
+                                               case 0x40:
+                                                       p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_outgoing_international_calls = TRUE;
+                                                       break;
+                                               case 0x20:
+                                                       p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_outgoing_international_calls_except_hplmn = TRUE;
+                                                       break;
+                                               case 0x10:
+                                                       p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_all_incoming_calls_roaming_outside_hplmn = TRUE;
+                                                       break;
+                                               case 0x08:
+                                                       p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_incoming_calls_when_roaming = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0x03:
+                               for (k = 0; k < 5; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.other_supp_services.b_multi_party_service = TRUE;
+                                                       break;
+                                               case 0x40:
+                                                       p_csp->service_profile_entry[j].service.other_supp_services.b_closed_user_group = TRUE;
+                                                       break;
+                                               case 0x20:
+                                                       p_csp->service_profile_entry[j].service.other_supp_services.b_advice_of_charge = TRUE;
+                                                       break;
+                                               case 0x10:
+                                                       p_csp->service_profile_entry[j].service.other_supp_services.b_preferential_closed_user_group = TRUE;
+                                                       break;
+                                               case 0x08:
+                                                       p_csp->service_profile_entry[j].service.other_supp_services.b_closed_user_group_outgoing_access = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0x04:
+                               for (k = 0; k < 4; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.call_complete.b_call_hold = TRUE;
+                                                       break;
+                                               case 0x40:
+                                                       p_csp->service_profile_entry[j].service.call_complete.b_call_waiting = TRUE;
+                                                       break;
+                                               case 0x20:
+                                                       p_csp->service_profile_entry[j].service.call_complete.b_completion_of_call_to_busy_subscriber = TRUE;
+                                                       break;
+                                               case 0x10:
+                                                       p_csp->service_profile_entry[j].service.call_complete.b_user_user_signalling = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0x05:
+                               for (k = 0; k < 7; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.teleservices.b_short_message_mobile_terminated = TRUE;
+                                                       break;
+                                               case 0x40:
+                                                       p_csp->service_profile_entry[j].service.teleservices.b_short_message_mobile_originated = TRUE;
+                                                       break;
+                                               case 0x20:
+                                                       p_csp->service_profile_entry[j].service.teleservices.b_short_message_cell_broadcast = TRUE;
+                                                       break;
+                                               case 0x10:
+                                                       p_csp->service_profile_entry[j].service.teleservices.b_short_message_reply_path = TRUE;
+                                                       break;
+                                               case 0x08:
+                                                       p_csp->service_profile_entry[j].service.teleservices.b_short_message_delivery_conf = TRUE;
+                                                       break;
+                                               case 0x04:
+                                                       p_csp->service_profile_entry[j].service.teleservices.b_short_message_protocol_identifier = TRUE;
+                                                       break;
+                                               case 0x02:
+                                                       p_csp->service_profile_entry[j].service.teleservices.b_short_message_validity_period = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0x06:
+                               for (k = 0; k < 1; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.cphs_teleservices.b_alternative_line_service =  TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0x07:
+                               for (k = 0; k < 1; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.cphs_features.b_string_service_table = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0x08:
+                               for (k = 0; k < 8; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_present = TRUE;
+                                                       break;
+                                               case 0x20:
+                                                       p_csp->service_profile_entry[j].service.number_identifiers.b_connected_line_identification_restrict = TRUE;
+                                                       break;
+                                               case 0x10:
+                                                       p_csp->service_profile_entry[j].service.number_identifiers.b_connected_line_identification_present = TRUE;
+                                                       break;
+                                               case 0x08:
+                                                       p_csp->service_profile_entry[j].service.number_identifiers.b_malicious_call_identifier = TRUE;
+                                                       break;
+                                               case 0x02:
+                                                       p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_send = TRUE;
+                                                       break;
+                                               case 0x01:
+                                                       p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_block = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0x09:
+                               for (k = 0; k < 6; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.phase_services.b_menu_for_gprs = TRUE;
+                                                       break;
+                                               case 0x40:
+                                                       p_csp->service_profile_entry[j].service.phase_services.b_menu_for_high_speed_csd = TRUE;
+                                                       break;
+                                               case 0x20:
+                                                       p_csp->service_profile_entry[j].service.phase_services.b_menu_for_voice_group_call = TRUE;
+                                                       break;
+                                               case 0x10:
+                                                       p_csp->service_profile_entry[j].service.phase_services.b_menu_for_voice_broadcast_service = TRUE;
+                                                       break;
+                                               case 0x08:
+                                                       p_csp->service_profile_entry[j].service.phase_services.b_menu_for_multiple_subscriber_profile = TRUE;
+                                                       break;
+                                               case 0x04:
+                                                       p_csp->service_profile_entry[j].service.phase_services.b_menu_for_multiple_band = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0xC0:
+                               for (k = 0; k < 8; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                                       p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_manual_selection = TRUE;
+                                                       break;
+                                               case 0x40:
+                                                       p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_voice_mail = TRUE;
+                                                       break;
+                                               case 0x20:
+                                                       p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_mo_sms_and_paging = TRUE;
+                                                       break;
+                                               case 0x10:
+                                                       p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_mo_sms_with_emial_type = TRUE;
+                                                       break;
+                                               case 0x08:
+                                                       p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_fax_calls = TRUE;
+                                                       break;
+                                               case 0x04:
+                                                       p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_data_calls = TRUE;
+                                                       break;
+                                               case 0x01:
+                                                       p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_change_language = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       case 0xD5:
+                               for (k = 0; k < 8; k++) {
+                                       switch (byteSignificance & mask) {
+                                               case 0x80:
+                                               case 0x40:
+                                               case 0x20:
+                                               case 0x10:
+                                               case 0x08:
+                                               case 0x04:
+                                               case 0x02:
+                                               case 0x01:
+                                                       p_csp->service_profile_entry[j].service.information_numbers.b_information_numbers = TRUE;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       mask = mask >> 1;
+                               }
+                               break;
+
+                       default:
+                               break;
+               }
        }
+       return TRUE;
+}
+
+gboolean tcore_sim_encode_csp(unsigned char *p_out, int out_length, struct tel_sim_cphs_csp *p_csp)
+{
+       unsigned char i, j = 0;
+
+       if (out_length == 0)
+               return FALSE;
+
+       memset((void*) p_out, 0xFF, out_length);
+
+/* current telephony supports 22 byte cphs-csp data. 18 byte is mandatory, the other is optional.*/
+       for (i = 0, j = 0; i < SIM_CPHS_CSP_LEN_MAX && j < SIM_CPHS_CSP_ENTRY_CNT_MAX; i++, j++) {
+               p_out[i] = (unsigned char) p_csp->service_profile_entry[j].customer_service_group;
+               switch (p_out[i]) {
+                       case 0x01:
+                               p_out[++i] =    (((unsigned char) p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_unconditional) << 7)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_user_busy) << 6)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_no_reply) << 5)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_user_not_reachable) << 4)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_offering.b_call_transfer) << 3);
+                               break;
 
-       X = enc_xdn_len - 14;   // get alpha id max length
-       *alpha_id_len = 0;
+                       case 0x02:
+                               p_out[++i] =    (((unsigned char) p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_all_outgoing_calls) << 7)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_outgoing_international_calls) << 6)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_outgoing_international_calls_except_hplmn) << 5)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_all_incoming_calls_roaming_outside_hplmn) << 4)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_incoming_calls_when_roaming) << 3);
+                               break;
 
-       if (X != 0) {
-               *alpha_id_len = tcore_util_get_string((unsigned char *)alpha_id, enc_xdn, X);
-               dbg("alpha_id_len:[%d]", *alpha_id_len);
-       }
+                       case 0x03:
+                               p_out[++i] =    (((unsigned char) p_csp->service_profile_entry[j].service.other_supp_services.b_multi_party_service) << 7)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.other_supp_services.b_closed_user_group) << 6)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.other_supp_services.b_advice_of_charge) << 5)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.other_supp_services.b_preferential_closed_user_group) << 4)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.other_supp_services.b_closed_user_group_outgoing_access) << 3);
+                               break;
 
-       // get dialing number length
-       // in[X] is BCD length of dialing number length plus TON/NPI 1 bytes.
-       // Convert to digit length and subtract TON/NPI length.
-       if (enc_xdn[X] != 0xFF) {
-               dbg( "Dialing number Length %d, BCD length 0x%x ", (enc_xdn[X] - 1) * 2, enc_xdn[X]);
+                       case 0x04:
+                               p_out[++i] = (((unsigned char) p_csp->service_profile_entry[j].service.call_complete.b_call_hold) << 7)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_complete.b_call_waiting) << 6)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_complete.b_completion_of_call_to_busy_subscriber) << 5)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.call_complete.b_user_user_signalling) << 4);
+                               break;
 
-/*             if (p_xdn->num_max_len > SIM_XDN_NUMBER_LEN_MAX)        {
+                       case 0x05:
+                               p_out[++i] = (((unsigned char) p_csp->service_profile_entry[j].service.teleservices.b_short_message_mobile_terminated) << 7)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.teleservices.b_short_message_mobile_originated) << 6)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.teleservices.b_short_message_cell_broadcast) << 5)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.teleservices.b_short_message_reply_path) << 4)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.teleservices.b_short_message_delivery_conf) << 3)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.teleservices.b_short_message_protocol_identifier) << 2)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.teleservices.b_short_message_validity_period) << 1);
+                               break;
 
-                        this may be broken record.
-                        p_xdn->b_used = FALSE;
-                        memset((void*)p_xdn, 0, sizeof(tapi_sim_dialing_number_info_t));
-                        return FALSE;
+                       case 0x06:
+                               p_out[++i] = (((unsigned char) p_csp->service_profile_entry[j].service.cphs_teleservices.b_alternative_line_service) << 7);
+                               break;
 
-                        ADN record cannot have more than 20 digits. Anyway we can restrict this as per 31.102
-                        X+1    Length of BCD number/SSC contents       M       1 byte
-                        X+2    TON and NPI     M       1 byte
-                        X+3 to X+12    Dialing Number/SSC String       M       10 bytes
-                        X+13   Capability/Configuration1 Identifier    M       1 byte
-                        X+14   Extension1 Record Identifier    M       1 byte
+                       case 0x07:
+                               p_out[++i] = (((unsigned char) p_csp->service_profile_entry[j].service.cphs_features.b_string_service_table) << 7);
+                               break;
 
-                        Anyway we are doing this check @
-                        bcd_byte = (int) tcore_util_get_valid_bcd_byte (&in[X+2], TAPI_SIM_XDN_DIALING_NUMBER_LEN/2);
-                        by using the 20/2; so don`t return false.
+                       case 0x08:
+                               p_out[++i] = (((unsigned char) p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_present) << 7)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.number_identifiers.b_connected_line_identification_restrict) << 5)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.number_identifiers.b_connected_line_identification_present) << 4)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.number_identifiers.b_malicious_call_identifier) << 3)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_send) << 1)
+                                                               + ((unsigned char) p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_block);
+                               break;
 
-                       if (in[X] == 0x00)
-                               p_xdn->num_max_len = 0;
-                       else
-                               p_xdn->num_max_len = SIM_XDN_NUMBER_LEN_MAX;
-               }*/
+                       case 0x09:
+                               p_out[++i] =    (((unsigned char) p_csp->service_profile_entry[j].service.phase_services.b_menu_for_gprs) << 7)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.phase_services.b_menu_for_high_speed_csd) << 6)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.phase_services.b_menu_for_voice_group_call) << 5)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.phase_services.b_menu_for_voice_broadcast_service) << 4)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.phase_services.b_menu_for_multiple_subscriber_profile) << 3)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.phase_services.b_menu_for_multiple_band) << 2);
+                               break;
 
-               // get TON and NPI
-               //p_xdn->ton = (in[X + 1] >> 4) & 0x07;
-               //p_xdn->npi = in[X + 1] & 0x0F;
+                       case 0xC0:
+                               p_out[++i] =    (((unsigned char) p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_manual_selection) << 7)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_voice_mail) << 6)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_mo_sms_and_paging) << 5)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_mo_sms_with_emial_type) << 4)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_fax_calls) << 3)
+                                                               + (((unsigned char) p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_data_calls) << 2)
+                                                               + ((unsigned char) p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_change_language);
+                               break;
 
-               // get actual dialing number length
-               bcd_byte = (int) tcore_util_get_valid_bcd_byte(&enc_xdn[X + 2], TEL_SIM_XDN_NUMBER_LEN_MAX / 2);
-               dbg( "bcd_byte[%x]", bcd_byte);
+                       case 0xD5:
+                               if (p_csp->service_profile_entry[j].service.information_numbers.b_information_numbers)
+                                       p_out[++i] = 0xFF;
+                               else
+                                       p_out[++i] = 0x00;
+                               break;
 
-               // get dialing number/SSC string
-               tcore_util_convert_bcd_to_digit((char*) num, (char*) &enc_xdn[X + 2], bcd_byte); // actual dialing number length in BCD.
-               dbg( "p_xdn->DiallingNum[%s]", num);
-               // get Capability/Configuration id
-               //p_xdn->cc_id = enc_xdn[X + 12];
-               // get Extension1 id
-               //p_xdn->ext1_id = enc_xdn[X + 13];
+                       default:
+                               break;
+               }
        }
        return TRUE;
 }
 
-gboolean tcore_sim_encode_xdn(gchar *alpha_id, gchar *number, guint enc_xdn_len,
-       gchar **enc_data)
+gboolean tcore_sim_decode_mwis(struct tel_sim_mw *pMwis, unsigned char *p_in, int in_length)
 {
-#define TEL_SIM_CCI_OFFSET     12
-#define TEL_SIM_ERI_OFFSET     13
-
-       gint alpha_id_length = 0;
-       gchar *enc_xdn;
+       int i;
+       unsigned char type = 0;
+       unsigned char mask = 0x01;
 
-       enc_xdn = tcore_malloc0(enc_xdn_len + 1);
-       memset((void*)enc_xdn, 0xFF, enc_xdn_len);
+       if (in_length == 0)
+               return FALSE;
 
-       /* Alpha ID length */
-       alpha_id_length = enc_xdn_len - 14;
-       if (alpha_id_length < 0)
-               alpha_id_length = 0;
+       memset((void*) pMwis, 0, sizeof(struct tel_sim_mw));
 
-       /* Alpha ID */
-       if (alpha_id) {
-               guint str_len = strlen(alpha_id);
+       type = p_in[0];  //0x07
 
-               if (str_len) {
-                       /* Validate Alpha ID length */
-                       if (alpha_id_length < str_len) {
-                               /* alpha id is too big */
-                               dbg("SIM space for alpha_id is [%d] but input alpha_id " \
-                                       "length is [%d]. so we will use [%d] byte",
-                                       alpha_id_length, str_len, alpha_id_length);
-                               str_len = alpha_id_length;
+       if (type) {
+               for (i = 0; i < 5; i++) {
+                       switch (type & mask) {
+                               case 0x01:
+                                       pMwis->indicator_status = pMwis->indicator_status | SIM_MWIS_VOICE;
+                                       break;
+                               case 0x02:
+                                       pMwis->indicator_status = pMwis->indicator_status | SIM_MWIS_FAX;
+                                       break;
+                               case 0x04:
+                                       pMwis->indicator_status = pMwis->indicator_status | SIM_MWIS_EMAIL;
+                                       break;
+                               case 0x08:
+                                       pMwis->indicator_status = pMwis->indicator_status | SIM_MWIS_OTHER;
+                                       break;
+                               case 0x10:
+                                       pMwis->indicator_status = pMwis->indicator_status | SIM_MWIS_VIDEO;
+                                       break;
+                               default:
+                                       pMwis->indicator_status = pMwis->indicator_status | SIM_MWIS_NONE;
+                                       break;
                        }
+                       mask = mask << 1;
+               }
+
+               pMwis->voice_count = p_in[1];
+               pMwis->fax_count = p_in[2];
+               pMwis->email_count = p_in[3];
+               pMwis->other_count = p_in[4];
+
+               if (in_length == 6)
+                       pMwis->video_count = p_in[5];
+       }
+       return TRUE;
+}
+
+char* tcore_sim_encode_mwis( int *out_length, const struct tel_sim_mw *pMwis, int in_length)
+{
+       char *p_out = NULL;
+       int i = 0;
+       int encoded_size = 0;
 
-                       /* Set Alpha ID */
-                       tcore_util_set_string((unsigned char *)enc_xdn,
-                               (unsigned char *)alpha_id, str_len);
+       if (out_length == 0)
+               return FALSE;
+
+       /*
+        * by 3GPP spec (31.102),
+        * EF-MWIS record length should be <= 6. (5 or 6)
+        */
+       if (in_length > 6) {
+               encoded_size = 6;
+       } else {
+               encoded_size = in_length;
+       }
+
+       p_out = calloc(1, encoded_size);
+
+       for(i = 0; i < encoded_size; i++) {
+               switch (i) {
+               case 0:
+                       p_out[0] = (unsigned char) pMwis->indicator_status;
+                       break;
+               case 1:
+                       p_out[1] = pMwis->voice_count;
+                       break;
+               case 2:
+                       p_out[2] = pMwis->fax_count;
+                       break;
+               case 3:
+                       p_out[3] = pMwis->email_count;
+                       break;
+               case 4:
+                       p_out[4] = pMwis->other_count;
+                       break;
+               case 5:
+                       p_out[5] = pMwis->video_count;
+                       break;
+               default:
+                       break;
                }
        }
 
-       /* Dialing number/SSC string */
-       if (number) {
-               guchar number_index = 0;
-               guint number_length = 0;
+       *out_length = encoded_size;
+       return p_out;
+}
 
-               if (number[0] == '+')
-                       number_index = 1;
+gboolean tcore_sim_decode_vmwf(struct tel_sim_cphs_mw *p_vmwf, unsigned char* p_in, unsigned long in_length)
+{
+       int i, j = 0;
+       unsigned char* pTemp = (unsigned char*) p_vmwf;
+       unsigned char mask = 0x0F;
+       unsigned char voiceMsgFlg = 0;
 
-               number_length = strlen(&number[number_index]);
-               if (number_length) {
-                       gchar bcd_number[TEL_SIM_XDN_NUMBER_LEN_MAX / 2];
-                       memset((void*)bcd_number, 0xFF, TEL_SIM_XDN_NUMBER_LEN_MAX / 2);
+       if (in_length == 0){
+               dbg("fail - input length is zero");
+               return FALSE;
+       }
 
-                       /* Validate Dialing number/SSC string length */
-                       if (number_length > TEL_SIM_XDN_NUMBER_LEN_MAX) {
-                               dbg("SIM space for number is [%d] but input number length " \
-                                       "is [%d]. so we will use [%d] byte",
-                                       TEL_SIM_XDN_NUMBER_LEN_MAX,
-                                       number_length, TEL_SIM_XDN_NUMBER_LEN_MAX);
-                               number_length = TEL_SIM_XDN_NUMBER_LEN_MAX;
+/*     current telephony supports 2 byte cphs-vmwf data*/
+       for (i = 0; i < SIM_CPHS_VMWF_LEN_MAX; i++) {
+               voiceMsgFlg = p_in[i];
+               for (j = 0; j < 2; j++) {
+                       if ((voiceMsgFlg & mask) == 0x0A) {
+                               *pTemp = 1;  //TRUE
+                       } else if ((voiceMsgFlg & mask) == 0x05) {
+                               *pTemp = 0;  // FALSE
                        }
+                       pTemp += sizeof(gboolean);
+                       voiceMsgFlg = voiceMsgFlg >> 4;
+               }
+       }
+       return TRUE;
+}
+
+char* tcore_sim_encode_vmwf(int *out_length, const struct tel_sim_cphs_mw *p_vmwf, int in_length)
+{
+       int i, j = 0;
+       char *p_out = NULL;
+       unsigned char* pTemp = (unsigned char*) p_vmwf;
+       unsigned char present = 0x0A;
+       unsigned char absent = 0x05;
 
-                       tcore_util_convert_digit_to_bcd((char*)bcd_number,
-                               (char *)&number[number_index], number_length);
+       if (out_length == 0)
+               return NULL;
 
-                       /* Set length of BCD number/SSC contents */
-                       enc_xdn[alpha_id_length] = ( (number_length + 1) / 2 ) + 1;
+       p_out = calloc(1, in_length);
 
-                       /* Set TON and NPI */
-                       enc_xdn[alpha_id_length + 1] = 0x80;
-                       enc_xdn[alpha_id_length + 1] |= (number_index & 0x07) << 4;
-                       enc_xdn[alpha_id_length + 1] |= (number_index & 0x0F);
+       for (i = 0; i < in_length; i++) {
+               present = 0x0A;
+               absent = 0x05;
 
-                       memcpy((void*)&enc_xdn[alpha_id_length + 2],
-                               bcd_number, TEL_SIM_XDN_NUMBER_LEN_MAX / 2);
+               p_out[i] = 0x00;
+
+               for (j = 0; j < 2; j++) {
+                       if (*pTemp)
+                               p_out[i] = p_out[i] | present;  //TRUE
+                       else
+                               p_out[i] = p_out[i] | absent;  //TRUE
+
+                       pTemp += sizeof(gboolean);
+                       present = present << 4;
+                       absent = absent << 4;
                }
        }
+       *out_length = in_length;
+       return p_out;
+}
+
+gboolean tcore_sim_decode_ons(unsigned char* p_out,unsigned  char* p_in, int in_length)
+{
+       int length;
+       memset((void*) p_out, 0, SIM_CPHS_OPERATOR_NAME_LEN_MAX+1);
 
-       /* Set Capability/Configuration Identifier */
-       enc_xdn[alpha_id_length + TEL_SIM_CCI_OFFSET] = 0xFF;
+       if (in_length == 0)
+               return FALSE;
+
+       if (_is_empty(p_in, in_length) == TRUE) {
+               return FALSE;
+       }
 
-       /* Set Extension1 Record Identifier */
-       enc_xdn[alpha_id_length + TEL_SIM_ERI_OFFSET] = 0xFF;
+       /* current telephony supports 25 byte cphs-operator name string.*/
+       if (in_length >= SIM_CPHS_OPERATOR_NAME_LEN_MAX)
+               in_length = SIM_CPHS_OPERATOR_NAME_LEN_MAX;
 
-       *enc_data = enc_xdn;
-       enc_xdn[enc_xdn_len] = '\0';
+       length = _get_string(p_out, p_in, in_length);
+       p_out[length] = '\0';
+       dbg( "Operator Name is (%s) & Length (%d) ",    p_out, length);
 
        return TRUE;
 }
 
-gboolean tcore_sim_decode_ecc(unsigned char *enc_ecc, int enc_ecc_len, TelSimEccList *dec_ecc)
+gboolean tcore_sim_decode_cfis(struct tel_sim_cfis *p_cfis, unsigned char *p_in, int in_length)
 {
        int bcd_byte;   // dialing number max length
-       int i;
-       int valid_ecc_length;
+       int digit_len;
+       int i = 0;
+       if (in_length == 0)
+               return FALSE;
+
+       if (_is_empty(p_in, in_length) == TRUE) {
+               dbg("empty record. all data is set 0xff");
+               return TRUE;    // this is empty record
+       }
+
+       p_cfis->msp_num = p_in[i++];
+       p_cfis->cfu_status = p_in[i++];
+
+       // get TON and NPI
+       p_cfis->ton = (p_in[++i] >> 4) & 0x07;
+       p_cfis->npi = p_in[i++] & 0x0F;
+
+       // get actual dialing number length
+       /* current telephony supports 20 byte dialing number format. */
+       bcd_byte = _get_valid_bcd_byte(&p_in[i], SIM_XDN_NUMBER_LEN_MAX / 2);
+
+       // get dialing number/SSC string
+       digit_len = _bcd_to_digit((char*) p_cfis->cfu_num, (char*) &p_in[i], bcd_byte); // actual dialing number length in BCD.
+       dbg( "Dialing number Length[%d]", digit_len);
+
+       i = i + SIM_XDN_NUMBER_LEN_MAX / 2;
+
+       // get Capability/Configuration id
+       p_cfis->cc2_id = p_in[i++];
+
+       // get Extension1 id
+       p_cfis->ext7_id = p_in[i];
+
+       dbg( "MspNumber 0x%x", p_cfis->msp_num);
+       dbg( "Status 0x%x", p_cfis->cfu_status);
+       dbg( "TypeOfNumber %d", p_cfis->ton);
+       dbg( "NumberingPlanIdent %d", p_cfis->npi);
+       dbg( "Dialing number[%s]", p_cfis->cfu_num);
+
+       return TRUE;
+}
 
-       tcore_check_return_value_assert(enc_ecc != NULL, FALSE);
-       tcore_check_return_value_assert(enc_ecc_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_ecc != NULL, FALSE);
+gboolean tcore_sim_decode_img(struct tel_sim_img *p_out, unsigned char *p_in, int in_length)
+{
+       int i = 1;
 
-       memset((void*)dec_ecc, 0x00, sizeof(TelSimEccList));
+       dbg( "Func Entrance");
 
-       if (enc_ecc_len%3 != 0) {
-               err("error - invalid data length");
+       if ((NULL == p_out) || (NULL == p_in)) {
                return FALSE;
        }
 
-       for(i=0; i < enc_ecc_len/3; i++){
-               //get the BCD length of the ECC
-               bcd_byte = (int) tcore_util_get_valid_bcd_byte((unsigned char*) enc_ecc+(i*3), 3);
-               if (bcd_byte != 0) {
-                       valid_ecc_length = tcore_util_convert_bcd_to_digit(dec_ecc->list[dec_ecc->count].number, (char *)enc_ecc+(i*3), bcd_byte);
-                       dec_ecc->list[dec_ecc->count].number[valid_ecc_length] = '\0';
-                       dec_ecc->count++;
-               }
+       if ((in_length == 0) || (in_length == 0xff) || (10 > in_length)) {
+               dbg("No valid IMG data present - length:[%x]",  in_length);
+               return FALSE;
+       }
+
+       if (_is_empty(p_in, in_length) == TRUE) {
+               dbg("empty record. all data is set 0xff");
+               return FALSE;   // this is empty record
        }
+
+       /*We are trying to decode only the 1st valid image data property and ignoring other for time being*/
+       p_out->width = p_in[i++];
+       p_out->height = p_in[i++];
+       p_out->ics = p_in[i++];
+       p_out->iidf_fileid =  (*(p_in+4) << 8) | (*(p_in+5) & 0x00ff);/*index is 4 and 5 because the 1st byte is number of actual image instance*/
+       p_out->offset =  (*(p_in+6) << 8) | (*(p_in+7) & 0x00ff);
+       p_out->length =  (*(p_in+8) << 8) | (*(p_in+9) & 0x00ff);
+
+       dbg("p_out->width[%d], p_out->height[%d],  p_out->ics[%d],  p_out->offset[%d], p_out->length[%d], p_out->iidf_fileid[0x%02x]",
+               p_out->width, p_out->height,  p_out->ics, p_out->offset, p_out->length, p_out->iidf_fileid);
+
        return TRUE;
 }
 
-gboolean tcore_sim_decode_ust(unsigned char *enc_ust, int enc_ust_len, char *dec_ust)
+gboolean tcore_sim_decode_isim_impi(struct tel_sim_impi *p_out, unsigned char *p_in, int in_length)
 {
-       int i, j;
-       char mask;
+       unsigned char tag = 0, len = 0;
 
-       tcore_check_return_value_assert(enc_ust != NULL, FALSE);
-       tcore_check_return_value_assert(enc_ust_len != 0, FALSE);
+       if (p_in == NULL || p_out == NULL || in_length < 2)
+               return FALSE;
 
-       memset((void*) dec_ust, 0, TEL_SIM_UST_SERVICE_CNT_MAX);
+       tag = p_in[0];
+       if (tag != 0x80) {
+               err("tag[0x%x] should be 0x80. return FALSE.", tag);
+               return FALSE;
+       }
+       len = p_in[1];
 
-/*     UST service is described to 74(1 byte includes 8 service status) in 31.102 r7.
-       current sim_ust_s has 64 services. so enc_ust_len should be under 8 byte. */
-       if (enc_ust_len > TEL_SIM_UST_BYTE_LEN_MAX)
-               enc_ust_len = TEL_SIM_UST_BYTE_LEN_MAX;
+       if (in_length < len + 2) {
+               err("invalid length. in_length[%d] < TLV_len[%d] + 2", in_length, len);
+       }
 
-       for (i = 0; i < enc_ust_len; i++) {
-               mask = 0x01;    // reset mast to check first bit
+       p_out->impi = calloc(1, len + 1);
+
+       memcpy(p_out->impi, &p_in[2], len);
 
-               for (j = 0; j < 8; j++) {
-                       if (enc_ust[i] & mask) {
-                               *dec_ust = 1;
-                       }
-                       dec_ust += sizeof(char);
-                       mask = mask << 1;
-               }
-       }
        return TRUE;
 }
 
-gboolean tcore_sim_decode_uecc(unsigned char* enc_uecc, int enc_uecc_len, TelSimEcc *dec_ecc)
+gboolean tcore_sim_decode_isim_domain(struct tel_sim_domain *p_out, unsigned char *p_in, int in_length)
 {
-       int bcd_byte;   // dialing number max length
-       unsigned char ecc_service_category;
+       unsigned char tag = 0, len = 0;
 
-       tcore_check_return_value_assert(enc_uecc != NULL, FALSE);
-       tcore_check_return_value_assert(enc_uecc_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_ecc != NULL, FALSE);
+       if (p_in == NULL || p_out == NULL || in_length < 2)
+               return FALSE;
 
-       if (tcore_util_is_empty(enc_uecc, enc_uecc_len) == TRUE) {
-               err("empty record");
+       tag = p_in[0];
+       if (tag != 0x80) {
+               err("tag[0x%x] should be 0x80. return FALSE.", tag);
                return FALSE;
        }
+       len = p_in[1];
 
-       //get the BCD length of the ECC
-       bcd_byte = (int) tcore_util_get_valid_bcd_byte(&enc_uecc[0], TEL_SIM_ECC_BYTE_LEN_MAX);
-
-       //get the ECC codes in digits and the length as well
-       tcore_util_convert_bcd_to_digit((char*) dec_ecc->number, (char*) &enc_uecc[0], bcd_byte);
+       if (in_length < len + 2) {
+               err("invalid length. in_length[%d] < TLV_len[%d] + 2", in_length, len);
+       }
 
-       //get the alpha identifier of ECC (
-       tcore_util_get_string((unsigned char*) dec_ecc->name, (unsigned char*) &enc_uecc[3], enc_uecc_len - 3);
+       p_out->domain = calloc(1, len + 1);
 
-       ecc_service_category = enc_uecc[enc_uecc_len - 1] & 0xFF;
+       memcpy(p_out->domain, &p_in[2], len);
 
-       /*
-        Assign the service category
-        3GPP TS24.008 Emergency Service Category Value.
-        Bit 8,7,6 are spare, 5~1 bit is used.
-        The meaning of the Emergency Category Value is derived from the following settings
-        (see 3GPP TS 22.101 clause 10):
-        Bit 1  Police 0x01
-        Bit 2  Ambulance 0x02
-        Bit 3  Fire Brigade 0x04
-        Bit 4  Marine Guard 0x08
-        Bit 5  Mountain Rescue 0x10
-        Bit 6  manually initiated eCall
-        Bit 7  automatically initiated eCall
-        Bit 8  is spare and set to "0"
-        */
-       switch (ecc_service_category) {
-       case 0x01:
-               dec_ecc->category = TEL_SIM_ECC_ESC_POLICE;
-       break;
-       case 0x02:
-               dec_ecc->category = TEL_SIM_ECC_ESC_AMBULANCE;
-       break;
-       case 0x04:
-               dec_ecc->category = TEL_SIM_ECC_ESC_FIREBRIGADE;
-       break;
-       case 0x08:
-               dec_ecc->category = TEL_SIM_ECC_ESC_MARINEGUARD;
-       break;
-       case 0x10:
-               dec_ecc->category = TEL_SIM_ECC_ESC_MOUNTAINRESCUE;
-       break;
-       case 0x20:
-               dec_ecc->category = TEL_SIM_ECC_ESC_MANUAL_ECALL;
-       break;
-       case 0x40:
-               dec_ecc->category = TEL_SIM_ECC_ESC_AUTO_ECALL;
-       break;
-       default:
-               dec_ecc->category = TEL_SIM_ECC_ESC_DEFAULT;
-               dbg("default ecc->category");
-       }
        return TRUE;
 }
 
-gboolean tcore_sim_decode_mbi(unsigned char *enc_mbi, int enc_mbi_len, TelSimMbi *dec_mbi)
+gboolean tcore_sim_decode_isim_impu(struct tel_sim_impu *p_out, unsigned char *p_in, int in_length)
 {
-       tcore_check_return_value_assert(enc_mbi != NULL, FALSE);
-       tcore_check_return_value_assert(enc_mbi_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_mbi != NULL, FALSE);
+       unsigned char tag = 0, len = 0;
 
-       /* EF-MBI is defined 4 mandatory, 1 optional byte in 31.102 */
-       if (enc_mbi_len == 0 || enc_mbi_len > TEL_SIM_MAIL_BOX_IDENTIFIER_LEN_MAX) {
-               err("invalid length");
+       if (p_in == NULL || p_out == NULL || in_length < 2)
+               return FALSE;
+
+       tag = p_in[0];
+       if (tag != 0x80) {
+               err("tag[0x%x] should be 0x80. return FALSE.", tag);
                return FALSE;
        }
 
-       if ( tcore_util_is_empty(enc_mbi, enc_mbi_len) == TRUE) {
-               err("empty record");
-               return FALSE; // this is empty record
+       len = p_in[1];
+
+       if (in_length < len + 2) {
+               err("invalid length. in_length[%d] < TLV_len[%d] + 2", in_length, len);
        }
 
-       dec_mbi->voice_index = enc_mbi[0];
-       dec_mbi->fax_index = enc_mbi[1];
-       dec_mbi->email_index = enc_mbi[2];
-       dec_mbi->other_index = enc_mbi[3];
+       p_out->impu = calloc(1, len + 1);
 
-       // 5th byte is optional
-       if (enc_mbi_len == 5)
-               dec_mbi->video_index = enc_mbi[4];
+       memcpy(p_out->impu, &p_in[2], len);
 
        return TRUE;
 }
 
-gboolean tcore_sim_decode_cff(unsigned char *enc_cff, int enc_cff_len, TelSimMwis *dec_mwis)
+gboolean tcore_sim_decode_isim_pcscf(struct tel_sim_pcscf *p_out, unsigned char *p_in, int in_length)
 {
-       int i;
-       unsigned char type = 0;
-       unsigned char mask = 0x01;
+       unsigned char tag = 0, len = 0;
 
-       tcore_check_return_value_assert(enc_cff != NULL, FALSE);
-       tcore_check_return_value_assert(enc_cff_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_mwis != NULL, FALSE);
+       if (p_in == NULL || p_out == NULL || in_length < 2)
+               return FALSE;
 
-       memset((void*) dec_mwis, 0, sizeof(TelSimMwis));
-       /* 1st byte is mandatory */
-       type = enc_cff[0];
+       tag = p_in[0];
+       if (tag != 0x80) {
+               err("tag[0x%x] should be 0x80. return FALSE.", tag);
+               return FALSE;
+       }
+       /*P-CSCF Address length */
+       len = p_in[1];
 
-       if (type) {
-               for (i = 0; i < 2; i++) {
-                       switch (type & mask) {
-                       case 0x01:
-                               dec_mwis->profile_id = 1;
-                               dec_mwis->msg_waiting[0].indication = TRUE;
-                       break;
-                       case 0x05:
-                               dec_mwis->profile_id = 2;
-                               dec_mwis->msg_waiting[0].indication = TRUE;
-                       break;
-                       default:
-                               dbg("CFF is NONE");
-                       }
-                       mask = mask << 1;
-               }
+       if (in_length < len + 2) {
+               err("invalid length. in_length[%d] < TLV_len[%d] + 2", in_length, len);
        }
 
-       /* 2nd byte is optional */
-       if (enc_cff_len > 1) {
-               type = enc_cff[1];
-               if (type) {
-                       for (i = 0; i < 2; i++) {
-                               switch (type & mask) {
-                               case 0x01:
-                                       dec_mwis->profile_id = 1;
-                                       dec_mwis->msg_waiting[1].indication = TRUE;
-                               break;
-                               case 0x05:
-                                       dec_mwis->profile_id = 2;
-                                       dec_mwis->msg_waiting[1].indication = TRUE;
-                               break;
-                               default:
-                                       dbg("CFF is NONE");
-                               }
-                               mask = mask << 1;
-                       }
+       /*P-CSCF Address type */
+       if (p_in[2] == 0x00)
+               p_out->type = SIM_PCSCF_TYPE_FQDN;
+       else if (p_in[2] == 0x01)
+               p_out->type = SIM_PCSCF_TYPE_IPV4;
+       else if (p_in[2] == 0x02)
+               p_out->type = SIM_PCSCF_TYPE_IPV6;
+
+       /* If P-CSCF Address type is "00" (FQDN), then address shall be encoded to
+         * an octet string according to UTF-8 encoding rules.
+        *  So, no need to convert it to UTF-8.
+         */
+       if (p_out->type == SIM_PCSCF_TYPE_FQDN) {
+               p_out->pcscf = calloc(1, len);
+               memcpy(p_out->pcscf, &p_in[3], len - 1);
+       } else {
+               unsigned char buf[255] = {0,};
+               unsigned short buf_len;
+               gboolean ret = FALSE;
+
+               ret = tcore_util_convert_string_to_utf8(buf, &buf_len, ALPHABET_FORMAT_SMS_DEFAULT,
+                                               (const unsigned char *)&p_in[3], len - 1);
+               if (ret) {
+                       p_out->pcscf = calloc(1, buf_len + 1);
+                       memcpy(p_out->pcscf, buf, buf_len);
                }
        }
+
        return TRUE;
 }
 
-gboolean tcore_sim_decode_mwis(unsigned char *enc_mwis, int enc_mwis_len, TelSimMwis *dec_mwis)
+char* tcore_sim_encode_cfis(int *out_length, const struct tel_sim_cfis *p_cfis)
 {
-       gint i;
-       guchar indicator_status = 0;
-       guchar mask_bit = 0x01;
+       char *encoded_o = NULL;
+       char bcd[10];
 
-       tcore_check_return_value_assert(enc_mwis != NULL, FALSE);
-       tcore_check_return_value_assert(enc_mwis_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_mwis != NULL, FALSE);
-
-       memset((void*)dec_mwis, 0x0, sizeof(TelSimMwis));
+       encoded_o = calloc(1, 16); // EF-CFIS record length is 16
+       memset(bcd, 0xff, 10);
 
        /*
-        * Indicator Status
-        *      | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
-        *
-        * b1 -Voicemail
-        * b2 - Fax
-        * b3 - Electronic Mail
-        * b4 - Other
-        * b5 - Videomail
-        * b6-b8 - RFU
+        Bytes  Description                                                     M/O             Length
+        1              MSP number                                                      M               1 byte
+        2              CFU indicator status                                    M               1 byte
+        3              Length of BCD number                                    M               1 byte
+        4              TON and NPI                                                     M               1 byte
+        5 to 14        Dialing Number                                          M               10 bytes. unused byte should be set with 'F'
+        15             Capability/Configuration2 Record Identifier     M               1 byte
+        16             Extension 7 Record Identifier                           M               1 byte
         */
-       indicator_status = enc_mwis[0];  //0x07
-       if (indicator_status) {
-               /* Count is valid */
-               dec_mwis->count_valid = TRUE;
+       encoded_o[0] = p_cfis->msp_num;
+       encoded_o[1] = p_cfis->cfu_status;
 
-               /*
-                * enc_mwis_len includes 'Indicator Status' byte also,
-                * (-1) ensures that length doesn't consider 'Indicator Status'
-                * byte.
-                */
-               for (i = 0; i < enc_mwis_len-1; i++) {
-                       /*
-                        * '0th' index of Encoded MWIS is dedicated to
-                        * 'Indicator Status'; 'i+1' while dereferencing 'enc_mwis'
-                        * ensures that this byte is skipped.
-                        */
-                       switch (indicator_status & (mask_bit << i)) {
-                       case TEL_SIM_MWIS_VOICE:
-                               dec_mwis->msg_waiting[i].indication = TRUE;
-                               dec_mwis->msg_waiting[i].count = enc_mwis[i+1];
-                       break;
-                       case TEL_SIM_MWIS_FAX:
-                               dec_mwis->msg_waiting[i].indication = TRUE;
-                               dec_mwis->msg_waiting[i].count = enc_mwis[i+1];
-                       break;
-                       case TEL_SIM_MWIS_EMAIL:
-                               dec_mwis->msg_waiting[i].indication = TRUE;
-                               dec_mwis->msg_waiting[i].count = enc_mwis[i+1];
-                       break;
-                       case TEL_SIM_MWIS_OTHER:
-                               dec_mwis->msg_waiting[i].indication = TRUE;
-                               dec_mwis->msg_waiting[i].count = enc_mwis[i+1];
+       encoded_o[2] = (strlen(p_cfis->cfu_num) +1) /2;
+
+       // set TON and NPI
+       encoded_o[3] = 0x80;
+       encoded_o[3] |= (p_cfis->ton & 0x07) << 4;
+       encoded_o[3] |= p_cfis->npi & 0x0F;
+
+       _digit_to_bcd(bcd, (char*)&p_cfis->cfu_num, strlen(p_cfis->cfu_num));
+       memcpy(&encoded_o[4], bcd, 10);
+
+       encoded_o[14] = p_cfis->cc2_id;
+       encoded_o[15] = p_cfis->ext7_id;
+
+       *out_length = 16;
+       return encoded_o;
+}
+
+gboolean tcore_sim_decode_dynamic_flag(struct tel_sim_cphs_dflag *p_df, unsigned char *p_in, int in_length)
+{
+       if (in_length == 0)
+               return FALSE;
+
+       memset((void*) p_df, 0, sizeof(struct tel_sim_cphs_dflag));
+
+       switch (p_in[0] & 0x01) {
+               case 0x00:
+                       p_df->DynamicFlags = SIM_DYNAMIC_FLAGS_LINE2;
                        break;
-                       case TEL_SIM_MWIS_VIDEO:
-                               dec_mwis->msg_waiting[i].indication = TRUE;
-                               dec_mwis->msg_waiting[i].count = enc_mwis[i+1];
+
+               case 0x01:
+                       p_df->DynamicFlags = SIM_DYNAMIC_FLAGS_LINE1;
                        break;
-                       default:
-                               dbg("MWIS is NONE");
-                       }
-               }
+               default:
+                       warn("invalid input");
+                       break;                  
        }
 
        return TRUE;
 }
 
-gboolean tcore_sim_encode_mwis(const TelSimMwis *mwis, guint field_count,
-       gchar **encoded_mwis, guint *encoded_mwis_len)
+gboolean tcore_sim_decode_dynamic2_flag(struct tel_sim_cphs_dflag2 *p_d2f, unsigned char *p_in, int in_length)
 {
-       gchar *mwis_buf;
-       guint i;
-
-       tcore_check_return_value_assert(mwis != NULL, FALSE);
-       tcore_check_return_value_assert(field_count >= 5, FALSE);
+       if (in_length == 0)
+               return FALSE;
 
-       /*
-        * Allocate memory -
-        *
-        *      field_count >=5 (1 - Indicator status, 2-5 Mandatory fields)
-        *              6 is possible if Videomail is supported (which is Optional)
-        *      +1 - NULL termination
-        */
-       mwis_buf = tcore_malloc(field_count + 1);
+       memset((void*) p_d2f, 0, sizeof(struct tel_sim_cphs_dflag2));
 
-       /*
-        * 3GPP TS 31.102 version 11.6.0 Release 11
-        *      4.2.63 EFMWIS (Message Waiting Indication Status)
-        */
-       for (i = 1; i < field_count; i++) {
-               /*
-                * '0th' index of Encoded MWIS contains 'Indicator Status',
-                * hence 'i' starts from '1'.
-                *
-                * msg_waiting is aligned from 0-field_count, hence (i-1) is used.
-                */
-               mwis_buf[i] = mwis->msg_waiting[i-1].count;
+       switch (p_in[0] & 0x01) {
+               case 0x00:
+                       p_d2f->Dynamic2Flag = SIM_PIN2_ACCESSIBLE_FLAGS_UNLOCKED;
+                       break;
 
-               /*
-                * Indicator Status
-                *      | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
-                *
-                * b1 -Voicemail
-                * b2 - Fax
-                * b3 - Electronic Mail
-                * b4 - Other
-                * b5 - Videomail
-                * b6-b8 - RFU
-                */
-               if (mwis_buf[i])
-                       mwis_buf[0] |= (0x01 << (i-1));
+               case 0x01:
+                       p_d2f->Dynamic2Flag = SIM_PIN2_ACCESSIBLE_FLAGS_LOCKED;
+                       break;
+               default:
+                       warn("invalid input");
+                       break;                  
        }
 
-       *encoded_mwis = mwis_buf;
-       *encoded_mwis_len = field_count;
+       return TRUE;
+}
+
+gboolean tcore_sim_encode_dynamic_flag(char *p_out, int out_length, struct tel_sim_cphs_dflag *p_df)
+{
+       if (out_length == 0 || out_length > 1)
+               return FALSE;
+
+       memset((void*) p_out, 0xFF, out_length);
+       p_out[0] = p_df->DynamicFlags;
+       return TRUE;
+}
+
+gboolean tcore_sim_encode_dynamic2_flag(char *p_out, int out_length, struct tel_sim_cphs_dflag2 *p_d2f)
+{
+       if (out_length == 0 || out_length > 1)
+               return FALSE;
 
+       memset((void*) p_out, 0xFF, out_length);
+       p_out[0] = p_d2f->Dynamic2Flag;
        return TRUE;
 }
 
-gboolean tcore_sim_decode_vmwf(unsigned char* enc_vmwf, unsigned long enc_vmwf_len, TelSimMwis *dec_vmwf)
+gboolean tcore_sim_decode_cphs_info(struct tel_sim_cphs_info *pCphsInfo, unsigned char *p_in, int in_length)
 {
        int i, j = 0;
-       unsigned char* temp = (unsigned char*) dec_vmwf;
-       unsigned char mask = 0x0F;
-       unsigned char voice_msg_flg = 0;
+       unsigned char mask = 0x03;
+       unsigned char* pTemp = (unsigned char*) &pCphsInfo->CphsServiceTable;
 
-       tcore_check_return_value_assert(enc_vmwf != NULL, FALSE);
-       tcore_check_return_value_assert(enc_vmwf_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_vmwf != NULL, FALSE);
+       memset((void*) pCphsInfo, 0, sizeof(struct tel_sim_cphs_info));
 
-       /* current telephony supports 2 byte cphs-vmwf data */
-       for (i = 0; i < TEL_SIM_CPHS_VMWF_LEN_MAX; i++) {
-               voice_msg_flg = enc_vmwf[i];
-               for (j = 0; j < 2; j++) {
-                       if ((voice_msg_flg & mask) == 0x0A) {
-                               *temp = 1;  //TRUE
-                       } else if ((voice_msg_flg & mask) == 0x05) {
-                               *temp = 0;  // FALSE
+       if (in_length == 0)
+               return FALSE;
+
+        /*CPHS info EF has 3 bytes data.*/
+       if (in_length >= SIM_CPHS_INFO_LEN_MAX)
+               in_length = SIM_CPHS_INFO_LEN_MAX;
+
+       switch (p_in[0]) {
+               case 0x01:
+                       pCphsInfo->CphsPhase = SIM_CPHS_PHASE1;
+                       break;
+               case 0x02:
+                       pCphsInfo->CphsPhase = SIM_CPHS_PHASE2;
+                       break;
+               default:
+                       pCphsInfo->CphsPhase = SIM_CPHS_PHASE_RFU;
+                       break;
+       }
+
+       dbg( "Cphs Phase %d \n", pCphsInfo->CphsPhase);
+
+       for (i = 1; i < in_length; i++) { //CPHS SST is only 2 bytes
+               mask = 0x03;    // reset mast to check first bit
+               for (j = 0; j < 4; j++) {
+                       if (p_in[i] & mask) {
+                               *pTemp = 1;
                        }
-                       temp += sizeof(gboolean);
-                       voice_msg_flg = voice_msg_flg >> 4;
+                       dbg( "Byte (%d), service (%d) ", i+1, *pTemp);
+                       pTemp += sizeof(gboolean);
+                       mask = mask << 2;
                }
        }
-
        return TRUE;
 }
 
-gboolean tcore_sim_decode_ons(unsigned  char* enc_ons, int enc_ons_len, unsigned char *dec_ons)
+gboolean tcore_sim_decode_short_ons(unsigned char *p_out, unsigned char *p_in, int in_length)
 {
        int length;
-       memset((void*) dec_ons, 0, TEL_SIM_CPHS_OPERATOR_NAME_LEN_MAX+1);
 
-       tcore_check_return_value_assert(enc_ons != NULL, FALSE);
-       tcore_check_return_value_assert(enc_ons_len != 0, FALSE);
+       memset(p_out, 0x00, SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX+1);
 
-       if (tcore_util_is_empty(enc_ons, enc_ons_len) == TRUE) {
-               err("empty record");
-               return FALSE;
+       if (_is_empty(p_in, in_length) == TRUE){
+               return FALSE;   // this is empty record
        }
 
-       /* current telephony supports 25 byte cphs-operator name string.*/
-       if (enc_ons_len >= TEL_SIM_CPHS_OPERATOR_NAME_LEN_MAX)
-               enc_ons_len = TEL_SIM_CPHS_OPERATOR_NAME_LEN_MAX;
+       /*CPHS specification shows current EF include 10 bytes */
+       if (in_length == 0)
+               return FALSE;
 
-       length = tcore_util_get_string(dec_ons, enc_ons, enc_ons_len);
-       dec_ons[length] = '\0';
-       dbg("Operator Name is (%s) & Length (%d) ", dec_ons, length);
+       if(in_length > SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX)
+               in_length = SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX;
 
+       length = _get_string( p_out, p_in, in_length );
+       p_out[length] = '\0';
+       dbg( "Operator short Name is (%s) &  length (%d)", p_out, length);
        return TRUE;
 }
 
-gboolean tcore_sim_decode_cfis(unsigned char *enc_cfis, int enc_cfis_len, TelSimCfis *dec_cfis)
+gboolean tcore_sim_decode_information_number(struct tel_sim_cphs_info_number *p_info, unsigned char* p_in, int in_length)
 {
-       unsigned char type = 0;
-       unsigned char mask = 0x01;
-       int i = 0;
+       int i;
 
-       tcore_check_return_value_assert(enc_cfis != NULL, FALSE);
-       tcore_check_return_value_assert(enc_cfis_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_cfis != NULL, FALSE);
+       if (in_length == 0)
+               return FALSE;
 
-       if (tcore_util_is_empty(enc_cfis, enc_cfis_len) == TRUE) {
-               err("empty record. all data is set 0xff");
-               return TRUE;    // this is empty record
+       for (i = 0; i < in_length; i++) {
+               dbg( " \t0x%04X.", p_in[i]);
        }
 
-       dec_cfis->profile_id = enc_cfis[i++];
-       type = enc_cfis[i++];
-
-       if (type) {
-               for (i = 0; i < 5; i++) {
-                       switch (type & mask) {
-                       case 0x01:
-                               dec_cfis->indication[0] = TRUE;
-                       break;
-                       case 0x02:
-                               dec_cfis->indication[1] = TRUE;
-                       break;
-                       case 0x04:
-                               dec_cfis->indication[2] = TRUE;
-                       break;
-                       case 0x08:
-                               dec_cfis->indication[3] = TRUE;
-                       break;
-                       case 0x10:
-                               dec_cfis->indication[4] = TRUE;
-                       break;
-                       default:
-                               dbg("CFIS is NONE");
-                       }
-                       mask = mask << 1;
-               }
+       if (_is_empty(p_in, in_length) == TRUE) {
+               return FALSE;   // this is empty record
        }
-#if 0
-       // get TON and NPI
-       p_cfis->ton = (enc_cfis[++i] >> 4) & 0x07;
-       p_cfis->npi = enc_cfis[i++] & 0x0F;
 
-       // get actual dialing number length
-       /* current telephony supports 20 byte dialing number format. */
-       bcd_byte = (int) tcore_util_get_valid_bcd_byte(&enc_cfis[i], SIM_XDN_NUMBER_LEN_MAX / 2);
+       p_info->AlphaIdLength = p_in[0];
 
-       // get dialing number/SSC string
-       digit_len = tcore_util_convert_bcd_to_digit((char*) p_cfis->cfu_num, (char*) &enc_cfis[i], bcd_byte); // actual dialing number length in BCD.
-       dbg( "Dialing number Length[%d]", digit_len);
+       if (p_in[1] & 0x0F)
+               p_info->IndexLevelIndicator =   (enum tel_sim_cphs_index_level) (p_in[1] & 0x0F);
 
-       i = i + SIM_XDN_NUMBER_LEN_MAX / 2;
+       if (p_in[1] & 0x10)
+               p_info->PremiumServiceIndicator = TRUE;
 
-       // get Capability/Configuration id
-       p_cfis->cc2_id = enc_cfis[i++];
+       if (p_in[1] & 0x20)
+               p_info->PremiumServiceIndicator = TRUE;
+
+       _get_string(p_info->Alpha_id, &p_in[2], p_info->AlphaIdLength);
 
+       p_info->DiallingnumLength = p_in[2 + p_info->AlphaIdLength] * 2;
+       p_info->TypeOfNumber = (p_in[3 + p_info->AlphaIdLength] >> 4) & 0x07;
+       p_info->NumberingPlanIdentity = p_in[3 + p_info->AlphaIdLength] & 0x0F;
+
+       // get dialing number/SSC string
+       _bcd_to_digit((char*) p_info->DiallingnumLength, (char*) &p_in[4 + p_info->AlphaIdLength],      p_info->DiallingnumLength / 2); // actual dialing number length in BCD.
        // get Extension1 id
-       p_cfis->ext7_id = enc_cfis[i];
-#endif
-       dbg( "profile_id 0x%x", dec_cfis->profile_id);
-/*
-       dbg( "TypeOfNumber %d", p_cfis->ton);
-       dbg( "NumberingPlanIdent %d", p_cfis->npi);
-       dbg( "Dialing number[%s]", p_cfis->cfu_num);
-*/
+       p_info->Ext1RecordId = p_in[4 + p_info->AlphaIdLength + p_info->DiallingnumLength / 2];
+
        return TRUE;
 }
 
-gboolean tcore_sim_decode_short_ons(unsigned char *enc_short_ons, int enc_short_ons_len, unsigned char *dec_short_ons)
+gboolean tcore_sim_decode_opl(struct tel_sim_opl *p_opl, unsigned char *p_in, int in_length)
 {
-       int length;
-
-       tcore_check_return_value_assert(enc_short_ons != NULL, FALSE);
-       tcore_check_return_value_assert(enc_short_ons_len != 0, FALSE);
-
-       memset(dec_short_ons, 0x00, TEL_SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX+1);
-
-       if (tcore_util_is_empty(enc_short_ons, enc_short_ons_len) == TRUE){
-               err("empty record");
+       if (_is_empty(p_in, in_length) == TRUE) {
+               memset(p_opl, 0x00, sizeof(struct tel_sim_opl));
                return FALSE;   // this is empty record
        }
 
-       /*CPHS specification shows current EF include 10 bytes */
-       tcore_check_return_value_assert(enc_short_ons_len != 0, FALSE);
-
-       if (enc_short_ons_len > TEL_SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX)
-               enc_short_ons_len = TEL_SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX;
+       _decode_plmn(p_in, p_opl->plmn);
+       dbg( " PLMN Code[%s]", p_opl->plmn);
 
-       length = tcore_util_get_string(dec_short_ons, enc_short_ons, enc_short_ons_len);
-       dec_short_ons[length] = '\0';
-       dbg( "Operator short Name is (%s) &  length (%d)", dec_short_ons, length);
-       return TRUE;
-}
+       p_opl->lac_from = (*(p_in+3) << 8) | (*(p_in+4) & 0x00ff);
+       dbg( " Start value of the LAC range[%x]",       p_opl->lac_from);
 
-gboolean tcore_sim_decode_opl(unsigned char *enc_opl, int enc_opl_len, TelSimOpl *dec_opl)
-{
-       unsigned char packet_in_digit[3 * 2 + 1];
+       p_opl->lac_to = (*(p_in+5) << 8) | (*(p_in+6) & 0x00ff);
+       dbg( " End value of the LAC range[%x]", p_opl->lac_to);
 
-       tcore_check_return_value_assert(enc_opl != NULL, FALSE);
-       tcore_check_return_value_assert(enc_opl_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_opl != NULL, FALSE);
+       p_opl->rec_identifier = p_in[7];
+       dbg( " PNN Record identifier[%x]", p_opl->rec_identifier);
 
-       if (tcore_util_is_empty(enc_opl, enc_opl_len) == TRUE) {
-               err("empty record");
-               return FALSE;   // this is empty record
-       }
-       tcore_util_convert_bcd_to_digit((char*) packet_in_digit, (char*) &enc_opl[0], 3);
-       dbg( "AFTER tcore_util_convert_bcd_to_digit 4th[0x%x]", packet_in_digit[3]);
-
-       // get MCC
-       memcpy(&dec_opl->plmn, &(packet_in_digit[0]), 3);
-       // get MNC
-       if (packet_in_digit[3] == 0x00){
-               memcpy(&(dec_opl->plmn[3]), &(packet_in_digit[3 + 1]), 2);
-               dec_opl->plmn[5] = '\0';
-       } else{
-               memcpy(&(dec_opl->plmn[3]), &(packet_in_digit[3]), 3);
-               dec_opl->plmn[6] = '\0';
-       }
-
-       dbg( " PLMN Code[%s]", dec_opl->plmn);
-       dec_opl->lac_from = (*(enc_opl+3) << 8) | (*(enc_opl+4) & 0x00ff);
-       dbg( " Start value of the LAC range[%x]",       dec_opl->lac_from);
-       dec_opl->lac_to = (*(enc_opl+5) << 8) | (*(enc_opl+6) & 0x00ff);
-       dbg( " End value of the LAC range[%x]", dec_opl->lac_to);
-       dec_opl->rec_identifier = enc_opl[7];
-       dbg( " PNN Record identifier[%x]", dec_opl->rec_identifier);
        return TRUE;
 }
 
-gboolean tcore_sim_decode_pnn(unsigned char* enc_pnn, int enc_pnn_len, TelSimPnn *dec_pnn)
+gboolean tcore_sim_decode_pnn(struct tel_sim_pnn *p_pnn, unsigned char* p_in, int in_length)
 {
-       int full_name_len = 0, short_name_len = 0;
-       int cvt_leng = 0, short_name_base = 0;
-       unsigned char *full_name_str, *short_name_str;
+       int f_name_len = 0, s_name_len = 0;
+       int cvt_leng = 0, s_name_base = 0;
 
-       tcore_check_return_value_assert(enc_pnn != NULL, FALSE);
-       tcore_check_return_value_assert(enc_pnn_len != 0, FALSE);
-       tcore_check_return_value_assert(dec_pnn != NULL, FALSE);
-
-       if (tcore_util_is_empty(enc_pnn, enc_pnn_len) == TRUE) {
-               err("empty record");
+       if (_is_empty(p_in, in_length) == TRUE) {
+               memset(p_pnn, 0x00, sizeof(struct tel_sim_pnn));
                return FALSE;   // this is empty record
        }
 
        /*Full name for network IEI(Information Element Identifier),0x43*/
-       if (enc_pnn[0] == 0x43) {
+       if (p_in[0] == 0x43) {
                dbg( " Full name of network IEI exist");
                //f_name_part includes information byte.
-               full_name_len =  (int)enc_pnn[1] - 1;
+               f_name_len =  (int)p_in[1] - 1;
 
                /* 3rd byte information element(according to TS 24.008 for Network Name)
                 8 :ext1
@@ -1331,409 +2962,837 @@ gboolean tcore_sim_decode_pnn(unsigned char* enc_pnn, int enc_pnn_len, TelSimPnn
                 0      1       0               to      reserved
                 1      1       1               to      reserved
                 */
-               if ((enc_pnn[2] & 0x70) >> 4 == 0) {
+               if ((p_in[2] & 0x70) >> 4 == 0) {
                        dbg( "DCS:GSM7");
                        // In case of GSM7, 35byte packing data will be converted 40 bytes unpacking string.
-                       if (full_name_len > (TEL_SIM_NW_FULL_NAME_LEN_MAX * 7) / 8)
-                               full_name_len = (TEL_SIM_NW_FULL_NAME_LEN_MAX * 7) / 8;
+                       if (f_name_len > (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8)
+                               f_name_len = (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8;
 
-                       full_name_str = (unsigned char *) tcore_util_unpack_gsm7bit(enc_pnn + 3, full_name_len);
-                       memcpy(&dec_pnn->full_name, full_name_str, TEL_SIM_NW_FULL_NAME_LEN_MAX+1);
-               } else if ((enc_pnn[2] & 0x70) >> 4 == 1) {
+                       _unpack_7bit28bit(p_in + 3, f_name_len, (unsigned char *) (p_pnn->full_name));
+               } else if ((p_in[2] & 0x70) >> 4 == 1) {
                        dbg( "DCS:UCS2");
                        /* current telephony supports 40 bytes network name string */
-                       if (full_name_len > TEL_SIM_NW_FULL_NAME_LEN_MAX)
-                               full_name_len = TEL_SIM_NW_FULL_NAME_LEN_MAX;
+                       if (f_name_len > SIM_NW_FULL_NAME_LEN_MAX)
+                               f_name_len = SIM_NW_FULL_NAME_LEN_MAX;
 
-                       tcore_util_convert_str_to_utf8((guchar *) (dec_pnn->full_name), (gushort *) &cvt_leng, TEL_UTIL_ALPHABET_FORMAT_UCS2, enc_pnn + 3, full_name_len);
+                       _ucs2_to_utf8(f_name_len, p_in + 3, (int*) &cvt_leng, (unsigned char *) (p_pnn->full_name));
                } else {
                        dbg( "DCS:unknown");
                        return FALSE;
                }
-               dbg( " Full name of network contents[%s]", dec_pnn->full_name);
+               dbg( " Full name of network contents[%s]", p_pnn->full_name);
 
-               short_name_base = (int)enc_pnn[1] +2;
-               dbg( " short name base byte [0x%02x]", short_name_base);
+               s_name_base = (int)p_in[1] +2;
+               dbg( " short name base byte [0x%02x]", s_name_base);
 
                /*Short Name for network IEI(Information Element Identifier), 0x45*/
-               if (enc_pnn[short_name_base] == 0x45) {
+               if (p_in[s_name_base] == 0x45) {
                        dbg( " Short name of network IEI exist");
                        //s_name_part includes information byte.
-                       short_name_len = enc_pnn[short_name_base +1] -1;
+                       s_name_len = p_in[s_name_base +1] -1;
 
-                       if ((enc_pnn[short_name_base + 2] & 0x70) >> 4 == 0) {
+                       if ((p_in[s_name_base + 2] & 0x70) >> 4 == 0) {
                                dbg( "DCS:GSM7");
                                // In case of GSM7, 35byte packing data will be converted 40 bytes unpacking string.
-                               if (short_name_len > (TEL_SIM_NW_FULL_NAME_LEN_MAX * 7) / 8)
-                                       short_name_len = (TEL_SIM_NW_FULL_NAME_LEN_MAX * 7) / 8;
+                               if (s_name_len > (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8)
+                                       s_name_len = (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8;
 
-                               short_name_str = (unsigned char *) tcore_util_unpack_gsm7bit(enc_pnn + short_name_base + 3, short_name_len);
-                               memcpy(&dec_pnn->short_name, short_name_str, TEL_SIM_NW_FULL_NAME_LEN_MAX+1);
-                       } else if ((enc_pnn[short_name_base +2] & 0x70) >> 4 == 1) {
+                               _unpack_7bit28bit(p_in + s_name_base + 3, s_name_len, (unsigned char *) (p_pnn->short_name));
+                       } else if ((p_in[s_name_base +2] & 0x70) >> 4 == 1) {
                                dbg( "DCS:UCS2");
-                               if (short_name_len > TEL_SIM_NW_FULL_NAME_LEN_MAX)
-                                       short_name_len = TEL_SIM_NW_FULL_NAME_LEN_MAX;
+                               if (s_name_len > SIM_NW_FULL_NAME_LEN_MAX)
+                                       s_name_len = SIM_NW_FULL_NAME_LEN_MAX;
 
-                               tcore_util_convert_str_to_utf8((guchar *) (dec_pnn->short_name), (gushort*) &cvt_leng, TEL_UTIL_ALPHABET_FORMAT_UCS2, enc_pnn + short_name_base+ 3, short_name_len);
+                               _ucs2_to_utf8(s_name_len, p_in + s_name_base+ 3, (int*) &cvt_leng, (unsigned char *) (p_pnn->short_name));
                        } else {
                                dbg( "DCS:unknown");
                                return FALSE;
                        }
-                       dbg( " Short name of network contents[%s]", dec_pnn->short_name);
+                       dbg( " Short name of network contents[%s]", p_pnn->short_name);
                }
                return TRUE;
        }
        return FALSE;
 }
 
-gboolean tcore_sim_get_status(CoreObject *co, TelSimCardStatus *status)
+gboolean tcore_sim_decode_oplmnwact(struct tel_sim_oplmnwact_list *p_list, unsigned char *p_in, int in_length)
 {
-       PrivateObject *po = NULL;
+       unsigned long m = 0;
+//unsigned long k, j, m = 0;
+//     unsigned char mask = 0x00;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       //current raw data can include invalid OPLMN data(ex: ff ff ff 00 00). so we can`t decide the number of OPLMN records directly.
+       int rawOplmnWactCount = 0;
+       int i = 0;
 
-       *status = po->sim_status;
+       memset((void*) p_list, 0, sizeof(struct tel_sim_oplmnwact_list));
 
-       return TRUE;
-}
+       rawOplmnWactCount = in_length / 5;
 
-gboolean tcore_sim_set_status(CoreObject *co, TelSimCardStatus status)
-{
-       PrivateObject *po = NULL;
+       dbg( "rawOplmnWactCount[%d]", rawOplmnWactCount);
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       for (i = 0; i < rawOplmnWactCount; i++) {
 
-       po->sim_status = status;
+               //Regarding current IPC data, even if there`s no OPLMN value, IPC data is sending with 'ff ff ff 00 00'. so we should check for validation.
+               if (p_in[m] == 0xff) {
+                       p_list->opwa_count = m / 5;
+                       dbg("OPLMN(MCC+MNC) value is not found at p_in[m]=[%lu].So OPLMN count is [%d]", m, p_list->opwa_count);
+                       return TRUE;
+               }
 
-       return TRUE;
-}
+               _decode_plmn(&p_in[m], p_list->opwa[i].plmn);
+               dbg( "[%d] OPLMN PLMN Code[%s]", i, p_list->opwa[i].plmn);
 
-gboolean tcore_sim_get_identification(CoreObject *co, TelSimCardChangeStatus *change_status)
-{
-       PrivateObject *po = NULL;
+               if(p_in[m+3] & 0x80)
+                       p_list->opwa[i].b_umts = 1;
+
+               if(p_in[m+4] & 0x80)
+                       p_list->opwa[i].b_gsm = 1;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+               m = m + 5;
+       }
 
-       *change_status = po->change_status;
+       p_list->opwa_count = rawOplmnWactCount;
+       dbg( "OPLMN count is p_list->opwa_count[%d]", p_list->opwa_count);
 
        return TRUE;
 }
 
-gboolean tcore_sim_set_identification(CoreObject *co, TelSimCardChangeStatus change_status)
+enum tel_sim_status tcore_sim_get_status(CoreObject *o)
 {
-       PrivateObject *po = NULL;
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return -1;
+       }
+       return po->sim_status;
+}
 
-       po->change_status = change_status;
+gboolean tcore_sim_set_status(CoreObject *o, enum tel_sim_status status)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       po->sim_status = status;
 
        return TRUE;
 }
 
-gboolean tcore_sim_get_type(CoreObject *co, TelSimCardType *type)
+gboolean tcore_sim_get_identification(CoreObject *o)
 {
-       PrivateObject *po = NULL;
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return -1;
+       }
+       return po->b_sim_changed;
+}
 
-       *type = po->type;
+gboolean tcore_sim_set_identification(CoreObject *o, gboolean b_changed)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       po->b_sim_changed = b_changed;
 
        return TRUE;
 }
 
-gboolean tcore_sim_set_type(CoreObject *co, TelSimCardType type)
+enum tel_sim_type tcore_sim_get_type(CoreObject *o)
 {
-       PrivateObject *po = NULL;
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return -1;
+       }
+       return po->type;
+}
 
+gboolean tcore_sim_set_type(CoreObject *o, enum tel_sim_type type)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
        po->type = type;
-
        return TRUE;
 }
 
-gboolean tcore_sim_get_imsi(CoreObject *co, TelSimImsiInfo **imsi)
+struct tel_sim_imsi* tcore_sim_get_imsi(CoreObject *o)
 {
-       PrivateObject *po = NULL;
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-
-       *imsi = (TelSimImsiInfo *)tcore_memdup((gconstpointer)&po->imsi, sizeof(TelSimImsiInfo));
+       struct tel_sim_imsi *tmp_imsi;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return NULL;
+       }
+       tmp_imsi =  calloc(1, sizeof(struct tel_sim_imsi));
+       memcpy(tmp_imsi, &po->imsi, sizeof(struct tel_sim_imsi));
+       return tmp_imsi;
+}
 
+gboolean tcore_sim_set_imsi(CoreObject *o, const struct tel_sim_imsi *imsi)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       memcpy(&po->imsi, imsi, sizeof(struct tel_sim_imsi));
        return TRUE;
 }
 
-gboolean tcore_sim_set_imsi(CoreObject *co, TelSimImsiInfo *imsi)
+struct tel_sim_msisdn_list* tcore_sim_get_msisdn_list(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct tel_sim_msisdn_list *tmp_msisdn_list;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return NULL;
+       } else if (!po->msisdn_list) {
+               dbg("po->msisdn_list is NULL");
+               return NULL;
+       }
+       tmp_msisdn_list =  calloc(1, sizeof(struct tel_sim_msisdn_list));
+       memcpy(tmp_msisdn_list, po->msisdn_list, sizeof(struct tel_sim_msisdn_list));
+       return tmp_msisdn_list;
+}
+
+gboolean tcore_sim_set_msisdn_list(CoreObject *o, const struct tel_sim_msisdn_list *msisdn_list)
+{
+       struct tel_sim_msisdn_list *empty_msisdn_list = NULL;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       if (!msisdn_list) {
+               empty_msisdn_list = calloc(1, sizeof(struct tel_sim_msisdn_list));
+               msisdn_list = empty_msisdn_list;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (po->msisdn_list) {
+               memcpy(po->msisdn_list, msisdn_list, sizeof(struct tel_sim_msisdn_list));
+       } else {
+               struct tel_sim_msisdn_list *tmp_msisdn_list = NULL;
+               tmp_msisdn_list =  calloc(1, sizeof(struct tel_sim_msisdn_list));
+               memcpy(tmp_msisdn_list, msisdn_list, sizeof(struct tel_sim_msisdn_list));
+               po->msisdn_list = tmp_msisdn_list;
+       }
 
-       memcpy(&po->imsi, imsi, sizeof(TelSimImsiInfo));
+       if (empty_msisdn_list)
+               free(empty_msisdn_list);
 
        return TRUE;
 }
 
-gboolean tcore_sim_get_service_table(CoreObject *co, TelSimServiceTable **svct)
+enum tcore_return tcore_sim_delete_msisdn_list(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return TCORE_RETURN_EINVAL;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (po->msisdn_list) {
+               free(po->msisdn_list);
+               po->msisdn_list = NULL;
+       }
 
-       *svct = (TelSimServiceTable *)tcore_memdup((gconstpointer)&po->svct, sizeof(TelSimServiceTable));
+       return TCORE_RETURN_SUCCESS;
+}
 
-       return TRUE;
+struct tel_sim_service_table* tcore_sim_get_service_table(CoreObject *o)
+{
+       struct tel_sim_service_table *tmp_svct;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return NULL;
+       } else if (!po->svct) {
+               dbg("po->svct is NULL.");
+               return NULL;
+       }
+       tmp_svct =  calloc(1, sizeof(struct tel_sim_service_table));
+       memcpy(tmp_svct, po->svct, sizeof(struct tel_sim_service_table));
+       return tmp_svct;
 }
 
-gboolean tcore_sim_set_service_table(CoreObject *co, TelSimServiceTable *svct)
+gboolean tcore_sim_set_service_table(CoreObject *o, const struct tel_sim_service_table *svct)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+       struct tel_sim_service_table *empty_svct = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       if (!svct) {
+               empty_svct = calloc(1, sizeof(struct tel_sim_service_table));
+               svct = empty_svct;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (po->svct) {
+               memcpy(po->svct, svct, sizeof(struct tel_sim_service_table));
+       } else {
+               struct tel_sim_service_table *tmp_svct = NULL;
+               tmp_svct =  calloc(1, sizeof(struct tel_sim_service_table));
+               memcpy(tmp_svct, svct, sizeof(struct tel_sim_service_table));
+               po->svct = tmp_svct;
+       }
 
-       memcpy(&po->svct, svct, sizeof(TelSimServiceTable));
+       if(empty_svct)
+               free(empty_svct);
 
        return TRUE;
 }
 
-gboolean tcore_sim_get_cphs_status(CoreObject *co, gboolean *is_supported)
+enum tcore_return tcore_sim_delete_service_table(CoreObject *o)
 {
-       PrivateObject *po = NULL;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return TCORE_RETURN_EINVAL;
+       }
+
+       if (po->svct) {
+               free(po->svct);
+               po->svct = NULL;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       return TCORE_RETURN_SUCCESS;
+}
 
-       *is_supported = po->is_cphs;
+gboolean tcore_sim_get_cphs_status(CoreObject *o){
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       return po->b_cphs;
+}
 
+gboolean tcore_sim_set_cphs_status(CoreObject *o, gboolean b_support){
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       po->b_cphs = b_support;
        return TRUE;
 }
 
-gboolean tcore_sim_set_cphs_status(CoreObject *co, gboolean is_supported)
+struct tel_sim_cphs_csp* tcore_sim_get_csp(CoreObject *o)
+{
+       struct tel_sim_cphs_csp *tmp_csp;
+       struct private_object_data *po = NULL;
+
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return NULL;
+       } else if (!po->csp) {
+               dbg("po->csp is NULL");
+               return NULL;
+       }
+       tmp_csp =  calloc(1, sizeof(struct tel_sim_cphs_csp));
+       if (!tmp_csp) {
+               err("memory allocation failed");
+               return NULL;
+       }
+       memcpy(tmp_csp, po->csp, sizeof(struct tel_sim_cphs_csp));
+       return tmp_csp;
+}
+
+gboolean tcore_sim_set_csp(CoreObject *o, const struct tel_sim_cphs_csp *csp)
 {
-       PrivateObject *po = NULL;
+       struct tel_sim_cphs_csp *empty_csp = NULL;
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       if (!csp) {
+               empty_csp = calloc(1, sizeof(struct tel_sim_cphs_csp));
+               csp = empty_csp;
+       }
 
-       po->is_cphs = is_supported;
+       if (!(po->csp)) {
+               po->csp =  calloc(1, sizeof(struct tel_sim_cphs_csp));
+               if (!(po->csp)) {
+                       err("memory allocation failed");
+                       free(empty_csp);
+                       return FALSE;
+               }
+       }
+       memcpy(po->csp, csp, sizeof(struct tel_sim_cphs_csp));
+       if (empty_csp)
+               free(empty_csp);
 
        return TRUE;
 }
 
-gboolean tcore_sim_get_spn(CoreObject *co, gchar **spn)
+gboolean tcore_sim_delete_csp(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(spn != NULL, FALSE);
+       struct private_object_data *po = NULL;
+
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
 
-       *spn = tcore_strdup(po->spn);
+       if (po->csp) {
+               free(po->csp);
+               po->csp = NULL;
+       }
 
        return TRUE;
 }
 
-gboolean tcore_sim_set_spn(CoreObject *co, gchar *spn)
+struct tel_sim_ecc_list* tcore_sim_get_ecc_list(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-
-       tcore_free(po->spn);
-       po->spn = tcore_strdup(spn);
-
-       return TRUE;
+       struct tel_sim_ecc_list *tmp_ecc_list;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return NULL;
+       } else if (!po->ecc_list) {
+               dbg("po->ecc_list is NULL");
+               return NULL;
+       }
+       tmp_ecc_list =  calloc(1, sizeof(struct tel_sim_ecc_list));
+       memcpy(tmp_ecc_list, po->ecc_list, sizeof(struct tel_sim_ecc_list));
+       return tmp_ecc_list;
 }
 
-gboolean tcore_sim_get_disp_condition(CoreObject *co,
-               TelSimSpnDispCondition *disp_condition)
+gboolean tcore_sim_set_ecc_list(CoreObject *o, const struct tel_sim_ecc_list *ecc_list)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(disp_condition != NULL, FALSE);
+       struct tel_sim_ecc_list *empty_ecc_list = NULL;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       if (!ecc_list) {
+               empty_ecc_list = calloc(1, sizeof(struct tel_sim_ecc_list));
+               ecc_list = empty_ecc_list;
+       }
+
+       if (po->ecc_list) {
+               memcpy(po->ecc_list, ecc_list, sizeof(struct tel_sim_ecc_list));
+       } else {
+               struct tel_sim_ecc_list *tmp_ecc_list = NULL;
+               tmp_ecc_list =  calloc(1, sizeof(struct tel_sim_ecc_list));
+               memcpy(tmp_ecc_list, ecc_list, sizeof(struct tel_sim_ecc_list));
+               po->ecc_list = tmp_ecc_list;
+       }
 
-       *disp_condition = po->disp_condition;
+       if (empty_ecc_list)
+               free(empty_ecc_list);
 
        return TRUE;
 }
 
-gboolean tcore_sim_set_disp_condition(CoreObject *co,
-               TelSimSpnDispCondition disp_condition)
+enum tcore_return tcore_sim_delete_ecc_list(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return TCORE_RETURN_EINVAL;
+       }
 
-       po->disp_condition = disp_condition;
+       if (po->ecc_list) {
+               free(po->ecc_list);
+               po->ecc_list = NULL;
+       }
 
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
+}
+
+struct tel_sim_spn* tcore_sim_get_spn(CoreObject *o)
+{
+       struct tel_sim_spn *tmp_spn;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return NULL;
+       } else if (!po->spn) {
+               dbg("po->spn is NULL");
+               return NULL;
+       }
+       tmp_spn =  calloc(1, sizeof(struct tel_sim_spn));
+       memcpy(tmp_spn, po->spn, sizeof(struct tel_sim_spn));
+       return tmp_spn;
 }
 
-gboolean tcore_sim_link_userdata(CoreObject *co, void *userdata)
+gboolean tcore_sim_set_spn(CoreObject *o, const struct tel_sim_spn *spn)
 {
-       PrivateObject *po = NULL;
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct tel_sim_spn *empty_spn = NULL;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       if (!spn) {
+               empty_spn = calloc(1, sizeof(struct tel_sim_spn));
+               spn = empty_spn;
+       }
 
-       po->userdata = userdata;
+       if (po->spn) {
+               memcpy(po->spn, spn, sizeof(struct tel_sim_spn));
+       } else {
+               struct tel_sim_spn *tmp_spn = NULL;
+               tmp_spn =  calloc(1, sizeof(struct tel_sim_spn));
+               memcpy(tmp_spn, spn, sizeof(struct tel_sim_spn));
+               po->spn = tmp_spn;
+       }
+
+       if (empty_spn)
+               free(empty_spn);
 
        return TRUE;
 }
 
-void* tcore_sim_ref_userdata(CoreObject *co)
+enum tcore_return tcore_sim_delete_spn(CoreObject *o)
 {
-       PrivateObject *po = NULL;
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
-       tcore_check_return_value_assert(po->userdata != NULL, NULL);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return TCORE_RETURN_EINVAL;
+       }
 
-       return po->userdata;
+       if (po->spn) {
+               free(po->spn);
+               po->spn = NULL;
+       }
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-static void tcore_sim_initialize_context(CoreObject *co)
+struct tel_sim_cphs_netname* tcore_sim_get_cphs_netname(CoreObject *o)
 {
-       TcoreSimOps *tmp_ops = NULL;
-       PrivateObject *po = NULL;
-
-       po = tcore_object_ref_object(co);
-       tcore_check_return_assert(po != NULL);
-       tmp_ops = po->ops;
-       memset(po, 0x00, sizeof(PrivateObject));
-       po->ops = tmp_ops;
-       po->sim_status = TEL_SIM_STATUS_UNKNOWN;
+       struct tel_sim_cphs_netname *tmp_cphs_netname;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return NULL;
+       } else if (!po->cphs_netname) {
+               dbg("po->cphs_netname is NULL");
+               return NULL;
+       }
+       tmp_cphs_netname =  calloc(1, sizeof(struct tel_sim_cphs_netname));
+       memcpy(tmp_cphs_netname, po->cphs_netname, sizeof(struct tel_sim_cphs_netname));
+       return tmp_cphs_netname;
 }
 
-void tcore_sim_override_ops(CoreObject *co, TcoreSimOps *sim_ops)
+gboolean tcore_sim_set_cphs_netname(CoreObject *o, const struct tel_sim_cphs_netname *cphs_netname)
 {
-       PrivateObject *po = NULL;
-       po = (PrivateObject *)tcore_object_ref_object(co);
-
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(sim_ops != NULL);
+       struct tel_sim_cphs_netname *empty_cphs_netname = NULL;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       if (!cphs_netname) {
+               empty_cphs_netname = calloc(1, sizeof(struct tel_sim_cphs_netname));
+               cphs_netname = empty_cphs_netname;
+       }
 
-       if (sim_ops->get_ecc)
-               po->ops->get_ecc = sim_ops->get_ecc;
+       if (po->cphs_netname) {
+               memcpy(po->cphs_netname, cphs_netname, sizeof(struct tel_sim_cphs_netname));
+       } else {
+               struct tel_sim_cphs_netname *tmp_cphs_netname = NULL;
+               tmp_cphs_netname =  calloc(1, sizeof(struct tel_sim_cphs_netname));
+               memcpy(tmp_cphs_netname, cphs_netname, sizeof(struct tel_sim_cphs_netname));
+               po->cphs_netname = tmp_cphs_netname;
+       }
 
-       if (sim_ops->get_iccid)
-               po->ops->get_iccid = sim_ops->get_iccid;
+       if (empty_cphs_netname)
+               free(empty_cphs_netname);
 
-       if (sim_ops->get_language)
-               po->ops->get_language = sim_ops->get_language;
+       return TRUE;
+}
 
-       if (sim_ops->set_language)
-               po->ops->set_language = sim_ops->set_language;
+enum tcore_return tcore_sim_delete_cphs_netname(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return TCORE_RETURN_EINVAL;
+       }
 
-       if (sim_ops->get_callforwarding_info)
-               po->ops->get_callforwarding_info = sim_ops->get_callforwarding_info;
+       if (po->cphs_netname) {
+               free(po->cphs_netname);
+               po->cphs_netname = NULL;
+       }
 
-       if (sim_ops->get_messagewaiting_info)
-               po->ops->get_messagewaiting_info = sim_ops->get_messagewaiting_info;
+       return TCORE_RETURN_SUCCESS;
+}
 
-       if (sim_ops->set_messagewaiting_info)
-               po->ops->set_messagewaiting_info = sim_ops->set_messagewaiting_info;
+struct tel_sim_iccid* tcore_sim_get_iccid(CoreObject *o)
+{
+       struct tel_sim_iccid *tmp_iccid;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return NULL;
+       } else if (!po->iccid) {
+               dbg("po->iccid is NULL");
+               return NULL;
+       }
+       tmp_iccid =  calloc(1, sizeof(struct tel_sim_iccid));
+       memcpy(tmp_iccid, po->iccid, sizeof(struct tel_sim_iccid));
+       return tmp_iccid;
+}
 
-       if (sim_ops->get_mailbox_info)
-               po->ops->get_mailbox_info = sim_ops->get_mailbox_info;
+gboolean tcore_sim_set_iccid(CoreObject *o, const struct tel_sim_iccid *iccid)
+{
+       struct tel_sim_iccid *empty_iccid = NULL;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       if (!iccid) {
+               empty_iccid = calloc(1, sizeof(struct tel_sim_iccid));
+               iccid = empty_iccid;
+       }
 
-       if (sim_ops->set_mailbox_info)
-               po->ops->set_mailbox_info = sim_ops->set_mailbox_info;
+       if (po->iccid) {
+               memcpy(po->iccid, iccid, sizeof(struct tel_sim_iccid));
+       } else {
+               struct tel_sim_iccid *tmp_iccid = NULL;
+               tmp_iccid =  calloc(1, sizeof(struct tel_sim_iccid));
+               memcpy(tmp_iccid, iccid, sizeof(struct tel_sim_iccid));
+               po->iccid = tmp_iccid;
+       }
 
-       if (sim_ops->get_msisdn)
-               po->ops->get_msisdn = sim_ops->get_msisdn;
+       if (empty_iccid)
+               free(empty_iccid);
 
-       if (sim_ops->get_spn)
-               po->ops->get_spn = sim_ops->get_spn;
+       return TRUE;
+}
 
-       if (sim_ops->get_cphs_netname)
-               po->ops->get_cphs_netname = sim_ops->get_cphs_netname;
+enum tcore_return tcore_sim_delete_iccid(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return TCORE_RETURN_EINVAL;
+       }
 
-       if (sim_ops->get_sp_display_info)
-               po->ops->get_sp_display_info = sim_ops->get_sp_display_info;
+       if (po->iccid) {
+               free(po->iccid);
+               po->iccid = NULL;
+       }
 
-       if (sim_ops->req_authentication)
-               po->ops->req_authentication = sim_ops->req_authentication;
+       return TCORE_RETURN_SUCCESS;
+}
 
-       if (sim_ops->verify_pins)
-               po->ops->verify_pins = sim_ops->verify_pins;
+gboolean tcore_sim_link_userdata(CoreObject *o, void *userdata)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
+       }
+       po->userdata = userdata;
+       return TRUE;
+}
 
-       if (sim_ops->verify_puks)
-               po->ops->verify_puks = sim_ops->verify_puks;
+void* tcore_sim_ref_userdata(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po || !po->userdata) {
+               dbg("po access fail");
+               return NULL;
+       }
+       return po->userdata;
+}
 
-       if (sim_ops->change_pins)
-               po->ops->change_pins = sim_ops->change_pins;
+static void tcore_sim_initialize_context(CoreObject *o)
+{
+       struct tcore_sim_operations *tmp_ops = NULL;
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return;
+       }
 
-       if (sim_ops->disable_facility)
-               po->ops->disable_facility = sim_ops->disable_facility;
+       tmp_ops = po->ops;
+       memset(po, 0x00, sizeof(struct private_object_data));
+       po->ops = tmp_ops;
+       po->sim_status = SIM_STATUS_UNKNOWN;
+}
 
-       if (sim_ops->enable_facility)
-               po->ops->enable_facility = sim_ops->enable_facility;
+unsigned char tcore_sim_get_app_list(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               err("po access fail");
+               return 0;
+       }
+       return po->app_list;
+}
 
-       if (sim_ops->get_facility)
-               po->ops->get_facility = sim_ops->get_facility;
+gboolean tcore_sim_set_app_list(CoreObject *o, unsigned char app_list)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               err("po access fail");
+               return FALSE;
+       }
 
-       if (sim_ops->get_lock_info)
-               po->ops->get_lock_info = sim_ops->get_lock_info;
+       po->app_list = app_list;
+       return TRUE;
+}
 
-       if (sim_ops->req_apdu)
-               po->ops->req_apdu = sim_ops->req_apdu;
+struct tel_sim_ist *tcore_sim_get_isim_service_table(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       struct tel_sim_ist *ist;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               err("po access fail");
+               return NULL;
+       }
+       if (!po->ist) {
+               err("po->ist is NULL");
+               return NULL;
+       }
 
-       if (sim_ops->req_atr)
-               po->ops->req_atr = sim_ops->req_atr;
+       ist = calloc(1, sizeof(struct tel_sim_ist));
+       memcpy(ist, po->ist, sizeof(struct tel_sim_ist));
+       return ist;
 }
 
-gboolean tcore_sim_set_ops(CoreObject *co, TcoreSimOps *ops)
+gboolean tcore_sim_set_isim_service_table(CoreObject *o, struct tel_sim_ist *ist)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               err("po access fail");
+               return FALSE;
+       }
+       if (!ist) {
+               err("ist is NULL");
+               return FALSE;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (po->ist) {
+               memcpy(po->ist, ist, sizeof(struct tel_sim_ist));
+       } else {
+               po->ist = calloc(1, sizeof(struct tel_sim_ist));
+               memcpy(po->ist, ist, sizeof(struct tel_sim_ist));
+       }
+       return TRUE;
+}
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+enum tcore_return tcore_sim_delete_isim_service_table(CoreObject *o)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               err("po access fail");
+               return TCORE_RETURN_EINVAL;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSimOps));
+       if (po->ist) {
+               free(po->ist);
+               po->ist = NULL;
+       }
 
-       return TRUE;
+       return TCORE_RETURN_SUCCESS;
 }
 
-CoreObject *tcore_sim_new(TcorePlugin *p,
-                       TcoreSimOps *ops, TcoreHal *hal)
+CoreObject *tcore_sim_new(TcorePlugin *p, const char *name,
+               struct tcore_sim_operations *ops, TcoreHal *hal)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
+
+       if (!p)
+               return NULL;
+
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
 
-       tcore_check_return_value_assert(p != NULL, NULL);
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
+       }
 
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       po->ops = ops;
 
-       po = tcore_malloc0(sizeof(PrivateObject));
-       po->ops = tcore_memdup(ops, sizeof(TcoreSimOps));
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_SIM);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_clone_hook(o, _clone_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_SIM);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
+       tcore_sim_initialize_context(o);
 
-       tcore_sim_initialize_context(co);
+       return o;
+}
 
-       return co;
+void tcore_sim_free(CoreObject *o)
+{
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SIM);
+       tcore_object_free(o);
 }
 
-void tcore_sim_free(CoreObject *co)
+void tcore_sim_set_ops(CoreObject *o, struct tcore_sim_operations *ops)
 {
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SIM);
-       tcore_object_free(co);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SIM);
+
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
+
+       po->ops = ops;
 }
index 91d4114..60a5433 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include <glib.h>
 
 #include "tcore.h"
 #include "plugin.h"
+#include "user_request.h"
 #include "co_sms.h"
 
-typedef struct {
-       TcoreSmsOps *ops;
-       gboolean ready_status;
-} PrivateObject;
+struct private_object_data {
+       struct tcore_sms_operations *ops;
+       enum telephony_sms_ready_status SmsReadyStatus;
+};
 
-static TelReturn _dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data)
+int _tcore_util_sms_encode_smsParameters(const struct telephony_sms_Params *incoming, unsigned char *data, int SMSPRecordLen)
 {
-       TcoreSmsOps *sms = NULL;
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
-
-       if (!po->ready_status) {
-               err("DEVICE_NOT_READY");
-               return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+       struct telephony_sms_Params *smsParams =  (struct telephony_sms_Params *)incoming;
+       unsigned int nPIDIndex = 0;
+       unsigned char nOffset = 0;
+
+       if(incoming == NULL || data == NULL)
+               return FALSE;
+
+       memset(data, 0xff, SMSPRecordLen);//pSmsParam->RecordLen);
+
+       dbg(" Record index = %d", (int) smsParams->recordIndex);
+       dbg(" Alpha ID Len = %d", (int) smsParams->alphaIdLen);
+       dbg(" Record Length : %d", SMSPRecordLen);//pSmsParam->RecordLen);
+
+       if (SMSPRecordLen/*pSmsParam->RecordLen*/>= nDefaultSMSPWithoutAlphaId) {
+               nPIDIndex = SMSPRecordLen
+                               /*pSmsParam->RecordLen*/- nDefaultSMSPWithoutAlphaId;
        }
-       sms = po->ops;
 
-       switch (command) {
-       case TCORE_COMMAND_SMS_SEND_SMS:
-               if (sms->send_sms)
-                       return sms->send_sms(co,
-                               (const TelSmsSendInfo *)request,
-                               cb,(void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_READ_IN_SIM:
-               if (sms->read_in_sim)
-                       return sms->read_in_sim(co,
-                               *((unsigned int *)request),
-                               cb,(void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_WRITE_IN_SIM:
-               if (sms->write_in_sim)
-                       return sms->write_in_sim(co,
-                               (const TelSmsSimDataInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_DELETE_IN_SIM:
-               if (sms->delete_in_sim)
-                       return sms->delete_in_sim(co,
-                               *((unsigned int *)request),
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_GET_COUNT:
-               if (sms->get_count)
-                       return sms->get_count(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_SET_CB_CONFIG:
-               if (sms->set_cb_config)
-                       return sms->set_cb_config(co,
-                               (const TelSmsCbConfigInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_GET_CB_CONFIG:
-               if (sms->get_cb_config)
-                       return sms->get_cb_config(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_GET_PARAMETERS:
-               if (sms->get_parameters)
-                       return sms->get_parameters(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_SET_PARAMETERS:
-               if (sms->set_parameters)
-                       return sms->set_parameters(co,
-                               (const TelSmsParamsInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_SEND_DELIVER_REPORT:
-               if (sms->send_deliver_report)
-                       return sms->send_deliver_report(co,
-                               (const TelSmsDeliverReportInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_SET_SCA:
-               if (sms->set_sca)
-                       return sms->set_sca(co,
-                               (const TelSmsSca *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_GET_SCA:
-               if (sms->get_sca)
-                       return sms->get_sca(co, cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_SET_MEMORY_STATUS:
-               if (sms->set_memory_status)
-                       return sms->set_memory_status(co,
-                               *(gboolean *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SMS_SET_MESSAGE_STATUS:
-               if (sms->set_message_status)
-                       return sms->set_message_status(co,
-                               (const TelSmsStatusInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       default:
-               err("Unsupported command:[%d]",command);
-               return TEL_RETURN_INVALID_PARAMETER;
+       //dongil01.park(2008/12/27) - Check Point
+       memcpy(data, smsParams->szAlphaId, (int) nPIDIndex/*pSmsParam->AlphaIdLen*/);
+
+       dbg(" Alpha ID : %s", smsParams->szAlphaId);
+       dbg(" nPIDIndex = %d", nPIDIndex);
+
+       data[nPIDIndex] = smsParams->paramIndicator;
+
+       dbg(" Param Indicator = %02x",  smsParams->paramIndicator);
+
+       if ((smsParams->paramIndicator & SMSPValidDestAddr) == 0x00) {
+               nOffset = nDestAddrOffset;
+
+               data[nPIDIndex + (nOffset)] = smsParams->tpDestAddr.dialNumLen + 1;
+               data[nPIDIndex + (++nOffset)] = ((smsParams->tpDestAddr.typeOfNum << 4) | smsParams->tpDestAddr.numPlanId) | 0x80;
+
+               memcpy(&data[nPIDIndex + (++nOffset)], &smsParams->tpDestAddr.diallingNum, smsParams->tpDestAddr.dialNumLen);
+
+               dbg(" nextIndex = %d", nPIDIndex);
        }
-       err("Operation NOT Supported");
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+
+       if( (smsParams->paramIndicator & SMSPValidSvcAddr) == 0x00 )
+       {
+               dbg("TON [%d] / NPI [%d]", smsParams->tpSvcCntrAddr.typeOfNum, smsParams->tpSvcCntrAddr.numPlanId);
+
+               nOffset = nSCAAddrOffset;
+
+               dbg("SCA Length : %d", smsParams->tpSvcCntrAddr.dialNumLen);
+
+               data[nPIDIndex + (nOffset)] = smsParams->tpSvcCntrAddr.dialNumLen + 1;
+               data[nPIDIndex + (++nOffset)] = ((smsParams->tpSvcCntrAddr.typeOfNum << 4) | smsParams->tpSvcCntrAddr.numPlanId) | 0x80;
+
+               memcpy(&data[nPIDIndex + (++nOffset)], &smsParams->tpSvcCntrAddr.diallingNum, smsParams->tpSvcCntrAddr.dialNumLen);
+
+               dbg(" nextIndex = %d", nPIDIndex);
+       }
+
+       if ((smsParams->paramIndicator & SMSPValidPID) == 0x00) {
+               nOffset = nPIDOffset;
+
+               data[nPIDIndex + nOffset] = smsParams->tpProtocolId;
+               dbg(" PID = %02x", smsParams->tpProtocolId);
+               dbg(" nextIndex = %d", nPIDIndex);
+       }
+
+       if ((smsParams->paramIndicator & SMSPValidDCS) == 0x00) {
+               nOffset = nDCSOffset;
+
+               data[nPIDIndex + nOffset] = smsParams->tpDataCodingScheme;
+               dbg(" DCS = %02x", smsParams->tpDataCodingScheme);
+               dbg(" nextIndex = %d", nPIDIndex);
+       }
+
+       if ((smsParams->paramIndicator & SMSPValidVP) == 0x00) {
+               nOffset = nVPOffset;
+
+               data[nPIDIndex + nOffset] = smsParams->tpValidityPeriod;
+               dbg(" VP = %02x", smsParams->tpValidityPeriod);
+               dbg(" nextIndex = %d", nPIDIndex);
+       }
+
+       return TRUE;
+
 }
 
-static void _po_free_hook(CoreObject *co)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
+void tcore_util_sms_semioctet_to_octect(int* nScLength) {
+       if (*nScLength % 2) {
+               *nScLength = (*nScLength / 2) + 1;
+       } else {
+               *nScLength = *nScLength / 2;
+       }
 
-       tcore_check_return(po != NULL);
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+       return;
 }
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
+int tcore_util_sms_decode_smsParameters(uint8_t *incoming, uint32_t length, struct telephony_sms_Params *params)
 {
-       PrivateObject *dest_po = NULL;
+       int alpha_id_len = 0;
+       int i = 0;
+       int nOffset = 0;
 
-       PrivateObject *src_po = tcore_object_ref_object(src);
-       tcore_check_return_assert(src_po != NULL);
-       tcore_check_return_assert(src_po->ops != NULL);
-       tcore_check_return_assert(dest != NULL);
+       dbg(" RecordLen = %d", length);
 
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreSmsOps));
-       tcore_object_link_object(dest, dest_po);
+       if(incoming == NULL || params == NULL)
+               return FALSE;
+
+       alpha_id_len = length -SMS_SMSP_PARAMS_MAX_LEN;
+
+       if ( alpha_id_len > 0 )
+       {
+               if(alpha_id_len > SMS_SMSP_ALPHA_ID_LEN_MAX)
+               {
+                       alpha_id_len = SMS_SMSP_ALPHA_ID_LEN_MAX;
+               }
+
+               for( i=0 ; i < alpha_id_len ; i++)
+               {
+                       if( 0xff == incoming[i])
+                       {
+                               dbg(" found");
+                               break;
+                       }
+               }
+
+               memcpy(params->szAlphaId, incoming, i);
+
+               params->alphaIdLen = i;
+
+               dbg(" Alpha id length = %d", i);
+
+       }
+       else
+       {
+               params->alphaIdLen = 0;
+               dbg(" Alpha id length is zero");
+       }
+
+       //dongil01.park - start parse from here.
+       params->paramIndicator = incoming[alpha_id_len];
+
+       dbg(" Param Indicator = %02x", params->paramIndicator);
+
+       //dongil01.park(2008/12/26) - DestAddr
+       if( (params->paramIndicator & SMSPValidDestAddr) == 0)
+       {
+               nOffset = nDestAddrOffset;
+
+               if( 0x00 == incoming[alpha_id_len + nOffset] || 0xff == incoming[alpha_id_len + nOffset])
+               {
+                       params->tpDestAddr.dialNumLen = 0;
+
+                       dbg("DestAddr Length is 0");
+               }
+               else
+               {
+                       if ( 0 < (int)incoming[alpha_id_len + nOffset] )
+                       {
+                               params->tpDestAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1 );
+
+                               if(params->tpDestAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN)
+                                       params->tpDestAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN;
+                       }
+                       else
+                       {
+                               params->tpDestAddr.dialNumLen = 0;
+                       }
+
+                       params->tpDestAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ;
+                       params->tpDestAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70 )>>4 ;
+
+                       memcpy( params->tpDestAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)], (params->tpDestAddr.dialNumLen)) ;
+
+                       dbg("Dest TON is %d",params->tpDestAddr.typeOfNum);
+                       dbg("Dest NPI is %d",params->tpDestAddr.numPlanId);
+                       dbg("Dest Length = %d",params->tpDestAddr.dialNumLen);
+                       dbg("Dest Addr = %s",params->tpDestAddr.diallingNum);
+
+               }
+       }
+
+       //dongil01.park(2008/12/26) - SvcAddr
+       if( (params->paramIndicator & SMSPValidSvcAddr) == 0)
+       {
+               nOffset = nSCAAddrOffset;
+
+               if( 0x00 == (int)incoming[alpha_id_len + nOffset] || 0xff == (int)incoming[alpha_id_len + nOffset] )
+               {
+                       params->tpSvcCntrAddr.dialNumLen = 0;
+
+                       dbg(" SCAddr Length is 0");
+               }
+               else
+               {
+                       if ( 0 < (int)incoming[alpha_id_len + nOffset]  )
+                       {
+                               params->tpSvcCntrAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1);
+
+                               if(params->tpSvcCntrAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN)
+                                       params->tpSvcCntrAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN;
+
+                               params->tpSvcCntrAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ;
+                               params->tpSvcCntrAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70) >>4 ;
+
+                               memcpy( params->tpSvcCntrAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)], (params->tpSvcCntrAddr.dialNumLen));
+
+                               dbg("SCAddr Length = %d ",params->tpSvcCntrAddr.dialNumLen);
+                               dbg("SCAddr TON is %d",params->tpSvcCntrAddr.typeOfNum);
+                               dbg("SCAddr NPI is %d",params->tpSvcCntrAddr.numPlanId);
+
+                               for( i = 0 ; i < (int)params->tpSvcCntrAddr.dialNumLen ; i ++)
+                                       dbg("SCAddr = %d [%02x]",i,params->tpSvcCntrAddr.diallingNum[i]);
+                       }
+                       else
+                       {
+                               params->tpSvcCntrAddr.dialNumLen = 0;
+                       }
+               }
+       }
+       else if ( (0x00 < (int)incoming[alpha_id_len +nSCAAddrOffset] && (int)incoming[alpha_id_len +nSCAAddrOffset] <= 12 )
+                       || 0xff != (int)incoming[alpha_id_len +nSCAAddrOffset])
+       {
+               nOffset = nSCAAddrOffset;
+
+               if( 0x00 == (int)incoming[alpha_id_len + nOffset] || 0xff == (int)incoming[alpha_id_len + nOffset] )
+               {
+                       params->tpSvcCntrAddr.dialNumLen = 0;
+                       dbg("SCAddr Length is 0");
+               }
+               else
+               {
+
+                       if ( 0 < (int)incoming[alpha_id_len + nOffset]  )
+                       {
+                               params->tpSvcCntrAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1);
+
+                               params->tpSvcCntrAddr.dialNumLen = incoming[alpha_id_len + nOffset] -1;
+
+                               if(params->tpSvcCntrAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN)
+                                       params->tpSvcCntrAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN;
+
+                               params->tpSvcCntrAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ;
+                               params->tpSvcCntrAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70) >>4 ;
+
+                               memcpy( params->tpSvcCntrAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)],
+                                               (params->tpSvcCntrAddr.dialNumLen)) ;
+
+                               dbg("SCAddr Length = %d ",params->tpSvcCntrAddr.dialNumLen);
+                               dbg("SCAddr TON is %d",params->tpSvcCntrAddr.typeOfNum);
+                               dbg("SCAddr NPI is %d",params->tpSvcCntrAddr.numPlanId);
+
+                               for( i = 0 ; i < (int)params->tpSvcCntrAddr.dialNumLen ; i ++)
+                                       dbg("SCAddr = %d [%02x]",i,params->tpSvcCntrAddr.diallingNum[i]);
+                       }
+                       else
+                       {
+                               params->tpSvcCntrAddr.dialNumLen = 0;
+                       }
+               }
+
+       }
+
+       if( (params->paramIndicator & SMSPValidPID) == 0 &&     (alpha_id_len + nPIDOffset) < SMS_MAX_EFSMSP_RECORD_LENGTH)
+       {
+               params->tpProtocolId = incoming[alpha_id_len + nPIDOffset];
+       }
+       if( (params->paramIndicator & SMSPValidDCS) == 0 && (alpha_id_len + nDCSOffset) < SMS_MAX_EFSMSP_RECORD_LENGTH)
+       {
+               params->tpDataCodingScheme = incoming[alpha_id_len + nDCSOffset];
+       }
+       if( (params->paramIndicator & SMSPValidVP) == 0 && (alpha_id_len + nVPOffset) < SMS_MAX_EFSMSP_RECORD_LENGTH)
+       {
+               params->tpValidityPeriod = incoming[alpha_id_len + nVPOffset];
+       }
+
+       dbg(" Alpha Id(Len) = %d",(int)params->alphaIdLen);
+
+       for (i=0; i< (int)params->alphaIdLen ; i++)
+       {
+               dbg(" Alpha Id = [%d] [%c]",i,params->szAlphaId[i]);
+       }
+       dbg(" PID = %d",params->tpProtocolId);
+       dbg(" DCS = %d",params->tpDataCodingScheme);
+       dbg(" VP = %d",params->tpValidityPeriod);
+
+       return TRUE;
 }
 
-gboolean tcore_sms_get_ready_status(CoreObject *co, gboolean *status)
+
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
-       tcore_check_return_value_assert(status != NULL, FALSE);
+       enum tcore_request_command command;
+       struct private_object_data *po = NULL;
+       TReturn rtn = TCORE_RETURN_SUCCESS;
 
-       *status = po->ready_status;
-       return TRUE;
+       CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_SMS, TCORE_RETURN_EINVAL);
+
+       po = tcore_object_ref_object(o);
+       if (!po || !po->ops) {
+               dbg("[tcore_SMS] ERR: private_object is NULL or ops is NULL");
+               return TCORE_RETURN_ENOSYS;
+       }
+
+       if(po->SmsReadyStatus == SMS_READY_STATUS_NONE) {
+               dbg("[tcore_SMS] DEVICE_NOT_READY");
+               return TCORE_RETURN_ENOSYS; /* TAPI_API_NETTEXT_DEVICE_NOT_READY */
+       }
+
+       command = tcore_user_request_get_command(ur);
+       switch (command) {
+               case TREQ_SMS_SEND_UMTS_MSG:
+                       if (!po->ops->send_umts_msg)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->send_umts_msg is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->send_umts_msg(o, ur);
+
+                       break;
+               case TREQ_SMS_READ_MSG:
+                       if (!po->ops->read_msg)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->read_msg is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->read_msg(o, ur);
+
+                       break;
+               case TREQ_SMS_SAVE_MSG:
+                       if (!po->ops->save_msg)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->save_msg is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->save_msg(o, ur);
+
+                       break;
+               case TREQ_SMS_DELETE_MSG:
+                       if (!po->ops->delete_msg)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->delete_msg is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->delete_msg(o, ur);
+
+                       break;
+               case TREQ_SMS_GET_COUNT:
+                       if (!po->ops->get_storedMsgCnt)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->get_storedMsgCnt is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->get_storedMsgCnt(o, ur);
+
+                       break;
+               case TREQ_SMS_GET_SCA:
+                       if (!po->ops->get_sca)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->get_sca is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->get_sca(o, ur);
+
+                       break;
+               case TREQ_SMS_SET_SCA:
+                       if (!po->ops->set_sca)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->set_sca is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->set_sca(o, ur);
+
+                       break;
+               case TREQ_SMS_GET_CB_CONFIG:
+                       if (!po->ops->get_cb_config)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->get_cb_config is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->get_cb_config(o, ur);
+
+                       break;
+               case TREQ_SMS_SET_CB_CONFIG:
+                       if (!po->ops->set_cb_config)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->set_cb_config is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->set_cb_config(o, ur);
+
+                       break;
+               case TREQ_SMS_SET_MEM_STATUS:
+                       if (!po->ops->set_mem_status)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->set_mem_status is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->set_mem_status(o, ur);
+
+                       break;
+               case TREQ_SMS_GET_PREF_BEARER:
+                       if (!po->ops->get_pref_brearer)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->get_pref_brearer is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->get_pref_brearer(o, ur);
+
+                       break;
+               case TREQ_SMS_SET_PREF_BEARER:
+                       if (!po->ops->set_pref_brearer)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->get_pref_brearer is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->set_pref_brearer(o, ur);
+
+                       break;
+               case TREQ_SMS_SET_DELIVERY_REPORT:
+                       if (!po->ops->set_delivery_report)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->set_delivery_report is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->set_delivery_report(o, ur);
+
+                       break;
+               case TREQ_SMS_SET_MSG_STATUS:
+                       if (!po->ops->set_msg_status)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->set_msg_status is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->set_msg_status(o, ur);
+
+                       break;
+               case TREQ_SMS_GET_PARAMS:
+                       if (!po->ops->get_sms_params)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->get_sms_params is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->get_sms_params(o, ur);
+
+                       break;
+               case TREQ_SMS_SET_PARAMS:
+                       if (!po->ops->set_sms_params)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->set_sms_params is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->set_sms_params(o, ur);
+
+                       break;
+               case TREQ_SMS_GET_PARAMCNT:
+                       if (!po->ops->get_paramcnt)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->get_paramcnt is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->get_paramcnt(o, ur);
+
+                       break;
+               case TREQ_SMS_SEND_CDMA_MSG:
+                       if (!po->ops->send_cdma_msg)
+                       {
+                               dbg("[tcore_SMS] ERR: po->ops->send_cdma_msg is NULL");
+                               return TCORE_RETURN_ENOSYS;
+                       }
+
+                       rtn = po->ops->send_cdma_msg(o, ur);
+
+                       break;
+               default:
+                       break;
+       }
+
+       dbg("[tcore_SMS] result = [0x%x], command = [0x%x]", rtn, command);
+
+       return rtn;
 }
 
-gboolean tcore_sms_set_ready_status(CoreObject *co, gboolean status)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       struct private_object_data *po = NULL;
 
-       po->ready_status = status;
-       return TRUE;
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SMS);
+
+       po = tcore_object_ref_object(o);
+       if (po) {
+               free(po);
+               tcore_object_link_object(o, NULL);
+       }
 }
 
-void tcore_sms_override_ops(CoreObject *co, TcoreSmsOps *ops)
+static void _clone_hook(CoreObject *src, CoreObject *dest)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(po->ops != NULL);
-       tcore_check_return_assert(ops != NULL);
-
-       if (ops->send_sms)
-               po->ops->send_sms = ops->send_sms;
-       if (ops->read_in_sim)
-               po->ops->read_in_sim = ops->read_in_sim;
-       if (ops->write_in_sim)
-               po->ops->write_in_sim = ops->write_in_sim;
-       if (ops->delete_in_sim)
-               po->ops->delete_in_sim = ops->delete_in_sim;
-       if (ops->get_count)
-               po->ops->get_count = ops->get_count;
-       if (ops->set_cb_config)
-               po->ops->set_cb_config = ops->set_cb_config;
-       if (ops->get_cb_config)
-               po->ops->get_cb_config = ops->get_cb_config;
-       if (ops->get_parameters)
-               po->ops->get_parameters = ops->get_parameters;
-       if (ops->set_parameters)
-               po->ops->set_parameters = ops->set_parameters;
-       if (ops->send_deliver_report)
-               po->ops->send_deliver_report = ops->send_deliver_report;
-       if (ops->set_sca)
-               po->ops->set_sca = ops->set_sca;
-       if (ops->get_sca)
-               po->ops->get_sca = ops->get_sca;
-       if (ops->set_memory_status)
-               po->ops->set_memory_status = ops->set_memory_status;
-       if (ops->set_message_status)
-               po->ops->set_message_status = ops->set_message_status;
+       struct private_object_data *src_po = NULL;
+       struct private_object_data *dest_po = NULL;
+
+       if (!src || !dest)
+               return;
+
+       dest_po = calloc(1, sizeof(struct private_object_data));
+       if (!dest_po) {
+               tcore_object_link_object(dest, NULL);
+               return;
+       }
+
+       src_po = tcore_object_ref_object(src);
+       dest_po->ops = src_po->ops;
+
+       tcore_object_link_object(dest, dest_po);
 }
 
-gboolean tcore_sms_set_ops(CoreObject *co, TcoreSmsOps *ops)
+enum telephony_sms_ready_status tcore_sms_get_ready_status(CoreObject *o)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return SMS_READY_STATUS_NONE;
+       }
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       return po->SmsReadyStatus;
+}
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+gboolean tcore_sms_set_ready_status(CoreObject *o, enum telephony_sms_ready_status status)
+{
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
+       if (!po) {
+               dbg("po access fail");
+               return FALSE;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSmsOps));
+       po->SmsReadyStatus = status;
 
        return TRUE;
 }
 
-CoreObject *tcore_sms_new(TcorePlugin *p,
-                       TcoreSmsOps *ops, TcoreHal *hal)
+CoreObject *tcore_sms_new(TcorePlugin *p, const char *name,
+               struct tcore_sms_operations *ops, TcoreHal *hal)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-       tcore_check_return_value_assert(p != NULL, NULL);
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
+
+       if (!p)
+               return NULL;
+
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
+       }
 
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+       po->ops = ops;
 
-       po = tcore_malloc0(sizeof(PrivateObject));
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_SMS);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_clone_hook(o, _clone_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
 
-       if (ops != NULL)
-               po->ops = tcore_memdup(ops, sizeof(TcoreSmsOps));
+       return o;
+}
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_SMS);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
-       return co;
+void tcore_sms_free(CoreObject *o)
+{
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SMS);
+       tcore_object_free(o);
 }
 
-void tcore_sms_free(CoreObject *co)
+void tcore_sms_set_ops(CoreObject *o, struct tcore_sms_operations *ops)
 {
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SMS);
-       tcore_object_free(co);
+       struct private_object_data *po = NULL;
+
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SMS);
+
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
+
+       po->ops = ops;
 }
index 3419071..cdf77a4 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
+#include <glib.h>
+
 #include "tcore.h"
 #include "plugin.h"
+#include "queue.h"
+#include "user_request.h"
 #include "co_ss.h"
 
+#define _check_null( name, value, err ) { \
+       if ( !value ) { \
+               dbg("[error] %s : NULL", name ); \
+               return err; \
+       } \
+}
+
 struct ussd_session {
        gboolean session;
-       TelSsUssdType type;
-       void *data;
-       guint data_len;
+       enum tcore_ss_ussd_type type;
+       voiddata;
+       int data_len;
 };
 
-typedef struct {
-       UssdSession ussd_s;
-       TcoreSsOps *ops;
-} PrivateObject;
+struct private_object_data {
+       struct ussd_session ussd_s;
+       struct tcore_ss_operations *ops;
+};
 
-static TelReturn _dispatcher(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *user_data)
+static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
 {
-       TcoreSsOps *ss = NULL;
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
+       enum tcore_request_command command;
+       TReturn ret = 0;
+
+       struct private_object_data *po = NULL;
+       po = tcore_object_ref_object(o);
 
-       ss = po->ops;
+       _check_null( "po", po, TCORE_RETURN_FAILURE);
+       _check_null( "po->ops", po->ops, TCORE_RETURN_FAILURE);
+       _check_null( "ur", ur, TCORE_RETURN_FAILURE);
 
+       command = tcore_user_request_get_command(ur);
        switch (command) {
-       case TCORE_COMMAND_SS_SET_BARRING:
-               if (ss->set_barring)
-                       return ss->set_barring(co,
-                               (TelSsBarringInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_GET_BARRING_STATUS:
-               if (ss->get_barring_status)
-                       return ss->get_barring_status(co,
-                               (TelSsBarringGetInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_CHANGE_BARRING_PASSWORD:
-               if (ss->change_barring_password)
-                       return ss->change_barring_password(co,
-                               (TelSsBarringPwdInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_SET_FORWARDING:
-               if (ss->set_forwarding)
-                       return ss->set_forwarding(co,
-                               (TelSsForwardInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_GET_FORWARDING_STATUS:
-               if (ss->get_forwarding_status)
-                       return ss->get_forwarding_status(co,
-                               (TelSsForwardGetInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_SET_WAITING:
-               if (ss->set_waiting)
-                       return ss->set_waiting(co,
-                               (TelSsWaitingInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_GET_WAITING_STATUS:
-               if (ss->get_waiting_status)
-                       return ss->get_waiting_status(co,
-                               *(TelSsClass *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_SET_CLI:
-               if (ss->set_cli)
-                       return ss->set_cli(co,
-                               (TelSsCliInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_GET_CLI_STATUS:
-               if (ss->get_cli_status)
-                       return ss->get_cli_status(co,
-                               *(TelSsCliType *)request,
-                               cb, (void *)user_data);
-               break;
-
-       case TCORE_COMMAND_SS_SEND_USSD_REQUEST:
-               if (ss->send_ussd_request)
-                       return ss->send_ussd_request(co,
-                               (TelSsUssdInfo *)request,
-                               cb, (void *)user_data);
-               break;
-
-       default:
-               err("Unsupported Command [0x%x]", command);
-               return TEL_RETURN_INVALID_PARAMETER;
+               case TREQ_SS_BARRING_ACTIVATE:
+                       if (!po->ops->barring_activate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->barring_activate(o, ur);
+                       break;
+
+               case TREQ_SS_BARRING_DEACTIVATE:
+                       if (!po->ops->barring_deactivate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->barring_deactivate(o, ur);
+                       break;
+
+               case TREQ_SS_BARRING_CHANGE_PASSWORD:
+                       if (!po->ops->barring_change_password)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->barring_change_password(o, ur);
+                       break;
+
+               case TREQ_SS_BARRING_GET_STATUS:
+                       if (!po->ops->barring_get_status)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->barring_get_status(o, ur);
+                       break;
+
+               case TREQ_SS_FORWARDING_ACTIVATE:
+                       if (!po->ops->forwarding_activate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->forwarding_activate(o, ur);
+                       break;
+
+               case TREQ_SS_FORWARDING_DEACTIVATE:
+                       if (!po->ops->forwarding_deactivate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->forwarding_deactivate(o, ur);
+                       break;
+
+               case TREQ_SS_FORWARDING_REGISTER:
+                       if (!po->ops->forwarding_register)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->forwarding_register(o, ur);
+                       break;
+
+               case TREQ_SS_FORWARDING_DEREGISTER:
+                       if (!po->ops->forwarding_deregister)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->forwarding_deregister(o, ur);
+                       break;
+
+               case TREQ_SS_FORWARDING_GET_STATUS:
+                       if (!po->ops->forwarding_get_status)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->forwarding_get_status(o, ur);
+                       break;
+
+               case TREQ_SS_WAITING_ACTIVATE:
+                       if (!po->ops->waiting_activate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->waiting_activate(o, ur);
+                       break;
+
+               case TREQ_SS_WAITING_DEACTIVATE:
+                       if (!po->ops->waiting_deactivate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->waiting_deactivate(o, ur);
+                       break;
+
+               case TREQ_SS_WAITING_GET_STATUS:
+                       if (!po->ops->waiting_get_status)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->waiting_get_status(o, ur);
+                       break;
+
+               case TREQ_SS_CLI_ACTIVATE:
+                       if (!po->ops->cli_activate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->cli_activate(o, ur);
+                       break;
+
+               case TREQ_SS_CLI_DEACTIVATE:
+                       if (!po->ops->cli_deactivate)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->cli_deactivate(o, ur);
+                       break;
+
+               case TREQ_SS_CLI_SET_STATUS:
+                       if (!po->ops->cli_set_status)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->cli_set_status(o, ur);
+                       break;
+
+               case TREQ_SS_CLI_GET_STATUS:
+                       if (!po->ops->cli_get_status)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->cli_get_status(o, ur);
+                       break;
+
+               case TREQ_SS_SEND_USSD:
+                       if (!po->ops->send_ussd)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->send_ussd(o, ur);
+                       break;
+
+               case TREQ_SS_SET_AOC:
+                       if (!po->ops->set_aoc)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->set_aoc(o, ur);
+                       break;
+
+               case TREQ_SS_GET_AOC:
+                       if (!po->ops->get_aoc)
+                               return TCORE_RETURN_ENOSYS;
+
+                       ret = po->ops->get_aoc(o, ur);
+                       break;
+
+               default:
+                       break;
        }
 
-       err("Operation NOT Supported, Command: [0x%x]", command);
-       return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+       return ret;
 }
 
-static void _po_clone_hook(CoreObject *src, CoreObject *dest)
+static void _clone_hook(CoreObject *src, CoreObject *dest)
 {
-       PrivateObject *dest_po = NULL;
-       PrivateObject *src_po = tcore_object_ref_object(src);
+       struct private_object_data *src_po = NULL;
+       struct private_object_data *dest_po = NULL;
+
+       if (!src || !dest)
+               return;
+
+       dest_po = calloc(1, sizeof(struct private_object_data));
+       if (!dest_po) {
+               tcore_object_link_object(dest, NULL);
+               return;
+       }
 
-       tcore_check_return_assert(src_po != NULL);
-       tcore_check_return_assert(src_po->ops != NULL);
+       src_po = tcore_object_ref_object(src);
+       dest_po->ops = src_po->ops;
 
-       dest_po = tcore_malloc0(sizeof(PrivateObject));
-       dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreSsOps));
        tcore_object_link_object(dest, dest_po);
 }
 
-static void _po_free_hook(CoreObject *co)
+static void _free_hook(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
+       struct private_object_data *po = NULL;
 
-       tcore_check_return(po != NULL);
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return;
 
-       tcore_free(po->ops);
-       tcore_free(po);
-       tcore_object_link_object(co, NULL);
+       free(po);
+       tcore_object_link_object(o, NULL);
 }
 
-UssdSession *tcore_ss_ussd_create_session(CoreObject *co,
-       TelSsUssdType type, void *data, guint data_len)
+static void _ussd_session_init(struct ussd_session *ussd_s)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
+       ussd_s->session = FALSE;
+       ussd_s->type = 0;
+       ussd_s->data = 0;
+       ussd_s->data_len = 0;
+}
 
-       if (type > TEL_SS_USSD_TYPE_USER_REL) {
-               err("USSD type is Invalid");
-               return NULL;
+struct ussd_session* tcore_ss_ussd_create_session(CoreObject *o,
+               enum tcore_ss_ussd_type type, void *data, int data_len)
+{
+       struct private_object_data *po = NULL;
+
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
+
+       if (type < TCORE_SS_USSD_TYPE_USER_INITIATED
+                       || type > TCORE_SS_USSD_TYPE_NETWORK_INITIATED) {
+               dbg("[ error ] wrong ussd type : (0x%x)", type);
+               return 0;
        }
 
        if (!po->ussd_s.session) {
                po->ussd_s.session = TRUE;
                po->ussd_s.type = type;
-               po->ussd_s.data_len = data_len;
                po->ussd_s.data = data;
 
+               if (data_len < 0)
+                       po->ussd_s.data_len = 0;
+               else
+                       po->ussd_s.data_len = data_len;
+
                return &po->ussd_s;
-       }
 
-       warn("USSD session already exists, type: [%d]", po->ussd_s.type);
-       return NULL;
+       }
+       else {
+               dbg("[ error ] already exist ussd session, type : (0x%x)", po->ussd_s.type);
+               return 0;
+       }
 }
 
-void tcore_ss_ussd_destroy_session(UssdSession *ussd_s)
+void tcore_ss_ussd_destroy_session(struct ussd_session *ussd_s)
 {
-       tcore_check_return_assert(ussd_s != NULL);
+       if (!ussd_s || !ussd_s->session) {
+               return;
+       }
+       else {
 
-       memset(ussd_s, 0x00, sizeof(UssdSession));
+               _ussd_session_init(ussd_s);
+       }
 }
 
-UssdSession *tcore_ss_ussd_get_session(CoreObject *co)
+struct ussd_session* tcore_ss_ussd_get_session(CoreObject *o)
 {
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, NULL);
+       struct private_object_data *po = NULL;
 
-       if (po->ussd_s.session)
-               return &po->ussd_s;
+       po = tcore_object_ref_object(o);
+       if (!po)
+               return 0;
 
-       err("ussd session does not exist");
-       return NULL;
+       if (!po->ussd_s.session)
+               return 0;
+       else
+               return &po->ussd_s;
 }
 
-gboolean tcore_ss_ussd_get_session_type(UssdSession *ussd_s,
-       TelSsUssdType *ussd_type)
+enum tcore_ss_ussd_type tcore_ss_ussd_get_session_type(struct ussd_session *ussd_s)
 {
-       tcore_check_return_value_assert(ussd_s != NULL, FALSE);
-       tcore_check_return_value_assert(ussd_type != NULL, FALSE);
+       if (!ussd_s || !ussd_s->session) {
+               dbg("[ error ] there is no session");
+               return 0;
 
-       if (ussd_s->session) {
-               *ussd_type = ussd_s->type;
-               return TRUE;
        }
-
-       err("ussd session does not exist");
-       return FALSE;
+       else {
+               return ussd_s->type;
+       }
 }
 
-gboolean tcore_ss_ussd_set_session_type(UssdSession *ussd_s,
-                               TelSsUssdType type)
+void tcore_ss_ussd_set_session_type(struct ussd_session *ussd_s,
+               enum tcore_ss_ussd_type type)
 {
-       tcore_check_return_value_assert(ussd_s != NULL, FALSE);
+       if (!ussd_s || !ussd_s->session) {
+               dbg("[ error ] there is no session");
+               return;
 
-       if (ussd_s->session) {
+       }
+       else {
                ussd_s->type = type;
-               return TRUE;
        }
-
-       err("ussd session does not exist");
-       return FALSE;
 }
 
-gboolean tcore_ss_ussd_get_session_data(UssdSession *ussd_s,
-       void **data, guint *data_len)
+int tcore_ss_ussd_get_session_data(struct ussd_session* ussd_s, void **data)
 {
-       tcore_check_return_value_assert(ussd_s != NULL, FALSE);
-       tcore_check_return_value_assert(data != NULL, FALSE);
-       tcore_check_return_value_assert(data_len != NULL, FALSE);
+       if (!ussd_s || !ussd_s->session) {
+               dbg("[ error ] there is no session");
+               return -1;
 
-       if (ussd_s->session) {
-               *data = ussd_s->data;
-               *data_len = ussd_s->data_len;
-               return TRUE;
        }
+       else {
 
-       err("ussd session does not exist");
-       return FALSE;
+               *data = ussd_s->data;
+               return ussd_s->data_len;
+       }
 }
 
-gboolean tcore_ss_ussd_set_session_data(UssdSession *ussd_s,
-                               void *data, guint data_len)
+void tcore_ss_ussd_set_session_data(struct ussd_session* ussd_s, void *data, int data_len)
 {
-       tcore_check_return_value_assert(ussd_s != NULL, FALSE);
+       if (!ussd_s || !ussd_s->session) {
+               dbg("[ error ] there is no session");
+               return ;
+
+       }
+       else {
 
-       if (ussd_s->session) {
                ussd_s->data = data;
                ussd_s->data_len = data_len;
-               return TRUE;
        }
-
-       err("Session does not exist");
-       return FALSE;
 }
 
-void tcore_ss_override_ops(CoreObject *co, TcoreSsOps *ops)
-{
-       PrivateObject *po = tcore_object_ref_object(co);
-       tcore_check_return_assert(po != NULL);
-       tcore_check_return_assert(ops != NULL);
-       tcore_check_return_assert(po -> ops != NULL);
-
-       if (ops->set_barring)
-               po->ops->set_barring = ops->set_barring;
-       if (ops->get_barring_status)
-               po->ops->get_barring_status = ops->get_barring_status;
-       if (ops->change_barring_password)
-               po->ops->change_barring_password = ops->change_barring_password;
-       if (ops->set_forwarding)
-               po->ops->set_forwarding = ops->set_forwarding;
-       if (ops->get_forwarding_status)
-               po->ops->get_forwarding_status = ops->get_forwarding_status;
-       if (ops->set_waiting)
-               po->ops->set_waiting = ops->set_waiting;
-       if (ops->get_waiting_status)
-               po->ops->get_waiting_status = ops->get_waiting_status;
-       if (ops->set_cli)
-               po->ops->set_cli = ops->set_cli;
-       if (ops->get_cli_status)
-               po->ops->get_cli_status = ops->get_cli_status;
-       if (ops->send_ussd_request)
-               po->ops->send_ussd_request = ops->send_ussd_request;
-}
 
-gboolean tcore_ss_set_ops(CoreObject *co, TcoreSsOps *ops)
+CoreObject *tcore_ss_new(TcorePlugin *p, const char *name,
+               struct tcore_ss_operations *ops, TcoreHal *hal)
 {
-       PrivateObject *po;
-       tcore_check_return_value(co != NULL, FALSE);
+       CoreObject *o = NULL;
+       struct private_object_data *po = NULL;
 
-       po = tcore_object_ref_object(co);
-       tcore_check_return_value_assert(po != NULL, FALSE);
+       if (!p)
+               return NULL;
 
-       if (po->ops != NULL) {
-               tcore_free(po->ops);
-               po->ops = NULL;
+       o = tcore_object_new(p, name, hal);
+       if (!o)
+               return NULL;
+
+       po = calloc(1, sizeof(struct private_object_data));
+       if (!po) {
+               tcore_object_free(o);
+               return NULL;
        }
 
-       if (ops != NULL)
-               po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSsOps));
+       po->ops = ops;
+
+       _ussd_session_init(&po->ussd_s);
 
-       return TRUE;
+       tcore_object_set_type(o, CORE_OBJECT_TYPE_SS);
+       tcore_object_link_object(o, po);
+       tcore_object_set_free_hook(o, _free_hook);
+       tcore_object_set_clone_hook(o, _clone_hook);
+       tcore_object_set_dispatcher(o, _dispatcher);
+
+       return o;
 }
 
-CoreObject *tcore_ss_new(TcorePlugin *p, TcoreSsOps *ops, TcoreHal *hal)
+void tcore_ss_free(CoreObject *o)
 {
-       CoreObject *co = NULL;
-       PrivateObject *po = NULL;
-       tcore_check_return_value_assert(p != NULL, NULL);
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SS);
+
+       tcore_object_free(o);
+}
 
-       co = tcore_object_new(p, hal);
-       tcore_check_return_value_assert(co != NULL, NULL);
+void tcore_ss_set_ops(CoreObject *o, struct tcore_ss_operations *ops)
+{
+       struct private_object_data *po = NULL;
 
-       po = tcore_malloc0(sizeof(PrivateObject));
+       CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SS);
 
-       if (ops != NULL)
-               po->ops = tcore_memdup(ops, sizeof(TcoreSsOps));
+       po = (struct private_object_data *)tcore_object_ref_object(o);
+       if (!po) {
+               return;
+       }
 
-       tcore_object_set_type(co, CORE_OBJECT_TYPE_SS);
-       tcore_object_link_object(co, po);
-       tcore_object_set_free_hook(co, _po_free_hook);
-       tcore_object_set_clone_hook(co, _po_clone_hook);
-       tcore_object_set_dispatcher(co, _dispatcher);
-       return co;
+       po->ops = ops;
 }
 
-void tcore_ss_free(CoreObject *co)
-{
-       CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SS);
-       tcore_object_free(co);
-}
index c61c5fe..f2534d2 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,8 +30,8 @@
 #include "communicator.h"
 
 struct tcore_communicator_type {
-       gchar *name;
-       TcoreCommunicatorOps *ops;
+       const char *name;
+       struct tcore_communitor_operations *ops;
 
        void *user_data;
 
@@ -38,25 +39,21 @@ struct tcore_communicator_type {
 };
 
 
-Communicator* tcore_communicator_new(TcorePlugin *plugin,
-       const gchar *name, TcoreCommunicatorOps *ops)
+Communicator* tcore_communicator_new(TcorePlugin *plugin, const char *name,
+               struct tcore_communitor_operations *ops)
 {
        Communicator *comm;
 
-       comm = g_try_new0(struct tcore_communicator_type, 1);
-       if (comm == NULL) {
-               err("Failed to allocate memory");
+       comm = calloc(1, sizeof(struct tcore_communicator_type));
+       if (!comm)
                return NULL;
-       }
 
-       /* Update parameters */
-       comm->name = tcore_strdup(name);
+       if (name)
+               comm->name = strdup(name);
+
        comm->parent_plugin = plugin;
        comm->ops = ops;
 
-       dbg("Comunicator '%s' created", name);
-
-       /* Add communicator to Server */
        tcore_server_add_communicator(tcore_plugin_ref_server(plugin), comm);
 
        return comm;
@@ -64,70 +61,79 @@ Communicator* tcore_communicator_new(TcorePlugin *plugin,
 
 void tcore_communicator_free(Communicator *comm)
 {
-       if (comm == NULL) {
-               err("Communicator is NULL");
+       if (!comm)
                return;
-       }
 
-       dbg("Comunicator '%s' free", comm->name);
+       if (comm->name)
+               free((void *)comm->name);
 
-       /* Free resources */
-       tcore_free((void *)comm->name);
-       tcore_free(comm);
+       free(comm);
 }
 
 TcorePlugin *tcore_communicator_ref_plugin(Communicator *comm)
 {
-       if (comm == NULL) {
-               err("Communicator is NULL");
+       if (!comm)
                return NULL;
-       }
 
        return comm->parent_plugin;
 }
 
-const gchar *tcore_communicator_ref_name(Communicator *comm)
+const char *tcore_communicator_ref_name(Communicator *comm)
 {
-       if (comm == NULL) {
-               err("Communicator is NULL");
+       if (!comm)
                return NULL;
-       }
 
        return comm->name;
 }
 
-TelReturn tcore_communicator_link_user_data(Communicator *comm, void *data)
+TReturn tcore_communicator_link_user_data(Communicator *comm, void *data)
 {
-       if (comm == NULL) {
-               err("Communicator is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!comm)
+               return TCORE_RETURN_EINVAL;
 
        comm->user_data = data;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 void *tcore_communicator_ref_user_data(Communicator *comm)
 {
-       if (comm == NULL) {
-               err("Communicator is NULL");
+       if (!comm)
                return NULL;
-       }
 
        return comm->user_data;
 }
 
-TelReturn tcore_communicator_send_notification(Communicator *comm,
-       TcorePlugin *source, gint command, guint data_len, const void *data)
+TReturn tcore_communicator_dispatch_request(Communicator *comm, UserRequest *ur)
+{
+       Server *s;
+
+       if (!comm || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       s = tcore_plugin_ref_server(comm->parent_plugin);
+
+       return tcore_server_dispatch_request(s, ur);
+}
+
+TReturn tcore_communicator_send_response(Communicator *comm, UserRequest *ur,
+               enum tcore_response_command command,
+               unsigned int data_len, const void *data)
+{
+       if (!comm || !comm->ops || !comm->ops->send_response)
+               return TCORE_RETURN_EINVAL;
+
+       dbg("ur = 0x%x", (unsigned int)ur);
+
+       return comm->ops->send_response(comm, ur, command, data_len, data);
+}
+
+TReturn tcore_communicator_send_notification(Communicator *comm,
+               CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data)
 {
-       if ((comm == NULL) || (comm->ops == NULL)
-                       || (comm->ops->send_notification == NULL)) {
-               err("comm: [%p] ops: [%p] send_notiifcation: [%p]",
-                               comm, (comm ? comm->ops : NULL),
-                               ((comm && comm->ops) ? comm->ops->send_notification : NULL));
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!comm || !comm->ops || !comm->ops->send_notification)
+               return TCORE_RETURN_EINVAL;
 
        return comm->ops->send_notification(comm, source, command, data_len, data);
 }
index 4e4a9aa..af929cc 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 struct callback_type {
        CoreObject *co;
-       gchar *event;
-       TcoreObjectCallback callback;
+       char *event;
+       CoreObjectCallback callback;
        void *user_data;
 };
 
-/* Hooks related structures */
-typedef struct {
-       GSList *request_hooks_list;     /* List of (CoreObjectRequestCallbacks*) nodes */
-       GSList *request_list;                   /* List of (CoreObjectRequestList*) nodes */
-} CoreObjectRequestHook;
-
-typedef struct {
-       TcoreRequestHook func;          /* Request hook callback */
-       void *user_data;                                /* Request hook callback user_data */
-} CoreObjectRequestCallbacks;
-
-typedef struct {
-       void *request;                          /* Executing 'request' */
-       GSList *response_hook_list;     /* List of (CoreObjectResponseHook*) nodes */
-} CoreObjectRequestList;
-
-typedef struct {
-       TcoreResponseHook func;         /* Response hook callback */
-       void *user_data;                                /* Response hook callback user_data */
-} CoreObjectResponseHook;
-
-typedef struct {
-       TcoreNotification command;
-       TcoreNotificationHook func;
-       void *user_data;
-} CoreObjectNotificationHook;
-
 struct tcore_object_type {
-       guint type;
+       unsigned int type;
+       char *name;
 
        TcorePlugin *parent_plugin;
 
        void *object;
        void *user_data;
 
-       TcoreObjectFreeHook free_hook;
-       TcoreObjectCloneHook clone_hook;
-       TcoreObjectDispatcher dispatcher;
+       CoreObjectFreeHook free_hook;
+       CoreObjectCloneHook clone_hook;
+       CoreObjectDispatcher dispatcher;
        GSList *callbacks;
-
-       /*
-        * Request Hooks Hash table
-        *
-        * key - TcoreCommand
-        * value - CoreObjectRequestHook*
-        */
-       GHashTable *request_hooks;
-
-       /* Notification Hooks */
-       GSList *notification_hooks;
+       GHashTable *property;
 
        TcoreHal *hal;
 };
 
+
 /* Mapping Table */
 struct tcore_object_mapping_tbl {
        TcoreHal *hal;
        GSList *object_type;
 };
 
-typedef struct {
-       TcorePluginResponseCallback resp_cb;
-       void *resp_cbdata;
-
-       TcoreCommand command;
-       void *request;
-} TcoreObjectRespData;
-
-static void _util_print_mapping_tbl_entry(TcoreObjectMappingTable *tbl_entry)
+static void _util_print_mapping_tbl_entry(object_mapping_table_t *tbl_entry)
 {
        GSList *co_list;
 
@@ -131,20 +89,19 @@ static void _util_print_mapping_tbl_entry(TcoreObjectMappingTable *tbl_entry)
 
        /* Search all the Table entries with matching 'type' */
        for ( ; co_list ; co_list = co_list->next) {
-               if (co_list->data != NULL) {
-                       msg("           Core Object type: [0x%x]", co_list->data);
-               }
+               if (co_list->data == NULL)
+                       continue;
+
+               msg("           Core Object type: [0x%x]", co_list->data);
        }
 }
 
 static void _free_tbl_entry(gpointer data)
 {
-       TcoreObjectMappingTable *tbl_entry;
+       object_mapping_table_t *tbl_entry;
 
-       if (data == NULL) {
-               err("data is NULL");
+       if (data == NULL)
                return;
-       }
 
        tbl_entry = data;
 
@@ -155,87 +112,33 @@ static void _free_tbl_entry(gpointer data)
        g_slist_free(tbl_entry->object_type);
 
        /* Free Table entry */
-       tcore_free(tbl_entry);
-}
-
-static void __free_callback_data(gpointer data)
-{
-       struct callback_type *cb = data;
-
-       if (cb) {
-               tcore_free(cb->event);
-               tcore_free(cb);
-       }
+       g_free(tbl_entry);
 }
-
-static void __free_responses(gpointer data)
-{
-       CoreObjectRequestList *request_node = data;
-
-       /* Free resources */
-       g_slist_free_full(request_node->response_hook_list, g_free);
-}
-
-static void __free_request_hook(gpointer data)
-{
-       CoreObjectRequestHook *req_hook = data;
-
-       /* Free Request hook callback nodes */
-       g_slist_free_full(req_hook->request_hooks_list, g_free);
-
-       /* Free 'request' and correcponding Response hook nodes */
-       g_slist_free_full(req_hook->request_list, __free_responses);
-}
-
-static void __free_response_hook(CoreObject *co,
-       TcoreCommand command, void *request)
-{
-       CoreObjectRequestHook *req_hook;
-
-       req_hook = g_hash_table_lookup(co->request_hooks, (gconstpointer)command);
-       if (req_hook != NULL) {
-               GSList *req_list = req_hook->request_list;
-               CoreObjectRequestList *request_node;
-
-               for ( ; req_list ; req_list = req_list->next) {
-                       request_node = req_list->data;
-                       if (request_node != NULL)
-                               if (request_node->request == request)
-                                       g_slist_free_full(request_node->response_hook_list, g_free);
-               }
-       }
-
-}
-
-static CoreObject *_object_new(TcorePlugin *plugin, guint type)
+static CoreObject *_object_new(TcorePlugin *plugin, unsigned int type)
 {
        CoreObject *co;
 
-       co = tcore_malloc0(sizeof(CoreObject));
-       if (co == NULL) {
-               err("Failed allocate memory");
+       co = calloc(1, sizeof(struct tcore_object_type));
+       if (!co)
                return NULL;
-       }
 
-       /* Update parameters */
        co->parent_plugin = plugin;
-       co->type = type;
 
-       /* Request Hook Hash table */
-       co->request_hooks = g_hash_table_new_full(g_direct_hash,
-               g_direct_equal, NULL, __free_request_hook);
+       co->type = type;
+       co->property = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
 
        return co;
 }
 
 static gboolean _on_at_event(TcoreAT *at, const GSList *lines, void *user_data)
 {
-       struct callback_type *cb = user_data;
        gboolean ret;
 
+       struct callback_type *cb = user_data;
+
        ret = cb->callback(cb->co, lines, cb->user_data);
        if (ret == FALSE) {
-               err("Callback failed");
+
        }
 
        return ret;
@@ -246,45 +149,50 @@ static void _remove_at_callback(TcoreAT *at, struct callback_type *cb)
        tcore_at_remove_notification_full(at, cb->event, _on_at_event, cb);
 }
 
-static TcoreObjectMappingTable *_object_search_mapping_tbl_entry(GSList *mapping_tbl_list,
-       TcoreHal *hal)
+static object_mapping_table_t *_object_search_mapping_tbl_entry(GSList *mapping_tbl_list,
+                                                                                                               TcoreHal *hal)
 {
-       GSList *list = mapping_tbl_list;
-       TcoreObjectMappingTable *tbl_entry = NULL;
+       GSList *list;
+       object_mapping_table_t *tbl_entry = NULL;
 
-       for ( ; list ; list = list->next) {
+       for (list = mapping_tbl_list; list ; list = list->next) {
                tbl_entry = list->data;
-               if (tbl_entry != NULL) {
-                       /* Search for Table entry with matching 'hal' */
-                       if (tbl_entry->hal == hal)
-                               return tbl_entry;
+               if (tbl_entry == NULL)
+                       continue;
+
+               /* Search for Table entry with matching 'hal' */
+               if (tbl_entry->hal == hal) {
+                       return tbl_entry;
                }
        }
 
        return NULL;
 }
 
-static TcoreObjectMappingTable *_object_search_mapping_tbl_entry_by_type(
-       GSList *mapping_tbl_list, guint type)
+static object_mapping_table_t *_object_search_mapping_tbl_entry_by_type(
+                                                               GSList *mapping_tbl_list, unsigned int type)
 {
-       GSList *list = mapping_tbl_list;
-       TcoreObjectMappingTable *tbl_entry = NULL;
+       GSList *list;
+       GSList *co_list;
+       object_mapping_table_t *tbl_entry = NULL;
 
-       for ( ; list ; list = list->next) {
+       for (list = mapping_tbl_list; list ; list = list->next) {
                tbl_entry = list->data;
-               if (tbl_entry != NULL) {
-                       GSList *co_list = tbl_entry->object_type;
-
-                       /* Search all the Table entries with matching 'type' */
-                       for ( ; co_list ; co_list = co_list->next) {
-                               if (co_list->data != NULL)
-                                       if (type == (guint)co_list->data)
-                                               return tbl_entry;
+               if (tbl_entry == NULL)
+                       continue;
+
+               /* Search all the Table entries with matching 'type' */
+               for (co_list = tbl_entry->object_type ; co_list ; co_list = co_list->next) {
+                       if (co_list->data == NULL)
+                               continue;
+
+                       if (type == (unsigned int)co_list->data) {
+                               return tbl_entry;
                        }
                }
        }
 
-       return NULL;
+       return tbl_entry;
 }
 
 static CoreObject *_create_core_object_by_type(guint type,
@@ -295,57 +203,57 @@ static CoreObject *_create_core_object_by_type(guint type,
        switch (type) {
        case CORE_OBJECT_TYPE_MODEM:
                /* Create Core Object */
-               co = tcore_modem_new(plugin, NULL, hal);
+               co = tcore_modem_new(plugin, "modem", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_CALL:
                /* Create Core Object */
-               co = tcore_call_new(plugin, NULL, hal);
+               co = tcore_call_new(plugin, "call", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_SS:
                /* Create Core Object */
-               co = tcore_ss_new(plugin, NULL, hal);
+               co = tcore_ss_new(plugin, "ss", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_NETWORK:
                /* Create Core Object */
-               co = tcore_network_new(plugin, NULL, hal);
+               co = tcore_network_new(plugin, "network", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_PS:
                /* Create Core Object */
-               co = tcore_ps_new(plugin, NULL, hal);
+               co = tcore_ps_new(plugin, "ps", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_SIM:
                /* Create Core Object */
-               co = tcore_sim_new(plugin, NULL, hal);
+               co = tcore_sim_new(plugin, "sim", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_SAT:
                /* Create Core Object */
-               co = tcore_sat_new(plugin, NULL, hal);
+               co = tcore_sat_new(plugin, "sat", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_SAP:
                /* Create Core Object */
-               co = tcore_sap_new(plugin, NULL, hal);
+               co = tcore_sap_new(plugin, "sap", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_SMS:
                /* Create Core Object */
-               co = tcore_sms_new(plugin, NULL, hal);
+               co = tcore_sms_new(plugin, "sms", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_PHONEBOOK:
                /* Create Core Object */
-               co = tcore_phonebook_new(plugin, NULL, hal);
+               co = tcore_phonebook_new(plugin, "phonebook", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_GPS:
                /* Create Core Object */
-               co = tcore_gps_new(plugin, NULL, hal);
+               co = tcore_gps_new(plugin, "gps", NULL, hal);
        break;
 
        case CORE_OBJECT_TYPE_CUSTOM:           /* Fall through */
@@ -356,11 +264,16 @@ static CoreObject *_create_core_object_by_type(guint type,
        return co;
 }
 
-static gboolean _init_core_object_by_type(guint type,
-       TcorePlugin *plugin, TcoreObjectInitializer *initializer_list)
+
+static gboolean _init_core_object_by_type(unsigned int type,
+       TcorePlugin *plugin, struct object_initializer *initializer_list)
 {
-       CoreObject *co = tcore_plugin_ref_core_object(plugin, type);
        gboolean ret = FALSE;
+       CoreObject *co = tcore_plugin_ref_core_object(plugin, type);
+       if (co == NULL) {
+               err("No Core Object of type: [0x%x]", type);
+               return FALSE;
+       }
 
        switch (type) {
        case CORE_OBJECT_TYPE_MODEM: {
@@ -437,8 +350,9 @@ static gboolean _init_core_object_by_type(guint type,
        return ret;
 }
 
-static void _deinit_core_object_by_type(guint type,
-       TcorePlugin *plugin, TcoreObjectDeinitializer *deinitializer_list)
+
+static void _deinit_core_object_by_type(unsigned int type,
+                       TcorePlugin *plugin, struct object_deinitializer *deinitializer_list)
 {
        CoreObject *co;
 
@@ -536,104 +450,19 @@ static void _deinit_core_object_by_type(guint type,
        tcore_object_free(co);
 }
 
-static TcoreHookReturn __object_exec_request_hooks(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreObjectResponseCallback cb, const void *cb_data)
-{
-       CoreObjectRequestHook *req_hook;
-
-       /* Look-up Request Hook Hash table if Request hooks are added for the 'command' */
-       req_hook = g_hash_table_lookup(co->request_hooks, (gconstpointer)command);
-       if (req_hook != NULL) {
-               CoreObjectRequestCallbacks *req_hook_node;
-               GSList *req_hook_list = req_hook->request_hooks_list;
-               CoreObjectRequestList *req_list;
-
-               /* Request list to hold Response hooks */
-               req_list = tcore_try_malloc0(sizeof(CoreObjectRequestList));
-               if (req_list == NULL) {
-                       err("Failed to allocate memory");
-                       return TCORE_HOOK_RETURN_CONTINUE;
-               }
-               req_list->request = (void *)request;
-
-               /* Prepend the 'request' to Request list for Response hook addition */
-               req_hook->request_list = g_slist_prepend(req_hook->request_list, req_list);
-
-               for ( ; req_hook_list ; req_hook_list = req_hook_list->next) {
-                       req_hook_node = req_hook_list->data;
-                       if ((req_hook_node != NULL) && req_hook_node->func) {
-                               /* Invoke Request hook */
-                               if (req_hook_node->func(co, command, request,
-                                               req_hook_node->user_data,
-                                               cb, cb_data)
-                                               == TCORE_HOOK_RETURN_STOP_PROPAGATION) {
-                                       dbg("Request hook requests Stop propogation");
-                                       return TCORE_HOOK_RETURN_STOP_PROPAGATION;
-                               }
-                       }
-               }
-       }
-
-       return TCORE_HOOK_RETURN_CONTINUE;
-}
-
-static TcoreHookReturn __object_exec_response_hooks(CoreObject *co,
-       TcoreCommand command, const void *request, gint result, const void *response)
-{
-       CoreObjectRequestHook *req_hook;
-
-       /* Look-up Request Hook Hash table if Request hooks are added for the 'command' */
-       req_hook = g_hash_table_lookup(co->request_hooks, (gconstpointer)command);
-       if (req_hook != NULL) {
-               GSList *req_list = req_hook->request_list;
-               CoreObjectRequestList *req_list_node;
-
-               for ( ; req_list ; req_list = req_list->next) {
-                       req_list_node = req_list->data;
-                       if (req_list_node != NULL) {
-                               if (req_list_node->request == request) {
-                                       GSList *resp_list = req_list_node->response_hook_list;
-                                       CoreObjectResponseHook *resp_hook_node;
-
-                                       for ( ; resp_list ; resp_list = resp_list->next) {
-                                               resp_hook_node = resp_list->data;
-                                               if (resp_hook_node != NULL && resp_hook_node->func) {
-                                                       /* Invoke Response hook */
-                                                       if (resp_hook_node->func(co,
-                                                                       result, command,
-                                                                       response, resp_hook_node->user_data)
-                                                                       == TCORE_HOOK_RETURN_STOP_PROPAGATION) {
-                                                               dbg("Response hook requests Stop propogation");
-                                                               return TCORE_HOOK_RETURN_STOP_PROPAGATION;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
-       return TCORE_HOOK_RETURN_CONTINUE;
-}
 
-CoreObject *tcore_object_new(TcorePlugin *plugin, TcoreHal *hal)
+CoreObject *tcore_object_new(TcorePlugin *plugin,
+               const char *name, TcoreHal *hal)
 {
        CoreObject *co;
 
        co = _object_new(plugin, CORE_OBJECT_TYPE_DEFAULT);
-       if (co == NULL) {
-               err("Failed to allocate memory");
+       if (!co)
                return NULL;
-       }
 
-       /* Set HAL */
        tcore_object_set_hal(co, hal);
+       tcore_object_set_name(co, name);
 
-       /*
-        * Add Core Obejct to Plug-in is Core Object list
-        * if Plug-in is available
-        */
        if (plugin)
                tcore_plugin_add_core_object(plugin, co);
 
@@ -642,32 +471,61 @@ CoreObject *tcore_object_new(TcorePlugin *plugin, TcoreHal *hal)
 
 void tcore_object_free(CoreObject *co)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
+       GSList *l = NULL;
+       struct callback_type *cb = NULL;
+
+       if (!co)
                return;
-       }
-       dbg("Type: [0x%x]", co->type);
+
+       dbg("co_name=%s", co->name);
 
        if (co->free_hook)
                co->free_hook(co);
+       else {
+               if (co->object)
+                       warn("free_hook is null, private-object couldn't be freed!!");
+       }
+
+       if (co->property) {
+               g_hash_table_destroy(co->property);
+       }
+
+       if (co->callbacks) {
+               for (l = co->callbacks; l; l = l->next) {
+                       cb = l->data;
+                       if (!cb)
+                               continue;
+
+                       if (cb->event)
+                               free(cb->event);
+
+                       free(cb);
+               }
+
+               g_slist_free(co->callbacks);
+               co->callbacks = NULL;
+       }
+
+       if (co->parent_plugin)
+               tcore_plugin_remove_core_object(co->parent_plugin, co);
+
+       if (co->name)
+               free(co->name);
 
-       /* Free resources */
-       g_slist_free_full(co->callbacks, __free_callback_data);
-       g_hash_table_destroy(co->request_hooks);
-       tcore_free(co);
+       memset(co, 0, sizeof(CoreObject));
+       free(co);
 }
 
 CoreObject *tcore_object_clone(CoreObject *src, TcorePlugin *new_parent)
 {
        CoreObject *dest;
        TcorePlugin *p;
-       GSList *list;
+
+       GSList *l = NULL;
        struct callback_type *cb = NULL;
 
-       if (src == NULL) {
-               err("Source Core object is NULL");
+       if (!src)
                return NULL;
-       }
 
        if (new_parent)
                p = new_parent;
@@ -675,12 +533,9 @@ CoreObject *tcore_object_clone(CoreObject *src, TcorePlugin *new_parent)
                p = src->parent_plugin;
 
        dest = _object_new(p, src->type);
-       if (dest == NULL) {
-               err("Destination Core object is NULL");
+       if (!dest)
                return NULL;
-       }
 
-       /* Clone the parameters */
        dest->object = src->object;
        dest->user_data = src->user_data;
        dest->free_hook = src->free_hook;
@@ -688,16 +543,16 @@ CoreObject *tcore_object_clone(CoreObject *src, TcorePlugin *new_parent)
        dest->dispatcher = src->dispatcher;
        dest->hal = src->hal;
 
-       for (list = src->callbacks; list; list = list->next) {
-               cb = list->data;
-               if (cb != NULL)
-                       tcore_object_add_callback(dest, cb->event, cb->callback, cb->user_data);
+       for (l = src->callbacks; l; l = l->next) {
+               cb = l->data;
+               if (!cb)
+                       continue;
+
+               tcore_object_add_callback(dest, cb->event, cb->callback, cb->user_data);
        }
 
-       /* Add Cloned Core Object to Plug-in */
        tcore_plugin_add_core_object(p, dest);
 
-       /* Invoke Clone hook */
        if (src->clone_hook)
                src->clone_hook(src, dest);
 
@@ -705,353 +560,263 @@ CoreObject *tcore_object_clone(CoreObject *src, TcorePlugin *new_parent)
 }
 
 CoreObject *tcore_object_clone_template_object(TcorePlugin *p,
-                               guint co_type)
+                               unsigned int co_type)
 {
        CoreObject *template_co;
 
-       /* Find Template Core object */
        template_co = tcore_server_find_template_object(tcore_plugin_ref_server(p), co_type);
-       if (template_co == NULL) {
-               err("Failed to find Template Core object");
+       if(template_co == NULL)
                return NULL;
-       }
 
        return tcore_object_clone(template_co, p);
+
 }
 
-TelReturn tcore_object_set_free_hook(CoreObject *co,
-               TcoreObjectFreeHook free_hook)
+const char *tcore_object_ref_name(CoreObject *co)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co)
+               return NULL;
+
+       return co->name;
+}
+
+TReturn tcore_object_set_free_hook(CoreObject *co,
+               CoreObjectFreeHook free_hook)
+{
+       if (!co)
+               return TCORE_RETURN_EINVAL;
 
        co->free_hook = free_hook;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 
-TelReturn tcore_object_set_clone_hook(CoreObject *co,
-               TcoreObjectCloneHook clone_hook)
+TReturn tcore_object_set_clone_hook(CoreObject *co,
+               CoreObjectCloneHook clone_hook)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co)
+               return TCORE_RETURN_EINVAL;
 
        co->clone_hook = clone_hook;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_object_set_name(CoreObject *co, const char *name)
+{
+       if (!co)
+               return TCORE_RETURN_EINVAL;
+
+       if (co->name) {
+               free(co->name);
+               co->name = NULL;
+       }
+
+       if (name)
+               co->name = strdup(name);
+
+       return TCORE_RETURN_SUCCESS;
 }
 
 TcorePlugin *tcore_object_ref_plugin(CoreObject *co)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
+       if (!co)
                return NULL;
-       }
 
        return co->parent_plugin;
 }
 
-TelReturn tcore_object_link_object(CoreObject *co, void *object)
+TReturn tcore_object_link_object(CoreObject *co, void *object)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co)
+               return TCORE_RETURN_EINVAL;
 
        co->object = object;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 void *tcore_object_ref_object(CoreObject *co)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
+       if (!co)
                return NULL;
-       }
 
        return co->object;
 }
 
-TelReturn tcore_object_set_type(CoreObject *co, guint type)
+TReturn tcore_object_set_type(CoreObject *co, unsigned int type)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co)
+               return TCORE_RETURN_EINVAL;
 
        co->type = type;
-       dbg("Set core_object to type: [0x%x])", type);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-guint tcore_object_get_type(CoreObject *co)
+unsigned int tcore_object_get_type(CoreObject *co)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
+       if (!co)
                return 0;
-       }
 
        return co->type;
 }
 
-TelReturn tcore_object_set_hal(CoreObject *co, TcoreHal *hal)
+TReturn tcore_object_set_hal(CoreObject *co, TcoreHal *hal)
 {
        TcoreAT *at;
        struct callback_type *cb = NULL;
-       GSList *list;
+       GSList *l = NULL;
 
-       if (co == NULL) {
-               err("Core object is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       dbg("Core Object Type: [0x%x] HAL: [0x%x]", co->type, hal);
+       if (!co)
+               return TCORE_RETURN_EINVAL;
 
        if (co->hal) {
-               /* Remove unsolicited callbacks */
+               // remove unsolicited callbacks
                if (tcore_hal_get_mode(co->hal) == TCORE_HAL_MODE_AT) {
                        at = tcore_hal_get_at(co->hal);
-                       for (list = co->callbacks; list != NULL; list = list->next) {
-                               cb = list->data;
-                               if (cb != NULL) {
-                                       tcore_at_remove_notification_full(at,
-                                               cb->event, _on_at_event, cb);
-                               }
+                       for (l = co->callbacks; l; l = l->next) {
+                               cb = l->data;
+                               if (!cb)
+                                       continue;
+
+                               tcore_at_remove_notification_full(at, cb->event, _on_at_event, cb);
                        }
                }
        }
 
        co->hal = hal;
-       if (hal == NULL) {
-               dbg("hal is NULL");
-               return TEL_RETURN_SUCCESS;
-       }
+       if (!hal)
+               return TCORE_RETURN_SUCCESS;
 
-       /* Register unsolicited callbacks */
+       // register unsolicited callbacks
        if (tcore_hal_get_mode(hal) == TCORE_HAL_MODE_AT) {
                at = tcore_hal_get_at(hal);
-               for (list = co->callbacks; list != NULL; list = list->next) {
-                       cb = list->data;
-                       if (cb != NULL) {
-                               if (cb->event[0] == 27)
-                                       tcore_at_add_notification(at,
-                                               cb->event + 1, TRUE, _on_at_event, cb);
-                               else
-                                       tcore_at_add_notification(at,
-                                               cb->event, FALSE, _on_at_event, cb);
-                       }
+               for (l = co->callbacks; l; l = l->next) {
+                       cb = l->data;
+                       if (!cb)
+                               continue;
+
+                       if (cb->event[0] == 27)
+                               tcore_at_add_notification(at, cb->event + 1, TRUE, _on_at_event, cb);
+                       else
+                               tcore_at_add_notification(at, cb->event, FALSE, _on_at_event, cb);
                }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 TcoreHal *tcore_object_get_hal(CoreObject *co)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
+       if (!co)
                return NULL;
-       }
 
        return co->hal;
 }
 
-TelReturn tcore_object_link_user_data(CoreObject *co,
+TReturn tcore_object_link_user_data(CoreObject *co,
                void *user_data)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co)
+               return TCORE_RETURN_EINVAL;
 
        co->user_data = user_data;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 void *tcore_object_ref_user_data(CoreObject *co)
 {
-       if (co == NULL) {
-               err("Core object is NULL");
+       if (!co)
                return NULL;
-       }
 
        return co->user_data;
 }
 
-/* TODO - Need to move the static function and rename accordingly */
-static void tcore_object_response_callback(CoreObject *co,
-       gint result, const void *response, void *user_data)
+TReturn tcore_object_dispatch_request(CoreObject *co,
+               UserRequest *ur)
 {
-       TcoreObjectRespData *resp_cb_data = (TcoreObjectRespData *)user_data;
-
-       if (resp_cb_data == NULL) {
-               err("Response Callback data is NULL");
-               return;
-       }
-
-       /* Invoke Response hooks */
-       if (__object_exec_response_hooks(co,
-                       resp_cb_data->command,
-                       resp_cb_data->request, result, response)
-                       != TCORE_HOOK_RETURN_STOP_PROPAGATION) {
-               /* Invoke response callback */
-               if (resp_cb_data->resp_cb)
-                       resp_cb_data->resp_cb(tcore_object_ref_plugin(co),
-                               result, response, resp_cb_data->resp_cbdata);
-       }
-
-       /* Remove Request and Response Hooks */
-       __free_response_hook(co, resp_cb_data->command, resp_cb_data->request);
-
-       /* Free resource */
-       tcore_free(resp_cb_data->request);
-       tcore_free(resp_cb_data);
-}
-
-TelReturn tcore_object_dispatch_request(CoreObject *co,
-               gboolean exec_hooks, TcoreCommand command,
-               const void *request, guint request_len,
-               TcorePluginResponseCallback cb, const void *user_data)
-{
-       void *dispatch_request;
-       TcoreObjectRespData *resp_cb_data;
-       TelReturn ret = TEL_RETURN_FAILURE;
-
-       if (co == NULL) {
-               err("Core object is NULL");
-               return TEL_RETURN_FAILURE;
-       }
-
-       if (request_len)
-               dispatch_request = tcore_memdup(request, request_len);
-       else
-               dispatch_request = tcore_malloc0(sizeof(guint));
-
-       /* Allocate Response callback data */
-       resp_cb_data = tcore_malloc0(sizeof(TcoreObjectRespData));
-       resp_cb_data->resp_cb = cb;
-       resp_cb_data->resp_cbdata = (void *)user_data;
-
-       resp_cb_data->command = command;
-       resp_cb_data->request = dispatch_request;
-
-       if (exec_hooks == TRUE) {
-               /* Invoke Request hooks */
-               if (__object_exec_request_hooks(co, command, dispatch_request,
-                               tcore_object_response_callback, (const void *)resp_cb_data)
-                               == TCORE_HOOK_RETURN_STOP_PROPAGATION) {
-                       dbg("Hooks return - [STOP PROPOGATION]");
-                       return TEL_RETURN_SUCCESS;
-               }
-       }
-
-       /*
-        * Dispatch Request to corresponding Core object
-        * if 'dispatcher' is available.
-        */
-       if (co->dispatcher) {
-               ret = co->dispatcher(co, command, dispatch_request,
-                       tcore_object_response_callback, (const void *)resp_cb_data);
-               dbg("Dispatch Request - [%s]",
-                       (ret == TEL_RETURN_SUCCESS) ? "SUCCESS" : "FAIL");
-       } else {
-               err("Dispatcher is NULL");
-       }
+       if (!co || !ur)
+               return TCORE_RETURN_EINVAL;
 
-       /*
-        * Free resources,
-        * in case Request processing is not Successful
-        */
-       if (ret != TEL_RETURN_SUCCESS) {
-               tcore_free(dispatch_request);
-               tcore_free(resp_cb_data);
-       }
+       if (!co->dispatcher)
+               return TCORE_RETURN_ENOSYS;
 
-       return ret;
+       return co->dispatcher(co, ur);
 }
 
-TelReturn tcore_object_set_dispatcher(CoreObject *co,
-               TcoreObjectDispatcher func)
+TReturn tcore_object_set_dispatcher(CoreObject *co,
+               CoreObjectDispatcher func)
 {
-       if ((co == NULL) || (func == NULL)) {
-               err("co: [%p] func: [%p]", co, func);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co || !func)
+               return TCORE_RETURN_EINVAL;
 
        co->dispatcher = func;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_object_override_callback(CoreObject *co,
-               const gchar *event, TcoreObjectCallback callback, void *user_data)
+TReturn tcore_object_override_callback(CoreObject *co,
+               const char *event, tcore_object_callback callback, void *user_data)
 {
-       struct callback_type *cb;
-       GSList *list;
+       struct callback_type *cb = NULL;
+       GSList *l = NULL;
        TcoreAT *at = NULL;
 
-       if ((co == NULL) || (event == NULL) || (callback == NULL)) {
-               err("co: [%p] event: [%p] callback: [%p]", co, event, callback);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if ((co == NULL) || (event == NULL) || (callback == NULL))
+               return TCORE_RETURN_EINVAL;
 
-       if (strlen(event) < 1) {
-               err("Invalid event!!!");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (strlen(event) < 1)
+               return TCORE_RETURN_EINVAL;
 
-       if (co->hal)
+       if (co->hal) {
                if (tcore_hal_get_mode(co->hal) == TCORE_HAL_MODE_AT)
                        at = tcore_hal_get_at(co->hal);
+       }
 
-       for (list = co->callbacks; list ; list = list->next) {
-               cb = list->data;
-               if (cb != NULL) {
-                       if (g_strcmp0(cb->event, event) == 0) {
-                               if (at)
-                                       _remove_at_callback(at, cb);
+       for (l = co->callbacks; l; l = l->next) {
+               cb = l->data;
+               if (cb == NULL)
+                       continue;
 
-                               /* Free resources */
-                               co->callbacks = g_slist_remove(co->callbacks, cb);
-                               __free_callback_data(cb);
-                       }
-               }
+               if (g_strcmp0(cb->event, event) != 0)
+                       continue;
+
+               if (at)
+                       _remove_at_callback(at, cb);
+
+               g_free(cb->event);
+               co->callbacks = g_slist_remove(co->callbacks, cb);
+               g_free(cb);
        }
 
        return tcore_object_add_callback(co, event, callback, user_data);
 }
 
-TelReturn tcore_object_add_callback(CoreObject *co,
-       const gchar *event, TcoreObjectCallback callback, void *user_data)
+TReturn tcore_object_add_callback(CoreObject *co,
+               const char *event,
+               CoreObjectCallback callback, void *user_data)
 {
        struct callback_type *cb = NULL;
        TcoreAT *at = NULL;
 
-       if ((co == NULL) || (event == NULL) || (callback == NULL)) {
-               err("co: [%p] event: [%p] callback: [%p]", co, event, callback);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co || !event || !callback)
+               return TCORE_RETURN_EINVAL;
 
-       if (strlen(event) < 1) {
-               err("Invalid event!!!");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (strlen(event) < 1)
+               return TCORE_RETURN_EINVAL;
+
+       cb = calloc(1, sizeof(struct callback_type));
+       if (!cb)
+               return TCORE_RETURN_ENOMEM;
 
-       cb = tcore_malloc0(sizeof(struct callback_type));
        cb->co = co;
-       cb->event = tcore_strdup(event);
+       cb->event = strdup(event);
        cb->callback = callback;
        cb->user_data = user_data;
 
-       /* Callbacks are appended - FCFS principle */
        co->callbacks = g_slist_append(co->callbacks, cb);
 
        if (co->hal) {
@@ -1065,360 +830,188 @@ TelReturn tcore_object_add_callback(CoreObject *co,
                }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_object_del_callback(CoreObject *co,
-       const gchar *event, TcoreObjectCallback callback)
+TReturn tcore_object_del_callback(CoreObject *co,
+               const char *event, CoreObjectCallback callback)
 {
-       struct callback_type *cb;
-       GSList *list;
+       struct callback_type *cb = NULL;
+       GSList *l = NULL;
        TcoreAT *at = NULL;
 
-       if ((co == NULL) || (event == NULL)
-                       || (callback == NULL) || (co->callbacks == NULL)) {
-               err("co: [%p] event: [%p] callback: [%p] co->callbacks: [%p]",
-                               co, event, callback, (co ? co->callbacks : NULL));
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co || !event || !callback || !co->callbacks)
+               return TCORE_RETURN_EINVAL;
 
-       if (strlen(event) < 1) {
-               err("Invalid event!!!");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (strlen(event) == 0)
+               return TCORE_RETURN_EINVAL;
 
-       if (co->hal)
+       if (co->hal) {
                if (tcore_hal_get_mode(co->hal) == TCORE_HAL_MODE_AT)
                        at = tcore_hal_get_at(co->hal);
-
-       for (list = co->callbacks; list ; list = list->next) {
-               cb = list->data;
-               if (cb != NULL) {
-                       if (cb->callback == callback) {
-                               if (g_strcmp0(cb->event, event) == 0) {
-                                       if (at)
-                                               _remove_at_callback(at, cb);
-
-                                       /* Free resources */
-                                       co->callbacks = g_slist_remove(co->callbacks, cb);
-                                       __free_callback_data(cb);
-                               }
-                       }
-               }
-       }
-
-       return TEL_RETURN_SUCCESS;
-}
-
-TelReturn tcore_object_emit_callback(CoreObject *co,
-       const gchar *event, const void *event_info)
-{
-       struct callback_type *cb;
-       GSList *list;
-
-       if ((co == NULL) || (event == NULL)) {
-               err("co: [%p] event: [%p]", co, event);
-               return TEL_RETURN_INVALID_PARAMETER;
        }
 
-       for (list = co->callbacks ; list ; list = list->next) {
-               cb = list->data;
-               if (cb != NULL) {
-                       if (g_strcmp0(cb->event, event) == 0) {
-                               if (cb->callback) {
-                                       if (cb->callback(co, event_info, cb->user_data) == FALSE) {
-                                               err("Callback failed");
-
-                                               /* Free resource */
-                                               co->callbacks = g_slist_remove(co->callbacks, cb);
-                                               __free_callback_data(cb);
-                                       }
-                               }
-                       }
+       l = co->callbacks;
+       while (l) {
+               cb = l->data;
+               if (!cb) {
+                       l = l->next;
+                       continue;
                }
-       }
 
-       return TEL_RETURN_SUCCESS;
-}
-
-TelReturn tcore_object_add_request_hook(CoreObject *co,
-       TcoreCommand command, TcoreRequestHook func, void *user_data)
-{
-       CoreObjectRequestHook *req_hook;
-       CoreObjectRequestCallbacks *req_hook_node;
-
-       if ((co == NULL) || (func == NULL)) {
-               err("co: [%p] func: [%p]", co, func);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       /* Create Request hook list node */
-       req_hook_node = tcore_malloc0(sizeof(CoreObjectRequestCallbacks));
-       req_hook_node->func = func;
-       req_hook_node->user_data = user_data;
-
-       req_hook = g_hash_table_lookup(co->request_hooks, (gconstpointer)command);
-       if (req_hook == NULL) {
-               /* Create Request Hook (Hash table) node */
-               req_hook = tcore_malloc0(sizeof(CoreObjectRequestHook));
-               if (req_hook == NULL) {
-                       err("Failed to allocate memory");
+               if (cb->callback != callback) {
+                       l = l->next;
+                       continue;
+               }
 
-                       /* Free resource */
-                       tcore_free(req_hook_node);
-                       return TEL_RETURN_MEMORY_FAILURE;
+               if (g_strcmp0(cb->event, event) != 0) {
+                       l = l->next;
+                       continue;
                }
 
-               /* Insert Request Hook node to Hash table */
-               g_hash_table_insert(co->request_hooks, (gpointer)command, req_hook);
-       }
+               if (at)
+                       _remove_at_callback(at, cb);
 
-       /* Append request hook node to Request hooks list */
-       req_hook->request_hooks_list = g_slist_append(req_hook->request_hooks_list, req_hook_node);
-       dbg("Request hook added for Command: [0x%x]", command);
+               l = l->next;
+               co->callbacks = g_slist_remove(co->callbacks, cb);
+               free(cb->event);
+               free(cb);
+       }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-void tcore_object_remove_request_hook(CoreObject *co,
-       TcoreCommand command, TcoreRequestHook func)
+TReturn tcore_object_emit_callback(CoreObject *co,
+               const char *event, const void *event_info)
 {
-       CoreObjectRequestHook *req_hook;
-       CoreObjectRequestCallbacks *req_hook_node;
-       GSList *req_hook_list;
-
-       if ((co == NULL) || (func == NULL)) {
-               err("co: [%p] func: [%p]", co, func);
-               return;
-       }
-
-       req_hook = g_hash_table_lookup(co->request_hooks, (gconstpointer)command);
-       if (req_hook == NULL) {
-               err("No request hooks for Command: [0x%x]", command);
-               return;
-       }
-
-       req_hook_list = req_hook->request_hooks_list;
-       while (req_hook_list) {
-               req_hook_node = req_hook_list->data;
-               if (req_hook_node != NULL) {
-                       if (req_hook_node->func == func) {
-                               GSList *tmp_list = req_hook_list->next;
-
-                               /* Remove node */
-                               req_hook->request_hooks_list =
-                                       g_slist_remove(req_hook->request_hooks_list, req_hook_node);
-                               dbg("Request hook removed for Command: [0x%x]", command);
+       struct callback_type *cb = NULL;
+       GSList *l = NULL;
+       TReturn ret;
+
+       if (!co || !event)
+               return TCORE_RETURN_EINVAL;
+
+       l = co->callbacks;
+       while (l) {
+               cb = l->data;
+               if (!cb) {
+                       l = l->next;
+                       continue;
+               }
 
-                               /* Free resource */
-                               tcore_free(req_hook_node);
+               if (g_strcmp0(cb->event, event) != 0) {
+                       l = l->next;
+                       continue;
+               }
 
-                               /* Continue to next node */
-                               req_hook_list = tmp_list;
+               if (cb->callback) {
+                       ret = cb->callback(co, event_info, cb->user_data);
+                       if (ret == FALSE) {
+                               l = l->next;
+                               co->callbacks = g_slist_remove(co->callbacks, cb);
                                continue;
                        }
                }
 
-               /* Continue to next node */
-               req_hook_list = req_hook_list->next;
+               l = l->next;
        }
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_object_add_response_hook(CoreObject *co,
-       TcoreCommand command, const void *request,
-       TcoreResponseHook func, void *user_data)
+static GSList *_set_property_real (CoreObject *co, const char *key,
+               const char *value, GSList *list)
 {
-       CoreObjectRequestHook *req_hook;
+       char *prev;
 
-       if ((co == NULL) || (func == NULL)) {
-               err("co: [%p] func: [%p]", co, func);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!co || !key)
+               return list;
 
-       /* Look-up Request Hook Hash table if Request hooks are added for the 'command' */
-       req_hook = g_hash_table_lookup(co->request_hooks, (gconstpointer)command);
-       if (req_hook != NULL) {
-               GSList *req_list = req_hook->request_list;
-               CoreObjectRequestList *req_list_node;
-
-               for ( ; req_list ; req_list = req_list->next) {
-                       req_list_node = req_list->data;
-                       if (req_list_node != NULL) {
-                               if (req_list_node->request == request) {
-                                       CoreObjectResponseHook *resp_hook_node;
-
-                                       /* Response hook node */
-                                       resp_hook_node = tcore_try_malloc0(sizeof(CoreObjectResponseHook));
-                                       if (resp_hook_node == NULL) {
-                                               err("Failed to allocate memory");
-                                               return TEL_RETURN_MEMORY_FAILURE;
-                                       }
-                                       resp_hook_node->func = func;
-                                       resp_hook_node->user_data = user_data;
+       if (!value) {
+               g_hash_table_remove (co->property, key);
+               return g_slist_append (list, (char *)key);
+       }
 
-                                       /* Append Response hook node to Response hook list */
-                                       req_list_node->response_hook_list =
-                                               g_slist_append(req_list_node->response_hook_list, resp_hook_node);
-                                       dbg("Response hook added for Command: [0x%x]", command);
+       prev = g_hash_table_lookup(co->property, key);
+       if (prev != NULL) {
+               /*
+                * If same data, no change & no callback emit
+                */
+               if (strcmp (prev, value) == 0)
+                       return list;
 
-                                       return TEL_RETURN_SUCCESS;
-                               }
-                       }
-               }
+               g_hash_table_replace(co->property, strdup(key), strdup(value));
        }
        else {
-               err("Abnormal behavior... Response Hooks need to be added in Request hook callbacks!!!");
+               g_hash_table_insert(co->property, strdup(key), strdup(value));
        }
 
-       return TEL_RETURN_FAILURE;
+       return g_slist_append (list, (char *)key);
 }
 
-void tcore_object_remove_response_hook(CoreObject *co,
-       TcoreCommand command, TcoreResponseHook func)
+TReturn tcore_object_set_property_full(CoreObject *co, const char *first_property, ...)
 {
-       CoreObjectRequestHook *req_hook;
+       va_list argptr;
+       GSList *list = NULL;
+       const char *k;
+       const char *v;
 
-       if ((co == NULL) || (func == NULL)) {
-               err("co: [%p] func: [%p]", co, func);
-               return;
-       }
+       if (!co || !first_property)
+               return TCORE_RETURN_EINVAL;
 
-       req_hook = g_hash_table_lookup(co->request_hooks, (gconstpointer)command);
-       if (req_hook != NULL) {
-               GSList *req_list = req_hook->request_list;
-               CoreObjectRequestList *request_node;
-
-               for ( ; req_list ; req_list = req_list->next) {
-                       request_node = req_list->data;
-                       if (request_node != NULL) {
-                               CoreObjectResponseHook *response_node;
-                               GSList *resp_list = request_node->response_hook_list;
-
-                               while (resp_list) {
-                                       GSList *tmp_list = resp_list->next;
-
-                                       response_node = resp_list->data;
-                                       if (response_node != NULL) {
-                                               if (response_node->func == func) {
-                                                       /* Remove and free response hook node */
-                                                       request_node->response_hook_list =
-                                                               g_slist_remove(request_node->response_hook_list, response_node);
-                                                       dbg("Response hook removed for Command: [0x%x]", command);
-
-                                                       tcore_free(response_node);
-                                               }
-                                       }
+       va_start (argptr, first_property);
 
-                                       resp_list = tmp_list;
-                               }
-                       }
-               }
-       }
-}
+       k = first_property;
+       v = va_arg (argptr, char *);
+       list = _set_property_real (co, k, v, list);
 
-TelReturn tcore_object_add_notification_hook(CoreObject *co,
-       TcoreNotification command, TcoreNotificationHook func, void *user_data)
-{
-       CoreObjectNotificationHook *noti_hook;
+       while (1) {
+               k = va_arg (argptr, char *);
+               if (!k)
+                       break;
 
-       if ((co == NULL) || (func == NULL)) {
-               err("co: [%p] func: [%p]", co, func);
-               return TEL_RETURN_INVALID_PARAMETER;
+               v = va_arg (argptr, char *);
+               list = _set_property_real (co, k, v, list);
        }
 
-       /* Notification hook node */
-       noti_hook = tcore_try_malloc0(sizeof(CoreObjectNotificationHook));
-       if (noti_hook == NULL) {
-               err("Failed to allocate memory");
-               return TEL_RETURN_MEMORY_FAILURE;
-       }
-       noti_hook->command = command;
-       noti_hook->func = func;
-       noti_hook->user_data = user_data;
+       va_end (argptr);
+
+       if (!list)
+               return TCORE_RETURN_SUCCESS;
 
-       /* Append Notification hook node to Notification hook list */
-       co->notification_hooks =
-                       g_slist_append(co->notification_hooks, noti_hook);
+       if (g_slist_length(list) > 0)
+               tcore_object_emit_callback (co,
+                               CORE_OBJECT_EVENT_PROPERTY_CHANGED, list);
 
-       dbg("Notification hook added for Command: [0x%x]", command);
+       g_slist_free (list);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-void tcore_object_remove_notification_hook(CoreObject *co,
-       TcoreNotification command, TcoreNotificationHook func)
+const char *tcore_object_ref_property(CoreObject *co, const char *key)
 {
-       GSList *noti_list;
-       CoreObjectNotificationHook *noti_hook;
-
-       if ((co == NULL) || (func == NULL)) {
-               err("co: [%p] func: [%p]", co, func);
-               return;
-       }
-
-       noti_list = co->notification_hooks;
-       while (noti_list) {
-               GSList *tmp_list = noti_list->next;
-
-               noti_hook = noti_list->data;
-               if (noti_hook != NULL) {
-                       if (noti_hook->func == func) {
-                               /* Remove and free Notification hook node */
-                               co->notification_hooks =
-                                       g_slist_remove(co->notification_hooks, noti_hook);
-                               dbg("Notification hook removed for Command: [0x%x]", command);
-
-                               tcore_free(noti_hook);
-                       }
-               }
+       if (!co || !key)
+               return NULL;
 
-               noti_list = tmp_list;
-       }
+       return g_hash_table_lookup(co->property, key);
 }
 
-TelReturn tcore_object_send_notification(CoreObject *co,
-       TcoreNotification command, guint data_len, void *data)
+GHashTable *tcore_object_ref_property_hash(CoreObject *co)
 {
-       TcorePlugin *plugin;
-       GSList *noti_list;
-       CoreObjectNotificationHook *noti_hook;
-
-       if (co == NULL) {
-               err("Core object is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       plugin = tcore_object_ref_plugin(co);
-
-       /* Invoke Notification Hooks */
-       for (noti_list = co->notification_hooks; noti_list; noti_list = noti_list->next) {
-               noti_hook = noti_list->data;
-               if (noti_hook != NULL) {
-                       dbg("noti_hook->command[0x%x], Command: [0x%x]",noti_hook->command, command);
-                       if (noti_hook->command == command) {
-                               dbg("Invoking hook_func() for Command: [0x%x]", command);
-                               if (noti_hook->func(plugin, command, data_len, data, noti_hook->user_data)
-                                               == TCORE_HOOK_RETURN_STOP_PROPAGATION) {
-                                       dbg("Notification hook requests Stop propogation");
-                                       return TEL_RETURN_SUCCESS;
-                               }
-                       }
-               }
-       }
+       if (!co)
+               return NULL;
 
-       /* Dispatch the Notification to Server */
-       return tcore_plugin_send_notification(plugin, command, data_len, data);
+       return co->property;
 }
-
 void *tcore_object_add_mapping_tbl_entry(void *mapping_tbl,
-       guint object_type, TcoreHal *hal)
+                                               unsigned int object_type, TcoreHal *hal)
 {
        GSList *mapping_tbl_list = mapping_tbl;
-       TcoreObjectMappingTable *tbl_entry;
+       object_mapping_table_t *tbl_entry;
 
        if (hal == NULL) {
                err("Mapping Table: [0x%x] HAL: [0x%x]", mapping_tbl, hal);
-               return NULL;
+               return mapping_tbl;
        }
 
        /*
@@ -1439,8 +1032,13 @@ void *tcore_object_add_mapping_tbl_entry(void *mapping_tbl,
                 * new Table entry is created
                 */
 
-               tbl_entry = tcore_malloc0(sizeof(TcoreObjectMappingTable));
-               tbl_entry->hal = hal;
+               tbl_entry = g_try_new0(object_mapping_table_t, 1);
+               if (tbl_entry != NULL)
+                       tbl_entry->hal = hal;
+               else {
+                       err("Failed to allocate memory");
+                       return mapping_tbl_list;
+               }
 
                /* Add the Mapping Table entry to Mapping Table */
                mapping_tbl_list = g_slist_append(mapping_tbl_list, tbl_entry);
@@ -1471,7 +1069,7 @@ void tcore_object_remove_mapping_tbl(void *mapping_tbl)
 void *tcore_object_remove_mapping_tbl_entry(void *mapping_tbl, TcoreHal *hal)
 {
        GSList *mapping_tbl_list = mapping_tbl;
-       TcoreObjectMappingTable *tbl_entry;
+       object_mapping_table_t *tbl_entry;
 
        if (mapping_tbl_list == NULL) {
                err("Mapping Table is NULL");
@@ -1494,16 +1092,16 @@ void *tcore_object_remove_mapping_tbl_entry(void *mapping_tbl, TcoreHal *hal)
        mapping_tbl_list = g_slist_remove(mapping_tbl_list, tbl_entry);
 
        /* Free Table entry */
-       tcore_free(tbl_entry);
+       g_free(tbl_entry);
 
        return mapping_tbl_list;
 }
 
 void tcore_object_remove_mapping_tbl_entry_by_type(void *mapping_tbl,
-       guint co_type)
+                                                       unsigned int co_type)
 {
        GSList *mapping_tbl_list;
-       TcoreObjectMappingTable *tbl_entry;
+       object_mapping_table_t *tbl_entry;
 
        if (mapping_tbl == NULL) {
                err("Mapping Table is NULL");
@@ -1526,7 +1124,8 @@ void tcore_object_remove_mapping_tbl_entry_by_type(void *mapping_tbl,
 void tcore_object_print_mapping_tbl(void *mapping_tbl)
 {
        GSList *mapping_tbl_list;
-       TcoreObjectMappingTable *tbl_entry = NULL;
+       object_mapping_table_t *tbl_entry = NULL;
+
 
        if (mapping_tbl == NULL) {
                err("Mapping Table is NULL");
@@ -1537,15 +1136,16 @@ void tcore_object_print_mapping_tbl(void *mapping_tbl)
 
        for ( ; mapping_tbl_list ; mapping_tbl_list = mapping_tbl_list->next) {
                tbl_entry = mapping_tbl_list->data;
-               if (tbl_entry != NULL) {
-                       _util_print_mapping_tbl_entry(tbl_entry);
-               }
+               if (tbl_entry == NULL)
+                       continue;
+
+               _util_print_mapping_tbl_entry(tbl_entry);
        }
 }
 
 /* Initialize Core Objects */
-TelReturn tcore_object_init_objects(TcorePlugin *plugin,
-       TcoreObjectInitializer *initializer_list)
+TReturn tcore_object_init_objects(TcorePlugin *plugin,
+                                               struct object_initializer *initializer_list)
 {
        GSList *mapping_tbl_list;
        gboolean ret = FALSE;
@@ -1560,10 +1160,10 @@ TelReturn tcore_object_init_objects(TcorePlugin *plugin,
         * else, it is treated as a Failure.
         */
        if (mapping_tbl_list != NULL) {
-               TcoreObjectMappingTable *tbl_entry;
+               object_mapping_table_t *tbl_entry;
                GSList *mtbl_list;
                GSList *object_type_list;
-               guint type;
+               unsigned int type;
 
                /* Create each Core Object based on the Mapping Table entries */
                mtbl_list = mapping_tbl_list;
@@ -1579,13 +1179,14 @@ TelReturn tcore_object_init_objects(TcorePlugin *plugin,
                                        co = _create_core_object_by_type(type, plugin, tbl_entry->hal);
                                        if (co == NULL) {
                                                err("Failed to create Core Object - Type: [0x%x]", type);
-                                               return TEL_RETURN_FAILURE;
+                                               return TCORE_RETURN_FAILURE;
                                        }
                                        dbg("Created Core Object - Type: [0x%x]", type);
                                }
                        }
                }
 
+
                /* Initialize each Core Object based on the Mapping Table entries */
                mtbl_list = mapping_tbl_list;
                for ( ; mtbl_list ; mtbl_list = mtbl_list->next) {
@@ -1595,35 +1196,35 @@ TelReturn tcore_object_init_objects(TcorePlugin *plugin,
                                ret = FALSE;
 
                                object_type_list = tbl_entry->object_type;
+
                                for ( ; object_type_list ; object_type_list = object_type_list->next) {
-                                       type = (guint)object_type_list->data;
+                                       type = (unsigned int)object_type_list->data;
+                                       dbg("Core Object type: [0x%x]", type);
 
                                        ret = _init_core_object_by_type(type, plugin, initializer_list);
                                        if (ret == FALSE) {
-                                               err("Failed to initialize Core Object - Type: [0x%x]", type);
-                                               return TEL_RETURN_FAILURE;
+                                               err("Failed to initialize Core Object Type [0x%x]", type);
+                                               return TCORE_RETURN_FAILURE;
                                        }
                                        dbg("Initialized Core Object - Type: [0x%x]", type);
                                }
                        }
                }
-       }
-       else {
+       } else {
                err("Mapping Table is NOT present");
        }
-
        if (ret == FALSE) {
                err("Failed to create/initialize Core Objects");
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
        }
 
        dbg("Successfully initialized Core Objects");
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 /* De-initialize Core Objects */
 void tcore_object_deinit_objects(TcorePlugin *plugin,
-       TcoreObjectDeinitializer *deinitializer_list)
+                                               struct object_deinitializer *deinitializer_list)
 {
        GSList *mapping_tbl_list;
 
@@ -1638,26 +1239,26 @@ void tcore_object_deinit_objects(TcorePlugin *plugin,
         * just return with an Error log.
         */
        if (mapping_tbl_list != NULL) {
-               TcoreObjectMappingTable *tbl_entry;
+               object_mapping_table_t *tbl_entry;
                GSList *object_type_list;
-               guint type;
+               unsigned int type;
 
                /* De-initialize each Core Object based on the Mapping Table entries */
                for ( ; mapping_tbl_list ; mapping_tbl_list = mapping_tbl_list->next) {
                        tbl_entry = mapping_tbl_list->data;
-                       if (tbl_entry != NULL) {
-                               object_type_list = tbl_entry->object_type;
-                               for ( ; object_type_list ; object_type_list = object_type_list->next) {
-                                       type = (guint)object_type_list->data;
-                                       dbg("Core Object type: [0x%x]", type);
+                       if (tbl_entry == NULL)
+                               continue;
 
-                                       _deinit_core_object_by_type(type, plugin, deinitializer_list);
-                               }
+                       object_type_list = tbl_entry->object_type;
+
+                       for ( ; object_type_list ; object_type_list = object_type_list->next) {
+                               type = (unsigned int)object_type_list->data;
+                               dbg("Core Object type: [0x%x]", type);
+
+                               _deinit_core_object_by_type(type, plugin, deinitializer_list);
                        }
                }
                dbg("Successfully de-initialized Core Objects");
-       }
-       else {
+       } else
                err("Mapping Table is NOT present");
-       }
 }
index 4a247d0..75993e1 100644 (file)
--- a/src/hal.c
+++ b/src/hal.c
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 #include <stdio.h>
-//#include <string.h>
+#include <string.h>
+#include <pthread.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <time.h>
 
 #include <glib.h>
 
 #include "at.h"
 #include "queue.h"
 #include "plugin.h"
+#include "user_request.h"
 #include "server.h"
 #include "mux.h"
 
+
+//#define IDLE_SEND_PRIORITY G_PRIORITY_DEFAULT
 #define IDLE_SEND_PRIORITY G_PRIORITY_HIGH
 
 struct hook_send_type {
@@ -46,556 +52,528 @@ struct recv_callback_item_type {
 
 struct tcore_hal_type {
        TcorePlugin *parent_plugin;
-
-       gchar *name;
-       TcoreHalOperations *ops;
-       gboolean power_state;
-
        TcoreQueue *queue;
+       char *name;
+       struct tcore_hal_operations *ops;
        void *user_data;
-
        GSList *callbacks;
+       gboolean power_state;
        GSList *hook_list_send;
 
-       TcoreHalMode mode;
+       enum tcore_hal_mode mode;
        TcoreAT *at;
 };
 
-typedef enum {
-       TCORE_HAL_SEND_DATA_SUCCESS,
-       TCORE_HAL_SEND_DATA_FAILURE,
-       TCORE_HAL_SEND_DATA_HOOK_STOP
-} TcoreHalSendData;
-
-static gboolean __hal_idle_send(void *user_data)
+static gboolean _hal_idle_send(void *user_data)
 {
-       TcoreHal *hal = user_data;
-       TcorePending *pending;
-       void *data;
-       guint data_len = 0;
-       TelReturn ret;
+       TcoreHal *h = user_data;
+       TcorePending *p = NULL;
+       TcoreQueue *q;
+       int ret = 0;
+       void *data = NULL;
+       unsigned int data_len = 0;
        gboolean renew = FALSE;
-
-       if (hal == NULL) {
-               err("hal is NULL");
+       if (!h)
                return FALSE;
-       }
-
+#ifdef TCORE_HAL_DEBUG
        msg("--[Queue SEND]-------------------");
-
-       pending = tcore_queue_ref_next_pending(hal->queue);
-       if (pending == NULL) {
-               dbg("Queue is empty!!! (queue length: %d)",
-                       tcore_queue_get_length(hal->queue));
+#endif
+       p = tcore_queue_ref_next_pending(h->queue);
+       if (!p) {
+#ifdef TCORE_HAL_DEBUG
+               dbg("next pending is NULL. no send, queue len=%d", tcore_queue_get_length(h->queue));
+#endif
                goto out;
        }
 
-       data = tcore_pending_ref_request_data(pending, &data_len);
-       dbg("Queue length: [%d] pending: [%p] id: [0x%x] data_len: [%d]",
-       tcore_queue_get_length(hal->queue),
-               (guint)pending, tcore_pending_get_id(pending), data_len);
+       data = tcore_pending_ref_request_data(p, &data_len);
+       dbg("queue(%p) len=%d, pending(%p) id=0x%x data_len=%d",
+                       h->queue, tcore_queue_get_length(h->queue), p, tcore_pending_get_id(p), data_len);
 
-       if (hal->mode == TCORE_HAL_MODE_AT)
-               ret = tcore_at_send_data(hal->at, data, TRUE);
-       else
-               ret = tcore_hal_send_data(hal, data_len, data);
-
-       tcore_pending_emit_send_callback(pending, ret);
+       if (h->mode == TCORE_HAL_MODE_AT) {
+               ret = tcore_at_set_request(h->at, data, TRUE);
+       }
+       else {
+               ret = tcore_hal_send_data(h, data_len, data);
+       }
 
-       if (ret != (TelReturn)TCORE_HAL_SEND_DATA_HOOK_STOP) {
-               TcoreQueue *queue;
+       if (ret == TCORE_RETURN_SUCCESS) {
+               tcore_pending_emit_send_callback(p, TRUE);
+               tcore_pending_start_timer(p);
+       }
+       else {
+               tcore_pending_emit_send_callback(p, FALSE);
+       }
 
-               if (tcore_pending_get_auto_free_status_after_sent(pending)) {
-                       queue = tcore_hal_ref_queue(hal);
-                       tcore_queue_pop_by_pending(queue, pending);
-                       tcore_pending_free(pending);
+       if (ret != TCORE_RETURN_HOOK_STOP) {
+               if (tcore_pending_get_auto_free_status_after_sent(p)) {
+                       q = tcore_hal_ref_queue(h);
+                       tcore_queue_pop_by_pending(q, p);
+                       tcore_pending_free(p);
 
                        /* renew idler */
                        renew = TRUE;
                }
                else {
                        /* Send fail */
-                       if (ret != TEL_RETURN_SUCCESS) {
-                               err("HAL Send failed");
-
-                               queue = tcore_hal_ref_queue(hal);
-                               pending = tcore_queue_pop(queue);
-                               tcore_pending_free(pending);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               dbg("send fail.");
+                               q = tcore_hal_ref_queue(h);
+                               p = tcore_queue_pop(q);
+                               tcore_pending_free(p);
                        }
                }
        }
-
 out:
+#ifdef TCORE_HAL_DEBUG
        msg("--[Queue SEND FINISH]------------\n");
+#endif
        return renew;
 }
 
-TcoreHal *tcore_hal_new(TcorePlugin *plugin, const gchar *name,
-       TcoreHalOperations *hops, TcoreHalMode mode)
+TcoreHal *tcore_hal_new(TcorePlugin *plugin, const char *name,
+               struct tcore_hal_operations *hops,
+               enum tcore_hal_mode mode)
 {
-       TcoreHal *hal;
+       TcoreHal *h;
 
-       if (name == NULL) {
-               err("HAL name is NULL");
+       if (!name)
                return NULL;
-       }
 
-       hal = g_try_new0(struct tcore_hal_type, 1);
-       if (hal == NULL) {
-               err("Failed to allocate memory");
+       h = calloc(1, sizeof(struct tcore_hal_type));
+       if (!h)
                return NULL;
-       }
 
-       hal->parent_plugin = plugin;
-       hal->name = tcore_strdup(name);
-       hal->ops = hops;
+       h->parent_plugin = plugin;
+       h->ops = hops;
+       h->name = strdup(name);
+       h->queue = tcore_queue_new(h);
+       h->mode = mode;
 
-       hal->queue = tcore_queue_new(hal);
-       hal->mode = mode;
-
-       /* Create and link AT parser if HAL mode is AT */
        if (mode == TCORE_HAL_MODE_AT)
-               hal->at = tcore_at_new(hal);
+               h->at = tcore_at_new(h);
+
+       if (plugin)
+               tcore_server_add_hal(tcore_plugin_ref_server(plugin), h);
 
-       return hal;
+       dbg("HAL [%s] <==> Queue [%p]", h->name, h->queue);
+
+       return h;
 }
 
 void tcore_hal_free(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal)
                return;
-       }
 
-       dbg("hal: [%s]", hal->name);
+       dbg("hal=%s", hal->name);
+
+       /* Remove HAL from Server */
+       if (hal->parent_plugin)
+               tcore_server_remove_hal(tcore_plugin_ref_server(hal->parent_plugin), hal);
 
-       /* Freeing HAL name */
-       tcore_free(hal->name);
+       if (hal->name)
+               free(hal->name);
 
-       /* Freeing HAL callbacks list */
-       g_slist_free_full(hal->callbacks, g_free);
+       if (hal->callbacks)
+               g_slist_free(hal->callbacks);
 
-       /* Freeing HAL Queue */
-       tcore_queue_free(hal->queue);
+       if (hal->queue)
+               tcore_queue_free(hal->queue);
 
-       /* Freeing AT parser linked to HAL */
-       if (hal->mode == TCORE_HAL_MODE_AT)
+       if (hal->at)
                tcore_at_free(hal->at);
 
-       /* Freeing HAL */
-       tcore_free(hal);
+       free(hal);
 }
 
-TelReturn tcore_hal_set_name(TcoreHal *hal, const gchar *name)
+TReturn tcore_hal_set_name(TcoreHal *hal, const char *name)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
-       /* Freeing the previously assigned HAL name */
-       tcore_free(hal->name);
-       hal->name = NULL;
+       if (hal->name) {
+               free(hal->name);
+               hal->name = NULL;
+       }
 
-       /*
-        * Assign the new HAL name irrespective of if 'name' is NULL,
-        * g_strdup would take care of this scenario.
-        */
-       hal->name = tcore_strdup(name);
+       if (name)
+               hal->name = strdup(name);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gchar *tcore_hal_get_name(TcoreHal *hal)
+char *tcore_hal_get_name(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal)
                return NULL;
-       }
 
-       /*
-        * Return copy of HAL name,
-        *
-        * it CAN even be NULL if hal->name is NULL,
-        * g_strdup will take care of this scenario.
-        */
-       return tcore_strdup(hal->name);
+       if (hal->name)
+               return strdup(hal->name);
+
+       return NULL;
 }
 
 TcoreAT *tcore_hal_get_at(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal)
                return NULL;
-       }
 
        return hal->at;
 }
 
-TcoreHalMode tcore_hal_get_mode(TcoreHal *hal)
+enum tcore_hal_mode tcore_hal_get_mode(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal)
                return TCORE_HAL_MODE_UNKNOWN;
-       }
 
        return hal->mode;
 }
 
-TelReturn tcore_hal_set_mode(TcoreHal *hal, TcoreHalMode mode)
+TReturn tcore_hal_set_mode(TcoreHal *hal, enum tcore_hal_mode mode)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
        hal->mode = mode;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_hal_link_user_data(TcoreHal *hal, void *user_data)
+TReturn tcore_hal_link_user_data(TcoreHal *hal, void *user_data)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
        hal->user_data = user_data;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 void *tcore_hal_ref_user_data(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal)
                return NULL;
-       }
 
        return hal->user_data;
 }
 
 /* Send data without Queue */
-TelReturn tcore_hal_send_data(TcoreHal *hal, guint data_len, void *data)
+TReturn tcore_hal_send_data(TcoreHal *hal, unsigned int data_len, void *data)
 {
        struct hook_send_type *hook;
        GSList *list;
 
-       if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->send == NULL)) {
-               err("hal: [%p] hal->ops: [%p] hal->ops->send: [%p]",
-                       hal, (hal ? hal->ops : NULL),
-                       (hal ? (hal->ops ? hal->ops->send : NULL) : NULL));
-
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal || !hal->ops || !hal->ops->send)
+               return TCORE_RETURN_EINVAL;
 
        for (list = hal->hook_list_send; list; list = list->next) {
                hook = list->data;
-               if (hook != NULL)
-                       if (hook->func != NULL)
-                               if (hook->func(hal, data_len, data, hook->user_data)
-                                       == TCORE_HOOK_RETURN_STOP_PROPAGATION)
-                                       return TCORE_HAL_SEND_DATA_HOOK_STOP;
+               if (!hook) {
+                       continue;
+               }
+
+               if (hook->func(hal, data_len, data, hook->user_data) == TCORE_HOOK_RETURN_STOP_PROPAGATION) {
+                       return TCORE_RETURN_HOOK_STOP;
+               }
        }
 
        return hal->ops->send(hal, data_len, data);
 }
 
 /* Send data by Queue */
-TelReturn tcore_hal_send_request(TcoreHal *hal, TcorePending *pending)
+TReturn tcore_hal_send_request(TcoreHal *hal, TcorePending *pending)
 {
-       TcorePendingPriority priority;
-       TelReturn ret;
-       dbg("HAL: [%p]", hal);
+       int ret = 0;
+       enum tcore_pending_priority priority;
 
-       if ((hal == NULL) || (pending == NULL)){
-               err("hal: [%p] pending: [%p]", hal, pending);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal || !pending)
+               return TCORE_RETURN_EINVAL;
 
-       if (hal->power_state == FALSE) {
-               err("HAL Power: [OFF]");
-               return TEL_RETURN_FAILURE;
-       }
+       if (hal->power_state == FALSE)
+               return TCORE_RETURN_FAILURE;
 
        ret = tcore_queue_push(hal->queue, pending);
-       if (ret != TEL_RETURN_SUCCESS) {
-               err("Failed to PUSH request to Queue");
+       if( ret != TCORE_RETURN_SUCCESS ) {
+               dbg("Pushing pending fails : return [ %d ]", ret);
                return ret;
        }
 
        tcore_pending_get_priority(pending, &priority);
        if (priority == TCORE_PENDING_PRIORITY_IMMEDIATELY) {
-               dbg("IMMEDIATELY pending !!!");
-               __hal_idle_send(hal);
+               dbg("IMMEDIATELY pending !!");
+               _hal_idle_send(hal);
        }
        else {
-               /* If it is the ONLY entry then add to g_idle_add_full */
-               if (tcore_queue_get_length(hal->queue) == 1) {
-                       dbg("Single entry in pending  Queue!!!");
-                       g_idle_add_full(IDLE_SEND_PRIORITY,
-                               __hal_idle_send, hal, NULL);
+               if (tcore_queue_get_normal_length(hal->queue) <= 1) {
+                       g_idle_add_full(IDLE_SEND_PRIORITY, _hal_idle_send, hal, NULL);
                }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_hal_send_force(TcoreHal *hal)
+TReturn tcore_hal_send_force(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
-       __hal_idle_send(hal);
+       _hal_idle_send(hal);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_hal_dispatch_response_data(TcoreHal *hal, guint id,
-               guint data_len, const void *data)
+TReturn tcore_hal_free_timeout_pending_request(TcoreHal *hal, TcorePending *p,
+       unsigned int data_len, const void *data)
 {
-       TcorePending *pending = NULL;
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
+
+       if (data_len > 0 && data == NULL)
+               return TCORE_RETURN_EINVAL;
 
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
+       if (hal->mode == TCORE_HAL_MODE_AT) {
+               dbg("TCORE_HAL_MODE_AT");
+               tcore_free_pending_timeout_at_request(hal->at);
+               p = tcore_queue_pop_by_pending(hal->queue, p);
+               if (!p) {
+                       dbg("no pending");
+               }
+               tcore_user_request_free(tcore_pending_ref_user_request(p));
+               tcore_pending_free(p);
        }
+       else {
+               if(hal->mode == TCORE_HAL_MODE_CUSTOM) {
+                       dbg("TCORE_HAL_MODE_CUSTOM");
+                       p = tcore_queue_pop_by_pending(hal->queue, p);
+                       if (!p) {
+                               dbg("no pending");
+                       }
+                       tcore_user_request_free(tcore_pending_ref_user_request(p));
+                       tcore_pending_free(p);
+               }
+               else if(hal->mode == TCORE_HAL_MODE_TRANSPARENT) {
+                       dbg("TCORE_HAL_MODE_TRANSPARENT");
 
-       if ((data_len == 0) || (data == NULL)) {
-               err("data_len: [%d] data: [%p]", data_len, data);
-               return TEL_RETURN_INVALID_PARAMETER;
+                       /* TODO : Need to free resources */
+
+                       /* Invoke CMUX receive API for decoding */
+                       tcore_cmux_rcv_from_hal(hal, (unsigned char *)data, data_len);
+               }
        }
+       /* Send next request in queue */
+       g_idle_add_full(IDLE_SEND_PRIORITY, _hal_idle_send, hal, NULL );
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_hal_dispatch_response_data(TcoreHal *hal, int id,
+               unsigned int data_len, const void *data)
+{
+       TcorePending *p = NULL;
+
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
+
+       if (data_len > 0 && data == NULL)
+               return TCORE_RETURN_EINVAL;
 
        if (hal->mode == TCORE_HAL_MODE_AT) {
                gboolean ret;
+#ifdef TCORE_HAL_DEBUG
+               dbg("TCORE_HAL_MODE_AT");
+#endif
                ret = tcore_at_process(hal->at, data_len, data);
                if (ret) {
                        /* Send next request in queue */
-                       g_idle_add_full(IDLE_SEND_PRIORITY,
-                               __hal_idle_send, hal, NULL);
+                       g_idle_add_full(IDLE_SEND_PRIORITY, _hal_idle_send, hal, NULL );
                }
        }
        else {
                if(hal->mode == TCORE_HAL_MODE_CUSTOM) {
                        dbg("TCORE_HAL_MODE_CUSTOM");
-                       pending = tcore_queue_pop_by_id(hal->queue, id);
-                       if (pending == NULL) {
-                               err("unknown pending (id=0x%x)", id);
-                               return TEL_RETURN_INVALID_PARAMETER;
+                       p = tcore_queue_pop_by_id(hal->queue, id);
+                       if (!p) {
+                               dbg("unknown pending (id=0x%x)", id);
+                               return TCORE_RETURN_PENDING_WRONG_ID;
                        }
 
-                       /* Emit response callback */
-                       tcore_pending_emit_response_callback(pending,
-                               data_len, data);
-
-                       /* Free pending request */
-                       tcore_pending_free(pending);
+                       tcore_pending_emit_response_callback(p, data_len, data);
+                       tcore_user_request_free(tcore_pending_ref_user_request(p));
+                       tcore_pending_free(p);
                }
                else if(hal->mode == TCORE_HAL_MODE_TRANSPARENT) {
                        dbg("TCORE_HAL_MODE_TRANSPARENT");
 
                        /* Invoke CMUX receive API for decoding */
-                       tcore_cmux_rcv_from_hal(hal, (guchar *)data, data_len);
+                       tcore_cmux_rcv_from_hal(hal, (unsigned char *)data, data_len);
                }
-
                /* Send next request in queue */
-               g_idle_add_full(IDLE_SEND_PRIORITY, __hal_idle_send, hal, NULL);
+               g_idle_add_full(IDLE_SEND_PRIORITY, _hal_idle_send, hal, NULL );
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_hal_add_recv_callback(TcoreHal *hal, TcoreHalReceiveCallback func,
+TReturn tcore_hal_add_recv_callback(TcoreHal *hal, TcoreHalReceiveCallback func,
                void *user_data)
 {
        struct recv_callback_item_type *item;
 
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
-       item = g_try_new0(struct recv_callback_item_type, 1);
-       if (item == NULL) {
-               err("Failed to allocate memory");
-               return TEL_RETURN_MEMORY_FAILURE;
-       }
+       item = calloc(1, sizeof(struct recv_callback_item_type));
+       if (!item)
+               return TCORE_RETURN_ENOMEM;
 
        item->func = func;
        item->user_data = user_data;
 
        hal->callbacks = g_slist_append(hal->callbacks, item);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_hal_remove_recv_callback(TcoreHal *hal, TcoreHalReceiveCallback func)
+TReturn tcore_hal_remove_recv_callback(TcoreHal *hal, TcoreHalReceiveCallback func)
 {
        struct recv_callback_item_type *item;
        GSList *list;
 
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
        for (list = hal->callbacks; list; list = list->next) {
                item = list->data;
-               if (item != NULL) {
-                       if (item->func == func) {
-                               hal->callbacks =
-                                       g_slist_remove(hal->callbacks, item);
-                               tcore_free(item);
-                               if (hal->callbacks == NULL)
-                                       break;
-
-                               list = hal->callbacks;
-                       }
+               if (!item) {
+                       continue;
+               }
+
+               if (item->func == func) {
+                       hal->callbacks = g_slist_remove(hal->callbacks, item);
+                       free(item);
+                       if (!hal->callbacks)
+                               break;
+
+                       list = hal->callbacks;
                }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_hal_emit_recv_callback(TcoreHal *hal, guint data_len,
+TReturn tcore_hal_emit_recv_callback(TcoreHal *hal, unsigned int data_len,
                const void *data)
 {
        GSList *list;
        struct recv_callback_item_type *item;
 
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
        for (list = hal->callbacks; list; list = list->next) {
                item = list->data;
-               if (item != NULL)
-                       if (item->func)
-                               item->func(hal, data_len, data, item->user_data);
+
+               if (item) {
+                       item->func(hal, data_len, data, item->user_data);
+               }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 
-TelReturn tcore_hal_add_send_hook(TcoreHal *hal,
-       TcoreHalSendHook func, void *user_data)
+TReturn tcore_hal_add_send_hook(TcoreHal *hal, TcoreHalSendHook func, void *user_data)
 {
        struct hook_send_type *hook;
 
-       if ((hal == NULL) || (func == NULL)) {
-               err("hal: [%p] func: [%p]", hal, func);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal || !func)
+               return TCORE_RETURN_EINVAL;
 
-       hook = g_try_new0(struct hook_send_type, 1);
-       if (hook == NULL) {
-               err("Failed to allocate memory");
-               return TEL_RETURN_MEMORY_FAILURE;
-       }
+       hook = calloc(1, sizeof(struct hook_send_type));
+       if (!hook)
+               return TCORE_RETURN_ENOMEM;
 
        hook->func = func;
        hook->user_data = user_data;
 
        hal->hook_list_send = g_slist_append(hal->hook_list_send, hook);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_hal_remove_send_hook(TcoreHal *hal, TcoreHalSendHook func)
+TReturn tcore_hal_remove_send_hook(TcoreHal *hal, TcoreHalSendHook func)
 {
        struct hook_send_type *hook;
        GSList *list;
 
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
        for (list = hal->hook_list_send; list; list = list->next) {
                hook = list->data;
-               if (hook != NULL) {
-                       if (hook->func == func) {
-                               hal->hook_list_send =
-                                       g_slist_remove(hal->hook_list_send, hook);
+               if (!hook) {
+                       continue;
+               }
 
-                               tcore_free(hook);
-                               list = hal->hook_list_send;
-                       }
+               if (hook->func == func) {
+                       hal->hook_list_send = g_slist_remove(hal->hook_list_send, hook);
+                       free(hook);
+                       list = hal->hook_list_send;
                }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 TcoreQueue *tcore_hal_ref_queue(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal)
                return NULL;
-       }
 
        return hal->queue;
 }
 
 TcorePlugin *tcore_hal_ref_plugin(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal)
                return NULL;
-       }
 
        return hal->parent_plugin;
 }
 
-TelReturn tcore_hal_set_power_state(TcoreHal *hal, gboolean flag)
+TReturn tcore_hal_set_power_state(TcoreHal *hal, gboolean flag)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal)
+               return TCORE_RETURN_EINVAL;
 
        hal->power_state = flag;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 gboolean tcore_hal_get_power_state(TcoreHal *hal)
 {
-       if (hal == NULL) {
-               err("HAL is NULL");
+       if (!hal)
                return FALSE;
-       }
 
        return hal->power_state;
 }
 
-TelReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag)
+TReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag)
 {
-       if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->power == NULL)) {
-               err("hal: [%p] hal->ops: [%p] hal->ops->power: [%p]",
-                       hal, (hal ? hal->ops : NULL),
-                       (hal ? (hal->ops ? hal->ops->power : NULL) : NULL));
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!hal || !hal->ops || !hal->ops->power)
+               return TCORE_RETURN_EINVAL;
 
        return hal->ops->power(hal, flag);
 }
-
-TelReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
-       TcoreHalSetupNetifCallback func, void *user_data,
-       guint cid, gboolean enable)
+TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
+                               TcoreHalSetupNetifCallback func,
+                               void *user_data, unsigned int cid,
+                               gboolean enable)
 {
-       if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->setup_netif == NULL)) {
-               err("hal: [%p] hal->ops: [%p] hal->ops->setup_netif: [%p]",
-                       hal, (hal ? hal->ops : NULL),
-                       (hal ? (hal->ops ? hal->ops->setup_netif : NULL) : NULL));
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->setup_netif == NULL))
+               return TCORE_RETURN_EINVAL;
 
        return hal->ops->setup_netif(co, func, user_data, cid, enable);
 }
index a90774b..d75b88e 100644 (file)
--- a/src/mux.c
+++ b/src/mux.c
@@ -1,8 +1,8 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Contact: Arijit Sen <arijit.sen@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "hal.h"
 #include "core_object.h"
 #include "plugin.h"
+#include "user_request.h"
 #include "server.h"
 #include "at.h"
 #include "mux.h"
 
 /* Channel name maximum length */
-#define CMUX_MAX_CHANNEL_NAME  16
+#define CMUX_MAX_CHANNEL_NAME                  16
 
 /* CMUX Commands */
-#define CMUX_COMMAND_SABM              0x2F
-#define CMUX_COMMAND_UA                0x63
-#define CMUX_COMMAND_DM                0x0F
-#define CMUX_COMMAND_DISC              0x43
-#define CMUX_COMMAND_UIH               0xEF
-#define CMUX_COMMAND_UI                0x03
+#define CMUX_COMMAND_SABM                              0x2F
+#define CMUX_COMMAND_UA                                        0x63
+#define CMUX_COMMAND_DM                                        0x0F
+#define CMUX_COMMAND_DISC                                      0x43
+#define CMUX_COMMAND_UIH                                       0xEF
+#define CMUX_COMMAND_UI                                        0x03
 
 /* CMUX Delimiter Byte */
-#define CMUX_FRAME_DELIMITER           0xF9
+#define CMUX_FRAME_DELIMITER                           0xF9
 
 /*
  * CMUX Channels [0-64] -
@@ -59,7 +60,7 @@ typedef enum {
        CMUX_CHANNEL_0 = 0,             /* CMUX Control Channel */
 
        CMUX_CHANNEL_MAX = 65   /* Based on #GPP 27.010 */
-} TcoreCmuxChannelId;
+} tcore_cmux_channel_id;
 
 /*
  * CMUX Channel States
@@ -79,37 +80,37 @@ typedef enum {
        CMUX_CHANNEL_UA_SEND_CLOSING,
        CMUX_CHANNEL_UA_RECEIVED,
        CMUX_CHANNEL_UA_SENDING,
-} TcoreCmuxChannelState;
+} tcore_cmux_channel_state;
 
 /* CMUX State */
 typedef enum {
        CMUX_NOT_INITIALIZED,
        CMUX_INITIALIZED,
        CMUX_CLOSED
-} TcoreCmuxState;
+} tcore_cmux_state;
 
 /*
  * CMUX CONTROL COMMANDS
  * We are supporting only MSC and CLD commands for phase 1
  */
 /* Modem Status Command */
-#define  CMUX_COMMAND_MSC              0xE3
+#define  CMUX_COMMAND_MSC                                      0xE3
 /* Multiplexer close down */
-#define  CMUX_COMMAND_CLD              0xC3
-
-#define FIND_LENGTH(buf, header_length, total_length)  do { \
-       if (*buf & 0x01) { \
-               total_length = *buf++ >> 1;     \
-               header_length = 6; \
-       } else { \
-               total_length = *(buf + 0x01) << 7; \
-               total_length = total_length | (*buf & 0xFE) >> 1; \
-               header_length = 7; \
-       } \
+#define  CMUX_COMMAND_CLD                                      0xC3
+
+#define FIND_LENGTH(buf, header_length, total_length)  do {    \
+               if (*buf & 0x01) { \
+                       total_length = *buf++ >> 1;     \
+                       header_length = 6; \
+               } else { \
+                       total_length = *(buf + 0x01) << 7; \
+                       total_length = total_length | (*buf & 0xFE) >> 1; \
+                       header_length = 7; \
+               } \
 } while (0)
 
 /*================= CRC TABLE=========================*/
-const guchar crc_table[256] = {        /* reversed, 8-bit, poly=0x07 */
+const unsigned char crc_table[256] = { /* reversed, 8-bit, poly=0x07 */
        0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75,
        0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B,
        0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69,
@@ -149,34 +150,34 @@ const guchar crc_table[256] = {   /* reversed, 8-bit, poly=0x07 */
 struct cmux_channel {
        TcoreHal *hal;
 
-       TcoreCmuxChannelState channel_state;
-       TcoreCmuxChannelId channel_id;
+       tcore_cmux_channel_state channel_state;
+       tcore_cmux_channel_id channel_id;
 
-       gint frame_type;
-       guchar ext_bit;
-       guchar cr_bit;
-       guchar poll_final_bit;
+       int frame_type;
+       unsigned char ext_bit;
+       unsigned char cr_bit;
+       unsigned char poll_final_bit;
 };
 
 /* CMUX structure - Internal */
 struct cmux_internal {
-       TcoreCmuxChannel *channel_info[CMUX_CHANNEL_MAX];
+       tcore_cmux_channel *channel_info[CMUX_CHANNEL_MAX];
 
-       gint is_waiting;
+       int is_waiting;
 
-       guint msg_len;
-       gint cur_main_buf_len;
+       int msg_len;
+       int cur_main_buf_len;
 
        /* Channel Setup callbacks */
-       CmuxSetupCbFunc channel_setup_cb;
-       gpointer channel_setup_cb_data;
+       cmux_setup_cb_func channel_setup_cb;
+       gpointer channel_setup_user_data;
 
        /* Channel Setup complete callback */
-       CmuxSetupCompleteCbFunc setup_complete_cb;
-       gpointer setup_complete_cb_data;
+       cmux_setup_complete_cb_func setup_complete_cb;
+       gpointer setup_complete_user_data;
 
-       gint info_field_len;
-       guchar *info_field;
+       int info_field_len;
+       unsigned char *info_field;
 };
 
 /* Global CMUX Object */
@@ -187,14 +188,14 @@ struct cmux_obj {
        /* Modem Interface Plug-in */
        TcorePlugin *plugin;
 
-       TcoreCmuxState cmux_state;
+       tcore_cmux_state cmux_state;
 
        tcore_cmux_mode cmux_mode;
-       guint max_cmux_channels;
-       guint max_cmux_buf_size;
+       int max_cmux_channels;
+       unsigned int max_cmux_buf_size;
 
        /* CMUX frame processing buffer */
-       guchar *cmux_buffer;
+       unsigned char *cmux_buffer;
 
        /* Only Internal MUX is managed by libtcore */
        struct cmux_internal internal_mux;
@@ -205,42 +206,43 @@ static GSList *g_cmux_obj = NULL;
 
 /* All the local functions declared below */
 static void _cmux_on_confirmation_message_send(TcorePending *plugin,
-       TelReturn result, void *user_data);
+                                                                                       gboolean result, void *user_data);
 
-TcoreCmuxObject *_cmux_new(guint max_channels, guint buffer_size);
-static void _cmux_free(TcoreCmuxObject *cmux_obj);
+tcore_cmux_object *_cmux_new(int max_channels, unsigned int buffer_size);
+static void _cmux_free(tcore_cmux_object *cmux_obj);
 
-static void _cmux_channel_init(TcoreCmuxObject *cmux_obj, gint channel_id);
-static void _cmux_close_channel(TcoreCmuxObject *cmux_obj, gint channel_id);
+static void _cmux_channel_init(tcore_cmux_object *cmux_obj, int channel_id);
+static void _cmux_close_channel(tcore_cmux_object *cmux_obj, int channel_id);
 
-static TcoreHal *_cmux_create_logical_hal(TcoreCmuxObject *cmux_obj,
-       TcoreCmuxChannel *channel);
+static TcoreHal *_cmux_create_logical_hal(tcore_cmux_object *cmux_obj,
+                                                               tcore_cmux_channel *channel);
 
-static gboolean _cmux_recv_cmux_data(TcoreCmuxObject *cmux_obj,
-       TcoreCmuxChannel *channel);
-static void _cmux_process_rcv_frame(TcoreCmuxObject *cmux_obj, gint length);
-static void _cmux_process_channel_data(TcoreCmuxObject *cmux_obj,
-       TcoreCmuxChannel *channel);
+static gboolean _cmux_recv_cmux_data(tcore_cmux_object *cmux_obj,
+                               tcore_cmux_channel *channel);
+static void _cmux_process_rcv_frame(tcore_cmux_object *cmux_obj, int length);
+static void _cmux_process_channel_data(tcore_cmux_object *cmux_obj,
+                                       tcore_cmux_channel *channel);
 
-static void _cmux_control_channel_handle(TcoreCmuxObject *cmux_obj);
-static void _cmux_flush_channel_data(TcoreCmuxObject *cmux_obj);
+static void _cmux_control_channel_handle(tcore_cmux_object *cmux_obj);
+static void _cmux_flush_channel_data(tcore_cmux_object *cmux_obj);
 
-static TelReturn _cmux_send_data(TcoreHal *hal, gint data_len, guchar *data);
-static guchar *_cmux_encode_cmux_frame(TcoreCmuxObject *cmux_obj,
-       guchar *data, guint length, guint channel_id,
-       gint frame_type, guchar EA_bit, guchar CR_bit,
-       guchar PF_bit, guint *out_data_len);
+static TReturn _cmux_send_data(TcoreHal *hal, int data_len, unsigned char *data);
+static unsigned char *_cmux_encode_cmux_frame(tcore_cmux_object *cmux_obj,
+                                               unsigned char *data, unsigned int length, int channel_id,
+                                               int frame_type, unsigned char EA_bit, unsigned char CR_bit,
+                                               unsigned char PF_bit, int *out_data_len);
 
-static TcoreCmuxObject *_cmux_get_cmux_object(TcorePlugin *plugin);
+static tcore_cmux_object *_cmux_get_cmux_object(TcorePlugin *plugin);
 
-static guchar _cmux_calc_crc(guchar *header, gint length);
-static gint _cmux_check_recv_crc(guchar *data,
-       guchar length, guchar rcv_fcs);
+static unsigned char _cmux_calc_crc(unsigned char *header, int length);
+static int _cmux_check_recv_crc(unsigned char *data,
+                                                                       unsigned char length,
+                                                                       unsigned char rcv_fcs);
 
-static guchar _cmux_calc_crc(guchar *header, gint length)
+static unsigned char _cmux_calc_crc(unsigned char *header, int length)
 {
-       guchar fcs = 0xFF;      /* Init */
-       guchar crc = 0x00;
+       unsigned char fcs = 0xFF;       /* Init */
+       unsigned char crc = 0x00;
 
        /*
         * 'length' is the number of bytes in the message,
@@ -256,10 +258,11 @@ static guchar _cmux_calc_crc(guchar *header, gint length)
        return crc;
 }
 
-static gint _cmux_check_recv_crc(guchar *data,
-       guchar length, guchar rcv_fcs)
+static int _cmux_check_recv_crc(unsigned char *data,
+                                                                       unsigned char length,
+                                                                       unsigned char rcv_fcs)
 {
-       guchar fcs = 0xFF;      /* Init */
+       unsigned char fcs = 0xFF;       /* Init */
 
        /*
         * 'length' is the number of bytes in the message,
@@ -278,10 +281,11 @@ static gint _cmux_check_recv_crc(guchar *data,
                return 0;
 }
 
-static TcoreCmuxObject *_cmux_get_cmux_object(TcorePlugin *plugin)
+static tcore_cmux_object *_cmux_get_cmux_object(TcorePlugin *plugin)
 {
-       TcoreCmuxObject *cmux_obj;
+       tcore_cmux_object *cmux_obj;
        GSList *tmp_obj;
+       dbg("Entry");
 
        /* Check across CMUX Objects list for specific CMUX Object */
        for (tmp_obj = g_cmux_obj ; tmp_obj ; tmp_obj = tmp_obj->next) {
@@ -299,14 +303,14 @@ static TcoreCmuxObject *_cmux_get_cmux_object(TcorePlugin *plugin)
        return NULL;
 }
 
-static guchar *_cmux_encode_cmux_frame(TcoreCmuxObject *cmux_obj,
-       guchar *data, guint length, guint channel_id,
-       gint frame_type, guchar EA_bit, guchar CR_bit,
-       guchar PF_bit, guint *out_data_len)
+static unsigned char *_cmux_encode_cmux_frame(tcore_cmux_object *cmux_obj,
+                                               unsigned char *data, unsigned int length, int channel_id,
+                                               int frame_type, unsigned char EA_bit, unsigned char CR_bit,
+                                               unsigned char PF_bit, int *out_data_len)
 {
-       guint frame_length = 0;
-       guint total_frame_length = 0;
-       guint crc_len = 0;
+       int frame_length = 0;
+       int total_frame_length = 0;
+       int crc_len = 0;
        dbg("Entry");
 
        /* Flush channel data */
@@ -332,11 +336,11 @@ static guchar *_cmux_encode_cmux_frame(TcoreCmuxObject *cmux_obj,
 
                /* DLCI: Data Link Connection Identifier */
                /* Check if the channel is within range */
-               if (channel_id < cmux_obj->max_cmux_channels) {
+               if (channel_id < cmux_obj->max_cmux_channels && channel_id >= 0) {
                        dbg("Channel ID: [%d]", channel_id);
                        cmux_obj->internal_mux.info_field[frame_length] =
                                (cmux_obj->internal_mux.info_field[frame_length]
-                                                       | ((guchar)channel_id << 2));
+                                                       | ((unsigned char)channel_id << 2));
                } else {
                        err("Channel ID [%d] is out of range [0-%d]",
                                        channel_id, cmux_obj->max_cmux_channels);
@@ -348,33 +352,32 @@ static guchar *_cmux_encode_cmux_frame(TcoreCmuxObject *cmux_obj,
                 * Control Field
                 *
                 * The content of the control field defines the type of frame.
-                * ************************************************************
-                * Frame Type                                   0 1 2 3  4   5 6 7
-                * SABM (Set Asynchronous Balanced Mode)                1 1 1 1 P/F 1 0 0
-                * UA (Unnumbered Acknowledgement)              1 1 0 0 P/F 1 1 0
-                * DM (Disconnected Mode)                               1 1 1 1 P/F 0 0 0
-                * DISC (Disconnect)                            1 1 0 0 P/F 0 1 0
-                * UIH (Unnumbered Information with Header check)       1 1 1 1 P/F 1 1 1
-                *************************************************************/
+                * ****************************************************************
+                * Frame Type                                                                           0 1 2 3  4   5 6 7
+                * SABM (Set Asynchronous Balanced Mode)                                1 1 1 1 P/F 1 0 0
+                * UA (Unnumbered Acknowledgement)                                      1 1 0 0 P/F 1 1 0
+                * DM (Disconnected Mode)                                                               1 1 1 1 P/F 0 0 0
+                * DISC (Disconnect)                                                                    1 1 0 0 P/F 0 1 0
+                * UIH (Unnumbered Information with Header check)                       1 1 1 1 P/F 1 1 1
+                ******************************************************************/
                if (PF_bit)
                        cmux_obj->internal_mux.info_field[frame_length++] =
-                                                       frame_type | 0x10;
+                                                                                                       frame_type | 0x10;
                else
-                       cmux_obj->internal_mux.info_field[frame_length++] =
-                                                       frame_type;
+                       cmux_obj->internal_mux.info_field[frame_length++] = frame_type;
 
                /* 5.2.1.5 Length Indicator */
                if (length < 128) {
                        cmux_obj->internal_mux.info_field[frame_length++] =
-                                               (guchar) length << 1 | 0x01;
+                                                                                                       (char) length << 1 | 0x01;
 
                        /* CRC calculatable length */
                        crc_len = 3;
                } else {
                        cmux_obj->internal_mux.info_field[frame_length++] =
-                                                       (guchar) (length << 1);
+                                                                                                       (char) (length << 1);
                        cmux_obj->internal_mux.info_field[frame_length++] =
-                                                       (guchar) (length >> 7);
+                                                                                                       (char) (length >> 7);
 
                        /* CRC calculatable length */
                        crc_len = 4;
@@ -389,7 +392,7 @@ static guchar *_cmux_encode_cmux_frame(TcoreCmuxObject *cmux_obj,
                /* 5.2.1.4 Information Field */
                if (length > 0) {
                        memcpy((cmux_obj->internal_mux.info_field + frame_length),
-                                       data, length);
+                                                                                                               data, length);
                        frame_length += length;
                } else
                        dbg("info field length is zero");
@@ -399,8 +402,7 @@ static guchar *_cmux_encode_cmux_frame(TcoreCmuxObject *cmux_obj,
                        _cmux_calc_crc(cmux_obj->internal_mux.info_field + 1, crc_len);
 
                /* Flag Octet */
-               cmux_obj->internal_mux.info_field[frame_length++] =
-                                               CMUX_FRAME_DELIMITER;
+               cmux_obj->internal_mux.info_field[frame_length++] = CMUX_FRAME_DELIMITER;
 
                total_frame_length = frame_length;
        } else if (cmux_obj->cmux_mode == CMUX_MODE_ADVANCED) {
@@ -414,18 +416,17 @@ static guchar *_cmux_encode_cmux_frame(TcoreCmuxObject *cmux_obj,
        return cmux_obj->internal_mux.info_field;
 }
 
-static void _cmux_control_channel_handle(TcoreCmuxObject *cmux_obj)
+static void _cmux_control_channel_handle(tcore_cmux_object *cmux_obj)
 {
-       guchar cmd_type;
-       guint msg_len = 0;
-       guchar *msg_start_ptr;
+       unsigned char cmd_type;
+       int msg_len = 0;
+       unsigned char *msg_start_ptr;
        dbg("Entry");
 
        /*
         * 5.4.6.1 Message format
-        *
-        * All messages sent between the multiplexers conform to
-        * the following type, length, value format:
+        * All messages sent between the multiplexers conform to the following
+        * type, length, value format:
         * Type Length Value 1 Value2  \85
         */
        if (cmux_obj->internal_mux.info_field_len > 0) {
@@ -433,35 +434,31 @@ static void _cmux_control_channel_handle(TcoreCmuxObject *cmux_obj)
                cmd_type = cmux_obj->internal_mux.info_field[0];
 
                /*
-                * The EA bit is an extension bit.
-                *
-                * The EA bit is set to 1 in the last octet of the sequence;
-                * in other octets EA is set to 0.
+                * The EA bit is an extension bit. The EA bit is set to 1 in the last octet
+                * of the sequence; in other octets EA is set to 0.
                 *
                 * Search for the last octet
                 */
                while ((*msg_start_ptr++ & 0x01))
                        msg_len++;
 
-               if ((cmd_type & 0x02) == 0x02) {/* This is a command Request */
+               if ((cmd_type & 0x02) == 0x02) {        /* This is a command Request */
                        switch (cmd_type) {
-                       case CMUX_COMMAND_MSC:
-                               dbg("Modem Status Command");
-                       break;
-
-                       case CMUX_COMMAND_CLD:
-                               dbg("Multiplexer close down");
-
-                               cmux_obj->cmux_state = CMUX_CLOSED;
-
-                               /* TODO - Need to notify regarding CMUX closure */
-                               tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
-                       break;
-
-                       default:
-                               /* We will be supporting these commands in Phase 2 */
-                               dbg("Default");
-                       break;
+                               case CMUX_COMMAND_MSC:
+                                       dbg("Modem Status Command");
+                                       break;
+                               case CMUX_COMMAND_CLD:
+                                       dbg("Multiplexer close down");
+
+                                       cmux_obj->cmux_state = CMUX_CLOSED;
+
+                                       /* TODO - Need to notify regarding CMUX closure */
+                                       tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
+                                       break;
+                               default:
+                                       /* We will be supporting these commands in Phase 2 */
+                                       dbg("Default");
+                                       break;
                        }
                }
        } else
@@ -470,221 +467,221 @@ static void _cmux_control_channel_handle(TcoreCmuxObject *cmux_obj)
        dbg("Exit");
 }
 
-static void _cmux_process_channel_data(TcoreCmuxObject *cmux_obj,
-       TcoreCmuxChannel *channel)
+static void _cmux_process_channel_data(tcore_cmux_object *cmux_obj,
+                                       tcore_cmux_channel *channel)
 {
-       gint frame_type;
-       guint channel_id;
-       guint len;
-       guchar *send_data;
-       static guint count = 0;
-       TelReturn ret;
+       int frame_type;
+       int channel_id;
+       int len;
+       unsigned char *send_data;
+       static int count = 0;
+       int ret;
        dbg("Entry");
 
        channel_id = channel->channel_id;
+       dbg("Channel ID: [%d]", channel_id);
+
        frame_type = channel->frame_type & 0xEF;
-       dbg("Channel ID: [%d] Frame Type: [0x%02x]", channel_id, frame_type);
+       dbg("Frame Type: [0x%02x]", frame_type);
 
        switch (frame_type) {
-       case CMUX_COMMAND_UI:   /* FALLTHROUGH */
-       case CMUX_COMMAND_UIH:
-               dbg("");
-               if (channel_id == CMUX_CHANNEL_0) {     /* This is control info */
-                       dbg("Received UI/UIH Frame - [Control information]");
-                       _cmux_control_channel_handle(cmux_obj);
-               } else {
-                       dbg("Received UI/UIH Frame - [Normal information]");
-
-                       /* Put in the logical HAL queue, this goes to the Cobject */
-                       if (FALSE == _cmux_recv_cmux_data(cmux_obj, channel))
-                               err("Failed receive callback");
-               }
-       break;
-       case CMUX_COMMAND_UA:
-               dbg("Received UA Frame - Channel State: [%d]", channel->channel_state);
-               if (channel->channel_state
-                               == CMUX_CHANNEL_SABM_SEND_WAITING_FOR_UA) {
-                       channel->channel_state = CMUX_CHANNEL_ESTABLISHED;
-
-                       if (channel->channel_id != CMUX_CHANNEL_0) {
-                               TcoreHal *hal;
-
-                               /* Create Logical HAL */
-                               hal = _cmux_create_logical_hal(cmux_obj, channel);
-                               if (hal != NULL) {
-                                       dbg("Invoking CMUX Channel Setup "
-                                               "callback for [%d] channel",
-                                               channel->channel_id);
+               case CMUX_COMMAND_UI:
+               case CMUX_COMMAND_UIH:
+                       dbg("Received UI/UIH Frame");
+                       if (channel_id == CMUX_CHANNEL_0) {              /* This is control info */
+                               dbg("Control information");
+                               _cmux_control_channel_handle(cmux_obj);
+                       } else {
+                               dbg("Normal information");
+
+                               /* Put in the logical HAL queue, this goes to the Cobject */
+                               if (FALSE == _cmux_recv_cmux_data(cmux_obj, channel))
+                                       err("Failed receive callback");
+                       }
+                       break;
+               case CMUX_COMMAND_UA:
+                       dbg("Received UA Frame - Channel State: [%d]", channel->channel_state);
+                       if (CMUX_CHANNEL_SABM_SEND_WAITING_FOR_UA == channel->channel_state) {
+                               channel->channel_state = CMUX_CHANNEL_ESTABLISHED;
+
+                               if (channel->channel_id != CMUX_CHANNEL_0) {
+                                       TcoreHal *hal;
+
+                                       /* Create Logical HAL */
+                                       hal = _cmux_create_logical_hal(cmux_obj, channel);
+                                       if (hal != NULL) {
+                                               dbg("Invoking CMUX Channel Setup callback for [%d] channel",
+                                                                                                       channel->channel_id);
+                                               /*
+                                                * 'channel_setup_cb' cannot be NULL as it is MANDATED during
+                                                * CMUX setup operation.
+                                                */
+                                               cmux_obj->internal_mux.channel_setup_cb(channel->channel_id, hal,
+                                                                               cmux_obj->internal_mux.channel_setup_user_data);
+                                       } else
+                                               err("Failed to Create Logical HAL");
+                               }
+
+                               count++;
+                               dbg("Count: [%d]", count);
+                               if (cmux_obj->max_cmux_channels == count) {
+                                       dbg("Invoking CMUX Channel Setup Complete callback - Total Channels: [%d]",
+                                                                                                       count);
                                        /*
-                                        * 'channel_setup_cb' cannot be NULL as it is MANDATED during
+                                        * 'setup_complete_cb' cannot be NULL as it is MANDATED during
                                         * CMUX setup operation.
                                         */
-                                       cmux_obj->internal_mux.channel_setup_cb(
-                                               channel->channel_id, hal,
-                                               cmux_obj->internal_mux.channel_setup_cb_data
-                                               );
-                               } else
-                                       err("Failed to Create Logical HAL");
-                       }
+                                       cmux_obj->internal_mux.setup_complete_cb(
+                                               cmux_obj->internal_mux.setup_complete_user_data);
 
-                       count++;
-                       dbg("Count: [%d]", count);
-                       if (cmux_obj->max_cmux_channels == count) {
-                               dbg("Invoking CMUX Channel Setup Complete "
-                                       "callback - Total Channels: [%d]", count);
-                               /*
-                                * 'setup_complete_cb' cannot be NULL as it is MANDATED during
-                                * CMUX setup operation.
-                                */
-                               cmux_obj->internal_mux.setup_complete_cb(
-                                       cmux_obj->internal_mux.setup_complete_cb_data);
-
-                               /* Reset 'count' */
-                               count = 0;
-                       }
-               } else if (channel->channel_state
-                               == CMUX_CHANNEL_SABM_SEND_WAITING_FOR_UA) {
-                       channel->channel_state = CMUX_CHANNEL_CLOSED;
+                                       /* Reset 'count' */
+                                       count = 0;
+                               }
+                       } else if (CMUX_CHANNEL_DISC_SEND_WAITING_FOR_UA ==
+                                                                               channel->channel_state) {
+                               channel->channel_state = CMUX_CHANNEL_CLOSED;
 
-                       if (channel_id == CMUX_CHANNEL_0) {
-                               cmux_obj->cmux_state = CMUX_CLOSED;
+                               if (channel_id == CMUX_CHANNEL_0) {
+                                       cmux_obj->cmux_state = CMUX_CLOSED;
 
-                               /* TODO - Need to notify regarding CMUX closure */
-                               tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
-                       }
-               } else
-                       err("Received UA in wrong state!!!");
+                                       /* TODO - Need to notify regarding CMUX closure */
+                                       tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
+                               }
+                       } else
+                               err("Received UA in wrong state!!!");
 
-       break;
-       case CMUX_COMMAND_DM:
-               /*
-                * 5.4.1 DLC Establishment: If the responding station is
-                * not ready or unwilling to establish the particular DLC
-                * it will reply with a DM frame with the F-bit set to 1.
-                */
-               dbg("Received DM Frame");
-               if ((channel->channel_state == CMUX_CHANNEL_ESTABLISHED)
-                               || (channel->channel_state
-                               == CMUX_CHANNEL_SABM_SEND_WAITING_FOR_UA)) {
-                       /* Channel State set to Close */
-                       channel->channel_state = CMUX_CHANNEL_CLOSED;
-               }
-
-               /* Flush the Channel data */
-               _cmux_flush_channel_data(cmux_obj);
-       break;
-       case CMUX_COMMAND_DISC:
-               dbg("Received DISC Frame");
-               if (channel->poll_final_bit == 0) {
+                       break;
+               case CMUX_COMMAND_DM:
                        /*
-                        * In the case where a CMUX_COMMAND_SABM or
-                        * CMUX_COMMAND_DISC command with the P bit set to 0
-                        * is received then the received frame shall be discarded.
+                        * 5.4.1 DLC Establishment : If the responding station is not ready or unwilling
+                        * to establish the particular DLC it will reply with a DM frame with the
+                        * F-bit set to 1.
                         */
+                       dbg("Received DM Frame");
+                       if ((channel->channel_state == CMUX_CHANNEL_ESTABLISHED)
+                               || (channel->channel_state ==
+                                                       CMUX_CHANNEL_SABM_SEND_WAITING_FOR_UA)) {
+                               /* Channel State set to Close */
+                               channel->channel_state = CMUX_CHANNEL_CLOSED;
+                       }
 
                        /* Flush the Channel data */
                        _cmux_flush_channel_data(cmux_obj);
-               } else {
-                       if (channel->channel_state == CMUX_CHANNEL_CLOSED) {
+                       break;
+               case CMUX_COMMAND_DISC:
+                       dbg("Received DISC Frame");
+                       if (channel->poll_final_bit == 0) {
                                /*
-                                * If a CMUX_COMMAND_DISC command is received
-                                * while in disconnected mode a CMUX_COMMAND_DM
-                                * response should be sent.
+                                * In the case where a CMUX_COMMAND_SABM or
+                                * CMUX_COMMAND_DISC command with
+                                * the P bit set to 0 is received then the received frame shall be
+                                * discarded.
                                 */
 
-                               /* Encoding frame */
-                               send_data = _cmux_encode_cmux_frame(cmux_obj,
-                                                       NULL, 0, channel_id,
-                                                       CMUX_COMMAND_DM,
-                                                       0x01, 0x01, 0x01, &len);
-                       } else {                /* Send Unnumbered Acknowledgement */
-                               /* Encoding frame */
-                               send_data = _cmux_encode_cmux_frame(cmux_obj,
-                                                       NULL, 0, channel_id,
-                                                       CMUX_COMMAND_UA,
-                                                       0x01, 0x01, 0x01, &len);
-                       }
+                               /* Flush the Channel data */
+                               _cmux_flush_channel_data(cmux_obj);
+                       } else {
+                               if (channel->channel_state == CMUX_CHANNEL_CLOSED) {
+                                       /*
+                                        * If a CMUX_COMMAND_DISC command is received while in
+                                        * disconnected mode a CMUX_COMMAND_DM response should
+                                        * be sent
+                                        */
 
-                       if (len == 0) {
-                               err("Failed to encode");
-                               return;
-                       }
+                                       /* Encoding frame */
+                                       send_data = _cmux_encode_cmux_frame(cmux_obj, NULL,
+                                                                                       0, channel_id, CMUX_COMMAND_DM,
+                                                                                       0x01, 0x01, 0x01, &len);
+                               } else {                                /* Send Unnumbered Acknowledgement */
+                                       /* Encoding frame */
+                                       send_data = _cmux_encode_cmux_frame(cmux_obj, NULL,
+                                                                                       0, channel_id, CMUX_COMMAND_UA,
+                                                                                       0x01, 0x01, 0x01, &len);
+                               }
+
+                               if (len == 0) {
+                                       err("Failed to encode");
+                                       return;
+                               }
 
-                       /* Send CMUX data */
-                       ret = _cmux_send_data(cmux_obj->phy_hal, len, send_data);
+                               /* Send CMUX data */
+                               ret = _cmux_send_data(cmux_obj->phy_hal, len, send_data);
+                dbg("return %d", ret);
 
-                       /* Flush the Channel data */
-                       _cmux_flush_channel_data(cmux_obj);
+                               /* Flush the Channel data */
+                               _cmux_flush_channel_data(cmux_obj);
 
-                       /*
-                        * 5.3.4 Disconnect (DISC) command: CMUX_COMMAND_DISC
-                        * command sent at DLCI 0 have the same meaning as the
-                        * Multiplexer Close Down command.
-                        */
-                       if (channel_id == CMUX_CHANNEL_0) {
-                               cmux_obj->cmux_state = CMUX_CLOSED;
+                               /*
+                                * 5.3.4 Disconnect (DISC) command: CMUX_COMMAND_DISC
+                                * command sent at DLCI 0 have the same meaning as the
+                                * Multiplexer Close Down command.
+                                */
+                               if (channel_id == CMUX_CHANNEL_0) {
+                                       cmux_obj->cmux_state = CMUX_CLOSED;
 
-                               /* Close CMUX */
-                               /* TODO - Need to notify regarding CMUX closure */
-                               tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
+                                       /* Close CMUX */
+                                       /* TODO - Need to notify regarding CMUX closure */
+                                       tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
+                               }
                        }
-               }
-       break;
-       case CMUX_COMMAND_SABM:
-               dbg("Received SABM Frame");
-               if (channel->poll_final_bit == 0) {
-                       /*
-                        * In the case where a CMUX_COMMAND_SABM or CMUX_COMMAND_DISC
-                        * command with the P bit set to 0 is received then the received frame
-                        * shall be discarded.
-                        */
-
-                       /* Flush the Channel data */
-                       _cmux_flush_channel_data(cmux_obj);
-               } else {
-                       /* Encoding frame */
-                       send_data = _cmux_encode_cmux_frame(cmux_obj,
-                                                       NULL, 0, channel_id,
-                                                       CMUX_COMMAND_UA,
-                                                       0x01, 0x01, 0x01, &len);
-                       if (len != 0)
-                               /* Send CMUX data */
-                               ret = _cmux_send_data(cmux_obj->phy_hal, len, send_data);
-                       else
-                               err("Failed to encode");
+                       break;
+               case CMUX_COMMAND_SABM:
+                       dbg("Received SABM Frame");
+                       if (channel->poll_final_bit == 0) {
+                               /*
+                                * In the case where a CMUX_COMMAND_SABM or CMUX_COMMAND_DISC
+                                * command with the P bit set to 0 is received then the received frame
+                                * shall be discarded.
+                                */
 
-                       if (channel->channel_state != CMUX_CHANNEL_ESTABLISHED) {
-                               /* Channel State set to Established */
-                               channel->channel_state =
-                                       CMUX_CHANNEL_ESTABLISHED;
+                               /* Flush the Channel data */
+                               _cmux_flush_channel_data(cmux_obj);
+                       } else {
+                               /* Encoding frame */
+                               send_data = _cmux_encode_cmux_frame(cmux_obj, NULL,
+                                                                               0, channel_id, CMUX_COMMAND_UA,
+                                                                               0x01, 0x01, 0x01, &len);
+                               if (len != 0)
+                                       /* Send CMUX data */
+                                       ret = _cmux_send_data(cmux_obj->phy_hal, len, send_data);
+                               else
+                                       err("Failed to encode");
+
+                               if (channel->channel_state != CMUX_CHANNEL_ESTABLISHED)
+                                       /* Channel State set to Established */
+                                       channel->channel_state = CMUX_CHANNEL_ESTABLISHED;
                        }
-               }
-       break;
+               break;
+               default:
+                       warn("invalid frame_type");
+               break;  
        }
 
        dbg("Exit");
 }
 
-static void _cmux_flush_channel_data(TcoreCmuxObject *cmux_obj)
+static void _cmux_flush_channel_data(tcore_cmux_object *cmux_obj)
 {
-       if (cmux_obj == NULL) {
-               err("cmux_obj is NULL");
+       dbg("Entry");
+
+       if (cmux_obj == NULL)
                return;
-       }
 
        cmux_obj->internal_mux.info_field_len = 0x0;
-       memset(cmux_obj->internal_mux.info_field,
-               0x0, cmux_obj->max_cmux_buf_size);
+       memset(cmux_obj->internal_mux.info_field, 0x0, cmux_obj->max_cmux_buf_size);
+
+       dbg("Exit");
 }
 
-static void _cmux_process_rcv_frame(TcoreCmuxObject *cmux_obj, gint length)
+static void _cmux_process_rcv_frame(tcore_cmux_object *cmux_obj, int length)
 {
-       guchar *frame_process_ptr = cmux_obj->cmux_buffer;
-       guchar *buf_start_ptr = cmux_obj->cmux_buffer;
+       unsigned char *frame_process_ptr = cmux_obj->cmux_buffer;
+       unsigned char *buf_start_ptr = cmux_obj->cmux_buffer;
 
-       TcoreCmuxChannel *ch;
-       guchar channel_id;
-       gint header_length;
+       tcore_cmux_channel *ch;
+       unsigned char channel_id;
+       int header_length;
+       dbg("Entry");
 
        /* Flush channel data */
        _cmux_flush_channel_data(cmux_obj);
@@ -710,16 +707,14 @@ static void _cmux_process_rcv_frame(TcoreCmuxObject *cmux_obj, gint length)
                ch->poll_final_bit = (ch->frame_type & 0x10) >> 4;
 
                /* get the length . TBD */
-               if (*frame_process_ptr & 0x01) {        /* if, len < 127 */
-                       cmux_obj->internal_mux.info_field_len =
-                                       *frame_process_ptr++ >> 1;
+               if (*frame_process_ptr & 0x01) {                        /* if, len < 127 */
+                       cmux_obj->internal_mux.info_field_len = *frame_process_ptr++ >> 1;
                        header_length = 3;
                } else {
+                       cmux_obj->internal_mux.info_field_len = *(frame_process_ptr + 1) << 7;
                        cmux_obj->internal_mux.info_field_len =
-                                       *(frame_process_ptr + 1) << 7;
-                       cmux_obj->internal_mux.info_field_len =
-                                       (cmux_obj->internal_mux.info_field_len
-                                       | ((*frame_process_ptr++ & 0xFE) >> 1));
+                                               (cmux_obj->internal_mux.info_field_len
+                                               | ((*frame_process_ptr++ & 0xFE) >> 1));
                        header_length = 4;
                        frame_process_ptr++;
                }
@@ -729,36 +724,41 @@ static void _cmux_process_rcv_frame(TcoreCmuxObject *cmux_obj, gint length)
                memcpy(cmux_obj->internal_mux.info_field, frame_process_ptr,
                                        cmux_obj->internal_mux.info_field_len);
 
-               frame_process_ptr += cmux_obj->internal_mux.info_field_len;
+               frame_process_ptr = frame_process_ptr + cmux_obj->internal_mux.info_field_len;
 
                /* CRC check of the header */
-               if (_cmux_check_recv_crc((buf_start_ptr + 1),
-                               header_length, *frame_process_ptr)) {
+               if (_cmux_check_recv_crc((buf_start_ptr + 1), header_length, *frame_process_ptr)) {
+                       dbg("Calling _cmux_process_channel_data");
                        _cmux_process_channel_data(cmux_obj, ch);
                } else
                        err("CRC check of the header FAILED.. Drop the packet !!");
        } else
                err("Incorrect channel... Drop the packet !!");
+
+       dbg("Exit");
 }
 
-static TelReturn _cmux_send_data(TcoreHal *hal, gint data_len, guchar *data)
+static TReturn _cmux_send_data(TcoreHal *hal, int data_len, unsigned char *data)
 {
-       TelReturn ret;
+       TReturn ret;
+       dbg("Entry");
 
        /* Directly send to Physical HAL */
        ret = tcore_hal_send_data(hal, data_len, (void *) data);
-       if (ret != TEL_RETURN_SUCCESS) {
+       if (ret != TCORE_RETURN_SUCCESS) {
                err("Failed to send CMUX data");
        } else
                dbg("Successfully sent CMUX data");
 
+       dbg("Exit");
        return ret;
 }
 
-static gboolean _cmux_recv_cmux_data(TcoreCmuxObject *cmux_obj,
-                               TcoreCmuxChannel *channel)
+static gboolean _cmux_recv_cmux_data(tcore_cmux_object *cmux_obj,
+                               tcore_cmux_channel *channel)
 {
        TcoreHal *hal;
+       dbg("Entry");
 
        /* Dereferencing HAL from Channel Pointer */
        hal = channel->hal;
@@ -767,45 +767,48 @@ static gboolean _cmux_recv_cmux_data(TcoreCmuxObject *cmux_obj,
                return FALSE;
        }
 
-       dbg("Dispatching to logical HAL - hal: [0x%x]", (guint)hal);
+       dbg("Dispatching to logical HAL - hal: [0x%x]", (unsigned int)hal);
        if (tcore_hal_dispatch_response_data(hal, 0,
                        cmux_obj->internal_mux.info_field_len,
                        cmux_obj->internal_mux.info_field)
-                       != TEL_RETURN_SUCCESS) {
+                       != TCORE_RETURN_SUCCESS) {
                err("Exit");
                return FALSE;
        }
 
+       dbg("Exit");
        return TRUE;
 }
 
-static TelReturn _cmux_hal_power(TcoreHal *hal, gboolean flag)
+static TReturn _cmux_hal_power(TcoreHal *hal, gboolean flag)
 {
+       dbg("Entry");
+
        if (flag == TRUE) {             /* Powering ON */
                dbg("Powering ON");
                return tcore_hal_set_power_state(hal, TRUE);
-       } else {                                /* Powering OFF */
+       } else {                                        /* Powering OFF */
                dbg("Powering OFF");
                return tcore_hal_set_power_state(hal, FALSE);
        }
 }
 
-static TelReturn _cmux_hal_send(TcoreHal *hal,
-       guint data_len, void *data)
+static TReturn _cmux_hal_send(TcoreHal *hal, unsigned int data_len, void *data)
 {
-       TcoreCmuxObject *cmux_obj;
-       gchar *hal_name;
-       guchar *send_data;
-       gchar *channel_name;
-       guint channel_id;
-       guint len;
-
-       TelReturn ret = TEL_RETURN_FAILURE;
+       tcore_cmux_object *cmux_obj;
+       char *hal_name;
+       unsigned char *send_data;
+       char *channel_name;
+       int channel_id;
+       int len;
+
+       TReturn ret = TCORE_RETURN_FAILURE;
+       dbg("Entry");
 
        /* Check if Logical HAL is Powered ON */
        if (tcore_hal_get_power_state(hal) == FALSE) {
                err("HAL is not Powered UP");
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
        }
 
        /*
@@ -814,7 +817,7 @@ static TelReturn _cmux_hal_send(TcoreHal *hal,
        cmux_obj = _cmux_get_cmux_object(tcore_hal_ref_plugin(hal));
        if (cmux_obj == NULL) {
                err("Failed to find CMUX object");
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
        }
 
        channel_id = cmux_obj->max_cmux_channels + 1;
@@ -823,7 +826,7 @@ static TelReturn _cmux_hal_send(TcoreHal *hal,
        dbg("HAL name: [%s]", channel_name);
 
        if (channel_name != NULL) {
-               guint i;
+               int i;
 
                /*
                 * Channel 0 is dedicated to CMUX Control Channel,
@@ -841,22 +844,21 @@ static TelReturn _cmux_hal_send(TcoreHal *hal,
                         * Comparing all Logical HAL names with required HAL name.
                         */
                        if (strcmp(hal_name, channel_name) == 0) {
-                               channel_id =
-                                       cmux_obj->internal_mux.channel_info[i]->channel_id;
+                               channel_id = cmux_obj->internal_mux.channel_info[i]->channel_id;
                                dbg("Found Channel ID: [%d]", channel_id);
 
                                /* Free HAL name */
-                               tcore_free(hal_name);
+                               g_free(hal_name);
 
                                break;
                        }
 
                        /* Free HAL name */
-                       tcore_free(hal_name);
+                       g_free(hal_name);
                }
 
                /* Free memory */
-               tcore_free(channel_name);
+               g_free(channel_name);
        } else {
                err("No name defined for HAL");
                return ret;
@@ -869,13 +871,11 @@ static TelReturn _cmux_hal_send(TcoreHal *hal,
 
        /* Muxing operation and Frame creation */
        /* Encoding frame */
-       send_data = _cmux_encode_cmux_frame(cmux_obj,
-                               data, data_len, channel_id,
-                               CMUX_COMMAND_UIH,
-                               0x1, 0x1, 0x0, &len);
+       send_data = _cmux_encode_cmux_frame(cmux_obj, data, data_len, channel_id,
+                                       CMUX_COMMAND_UIH, 0x1, 0x1, 0x0, &len);
        if (len == 0) {
                err("Failed to encode");
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
        }
 
        /* Send CMUX data */
@@ -885,11 +885,11 @@ static TelReturn _cmux_hal_send(TcoreHal *hal,
        return ret;
 }
 
-static TelReturn _cmux_hal_setup_netif(CoreObject *co,
-       TcoreHalSetupNetifCallback func, void *user_data,
-       guint cid, gboolean enable)
+static TReturn _cmux_hal_setup_netif(CoreObject *co,
+                               TcoreHalSetupNetifCallback func, void *user_data,
+                               unsigned int cid, gboolean enable)
 {
-       TcoreCmuxObject *cmux_obj;
+       tcore_cmux_object *cmux_obj;
        TcoreHal *hal;
        dbg("Entry");
 
@@ -901,24 +901,24 @@ static TelReturn _cmux_hal_setup_netif(CoreObject *co,
         */
        cmux_obj = _cmux_get_cmux_object(tcore_hal_ref_plugin(hal));
        if (cmux_obj == NULL)
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
 
        return tcore_hal_setup_netif(cmux_obj->phy_hal,
-                       co, func, user_data, cid, enable);
+                                                               co, func, user_data, cid, enable);
 }
 
 /* CMUX supported HAL (Logical HAL) operations */
-static TcoreHalOperations cmux_hops = {
+static struct tcore_hal_operations cmux_hops = {
        .power = _cmux_hal_power,
        .send = _cmux_hal_send,
        .setup_netif = _cmux_hal_setup_netif,
 };
 
-static TcoreHal *_cmux_create_logical_hal(TcoreCmuxObject *cmux_obj,
-       TcoreCmuxChannel *channel)
+static TcoreHal *_cmux_create_logical_hal(tcore_cmux_object *cmux_obj,
+                                                               tcore_cmux_channel *channel)
 {
        TcoreHal *hal;
-       gchar channel_id_name[CMUX_MAX_CHANNEL_NAME];
+       char channel_id_name[CMUX_MAX_CHANNEL_NAME];
        dbg("Entry");
 
        if ((cmux_obj == NULL) || (channel == NULL)) {
@@ -928,12 +928,12 @@ static TcoreHal *_cmux_create_logical_hal(TcoreCmuxObject *cmux_obj,
 
        /* Creating Logical HAL for Core Object - Mode - 'AT mode' */
        snprintf(channel_id_name, sizeof(channel_id_name),
-                       "channel_%d", channel->channel_id);
+                                               "channel_%d", channel->channel_id);
 
        /* Creating Logical HAL */
        hal = tcore_hal_new(cmux_obj->plugin,
-               (const gchar *)channel_id_name, &cmux_hops, TCORE_HAL_MODE_AT);
-       dbg("hal: [%p]", hal);
+                                       channel_id_name, &cmux_hops, TCORE_HAL_MODE_AT);
+       dbg("hal: %p", hal);
        if (hal == NULL) {
                err("Failed to allocate memory");
                return NULL;
@@ -946,14 +946,14 @@ static TcoreHal *_cmux_create_logical_hal(TcoreCmuxObject *cmux_obj,
        return hal;
 }
 
-TcoreCmuxObject *_cmux_new(guint max_channels, guint buffer_size)
+tcore_cmux_object *_cmux_new(int max_channels, unsigned int buffer_size)
 {
-       TcoreCmuxObject *cmux_obj;
-       guint i;
+       tcore_cmux_object *cmux_obj;
+       int i;
        dbg("Entry");
 
        /* Allocating memory for mux */
-       cmux_obj = (TcoreCmuxObject *)tcore_try_malloc0(sizeof(TcoreCmuxObject));
+       cmux_obj = (tcore_cmux_object *)g_try_new0(tcore_cmux_object, 1);
        if (cmux_obj == NULL) {
                err("Failed to allocate memory");
                return NULL;
@@ -961,7 +961,7 @@ TcoreCmuxObject *_cmux_new(guint max_channels, guint buffer_size)
 
        /* Allocating memory for info_field */
        cmux_obj->internal_mux.info_field =
-               (guchar *)tcore_try_malloc0(buffer_size);
+                                       (unsigned char *)g_try_malloc0(buffer_size);
        if (cmux_obj->internal_mux.info_field == NULL) {
                err("Failed to allocate memory for info field");
                goto ERROR;
@@ -978,7 +978,7 @@ TcoreCmuxObject *_cmux_new(guint max_channels, guint buffer_size)
        for (i = 0; i < (max_channels + 1) ; i++) {
                /* Allocating memory for channel_info */
                cmux_obj->internal_mux.channel_info[i] =
-                       (TcoreCmuxChannel *)tcore_try_malloc0(sizeof(TcoreCmuxChannel));
+                               (tcore_cmux_channel *)g_try_new0(tcore_cmux_channel, 1);
                if (cmux_obj->internal_mux.channel_info[i] == NULL) {
                        err("Failed to allocate memory for channel_info of channel: [%d]", i);
                        goto ERROR;
@@ -990,16 +990,25 @@ TcoreCmuxObject *_cmux_new(guint max_channels, guint buffer_size)
 
 ERROR:
        /* Free allocated memory */
-       if (cmux_obj != NULL)
-               _cmux_free(cmux_obj);
+       if (cmux_obj != NULL) {
+               /* Free info_field */
+               g_free(cmux_obj->internal_mux.info_field);
+
+               for (i = 0; i < (max_channels + 1) ; i++)
+                       /* Free channel_info */
+                       g_free(cmux_obj->internal_mux.channel_info[i]);
+
+               /* Free CMUX object memory */
+               g_free(cmux_obj);
+       }
 
        err("Exit");
        return NULL;
 }
 
-static void _cmux_channel_init(TcoreCmuxObject *cmux_obj, gint channel_id)
+static void _cmux_channel_init(tcore_cmux_object *cmux_obj, int channel_id)
 {
-       TcoreCmuxChannel *ch;
+       tcore_cmux_channel *ch;
        dbg("Entry");
 
        ch = cmux_obj->internal_mux.channel_info[channel_id];
@@ -1020,12 +1029,11 @@ static void _cmux_channel_init(TcoreCmuxObject *cmux_obj, gint channel_id)
        dbg("Channel ID [%d] - Initialized", channel_id);
 }
 
-static void _cmux_close_channel(TcoreCmuxObject *cmux_obj, gint channel_id)
+static void _cmux_close_channel(tcore_cmux_object *cmux_obj, int channel_id)
 {
-       TcoreCmuxChannel *ch;
-       guchar *send_data;
-       guint len = 0;
-       TelReturn ret;
+       tcore_cmux_channel *ch;
+       unsigned char *send_data;
+       int ret, len = 0;
        dbg("Entry");
 
        ch = cmux_obj->internal_mux.channel_info[channel_id];
@@ -1040,15 +1048,16 @@ static void _cmux_close_channel(TcoreCmuxObject *cmux_obj, gint channel_id)
 
                /* Send DSC command */
                /* Encoding frame */
-               send_data = _cmux_encode_cmux_frame(cmux_obj,
-                               NULL, 0, channel_id,
-                               CMUX_COMMAND_DISC,
-                               0x01, 0x01, 0x01, &len);
-               if (len != 0)
+               send_data = _cmux_encode_cmux_frame(cmux_obj, NULL, 0, channel_id,
+                                               CMUX_COMMAND_DISC, 0x01, 0x01, 0x01, &len);
+               if (len != 0) {
                        /* Send CMUX data */
                        ret = _cmux_send_data(cmux_obj->phy_hal, len, send_data);
-               else
+            dbg("return %d", ret);
+        }
+               else {
                        err("Failed to encode");
+        }
        } else
                /* Channel is already closed */
                err("Channel is already closed");
@@ -1056,9 +1065,9 @@ static void _cmux_close_channel(TcoreCmuxObject *cmux_obj, gint channel_id)
        dbg("Exit");
 }
 
-static void _cmux_free(TcoreCmuxObject *cmux_obj)
+static void _cmux_free(tcore_cmux_object *cmux_obj)
 {
-       guint channel;
+       int channel;
        dbg("Entry");
 
        /*
@@ -1066,34 +1075,34 @@ static void _cmux_free(TcoreCmuxObject *cmux_obj)
         * is NOT required.
         */
        /* Free Information Field */
-       tcore_free(cmux_obj->internal_mux.info_field);
+       g_free(cmux_obj->internal_mux.info_field);
        cmux_obj->internal_mux.info_field = NULL;
 
        for (channel = 0; channel < cmux_obj->max_cmux_channels; channel++) {
                /* Free Channel Information */
-               tcore_free(cmux_obj->internal_mux.channel_info[channel]);
+               g_free(cmux_obj->internal_mux.channel_info[channel]);
                cmux_obj->internal_mux.channel_info[channel] = NULL;
        }
 
        /* Free CMUX Object */
-       tcore_free(cmux_obj);
+       g_free(cmux_obj);
        cmux_obj = NULL;
 
        dbg("Exit");
 }
 
 static void _cmux_on_confirmation_message_send(TcorePending *plugin,
-                                       TelReturn result, void *user_data)
+                                                                                       gboolean result, void *user_data)
 {
        dbg("Message out from queue");
 
-       if (result == TEL_RETURN_SUCCESS) {     /* Success */
-               dbg("SEND OK");
-       } else
+       if (result == FALSE) {          /* Fail */
                err("SEND FAIL");
+       } else
+               dbg("SEND OK");
 }
 
-void tcore_cmux_rcv_from_hal(TcoreHal *hal, guchar *data, size_t length)
+void tcore_cmux_rcv_from_hal(TcoreHal *hal, unsigned char *data, size_t length)
 {
 #define TCORE_CMUX_DECODE_FLAG_HUNT                    0
 #define TCORE_CMUX_DECODE_ADDR_HUNT                    1
@@ -1103,16 +1112,16 @@ void tcore_cmux_rcv_from_hal(TcoreHal *hal, guchar *data, size_t length)
 #define TCORE_CMUX_DECODE_DATA_HUNT                    5
 #define TCORE_CMUX_DECODE_FCS_HUNT                     6
 
-       TcoreCmuxObject *cmux_obj;
+       tcore_cmux_object *cmux_obj;
 
-       static gint decode_state = TCORE_CMUX_DECODE_FLAG_HUNT;
-       static guchar dec_fcs;
-       static guchar *dec_data;
+       static int decode_state = TCORE_CMUX_DECODE_FLAG_HUNT;
+       static unsigned char dec_fcs;
+       static unsigned char *dec_data;
        static unsigned short dec_length;
        static size_t full_frame_len;
 
        size_t pos = -1;
-       gint cp_len;
+       int cp_len;
        dbg("Entry");
 
        /*
@@ -1126,38 +1135,35 @@ DECODE_STATE_CHANGE:
        if (++pos >= length)
                return;
 
-       switch (decode_state) {
-       case TCORE_CMUX_DECODE_FLAG_HUNT:
-               full_frame_len = 0;
-               dec_length = 0;
-               dec_fcs = 0xFF;
-               dec_data = cmux_obj->cmux_buffer;
-               goto FLAG_HUNT;
-       break;
-
-       case TCORE_CMUX_DECODE_ADDR_HUNT:
-               goto ADDR_HUNT;
-       break;
-
-       case TCORE_CMUX_DECODE_CONTROL_HUNT:
-               goto CONTROL_HUNT;
-       break;
-
-       case TCORE_CMUX_DECODE_LENGTH1_HUNT:
-               goto LENGTH1_HUNT;
-       break;
-
-       case TCORE_CMUX_DECODE_LENGTH2_HUNT:
-               goto LENGTH2_HUNT;
-       break;
-
-       case TCORE_CMUX_DECODE_DATA_HUNT:
-               goto DATA_HUNT;
-       break;
-
-       case TCORE_CMUX_DECODE_FCS_HUNT:
-               goto FCS_HUNT;
-       break;
+       switch(decode_state) {
+               case TCORE_CMUX_DECODE_FLAG_HUNT:
+                       full_frame_len = 0;
+                       dec_length = 0;
+                       dec_fcs = 0xFF;
+                       dec_data = cmux_obj->cmux_buffer;
+                       goto FLAG_HUNT;
+               break;
+               case TCORE_CMUX_DECODE_ADDR_HUNT:
+                       goto ADDR_HUNT;
+               break;
+               case TCORE_CMUX_DECODE_CONTROL_HUNT:
+                       goto CONTROL_HUNT;
+               break;
+               case TCORE_CMUX_DECODE_LENGTH1_HUNT:
+                       goto LENGTH1_HUNT;
+               break;
+               case TCORE_CMUX_DECODE_LENGTH2_HUNT:
+                       goto LENGTH2_HUNT;
+               break;
+               case TCORE_CMUX_DECODE_DATA_HUNT:
+                       goto DATA_HUNT;
+               break;
+               case TCORE_CMUX_DECODE_FCS_HUNT:
+                       goto FCS_HUNT;
+               break;
+               default:
+                       warn("invalid decode_state");
+               break;  
        }
 
 FLAG_HUNT:
@@ -1211,10 +1217,10 @@ LENGTH2_HUNT:
        goto DECODE_STATE_CHANGE;
 
 DATA_HUNT:
-       if (dec_length < (length - pos)) {/* frame data fully available in the buffer */
+       if (dec_length < (length - pos)) {      /* frame data fully available in the buffer */
                cp_len = dec_length;
                decode_state = TCORE_CMUX_DECODE_FCS_HUNT;
-       } else {                /* frame data partially available in the buffer */
+       } else {                                                /* frame data partially available in the buffer */
                cp_len = (length - pos);
                decode_state = TCORE_CMUX_DECODE_DATA_HUNT;
        }
@@ -1239,18 +1245,20 @@ FCS_HUNT:
 }
 
 /* CMUX initialization */
-TelReturn tcore_cmux_init(TcoreHal *phy_hal, guint frame_size,
-       TcorePendingResponseCallback resp_cb, void *resp_cb_data)
+TReturn tcore_cmux_init(TcoreHal *phy_hal, unsigned int frame_size,
+                                       TcorePendingResponseCallback resp_cb, void *resp_cb_data)
 {
        TcorePending *pending = NULL;
-       TcoreAtRequest *req = NULL;
-       gchar *cmd_str;
-       TelReturn ret = TEL_RETURN_FAILURE;
+       TcoreATRequest *req = NULL;
+       TReturn ret = TCORE_RETURN_FAILURE;
+       char *cmd_str;
        dbg("Entry");
 
-       tcore_check_return_value((phy_hal != NULL), TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value((resp_cb != NULL), TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value((frame_size <= 32768), TEL_RETURN_INVALID_PARAMETER);
+       if ((phy_hal == NULL) || (resp_cb == NULL))
+               return TCORE_RETURN_EINVAL;
+
+       if (frame_size > 32768)
+               return TCORE_RETURN_EINVAL;
 
        /*
         * 3GPP 27.010 Section 5.7.2 Maximum Frame Size (N1)
@@ -1266,35 +1274,33 @@ TelReturn tcore_cmux_init(TcoreHal *phy_hal, guint frame_size,
                cmd_str = g_strdup_printf("AT+CMUX=0,0,,1509,10,3,30,,");
 
        if (cmd_str == NULL)
-               return TEL_RETURN_MEMORY_FAILURE;
+               return TCORE_RETURN_ENOMEM;
 
        /* Create Pending Request */
        pending = tcore_pending_new(NULL, 0);
        if (pending == NULL) {
                dbg("Pending is NULL");
 
-               tcore_free(cmd_str);
+               g_free(cmd_str);
                return ret;
        }
 
        /* Create AT-Command Request */
-       req = tcore_at_request_new(cmd_str, "+CMUX:", TCORE_AT_COMMAND_TYPE_NO_RESULT);
+       req = tcore_at_request_new(cmd_str, "+CMUX:", TCORE_AT_NO_RESULT);
 
        /* Free command string */
-       tcore_free(cmd_str);
+       g_free(cmd_str);
 
        if (req == NULL) {
                dbg("Request is NULL");
                tcore_pending_free(pending);
                return ret;
        }
-       dbg("AT Command: [%s], Prefix(if any): [%s], AT-Command length: [%d]",
-               req->cmd, req->prefix, strlen(req->cmd));
+       dbg("AT Command: [%s], Prefix(if any): [%s], AT-Command length: [%d]", req->cmd, req->prefix, strlen(req->cmd));
 
        tcore_pending_set_request_data(pending, 0, req);
        tcore_pending_set_response_callback(pending, resp_cb, resp_cb_data);
-       tcore_pending_set_send_callback(pending,
-               _cmux_on_confirmation_message_send, NULL);
+       tcore_pending_set_send_callback(pending, _cmux_on_confirmation_message_send, NULL);
 
        ret = tcore_hal_send_request(phy_hal, pending);
 
@@ -1303,27 +1309,32 @@ TelReturn tcore_cmux_init(TcoreHal *phy_hal, guint frame_size,
 }
 
 /* Setup Internal CMUX */
-TelReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
-       guint max_channels, guint cmux_buf_size, TcoreHal *phy_hal,
-       CmuxSetupCbFunc channel_setup_cb, gpointer channel_setup_cb_data,
-       CmuxSetupCompleteCbFunc setup_complete_cb, gpointer setup_complete_cb_data)
+TReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
+       int max_channels, unsigned int cmux_buf_size, TcoreHal *phy_hal,
+       cmux_setup_cb_func channel_setup_cb, gpointer channel_setup_user_data,
+       cmux_setup_complete_cb_func setup_complete_cb, gpointer setup_complete_user_data)
 {
-       TcoreCmuxObject *cmux_obj;
-       guchar *data;
-       guint data_len;
-       guint index;
+       tcore_cmux_object *cmux_obj;
+       unsigned char *data;
+       int data_len;
+       int temp_index;
 
-       TelReturn ret = TEL_RETURN_FAILURE;
-       dbg("Entry - Internal CMUX setup request");
+       TReturn ret = TCORE_RETURN_FAILURE;
+       dbg("Entry");
+       dbg("Internal CMUX setup request");
 
        /* Sanity Check */
-       tcore_check_return_value((cmux_buf_size > 0), TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value((phy_hal != NULL), TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value((channel_setup_cb != NULL), TEL_RETURN_INVALID_PARAMETER);
-       tcore_check_return_value((setup_complete_cb != NULL), TEL_RETURN_INVALID_PARAMETER);
+       if ((cmux_buf_size <= 0)
+                       || (phy_hal == NULL)
+                       || (channel_setup_cb == NULL)
+                       || (setup_complete_cb == NULL)) {
+               err("CMUX Buffer size: [%d] Physical HAL: [0x%x] setup_complete_cb: [0x%x]",
+                       cmux_buf_size, (unsigned int)phy_hal, setup_complete_cb);
+               return TCORE_RETURN_EINVAL;
+       }
 
        dbg("Physical HAL: [0x%x] cmux_buf_size: [%d]",
-               (guint)phy_hal, cmux_buf_size);
+                                                               (unsigned int)phy_hal, cmux_buf_size);
 
        /*
         * Max Channels
@@ -1331,14 +1342,14 @@ TelReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
         */
        if ((max_channels +1) >= CMUX_CHANNEL_MAX) {
                err("Number of Channels requested is greater than supported");
-               return TEL_RETURN_INVALID_PARAMETER;
+               return TCORE_RETURN_EINVAL;
        }
 
        /* Create new CMUX Object */
        cmux_obj = _cmux_new(max_channels, cmux_buf_size);
        if (cmux_obj == NULL) {
                err("Failed to create CMUX object");
-               return TEL_RETURN_MEMORY_FAILURE;
+               return TCORE_RETURN_ENOMEM;
        }
 
        /* Maximum Buffer size for CMUX frame processing */
@@ -1348,12 +1359,11 @@ TelReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
        cmux_obj->max_cmux_channels = max_channels + 1;
 
        /* Allocating buffer for CMUX frames proposing */
-       cmux_obj->cmux_buffer =
-               (guchar *)tcore_try_malloc0(cmux_buf_size);
+       cmux_obj->cmux_buffer = (unsigned char *)g_try_malloc0(cmux_buf_size);
        if (cmux_obj->cmux_buffer == NULL) {
                err("Failed to allocate memory");
 
-               ret = TEL_RETURN_MEMORY_FAILURE;
+               ret = TCORE_RETURN_ENOMEM;
                goto ERROR;
        }
 
@@ -1369,11 +1379,11 @@ TelReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
 
        /* CMUX setup callback function */
        cmux_obj->internal_mux.channel_setup_cb = channel_setup_cb;
-       cmux_obj->internal_mux.channel_setup_cb_data = channel_setup_cb_data;
+       cmux_obj->internal_mux.channel_setup_user_data = channel_setup_user_data;
 
        /* CMUX setup complete callback function */
        cmux_obj->internal_mux.setup_complete_cb = setup_complete_cb;
-       cmux_obj->internal_mux.setup_complete_cb_data = setup_complete_cb_data;
+       cmux_obj->internal_mux.setup_complete_user_data = setup_complete_user_data;
 
        /*
         * After CMUX setup, AT parse functionality of PHY HAL should be disabled,
@@ -1387,16 +1397,14 @@ TelReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
 
        /* Initialize all the Channels for the CMUX object */
        /* Open all Channels */
-       for (index = 0; index < cmux_obj->max_cmux_channels; index++) {
-               dbg("Initializing CMUX Channel [%d]", index);
-               _cmux_channel_init(cmux_obj, index);
+       for (temp_index = 0; temp_index < cmux_obj->max_cmux_channels; temp_index++) {
+               dbg("Initializing CMUX Channel [%d]", temp_index);
+               _cmux_channel_init(cmux_obj, temp_index);
 
-               dbg("Opening Channel ID [%d]", index);
+               dbg("Opening Channel ID [%d]", temp_index);
                /* Encode CMUX Frame */
-               data = _cmux_encode_cmux_frame(cmux_obj,
-                                               NULL, 0, index,
-                                               CMUX_COMMAND_SABM,
-                                               0x01, 0x01, 0x01, &data_len);
+               data = _cmux_encode_cmux_frame(cmux_obj, NULL, 0, temp_index,
+                                       CMUX_COMMAND_SABM, 0x01, 0x01, 0x01, &data_len);
                if (data_len == 0) {
                        err("Failed to encode");
                        goto ERROR;
@@ -1405,9 +1413,8 @@ TelReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
 
                /* Send CMUX data */
                ret = _cmux_send_data(cmux_obj->phy_hal, data_len, data);
-               if (ret != TEL_RETURN_SUCCESS) {
-                       err("Failed to send CMUX Control Request for "
-                               "Channel ID: [%d]", index);
+               if (ret != TCORE_RETURN_SUCCESS) {
+                       err("Failed to send CMUX Control Request for Channel ID: [%d]", temp_index);
                        goto ERROR;
                } else
                        dbg("CMUX Control Request sent to CP");
@@ -1426,10 +1433,10 @@ ERROR:
 
 /* Close CMUX */
 void tcore_cmux_close(TcoreHal *phy_hal,
-       CmuxChannelCloseCbFunc channel_close_cb, gpointer channel_close_cb_data)
+       cmux_channel_close_cb_func channel_close_cb, gpointer channel_close_user_data)
 {
-       TcoreCmuxObject *cmux_obj;
-       guint channel_id;
+       tcore_cmux_object *cmux_obj;
+       int channel_id;
        dbg("Entry");
 
        /*
@@ -1453,9 +1460,8 @@ void tcore_cmux_close(TcoreHal *phy_hal,
 
                /* Invoke callback */
                if (channel_close_cb != NULL)
-                       channel_close_cb(
-                               cmux_obj->internal_mux.channel_info[channel_id]->hal,
-                               channel_close_cb_data);
+                       channel_close_cb(cmux_obj->internal_mux.channel_info[channel_id]->hal,
+                                               channel_close_user_data);
 
                /* Free Logical HAL for Channel */
                tcore_hal_free(cmux_obj->internal_mux.channel_info[channel_id]->hal);
@@ -1463,7 +1469,7 @@ void tcore_cmux_close(TcoreHal *phy_hal,
        }
 
        /* Freeing CMUX frame processing buffer */
-       tcore_free(cmux_obj->cmux_buffer);
+       g_free(cmux_obj->cmux_buffer);
        cmux_obj->cmux_buffer = NULL;
 
        /* Change the mode of PHYSICAL HAL from Transparent to AT */
index 92ee740..ece65b7 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * 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.
@@ -33,7 +32,7 @@
 #include "server.h"
 
 struct tcore_plugin_type {
-       gchar *filename;
+       char *filename;
        const struct tcore_plugin_define_desc *desc;
        void *handle;
 
@@ -45,190 +44,189 @@ struct tcore_plugin_type {
        Server *parent_server;
 };
 
-typedef struct {
-       TcoreResponseCallback resp_cb;
-       void *resp_cbdata;
-       void *user_data;
-} TcorePluginRespData;
-
 TcorePlugin *tcore_plugin_new(Server *server,
-       const struct tcore_plugin_define_desc *desc,
-       const gchar *filename, void *handle)
+               const struct tcore_plugin_define_desc *desc,
+               const char *filename, void *handle)
 {
        TcorePlugin *p;
 
-       p = g_try_new0(struct tcore_plugin_type, 1);
-       if (p == NULL) {
-               err("plugin is NULL");
+       p = calloc(1, sizeof(struct tcore_plugin_type));
+       if (!p)
                return NULL;
-       }
 
-       /*
-        * Assign 'filename' name irrespective of if it is NULL,
-        * g_strdup would take care of this scenario.
-        */
-       p->filename = tcore_strdup(filename);
+       if (filename)
+               p->filename = strdup(filename);
 
        p->desc = desc;
        p->property = g_hash_table_new(g_str_hash, g_str_equal);
        p->handle = handle;
        p->parent_server = server;
 
-       dbg("Plug-in '%s' created", p->filename);
-
        return p;
 }
 
 void tcore_plugin_free(TcorePlugin *plugin)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       GSList *list;
+       CoreObject *o;
+
+       if (!plugin)
                return;
-       }
 
-       dbg("Plug-in '%s' freeing", plugin->filename);
+       dbg("");
 
-       /* Free resources */
-       g_slist_free_full(plugin->list_co, (GDestroyNotify)tcore_object_free);
-       tcore_free(plugin->filename);
-       g_hash_table_destroy(plugin->property);
+       if (plugin->list_co) {
+               for (list = plugin->list_co; list; list = list->next) {
+                       o = list->data;
+                       if (!o)
+                               continue;
 
-       if (plugin->handle)
-               dlclose(plugin->handle);
+                       tcore_object_free(o);
+                       list->data = NULL;
+               }
+
+               g_slist_free(plugin->list_co);
+               plugin->list_co = NULL;
+       }
+
+       if (plugin->filename) {
+               free(plugin->filename);
+               plugin->filename = NULL;
+       }
+
+       if (plugin->property) {
+               g_hash_table_destroy(plugin->property);
+               plugin->property = NULL;
+       }
 
        plugin->desc = NULL;
 
-       tcore_free(plugin);
+       if (plugin->handle) {
+               dlclose(plugin->handle);
+               plugin->handle = NULL;
+       }
+
+       free(plugin);
 }
 
 const struct tcore_plugin_define_desc *tcore_plugin_get_description(TcorePlugin *plugin)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       if (!plugin)
                return NULL;
-       }
 
        return plugin->desc;
 }
 
-gchar *tcore_plugin_get_filename(TcorePlugin *plugin)
+char *tcore_plugin_get_filename(TcorePlugin *plugin)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       if (!plugin)
                return NULL;
-       }
 
-       /*
-        * Return copy of 'filename',
-        *
-        * it CAN even be NULL if plugin->filename is NULL,
-        * g_strdup will take care of this scenario.
-        */
-       return tcore_strdup(plugin->filename);
+       if (!plugin->filename)
+               return NULL;
+
+       return strdup(plugin->filename);
 }
 
-const gchar *tcore_plugin_ref_plugin_name(TcorePlugin *plugin)
+const char* tcore_plugin_ref_plugin_name(TcorePlugin *plugin)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       if (!plugin)
                return NULL;
-       }
 
-       if (plugin->desc == NULL) {
-               err("desc is NULL");
+       if (!plugin->desc->name)
                return NULL;
-       }
 
        return plugin->desc->name;
 }
 
 Server *tcore_plugin_ref_server(TcorePlugin *plugin)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       if (!plugin)
                return NULL;
-       }
 
        return plugin->parent_server;
 }
 
-TelReturn tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data)
+TReturn tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!plugin)
+               return TCORE_RETURN_EINVAL;
 
        plugin->user_data = user_data;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 void *tcore_plugin_ref_user_data(TcorePlugin *plugin)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
-               return FALSE;
-       };
+       if (!plugin)
+               return NULL;
 
        return plugin->user_data;
 }
 
-TelReturn tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co)
+TReturn tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co)
 {
-       if ((plugin == NULL) || (co == NULL)) {
-               err("plugin: [%p] co: [%p]", plugin, co);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!plugin || !co)
+               return TCORE_RETURN_EINVAL;
+
+       dbg("add core_object! (name=%s)", tcore_object_ref_name(co));
 
-       /* Core Object is prepended to the Core Object list */
        plugin->list_co = g_slist_insert(plugin->list_co, co, 0);
-       dbg("Core Object (Type: [0x%x]) added!", tcore_object_get_type(co));
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_plugin_remove_core_object(TcorePlugin *plugin, CoreObject *co)
+TReturn tcore_plugin_remove_core_object(TcorePlugin *plugin, CoreObject *co)
 {
-       if ((plugin == NULL) || (co == NULL)) {
-               err("plugin: [%p] co: [%p]", plugin, co);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!plugin || !co)
+               return TCORE_RETURN_EINVAL;
+
+       dbg("remove core_object! (name=%s)", tcore_object_ref_name(co));
 
        plugin->list_co = g_slist_remove(plugin->list_co, co);
-       dbg("Core Object (Type: [0x%x]) added!", tcore_object_get_type(co));
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-GSList *tcore_plugin_ref_core_objects(TcorePlugin *plugin)
+CoreObject *tcore_plugin_ref_core_object(TcorePlugin *plugin, unsigned int type)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       GSList *list;
+       CoreObject *co;
+
+       if (!plugin)
                return NULL;
+
+       for (list = plugin->list_co; list; list = list->next) {
+               co = list->data;
+               if (!co)
+                       continue;
+
+               if (tcore_object_get_type(co) == type) {
+                       return co;
+               }
        }
 
-       return plugin->list_co;
+       return NULL;
 }
 
-CoreObject *tcore_plugin_ref_core_object(TcorePlugin *plugin, unsigned int type)
+GSList *tcore_plugin_get_core_objects(TcorePlugin *plugin)
 {
-       GSList *list;
+       GSList *list, *rlist = NULL;
        CoreObject *co;
 
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       if (!plugin)
                return NULL;
-       }
 
        for (list = plugin->list_co; list; list = list->next) {
                co = list->data;
-               if (co != NULL)
-                       if (tcore_object_get_type(co) == type)
-                               return co;
+               if (!co)
+                       continue;
+
+               rlist = g_slist_append(rlist, co);
        }
 
-       return NULL;
+       return rlist;
 }
 
 GSList *tcore_plugin_get_core_objects_bytype(TcorePlugin *plugin, unsigned int type)
@@ -236,235 +234,71 @@ GSList *tcore_plugin_get_core_objects_bytype(TcorePlugin *plugin, unsigned int t
        GSList *list, *rlist = NULL;
        CoreObject *co;
 
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       if (!plugin)
                return NULL;
-       }
 
        for (list = plugin->list_co; list; list = list->next) {
                co = list->data;
-               if (co != NULL) {
-                       /* Generate list of Core Object of similar type */
-                       if (tcore_object_get_type(co) == type)
-                               rlist = g_slist_append(rlist, co);
-               }
+               if (!co)
+                       continue;
+
+               if ((CORE_OBJECT_TYPE_DEFAULT |(tcore_object_get_type(co) & 0x0FF00000)) == type)
+                       rlist = g_slist_append(rlist, co);
        }
 
        return rlist;
 }
 
-TelReturn tcore_plugin_core_object_event_emit(TcorePlugin *plugin,
-               const gchar *event, const void *event_info)
+TReturn tcore_plugin_core_object_event_emit(TcorePlugin *plugin, const char *event, const void *event_info)
 {
        GSList *list;
        CoreObject *co;
 
-       if (plugin == NULL) {
-               err("plugin is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!plugin)
+               return TCORE_RETURN_EINVAL;
+
+       dbg("event(%s) emit", event);
 
-       dbg("Emitting '%s' event!!!", event);
        for (list = plugin->list_co; list; list = list->next) {
                co = list->data;
-               if (co != NULL)
-                       tcore_object_emit_callback(co, event, event_info);
+               if (!co)
+                       continue;
+
+               tcore_object_emit_callback(co, event, event_info);
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_plugin_link_property(TcorePlugin *plugin, const gchar *key, void *data)
+TReturn tcore_plugin_link_property(TcorePlugin *plugin, const char *key, void *data)
 {
        void *prev;
 
-       if (plugin == NULL) {
-               err("plugin is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!plugin)
+               return TCORE_RETURN_EINVAL;
 
-       if (plugin->property == NULL) {
-               err("property is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!plugin->property)
+               return TCORE_RETURN_EINVAL;
 
        prev = g_hash_table_lookup(plugin->property, key);
        if (prev != NULL) {
-               tcore_free(prev);
+               free(prev);
                g_hash_table_replace(plugin->property, (gpointer)key, data);
        }
        else {
-               g_hash_table_insert(plugin->property, tcore_strdup(key), data);
+               g_hash_table_insert(plugin->property, strdup(key), data);
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-void *tcore_plugin_ref_property(TcorePlugin *plugin, const gchar *key)
+void *tcore_plugin_ref_property(TcorePlugin *plugin, const char *key)
 {
-       if (plugin == NULL) {
-               err("plugin is NULL");
+       if (!plugin)
                return NULL;
-       };
 
-       if (plugin->property == NULL) {
-               err("property is NULL");
+       if (!plugin->property)
                return NULL;
-       }
 
        return g_hash_table_lookup(plugin->property, key);
 }
-
-TelReturn tcore_plugin_add_request_hook(TcorePlugin *plugin,
-       TcoreCommand command, TcoreRequestHook func, void *user_data)
-{
-       CoreObject *co;
-
-       if ((plugin == NULL) || (func == NULL)) {
-               err("plugin: [%p] func: [%p]", plugin, func);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       co = tcore_plugin_ref_core_object(plugin, GET_OBJECT_TYPE(command));
-       if (co == NULL) {
-               err("co is NULL");
-               return TEL_RETURN_FAILURE;
-       }
-
-       return tcore_object_add_request_hook(co, command, func, user_data);
-}
-
-void tcore_plugin_remove_request_hook(TcorePlugin *plugin,
-       TcoreCommand command, TcoreRequestHook func)
-{
-       CoreObject *co;
-
-       if ((plugin == NULL) || (func == NULL)) {
-               err("plugin: [%p] func: [%p]", plugin, func);
-               return;
-       }
-
-       co = tcore_plugin_ref_core_object(plugin, GET_OBJECT_TYPE(command));
-       if (co == NULL) {
-               err("co is NULL");
-               return;
-       }
-
-       return tcore_object_remove_request_hook(co, command, func);
-}
-
-TelReturn tcore_plugin_add_notification_hook(TcorePlugin *plugin,
-       TcoreNotification command, TcoreNotificationHook func, void *user_data)
-{
-       CoreObject *co;
-
-       if ((plugin == NULL) || (func == NULL)) {
-               err("plugin: [%p] func: [%p]", plugin, func);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       co = tcore_plugin_ref_core_object(plugin, GET_OBJECT_TYPE(command));
-       if (co == NULL) {
-               err("co [0x%x] is NULL", GET_OBJECT_TYPE(command));
-               return TEL_RETURN_FAILURE;
-       }
-
-       return tcore_object_add_notification_hook(co, command, func, user_data);
-}
-
-void tcore_plugin_remove_notification_hook(TcorePlugin *plugin,
-       TcoreNotification command, TcoreNotificationHook func)
-{
-       CoreObject *co;
-
-       if ((plugin == NULL) || (func == NULL)) {
-               err("plugin: [%p] func: [%p]", plugin, func);
-               return;
-       }
-
-       co = tcore_plugin_ref_core_object(plugin, GET_OBJECT_TYPE(command));
-       if (co == NULL) {
-               err("co [0x%x] is NULL", GET_OBJECT_TYPE(command));
-               return;
-       }
-
-       return tcore_object_remove_notification_hook(co, command, func);
-}
-
-
-/* TODO - Need to move the static function and rename accordingly */
-static void tcore_plugin_response_callback(TcorePlugin *plugin,
-       gint result, const void *response, void *user_data)
-{
-       TcorePluginRespData *resp_cb_data = (TcorePluginRespData *)user_data;
-
-       if (resp_cb_data == NULL) {
-               err("Response Callback data is NULL");
-               return;
-       }
-
-       /* Invoke response callback */
-       if (resp_cb_data->resp_cb)
-               resp_cb_data->resp_cb(result, response, resp_cb_data->resp_cbdata);
-
-       /* Free resource */
-       tcore_free(resp_cb_data);
-}
-
-TelReturn tcore_plugin_dispatch_request(TcorePlugin *plugin,
-               gboolean exec_hooks, TcoreCommand command,
-               const void *request, guint request_len,
-               TcoreResponseCallback cb, const void *user_data)
-{
-       CoreObject *co;
-       TcorePluginRespData *resp_cb_data;
-       TelReturn ret;
-
-       if (plugin == NULL) {
-               err("plugin is NULL");
-               return TEL_RETURN_FAILURE;
-       }
-
-       co = tcore_plugin_ref_core_object(plugin, GET_OBJECT_TYPE(command));
-       if (co == NULL) {
-               err("co is NULL");
-               return TEL_RETURN_FAILURE;
-       }
-
-       resp_cb_data = tcore_try_malloc0(sizeof(TcorePluginRespData));
-       if (resp_cb_data == NULL) {
-               err("Failed to allocate memory");
-               return TEL_RETURN_FAILURE;
-       }
-
-       resp_cb_data->resp_cb = cb;
-       resp_cb_data->resp_cbdata = (void *)user_data;
-
-       /* Dispatch Request to Core Object */
-       ret = tcore_object_dispatch_request(co, exec_hooks, command,
-               request, request_len, tcore_plugin_response_callback, (void *)resp_cb_data);
-       if (ret != TEL_RETURN_SUCCESS) {
-               err("Failed to dispatch request!!!");
-
-               /* Free resource */
-               tcore_free(resp_cb_data);
-       }
-
-       return ret;
-}
-
-TelReturn tcore_plugin_send_notification(TcorePlugin *plugin,
-       TcoreNotification command, guint data_len, void *data)
-{
-       Server *s;
-
-       if (plugin == NULL) {
-               err("plugin is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       s = tcore_plugin_ref_server(plugin);
-
-       /* Dispatch the Notification to Server */
-       return tcore_server_send_notification(s, plugin, command, data_len, data);
-}
index 21ab861..0f115b5 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "plugin.h"
 #include "queue.h"
 #include "hal.h"
+#include "user_request.h"
 #include "core_object.h"
 
 
 struct tcore_queue_type {
        TcoreHal *hal;
        GQueue *gq;
-       guint next_id;
+       unsigned int next_id;
 };
 
 struct tcore_pending_type {
-       guint id;               /**< Unique ID: to Identify the Pending Request */
+       unsigned int id;
 
-       TcorePendingPriority priority;  /**< Prority */
-       gboolean enable;
+       TcorePendingSendCallback on_send;
+       void *on_send_user_data;
+       TcorePendingTimeoutCallback on_timeout;
+       void *on_timeout_user_data;
+       TcorePendingResponseCallback on_response;
+       void *on_response_user_data;
 
-       /**< Request data */
+       enum tcore_pending_priority priority;
        void *data;
-       guint data_len;
+       unsigned int data_len;
 
-       /**< Flags */
-       gboolean flag_sent;     /**< Sent: Request sent to modem */
-       gboolean flag_received_response;        /**< Received response: Response received from modem */
-       gboolean flag_auto_free_after_sent;     /**< Auto free: Not expecting Response */
+       gboolean enable;
+       unsigned int timeout;
+       time_t timestamp;
+       gboolean flag_sent;
+       gboolean flag_received_response;
+       gboolean flag_auto_free_after_sent;
 
-       /**< Abortable Request */
-       gboolean abortable;
+       guint timer_src;
 
-       /**< Essential references */
-       void *request;
+       UserRequest *ur;
        TcorePlugin *plugin;
        CoreObject *co;
        TcoreQueue *queue;
-
-       /**< Timeout parameters */
-       guint timer_src;        /**< Timer */
-       time_t timestamp;       /**< Time stamp of request*/
-       guint timeout;  /**< Timeout value*/
-
-       /* Callbacks */
-       TcorePendingSendCallback on_send;       /**< On send */
-       void *on_send_user_data;
-       TcorePendingResponseCallback on_response;       /**< On response */
-       void *on_response_user_data;
-       TcorePendingTimeoutCallback on_timeout; /**< On timeout */
-       void *on_timeout_user_data;
 };
 
-typedef enum {
+enum search_field {
        SEARCH_FIELD_ID_ALL = 0x01,
        SEARCH_FIELD_ID_WAIT = 0x11,
        SEARCH_FIELD_ID_SENT = 0x21,
        SEARCH_FIELD_COMMAND_ALL = 0x02,
        SEARCH_FIELD_COMMAND_WAIT = 0x12,
-       SEARCH_FIELD_COMMAND_SENT = 0x22
-} TcoreSearchField;
+       SEARCH_FIELD_COMMAND_SENT = 0x22,
+};
 
-static gboolean __on_pending_timeout(gpointer user_data)
+static gboolean _on_pending_timeout(gpointer user_data)
 {
-       TcorePending *pending = user_data;
+       TcorePending *p = user_data;
 
-       dbg("'pending' timeout!!!");
+       dbg("pending timeout!!");
 
-       if (pending == NULL) {
-               err("pending is NULL");
+       if (!p)
                return FALSE;
-       }
 
-       /* Emit timeout callback */
-       tcore_pending_emit_timeout_callback(pending);
+       tcore_pending_emit_timeout_callback(p);
 
-       pending->on_response = NULL;
-       tcore_hal_dispatch_response_data(pending->queue->hal, pending->id, 0, NULL);
+       p->on_response = NULL;
+       tcore_hal_free_timeout_pending_request(p->queue->hal, p, 0, NULL);
 
        return FALSE;
 }
 
-static void __queue_push_head(TcoreQueue *queue, TcorePending *pending)
-{
-       guint i = 0;
-       TcorePending *tmp;
-
-       do {
-               tmp = g_queue_peek_nth(queue->gq, i);
-
-               /*
-                * Either NO nodes in the list or all prior nodes were of
-                * IMMEDIATE priority
-                */
-               if (tmp == NULL)
-                       break;
-
-               /*
-                * Push to head unless HEAD is not of IMMEDIATE priority
-                */
-               if (tmp->priority != TCORE_PENDING_PRIORITY_IMMEDIATELY)
-                       break;
-
-               i++;
-       } while (1);
-
-       g_queue_push_nth(queue->gq, pending, i);
-}
-
-static TcorePending *__queue_search_full(TcoreQueue *queue, guint id,
-       TcoreCommand command, TcoreSearchField field, gboolean flag_pop)
-{
-       TcorePending *pending = NULL;
-       guint i = 0;
-
-       if (queue == NULL) {
-               err("queue is NULL");
-               return NULL;
-       }
-
-       do {
-               pending = g_queue_peek_nth(queue->gq, i);
-               if (pending == NULL) {
-                       err("pending is NULL");
-                       return NULL;
-               }
-
-               if ((field & 0xF0) == 0x10) {
-                       /* search option is wait pending */
-                       if (pending->flag_sent) {
-                               i++;
-                               continue;
-                       }
-               }
-               else if ((field & 0xF0) == 0x20) {
-                       /* search option is sent pending */
-                       if (pending->flag_sent == FALSE) {
-                               i++;
-                               continue;
-                       }
-               }
-
-               if ((field & 0x0F) == SEARCH_FIELD_ID_ALL) {
-                       if (pending->id == id) {
-                               if (flag_pop == TRUE)
-                                       pending = g_queue_pop_nth(queue->gq, i);
-
-                               break;
-                       }
-               }
-#if 0
-               else if ((field & 0x0F) == SEARCH_FIELD_COMMAND_ALL) {
-                       ur = tcore_pending_ref_request(pending);
-                       if (tcore_user_request_get_command(ur) == command) {
-                               if (flag_pop == TRUE)
-                                       pending = g_queue_pop_nth(queue->gq, i);
-
-                               break;
-                       }
-               }
-#endif
-               i++;
-       } while (pending != NULL);
-
-       return pending;
-}
-
-TcorePending *tcore_pending_new(CoreObject *co, guint id)
+TcorePending *tcore_pending_new(CoreObject *co, unsigned int id)
 {
-       TcorePending *pending;
+       TcorePending *p;
 
-       /* Create 'pending' */
-       pending = g_try_new0(struct tcore_pending_type, 1);
-       if (pending == NULL) {
-               err("pending is NULL");
+       p = calloc(1, sizeof(struct tcore_pending_type));
+       if (!p)
                return NULL;
-       }
-
-       /*
-        * Initialize parameters
-        *
-        * By default others are initialized to '0' or NULL.
-        */
-       pending->id = id;
-       pending->priority = TCORE_PENDING_PRIORITY_DEFAULT;
 
-       time(&pending->timestamp);
+       p->id = id;
+       time(&p->timestamp);
 
-       pending->co = co;
-       pending->plugin = tcore_object_ref_plugin(co);
+       p->on_send = NULL;
+       p->on_send_user_data = NULL;
+       p->on_response = NULL;
+       p->on_response_user_data = NULL;
+       p->on_timeout = NULL;
+       p->on_timeout_user_data = NULL;
+       p->data = NULL;
+       p->data_len = 0;
+       p->timeout = 0;
+       p->priority = TCORE_PENDING_PRIORITY_DEFAULT;
+       p->flag_sent = FALSE;
+       p->co = co;
+       p->plugin = tcore_object_ref_plugin(co);
 
-       return pending;
+       return p;
 }
 
 void tcore_pending_free(TcorePending *pending)
 {
-       TcoreHalMode hal_mode;
-
-       if (pending == NULL) {
-               err("pending is NULL");
+       if (!pending)
                return;
-       }
 
-       dbg("Freeing - pending: [%p] ID: [0x%x]", (guint)pending, pending->id);
+       dbg("pending(0x%x) free, id=0x%x", (unsigned int)pending, pending->id);
 
-       hal_mode = tcore_hal_get_mode(pending->queue->hal);
-       if ((hal_mode != TCORE_HAL_MODE_AT)
-                       && (hal_mode != TCORE_HAL_MODE_TRANSPARENT)) {
-               if (pending->data)
-                       tcore_free(pending->data);
+       if (pending->queue) {
+               enum tcore_hal_mode mode = tcore_hal_get_mode(pending->queue->hal);
+               if ((mode != TCORE_HAL_MODE_AT)
+                               && (mode != TCORE_HAL_MODE_TRANSPARENT))
+                       if (pending->data)
+                               free(pending->data);
        }
 
-       if (pending->timer_src)
+       if (pending->timer_src) {
                g_source_remove(pending->timer_src);
+       }
 
-       tcore_free(pending);
+       free(pending);
 }
 
-guint tcore_pending_get_id(TcorePending *pending)
+unsigned int tcore_pending_get_id(TcorePending *pending)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
+       if (!pending)
                return 0;
-       }
 
        return pending->id;
 }
 
-TelReturn tcore_pending_set_auto_free_status_after_sent(TcorePending *pending,
+TReturn tcore_pending_set_auto_free_status_after_sent(TcorePending *pending,
                gboolean flag)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        pending->flag_auto_free_after_sent = flag;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 gboolean tcore_pending_get_auto_free_status_after_sent(TcorePending *pending)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
+       if (!pending)
                return FALSE;
-       }
 
        return pending->flag_auto_free_after_sent;
 }
 
-TelReturn tcore_pending_set_abortable(TcorePending *pending,
-       gboolean abortable)
-{
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       pending->abortable = abortable;
-
-       return TEL_RETURN_SUCCESS;
-}
-
-gboolean tcore_pending_get_abortable(TcorePending *pending)
-{
-       if (pending == NULL) {
-               err("pending is NULL");
-               return FALSE;
-       }
-
-       return pending->abortable;
-}
-
-TelReturn tcore_pending_set_request_data(TcorePending *pending,
-               guint data_len, void *data)
+TReturn tcore_pending_set_request_data(TcorePending *pending,
+               unsigned int data_len, void *data)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        if (pending->data) {
                if (pending->data_len != 0) {
-                       tcore_free(pending->data);
+                       free(pending->data);
                        pending->data = NULL;
-                       pending->data_len = 0;
                }
        }
 
        pending->data_len = data_len;
-       if (data_len > 0)
-               pending->data = tcore_memdup((gconstpointer)data, data_len);
-       else
+       if (pending->data_len > 0) {
+               pending->data = calloc(data_len, 1);
+               if (!pending->data)
+                       return TCORE_RETURN_ENOMEM;
+
+               memcpy(pending->data, data, data_len);
+       }
+       else {
                pending->data = data;
+       }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-void *tcore_pending_ref_request_data(TcorePending *pending, guint *data_len)
+void *tcore_pending_ref_request_data(TcorePending *pending, unsigned int *data_len)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
+       if (!pending)
                return NULL;
-       }
 
        if (data_len)
                *data_len = pending->data_len;
@@ -336,213 +212,187 @@ void *tcore_pending_ref_request_data(TcorePending *pending, guint *data_len)
        return pending->data;
 }
 
-TelReturn tcore_pending_set_priority(TcorePending *pending, TcorePendingPriority priority)
+TReturn tcore_pending_set_priority(TcorePending *pending,
+               enum tcore_pending_priority priority)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        pending->priority = priority;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_get_priority(TcorePending *pending, TcorePendingPriority *priority)
+TReturn tcore_pending_get_priority(TcorePending *pending,
+               enum tcore_pending_priority *result_priority)
 {
-       if ((pending == NULL) || (priority == NULL)) {
-               err("pending: [%p] priority: [%p]", pending, priority);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending || !result_priority)
+               return TCORE_RETURN_EINVAL;
 
-       *priority = pending->priority;
+       *result_priority = pending->priority;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_set_timeout(TcorePending *pending, guint timeout)
+TReturn tcore_pending_start_timer(TcorePending *pending)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
+       /* pending timer */
+       if (pending->timeout > 0 && pending->on_timeout) {
+               dbg("start pending timer! (%d secs)", pending->timeout);
+               pending->timer_src = g_timeout_add_seconds(pending->timeout, _on_pending_timeout, pending);
        }
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_pending_set_timeout(TcorePending *pending, unsigned int timeout)
+{
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        pending->timeout = timeout;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_get_send_status(TcorePending *pending, gboolean *status)
+unsigned int  tcore_pending_get_timeout(TcorePending *pending)
 {
-       if ((pending == NULL) || (status == NULL)) {
-               err("pending: [%p] status: [%p]", pending, status);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return 0;
+
+       return pending->timeout;
+}
+
+TReturn tcore_pending_get_send_status(TcorePending *pending,
+               gboolean *result_status)
+{
+       if (!pending || !result_status)
+               return TCORE_RETURN_EINVAL;
 
-       *status = pending->flag_sent;
+       *result_status = pending->flag_sent;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_set_send_callback(TcorePending *pending,
+TReturn tcore_pending_set_send_callback(TcorePending *pending,
                TcorePendingSendCallback func, void *user_data)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        pending->on_send = func;
        pending->on_send_user_data = user_data;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_set_timeout_callback(TcorePending *pending,
+TReturn tcore_pending_set_timeout_callback(TcorePending *pending,
                TcorePendingTimeoutCallback func, void *user_data)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        pending->on_timeout = func;
        pending->on_timeout_user_data = user_data;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_set_response_callback(TcorePending *pending,
+TReturn tcore_pending_set_response_callback(TcorePending *pending,
                TcorePendingResponseCallback func, void *user_data)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        pending->on_response = func;
        pending->on_response_user_data = user_data;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_emit_send_callback(TcorePending *pending,
-       TelReturn send_status)
+TReturn tcore_pending_emit_send_callback(TcorePending *pending, gboolean result)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        pending->flag_sent = TRUE;
 
-       if (pending->on_send) {
-               pending->on_send(pending,
-                       send_status, pending->on_send_user_data);
-       }
-
-       if (send_status == TEL_RETURN_SUCCESS) {
-               if (pending->flag_auto_free_after_sent == FALSE
-                               && pending->timeout > 0) {
-                       /* timer */
-                       dbg("Start pending timer!!! [Timeout: %d secs]",
-                               pending->timeout);
-                       pending->timer_src =
-                               g_timeout_add_seconds(pending->timeout,
-                                       __on_pending_timeout, pending);
-               }
-       }
+       if (pending->on_send)
+               pending->on_send(pending, result, pending->on_send_user_data);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_emit_timeout_callback(TcorePending *pending)
+TReturn tcore_pending_emit_timeout_callback(TcorePending *pending)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        if (pending->on_timeout)
                pending->on_timeout(pending, pending->on_timeout_user_data);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_pending_emit_response_callback(TcorePending *pending,
-               guint data_len, const void *data)
+TReturn tcore_pending_emit_response_callback(TcorePending *pending,
+               int data_len, const void *data)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
        if (pending->on_response)
-               pending->on_response(pending,
-                       data_len, data, pending->on_response_user_data);
+               pending->on_response(pending, data_len, data,
+                               pending->on_response_user_data);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 CoreObject *tcore_pending_ref_core_object(TcorePending *pending)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
+       if (!pending)
                return NULL;
-       }
 
        return pending->co;
 }
 
 TcorePlugin *tcore_pending_ref_plugin(TcorePending *pending)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
+       if (!pending)
                return NULL;
-       }
 
        return pending->plugin;
 }
 
-TelReturn tcore_pending_link_request(TcorePending *pending, void *request)
+TReturn tcore_pending_link_user_request(TcorePending *pending, UserRequest *ur)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!pending)
+               return TCORE_RETURN_EINVAL;
 
-       pending->request = request;
+       pending->ur = ur;
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-void *tcore_pending_ref_request(TcorePending *pending)
+UserRequest *tcore_pending_ref_user_request(TcorePending *pending)
 {
-       if (pending == NULL) {
-               err("pending is NULL");
+       if (!pending)
                return NULL;
-       }
 
-       return pending->request;
+       return pending->ur;
 }
 
 TcoreQueue *tcore_queue_new(TcoreHal *h)
 {
        TcoreQueue *queue;
 
-       queue = g_try_new0(struct tcore_queue_type, 1);
-       if (queue == NULL) {
-               err("Failed to allocate memory");
+       queue = calloc(1, sizeof(struct tcore_queue_type));
+       if (!queue)
                return FALSE;
-       }
 
        queue->hal = h;
 
        queue->gq = g_queue_new();
-       if (queue->gq == NULL) {
-               err("Failed to create Queue");
-
-               tcore_free(queue);
+       if (!queue->gq) {
+               free(queue);
                return FALSE;
        }
 
@@ -553,121 +403,108 @@ TcoreQueue *tcore_queue_new(TcoreHal *h)
 
 void tcore_queue_free(TcoreQueue *queue)
 {
-       if (queue == NULL) {
-               err("pending is NULL");
+       if (!queue)
                return;
-       }
 
-       /* Free resources */
-       g_queue_free(queue->gq);
-       tcore_free(queue);
+       if (queue->gq)
+               g_queue_free(queue->gq);
+
+       free(queue);
 }
 
-TelReturn tcore_queue_push(TcoreQueue *queue, TcorePending *pending)
+static void _tcore_queue_push_head(TcoreQueue *queue, TcorePending *pending)
 {
-       if ((queue == NULL) || (pending == NULL)) {
-               err("queue: [%p] pending: [%p]", queue, pending);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       int i = -1;
+       TcorePending *tmp;
+
+       do {
+               i++;
+               tmp = g_queue_peek_nth(queue->gq, i);
+               if (!tmp) {
+                       break;
+               }
+
+               if (tmp->priority == TCORE_PENDING_PRIORITY_IMMEDIATELY)
+                       continue;
+
+               break;
+       } while (1);
+
+       g_queue_push_nth(queue->gq, pending, i);
+}
+
+TReturn tcore_queue_push(TcoreQueue *queue, TcorePending *pending)
+{
+       enum tcore_pending_priority priority;
+
+       if (!queue || !pending)
+               return TCORE_RETURN_EINVAL;
 
        if (pending->id == 0) {
                pending->id = queue->next_id;
                queue->next_id++;
        }
 
-       switch (pending->priority) {
-       case TCORE_PENDING_PRIORITY_IMMEDIATELY:
-       case TCORE_PENDING_PRIORITY_HIGH:
-               __queue_push_head(queue, pending);
-       break;
+       tcore_pending_get_priority(pending, &priority);
+       switch (priority) {
+               case TCORE_PENDING_PRIORITY_IMMEDIATELY:
+               case TCORE_PENDING_PRIORITY_HIGH:
+                       pending->queue = queue;
+                       _tcore_queue_push_head(queue, pending);
+                       break;
 
-       case TCORE_PENDING_PRIORITY_DEFAULT:
-       case TCORE_PENDING_PRIORITY_LOW:
-               g_queue_push_tail(queue->gq, pending);
-       break;
+               case TCORE_PENDING_PRIORITY_DEFAULT:
+               case TCORE_PENDING_PRIORITY_LOW:
+                       pending->queue = queue;
+                       g_queue_push_tail(queue->gq, pending);
+                       break;
 
-       default:
-               err("Invalid priority: [%d]", pending->priority);
-               return TEL_RETURN_INVALID_PARAMETER;
+               default:
+                       return TCORE_RETURN_EINVAL;
+                       break;
        }
-       pending->queue = queue;
 
-       dbg("Push to Queue - pending: [%p] queue length: [%d]",
-               (guint)pending, g_queue_get_length(queue->gq));
+       dbg("pending(%p) push to queue(%p). queue length=%d",
+                       (unsigned int)pending, queue, g_queue_get_length(queue->gq));
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 TcorePending *tcore_queue_pop(TcoreQueue *queue)
 {
-       if (queue == NULL) {
-               err("pending is NULL");
+       if (!queue)
                return NULL;
-       }
 
        return g_queue_pop_head(queue->gq);
 }
 
-TcorePending *tcore_queue_pop_by_pending(TcoreQueue *queue,
-       TcorePending *pending)
+TcorePending *tcore_queue_pop_by_pending(TcoreQueue *queue, TcorePending *pending)
 {
        TcorePending *tmp;
-       guint i = 0;
+       int i = 0;
 
-       if (queue == NULL) {
-               err("queue is NULL");
+       if (!queue)
                return NULL;
-       }
 
        do {
                tmp = g_queue_peek_nth(queue->gq, i);
+               if (!tmp)
+                       return NULL;
+
                if (tmp == pending) {
                        g_queue_pop_nth(queue->gq, i);
                        return tmp;
                }
 
                i++;
-       } while(tmp != NULL);
+       } while(1);
 
        return NULL;
 }
 
-TcorePending *tcore_queue_pop_abortable_pending(TcoreQueue *queue)
-{
-       TcorePending *pending = NULL;
-       gint i = 0;
-
-       if (queue == NULL) {
-               err("queue is NULL");
-               return NULL;
-       }
-
-       /*
-        * Scan through the list of 'pending' Requests and
-        * get the first Abortable Request
-        */
-       do {
-               pending = g_queue_peek_nth(queue->gq, i);
-               if (pending == NULL) {
-                       err("pending is NULL");
-                       return NULL;
-               }
-               else if (tcore_pending_get_abortable(pending) == TRUE) {
-                       dbg("Found Abrotable 'pending' request: [%p]", pending);
-
-                       /* Pop the Abortable 'pending' Request */
-                       g_queue_pop_nth(queue->gq, i);
-                       break;
-               }
-
-               i++;
-       } while (pending != NULL);
-
-       return pending;
-}
 TcorePending *tcore_queue_pop_timeout_pending(TcoreQueue *queue)
 {
-       guint i = 0;
+       int i = 0;
        TcorePending *pending = NULL;
        time_t cur_time = 0;
 
@@ -675,10 +512,10 @@ TcorePending *tcore_queue_pop_timeout_pending(TcoreQueue *queue)
 
        do {
                pending = g_queue_peek_nth(queue->gq, i);
-               if (pending == NULL)
+               if (!pending)
                        return NULL;
 
-               if (cur_time - pending->timestamp >= (gint)pending->timeout) {
+               if (cur_time - pending->timestamp >= (int)pending->timeout) {
                        pending = g_queue_pop_nth(queue->gq, i);
                        break;
                }
@@ -691,140 +528,203 @@ TcorePending *tcore_queue_pop_timeout_pending(TcoreQueue *queue)
 
 TcorePending *tcore_queue_ref_head(TcoreQueue *queue)
 {
-       if (queue == NULL) {
-               err("queue is NULL");
+       if (!queue)
                return NULL;
-       }
 
        return g_queue_peek_head(queue->gq);
 }
 
 TcorePending *tcore_queue_ref_tail(TcoreQueue *queue)
 {
-       if (queue == NULL) {
-               err("queue is NULL");
+       if (!queue)
                return NULL;
-       }
 
        return g_queue_peek_tail(queue->gq);
 }
 
+
+static TcorePending *_tcore_queue_search_full(TcoreQueue *queue, unsigned int id,
+               enum tcore_request_command command, enum search_field field, gboolean flag_pop)
+{
+       TcorePending *pending = NULL;
+       int i = 0;
+       UserRequest *ur;
+
+       if (!queue)
+               return NULL;
+
+       do {
+               pending = g_queue_peek_nth(queue->gq, i);
+               if (!pending)
+                       return NULL;
+
+               if ((field & 0xF0) == 0x10) {
+                       /* search option is wait pending */
+                       if (pending->flag_sent) {
+                               i++;
+                               continue;
+                       }
+               }
+               else if ((field & 0xF0) == 0x20) {
+                       /* search option is sent pending */
+                       if (pending->flag_sent == FALSE) {
+                               i++;
+                               continue;
+                       }
+               }
+
+               if ((field & 0x0F) == SEARCH_FIELD_ID_ALL) {
+                       if (pending->id == id) {
+                               if (flag_pop == TRUE) {
+                                       pending = g_queue_pop_nth(queue->gq, i);
+                               }
+                               break;
+                       }
+               }
+               else if ((field & 0x0F) == SEARCH_FIELD_COMMAND_ALL) {
+                       ur = tcore_pending_ref_user_request(pending);
+                       if (tcore_user_request_get_command(ur) == command) {
+                               if (flag_pop == TRUE) {
+                                       pending = g_queue_pop_nth(queue->gq, i);
+                               }
+                               break;
+                       }
+               }
+
+               i++;
+       } while (pending != NULL);
+
+       return pending;
+}
+
 TcorePending *tcore_queue_search_by_command(TcoreQueue *queue,
-               TcoreCommand command, gboolean flag_sent)
+               enum tcore_request_command command, gboolean flag_sent)
 {
        if (flag_sent)
-               return __queue_search_full(queue, 0,
-                       command, SEARCH_FIELD_COMMAND_SENT, FALSE);
+               return _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_SENT, FALSE);
 
-       return __queue_search_full(queue, 0,
-               command, SEARCH_FIELD_COMMAND_WAIT, FALSE);
+       return _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_WAIT, FALSE);
 }
 
-TcorePending *tcore_queue_pop_by_id(TcoreQueue *queue, guint id)
+TcorePending *tcore_queue_pop_by_id(TcoreQueue *queue, unsigned int id)
 {
-       if (queue == NULL) {
-               err("queue is NULL");
+       if (!queue)
                return NULL;
-       }
 
-       return __queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, TRUE);
+       return _tcore_queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, TRUE);
+}
+
+TcorePending *tcore_queue_ref_pending_by_id(TcoreQueue *queue, unsigned int id)
+{
+       if (!queue)
+               return NULL;
+
+       return _tcore_queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, FALSE);
 }
 
 TcorePending *tcore_queue_ref_next_pending(TcoreQueue *queue)
 {
        TcorePending *pending = NULL;
-       gint i = 0;
+       int i = 0;
 
-       if (queue == NULL) {
-               err("queue is NULL");
+       if (!queue)
                return NULL;
-       }
 
        do {
                pending = g_queue_peek_nth(queue->gq, i);
-               if (pending == NULL) {
-                       err("pending is NULL");
+               if (!pending) {
                        return NULL;
                }
 
                /* skip already sent immediately pending */
                if (pending->priority == TCORE_PENDING_PRIORITY_IMMEDIATELY) {
-                       if (pending->flag_sent == FALSE)
+                       if (pending->flag_sent == FALSE) {
                                break;
+                       }
 
                        i++;
                        continue;
                }
-               else
+               else {
                        break;
+               }
        } while (pending != NULL);
 
        if (pending->flag_sent == TRUE) {
-               dbg("pending: [%p] is waiting state", (guint)pending);
+               dbg("pending(0x%x) is waiting state.", (unsigned int)pending);
                return NULL;
        }
 
        return pending;
 }
 
-TcorePending *tcore_queue_ref_pending_by_id(TcoreQueue *queue, guint id)
+unsigned int tcore_queue_get_length(TcoreQueue *queue)
 {
-       if (queue == NULL) {
-               err("queue is NULL");
-               return NULL;
-       }
+       if (!queue)
+               return 0;
 
-       return __queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, FALSE);
+       return g_queue_get_length(queue->gq);
 }
 
-guint tcore_queue_get_length(TcoreQueue *queue)
+unsigned int tcore_queue_get_normal_length(TcoreQueue *queue)
 {
-       if (queue == NULL) {
-               err("queue is NULL");
+       TcorePending *pending;
+       int i = 0;
+
+       if (!queue)
                return 0;
-       }
 
-       return g_queue_get_length(queue->gq);
+       do {
+               pending = g_queue_peek_nth(queue->gq, i);
+               if (!pending) {
+                       break;
+               }
+
+               if (pending->priority == TCORE_PENDING_PRIORITY_IMMEDIATELY) {
+                       i++;
+                       continue;
+               }
+
+               break;
+       } while (1);
+
+       return g_queue_get_length(queue->gq) - i;
 }
 
 TcoreHal *tcore_queue_ref_hal(TcoreQueue *queue)
 {
-       if (queue == NULL) {
-               err("queue is NULL");
+       if (!queue)
                return NULL;
-       }
 
        return queue->hal;
 }
 
-TelReturn tcore_queue_cancel_pending_by_command(TcoreQueue *queue,
-       TcoreCommand command)
+TReturn tcore_queue_cancel_pending_by_command(TcoreQueue *queue, enum tcore_request_command command)
 {
        TcorePending *pending;
 
-       if (queue == NULL) {
-               err("queue is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!queue)
+               return TCORE_RETURN_EINVAL;
 
        while (1) {
-               pending = __queue_search_full(queue, 0,
-                       command, SEARCH_FIELD_COMMAND_ALL, FALSE);
-               if (pending == NULL)
+               pending = _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_ALL, FALSE);
+               if (!pending)
                        break;
 
-               dbg("pending: [%p] cancel", (guint)pending);
+               dbg("pending(0x%x) cancel", (unsigned int)pending);
 
                if (queue->hal) {
-                       tcore_hal_dispatch_response_data(queue->hal,
-                               pending->id, 0, NULL);
+                       dbg("hal %p", queue->hal);
+                       tcore_hal_dispatch_response_data(queue->hal, pending->id, 0, NULL);
                }
                else {
+                       dbg("no hal");
                        pending = tcore_queue_pop_by_pending(queue, pending);
                        tcore_pending_emit_response_callback(pending, 0, NULL);
+                       tcore_user_request_unref(tcore_pending_ref_user_request(pending));
                        tcore_pending_free(pending);
                }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
index 44a0862..0717f3b 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <time.h>
 #include <dlfcn.h>
 
 #include <glib.h>
-#include <glib/gprintf.h>
 
 #include "tcore.h"
-#include "server.h"
 #include "plugin.h"
+#include "hal.h"
+#include "server.h"
+#include "user_request.h"
 #include "core_object.h"
+#include "co_ps.h"
 #include "communicator.h"
 #include "storage.h"
-#include "udev.h"
 #include "util.h"
 
-#define MODEMS_PATH "/usr/lib/telephony/plugins/modems"
+#define MODEMS_PATH "/usr/lib/telephony/plugins/modems/"
 
 struct tcore_server_type {
        GMainLoop *mainloop;
-
        GSList *plugins;
        GSList *communicators;
        GSList *storages;
+       GSList *hals;
        GSList *modems;
 
        GSList *template_co;
 
+       GSList *hook_list_request;
        GSList *hook_list_notification;
-
        TcorePlugin *default_plugin;
-       TcoreUdev *udev;
 };
 
 struct tcore_modem_type {
-       gchar *cp_name;
+       char *cp_name;
        TcorePlugin *modem_iface_plugin;
 
        TcorePlugin *modem_plugin;
@@ -64,28 +65,34 @@ struct tcore_modem_type {
        void *mapping_tbl;
 };
 
+struct hook_request_type {
+       enum tcore_request_command command;
+       TcoreServerRequestHook func;
+       void *user_data;
+};
+
 struct hook_notification_type {
-       TcoreServerNotification command;
+       enum tcore_notification_command command;
        TcoreServerNotificationHook func;
        void *user_data;
 };
 
-static gint __compare_priority(gconstpointer a, gconstpointer b)
+static gint _compare_priority(gconstpointer a, gconstpointer b)
 {
        TcorePlugin *plugin1 = (TcorePlugin *)a;
        TcorePlugin *plugin2 = (TcorePlugin *)b;
 
-       if (plugin2 == NULL)
+       if (!plugin2)
                return 1;
 
        return tcore_plugin_get_description(plugin1)->priority -
-               tcore_plugin_get_description(plugin2)->priority;
+                       tcore_plugin_get_description(plugin2)->priority;
 }
 
-static gchar *_server_enumerate_modem(TcorePlugin *plugin)
+static char *_server_enumerate_modem(TcorePlugin *plugin)
 {
-       static guint cp_counter = 0;
-       const gchar *filename;
+       static unsigned int cp_counter = 0;
+       const char *filename;
 
        if (plugin == NULL)
                return NULL;
@@ -94,8 +101,8 @@ static gchar *_server_enumerate_modem(TcorePlugin *plugin)
         * Presently enumeration is based on Modem Interface Plug-in descriptor name
         * followed by an incremental Positive integer 'cp_count'.
         *
-        * For example, if Modem Interface Plug-in descriptor name is 'imcmodem' then,
-        *      'name' would be enumerated as "imcmode_N", where N >= 0
+        * For example, if Modem Interface Plug-in descriptor name is 'qmimodem' then,
+        *      'name' would be enumerated as "qmimodem_N", where N >= 0
         */
        filename = tcore_plugin_ref_plugin_name(plugin);
        if (filename == NULL)
@@ -106,65 +113,52 @@ static gchar *_server_enumerate_modem(TcorePlugin *plugin)
        return g_strdup_printf("%s%d", filename, cp_counter++);
 }
 
-static TcoreModem *__server_find_modem(Server *s,
-       TcorePlugin *modem_iface_plugin, TcorePlugin *modem_plugin)
+static TcoreModem *__get_modem(TcorePlugin *modem_plugin)
 {
        GSList *list;
        TcoreModem *modem;
+       Server *s;
 
-       dbg("Modem Plug-in [0x%x][%s] Modem Interface Plug-in: [0x%x][%s]",
-               modem_plugin, tcore_plugin_ref_plugin_name(modem_plugin),
-               modem_iface_plugin, tcore_plugin_ref_plugin_name(modem_iface_plugin));
+       s = tcore_plugin_ref_server(modem_plugin);
+       if (s == NULL) {
+               err("server is NULL");
+               return NULL;
+       }
 
        for (list = s->modems; list; list = list->next) {
                modem = list->data;
-               if (modem == NULL)
+               if (modem == NULL) {
+                       dbg("Modem is NULL");
                        continue;
-
-               /*
-                * Specifically for Unregister, Add Modem Plug-in
-                * and Add/Remove Mapping Table -
-                *
-                * MUST match Modem Interface Plug-in
-                *                      AND
-                * If passed Modem Interface Plug-in is NULL, then
-                * Modem Interface Plug-in of 'modems' MUST be NULL
-                */
-               if ((modem_iface_plugin == modem->modem_iface_plugin)
-                       && ((modem_plugin == NULL) && (modem->modem_plugin == NULL))) {
-                       dbg("'modem' found!!!");
-                       return modem;
                }
 
-               /*
-                * Specifically for get Mapping Table -
-                *
-                * Modem Interface Plug-in MUST be NULL
-                *                      AND
-                * Passed Modem Plug-in MUST match Modem Plug-of 'modems'
-                */
-               if ((modem_iface_plugin == NULL)
-                       && (modem_plugin == modem->modem_plugin)) {
-                       dbg("'modem' found!!!");
-                       return modem;
-               }
-
-               /*
-                * Specifically for get CP name -
-                *
-                * Passed Modem OR Modem Interface Plug-in MUST match
-                *                      AND
-                * MUST match either Modem OR Modem Interface Plug-in of 'modems'
-                */
-               if ((modem_iface_plugin == modem_plugin)
-                               && ((modem_iface_plugin == modem->modem_iface_plugin)
-                               || (modem_plugin == modem->modem_plugin))) {
-                       dbg("'modem' found!!!");
+               if (modem->modem_plugin == modem_plugin)
                        return modem;
-               }
        }
 
        err("Modem not found");
+
+       return NULL;
+}
+
+static TcorePlugin *_find_default_plugin(Server *s)
+{
+       GSList *list;
+       TcoreModem *modem;
+
+       if (s->default_plugin != NULL) {
+               return s->default_plugin;
+       }
+
+       for (list = s->modems; list; list = list->next) {
+               modem = list->data;
+               if (modem == NULL)
+                       continue;
+
+               s->default_plugin = modem->modem_plugin;
+               return modem->modem_plugin;
+       }
+
        return NULL;
 }
 
@@ -172,28 +166,24 @@ Server *tcore_server_new()
 {
        Server *s;
 
-       /* Server structure */
-       s = g_try_new0(struct tcore_server_type, 1);
-       if (s == NULL) {
-               err("Failed to allocate memory");
+       s = calloc(1, sizeof(struct tcore_server_type));
+       if (!s) {
+               err("Server allocation failed!!!");
                return NULL;
        }
 
-       /* g-main loop */
        s->mainloop = g_main_loop_new (NULL, FALSE);
-       if (s->mainloop == NULL) {
-               err("Failed to allocate memory");
-
-               /* Free resources */
-               tcore_free(s);
+       if (!s->mainloop) {
+               err("mainloop creation failed!!!");
+               free(s);
                return NULL;
        }
 
-       /* Initialize Server structure */
        s->plugins = NULL;
        s->communicators = NULL;
        s->storages = NULL;
-       s->template_co = NULL;
+       s->hals = NULL;
+       s->hook_list_request = NULL;
        s->hook_list_notification = NULL;
        s->default_plugin = NULL;
 
@@ -202,651 +192,616 @@ Server *tcore_server_new()
 
 void tcore_server_free(Server *s)
 {
-       GSList *list;
-       TcorePlugin *p;
-       const struct tcore_plugin_define_desc *desc;
+       GSList *list = NULL;
+       TcorePlugin *p = NULL;
+       struct tcore_plugin_define_desc *desc = NULL;
 
-       if (s == NULL) {
+       if (!s) {
                err("Server is NULL");
                return;
        }
+       s->plugins = g_slist_reverse(s->plugins);
 
-       /* Unref g-main loop */
-       if (s->mainloop)
-               g_main_loop_unref(s->mainloop);
-
-       /* Unload Plug-ins */
+       /* Unload all plug-ins */
        for (list = s->plugins; list; list = list->next) {
                p = list->data;
-               if (p != NULL) {
-                       desc = (struct tcore_plugin_define_desc *)tcore_plugin_get_description(p);
+               if (!p)
+                       continue;
 
-                       /* Unload Plug-in */
-                       if ((desc != NULL) && (desc->unload != NULL))
-                               desc->unload(p);
+               desc = (struct tcore_plugin_define_desc *)tcore_plugin_get_description(p);
+               if (!desc || !desc->unload)
+                       continue;
 
-                       /* Free resource */
-                       tcore_plugin_free(p);
-                       list->data = NULL;
-               }
+               desc->unload(p);
+
+               tcore_plugin_free(p);
+
+               list->data = NULL;
+       }
+
+       /* Free plug-ins */
+       if (s->plugins) {
+               g_slist_free(s->plugins);
+               s->plugins = NULL;
        }
 
-       /* Free resources */
-       g_slist_free_full(s->hook_list_notification, g_free);
-       g_slist_free(s->template_co);
-       g_slist_free(s->storages);
-       g_slist_free(s->communicators);
-       g_slist_free(s->plugins);
+       /* Unref 'mainloop' */
+       if (s->mainloop) {
+               g_main_loop_unref(s->mainloop);
+       }
 
-       /* Freeing Server */
-       tcore_free(s);
+       /* Free server */
+       free(s);
+       dbg("Freeing Server");
 }
 
-TelReturn tcore_server_run(Server *s)
+TReturn tcore_server_run(Server *s)
 {
-       gchar *version;
+       char *version;
 
-       if (s == NULL) {
-               err("Server is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       if (s->mainloop == NULL) {
-               err("Server mainloop is NULL");
-               return TEL_RETURN_FAILURE;
-       }
+       if (!s || !s->mainloop)
+               return TCORE_RETURN_EINVAL;
 
        version = tcore_util_get_version();
        if (version) {
                dbg("libtcore version: %s", version);
-               tcore_free(version);
+               free(version);
        }
 
-       /* Send 'Server running' notification */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_SERVER_RUN,
-               0, NULL);
+       tcore_server_send_notification(s, NULL, TNOTI_SERVER_RUN, 0, NULL);
 
-       /* Enter g-main loop */
        g_main_loop_run(s->mainloop);
 
-       dbg("~*~*~* Server Exit *~*~*~");
-
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_server_exit(Server *s)
+TReturn tcore_server_exit(Server *s)
 {
-       if (s == NULL) {
-               err("Server is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!s || !s->mainloop)
+               return TCORE_RETURN_EINVAL;
 
-       if (s->mainloop == NULL) {
-               err("Server mainloop is NULL");
-               return TEL_RETURN_FAILURE;
-       }
-
-       /* Quit g-main loop */
        g_main_loop_quit(s->mainloop);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_server_add_plugin(Server *s, TcorePlugin *plugin)
+TReturn tcore_server_add_plugin(Server *s, TcorePlugin *plugin)
 {
-       if ((s == NULL) || (plugin == NULL)) {
-               err("s: [%p] plugin: [%p]", s, plugin);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!s || !plugin)
+               return TCORE_RETURN_EINVAL;
 
-       /*
-        * Plug-in addition to Server list
-        *
-        * Plug-ins are added in a sorted list based on 'priority' of Plug-in
-        */
-       s->plugins = g_slist_insert_sorted(s->plugins, plugin, __compare_priority);
+       s->plugins = g_slist_insert_sorted(s->plugins, plugin, _compare_priority);
 
-       /* Send 'Plug-in added' notification */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_ADDED_PLUGIN,
-               0, NULL);
+       tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_PLUGIN, 0, NULL);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_server_remove_plugin(Server *s, TcorePlugin *plugin)
-{
-       if ((s == NULL) || (plugin == NULL)) {
-               err("s: [%p] plugin: [%p]", s, plugin);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       s->plugins = g_slist_remove(s->plugins, plugin);
-
-       /* Send 'Plug-in removed' notification */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_REMOVED_PLUGIN,
-               0, NULL);
-
-       return TEL_RETURN_SUCCESS;
-}
-
-TcorePlugin *tcore_server_find_plugin(Server *s, const gchar *name)
+TcorePlugin *tcore_server_find_plugin(Server *s, const char *name)
 {
        GSList *list;
        TcoreModem *modem;
 
-       dbg("Plug-in Name: [%s]", name);
+       dbg("Name: [%s]", name);
+       if (g_strcmp0(TCORE_PLUGIN_DEFAULT, name) == 0)
+               return _find_default_plugin(s);
 
        for (list = s->modems; list; list = list->next) {
                modem = list->data;
-               if (modem != NULL)
-                       if (g_strcmp0(modem->cp_name, name) == 0)
-                               return modem->modem_plugin;
+               if (modem == NULL)
+                       continue;
+
+               if (g_strcmp0(modem->cp_name, name) == 0)
+                       return modem->modem_plugin;
        }
 
-       err("Modem plugin '%s' not found", name);
+       err("Modem plugin not found");
+
        return NULL;
 }
 
 GSList *tcore_server_ref_plugins(Server *s)
 {
-       if (s == NULL) {
-               err("server is NULL");
+       if (!s)
                return NULL;
-       }
 
        return s->plugins;
 }
 
-TelReturn tcore_server_add_communicator(Server *s, Communicator *comm)
+TReturn tcore_server_add_communicator(Server *s, Communicator *comm)
 {
-       if ((s == NULL) || (comm == NULL)) {
-               err("s: [%p] comm: [%p]", s, comm);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!s || !comm)
+               return TCORE_RETURN_EINVAL;
 
-       /*
-        * Communication addition to Server list
-        *
-        * Communicators are added to the beginning of the list (prepended)
-        */
        s->communicators = g_slist_insert(s->communicators, comm, 0);
 
-       /* Send 'Communicator added' notification */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_ADDED_COMMUNICATOR,
-               0, NULL);
+       tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_COMMUNICATOR, 0, NULL);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_server_remove_communicator(Server *s, Communicator *comm)
+TReturn tcore_server_remove_communicator(Server *s, Communicator *comm)
 {
-       if ((s == NULL) || (comm == NULL)) {
-               err("s: [%p] comm: [%p]", s, comm);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       s->communicators = g_slist_remove(s->communicators, comm);
+       if (!s || !comm)
+               return TCORE_RETURN_EINVAL;
 
-       /* Send 'Communicator removed' notification */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_REMOVED_COMMUNICATOR,
-               0, NULL);
+       s->communicators = g_slist_remove( s->communicators, comm );
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
+
 GSList *tcore_server_ref_communicators(Server *s)
 {
-       if (s == NULL) {
-               err("server is NULL");
+       if (!s)
                return NULL;
-       }
 
        return s->communicators;
 }
 
-Communicator *tcore_server_find_communicator(Server *s, const gchar *name)
+Communicator *tcore_server_find_communicator(Server *s, const char *name)
 {
        GSList *list;
        Communicator *comm;
 
-       dbg("Communicator Name: [%s]", name);
-
        for (list = s->communicators; list; list = list->next) {
                comm = list->data;
-               if (comm != NULL)
-                       if (g_strcmp0(tcore_communicator_ref_name(comm), name) == 0)
-                               return comm;
+               if (!comm) {
+                       continue;
+               }
+
+               if (g_strcmp0(tcore_communicator_ref_name(comm), name) == 0) {
+                       return comm;
+               }
        }
 
        return NULL;
 }
 
-TelReturn tcore_server_add_storage(Server *s, TcoreStorage *strg)
+TReturn tcore_server_add_storage(Server *s, Storage *strg)
 {
-       if ((s == NULL) || (strg == NULL)) {
-               err("s: [%p] strg: [%p]", s, strg);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!s || !strg)
+               return TCORE_RETURN_EINVAL;
 
-       /*
-        * Storage addition to Server list
-        *
-        * Storages are added to the beginning of the list (prepended)
-        */
        s->storages = g_slist_insert(s->storages, strg, 0);
 
-       /* Send 'Storage added' notification */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_ADDED_STORAGE,
-               0, NULL);
+       tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_STORAGE, 0, NULL);
 
-       return TEL_RETURN_SUCCESS;
-}
-
-TelReturn tcore_server_remove_storage(Server *s, TcoreStorage *strg)
-{
-       if ((s == NULL) || (strg == NULL)) {
-               err("s: [%p] strg: [%p]", s, strg);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       s->storages = g_slist_remove(s->storages, strg);
-
-       /* Send 'Storage remove' notification */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_REMOVED_STORAGE,
-               0, NULL);
-
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
 GSList *tcore_server_ref_storages(Server *s)
 {
-       if (s == NULL) {
-               err("server is NULL");
+       if (!s)
                return NULL;
-       }
 
        return s->storages;
 }
 
-TcoreStorage *tcore_server_find_storage(Server *s, const gchar *name)
+Storage *tcore_server_find_storage(Server *s, const char *name)
 {
        GSList *list;
-       TcoreStorage *strg;
+       Storage *strg;
 
        for (list = s->storages; list; list = list->next) {
                strg = list->data;
-               if (strg != NULL)
-                       if (g_strcmp0(tcore_storage_ref_name(strg), name) == 0)
-                               return strg;
+               if (!strg) {
+                       continue;
+               }
+
+               if (g_strcmp0(tcore_storage_ref_name(strg), name) == 0) {
+                       return strg;
+               }
        }
 
        return NULL;
 }
 
-TelReturn tcore_server_add_template_object(Server *s, CoreObject *template_co)
+TReturn tcore_server_add_hal(Server *s, TcoreHal *hal)
 {
        GSList *list;
-       CoreObject *temp;
+       TcoreHal *temp;
 
-       if ((s == NULL) || (template_co == NULL)) {
-               err("s: [%p] template_co: [%p]", s, template_co);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!s || !hal)
+               return TCORE_RETURN_EINVAL;
 
-       /*
-       * Template Core Object addition to Server list
-       *
-       * Only one Template Core Object of a specific type is added to the
-       * list on Template Core Objects
-       */
-       for (list = s->template_co; list; list = list->next) {
+       for (list = s->hals; list; list = list->next) {
                temp = list->data;
-               if (temp != NULL)
-                       if (tcore_object_get_type(temp) ==
-                                       tcore_object_get_type(template_co))
-                               return TEL_RETURN_FAILURE;
+               if (!temp) {
+                       continue;
+               }
+
+               if (temp == hal)
+                       return TCORE_RETURN_EALREADY;
        }
 
-       /* Template Core Objects are added to the beginning of the list (prepended) */
-       s->template_co = g_slist_insert(s->template_co, template_co, 0);
+       s->hals = g_slist_insert(s->hals, hal, 0);
 
-       return TEL_RETURN_SUCCESS;
+       tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_HAL, 0, NULL);
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_server_remove_template_object(Server *s, CoreObject *template_co)
+TReturn tcore_server_remove_hal(Server *s, TcoreHal *hal)
 {
-       if ((s == NULL) || (template_co == NULL)) {
-               err("s: [%p] template_co: [%p]", s, template_co);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!s || !hal)
+               return TCORE_RETURN_EINVAL;
+
+       /* Remove HAL from list */
+       s->hals = g_slist_remove(s->hals, hal);
 
-       s->template_co = g_slist_remove(s->template_co, template_co);
+       /* Send Notification */
+       tcore_server_send_notification(s, NULL, TNOTI_SERVER_REMOVED_HAL, 0, NULL);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-GSList *tcore_server_ref_template_object(Server *s)
+GSList *tcore_server_ref_hals(Server *s)
 {
-       if (s == NULL) {
-               err("server is NULL");
+       if (!s)
                return NULL;
-       }
 
-       return s->template_co;
+       return s->hals;
 }
 
-CoreObject *tcore_server_find_template_object(Server *s, guint type)
+CoreObject *tcore_server_find_template_object(Server *s, unsigned int type)
 {
        GSList *list;
        CoreObject *template_co;
 
-       dbg("Template Core Object type: [0x%x]", type);
-
        for (list = s->template_co; list; list = list->next) {
                template_co = list->data;
-               if (template_co != NULL)
-                       if (type == tcore_object_get_type(template_co))
-                               return template_co;
+               if (template_co == NULL)
+                       continue;
+
+               if (type == tcore_object_get_type(template_co))
+                       return template_co;
        }
 
        return NULL;
 }
 
-TelReturn tcore_server_link_udev(Server *s, TcoreUdev *udev)
+TcoreHal *tcore_server_find_hal(Server *s, const char *name)
 {
-       if ((s == NULL) || (udev == NULL)) {
-               err("s: [%p] udev: [%p]", s, udev);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       GSList *list;
+       TcoreHal *hal;
+       char *buf;
 
-       s->udev = udev;
+       for (list = s->hals; list; list = list->next) {
+               hal = list->data;
+               if (!hal) {
+                       continue;
+               }
+
+               buf = tcore_hal_get_name(hal);
+               if (!buf)
+                       continue;
+
+               if (g_strcmp0(buf, name) == 0) {
+                       free(buf);
+                       return hal;
+               }
 
-       return TEL_RETURN_SUCCESS;
+               free(buf);
+       }
+
+       return NULL;
 }
 
-TcoreUdev *tcore_server_ref_udev(Server *s)
+TReturn tcore_server_dispatch_request(Server *s, UserRequest *ur)
 {
-       if (s == NULL) {
-               err("server is NULL");
-               return NULL;
+       char *modem_name = NULL;
+       TcorePlugin *p;
+       enum tcore_request_command command = 0;
+       GSList *list, *co_list=NULL;
+       struct hook_request_type *hook;
+       int category;
+       CoreObject *o;
+       TReturn ret = TCORE_RETURN_ENOSYS;
+       TReturn prev_ret = TCORE_RETURN_FAILURE;
+
+       if (!s || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       for (list = s->hook_list_request; list; list = list->next) {
+               hook = list->data;
+               if (!hook) {
+                       continue;
+               }
+
+               if (hook->command == tcore_user_request_get_command(ur)) {
+                       if (hook->func) {
+                               enum tcore_hook_return hook_ret;
+
+                               hook_ret = hook->func(s, ur, hook->user_data);
+                               if (hook_ret == TCORE_HOOK_RETURN_STOP_PROPAGATION) {
+                                       return TCORE_RETURN_SUCCESS;
+                               } else if (hook_ret == TCORE_HOOK_RETURN_STOP_PROPAGATION_FAIL) {
+                                       return TCORE_RETURN_FAILURE;
+                               }
+                       }
+               }
+       }
+
+       modem_name = tcore_user_request_get_modem_name(ur);
+       if (!modem_name)
+               return TCORE_RETURN_EINVAL;
+
+       p = tcore_server_find_plugin(s, (const char*)modem_name);
+       if (!p) {
+               free(modem_name);
+               return TCORE_RETURN_SERVER_WRONG_PLUGIN;
        }
+       free(modem_name);
 
-       return s->udev;
+       command = tcore_user_request_get_command(ur);
+
+       category = CORE_OBJECT_TYPE_DEFAULT | (command & 0x0FF00000);
+
+       co_list = tcore_plugin_get_core_objects_bytype(p, category);
+       if (!co_list) {
+               warn("can't find 0x%x core_object. co_list is null.", category);
+               return TCORE_RETURN_ENOSYS;
+       }
+
+       for (list = co_list; list; list = list->next) {
+               o = (CoreObject *) list->data;
+               if (!o) {
+                       warn("can't find 0x%x core_object", category);
+                       continue;
+               }
+
+               /*
+                * SUCCESS would be returned if even one of the Core Object
+                * in the list 'co_list' Successfully processes the request.
+                *
+                * The concept is to consider that the Request is being
+                * processed atleast by 1 entity.
+                */
+               ret = tcore_object_dispatch_request(o, ur);
+               if ( ret != TCORE_RETURN_SUCCESS) {
+                       dbg("failed... ret=[%d]", ret);
+               }
+               else {
+                       prev_ret = ret;
+               }
+               ret = prev_ret;
+       }
+
+       g_slist_free(co_list);
+       return ret;
 }
 
-TelReturn tcore_server_send_server_notification(Server *s,
-       TcoreServerNotification command, guint data_len, void *data)
+TReturn tcore_server_send_notification(Server *s, CoreObject *source,
+               enum tcore_notification_command command,
+               unsigned int data_len, void *data)
 {
        GSList *list;
        Communicator *comm;
        struct hook_notification_type *hook;
+       if (!s)
+               return TCORE_RETURN_EINVAL;
 
-       dbg("Send Server Notification!!! Command: [0x%x]", command);
-
-       if (s == NULL) {
-               err("server is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       for (list = s->hook_list_notification; list; list = list->next) {
+       for (list = s->hook_list_notification; list;) {
                hook = list->data;
-               if (hook != NULL) {
-                       if (hook->command == command) {
-                               dbg("Invoking hook_func() for Command: [0x%x]", command);
-                               if (hook->func(s, command, data_len, data, hook->user_data)
-                                               == TCORE_HOOK_RETURN_STOP_PROPAGATION)
-                                       return TEL_RETURN_SUCCESS;
+               list = list->next;
+               if (!hook) {
+                       continue;
+               }
+
+               if (hook->command == command) {
+                       if (hook->func(s, source, command, data_len, data, hook->user_data) == TCORE_HOOK_RETURN_STOP_PROPAGATION) {
+                               return TCORE_RETURN_SUCCESS;
                        }
                }
        }
 
-       for (list = s->communicators; list; list = list->next) {
+       for (list = s->communicators; list;) {
                comm = list->data;
-               if (comm != NULL)
-                       tcore_communicator_send_notification(comm,
-                               NULL, command, data_len, data);
+               list = list->next;
+               if (!comm) {
+                       continue;
+               }
+
+               tcore_communicator_send_notification(comm, source, command, data_len, data);
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_server_add_request_hook(Server *s,
+               enum tcore_request_command command,
+               TcoreServerRequestHook func, void *user_data)
+{
+       struct hook_request_type *hook;
+
+       if (!s || !func)
+               return TCORE_RETURN_EINVAL;
+
+       hook = calloc(1, sizeof(struct hook_request_type));
+       if (!hook)
+               return TCORE_RETURN_ENOMEM;
+
+       hook->command = command;
+       hook->func = func;
+       hook->user_data = user_data;
+
+       s->hook_list_request = g_slist_append(s->hook_list_request, hook);
+
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_server_send_notification(Server *s,
-       TcorePlugin *source, TcoreNotification command, guint data_len, void *data)
+TReturn tcore_server_remove_request_hook(Server *s, TcoreServerRequestHook func)
 {
+       struct hook_request_type *hook;
        GSList *list;
-       Communicator *comm;
 
-       dbg("Send Notification!!! Command: [0x%x]", command);
+       if (!s)
+               return TCORE_RETURN_EINVAL;
 
-       if (s == NULL) {
-               err("server is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       for (list = s->hook_list_request; list; list = list->next) {
+               hook = list->data;
+               if (!hook) {
+                       continue;
+               }
 
-       for (list = s->communicators; list; list = list->next) {
-               comm = list->data;
-               if (comm != NULL)
-                       tcore_communicator_send_notification(comm,
-                               source, command, data_len, data);
+               if (hook->func == func) {
+                       s->hook_list_request = g_slist_remove(s->hook_list_request, hook);
+                       free(hook);
+                       list = s->hook_list_request;
+               }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_server_add_notification_hook(Server *s,
-       TcoreServerNotification command, TcoreServerNotificationHook func, void *user_data)
+TReturn tcore_server_add_notification_hook(Server *s,
+               enum tcore_notification_command command,
+               TcoreServerNotificationHook func, void *user_data)
 {
        struct hook_notification_type *hook;
 
-       if ((s == NULL) || (func == NULL)) {
-               err("server: [0x%x] func: [0x%x]", s, func);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       if (!s || !func)
+               return TCORE_RETURN_EINVAL;
 
-       if (command < TCORE_SERVER_NOTIFICATION_SERVER_RUN
-                       || command > TCORE_SERVER_NOTIFICATION_MODEM_ERR) {
-               err("Invalid command: [0x%x]", command);
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
+       hook = calloc(1, sizeof(struct hook_notification_type));
+       if (!hook)
+               return TCORE_RETURN_ENOMEM;
 
-       /* Create 'hook' node */
-       hook = g_try_new0(struct hook_notification_type, 1);
-       if (hook == NULL) {
-               err("Failed to allocate memory");
-               return TEL_RETURN_MEMORY_FAILURE;
-       }
        hook->command = command;
        hook->func = func;
        hook->user_data = user_data;
 
-       /* Notification Hooks are appended to the list */
        s->hook_list_notification = g_slist_append(s->hook_list_notification, hook);
-       dbg("Server Notification hook added for Command: [0x%x]", command);
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_server_remove_notification_hook(Server *s,
+TReturn tcore_server_remove_notification_hook(Server *s,
                TcoreServerNotificationHook func)
 {
        struct hook_notification_type *hook;
        GSList *list;
 
-       if (s == NULL) {
-               err("Server is NULL");
-               return TEL_RETURN_INVALID_PARAMETER;
-       }
-
-       list = s->hook_list_notification;
-       while (list) {
-               GSList *tmp_list = list->next;
+       if (!s)
+               return TCORE_RETURN_EINVAL;
 
+       for (list = s->hook_list_notification; list; list = list->next) {
                hook = list->data;
-               if (hook != NULL) {
-                       if (hook->func == func) {
-                               /* Remove 'hook' node */
-                               s->hook_list_notification =
-                                       g_slist_remove(s->hook_list_notification, hook);
-                               dbg("Server Notification hook removed for Command: [0x%x]",
-                                       hook->command);
-
-                               /* Free resource */
-                               tcore_free(hook);
-                       }
+               if (!hook) {
+                       continue;
                }
 
-               /* Proceed to next node */
-               list = tmp_list;
+               if (hook->func == func) {
+                       s->hook_list_notification = g_slist_remove(s->hook_list_notification, hook);
+                       free(hook);
+                       list = s->hook_list_notification;
+               }
        }
 
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-gboolean tcore_server_register_modem(Server *s, TcorePlugin *modem_iface_plugin)
+TcoreModem *tcore_server_register_modem(Server *s, TcorePlugin *modem_iface_plugin)
 {
        TcoreModem *modem;
 
        if ((s == NULL) || (modem_iface_plugin == NULL)) {
-               err("server [0x%x] Modem Interface Plug-in: [0x%x]", s, modem_iface_plugin);
-               return FALSE;
+               err("Server [%p] Modem Interface Plug-in: [%p]", s, modem_iface_plugin);
+               return NULL;
        }
 
+       /* Allocate 'modem' */
        modem = g_try_new0(TcoreModem, 1);
        if (modem == NULL) {
                err("Failed to allocate memory");
-               return FALSE;
+               return NULL;
        }
 
-       /* Enumerate CP Name */
+       /* Enumerate CP Name to 'modem' */
        modem->cp_name = _server_enumerate_modem(modem_iface_plugin);
+
+       /* Update Modem Interface Plug-in to 'modem' */
        modem->modem_iface_plugin = modem_iface_plugin;
 
-       /*
-        * 'modem' addition to modems list
-        *
-        * 'modem' is appended to modems list
-        */
+       /* Add 'modem' to 'modems' list */
        s->modems = g_slist_append(s->modems, modem);
        dbg("Added to 'modems' entry - CP Name: [%s] Modem Interface Plug-in: [%s]",
-               modem->cp_name, tcore_plugin_ref_plugin_name(modem_iface_plugin));
+                                       modem->cp_name, tcore_plugin_ref_plugin_name(modem_iface_plugin));
 
-       return TRUE;
+       return modem;
 }
 
-void tcore_server_unregister_modem(Server *s, TcorePlugin *modem_iface_plugin)
+void tcore_server_unregister_modem(Server *s, TcoreModem *modem)
 {
-       TcoreModem *modem;
-
-       if ((s == NULL) || (modem_iface_plugin == NULL)) {
-               err("server [0x%x] Modem Interface Plug-in: [0x%x]", s, modem_iface_plugin);
-               return;
-       }
-
-       /* Find 'modem' */
-       modem = __server_find_modem(s, modem_iface_plugin, NULL);
-       if (modem == NULL) {
-               err("Failed to find 'modem' for Modem Interface Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(modem_iface_plugin));
+       if ((s == NULL) || (modem == NULL)) {
+               err("server [%p] Modem: [%p]", s, modem);
                return;
        }
 
-       /* Remove 'modem' from modems list */
+       /* Remove 'modem' from 'modems' list */
        s->modems = g_slist_remove(s->modems, modem);
+       dbg("Removed from 'modems' entry - CP Name: [%s] Modem Interface Plug-in: [%s]",
+               modem->cp_name, tcore_plugin_ref_plugin_name(modem->modem_iface_plugin));
 
-       /* Free resources */
-       tcore_free(modem->cp_name);
-       tcore_free(modem);
+       /* Free memory */
+       g_free(modem->cp_name);
+       g_free(modem);
 }
 
-gboolean tcore_server_update_modem_plugin(TcorePlugin *modem_iface_plugin,
-       TcorePlugin *modem_plugin)
+GSList *tcore_server_get_cp_name_list(Server *s)
 {
-       Server *s;
+       GSList *cp_name_list = NULL;
+       GSList *list;
        TcoreModem *modem;
 
-       if (modem_iface_plugin == NULL) {
-               err("Modem Interface Plug-in: [0x%x]", modem_iface_plugin);
-               return FALSE;
-       }
+       int i = 0;
 
-       s = tcore_plugin_ref_server(modem_iface_plugin);
        if (s == NULL) {
-               err("server is NULL");
-               return FALSE;
+               err("Server is NULL");
+               return NULL;
        }
 
-       /* Find 'modem' */
-       modem = __server_find_modem(s, modem_iface_plugin, NULL);
-       if (modem == NULL) {
-               err("Failed to find 'modem' for Modem Interface Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(modem_iface_plugin));
-               return FALSE;
-       }
+       for (list = s->modems; list; list = list->next) {
+               modem = list->data;
+               if (modem == NULL) {
+                       dbg("No modem - continue");
+                       continue;
+               }
 
-       /* Update Modem Plug-in */
-       modem->modem_plugin = modem_plugin;
-       dbg("Added to 'modems' pair - Modem Plug-in [%s] <---> Modem Interface Plug-in: [%s]",
-               tcore_plugin_ref_plugin_name(modem_plugin),
-               tcore_plugin_ref_plugin_name(modem_iface_plugin));
+               /* Add CP name to 'cp_name_list' */
+               dbg("[%d] CP Name: [%s]", i++, modem->cp_name);
+               cp_name_list = g_slist_append(cp_name_list, g_strdup(modem->cp_name));
+       }
 
-       return TRUE;
+       /* 'cp_name_list' would be freed by the calling function */
+       return cp_name_list;
 }
 
-const gchar *tcore_server_get_cp_name_by_plugin(TcorePlugin *plugin)
+const char *tcore_server_get_cp_name_by_plugin(TcorePlugin *modem_plugin)
 {
-       Server *s;
        TcoreModem *modem;
 
-       if (plugin == NULL) {
-               err("plugin is NULL");
-               return NULL;
-       }
-
-       s = tcore_plugin_ref_server(plugin);
-       if (s == NULL) {
-               err("server is NULL");
+       if (modem_plugin == NULL) {
+               err("Modem Plug-in is NULL");
                return NULL;
        }
 
-       /* Find 'modem' */
-       modem = __server_find_modem(s, plugin, plugin);
+       modem = __get_modem(modem_plugin);
        if (modem == NULL) {
                err("Failed to find 'modem' for Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(plugin));
+                                       tcore_plugin_ref_plugin_name(modem_plugin));
                return NULL;
        }
 
-       return (const gchar *)modem->cp_name;
+       return (const char *)modem->cp_name;
 }
 
-gboolean tcore_server_add_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
-       guint co_type, TcoreHal *hal)
+gboolean tcore_server_add_cp_mapping_tbl_entry(TcoreModem *modem,
+                                       unsigned int co_type, TcoreHal *hal)
 {
-       Server *s;
-       TcoreModem *modem;
-
-       if (modem_iface_plugin == NULL) {
-               err("Modem Interface is NULL");
-               return FALSE;
-       }
-
-       s = tcore_plugin_ref_server(modem_iface_plugin);
-       if (s == NULL) {
-               err("server is NULL");
-               return FALSE;
-       }
-
-       modem = __server_find_modem(s, modem_iface_plugin, NULL);
        if (modem == NULL) {
-               err("Failed to find 'modem' for Modem Interface Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(modem_iface_plugin));
+               err("Modem is NULL");
                return FALSE;
        }
 
@@ -860,26 +815,10 @@ gboolean tcore_server_add_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
        return TRUE;
 }
 
-void tcore_server_remove_cp_mapping_tbl(TcorePlugin *modem_iface_plugin)
+void tcore_server_remove_cp_mapping_tbl(TcoreModem *modem)
 {
-       Server *s;
-       TcoreModem *modem;
-
-       if (modem_iface_plugin == NULL) {
-               err("Modem Interface is NULL");
-               return;
-       }
-
-       s = tcore_plugin_ref_server(modem_iface_plugin);
-       if (s == NULL) {
-               err("server is NULL");
-               return;
-       }
-
-       modem = __server_find_modem(s, modem_iface_plugin, NULL);
        if (modem == NULL) {
-               err("Failed to find 'modem' for Modem Interface Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(modem_iface_plugin));
+               err("Modem is NULL");
                return;
        }
 
@@ -887,38 +826,21 @@ void tcore_server_remove_cp_mapping_tbl(TcorePlugin *modem_iface_plugin)
        tcore_object_remove_mapping_tbl(modem->mapping_tbl);
 }
 
-void tcore_server_remove_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
-       TcoreHal *hal)
+void tcore_server_remove_cp_mapping_tbl_entry(TcoreModem *modem,
+                                       TcoreHal *hal)
 {
-       Server *s;
-       TcoreModem *modem;
-
-       if (modem_iface_plugin == NULL) {
-               err("Modem Interface is NULL");
-               return;
-       }
-
-       s = tcore_plugin_ref_server(modem_iface_plugin);
-       if (s == NULL) {
-               err("server is NULL");
-               return;
-       }
-
-       modem = __server_find_modem(s, modem_iface_plugin, NULL);
        if (modem == NULL) {
-               err("Failed to find 'modem' for Modem Interface Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(modem_iface_plugin));
+               err("Modem is NULL");
                return;
        }
 
-       /* Removing the Mapping Table from the Modems list */
+       /* Removing the Mapping Table Entry from the Modems list */
        modem->mapping_tbl =
                tcore_object_remove_mapping_tbl_entry(modem->mapping_tbl, hal);
 }
 
 void *tcore_server_get_cp_mapping_tbl(TcorePlugin *modem_plugin)
 {
-       Server *s;
        TcoreModem *modem;
 
        if (modem_plugin == NULL) {
@@ -926,174 +848,134 @@ void *tcore_server_get_cp_mapping_tbl(TcorePlugin *modem_plugin)
                return NULL;
        }
 
-       s = tcore_plugin_ref_server(modem_plugin);
-       if (s == NULL) {
-               err("server is NULL");
-               return NULL;
-       }
-
-       modem = __server_find_modem(s, NULL, modem_plugin);
+       modem = __get_modem(modem_plugin);
        if (modem == NULL) {
                err("Failed to find 'modem' for Modem Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(modem_plugin));
+                                       tcore_plugin_ref_plugin_name(modem_plugin));
                return NULL;
        }
 
        return modem->mapping_tbl;
 }
 
-void tcore_server_print_modems(TcorePlugin *plugin)
+void tcore_server_print_modems(Server *s)
 {
-       Server *s;
        TcoreModem *modem;
+       GSList *list;
 
-       if (plugin == NULL) {
-               err("Modem Interface is NULL");
-               return;
-       }
-
-       s = tcore_plugin_ref_server(plugin);
        if (s == NULL) {
-               err("server is NULL");
-               return;
-       }
-
-       modem = __server_find_modem(s, plugin, plugin);
-       if (modem == NULL) {
-               err("Failed to find 'modem' for Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(plugin));
+               err("Server is NULL");
                return;
        }
 
-       dbg("Modem Plug-in: [%s] Modem Interface Plug-in: [%s] - CP Name: [%s]",
-               tcore_plugin_ref_plugin_name(modem->modem_plugin),
-               tcore_plugin_ref_plugin_name(modem->modem_iface_plugin),
-               modem->cp_name);
+       for (list = s->modems ; list ; list = list->next) {
+               modem = list->data;
+               if (modem == NULL) {
+                       dbg("Modem is NULL");
+                       continue;
+               }
 
-       tcore_object_print_mapping_tbl(modem->mapping_tbl);
+               msg("Modem: [0x%x] CP Name: [%s]", modem, modem->cp_name);
+               msg("Modem Plug-in: [%s] <---> Modem Interface Plug-in: [%s]",
+                               tcore_plugin_ref_plugin_name(modem->modem_plugin),
+                               tcore_plugin_ref_plugin_name(modem->modem_iface_plugin));
+       }
 }
 
-TelReturn tcore_server_load_modem_plugin(Server *s,
-       TcorePlugin *modem_if_plugin, const gchar *name)
+TReturn tcore_server_load_modem_plugin(Server *s,
+                                       TcoreModem *modem,
+                                       const char *name)
 {
        struct tcore_plugin_define_desc *desc;
        TcorePlugin *modem_plugin;
-       gchar *filename;
+       char *filename = NULL;
        void *handle;
-       TelReturn ret = TEL_RETURN_FAILURE;
+       TReturn ret = TCORE_RETURN_FAILURE;
 
-       if ((s == NULL) || (name == NULL) || (modem_if_plugin == NULL)) {
-               err("s: [%p] name: [%s] modem_if_plugin: [%p]", s, name, modem_if_plugin);
-               return TEL_RETURN_INVALID_PARAMETER;
+       if ((s == NULL) || (modem == NULL) || (name == NULL)) {
+               err("Server: [%p] modem: [%p] Plug-in Name (.so): [%s] ",
+                                                                       s, modem, name);
+               ret = TCORE_RETURN_EINVAL;
+               goto out;
        }
 
        filename = g_build_filename(MODEMS_PATH, name, NULL);
 
-       /* Open .so */
-       handle = dlopen(filename, RTLD_NOW);
+       /* Open '.so' */
+       handle = dlopen(filename, RTLD_LAZY);
        if (handle == NULL) {
                err("Failed to load '%s': %s", filename, dlerror());
-
-               tcore_free(filename);
-               return ret;
+               goto out;
        }
 
-       /* Symbol 'plugin_define_desc' search */
        desc = dlsym(handle, "plugin_define_desc");
        if (desc == NULL) {
-               err("Failed to load symbol: %s", dlerror());
-
-               /* Close handle */
+               err("Failed to obtain the address of plugin_define_desc: %s", dlerror());
                dlclose(handle);
-
-               tcore_free(filename);
-               return ret;
+               goto out;
        }
-       dbg("Plugin '%s' found", desc->name);
+
+       dbg("Plugin %s found", desc->name);
 
        if (desc->load != NULL) {
                /* Load Modem Plug-in */
                if (desc->load() == FALSE) {
-                       err("Failed to load '%s' plugin", desc->name);
-
-                       /* Close handle */
+                       err("Failed to load %s plugin", desc->name);
                        dlclose(handle);
-
-                       tcore_free(filename);
-                       return ret;
+                       goto out;
                }
        }
 
-       /* Create new Modem Plug-in and update to corresponding 'modem's structure */
+       /* Create new Plug-in */
        modem_plugin = tcore_plugin_new(s, desc, filename, handle);
-       tcore_server_update_modem_plugin(modem_if_plugin, modem_plugin);
+       if (modem_plugin == NULL) {
+               err("Modem Plug-in is NULL");
+               dlclose(handle);
+               goto out;
+       }
+
+       /* Update Modem Plug-in to 'modem' */
+       modem->modem_plugin = modem_plugin;
+
        dbg("Plugin %s loaded successfully", desc->name);
 
        if (desc->init == NULL) {
-               err("Plugin '%s' has no initializer", desc->name);
-               goto OUT;
+               err("Plugin %s has no initializer", desc->name);
+               dlclose(handle);
+               goto out;
        }
 
        /* Initialize Modem Plug-in */
        if (desc->init(modem_plugin) == FALSE) {
                err("Plugin %s initialization failed", desc->name);
-               goto OUT;
+               dlclose(handle);
+               goto out;
        }
-       dbg("Plugin '%s' successfully initialized", desc->name);
-
-       /* Notify addition of Plug-in to Upper Layers */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_ADDED_MODEM_PLUGIN,
-               0, modem_plugin);
 
-       ret = TEL_RETURN_SUCCESS;
+       dbg("Plugin %s initialization success", desc->name);
 
-OUT:
-       tcore_free(filename);
-
-       if (ret != TEL_RETURN_SUCCESS) {
-               /* Unload Modem Plug-in */
-               if (desc->unload != NULL) {
-                       dbg("Unloading Modem Plug-in: [%s]",
-                               tcore_plugin_ref_plugin_name(modem_plugin));
-                       desc->unload(modem_plugin);
-               }
+       /* Notify addition of Plug-in to Upper Layers */
+       tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_MODEM_PLUGIN,
+                                                               0, modem_plugin);
 
-               /* Free Modem Plug-in and update the 'modem's structure */
-               tcore_server_update_modem_plugin(modem_if_plugin, NULL);
-               tcore_plugin_free(modem_plugin);
+       ret = TCORE_RETURN_SUCCESS;
 
-               /* Close handle */
-               dlclose(handle);
-       }
+out:
+       g_free(filename);
 
        return ret;
 }
 
-void tcore_server_unload_modem_plugin(Server *s, TcorePlugin *modem_if_plugin)
+void tcore_server_unload_modem_plugin(Server *s, TcoreModem *modem)
 {
-       TcoreModem *modem;
        TcorePlugin *modem_plugin;
        const struct tcore_plugin_define_desc *desc;
 
-       if ((s == NULL) || (modem_if_plugin == NULL)) {
-               err("s: [%p] modem_if_plugin: [%p]", s, modem_if_plugin);
+       if ((s == NULL) || (modem == NULL)) {
+               err("Server: [%p] modem: [%p]", s, modem);
                return;
        }
 
-       /* Find modem from Server's Modem's list */
-       modem = __server_find_modem(s, modem_if_plugin, modem_if_plugin);
-       if (modem == NULL) {
-               err("Failed to find 'modem' for Plug-in: [%s]",
-                       tcore_plugin_ref_plugin_name(modem_if_plugin));
-               return;
-       }
-
-       dbg("Modem Plug-in: [%s] Modem Interface Plug-in: [%s] - CP Name: [%s]",
-               tcore_plugin_ref_plugin_name(modem->modem_plugin),
-               tcore_plugin_ref_plugin_name(modem->modem_iface_plugin),
-               modem->cp_name);
-
        /* Extract Modem Plug-in */
        modem_plugin = modem->modem_plugin;
        if (modem_plugin == NULL) {
@@ -1101,10 +983,13 @@ void tcore_server_unload_modem_plugin(Server *s, TcorePlugin *modem_if_plugin)
                return;
        }
 
-       /* Notify deletion of Plug-in to Upper Layers */
-       tcore_server_send_server_notification(s,
-               TCORE_SERVER_NOTIFICATION_REMOVED_MODEM_PLUGIN,
-               0, modem_plugin);
+       msg("Modem Plug-in: [%s] <---> Modem Interface Plug-in: [%s] - CP Name: [%s]",
+                       tcore_plugin_ref_plugin_name(modem->modem_plugin),
+                       tcore_plugin_ref_plugin_name(modem->modem_iface_plugin), modem->cp_name);
+
+       /* Notify removal of Plug-in to Upper Layers */
+       tcore_server_send_notification(s, NULL, TNOTI_SERVER_REMOVED_MODEM_PLUGIN,
+                                                       0, modem_plugin);
 
        /* Extract descriptor of Modem Plug-in */
        desc = tcore_plugin_get_description(modem_plugin);
@@ -1112,14 +997,14 @@ void tcore_server_unload_modem_plugin(Server *s, TcorePlugin *modem_if_plugin)
                /* Unload Modem Plug-in */
                if (desc->unload != NULL) {
                        dbg("Unloading Modem Plug-in: [%s]",
-                               tcore_plugin_ref_plugin_name(modem_plugin));
+                                               tcore_plugin_ref_plugin_name(modem_plugin));
                        desc->unload(modem_plugin);
                }
        }
 
-       /* Free Modem Plug-in and update the 'modem's structure */
-       tcore_server_update_modem_plugin(modem_if_plugin, NULL);
+       /* Free Modem Plug-in */
        tcore_plugin_free(modem_plugin);
+       modem->modem_plugin = NULL;
 
        dbg("Unloaded Modem Plug-in");
 }
@@ -1132,11 +1017,19 @@ GSList *tcore_server_get_modem_plugin_list(Server *s)
 
        for (list = s->modems; list; list = list->next) {
                modem = list->data;
-               if (modem != NULL)
-                       if (NULL != modem->modem_plugin)
-                               modem_plugin_list =
-                                       g_slist_append(modem_plugin_list, modem->modem_plugin);
+               if (modem == NULL) {
+                       dbg("Modem is NULL");
+                       continue;
+               }
+               if (NULL != modem->modem_plugin) {
+                       modem_plugin_list = g_slist_append(modem_plugin_list, modem->modem_plugin);
+               }
        }
 
        return modem_plugin_list;
 }
+
+gint tcore_server_get_modems_count(Server *s)
+{
+       return g_slist_length(s->modems);
+}
index 3910672..a65aa6b 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "storage.h"
 
 struct tcore_storage_type {
-       char *name;
-       TcorePlugin *parent_plugin;
-
-       TcoreStorageOperations *ops;
+       const char *name;
+       struct storage_operations *ops;
        GHashTable *callback;
+
+       TcorePlugin *parent_plugin;
 };
 
-typedef struct {
+struct storage_callback_type{
        TcoreStorageKeyCallback cb_fn;
        void *user_data;
-} TcoreStorageCb;
+};
 
-TcoreStorage *tcore_storage_new(TcorePlugin *plugin,
-       const char *name, TcoreStorageOperations *ops)
+Storage *tcore_storage_new(TcorePlugin *plugin, const char *name,
+               struct storage_operations *ops)
 {
-       TcoreStorage *strg;
+       Storage *strg;
 
-       strg = tcore_malloc0(sizeof(TcoreStorage));
+       strg = calloc(1, sizeof(struct tcore_storage_type));
+       if (!strg)
+               return NULL;
 
        if (name)
-               strg->name = tcore_strdup(name);
+               strg->name = strdup(name);
 
        strg->parent_plugin = plugin;
        strg->ops = ops;
-       strg->callback =
-               g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+       strg->callback = g_hash_table_new_full(g_str_hash,g_str_equal, g_free, NULL);
 
        tcore_server_add_storage(tcore_plugin_ref_server(plugin), strg);
 
        return strg;
 }
 
-void tcore_storage_free(TcoreStorage *strg)
+void tcore_storage_free(Storage *strg)
 {
-       if (strg == NULL) {
-               err("Storage is NULL");
+       if (!strg)
                return;
-       }
 
-       tcore_free(strg->name);
-       tcore_free(strg);
+       if (strg->name)
+               free((void *)strg->name);
+
+       free(strg);
 }
 
-const char *tcore_storage_ref_name(TcoreStorage *strg)
+const char *tcore_storage_ref_name(Storage *strg)
 {
-       if (strg == NULL) {
-               err("Storage is NULL");
+       if (!strg)
                return NULL;
-       }
 
-       return (const char *)strg->name;
+       return strg->name;
 }
 
-void *tcore_storage_create_handle(TcoreStorage *strg, const char *path)
+void *tcore_storage_create_handle(Storage *strg, const char *path)
 {
-       if (path == NULL) {
-               err("path is NULL");
+       if (!path)
                return NULL;
-       }
 
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->create_handle == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->create_handle: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->create_handle : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->create_handle) {
                return NULL;
        }
 
        return strg->ops->create_handle(strg, path);
 }
 
-gboolean tcore_storage_remove_handle(TcoreStorage *strg, void *handle)
+gboolean tcore_storage_remove_handle(Storage *strg, void *handle)
 {
-       if (handle == NULL) {
-               err("handle is NULL");
+       if (!handle)
                return FALSE;
-       }
 
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->remove_handle == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->remove_handle: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->remove_handle : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->remove_handle) {
                return FALSE;
        }
 
        return strg->ops->remove_handle(strg, handle);
 }
 
-gboolean tcore_storage_set_int(TcoreStorage *strg,
-       TcoreStorageKey key, int value)
+gboolean tcore_storage_set_int(Storage *strg, enum tcore_storage_key key,
+               int value)
 {
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->set_int == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->set_int: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->set_int : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->set_int) {
                return FALSE;
        }
 
        return strg->ops->set_int(strg, key, value);
 }
 
-gboolean tcore_storage_set_string(TcoreStorage *strg,
-       TcoreStorageKey key, const char *value)
+gboolean tcore_storage_set_string(Storage *strg, enum tcore_storage_key key,
+               const char *value)
 {
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->set_string == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->set_string: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->set_string : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->set_string) {
                return FALSE;
        }
 
        return strg->ops->set_string(strg, key, value);
 }
 
-gboolean tcore_storage_set_bool(TcoreStorage *strg,
-       TcoreStorageKey key, gboolean value)
+gboolean tcore_storage_set_bool(Storage *strg, enum tcore_storage_key key,
+               gboolean value)
 {
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->set_bool == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->set_bool: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->set_bool : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->set_bool) {
                return FALSE;
        }
 
        return strg->ops->set_bool(strg, key, value);
 }
 
-int tcore_storage_get_int(TcoreStorage *strg, TcoreStorageKey key)
+int tcore_storage_get_int(Storage *strg, enum tcore_storage_key key)
 {
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->get_int == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->get_int: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->get_int : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->get_int) {
                return -1;
        }
 
        return strg->ops->get_int(strg, key);
 }
 
-char *tcore_storage_get_string(TcoreStorage *strg, TcoreStorageKey key)
+char *tcore_storage_get_string(Storage *strg, enum tcore_storage_key key)
 {
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->get_string == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->get_string: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->get_string : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->get_string) {
                return NULL;
        }
 
        return strg->ops->get_string(strg, key);
 }
 
-gboolean tcore_storage_get_bool(TcoreStorage *strg, TcoreStorageKey key)
+gboolean tcore_storage_get_bool(Storage *strg, enum tcore_storage_key key)
 {
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->get_bool == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->get_bool: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->get_bool : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->get_bool) {
                return FALSE;
        }
 
        return strg->ops->get_bool(strg, key);
 }
 
-static void tcore_storage_vkey_callback_dispatcher(TcoreStorage *strg,
-               TcoreStorageKey key, void *value)
+static void tcore_storage_vkey_callback_dispatcher(Storage *strg,
+               enum tcore_storage_key key, void *value)
 {
        gchar *key_gen = NULL;
-       gpointer hash_node = NULL;
+       GSList *cb_data = NULL;
+       struct storage_callback_type *tmp_cb = NULL;
 
        key_gen = g_strdup_printf("%d", key);
+       if (!key_gen)
+               return;
 
-       /* Lookup for 'key' callback list node in Hash table */
-       hash_node = g_hash_table_lookup(strg->callback, key_gen);
-       if (hash_node != NULL) {
-               GSList *cb_list = (GSList *)hash_node;
-               TcoreStorageCb *cb_node;
-
-               do {
-                       cb_node = cb_list->data;
-                       if (cb_node && cb_node->cb_fn)
-                               cb_node->cb_fn(key, value, cb_node->user_data);
+       cb_data = g_hash_table_lookup(strg->callback, key_gen);
+       while (cb_data) {
+               tmp_cb = cb_data->data;
+               if (tmp_cb)
+                       if (tmp_cb->cb_fn)
+                               tmp_cb->cb_fn(key, value, tmp_cb->user_data);
 
-                       cb_list = g_slist_next(cb_list);
-               } while (cb_list != NULL);
+               cb_data = g_slist_next(cb_data);
        }
 
-       tcore_free(key_gen);
+       g_free(key_gen);
 }
 
-gboolean tcore_storage_set_key_callback(TcoreStorage *strg,
-       TcoreStorageKey key, TcoreStorageKeyCallback cb, void *user_data)
+gboolean tcore_storage_set_key_callback(Storage *strg,
+               enum tcore_storage_key key, TcoreStorageKeyCallback cb, void *user_data)
 {
-       gpointer hash_node = NULL;
+       gpointer tmp = NULL;
        gchar *key_gen = NULL;
-       TcoreStorageCb *strg_cb_data = NULL;
+       struct storage_callback_type *strg_cb_data = NULL;
+       struct storage_callback_type *tmp_cb = NULL;
 
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->set_key_callback == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->set_key_callback: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->set_key_callback : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->set_key_callback)
+       {
                return FALSE;
        }
 
-       /* Create callback node */
-       strg_cb_data = tcore_malloc0(sizeof(TcoreStorageCb));
+       strg_cb_data = g_new0(struct storage_callback_type, 1);
        strg_cb_data->cb_fn = cb;
        strg_cb_data->user_data = user_data;
 
        key_gen = g_strdup_printf("%d", key);
-
-       /* Lookup for 'key' callback list node in Hash table */
-       hash_node = g_hash_table_lookup(strg->callback, key_gen);
-       if (hash_node != NULL) {
-               /*
-                * There is a 'value' (hash_node) previously added
-                * for the 'key'.
-                *
-                * 'callback' is appended to the list of callbacks if it doesn;t
-                * match any of the previously added 'callbacks' for the 'key'.
-                */
-               GSList *cb_list = (GSList *)hash_node;
-               TcoreStorageCb *cb_node = NULL;
-
-               do {
-                       cb_node = cb_list->data;
-                       if (cb_node && (cb_node->cb_fn == cb)) {
-                               tcore_free(key_gen);
-                               tcore_free(strg_cb_data);
-                               return FALSE;
+       tmp = g_hash_table_lookup(strg->callback, key_gen);
+       if (tmp != NULL) {
+               GSList *cb_data = tmp;
+
+               while (cb_data) {
+                       tmp_cb = cb_data->data;
+                       if (tmp_cb) {
+                               if ((tmp_cb->cb_fn == cb)
+                                               && (tmp_cb->user_data == user_data)) {
+                                       g_free(key_gen);
+                                       g_free(strg_cb_data);
+                                       return FALSE;
+                               }
                        }
-                       cb_list = g_slist_next(cb_list);
-               } while (cb_list);
 
-               /* Append additional callback to same 'key' in Hash table */
-               hash_node = g_slist_append((GSList *)hash_node, strg_cb_data);
-               dbg("Hash node", hash_node);
+                       cb_data = g_slist_next(cb_data);
+               }
+
+               tmp = g_slist_append(tmp, strg_cb_data);
+               g_hash_table_replace(strg->callback, g_strdup(key_gen), tmp);
        }
        else {
-               /*
-                * There is no 'value' (hash_node) previously added
-                * for the 'key'.
-                */
                GSList *data = NULL;
                data = g_slist_append(data, strg_cb_data);
-
-               /* Add first entry to Hash table for 'key' */
-               g_hash_table_insert(strg->callback, tcore_strdup(key_gen), data);
-
-               /* Set Key callback dispatcher */
-               strg->ops->set_key_callback(strg,
-                       key, tcore_storage_vkey_callback_dispatcher);
+               g_hash_table_insert(strg->callback, g_strdup(key_gen), data);
+               strg->ops->set_key_callback(strg, key, tcore_storage_vkey_callback_dispatcher);
        }
 
-       tcore_free(key_gen);
+       g_free(key_gen);
        return TRUE;
 }
 
-gboolean tcore_storage_remove_key_callback(TcoreStorage *strg,
-               TcoreStorageKey key, TcoreStorageKeyCallback cb)
+gboolean tcore_storage_remove_key_callback(Storage *strg,
+               enum tcore_storage_key key, TcoreStorageKeyCallback cb)
 {
-       gpointer hash_node = NULL;
+       GSList *tmp = NULL;
        gchar *key_gen = NULL;
-       GSList *cb_list = NULL;
+       GSList *cb_data = NULL;
        int cb_cnt = 0;
-       TcoreStorageCb *cb_node = NULL;
+       struct storage_callback_type *tmp_cb = NULL;
 
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->remove_key_callback == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->remove_key_callback: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->remove_key_callback : NULL) : NULL));
+       if (!strg || !strg->ops || !strg->ops->remove_key_callback) {
                return FALSE;
        }
 
        key_gen = g_strdup_printf("%d", key);
-
-       /* Lookup for 'key' callback list node in Hash table */
-       hash_node = g_hash_table_lookup(strg->callback, key_gen);
-       if (hash_node == NULL) {
-               tcore_free(key_gen);
+       tmp = g_hash_table_lookup(strg->callback, key_gen);
+       if (tmp == NULL){
+               g_free(key_gen);
                return FALSE;
        }
 
-       cb_list = (GSList *)hash_node;
-       do {
-               cb_node = cb_list->data;
-               if (cb_node && (cb_node->cb_fn == cb)) {
-                       hash_node = g_slist_remove((GSList *) hash_node, cb_node);
-                       tcore_free(cb_node);
-                       break;
+       cb_data = tmp;
+       while (cb_data) {
+               tmp_cb = cb_data->data;
+               if (tmp_cb) {
+                       if (tmp_cb->cb_fn == cb) {
+                               tmp = g_slist_remove(tmp, tmp_cb);
+                               g_free(tmp_cb);
+                               break;
+                       }
                }
-               cb_list = g_slist_next(cb_list);
-       } while (cb_list);
 
-       cb_cnt = g_slist_length((GSList *) hash_node);
-       dbg("Callback list count: [%d]", cb_cnt);
+               cb_data = g_slist_next(cb_data);
+       }
+
+       cb_cnt = g_slist_length(tmp);
+       dbg("glist cnt (%d)", cb_cnt);
+
        if (cb_cnt == 0) {
-               /*
-                * No more callbacks registered for 'key',
-                * remove callback list node from Hash table.
-                */
                g_hash_table_remove(strg->callback, key_gen);
                strg->ops->remove_key_callback(strg, key);
        }
 
-       tcore_free(key_gen);
+       g_free(key_gen);
        return TRUE;
 }
 
-gboolean tcore_storage_update_query_database(TcoreStorage *strg,
-       void *handle, const char *query, GHashTable *in_param)
+gboolean tcore_storage_update_query_database(Storage *strg, void *handle,
+               const char *query, GHashTable *in_param)
 {
-       if ((strg == NULL) || (handle == NULL) || (query == NULL)) {
-               err("Storage: [%p] handle: [%p] query: [%p]", strg, handle, query);
+       if (!strg || !handle || !query)
                return FALSE;
-       }
 
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->update_query_database == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->update_query_database: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->update_query_database : NULL) : NULL));
+       if (!strg->ops || !strg->ops->update_query_database) {
                return FALSE;
        }
 
        return strg->ops->update_query_database(strg, handle, query, in_param);
 }
 
-gboolean tcore_storage_read_query_database(TcoreStorage *strg,
-       void *handle, const char *query, GHashTable *in_param,
-       GHashTable *out_param, int out_param_cnt)
+gboolean tcore_storage_read_query_database(Storage *strg, void *handle,
+               const char *query, GHashTable *in_param,
+               GHashTable *out_param, int out_param_cnt)
 {
-       if ((strg == NULL) || (handle == NULL) || (query == NULL)) {
-               err("Storage: [%p] handle: [%p] query: [%p]", strg, handle, query);
+       if (!strg || !handle || !query)
                return FALSE;
-       }
 
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->read_query_database == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->read_query_database: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->read_query_database : NULL) : NULL));
+       if (!strg->ops || !strg->ops->read_query_database) {
                return FALSE;
        }
 
@@ -386,38 +311,26 @@ gboolean tcore_storage_read_query_database(TcoreStorage *strg,
                        in_param, out_param, out_param_cnt);
 }
 
-gboolean tcore_storage_insert_query_database(TcoreStorage *strg,
-       void *handle, const char *query, GHashTable *in_param)
+gboolean tcore_storage_insert_query_database(Storage *strg, void *handle,
+               const char *query, GHashTable *in_param)
 {
-       if ((strg == NULL) || (handle == NULL) || (query == NULL)) {
-               err("Storage: [%p] handle: [%p] query: [%p]", strg, handle, query);
+       if (!strg || !handle || !query)
                return FALSE;
-       }
 
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->insert_query_database == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->insert_query_database: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->insert_query_database : NULL) : NULL));
+       if (!strg->ops || !strg->ops->insert_query_database) {
                return FALSE;
        }
 
        return strg->ops->insert_query_database(strg, handle, query, in_param);
 }
 
-gboolean tcore_storage_remove_query_database(TcoreStorage *strg,
-       void *handle, const char *query, GHashTable *in_param)
+gboolean tcore_storage_remove_query_database(Storage *strg, void *handle,
+               const char *query, GHashTable *in_param)
 {
-       if ((strg == NULL) || (handle == NULL) || (query == NULL)) {
-               err("Storage: [%p] handle: [%p] query: [%p]", strg, handle, query);
+       if (!strg || !handle || !query)
                return FALSE;
-       }
 
-       if ((strg == NULL) || (strg->ops == NULL)
-                       || (strg->ops->remove_query_database == NULL)) {
-               err("strg: [%p] strg->ops: [%p] strg->ops->remove_query_database: [%p]",
-                       strg, (strg ? strg->ops : NULL), (strg ? (strg->ops ?
-                       strg->ops->remove_query_database : NULL) : NULL));
+       if (!strg->ops || !strg->ops->remove_query_database) {
                return FALSE;
        }
 
diff --git a/src/udev.c b/src/udev.c
deleted file mode 100644 (file)
index 125dd64..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * libtcore
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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 <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#include "tcore.h"
-#include "udev.h"
-
-struct tcore_udev_type {
-       Server *server;
-
-       GUdevClient *client;
-       GUdevEnumerator *enumer;
-       GSList *enumer_callbacks;
-       GSList *callbacks;
-};
-
-struct udev_enumer_callback_type {
-       TcoreUdevEnumerCallback func;
-       void *user_data;
-};
-
-struct udev_callback_type {
-       TcoreUdevCallback func;
-       char *subsystem;
-       char *action;
-       void *user_data;
-};
-
-static const gchar *_default_subsystems[] = { NULL, };
-
-static void _on_uevent(GUdevClient *client, gchar *action, GUdevDevice *device, gpointer user_data)
-{
-       TcoreUdev *udev = user_data;
-       GSList *cb = NULL;
-       struct udev_callback_type *node;
-
-       if (!udev)
-               return;
-
-       dbg("action = '%s'", action);
-
-       for (cb = udev->callbacks; cb; cb = cb->next) {
-               node = cb->data;
-               if (!node)
-                       continue;
-
-               if (node->action)
-                       if (g_strcmp0(node->action, action) != 0)
-                               continue;
-
-               if (node->subsystem)
-                       if (g_strcmp0(node->subsystem, g_udev_device_get_subsystem(device)) != 0)
-                               continue;
-
-               if (!node->func)
-                       continue;
-
-               node->func(udev, device, node->user_data);
-       }
-}
-
-TcoreUdev *tcore_udev_new(Server *s, const gchar **subsystems)
-{
-       TcoreUdev *udev;
-
-       udev = calloc(1, sizeof(struct tcore_udev_type));
-       if (!udev)
-               return NULL;
-
-       if (!subsystems) {
-               subsystems = _default_subsystems;
-       }
-
-       udev->server = s;
-       udev->client = g_udev_client_new(subsystems);
-       if (!udev->client) {
-               free(udev);
-               return NULL;
-       }
-
-       g_signal_connect(udev->client, "uevent", G_CALLBACK(_on_uevent), udev);
-
-       udev->enumer = g_udev_enumerator_new(udev->client);
-
-       return udev;
-}
-
-void tcore_udev_free(TcoreUdev *udev)
-{
-       if (!udev)
-               return;
-
-       if (udev->client)
-               g_object_unref(udev->client);
-
-       if (udev->enumer)
-               g_object_unref(udev->enumer);
-
-       free(udev);
-}
-
-Server *tcore_udev_ref_server(TcoreUdev *udev)
-{
-       if (!udev)
-               return NULL;
-
-       return udev->server;
-}
-
-GUdevClient *tcore_udev_ref_client(TcoreUdev *udev)
-{
-       if (!udev)
-               return NULL;
-
-       return udev->client;
-}
-
-GUdevEnumerator *tcore_udev_ref_enumerator(TcoreUdev *udev)
-{
-       if (!udev)
-               return NULL;
-
-       return udev->enumer;
-}
-
-TReturn tcore_udev_add_enumerator_callback(TcoreUdev *udev, TcoreUdevEnumerCallback func, void *user_data)
-{
-       struct udev_enumer_callback_type *node;
-
-       if (!udev || !func)
-               return TCORE_RETURN_FAILURE;
-
-       node = calloc(1, sizeof(struct udev_enumer_callback_type));
-       if (!node)
-               return TCORE_RETURN_ENOMEM;
-
-       node->func = func;
-       node->user_data = user_data;
-
-       udev->enumer_callbacks = g_slist_append(udev->enumer_callbacks, node);
-
-       return TCORE_RETURN_SUCCESS;
-}
-
-GList *tcore_udev_exec_enumerator(TcoreUdev *udev, gboolean event_emit_flag)
-{
-       GList *list = NULL;
-       GSList *cb = NULL;
-       struct udev_enumer_callback_type *node;
-
-       if (!udev) {
-               return NULL;
-       }
-
-       list = g_udev_enumerator_execute(udev->enumer);
-       if (!list) {
-               return NULL;
-       }
-
-       if (event_emit_flag == FALSE)
-               return list;
-
-       for (cb = udev->enumer_callbacks; cb; cb = cb->next) {
-               node = cb->data;
-               if (!node) {
-                       continue;
-               }
-
-               if (!node->func)
-                       continue;
-
-               node->func(udev, list, node->user_data);
-       }
-
-       return list;
-}
-
-TReturn tcore_udev_add_callback(TcoreUdev *udev, const char *subsystem, const char *action, TcoreUdevCallback func, void *user_data)
-{
-       struct udev_callback_type *node;
-
-       if (!udev || !func)
-               return TCORE_RETURN_FAILURE;
-
-       node = calloc(1, sizeof(struct udev_callback_type));
-       if (!node)
-               return TCORE_RETURN_ENOMEM;
-
-       node->func = func;
-       node->user_data = user_data;
-
-       if (subsystem)
-               node->subsystem = strdup(subsystem);
-
-       if (action)
-               node->action = strdup(action);
-
-       udev->callbacks = g_slist_append(udev->callbacks, node);
-
-       dbg("subsystem = [%s]", node->subsystem);
-       dbg("action = [%s]", node->action);
-       dbg("callbacks length = %d", g_slist_length(udev->callbacks));
-
-       return TCORE_RETURN_SUCCESS;
-}
-
diff --git a/src/user_request.c b/src/user_request.c
new file mode 100644 (file)
index 0000000..5d7f27c
--- /dev/null
@@ -0,0 +1,334 @@
+/*
+ * libtcore
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include "tcore.h"
+#include "user_request.h"
+#include "communicator.h"
+
+struct tcore_user_request_type {
+       int ref;
+
+       /* Communicator information */
+       void *user_info;
+       Communicator *comm;
+
+       char *modem_name;
+
+       enum tcore_request_command command;
+
+       void *data;
+       unsigned int data_len;
+
+       void *metainfo;
+       unsigned int metainfo_len;
+
+       UserRequestFreeHook free_hook;
+       GSList *response_hook;
+};
+
+struct hook_response_type {
+       UserRequestResponseHook func;
+       void *user_data;
+};
+
+UserRequest *tcore_user_request_new(Communicator *comm, const char *modem_name)
+{
+       UserRequest *ur;
+
+       ur = calloc(1, sizeof(struct tcore_user_request_type));
+       if (!ur)
+               return NULL;
+
+       ur->comm = comm;
+
+       if (modem_name)
+               ur->modem_name = strdup(modem_name);
+       else
+               ur->modem_name = NULL;
+
+       return ur;
+}
+
+void tcore_user_request_free(UserRequest *ur)
+{
+       if (!ur)
+               return;
+
+       if (ur->ref > 0) {
+               ur->ref--;
+               return;
+       }
+
+       g_slist_free_full(ur->response_hook, free);
+
+       if (ur->free_hook)
+               ur->free_hook(ur);
+
+       if (ur->modem_name)
+               free(ur->modem_name);
+
+       if (ur->data)
+               free(ur->data);
+
+       if(ur->metainfo)
+               free(ur->metainfo);
+
+       dbg("user_request(0x%x) free.", (unsigned int)ur);
+
+       free(ur);
+}
+
+UserRequest *tcore_user_request_ref(UserRequest *ur)
+{
+       if (!ur)
+               return NULL;
+
+       ur->ref++;
+
+       return ur;
+}
+
+void tcore_user_request_unref(UserRequest *ur)
+{
+       if (!ur)
+               return;
+
+       if (ur->ref > 0)
+               ur->ref--;
+       else
+               tcore_user_request_free(ur);
+
+       return;
+}
+
+TReturn tcore_user_request_set_free_hook(UserRequest *ur,
+               UserRequestFreeHook free_hook)
+{
+       if (!ur)
+               return TCORE_RETURN_EINVAL;
+
+       ur->free_hook = free_hook;
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_user_request_set_response_hook(UserRequest *ur,
+               UserRequestResponseHook resp_hook, void *user_data)
+{
+       struct hook_response_type *hook;
+
+       if (!ur)
+               return TCORE_RETURN_EINVAL;
+
+       hook = calloc(1, sizeof(struct hook_response_type));
+       if (!hook)
+               return TCORE_RETURN_ENOMEM;
+
+       hook->func = resp_hook;
+       hook->user_data = user_data;
+
+       ur->response_hook = g_slist_append(ur->response_hook, hook);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+Communicator *tcore_user_request_ref_communicator(UserRequest *ur)
+{
+       if (!ur)
+               return NULL;
+
+       return ur->comm;
+}
+
+char *tcore_user_request_get_modem_name(UserRequest *ur)
+{
+       if (!ur)
+               return NULL;
+
+       if (!ur->modem_name)
+               return NULL;
+
+       return strdup(ur->modem_name);
+}
+
+TReturn tcore_user_request_set_user_info(UserRequest *ur, void *user_info)
+{
+       if (!ur)
+               return TCORE_RETURN_EINVAL;
+
+       ur->user_info = user_info;
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+void *tcore_user_request_ref_user_info(UserRequest *ur)
+{
+       if (!ur)
+               return NULL;
+
+       return ur->user_info;
+}
+
+TReturn tcore_user_request_send_response(UserRequest *ur,
+               enum tcore_response_command command,
+               unsigned int data_len, const void *data)
+{
+       GSList *list;
+       struct hook_response_type *hook;
+
+       if (!ur) {
+               dbg("ur is NULL");
+               return TCORE_RETURN_EINVAL;
+       }
+
+       for (list = ur->response_hook; list;) {
+               hook = list->data;
+               list = list->next;
+
+               if (!hook) {
+                       continue;
+               }
+
+               if (hook->func)
+                       hook->func(ur, command, data_len, data, hook->user_data);
+       }
+
+       if (ur->comm) {
+               return tcore_communicator_send_response(ur->comm, ur,
+                               command, data_len, data);
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_user_request_set_command(UserRequest *ur,
+               enum tcore_request_command command)
+{
+       if (!ur)
+               return TCORE_RETURN_EINVAL;
+
+       ur->command = command;
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+enum tcore_request_command tcore_user_request_get_command(UserRequest *ur)
+{
+       if (!ur)
+               return 0;
+
+       return ur->command;
+}
+
+TReturn tcore_user_request_set_data(UserRequest *ur,
+               unsigned int data_len, const void *data)
+{
+       if (!ur)
+               return TCORE_RETURN_EINVAL;
+
+       if (ur->data != NULL) {
+               free(ur->data);
+               ur->data = NULL;
+       }
+
+       ur->data_len = data_len;
+
+       if (data_len > 0) {
+               if (data != NULL) {
+                       ur->data = calloc(data_len, 1);
+                       if (!ur->data) {
+                               ur->data_len = 0;
+                               return TCORE_RETURN_ENOMEM;
+                       }
+
+                       memcpy(ur->data, data, data_len);
+               }
+               else
+                       ur->data_len = 0;
+       }
+       else {
+               ur->data = NULL;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+TReturn tcore_user_request_set_metainfo(UserRequest *ur,
+               unsigned int metainfo_len, const void *metainfo)
+{
+       if (!ur)
+               return TCORE_RETURN_EINVAL;
+
+       if (ur->metainfo != NULL) {
+               free(ur->metainfo);
+               ur->metainfo = NULL;
+       }
+
+       ur->metainfo_len = metainfo_len;
+
+       if (metainfo_len > 0) {
+               if (metainfo != NULL) {
+                       ur->metainfo = calloc(metainfo_len, 1);
+                       if (!ur->metainfo) {
+                               ur->metainfo_len = 0;
+                               return TCORE_RETURN_ENOMEM;
+                       }
+
+                       memcpy(ur->metainfo, metainfo, metainfo_len);
+               }
+               else
+                       ur->metainfo_len = 0;
+       }
+       else {
+               ur->metainfo = NULL;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+const void *tcore_user_request_ref_data(UserRequest *ur,
+               unsigned int *data_len)
+{
+       if (!ur)
+               return NULL;
+
+       if (data_len)
+               *data_len = ur->data_len;
+
+       return ur->data;
+}
+
+const void *tcore_user_request_ref_metainfo(UserRequest *ur,
+               unsigned int *metainfo_len)
+{
+       if (!ur)
+               return NULL;
+
+       if (metainfo_len)
+               *metainfo_len = ur->metainfo_len;
+
+       return ur->metainfo;
+}
old mode 100755 (executable)
new mode 100644 (file)
index c4e5b62..ee86eba
@@ -1,8 +1,9 @@
 /*
  * libtcore
  *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +21,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <unistd.h>
 
 #include <net/if.h>
 #include "tcore.h"
 #include "util.h"
 
-#define TEXT_STRING_LEN_MAX                    512
 
-/* Unicode table lengths */
-#define GSM_UNICODE2_TABLE_LEN_MAX             9
-#define GSM_UNICODE_TABLE_LEN_MAX              42
+#define        tabGsmUniMax2 9
+#define        tabGsmUniMax 42
 
-#define convert_to_hex(in, out)        (in <= 9) ? \
-       (out = '0' + in) : (out = 'A' + in - 10)
+gboolean tcore_debug = TRUE;
 
-                       /* EF-SMSP digit length */
+static gboolean                _find_gsm_code_exception_table(unsigned short src);
+static int             _get_gsm_code_size(unsigned short* src, int src_len);
+static gboolean                _convert_gsm_to_unicode(unsigned short *dest, int dest_len, unsigned char *src, unsigned int src_len);
+static int                     _convert_gsm_to_ucs2(unsigned short* dest, unsigned char* src, unsigned int src_len);
+static void            _convert_gsm_to_utf8(unsigned char *dest, unsigned short *dest_len,     unsigned char *src, unsigned int src_len);
+static gboolean                _convert_unicode_to_gsm(unsigned char* dest, int dest_len, unsigned short* src, int src_len);
+static char*           _convert_ucs_to_utf8(unsigned char *src, int src_len);
+static int                     _convert_ucs2_to_gsm(unsigned char* dest, unsigned short* src, unsigned int src_len);
+static void            _convert_alpha_field_ucs2_to_utf8(unsigned char *out, unsigned short *out_len, unsigned char *in, unsigned short in_len);
+static int                     _convert_utf8_to_unicode(unsigned short* dest, unsigned char* src, unsigned int src_len);
 
-#define MAX_GSM_SMS_PARAM_RECORD_SIZE          156             /* Maximum number of bytes SMSP Record size (Y + 28), y : 0 ~ 128 */
+typedef struct {
+       char gsm;
+       unsigned short unicode;
+} GsmUniTable;
 
-#define SMS_SMSP_PARAMS_MAX_LEN        28
-#define SMS_SMSP_ALPHA_ID_LEN_MAX      128     /* EF-SMSP alpha id length */
-#define SMS_SMSP_DEST_ADDRESS_LEN      12      /* EF-SMSP Destination Address length */
-#define SMS_SMSP_ADDRESS_LEN   20      /* EF-SMSP digit length */
+const GsmUniTable gsm_unicode2_table[] = {
+               { 0x14, 0x005E }, { 0x28, 0x007B }, { 0x29, 0x007D }, { 0x2F, 0x005C },
+               { 0x3C, 0x005B }, { 0x3D, 0x007E }, { 0x3E, 0x005D }, { 0x40, 0x007C },
+               { 0x65, 0x20AC } };
 
-#define SMS_DEFAULT_SMSP_WITHOUT_ALPHAID       28
+const GsmUniTable gsm_unicode_table[] = {
+               { 0x00, 0x0040 }, { 0x01, 0x00A3 }, { 0x02, 0x0024 }, { 0x03, 0x00A5 },
+               { 0x04, 0x00E8 }, { 0x05, 0x00E9 }, { 0x06, 0x00F9 }, { 0x07, 0x00EC }, { 0x08, 0x00F2 },
+               { 0x09, 0x00E7 }, { 0x0B, 0x00D8 }, { 0x0C, 0x00F8 }, { 0x0E, 0x00C5 }, { 0x0F, 0x00E5 },
+               { 0x10, 0x0394 }, { 0x11, 0x005F }, { 0x12, 0x03A6 }, { 0x13, 0x0393 }, { 0x14, 0x039B },
+               { 0x15, 0x03A9 }, { 0x16, 0x03A0 }, { 0x17, 0x03A8 }, { 0x18, 0x03A3 }, { 0x19, 0x0398 },
+               { 0x1A, 0x039E }, { 0x1C, 0x00C6 }, { 0x1D, 0x00E6 }, { 0x1E, 0x00DF }, { 0x1F, 0x00C9 },
+               { 0x24, 0x00A4 }, { 0x40, 0x00A1 }, { 0x5B, 0x00C4 }, { 0x5C, 0x00D6 }, { 0x5D, 0x00D1 },
+               { 0x5E, 0x00DC }, { 0x5F, 0x00A7 }, { 0x60, 0x00BF }, { 0x7B, 0x00E4 }, { 0x7C, 0x00F6 },
+               { 0x7D, 0x00F1 }, { 0x7E, 0x00FC }, { 0x7F, 0x00E0 }, };
 
-#define SMS_SMSP_SCA_ADDRESS   0x02
-#define SMS_SMSP_VP 0x10
 
-#define SMS_SCA_ADDR_OFFSET 12
-#define SMS_VP_OFFSET 27
 
-#define MAX_GSM_SMS_PARAM_RECORD_SIZE   156
 
-typedef struct {
-       gchar gsm;
-       gushort unicode;
-} TelUtilGsmUnicodeTable;
-
-/* GSM Unicode Table */
-const TelUtilGsmUnicodeTable gsm_unicode_table[] = {
-       { 0x00, 0x0040 }, { 0x01, 0x00A3 }, { 0x02, 0x0024 }, { 0x03, 0x00A5 },
-       { 0x04, 0x00E8 }, { 0x05, 0x00E9 }, { 0x06, 0x00F9 }, { 0x07, 0x00EC },
-       { 0x08, 0x00F2 }, { 0x09, 0x00E7 }, { 0x0B, 0x00D8 }, { 0x0C, 0x00F8 },
-       { 0x0E, 0x00C5 }, { 0x0F, 0x00E5 }, { 0x10, 0x0394 }, { 0x11, 0x005F },
-       { 0x12, 0x03A6 }, { 0x13, 0x0393 }, { 0x14, 0x039B }, { 0x15, 0x03A9 },
-       { 0x16, 0x03A0 }, { 0x17, 0x03A8 }, { 0x18, 0x03A3 }, { 0x19, 0x0398 },
-       { 0x1A, 0x039E }, { 0x1C, 0x00C6 }, { 0x1D, 0x00E6 }, { 0x1E, 0x00DF },
-       { 0x1F, 0x00C9 }, { 0x24, 0x00A4 }, { 0x40, 0x00A1 }, { 0x5B, 0x00C4 },
-       { 0x5C, 0x00D6 }, { 0x5D, 0x00D1 }, { 0x5E, 0x00DC }, { 0x5F, 0x00A7 },
-       { 0x60, 0x00BF }, { 0x7B, 0x00E4 }, { 0x7C, 0x00F6 }, { 0x7D, 0x00F1 },
-       { 0x7E, 0x00FC }, { 0x7F, 0x00E0 },
-};
-
-/* GSM Unicode2 Table */
-const TelUtilGsmUnicodeTable gsm_unicode2_table[] = {
-       { 0x14, 0x005E }, { 0x28, 0x007B }, { 0x29, 0x007D }, { 0x2F, 0x005C },
-       { 0x3C, 0x005B }, { 0x3D, 0x007E }, { 0x3E, 0x005D }, { 0x40, 0x007C },
-       { 0x65, 0x20AC }
-};
-
-
-
-/* Internal APIs */
-static gboolean __find_gsm_code_exception_table(gushort src)
+static gboolean _find_gsm_code_exception_table(unsigned short src)
 {
        if ((src >= 0x0020 && src <= 0x0023)
                        || (src >= 0x0025 && src <= 0x003F)
@@ -102,31 +85,28 @@ static gboolean __find_gsm_code_exception_table(gushort src)
                        || (src >= 0x0061 && src <= 0x007A)
                        || src == 0x000A || src == 0x000D)
                return TRUE;
-
        return FALSE;
 }
 
-static int __get_gsm_code_size(gushort *src, guint src_len)
+static int _get_gsm_code_size(unsigned short* src, int src_len)
 {
        gboolean in_table = FALSE;
        gboolean in_sec_table = FALSE;
-       gint gsm_len = 0;
-       guint i;
+       int i, gsm_len = 0;
 
        if (NULL == src) {
-               dbg("INPUT PARAM was NULL");
+               dbg( "INPUT PARAM was NULL");
                return -1;
        }
 
        for (; src_len > 0 && src; src_len--) {
-               if (__find_gsm_code_exception_table(*src) == TRUE) {
+               if (_find_gsm_code_exception_table(*src) == TRUE) {
                        src++;
                        gsm_len++;
                        continue;
                }
-
                in_table = FALSE;
-               for (i = 0; i < GSM_UNICODE_TABLE_LEN_MAX; i++) {
+               for (i = 0; i < tabGsmUniMax; i++) {
                        if (*src == gsm_unicode_table[i].unicode) {
                                src++;
                                in_table = TRUE;
@@ -134,10 +114,9 @@ static int __get_gsm_code_size(gushort *src, guint src_len)
                                break;
                        }
                }
-
                if (in_table == FALSE) {
                        in_sec_table = FALSE;
-                       for (i = 0; i < GSM_UNICODE2_TABLE_LEN_MAX; i++) {/* second table */
+                       for (i = 0; i < tabGsmUniMax2; i++) {/* second table */
                                if (*src == gsm_unicode2_table[i].unicode) {
                                        src++;
                                        in_table = TRUE;
@@ -146,10 +125,9 @@ static int __get_gsm_code_size(gushort *src, guint src_len)
                                        break;
                                }
                        }
-
                        if (in_sec_table == FALSE) {/* second*/
-                               if (__find_gsm_code_exception_table(*src) == FALSE) {
-                                       dbg("GSM Char[%d], gsm_len[%d]", *src, gsm_len);
+                               if (_find_gsm_code_exception_table(*src) == FALSE) {
+                                       dbg( "GSM Char[%d], gsm_len[%d]", *src, gsm_len);
                                        return -1;
                                }
                                src++;
@@ -157,1539 +135,914 @@ static int __get_gsm_code_size(gushort *src, guint src_len)
                        }
                }
        }
-
        return gsm_len;
 }
 
-static char *__acitoa(int n, char* str, int b)
-{
-       guint i = 0;
-
-       do {
-               str[i++] = "0123456789ABCDEF"[n % b];
-       } while ((n /= b) > 0);
-
-       str = (char *)g_strreverse((gchar *)str);
-       str[i] = '\0';
-
-       return str;
-}
-
-static gint __convert_ucs2_to_gsm(guchar *dest,
-       gushort *src, guint src_len)
-{
-       guchar* rear = NULL;
-       gushort* p;
-       guchar temp;
-       gboolean in_table = FALSE;
-       gboolean in_sec_table = FALSE;
-       gint gsm_code_len = 0;
-       guint i;
-
-       if ((!dest) || (!src) || (0x00 == src_len)) {
-               dbg("Warning: Wrong Input");
-               return -1;
-       }
-
-       rear = dest;
-       p = src;
-
-       for (; src_len > 0 && p; src_len--) {
-               in_table = FALSE;
-               for (i = 0; i < GSM_UNICODE_TABLE_LEN_MAX; i++) { /* is in table  */
-                       if (*p == gsm_unicode_table[i].unicode) {
-                               temp = (guchar) (gsm_unicode_table[i].gsm);
-                               *rear = temp;
-                               rear++;
-                               p++;
-                               in_table = TRUE;
-                               gsm_code_len++;
-                               break;
-                       }
-               }
-
-               if (in_table == FALSE) {
-                       in_sec_table = FALSE;
-                       for (i = 0; i < GSM_UNICODE2_TABLE_LEN_MAX; i++) { /* second table*/
-                               if (*p == gsm_unicode2_table[i].unicode) {
-                                       *rear = 0x1B;
-                                       rear++;
-                                       temp = (guchar) (gsm_unicode2_table[i].gsm);
-                                       *rear = temp;
-                                       rear++;
-                                       p++;
-                                       in_table = TRUE;
-                                       in_sec_table = TRUE;
-                                       gsm_code_len += 2;
-                                       break;
-                               }
-                       }
-
-                       if (in_sec_table == FALSE) { /* second */
-                               if (__find_gsm_code_exception_table(*p) == FALSE)
-                                       return -1;
-
-                               temp = (guchar) (*p); /* isn't in table. but it's just able to be converted to GSM (0x00?? -> 0x??)*/
-                               *rear = temp;
-                               rear++;
-                               p++;
-                               gsm_code_len++;
-                       }
-               }
-       }
-
-       src = p;
-       return gsm_code_len;
-}
-
-static gboolean __convert_unicode_to_gsm(guchar *dest, guint dest_len,
-       gushort *src, guint src_len)
+static gboolean _convert_gsm_to_unicode(unsigned short *dest, int dest_len, unsigned char *src, unsigned int src_len)
 {
-       gchar *gsm_str;
-       int gsm_code_len = 0;
-
-       if ((NULL == dest) || (NULL == src)) {
-               dbg("INPUT PARAM was NULL");
-               return FALSE;
-       }
-
-       if (src_len == 0)
-               return FALSE;
+       int count, tmp_len;
 
-       /* Finding the GSM code size */
-       gsm_code_len = __get_gsm_code_size(src, src_len);
-       if (0 >= gsm_code_len) {
-               dbg("Warning: Error[%d] while finding the GSM Code Size", gsm_code_len);
+       if(!dest || !src) {
+               dbg( "dest(%p) or src(%p) is null",dest, src);
                return FALSE;
        }
 
-       if (dest_len < (guint)gsm_code_len) {
-               if (dest_len == sizeof(void *)) {
-                       dbg("Out buffer (%s) size seems to be small", dest);
-               } else {
-                       dbg("Buffer (%s) size is too small - length [%d]"
-                               "gsm_code_len(%d)", dest, dest_len, gsm_code_len);
-               }
-               return FALSE;
+       if(!src_len){
+               dest[0] = '\0';
+               return TRUE;
        }
 
-       gsm_str = tcore_malloc0(gsm_code_len);
+       dbg("source string (%s) len(%d)", src, src_len);
 
-       /* Conversion: UCS2 --> GSM */
-       gsm_code_len = __convert_ucs2_to_gsm((guchar*)gsm_str, src, src_len);
-       if (gsm_code_len == -1) {
-               tcore_free(gsm_str);
-               return FALSE;
+       for(count = 0; count < (int)src_len; count++){
+               if(src[count] == 0x1B)
+                       src_len--;
        }
-       memcpy((char*)dest, (char*)gsm_str, gsm_code_len);
+       dbg("strlen excluding escape character (%d)", src_len);
+
+       tmp_len = _convert_gsm_to_ucs2(dest, src, src_len);
+       dest[tmp_len] = '\0';
 
-       tcore_free(gsm_str);
        return TRUE;
 }
 
-static gint __convert_gsm_to_ucs2(gushort *dest,
-       guchar *src, guint src_len)
+static int _convert_gsm_to_ucs2(unsigned short* dest, unsigned char* src, unsigned int src_len)
 {
-       gushort *org;
-       guint i;
+       int count;
+       unsigned short* org;
 
        org = dest;
 
-       for (i = 0 ; i < src_len ; i++) {
-               guint table_index = 0;
+       for(count=0; count < (int)src_len; count++){
+               int table_index=0;
                gboolean b_tabled = FALSE;
 
                /*
                 * if the first byte is 0x1B, it is the escape character.
                 * The byte value shoulbe be changed to unicode.
                 */
-               if (*src == 0x1B) {
-                       src++;
-                       i++;//move to next byte
-
-                       for (table_index = 0;
-                                       table_index < GSM_UNICODE2_TABLE_LEN_MAX;
-                                       table_index++) {
-                               if (*src == gsm_unicode2_table[table_index].gsm) {
+               if(*src == 0x1B){
+                       src++; count++;//move to next byte
+                       for(table_index=0; table_index < tabGsmUniMax2; table_index++){
+                               if(*src == gsm_unicode2_table[table_index].gsm){
                                        *dest = gsm_unicode2_table[table_index].unicode;
                                        b_tabled = TRUE;
                                        break;
                                }
                        }
 
-                       /* If matched data is not in table, it should be changed to NULL; */
-                       if (!b_tabled)
+                       //if matched data is not in table, it should be changed to NULL;
+                       if(!b_tabled){
                                *dest = 0x0020;
+                       }
                }
-               else {
-                       for (table_index = 0;
-                                       table_index < GSM_UNICODE_TABLE_LEN_MAX;
-                                       table_index++) {
-                               if (*src == gsm_unicode_table[table_index].gsm) {
+               else{
+                       for(table_index=0; table_index < tabGsmUniMax; table_index++){
+                               if(*src == gsm_unicode_table[table_index].gsm){
                                        *dest = gsm_unicode_table[table_index].unicode;
                                        b_tabled = TRUE;
                                        break;
                                }
                        }
 
-                       /* If matched data is not in table, it is using original value; */
-                       if (!b_tabled)
+                       //if matched data is not in table, it is using original value;
+                       if(!b_tabled){
                                *dest = *src;
+                       }
                }
 
-               /* Move to next position */
-               src++;
-               dest++;
+               //move to next position
+               src++; dest++;
        }
 
        dbg("cvt sr(%s), the size of data (%d) ", org, dest - org);
        return (dest - org);
 }
 
-static gchar *__convert_ucs_to_utf8(guchar *src, guint src_len)
+static void _convert_gsm_to_utf8(unsigned char* dest, unsigned short* dest_len, unsigned char* src, unsigned int src_len)
 {
-       gchar* utf_str = NULL;
-       iconv_t cd = NULL;
-       size_t ileft = 0;
-       size_t oleft = 0;
-
-       gchar *pIn = NULL;
-       gchar *in_buf = NULL;
-       gchar *out_buf = NULL;
+       unsigned short tmp_len = 0;
+       char *target_tmp = NULL;
+       unsigned char *raw_unicode = NULL;
+       unsigned short tmp_dest[SAT_TEXT_STRING_LEN_MAX];
 
-       gint ret = 0;
+       memset(tmp_dest, 0 , SAT_TEXT_STRING_LEN_MAX);
 
-       if (!src) {
-               err("src is null");
-               return NULL;
+       _convert_gsm_to_unicode(tmp_dest, SAT_TEXT_STRING_LEN_MAX, src, src_len);
+       while(tmp_dest[tmp_len] != '\0'){
+               tmp_len++;
        }
+       tmp_len++; // add null character
 
-       ileft = src_len * 2;//over allocate as utf-8 may occupy 3 bytes
-       oleft = src_len * 3;//over allocate as utf-8 may occupy 3 bytes
-
-       pIn = in_buf = (gchar *)tcore_malloc0(ileft + 2);
-       memcpy(in_buf, src, ileft);
-       in_buf[ileft] = '\0';
-
-       utf_str = out_buf = (gchar *)tcore_malloc0(oleft + 1);
+       tmp_len = tmp_len*2; //for byte align
+       raw_unicode = (unsigned char*)malloc(tmp_len);
+       memset(raw_unicode, 0, tmp_len);
 
-       cd = iconv_open("UTF-8", "UCS-2");
-       ret = iconv(cd, (char**) &in_buf, &ileft, &out_buf, &oleft);
+       memcpy(raw_unicode, (unsigned char*)tmp_dest, tmp_len);
 
-       utf_str[src_len * 2 - ileft] = '\0';
+       target_tmp = _convert_ucs_to_utf8(raw_unicode, tmp_len);
+       if(!target_tmp){
+               dbg( "str is NULL");
+               g_free(raw_unicode);
+               return;
+       }
 
-       iconv_close(cd);
-       tcore_free(pIn);
+       *dest_len = strlen((const char*)target_tmp);
+       dbg("utf8 (%s), len(%d)", (const char*)target_tmp, strlen((const char*)target_tmp));
+       memcpy(dest, target_tmp, strlen((const char*)target_tmp));
+       dbg("final utf8 str (%s), length (%d)", dest, tmp_len);
 
-       return utf_str;
+       g_free(raw_unicode);
+       g_free(target_tmp);
+       return;
 }
 
-static gint __convert_utf8_to_unicode(gushort *dest,
-       guchar *src, guint src_len)
+static gboolean _convert_unicode_to_gsm(unsigned char* dest, int dest_len, unsigned short* src, int src_len)
 {
-       gushort *org;
-       guchar hi = 0;
-       guchar mid = 0;
-       guchar low = 0;
+       char* tmp_str;
+       int gc_len = 0;
 
        if ((NULL == dest) || (NULL == src)) {
-               dbg("INPUT PARAM NULL");
-               return -1;
+               dbg( "INPUT PARAM was NULL");
+               return FALSE;
        }
-       org = dest;
 
-       while (src_len > 0 && (*src != '\0')) {
-               if (*src < 0x80) {
-                       *dest = (*src & 0x7F);
-                       dest++;
-                       src++;
-                       src_len--;
-               } else if (((0xC0 <= *src) && (*src < 0xE0)) && (*(src + 1) >= 0x80)) {
-                       hi = *src & 0x1F;
-                       low = *(src+1) & 0x3F;
-                       *dest = (hi << 6) | low;
-                       dest++;
-                       src += 2;
-                       src_len -= 2;
-               } else if ((*src >= 0xE0) && (*(src + 1) >= 0x80) && (*(src + 2) >= 0x80)) {
-                       hi = *src & 0x0F;
-                       mid = *(src+1) & 0x3F;
-                       low = *(src+2) & 0x3F;
-                       *dest = (hi << 12) | (mid << 6) | low;
-                       dest++;
-                       src += 3;
-                       src_len -= 3;
+       if (src_len == 0)
+               return FALSE;
+
+       gc_len = _get_gsm_code_size(src, src_len);
+       if (0 >= gc_len) {
+               dbg( "Warning: Error[%d] while finding the GSM Code Size", gc_len);
+               return FALSE;
+       }
+
+       if (dest_len < gc_len) {
+               if (dest_len == sizeof(void*)) {
+                       dbg( "Out buffer size seems to be small (%s)", dest);
                } else {
-                       *dest = (*src & 0x7F);
-                       dest++;
-                       src++;
-                       src_len--;
-                       err("UTF-8 range incorrect!!!");
+                       dbg("Buffer size is too small (%s): dest_len(%d), gc_len(%d)", dest, dest_len, gc_len);
                }
+               return FALSE;
        }
 
-       *dest = 0;
-       return (dest - org);
-}
-
-static gboolean __convert_gsm_to_unicode(gushort *dest, guint dest_len,
-       guchar *src, guint src_len)
-{
-       guint i;
-       gint tmp_len;
-
-       if (!dest || !src) {
-               dbg("dest(%p) or src(%p) is null",dest, src);
+       tmp_str = calloc(1, (unsigned short) gc_len);
+       if (tmp_str == NULL) {
+               dbg( "Memory Allocation Failed!");
                return FALSE;
        }
 
-       if (!src_len) {
-               dest[0] = '\0';
+       gc_len = _convert_ucs2_to_gsm((unsigned char*) tmp_str, src, src_len);
+       if (gc_len != -1) {
+               memcpy((char*) dest, (char*) tmp_str, gc_len);
+               free(tmp_str);
                return TRUE;
        }
 
-       dbg("source string (%s) len(%d)", src, src_len);
-
-       for (i = 0; i < src_len; i++)
-               if (src[i] == 0x1B)
-                       src_len--;
-
-       dbg("strlen excluding escape character (%d)", src_len);
-
-       /* Conversion: GSM --> UCS2 */
-       tmp_len = __convert_gsm_to_ucs2(dest, src, src_len);
-       if (tmp_len == -1)
-               return FALSE;
-
-       dest[tmp_len] = '\0';
-
-       return TRUE;
+       free(tmp_str);
+       return FALSE;
 }
 
-static gboolean __convert_ucs2_to_utf8(gchar *dest, gushort *dest_len,
-       gchar *src, gushort src_len)
+static char* _convert_ucs_to_utf8(unsigned char* src, int src_len)
 {
-       gchar *p_o = NULL;
-       size_t in_len = (size_t)src_len;
-       size_t out_len = (size_t)src_len*3;
+       char* utf_str = NULL;
+       iconv_t cd = NULL;
+       size_t ileft = 0;
+       size_t oleft = 0;
 
-       iconv_t cd = iconv_open("UTF-8", "UCS2");
-       if (cd == (iconv_t) (-1)) {
-               perror("iconv_open");
-               return FALSE;
+       char* pIn = NULL;
+       char* in_buf = NULL;
+       char* out_buf = NULL;
+
+       if (!src) {
+               dbg("src is null");
+               return NULL;
        }
 
-       p_o = dest;
+       ileft = src_len * 2;//over allocate as utf-8 may occupy 3 bytes
+       oleft = src_len * 3;//over allocate as utf-8 may occupy 3 bytes
+       pIn = in_buf = (char*) malloc(ileft + 2);
+       utf_str = out_buf = (char *) malloc(oleft + 1);
+
+       memset(in_buf, 0x00, ileft + 2);
+       memset(out_buf, 0x00, oleft + 1);
+       memcpy(in_buf, src, ileft);
+
+       in_buf[ileft] = '\0';
 
-       dbg("Expected input bytes: [%d] output bytes: [%d]", in_len, out_len);
+       cd = iconv_open("UTF-8", "UCS-2");
 
-       if (iconv(cd, &src, &in_len, &p_o, &out_len) == (size_t)(-1)) {
+       if (iconv(cd, (char**) &in_buf, &ileft, &out_buf, &oleft) == (size_t)(-1)) {
                dbg("failed to iconv errno:%d", errno);
        } else {
-               dbg("remained input bytes:%d processed bytes:%d",
-                       in_len, in_len*3 - out_len);
-               dest[in_len*3 - out_len] = '\0';
+               utf_str[src_len * 2 - ileft] = '\0';
        }
-       *dest_len = in_len*3 - out_len;
 
-       dbg("Output - Length: [%d] Data: [%s]", *dest_len, dest);
        iconv_close(cd);
+       free(pIn);
 
-       return TRUE;
+       return utf_str;
 }
 
-static void __convert_gsm_to_utf8(guchar *dest, gushort *dest_len, guchar *src, guint src_len)
+static int _convert_ucs2_to_gsm(unsigned char* dest, unsigned short* src, unsigned int src_len)
 {
-       int tmp_len = 0;
-       char *target_tmp = NULL;
-       guchar *raw_unicode = NULL;
-       gushort tmp_dest[TEXT_STRING_LEN_MAX];
+       unsigned char* rear = NULL;
+       unsigned short* p;
+       unsigned char temp;
+       gboolean in_table = FALSE;
+       gboolean in_sec_table = FALSE;
+       int i, gc_len = 0;
 
-       memset(tmp_dest, 0x0, TEXT_STRING_LEN_MAX);
+       if ((!dest) || (!src) || (0x00 == src_len)) {
+               dbg( "Warning: Wrong Input");
+               return -1;
+       }
 
-       __convert_gsm_to_unicode(tmp_dest, TEXT_STRING_LEN_MAX, src, src_len);
-       while (tmp_dest[tmp_len] != '\0')
-               tmp_len++;
-       tmp_len++; // add null character
+       rear = dest;
+       p = src;
 
-       tmp_len = tmp_len*2; //for byte align
+       for (; src_len > 0 && p; src_len--) {
+               in_table = FALSE;
+               for (i = 0; i < tabGsmUniMax; i++) { /* is in table  */
+                       if (*p == gsm_unicode_table[i].unicode) {
+                               temp = (unsigned char) (gsm_unicode_table[i].gsm);
+                               *rear = temp;
+                               rear++;
+                               p++;
+                               in_table = TRUE;
+                               gc_len++;
+                               break;
+                       }
+               }
+               if (in_table == FALSE) {
+                       in_sec_table = FALSE;
+                       for (i = 0; i < tabGsmUniMax2; i++) { /* second table*/
+                               if (*p == gsm_unicode2_table[i].unicode) {
+                                       *rear = 0x1B;
+                                       rear++;
+                                       temp = (unsigned char) (gsm_unicode2_table[i].gsm);
+                                       *rear = temp;
+                                       rear++;
+                                       p++;
+                                       in_table = TRUE;
+                                       in_sec_table = TRUE;
+                                       gc_len += 2;
+                                       break;
+                               }
+                       }
+                       if (in_sec_table == FALSE) { /* second */
+                               if (_find_gsm_code_exception_table(*p) == FALSE)
+                                       return -1;
+                               temp = (unsigned char) (*p); /* isn't in table. but it's just able to be converted to GSM (0x00?? -> 0x??)*/
+                               *rear = temp;
+                               rear++;
+                               p++;
+                               gc_len++;
+                       }
+               }
+       }
+       src = p;
+       return gc_len;
+}
 
-       raw_unicode = (guchar*)tcore_malloc0(tmp_len);
-       memcpy(raw_unicode, (guchar*)tmp_dest, tmp_len);
+int tcore_util_convert_ucs2_to_utf8(char *out, unsigned short *out_len, char *in, unsigned short in_len)
+{
+       //input string "char *in" should be BIG-ENDIAN format.
+       gsize byte_converted = 0;
+       gsize byte_read = 0;
+       gchar *str_converted = NULL;
 
-       *dest_len = tmp_len;
-       target_tmp = __convert_ucs_to_utf8(raw_unicode, tmp_len);
-       if (!target_tmp) {
-               dbg("str is NULL");
-               tcore_free(raw_unicode);
-               return;
+       if (NULL == out || NULL == out_len || NULL == in) {
+               dbg( "Invalid Input Parameter");
+               return 0;
        }
-       memcpy(dest, target_tmp, strlen((const char*)target_tmp));
-       dbg("final utf8 str (%s), length (%d)", dest, tmp_len);
+try_again:
+       str_converted = (gchar *)g_convert((const gchar *)in, (gssize)in_len, "UTF8", "UCS-2BE", &byte_read, &byte_converted, NULL);
+
+       dbg("read:[%d] converted:[%d] out:[%s]", byte_read, byte_converted, str_converted);
 
-       tcore_free(raw_unicode);
-       tcore_free(target_tmp);
+       *out_len = byte_converted;
+       if (str_converted) {
+               memcpy(out, str_converted, byte_converted);
+               g_free(str_converted);
+       } else {
+               warn("Cannot get converted data");
+               if (byte_read > 0) {
+                       in_len = byte_read;
+                       goto try_again;
+               }
+       }
+       return 0;
 }
 
-static void __convert_alpha_field_ucs2_to_utf8(guchar *out, gushort *out_len, guchar *in, gushort in_len)
+static void _convert_alpha_field_ucs2_to_utf8(unsigned char *out, unsigned short *out_len, unsigned char *in, unsigned short in_len)
 {
-       //input string UNSIGNED CHAR *IN should be encoded with BIG-ENDIAN
-       switch (in[0]) {
+       //input string "unsigned char *in" should be BIG-ENDIAN format.
+       int i = 0;
+
+       switch(in[0]) {
                case 0x80: {
-                       guchar num = in_len/2;  //number of characters
-                       int i = 0;
-                       int data_loc = 1;       //starting location of data
-                       gushort* in_buf = NULL;
                        dbg("[UCS2] prefix case:[0x80]");
-                       in_buf = (gushort*)malloc(num * sizeof(gushort));
-                       for (i=0; i<num; i++,data_loc++)        {
-                               in_buf[i] = ((gushort)in[data_loc]<<8) + (gushort)in[data_loc+1];
-                               data_loc++;
-                               dbg("[UCS2]in_buf[%d]=0x%04x", i, in_buf[i]);
-                       }
-                       __convert_ucs2_to_utf8((char*)out, out_len, (char*) in_buf, num*2);
-                       if (in_buf!=NULL)       free(in_buf);
+                       tcore_util_hex_dump(" [UCS2] ", in_len, in);
+                       tcore_util_convert_ucs2_to_utf8((char *)out, out_len, (char*)in+1, in_len-1);
                } break;
 
                case 0x81: {
-                       guchar num = in[1];     //number of characters
-                       gushort base = (gushort) in[2] << 7;    //base pointer for UCS2 type
-                       int i = 0;
+                       unsigned char num = in[1];      //number of characters
+                       unsigned short base = (unsigned short) in[2] << 7;      //base pointer for UCS2 type
                        int data_loc = 3;       //starting location of data
-                       gushort* in_buf = NULL;
+                       unsigned short* in_buf = NULL;
                        dbg("[UCS2] prefix case:[0x81]");
-                       in_buf = (gushort*)malloc(num * sizeof(gushort));
-                       for (i=0; i<num; i++,data_loc++)        {
-                               if (in[data_loc]<0x80) {        // if the MSB is zero (0x80 => 1000b), then remaining 7 bits are GSM default character.
-                                       __convert_gsm_to_ucs2(&in_buf[i], (guchar *)&in[data_loc], 1);
+                       in_buf = (unsigned short*)malloc(num * sizeof(unsigned short));
+                       for(i=0; i<num; i++,data_loc++) {
+                               if(in[data_loc]<0x80) { // if the MSB is zero (0x80 => 1000b), then remaining 7 bits are GSM default character.
+                                       _convert_gsm_to_ucs2(&in_buf[i], &in[data_loc], 1);
                                        dbg("[UCS2]in_buf[%d]=0x%04x", i, in_buf[i]);
                                } else {        // if the MSB is 1 then the remaining 7 bits are offset value added to Base Pointer which the result defines the UCS2 character.
-                                       in_buf[i] = base + ((gushort)(in[data_loc]) & 0x7F);
+                                       in_buf[i] = base + ((unsigned short)(in[data_loc]) & 0x7F);
                                        dbg("[UCS2]in_buf[%d]=0x%04x", i, in_buf[i]);
                                }
                        }
-                       __convert_ucs2_to_utf8((char*)out, out_len, (char*) in_buf, num*2);
-                       if (in_buf!=NULL)       free(in_buf);
-
+                       {
+                               unsigned char *dest = NULL;
+                               dest = (unsigned char*)malloc(num*2);
+                               tcore_util_swap_byte_order(dest, (unsigned char*)in_buf, num*2);
+                               tcore_util_convert_ucs2_to_utf8((char *)out, out_len, (char*) dest, num*2);
+                               if(in_buf!=NULL)        free(in_buf);
+                               if(dest!=NULL)  free(dest);
+                       }
                } break;
 
                case 0x82: {
-                       guchar num = in[1];     //number of characters
-                       gushort base = ((gushort) in[2] << 8) | (gushort) in[3];        //base pointer for UCS2 type
-                       int i = 0;
+                       unsigned char num = in[1];      //number of characters
+                       unsigned short base = ((unsigned short) in[2] << 8) | (unsigned short) in[3];   //base pointer for UCS2 type
                        int data_loc = 4;       //starting location of data
-                       gushort* in_buf = NULL;
+                       unsigned short* in_buf = NULL;
                        dbg("[UCS2] prefix case:[0x82]");
-                       in_buf = (gushort*)malloc(num * sizeof(gushort));
-                       for (i=0; i<num; i++,data_loc++)        {
-                               if (in[data_loc]<0x80) {
-                                       __convert_gsm_to_ucs2(&in_buf[i], (guchar *)&in[data_loc], (guint)1);
+                       in_buf = (unsigned short*)malloc(num * sizeof(unsigned short));
+                       for(i=0; i<num; i++,data_loc++) {
+                               if(in[data_loc]<0x80) {
+                                       _convert_gsm_to_ucs2(&in_buf[i], &in[data_loc], (unsigned int)1);
                                        dbg("[UCS2]in_buf[%d]=0x%04x", i, in_buf[i]);
                                } else {
-                                       in_buf[i] = base + ((gushort)(in[data_loc]) & 0x7F);
+                                       in_buf[i] = base + ((unsigned short)(in[data_loc]) & 0x7F);
                                        dbg("[UCS2]in_buf[%d]=0x%04x", i, in_buf[i]);
                                }
                        }
-                       __convert_ucs2_to_utf8((char*)out, out_len, (char*) in_buf, num*2);
-                       if (in_buf!=NULL)       free(in_buf);
+                       {
+                               unsigned char *dest = NULL;
+                               dest = (unsigned char*)malloc(num*2);
+                               tcore_util_swap_byte_order(dest, (unsigned char*)in_buf, num*2);
+                               tcore_util_convert_ucs2_to_utf8((char *)out, out_len, (char*) dest, num*2);
+                               if(in_buf!=NULL)        free(in_buf);
+                               if(dest!=NULL)  free(dest);
+                       }
                } break;
 
                default: {
-                       guchar num = in_len/2;  //number of characters
-                       int i = 0;
-                       int data_loc = 0;       //starting location of data
-                       gushort* in_buf = NULL;
                        dbg("[UCS2] non-prefix case.");
-                       in_buf = (gushort*)malloc(num * sizeof(gushort));
-                       for (i=0; i<num; i++,data_loc++)        {
-                               in_buf[i] = ((gushort)in[data_loc]<<8) + (gushort)in[data_loc+1];
-                               data_loc++;
-                               dbg("[UCS2]in_buf[%d]=0x%04x", i, in_buf[i]);
-                       }
-                       __convert_ucs2_to_utf8((char*)out, out_len, (char*) in_buf, num*2);
-                       if (in_buf!=NULL)       free(in_buf);
+                       tcore_util_hex_dump(" [UCS2] ", in_len, in);
+                       tcore_util_convert_ucs2_to_utf8((char *)out, out_len, (char*)in, in_len);
                } break;
        }
 }
 
-/*
- * Conversion APIs
- */
-
-/* BCD --> */
-gchar *tcore_util_convert_bcd_to_ascii(const gchar *bcd_str, guint bcd_str_len,
-       guint max_len)
+static int _convert_utf8_to_unicode(unsigned short* dest, unsigned char* src, unsigned int src_len)
 {
-       guint index, len = 0;
-       gchar l_bcd, h_bcd = 0x0F;
-       gchar *ascii_str;
-
-       tcore_check_return_value(bcd_str != NULL, NULL);
+       unsigned short* org = NULL;
+       unsigned char hi = 0;
+       unsigned char mid = 0;
+       unsigned char low = 0;
 
-       /* validate max length */
-       if (bcd_str_len*2 > max_len) {
-               err("PARSER - number length exceeds the maximum limit");
-               return NULL;
+       if ((NULL == dest) || (NULL == src)) {
+               dbg( "INPUT PARAM NULL");
+               return -1;
        }
 
-       ascii_str = tcore_malloc0(((bcd_str_len*2)*sizeof(char)) + 1);
-
-       for (index = 0 ; index < bcd_str_len ; index++) {
-               l_bcd = bcd_str[index] & 0x0F;
-               h_bcd = (bcd_str[index] & 0xF0) >> 0x04;
-
-               /* Lower nibble */
-               switch (l_bcd) {
-               case 0x0A:
-                       ascii_str[len++] = '*';
-               break;
-
-               case 0x0B:
-                       ascii_str[len++] = '#';
-               break;
-
-               case 0x0C:
-                       ascii_str[len++] = 'p'; /* Pause */
-               break;
-
-               case 0x0D:
-                       ascii_str[len++] = '?'; /* Wild Card character */
-               break;
+       org = dest;
 
-               case 0x0E:      /* Ignore, RFU */
-               case 0x0F:      /* Ignore in l_bcd */
-               break;
-
-               default:
-                       ascii_str[len++] = l_bcd+'0';   /* Digits 0~9 */
-               break;
-               }
-
-               /* Higher nibble */
-               switch (h_bcd) {
-               case 0x0A:
-                       ascii_str[len++] = '*';
-               break;
-
-               case 0x0B:
-                       ascii_str[len++] = '#';
-               break;
-
-               case 0x0C:
-                       ascii_str[len++] = 'p'; /* Pause */
-               break;
-
-               case 0x0D:
-                       ascii_str[len++] = '?'; /* Wild Card character */
-               break;
-
-               case 0x0E: //ignore, RFU
-               case 0x0F:
-                       ascii_str[len] = '\0';  /* Null termination */
-               break;
-
-               default:
-                       ascii_str[len++] = h_bcd+'0';   /* Digits 0~9 */
-               break;
-               }
-       }
-
-       /* Append '\0' */
-       if (h_bcd != 0x0F)
-               ascii_str[len] = '\0';
-
-       dbg("ASCII string: [%s] length: [%d]", ascii_str, len);
-       return ascii_str;
-}
-
-/*******************************************************************************
- Convert Digit to BCD (BCD to Digit)
-
- bcd           <--->   digit
- 0xa                           0x2a '*'
- 0xb                           0x23 '#'
- 0xc                           0x70 'P'
- 0xd                           '?'
- 0xf                           0
- 1032547698            0123456789
-
- ********************************************************************************/
-/**
- * This function is used to Convert Digit to BCD (Digit to BCD)
- *
- * @return             None
- * @param[out] bcd_code - BCD output
- * @param[in]          digits - Digit input
- * @param[in]          digit_len - digit length
- * @Interface          Synchronous.
- * @remark
- * @Refer
- */
-void tcore_util_convert_digit_to_bcd(char* bcd_code, char* digits, guint digit_len)
-{
-       guint i, j, digit;
-       unsigned char higher, lower;
-
-       // 0123456789 -> 1032547698
-       for (i = 0, j = 0; i < digit_len; i = i + 2, j++) {
-               if (digits[i] == '*')
-                       digit = 0x0A;
-               else if (digits[i] == '#')
-                       digit = 0x0B;
-               else if (toupper((int) digits[i]) == 'P')
-                       digit = 0x0C;
-               else if ((digits[i]) == '?')
-                       digit = 0x0D;
-               else
-                       digit = (guint) digits[i];
-
-               lower = digit & 0x0F;
-
-               if (digit_len != i + 1) {
-                       if (digits[i + 1] == '*')
-                               digit = 0x0A;
-                       else if (digits[i + 1] == '#')
-                               digit = 0x0B;
-                       else if (toupper((int) digits[i + 1]) == 'P')
-                               digit = 0x0C;
-                       else if (digits[i + 1] == '?')
-                               digit = 0x0D;
-                       else
-                               digit = (guint) digits[i + 1];
-                       higher = digit & 0x0F;
+       while (src_len > 0 && (*src != '\0')) {
+               if (*src < 0x80) {
+                       *dest = (*src & 0x7F);
+                       dest++;
+                       src++;
+                       src_len--;
+               } else if (((0xC0 <= *src) && (*src < 0xE0)) && (*(src + 1) >= 0x80)) {
+                       hi = *src & 0x1F;
+                       low = *(src+1) & 0x3F;
+                       *dest = (hi << 6) | low;
+                       dest++;
+                       src += 2;
+                       src_len -= 2;
+               } else if ((*src >= 0xE0) && (*(src + 1) >= 0x80) && (*(src + 2) >= 0x80)) {
+                       hi = *src & 0x0F;
+                       mid = *(src+1) & 0x3F;
+                       low = *(src+2) & 0x3F;
+                       *dest = (hi << 12) | (mid << 6) | low;
+                       dest++;
+                       src += 3;
+                       src_len -= 3;
                } else {
-                       higher = 0xFF;
+                       *dest = (*src & 0x7F);
+                       dest++;
+                       src++;
+                       src_len--;
+                       dbg( "utf8 incorrect range");
                }
-               bcd_code[j] = (higher << 4) | lower;
        }
+       *dest = 0;
+       return (dest - org);
 }
 
-/**
- * This function is used to Convert BCD to Digit (BCD to Digit)
- *
- * @return             None
- * @param[out] digit - Digit output output
- * @param[in]          bcd_code - BCD Input
- * @param[in]          bcd_len - BCD length
- * @Interface          Synchronous.
- * @remark
- * @Refer
- */
-guint tcore_util_convert_bcd_to_digit(char *digit, char *bcd_code, guint bcd_len)
+static char _convert_gsm7bit_extension( char c )
 {
-       guint i, h, l;
-       char c[2] = {0, };
-       unsigned char higher, lower;
-
-       // 0123456789 <- 1032547698
-       memset((void*)digit, 0, bcd_len * 2);
-
-       for (i = 0; i < bcd_len; i++) {
-               higher = (bcd_code[i] >> 4) & 0x0F; // get high nibble
-               if (higher == 0x0A)
-                       higher = '*'; // =0x2A
-               else if (higher == 0x0B)
-                       higher = '#'; // =0x23
-               else if (higher == 0x0C)
-                       higher = 'P'; // =0x70, DTMF Control digit
-               else if (higher == 0x0D)
-                       higher = '?';
-               else if (higher == 0x0F)
-                       higher = 0;
-               else {
-                       h = (guint)higher;
-                       __acitoa(h, c, 16);
-                       higher = (char)toupper(*c);
-               }
-
-               lower = bcd_code[i] & 0x0F; // get low nibble
-               if (lower == 0x0A)
-                       lower = '*';
-               else if (lower == 0x0B)
-                       lower = '#';
-               else if (lower == 0x0C)
-                       lower = 'P'; //DTMF Control digit
-               else if (lower == 0x0D)
-                       lower = '?';
-               else if (lower == 0x0F)
-                       lower = 0;
-               else {
-                       l = (guint) lower;
-                       __acitoa(l, c, 16);
-                       lower = (char)toupper(*c);
-               }
-
-               digit[i * 2] = lower;
-               digit[i * 2 + 1] = higher;
+       switch ( c ) {
+               case 0x0A:
+               case 0x1B:
+                       return ' ';
+               case 0x14:
+                       return '^';
+               case 0x28:
+                       return '{';
+               case 0x29:
+                       return '}';
+               case 0x2F:
+                       return '\\';
+               case 0x3C:
+                       return '[';
+               case 0x3D:
+                       return '~';
+               case 0x3E:
+                       return ']';
+               case 0x40:
+                       return '|';
+               /*
+                  case 0x65:
+                  This code represents the EURO currency symbol. The code value is that used for the character â€˜e’. Therefore
+                  a receiving entity which is incapable of displaying the EURO currency symbol will display the character â€˜e’
+                  instead. GSM 03.38
+               */
+               case 0x65:
+                       return 'e';
+               default:
+                       dbg("this is not extension character : (0x%x)", c);
+                       break;
        }
 
-       return (bcd_len * 2);
+       return c;
 }
 
-/* String --> */
-gboolean tcore_util_convert_str_to_utf8(guchar *dest, gushort *dest_len,
-       TelUtilAlphabetFormat dcs, const guchar *src, gushort src_len)
+gboolean tcore_util_convert_utf8_to_gsm(unsigned char *dest, int *dest_len, unsigned char* src, int src_len)
 {
-       tcore_check_return_value(src != NULL, FALSE);
-       tcore_check_return_value(src_len != 0, FALSE);
-       tcore_check_return_value(dest != NULL, FALSE);
-       tcore_check_return_value(dest_len != 0, FALSE);
-
-       switch (dcs) {
-       case TEL_UTIL_ALPHABET_FORMAT_SMS_DEFAULT: {
-               guchar *unpacked_str = NULL;
-               dbg("FORMAT_SMS_DEFAULT");
-
-               /* Convert: GSM to UTF-8 */
-               unpacked_str = (guchar*)tcore_util_unpack_gsm7bit((const guchar *)src, src_len);
-               if (unpacked_str == NULL) {
-                       err("Failed to unpack...");
-                       return FALSE;
-               }
-
-               /* Convert: GSM to UTF-8 */
-               __convert_gsm_to_utf8(dest, dest_len, unpacked_str, strlen((const char*)unpacked_str));
-
-               tcore_free(unpacked_str);
-       }
-       break;
-
-       case TEL_UTIL_ALPHABET_FORMAT_8BIT_DATA: {      //GSM7bit with bit 8 set to 0
-               int src_buf_len = 0;
-               guchar *src_buf;
-               dbg("8BIT_DATA");
-
-               src_buf = (guchar*)tcore_memdup(src, src_len);
-
-               /* Get string length */
-               /* 0xFF is the end of string */
-               while (src[src_buf_len] != 0xFF && src_buf_len < src_len)
-                       src_buf_len++;
-
-               /* Last space character must be deleted */
-               while (src[src_buf_len - 1] == 0x20 && src_buf_len > 0)
-                       src_buf_len--;
-
-               dbg("src_buf_len: [%d]", src_buf_len);
-
-               /* Convert: GSM to UTF-8 */
-               __convert_gsm_to_utf8(dest, dest_len, src_buf, src_buf_len);
-
-               tcore_free(src_buf);
-       }
-       break;
+       unsigned short *uc = NULL;
+       int gc_len = 0;
+       int uc_len = 0;
 
-       case TEL_UTIL_ALPHABET_FORMAT_UCS2: {
-               guchar *src_buf;
-               dbg("UCS2");
-
-               src_buf = (guchar*)tcore_memdup(src, src_len);
-
-               /* Convert: UCS2 to UTF-8 */
-               __convert_alpha_field_ucs2_to_utf8(dest, dest_len, src_buf, src_len);
-
-               tcore_free(src_buf);
-       }
-       break;
-
-       default: {
-               dbg("Unhandled format: [0x%02x]", dcs);
+       if (src == NULL || src_len == 0) {
+               dbg( "WARNING: Invalid Parameter");
                return FALSE;
        }
-       }
 
-       return TRUE;
-}
-
-/* UTF8 --> */
-gboolean tcore_util_convert_utf8_to_gsm(guchar *dest, guint *dest_len,
-       guchar* src, guint src_len)
-{
-       gushort *unicode = NULL;
-       gint gsm_code_len = 0;
-       gint unicode_len;
-
-       if (src == NULL || src_len == 0) {
-               dbg("WARNING: Invalid Parameter");
+       uc = (unsigned short*) calloc(src_len + 1, sizeof(unsigned short));
+       if (!uc) {
+               dbg( "WARNING: calloc Failed");
                return FALSE;
        }
 
-       unicode = (gushort *)tcore_malloc0((src_len + 1) * sizeof(gushort));
-
-       /* Converting from UTF8 --> UNICODE */
-       unicode_len = __convert_utf8_to_unicode(unicode, src, src_len);
-       dbg("Unicode length: [%d]", unicode_len);
-       if (unicode_len == -1) {
-               dbg("UTF8 --> UNICODE conversion fails...");
-
-               tcore_free(unicode);
+       /*Converting from UTF8 => UNICODE*/
+       uc_len = _convert_utf8_to_unicode(uc, src, src_len);
+       dbg( "uc_len:[%d]", uc_len);
+       if(uc_len == -1) {
+               dbg( "_convert_utf8_to_unicode returns false!");
+               free(uc);
                return FALSE;
        }
 
-       /* Finding the GSM code size */
-       gsm_code_len = __get_gsm_code_size(unicode, (guint)unicode_len);
-       dbg("GSM code length: [%d]", gsm_code_len);
-       if (gsm_code_len == -1) {
-               dbg("SM-DATA is not in GSM7BIT Character Set");
-
-               tcore_free(unicode);
+       /*Finding the GSMCode Size*/
+       gc_len = _get_gsm_code_size(uc, uc_len);
+       dbg( "gc_len:[%d]", gc_len);
+       if ( gc_len == -1) {
+               dbg( "SM- DATA is not in GSM7BIT Character Set & Error:[%d]",   gc_len);
+               free(uc);
                return FALSE;
        }
 
-       /*Converting from UNICODE --> GSM CODE */
-       if (__convert_unicode_to_gsm(dest, (guint)gsm_code_len,
-                       unicode, (guint)unicode_len) == FALSE) {
-               dbg("UNICODE --> GSM conversion fails...");
-
-               tcore_free(unicode);
+       *dest_len = gc_len;
+       /*Converting from UNICODE ==> GSM CODE */
+       if (_convert_unicode_to_gsm((unsigned char*) dest, *dest_len, uc, uc_len) == FALSE) {
+               dbg( "_convert_unicode_to_gsm Failed");
+               *dest_len = 0x00;
+               free(uc);
                return FALSE;
        }
-       *dest_len = gsm_code_len;
 
-       tcore_free(unicode);
+       if(uc)
+               free(uc);
        return TRUE;
 }
 
-gboolean tcore_util_convert_utf8_to_ucs2(guchar *dest, guint *dest_len,
-       guchar *src, guint src_len)
+gboolean tcore_util_convert_utf8_to_ucs2(char **dest, int *dest_len, unsigned char *src, int src_len)
 {
        gsize byte_converted = 0;
        gsize byte_read = 0;
-       gchar* str_converted = NULL;
-       GError *error = NULL;
-       char tmp_char;
-       guint i;
-
-       if (dest == NULL || dest_len == NULL || src == NULL) {
-               dbg("Invalid Input Parameter");
-               return FALSE;
-       }
+       gchar *str_converted = NULL;
 
-       /*Converting from UTF8 => UCS-2 using the g_convert*/
-       str_converted = (gchar *)g_convert((gchar *)src, (gsize)src_len,
-                               (gchar*) "UCS-2", (gchar*)"UTF8",
-                               (gsize*)&byte_read, (gsize*)&byte_converted,
-                               &error);
-       if (str_converted == NULL) {
-               err("g_convert failed...");
-               if (error != NULL) {
-                       err("UTF8 --> UCS2 conversion failed "
-                               "- Error code: [%d]", error->code);
-                       g_error_free(error);
-               }
+       if (NULL == src || NULL == dest || NULL == dest_len) {
+               dbg( "Invalid Input Parameter");
                return FALSE;
        }
+try_again:
+       /*Converting from UTF8 => UCS-2 BIG-ENDIAN FORMAT using the g_convert*/
+       str_converted = (gchar *)g_convert((const gchar *)src, (gssize)src_len, "UCS-2BE", "UTF8", &byte_read, &byte_converted, NULL);
 
-       dbg("src_len[%u], byte_read[%u], byte_converted[%u]",
-               src_len, byte_read, byte_converted);
-       *dest_len = (guint)byte_converted;
-
-       if (byte_converted % 2 != 0) {
-               dbg("String length is wrong!");
+       dbg("byte_read: [%d] byte_converted: [%d]", byte_read, byte_converted);
+       if (str_converted) {
+               *dest = str_converted;
+               *dest_len = byte_converted;
        } else {
-               for (i = 0; i < (guint)byte_converted; i++) {
-                       if (i % 2 == 0) {
-                               tmp_char = str_converted[i];
-                               str_converted[i] = str_converted[i + 1];
-                               str_converted[i + 1] = tmp_char;
-                       }
+               warn("Cannot get converted string");
+               if (byte_read > 0) {
+                       src_len = byte_read;
+                       goto try_again;
                }
        }
-
-       memcpy((guchar*)dest, (guchar*)str_converted, byte_converted);
-
-       tcore_free(str_converted);
        return TRUE;
 }
 
-/* Packing/Unpacking */
-guchar *tcore_util_pack_gsm7bit(const guchar *src, guint src_len)
+gboolean tcore_util_convert_string_to_utf8(unsigned char *dest, unsigned short *dest_len,
+               enum alphabet_format dcs, const unsigned char *src, unsigned short src_len)
 {
-       guchar *dest;
-       guint i = 0;
-       guint pos = 0, shift = 0;
-       guint outlen = 0;
+       dbg("dcs=[0x%02x], src=[%s], src_len=[%d]", dcs, src, src_len );
 
-       if (!src || src_len == 0) {
-               return NULL;
+       if(src==NULL || src_len==0) {
+               err("src is NULL or src_len is 0");
+               return FALSE;
        }
 
-       outlen = ((src_len * 7) / 8) + 1;
-
-       dest = calloc(outlen + 1, 1);
-       if (!dest)
-               return NULL;
-
-       for (pos = 0, i = 0; i < src_len; pos++, i++) {
-               if (pos >= outlen) {
-                       free(dest);
-                       return NULL;
-               }
-
-               /* pack the low bits */
-               dest[pos] = src[i] >> shift;
-
-               if (i + 1 < src_len) {
-                       /* pack the high bits using the low bits of the next character */
-                       dest[pos] |= src[i + 1] << (7 - shift);
-
-                       shift++;
+       switch (dcs) {
+               case ALPHABET_FORMAT_SMS_DEFAULT: {
+                       unsigned char* tmp_dest_str = NULL;
+                       tmp_dest_str = (unsigned char*)tcore_util_unpack_gsm7bit((const unsigned char *)src, src_len);
 
-                       if (shift == 7) {
-                               shift = 0;
-                               i++;
+                       if(!tmp_dest_str) {
+                               err("temp_dest_str is NULL");
+                               return FALSE;
                        }
-               }
-               else {
-                       if (shift == 6)
-                               dest[pos] |= 0x1a;
-               }
-       }
-
-       return dest;
-}
-
-guchar *tcore_util_unpack_gsm7bit(const guchar *src, guint src_len)
-{
-       guchar *dest;
-       guint pos = 0;
-       guchar shift = 0;
-       guint outlen = 0;
-       guint i = 0;
-
-       tcore_check_return_value(src != NULL, NULL);
-       tcore_check_return_value(src_len != 0, NULL);
+                       _convert_gsm_to_utf8(dest, dest_len, tmp_dest_str, strlen((const char*)tmp_dest_str));
+                       if(tmp_dest_str) {
+                               free(tmp_dest_str);
+                       }
+               }       break;
 
-       outlen = (src_len * 8) / 7;
+               case ALPHABET_FORMAT_8BIT_DATA: {//GSM7bit with bit 8 set to 0
+                       int tmp_str_len = 0;
+                       unsigned char *src_buf = NULL;
 
-       dest = tcore_malloc0(outlen + 1);
+                       src_buf = (unsigned char*)malloc(src_len);
+                       if(src_buf == NULL) {
+                               dbg("src_buf malloc failed.");
+                               return FALSE;
+                       }
 
-       for (i = 0; pos < src_len; i++, pos++) {
-               dest[i] = (src[pos] << shift) & 0x7F;
+                       memset(src_buf, 0, src_len);
+                       memcpy(src_buf, src, src_len);
 
-               if (pos != 0) {
-                       /*
-                        * Except the first byte, a character contains
-                        * some bits from the previous byte.
-                        */
-                       dest[i] |= src[pos - 1] >> (8 - shift);
-               }
+                       /*get string length*/
+                       /* 0xFF is the end of string */
+                       while (src[tmp_str_len] != 0xFF && tmp_str_len < src_len) {
+                               tmp_str_len++;
+                       }
+                       /* last space character must be deleted */
+                       while (src[tmp_str_len - 1] == 0x20 && tmp_str_len > 0) {
+                               tmp_str_len--;
+                       }
+                       dbg( "tmp_str_len[%d]", tmp_str_len);
 
-               shift++;
-               if (shift == 7) {
-                       shift = 0;
+                       _convert_gsm_to_utf8(dest, dest_len, src_buf, tmp_str_len);
+                       if(src_buf != NULL)
+                               free(src_buf);
+               }       break;
 
-                       /* a possible extra complete character is available */
-                       i++;
-                       dest[i] = src[pos] >> 1;
-               }
-       }
+               case ALPHABET_FORMAT_UCS2: {
+                       unsigned char *src_buf = NULL;
 
-       /* If a character is '\r' (13), change it to space(32) */
-       for (i = 0; i < outlen; i++)
-               if (dest[i] == '\r')
-                       dest[i] = ' ';
+                       src_buf = (unsigned char*)malloc(src_len);
+                       if(src_buf == NULL) {
+                               dbg("src_buf malloc failed.");
+                               return FALSE;
+                       }
 
-       dest[outlen] = '\0';
-       dbg("Converted string: [%s] length: [%d]", dest, outlen);
+                       memset(src_buf, 0, src_len);
+                       memcpy(src_buf, src, src_len);
 
-       return dest;
-}
+                       _convert_alpha_field_ucs2_to_utf8(dest, dest_len, src_buf, src_len);
+                       if(src_buf != NULL)
+                               free(src_buf);
+               }       break;
 
-/*
- * Utility APIs
- */
-gboolean tcore_util_encode_sms_parameters(TelSmsParamsInfo *set_params,
-       gchar *set_params_data, guint smsp_record_length)
-{
-       gint sca_length, param_offset = 0;
-       gchar *param_indicator_index = NULL;
-       guint pid_index = 0;
-
-       memset(set_params_data, 0xFF, smsp_record_length);
-
-       if (smsp_record_length >= SMS_DEFAULT_SMSP_WITHOUT_ALPHAID)
-               pid_index = smsp_record_length - SMS_DEFAULT_SMSP_WITHOUT_ALPHAID;
-
-       dbg("Alpha ID length: [%d]", pid_index);
-       param_indicator_index = &set_params_data[pid_index];
-
-       /* SCA */
-       sca_length = (unsigned)strlen(set_params->sca.number);
-       if (sca_length) {
-               if (sca_length <= SMS_SMSP_ADDRESS_LEN) {
-                       dbg("Valid SCA Present");
-
-                       /*
-                        * Service Centre Address
-                        *
-                        *      1 to Y Alpha-Identifier - alpha_id_len
-                        *      Y+1 Parameter Indicators - 1 byte
-                        *      Y+2 to Y+13 TP-Destination Address - SMS_SMSP_DEST_ADDRESS_LEN
-                        *      Y+14 to Y+25 TS-Service Centre Address <-- SCA
-                        */
-                       param_offset = pid_index + 1 + SMS_SCA_ADDR_OFFSET;
-
-                       tcore_util_encode_sca(&set_params->sca,
-                               &set_params_data[param_offset]);
-                       *param_indicator_index &= ~SMS_SMSP_SCA_ADDRESS;
-               } else {
-                       err("Invalid SCA Length.");
+               default: {
+                       dbg("not handled alpha format[0x%02x]", dcs);
                        return FALSE;
-               }
-       } else {
-               dbg("SCA is NULL");
-       }
-
-       /* Validity Period */
-       param_offset = pid_index + SMS_VP_OFFSET;
-       set_params_data[param_offset] = set_params->vp;
-       *param_indicator_index &= ~SMS_SMSP_VP;
-
-       dbg("Parameter Indicators: [%02x]", *param_indicator_index);
-
-       return TRUE;
-}
-
-gboolean tcore_util_decode_sms_parameters(unsigned char *incoming,
-       unsigned int length, TelSmsParamsInfo *get_params)
-{
-       gint i = 0, alpha_id_len = 0, sca_length = 0;
-       unsigned char param_indicator;
-       guint sca_offset = 0;
-
-       /*
-        * Record length: 28+Y bytes
-        *      1 to Y - Alpha-Identifier
-        */
-       alpha_id_len = length - SMS_SMSP_PARAMS_MAX_LEN;
-       dbg("Alpha ID length: [%d]", alpha_id_len);
-       if (alpha_id_len > 0) {
-               if (alpha_id_len > SMS_SMSP_ALPHA_ID_LEN_MAX)
-                       alpha_id_len = SMS_SMSP_ALPHA_ID_LEN_MAX;
-
-               /* Iterate the loop to get alpha ID */
-               for (i = 0; i < alpha_id_len; i++) {
-                       if (0xff == incoming[i]) {
-                               dbg("Alpha ID present");
-                               break;
-                       }
-               }
-       }
-       else {
-               alpha_id_len = 0;
-       }
-
-       /* Param Indicators */
-       param_indicator = incoming[alpha_id_len];
-       dbg("Parameter Indicators: [%02x]", param_indicator);
-
-       /*
-        * Service Centre Address
-        *
-        *      1 to Y Alpha-Identifier - alpha_id_len
-        *      Y+1 Parameter Indicators - 1 byte
-        *      Y+2 to Y+13 TP-Destination Address - SMS_SMSP_DEST_ADDRESS_LEN
-        *      Y+14 to Y+25 TS-Service Centre Address <-- SCA
-        */
-       sca_offset = alpha_id_len + 1 + SMS_SCA_ADDR_OFFSET;
-       if ((0 == (param_indicator & SMS_SMSP_SCA_ADDRESS))
-                       && (0xFF != (int)incoming[sca_offset])) {
-               dbg("SCA Address Present");
-
-               if ((incoming[sca_offset] > 0) && (incoming[sca_offset] <= 12)) {
-                       gchar *decoded_sca;
-
-                       sca_length = (int)(incoming[sca_offset] - 1);
-                       decoded_sca = tcore_util_convert_bcd_to_ascii(&incoming[sca_offset+2],
-                               sca_length, sca_length*2);
-                       dbg("Decoded SCA: [%s]", decoded_sca);
-                       g_strlcpy(get_params->sca.number,
-                               decoded_sca, strlen(decoded_sca)+1);
-                       tcore_free(decoded_sca);
-
-                       get_params->sca.npi = incoming[++sca_offset] & 0x0F;
-                       get_params->sca.ton = (incoming[sca_offset] & 0x70) >> 4;
-               } else {
-                       sca_length = 0;
-                       dbg("SCA Length is 0");
-               }
-       }else {
-               dbg(" SCA Address NOT Present");
-               sca_length = 0;
-               get_params->sca.number[sca_length] = '\0';
-       }
-       dbg("SCA - TON: [%d] NPI: [%d] Number: [%s]",
-               get_params->sca.ton, get_params->sca.npi, get_params->sca.number);
-
-       /* Validity Period */
-       if(((param_indicator & SMS_SMSP_VP) == 0)
-                       && (alpha_id_len + SMS_VP_OFFSET) < MAX_GSM_SMS_PARAM_RECORD_SIZE) {
-               get_params->vp = incoming[alpha_id_len + SMS_VP_OFFSET];
-               dbg("Validity period: [%d]", get_params->vp);
+               }       break;
        }
-
        return TRUE;
 }
 
-char tcore_util_unpackb(const char *src, int pos, int len)
+gboolean tcore_util_convert_ascii_to_utf8( unsigned char **dest, int *dest_len, unsigned char *src, int src_len )
 {
-       char result = 0;
-       int rshift = 0;
+       int i = 0, j = 0, tmp_len = 0;
+       unsigned char *tmp = 0;
 
-       src += pos / 8;
-       pos %= 8;
+       if ( (!dest) || (!src) || (!dest_len) )
+               return FALSE;
 
-       rshift = MAX(8 - (pos + len), 0);
+       if ( !src_len ) {
+               src_len = strlen( (char*)src );
+       }
 
-       if (rshift > 0) {
-               result = MASK_AND_SHIFT(len, pos, rshift, (unsigned char)*src);
-       } else {
-               result = MASK(8 - pos, pos, (unsigned char)*src);
-               src++;
-               len -= 8 - pos;
+       tmp_len = (src_len * 2);
+       tmp = g_new0( unsigned char, tmp_len );
 
-               if (len > 0) result = (result << len) | (*src >> (8 - len));   // if any bits left
-       }
+       for ( i=0, j=0; i<src_len; i++, j++ ) {
+               if ( src[i] <= 0x7F ) {
+                       tmp[j] = src[i];
 
-       return result;
-}
+               } else if ( (src[i] >= 0x80) && (src[i] <= 0xBF) ) {
+                       tmp[j] = 0xC2;
+                       tmp[++j] = src[i];
 
-char tcore_util_convert_byte_hexchar(char val)
-{
-       char hex_char;
+               } else { //( (src[i] >= 0xC0) && (src[i] <= 0xFF) )
+                       tmp[j] = 0xC3;
+                       tmp[++j] = (src[i] - 0x40);
 
-       if (val <= 9) {
-               hex_char = (char) (val + '0');
-       } else if (val >= 10 && val <= 15) {
-               hex_char = (char) (val - 10 + 'A');
-       } else {
-               hex_char = '0';
+               }
        }
 
-       return (hex_char);
-}
+       *dest_len = (j+1);
 
-gboolean tcore_util_byte_to_hex(const char *byte_pdu, char *hex_pdu, int num_bytes)
-{
-       int i;
-       char nibble;
-       int buf_pos = 0;
+       *dest = g_new0( unsigned char, *dest_len );
+       memcpy( *dest, tmp, j );
 
-       for (i = 0; i < num_bytes * 2; i++) {
-               nibble = tcore_util_unpackb(byte_pdu, buf_pos, 4);
-               buf_pos += 4;
-               hex_pdu[i] = tcore_util_convert_byte_hexchar(nibble);
-       }
+       g_free( tmp );
 
        return TRUE;
 }
 
-void tcore_util_swap_byte_order(gushort* dest,
-       const gushort* src, guint src_len)
+void tcore_util_swap_byte_order(unsigned char* dest, const unsigned char* src, int src_len)
 {
-       guint i = 0;
-
-       for (i = 0; i < src_len; i++)
-               dest[i] = (src[i] << 8) + (src[i] >> 8);
-}
-
-gchar *tcore_util_get_version(void)
-{
-       return tcore_strdup(TCORE_VERSION);
+       int i = 0;
+       for (i = 0; i+1 < src_len; i=i+2) {
+               dest[i] = src[i+1];
+               dest[i+1] = src[i];
+       }
+       if(src_len%2==1)
+               dest[i-1] = src[i-1];
+       dbg("swap completed.");
 }
 
-long tcore_util_encode_hex(const guchar *src,
-       long num_bytes, gchar *buf)
+static gboolean _tcore_util_marshal_create_gvalue(GValue *value,
+               const void *data, enum tcore_util_marshal_data_type type)
 {
-       long i, j;
-
-       if (num_bytes <= 0)
-       return -1;
-
-       for (i = 0, j = 0; i < num_bytes; i++, j++) {
-               convert_to_hex(((src[i] >> 4) & 0xf), buf[j++]);
-               convert_to_hex((src[i] & 0xf), buf[j]);
-       }
-
-       buf[j] = '\0';
+       switch (type) {
+               case TCORE_UTIL_MARSHAL_DATA_CHAR_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_schar(value, *((gchar *) data));
+                       break;
 
-       return j;
-}
+               case TCORE_UTIL_MARSHAL_DATA_BOOLEAN_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_boolean(value, *((gboolean *) data));
+                       break;
 
-void tcore_util_hex_dump(char *pad, int size, const void *data)
-{
-       char buf[255] = {0, };
-       char hex[4] = {0, };
-       int i;
-       unsigned char *p;
+               case TCORE_UTIL_MARSHAL_DATA_INT_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_int(value, *((gint *) data));
+                       break;
 
-       if (size <= 0) {
-               msg("%sno data", pad);
-               return;
-       }
+               case TCORE_UTIL_MARSHAL_DATA_DOUBLE_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_double(value, *((gdouble *) data));
+                       break;
 
-       p = (unsigned char *) data;
+               case TCORE_UTIL_MARSHAL_DATA_STRING_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_string(value, (gchar *) data);
+                       break;
 
-       snprintf(buf, 255, "%s%04X: ", pad, 0);
-       for (i = 0; i < size; i++) {
-               snprintf(hex, 4, "%02X ", p[i]);
-               strcat(buf, hex);
+               case TCORE_UTIL_MARSHAL_DATA_OBJECT_TYPE:
+                       g_value_init(value, G_TYPE_HASH_TABLE);
+                       g_value_set_boxed(value, (gpointer) data);
+                       break;
 
-               if ((i + 1) % 8 == 0) {
-                       if ((i + 1) % 16 == 0) {
-                               msg("%s", buf);
-                               memset(buf, 0, 255);
-                               snprintf(buf, 255, "%s%04X: ", pad, i + 1);
-                       } else {
-                               strcat(buf, "  ");
-                       }
-               }
+               default:
+                       return FALSE;
+                       break;
        }
 
-       msg("%s", buf);
+       return TRUE;
 }
 
-guint tcore_util_encode_sca(const TelSmsSca *sca,
-       gchar encoded_sca[TEL_UTIL_ENCODED_SCA_LEN_MAX])
-{
-       gchar *sca_number;
-       guint sca_len, encoded_sca_len = 0;
-       gchar lower_nibble, higher_nibble;
-       guint i = 0, j;
-
-       if (sca == NULL || strlen(sca->number) == 0)
-               return encoded_sca_len;
-
-       sca_number = (gchar *)&sca->number[0];
-       sca_len = strlen(sca_number);
-       if (sca_number[0] == '+') {     /* Remove '+' */
-               sca_number = (gchar *)&sca->number[1];
-               sca_len--;
-       }
-
-       /*
-        * Encoded SCA Length:
-        * number of packed BCD bytes + 1 byte (for TON/NPI byte)
-        */
-       if (sca_len % 2)    /* Odd: +1 for padding 0xF */
-               encoded_sca_len = (sca_len/2 + 1) + 1;
-       else                /* Even */
-               encoded_sca_len = (sca_len/2) + 1;
-
-       encoded_sca[0] = encoded_sca_len;
-
-       /*
-        * TON/NPI
-        *
-        *   7   6  5  4  3  2  1  0  - Bits
-        * | 1 |  TON  |     NPI    |
-        */
-       encoded_sca[1] = (gchar)(0x80 | ((sca->ton & 0x7) << 4) | (sca->npi & 0x0F));
-
-       /* Encoded SCA */
-       for (i = 0, j = 0; i < sca_len; i+=2, j++) {
-               /* Lower nibble */
-               lower_nibble = (sca_number[i] - '0') & 0x0F;
-
-               /* Higher nibble - In case of Odd SCA length, pad with 0xF */
-               if (sca_len != (i+1))
-                       higher_nibble = (sca_number[i+1] - '0') & 0x0F;
-               else
-                       higher_nibble = 0xFF;
-
-               encoded_sca[j+2] = (higher_nibble << 4) | lower_nibble;
-       }
-
-       return encoded_sca_len;
-}
 
-guint tcore_util_encode_pdu(const TelSmsSca *sca,
-       const guchar *tpdu, guint tpdu_len, gchar *pdu)
+static gboolean _tcore_util_return_value(GValue *src, void **dest,
+               enum tcore_util_marshal_data_type type)
 {
-       guint sca_len = 0;
-
-       pdu[0] = 0;
-
-       /* Encode SCA */
-       sca_len = tcore_util_encode_sca(sca, &pdu[0]);
-
-       /*
-        * Copy TPDU
-        * +1 is for sca_len field
-        */
-       memcpy(pdu + sca_len + 1, tpdu, tpdu_len);
-
-       /* Encoded SCA length (sca_len + 1) + TPDU length */
-       return ((sca_len + 1) + tpdu_len);
-}
+       switch (type) {
+               case TCORE_UTIL_MARSHAL_DATA_CHAR_TYPE:
+                       *dest = g_new0(gchar, 1);
+                       *((gchar *) *dest) = g_value_get_schar(src);
+                       break;
 
-gchar tcore_util_hexchar_to_int(gchar c)
-{
-       if (c >= '0' && c <= '9')
-               return (c - '0');
-       else if (c >= 'A' && c <= 'F')
-               return (c - 'A' + 10);
-       else if (c >= 'a' && c <= 'f')
-               return (c - 'a' + 10);
-       else {
-               err("Invalid charater!!");
-               return -1;
-       }
-}
+               case TCORE_UTIL_MARSHAL_DATA_BOOLEAN_TYPE:
+                       *dest = g_new0(gboolean, 1);
+                       *((gboolean *) *dest) = g_value_get_boolean(src);
+                       break;
 
-gboolean tcore_util_hexstring_to_bytes(gchar *hex_str,
-       gchar **bytes, guint *bytes_len)
-{
-       gchar *byte_str;
-       guint hex_str_len;
-       guint i;
+               case TCORE_UTIL_MARSHAL_DATA_INT_TYPE:
+                       *dest = g_new0(gint, 1);
+                       *((gint *) *dest) = g_value_get_int(src);
+                       break;
 
-       if (hex_str == NULL)
-               return FALSE;
+               case TCORE_UTIL_MARSHAL_DATA_DOUBLE_TYPE:
+                       *dest = g_new0(gdouble, 1);
+                       *((gdouble *) *dest) = g_value_get_double(src);
+                       break;
 
-       hex_str_len = strlen(hex_str);
+               case TCORE_UTIL_MARSHAL_DATA_STRING_TYPE:
+                       *dest = g_value_dup_string(src);
+                       break;
 
-       byte_str = tcore_try_malloc0((hex_str_len / 2) + 1);
+               case TCORE_UTIL_MARSHAL_DATA_OBJECT_TYPE:
+                       *dest = g_value_dup_boxed(src);
+                       break;
 
-       dbg("Convert String to Binary!!!");
-       for (i = 0; i < hex_str_len; i += 2) {
-               byte_str[i / 2] = (gchar)((tcore_util_hexchar_to_int(hex_str[i]) << 4)
-                               | tcore_util_hexchar_to_int(hex_str[i + 1]));
-               msg("           [%02x]", byte_str[i / 2]);
+               default:
+                       return FALSE;
+                       break;
        }
 
-       *bytes_len = (hex_str_len / 2);
-       *bytes = byte_str;
-
        return TRUE;
 }
 
-/**
- * This function is used to get(decode) string name
- *
- * @return             length of string
- * @param[out] alpha_id - Alpha string
- * @param[in]          record - Input raw data
- * @param[in]          alpha_id_max_len - Max size of alpha id array
- * @Interface          Synchronous.
- * @remark
- * @Refer
- */
-guint tcore_util_get_string(unsigned char* alpha_id, unsigned char* record, guint alpha_id_max_len)
-{
-       guint i, alpha_id_len = 0;
-
-       memset((void*) alpha_id, 0, alpha_id_max_len);
 
-       if (record[0] == 0xFF)
-               return alpha_id_len;
-
-       for (i = 0; i < alpha_id_max_len; i++) {
-               if (record[0] <= 0x7F && record[i] == 0xFF)
-                       break;
+static void _tcore_util_marshal_remove_value(gpointer value)
+{
+       unsigned int gtype = 0;
+       GHashTable *ht = NULL;
 
-               alpha_id[i] = record[i];
-               alpha_id_len++;
+       gtype = ((GValue *) value)->g_type;
+       if (gtype == G_TYPE_HASH_TABLE) {
+               ht = g_value_get_boxed(value);
+               g_hash_table_destroy(ht);
        }
-       return alpha_id_len;
-}
-
-/**
- * This function is used to set(encode) string name
- *
- * @return             length of string
- * @param[in]          alpha_id - Alpha string input
- * @param[out] record - output raw data
- * @param[in]          alpha_id_max_len - Max size of alpha id array
- * @Interface          Synchronous.
- * @remark
- * @Refer
- */
-void tcore_util_set_string(unsigned char* record, unsigned char* alpha_id, guint alpha_id_max_len)
-{
-       guint i;
 
-       tcore_check_return_assert(record != NULL);
-       memset((void*) record, 0xFF, alpha_id_max_len);
+       g_value_unset((GValue *) value);
+       g_free(value);
 
-       for (i = 0; i < alpha_id_max_len; i++)
-               record[i] = alpha_id[i];
+       return;
 }
 
-gboolean tcore_util_is_empty(unsigned char* in, guint in_length)
+static gboolean _tcore_util_marshal_convert_str_to_type(GValue *src,
+               GValue *dest, unsigned int dest_type)
 {
-       guint i;
+       if (dest_type == G_TYPE_HASH_TABLE)
+               dest_type = G_TYPE_BOXED;
 
-       for (i = 0; i < in_length; i++) {
-               if (in[i] != 0xFF)
+       switch (dest_type) {
+               case G_TYPE_INT: {
+                       gint64 tmp = 0;
+                       tmp = g_ascii_strtoll(g_value_get_string(src), NULL, 10);
+                       g_value_set_int(dest, tmp);
+               }
+                       break;
+               case G_TYPE_BOOLEAN: {
+                       gboolean tmp = FALSE;
+                       tmp = g_ascii_strncasecmp(g_value_get_string(src), "TRUE", 4) == 0
+                                       ? TRUE : FALSE;
+                       g_value_set_boolean(dest, tmp);
+               }
+                       break;
+               case G_TYPE_STRING: {
+                       const gchar* tmp = NULL;
+                       tmp = g_value_get_string(src);
+                       g_value_set_string(dest, tmp);
+               }
+                       break;
+               case G_TYPE_DOUBLE: {
+                       gdouble tmp = 0;
+                       tmp = g_ascii_strtod(g_value_get_string(src), NULL);
+                       g_value_set_double(dest, tmp);
+               }
+                       break;
+               case G_TYPE_BOXED: {
+                       GHashTable* tmp;
+                       tmp = tcore_util_marshal_deserialize_string(g_value_get_string(src));
+                       g_value_set_boxed(dest, tmp);
+               }
+                       break;
+               default: {
                        return FALSE;
-       }
-       dbg("current index has empty data");
-       return TRUE;            // this is empty record.
-}
-
-/**
- * This function is used to get BCD length
- *
- * @return             length of string
- * @param[in]          bcd_data - BCD Input data
- * @param[in]          bcd_max_len - BCD Max data Length
- * @Interface          Synchronous.
- * @remark
- * @Refer
- */
-guint tcore_util_get_valid_bcd_byte(unsigned char* bcd_data, guint bcd_max_len)
-{
-       guint i, bcd_length = 0;
-
-       for (i = 0; i < bcd_max_len; i++) {
-               if (bcd_data[i] == 0xFF)
+               }
                        break;
-
-               bcd_length++;
        }
-       return bcd_length;
+
+       return TRUE;
 }
 
-TelUtilAlphabetFormat tcore_util_get_cbs_coding_scheme(guchar encode)
+TReturn tcore_util_netif_up(const char *name)
 {
-       TelUtilAlphabetFormat alphabet_format = TEL_UTIL_ALPHABET_FORMAT_SMS_DEFAULT;
-
-       switch (encode & 0xf0)
-       {
-               case 0x00:
-               case 0x20:
-               case 0x30:
-                       alphabet_format = TEL_UTIL_ALPHABET_FORMAT_RESERVED;
-                       break;
+       int ret;
+       int fd;
+       struct ifreq ifr;
 
-               case 0x10:
-                       if ((encode & 0x0f) == 0x00)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_RESERVED;
-                       else if ((encode & 0x0f) == 0x01)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_8BIT_DATA;
-                       else
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_SMS_DEFAULT;
-                       break;
+       if (!name)
+               return TCORE_RETURN_EINVAL;
 
-               case 0x40:
-               case 0x50:
-               case 0x60:
-               case 0x70: // 01xx
-                       if ((encode & 0x0c) == 0x00)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_RESERVED;
-                       else if ((encode & 0x0c) == 0x04)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_8BIT_DATA;
-                       else if ((encode & 0x0c) == 0x08)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_UCS2;
-                       else if ((encode & 0x0c) == 0x0c)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_SMS_DEFAULT;
-                       break;
+       if (strlen(name) > IFNAMSIZ)
+               return TCORE_RETURN_EINVAL;
 
-               case 0x90: // 1001
-                       if ((encode & 0x0c) == 0x00)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_RESERVED;
-                       else if ((encode & 0x0c) == 0x04)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_8BIT_DATA;
-                       else if ((encode & 0x0c) == 0x08)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_UCS2;
-                       else if ((encode & 0x0c) == 0x0c)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_SMS_DEFAULT;
-                       break;
+       fd = socket(AF_INET, SOCK_DGRAM, 0);
+       if (fd < 0) {
+               return TCORE_RETURN_FAILURE;
+       }
 
-               case 0x80: // 1000
-               case 0xA0:
-               case 0xB0:
-               case 0xC0:
-               case 0xD0: // 1010 .. 1101
-               case 0xE0: // 0x1110
-                       break;
+       memset(&ifr, 0, sizeof(struct ifreq));
+       strncpy(ifr.ifr_name, name, IFNAMSIZ);
+       ifr.ifr_name[IFNAMSIZ - 1] = '\0';
 
-               case 0xF0:
-                       if ((encode & 0x04) == 0x00)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_RESERVED;
-                       else if ((encode & 0x04) == 0x04)
-                               alphabet_format = TEL_UTIL_ALPHABET_FORMAT_8BIT_DATA;
-                       break;
+       ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
+       if (ret < 0) {
+               close(fd);
+               return TCORE_RETURN_FAILURE;
        }
 
-       return alphabet_format;
-}
-
-gchar *tcore_util_get_string_by_ip4type(TcoreIp4Type ip)
-{
-       gchar *ip_addr_str = NULL;
+       ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
 
-       ip_addr_str = g_strdup_printf("%d.%d.%d.%d", ip.s[0], ip.s[1], ip.s[2], ip.s[3]);
-       dbg("IP Address: [%s]", ip_addr_str);
+       ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
+       if (ret < 0) {
+               close(fd);
+               return TCORE_RETURN_FAILURE;
+       }
 
-       return ip_addr_str;
+       close(fd);
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_util_netif (const char *name, gboolean enabled)
+TReturn tcore_util_netif_down(const char *name)
 {
-       gint ret;
-       gint fd;
+       int ret;
+       int fd;
        struct ifreq ifr;
 
        if (!name)
-               return TEL_RETURN_INVALID_PARAMETER;
+               return TCORE_RETURN_EINVAL;
 
        if (strlen(name) > IFNAMSIZ)
-               return TEL_RETURN_INVALID_PARAMETER;
-
-       if (enabled == TRUE)
-               fd = socket(AF_INET, SOCK_DGRAM, 0);
-       else
-               fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+               return TCORE_RETURN_EINVAL;
 
+       fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
        if (fd < 0) {
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
        }
 
        memset(&ifr, 0, sizeof(struct ifreq));
        strncpy(ifr.ifr_name, name, IFNAMSIZ);
        ifr.ifr_name[IFNAMSIZ - 1] = '\0';
 
+
        ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
        if (ret < 0) {
                close(fd);
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
        }
 
-       if (enabled == TRUE)
-               ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
-       else
-               ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING);
+       ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING);
 
        ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
        if (ret < 0) {
                close(fd);
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
        }
 
        close(fd);
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
+TReturn tcore_util_netif_set(const char *name, const char *ipaddr,
                const char *gateway, const char *netmask)
 {
-       gint ret;
-       gint fd;
+       int ret;
+       int fd;
        struct ifreq ifr;
        struct sockaddr_in sai;
 
        if (!name)
-               return TEL_RETURN_INVALID_PARAMETER;
+               return TCORE_RETURN_EINVAL;
 
        if (strlen(name) > IFNAMSIZ)
-               return TEL_RETURN_INVALID_PARAMETER;
+               return TCORE_RETURN_EINVAL;
 
        fd = socket(AF_INET, SOCK_DGRAM, 0);
        if (fd < 0) {
-               return TEL_RETURN_FAILURE;
+               return TCORE_RETURN_FAILURE;
        }
 
        memset(&sai, 0, sizeof(struct sockaddr_in));
@@ -1701,7 +1054,7 @@ TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
                dbg("ip = [%s]", ipaddr);
                if (!inet_aton(ipaddr, &sai.sin_addr)) {
                        close(fd);
-                       return TEL_RETURN_FAILURE;
+                       return TCORE_RETURN_FAILURE;
                }
 
                strncpy(ifr.ifr_name, name, IFNAMSIZ);
@@ -1711,7 +1064,7 @@ TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
                ret = ioctl(fd, SIOCSIFADDR, &ifr);
                if (ret < 0) {
                        close(fd);
-                       return TEL_RETURN_FAILURE;
+                       return TCORE_RETURN_FAILURE;
                }
        }
 
@@ -1719,7 +1072,7 @@ TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
                dbg("gateway = [%s]", gateway);
                if (!inet_aton(gateway, &sai.sin_addr)) {
                        close(fd);
-                       return TEL_RETURN_FAILURE;
+                       return TCORE_RETURN_FAILURE;
                }
 
                strncpy(ifr.ifr_name, name, IFNAMSIZ);
@@ -1729,7 +1082,7 @@ TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
                ret = ioctl(fd, SIOCSIFDSTADDR, &ifr);
                if (ret < 0) {
                        close(fd);
-                       return TEL_RETURN_FAILURE;
+                       return TCORE_RETURN_FAILURE;
                }
        }
 
@@ -1737,7 +1090,7 @@ TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
                dbg("netmask = [%s]", netmask);
                if (!inet_aton(netmask, &sai.sin_addr)) {
                        close(fd);
-                       return TEL_RETURN_FAILURE;
+                       return TCORE_RETURN_FAILURE;
                }
 
                strncpy(ifr.ifr_name, name, IFNAMSIZ);
@@ -1747,178 +1100,133 @@ TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
                ret = ioctl(fd, SIOCSIFNETMASK, &ifr);
                if (ret < 0) {
                        close(fd);
-                       return TEL_RETURN_FAILURE;
+                       return TCORE_RETURN_FAILURE;
                }
        }
 
        close(fd);
-       return TEL_RETURN_SUCCESS;
+       return TCORE_RETURN_SUCCESS;
 }
 
-#if 0  /* To be UNBLOCKED on requirement basis */
-
-static gboolean                __find_gsm_code_exception_table(gushort src);
-static int             __get_gsm_code_size(gushort* src, int src_len);
-static gboolean                __convert_gsm_to_unicode(gushort *dest, int dest_len, guchar *src, guint src_len);
-static int                     __convert_gsm_to_ucs2(gushort* dest, guchar* src, guint src_len);
-static void            __convert_gsm_to_utf8(guchar *dest, gushort *dest_len,  guchar *src, guint src_len);
-static gboolean                __convert_unicode_to_gsm(guchar* dest, int dest_len, gushort* src, int src_len);
-static char*           __convert_ucs_to_utf8(guchar *src, int src_len);
-static int                     __convert_ucs2_to_gsm(guchar* dest, gushort* src, guint src_len);
-static int                     __convert_ucs2_to_utf8(char *out, gushort *out_len, char *in, gushort in_len);
-static void            __convert_alpha_field_ucs2_to_utf8(guchar *out, gushort *out_len, guchar *in, gushort in_len);
-static int                     __convert_utf8_to_unicode(gushort* dest, guchar* src, guint src_len);
-
-
-static gboolean _tcore_util_marshal_create_gvalue(GValue *value,
-               const void *data, TcoreUtilMarshalData type)
+TReturn tcore_util_reset_ipv4_socket(const char *name, const char* ipaddr)
 {
-       switch (type) {
-               case TCORE_UTIL_MARSHAL_DATA_CHAR_TYPE:
-                       g_value_init(value, type);
-                       g_value_set_schar(value, *((gchar *) data));
-                       break;
-
-               case TCORE_UTIL_MARSHAL_DATA_BOOLEAN_TYPE:
-                       g_value_init(value, type);
-                       g_value_set_boolean(value, *((gboolean *) data));
-                       break;
-
-               case TCORE_UTIL_MARSHAL_DATA_INT_TYPE:
-                       g_value_init(value, type);
-                       g_value_set_int(value, *((gint *) data));
-                       break;
-
-               case TCORE_UTIL_MARSHAL_DATA_DOUBLE_TYPE:
-                       g_value_init(value, type);
-                       g_value_set_double(value, *((gdouble *) data));
-                       break;
+       int ret;
+       int fd;
+       struct ifreq ifr;
+       struct sockaddr_in sai;
 
-               case TCORE_UTIL_MARSHAL_DATA_STRING_TYPE:
-                       g_value_init(value, type);
-                       g_value_set_string(value, (gchar *) data);
-                       break;
+       if (!name)
+               return TCORE_RETURN_EINVAL;
 
-               case TCORE_UTIL_MARSHAL_DATA_OBJECT_TYPE:
-                       g_value_init(value, G_TYPE_HASH_TABLE);
-                       g_value_set_boxed(value, (gpointer) data);
-                       break;
+       if (strlen(name) > IFNAMSIZ)
+               return TCORE_RETURN_EINVAL;
 
-               default:
-                       return FALSE;
-                       break;
+       fd = socket(AF_INET, SOCK_DGRAM, 0);
+       if (fd < 0) {
+               return TCORE_RETURN_FAILURE;
        }
 
-       return TRUE;
-}
+       memset(&sai, 0, sizeof(struct sockaddr_in));
+       sai.sin_family = AF_INET;
+       sai.sin_port = 0;
+       if (ipaddr) {
+               if (!inet_aton(ipaddr, &sai.sin_addr)) {
+                       dbg("fail to inet_aton()");
+                       close(fd);
+                       return TCORE_RETURN_FAILURE;
+               }
+       }
 
+       memset(&ifr, 0, sizeof(struct ifreq));
+       memcpy(&ifr.ifr_addr, &sai, sizeof(sai));
+       strncpy(ifr.ifr_name, name, IFNAMSIZ);
+       ifr.ifr_name[IFNAMSIZ - 1] = '\0';
 
-static gboolean _tcore_util_return_value(GValue *src, void **dest,
-               TcoreUtilMarshalData type)
-{
-       switch (type) {
-               case TCORE_UTIL_MARSHAL_DATA_CHAR_TYPE:
-                       *dest = g_new0(gchar, 1);
-                       *((gchar *) *dest) = g_value_get_schar(src);
-                       break;
+       if(!ipaddr) {
+               ret = ioctl(fd, SIOCGIFADDR, &ifr);
+               if (ret < 0) {
+                       dbg("fail to ioctl[SIOCGIFADDR]!!!");
+                       close(fd);
+                       return TCORE_RETURN_FAILURE;
+               }
+       }
+       /* SIOCKILLADDR is initially introduced in Android OS. */
+#ifndef SIOCKILLADDR
+#define SIOCKILLADDR    0x8939
+#endif
+       ret = ioctl(fd, SIOCKILLADDR, &ifr);
+       if (ret < 0) {
+               dbg("fail to ioctl[SIOCKILLADDR]!!!");
+               close(fd);
+               return TCORE_RETURN_FAILURE;
+       }
 
-               case TCORE_UTIL_MARSHAL_DATA_BOOLEAN_TYPE:
-                       *dest = g_new0(gboolean, 1);
-                       *((gboolean *) *dest) = g_value_get_boolean(src);
-                       break;
+       if(ipaddr) {
+               dbg("devname: %s, ipaddr: %s", name, ipaddr);
+       } else {
+               memset(&sai, 0, sizeof(struct sockaddr_in));
+               memcpy(&sai, &ifr.ifr_addr, sizeof(struct sockaddr_in));
+               dbg("devname: %s, ipaddr: %s", name, inet_ntoa(sai.sin_addr));
+       }
+       close(fd);
+       return TCORE_RETURN_SUCCESS;
+}
 
-               case TCORE_UTIL_MARSHAL_DATA_INT_TYPE:
-                       *dest = g_new0(gint, 1);
-                       *((gint *) *dest) = g_value_get_int(src);
-                       break;
+TReturn tcore_util_netif_set_mtu(const char *name, unsigned int mtu)
+{
+       int ret;
+       int fd;
+       struct ifreq ifr;
 
-               case TCORE_UTIL_MARSHAL_DATA_DOUBLE_TYPE:
-                       *dest = g_new0(gdouble, 1);
-                       *((gdouble *) *dest) = g_value_get_double(src);
-                       break;
+       if (!name)
+               return TCORE_RETURN_EINVAL;
 
-               case TCORE_UTIL_MARSHAL_DATA_STRING_TYPE:
-                       *dest = g_value_dup_string(src);
-                       break;
+       if (strlen(name) > IFNAMSIZ)
+               return TCORE_RETURN_EINVAL;
 
-               case TCORE_UTIL_MARSHAL_DATA_OBJECT_TYPE:
-                       *dest = g_value_dup_boxed(src);
-                       break;
+       fd = socket(AF_INET, SOCK_DGRAM, 0);
+       if (fd < 0) {
+               return TCORE_RETURN_FAILURE;
+       }
 
-               default:
-                       return FALSE;
-                       break;
+       memset(&ifr, 0, sizeof(struct ifreq));
+       strncpy(ifr.ifr_name, name, IFNAMSIZ);
+       ifr.ifr_name[IFNAMSIZ - 1] = '\0';
+       ifr.ifr_data = (void*)mtu;
+
+       ret = ioctl(fd, SIOCSIFMTU, &ifr);
+       if (ret < 0) {
+               dbg("fail to ioctl[SIOCSIFMTU]!!!");
+               close(fd);
+               return TCORE_RETURN_FAILURE;
        }
 
-       return TRUE;
+       close(fd);
+       return TCORE_RETURN_SUCCESS;
 }
 
-
-static void _tcore_util_marshal_remove_value(gpointer value)
+char *tcore_util_get_string_by_ip4type(union tcore_ip4_type ip)
 {
-       guint gtype = 0;
-       GHashTable *ht = NULL;
+       char buf[16]; /* 'nnn'*4 + '.'*3 + '\0' */
 
-       gtype = ((GValue *) value)->g_type;
-       if (gtype == G_TYPE_HASH_TABLE) {
-               ht = g_value_get_boxed(value);
-               g_hash_table_destroy(ht);
-       }
+       snprintf(buf, 16, "%d.%d.%d.%d", ip.s[0], ip.s[1], ip.s[2], ip.s[3]);
 
-       g_value_unset((GValue *) value);
-       return;
+       return strdup(buf);
 }
 
-static gboolean _tcore_util_marshal__convert_str_to_type(GValue *src,
-               GValue *dest, guint dest_type)
+char *tcore_util_get_string_by_ip6type(unsigned char ipv6_addr_type[IPV6_ADDR_LEN])
 {
-       if (dest_type == G_TYPE_HASH_TABLE)
-               dest_type = G_TYPE_BOXED;
+       char buf[INET6_ADDRSTRLEN] = {0, };
 
-       switch (dest_type) {
-               case G_TYPE_INT: {
-                       gint64 tmp = 0;
-                       tmp = g_ascii_strtoll(g_value_get_string(src), NULL, 10);
-                       g_value_set_int(dest, tmp);
-               }
-                       break;
-               case G_TYPE_BOOLEAN: {
-                       gboolean tmp = FALSE;
-                       tmp = g_ascii_strncasecmp(g_value_get_string(src), "TRUE", 4) == 0
-                                       ? TRUE : FALSE;
-                       g_value_set_boolean(dest, tmp);
-               }
-                       break;
-               case G_TYPE_STRING: {
-                       const gchar* tmp = NULL;
-                       tmp = g_value_get_string(src);
-                       g_value_set_string(dest, tmp);
-               }
-                       break;
-               case G_TYPE_DOUBLE: {
-                       gdouble tmp = 0;
-                       tmp = g_ascii_strtod(g_value_get_string(src), NULL);
-                       g_value_set_double(dest, tmp);
-               }
-                       break;
-               case G_TYPE_BOXED: {
-                       GHashTable* tmp;
-                       tmp = tcore_util_marshal_deserialize_string(g_value_get_string(src));
-                       g_value_set_boxed(dest, tmp);
-               }
-                       break;
-               default: {
-                       return FALSE;
-               }
-                       break;
-       }
+       if (inet_ntop(AF_INET6, ipv6_addr_type, buf, INET6_ADDRSTRLEN) == NULL)
+               return NULL;
 
-       return TRUE;
+       return g_strdup(buf);
 }
 
-TcoreUtilDcs tcore_util_get_cbs_coding_scheme(guchar encode)
+enum tcore_dcs_type tcore_util_get_cbs_coding_scheme(unsigned char encode)
 {
-       TcoreUtilDcs dcs = TCORE_DCS_TYPE_NONE;
+       enum tcore_dcs_type dcs = TCORE_DCS_TYPE_NONE;
 
        switch (encode & 0xf0)
        {
@@ -1976,6 +1284,9 @@ TcoreUtilDcs tcore_util_get_cbs_coding_scheme(guchar encode)
                        else if ((encode & 0x04) == 0x04)
                                dcs = TCORE_DCS_TYPE_8_BIT;
                        break;
+               default:
+                       err("invalid encoding type");
+                       break;
        }
 
        return dcs;
@@ -1987,9 +1298,9 @@ TcoreUtilDcs tcore_util_get_cbs_coding_scheme(guchar encode)
        else (i) = 0;
 
 
-guchar *tcore_util_decode_hex(const char *src, int len)
+unsigned char *tcore_util_decode_hex(const char *src, int len)
 {
-       guchar *buf;
+       unsigned char *buf;
        int i = 0;
        int j = 0;
        int out_len = 0;
@@ -2006,7 +1317,7 @@ guchar *tcore_util_decode_hex(const char *src, int len)
                out_len = len;
        }
 
-       buf = calloc(out_len, 1);
+       buf = calloc(1, out_len);
        if (!buf)
                return NULL;
 
@@ -2020,6 +1331,277 @@ guchar *tcore_util_decode_hex(const char *src, int len)
        return buf;
 }
 
+void tcore_util_hex_dump(const char *pad, int size, const void *data)
+{
+       char buf[255] = {0, };
+       char hex[4] = {0, };
+       int i = 0;
+       unsigned char *p = NULL;
+
+       if (0 >= size) {
+               msg("%sno data", pad);
+               return;
+       }
+
+       p = (unsigned char *)data;
+
+       g_snprintf(buf, 255, "%s%04X: ", pad, 0);
+       for (i = 0; i<size; i++) {
+               g_snprintf(hex, 4, "%02X ", p[i]);
+               memcpy(buf+strlen(buf), hex, 4);
+
+               if ((i + 1) % 8 == 0) {
+                       if ((i + 1) % 16 == 0) {
+                               dbg("%s", buf);
+                               memset(buf, 0, 255);
+                               snprintf(buf, 255, "%s%04X: ", pad, i + 1);
+                       }
+                       else {
+                               strcat(buf, "  ");
+                       }
+               }
+       }
+
+       dbg("%s", buf);
+}
+
+unsigned char *tcore_util_unpack_gsm7bit(const unsigned char *src, unsigned int src_len)
+{
+       unsigned char *dest;
+       int i = 0, j = 0;
+       unsigned int pos = 0;
+       unsigned char shift = 0;
+       int outlen = 0;
+
+       if (!src || src_len == 0) {
+               return NULL;
+       }
+
+       outlen = (src_len * 8) / 7;
+
+       dest = calloc(1, outlen + 1);
+       if (!dest)
+               return NULL;
+
+       for (i = 0; pos < src_len; i++, pos++) {
+               dest[i] = (src[pos] << shift) & 0x7F;
+
+               if (pos != 0) {
+                       /* except the first byte, a character contains some bits from the previous byte.*/
+                       dest[i] |= src[pos - 1] >> (8 - shift);
+               }
+
+               shift++;
+
+               if (shift == 7) {
+                       shift = 0;
+
+                       /* a possible extra complete character is available */
+                       i++;
+                       dest[i] = src[pos] >> 1;
+               }
+       }
+
+       /*If a character is '\r'(13), change it to space(32) */
+       for (i = 0, j=0; i < outlen; i++, j++) {
+               if (dest[i] == '\r') {
+                       dest[j] = ' ';
+
+               } else if (dest[i] == 0x1B) { /*If a charater is 0x1B (escape), next charater is changed on gsm 7bit extension table */
+                       dest[j] = _convert_gsm7bit_extension( dest[++i] );
+
+               } else {
+                       dest[j] = dest[i];
+               }
+       }
+
+       outlen -= ( i - j );
+
+       dest[outlen] = '\0';
+
+       return dest;
+}
+
+unsigned char *tcore_util_pack_gsm7bit(const unsigned char *src, unsigned int src_len)
+{
+       unsigned char *dest;
+       unsigned int i = 0;
+       unsigned int pos = 0, shift = 0;
+       unsigned int outlen = 0;
+
+       if (!src || src_len == 0) {
+               return NULL;
+       }
+
+       outlen = ((src_len * 7) / 8) + 1;
+
+       dest = calloc(1, outlen + 1);
+       if (!dest)
+               return NULL;
+
+       for (pos = 0, i = 0; i < src_len; pos++, i++) {
+               if (pos >= outlen) {
+                       free(dest);
+                       return NULL;
+               }
+
+               /* pack the low bits */
+               dest[pos] = src[i] >> shift;
+
+               if (i + 1 < src_len) {
+                       /* pack the high bits using the low bits of the next character */
+                       dest[pos] |= src[i + 1] << (7 - shift);
+
+                       shift++;
+
+                       if (shift == 7) {
+                               shift = 0;
+                               i++;
+                       }
+               }
+               else {
+                       if (shift == 6)
+                               dest[pos] |= 0x1a;
+               }
+       }
+
+       return dest;
+}
+
+char* tcore_util_convert_bcd_str_2_ascii_str(const char* src, int src_len)
+{
+       int count = 0;
+       char *dest = NULL;
+
+       if(!src)
+               return NULL;
+
+       dest = malloc((src_len+1)*sizeof(char));
+       memset(dest, 0, (src_len+1)*sizeof(char));
+
+       for(count = 0; count < src_len; count++){
+               switch(src[count]){
+                       case 0x0A:
+                               dest[count] = '*';
+                               break;
+                       case 0x0B:
+                               dest[count] = '#';
+                               break;
+                       case 0x0C:
+                               dest[count] = 'p'; //Pause
+                               break;
+                       case 0x0D:
+                               dest[count] = '?'; //Wild Card character
+                               break;
+                       case 0x0E: //ignore, RFU
+                       case 0x0F:
+                               dest[count] = '\0'; //Null termination
+                               break;
+                       default:
+                               dest[count] = src[count]+'0'; //digits 0~9
+                               break;
+               }
+       }
+
+       dest[count] = '\0';
+       dbg("PARSER - number(%s) len(%d)", dest, strlen(dest));
+
+       return dest;
+}
+
+char* tcore_util_convert_bcd2ascii(const char* src, int src_len, int max_len)
+{
+       int count = 0, len=0;
+       char l_bcd = 0x00, h_bcd = 0x0F;
+       char *dest = NULL;
+
+       if(!src)
+               return NULL;
+
+       if(src_len*2 > max_len){
+               err("PARSER - number length exceeds the max");
+               return NULL;
+       }
+
+       dest = malloc((src_len*2)*sizeof(char)+1);
+       memset(dest, 0, (src_len*2)*sizeof(char)+1);
+
+       for(count = 0; count < src_len; count++){
+               l_bcd = src[count] & 0x0F;
+               h_bcd = (src[count] & 0xF0) >> 0x04;
+
+               switch(l_bcd){
+                       case 0x0A:
+                               dest[len++] = '*';
+                               break;
+                       case 0x0B:
+                               dest[len++] = '#';
+                               break;
+                       case 0x0C:
+                               dest[len++] = 'p'; //Pause
+                               break;
+                       case 0x0D:
+                               dest[len++] = '?'; //Wild Card character
+                               break;
+                       case 0x0E: //ignore, RFU
+                       case 0x0F: //ignore in l_bcd
+                               break;
+                       default:
+                               dest[len++] = l_bcd+'0'; //digits 0~9
+                               break;
+               }//l_lbcd switch
+
+               switch(h_bcd){
+                       case 0x0A:
+                               dest[len++] = '*';
+                               break;
+                       case 0x0B:
+                               dest[len++] = '#';
+                               break;
+                       case 0x0C:
+                               dest[len++] = 'p'; //Pause
+                               break;
+                       case 0x0D:
+                               dest[len++] = '?'; //Wild Card character
+                               break;
+                       case 0x0E: //ignore, RFU
+                       case 0x0F:
+                               dest[len] = '\0'; //Null termination
+                               break;
+                       default:
+                               dest[len++] = h_bcd+'0'; //digits 0~9
+                               break;
+               }//h_bcd switch
+       }
+
+       if(h_bcd != 0x0F)
+               dest[len] = '\0';
+
+       dbg("PARSER - number(%s) len(%d)", dest, len);
+       return dest;
+}
+
+char* tcore_util_convert_digit2ascii(const char* src, int src_len)
+{
+       int count = 0;
+       char *dest = NULL;
+
+       if(!src)
+               return NULL;
+
+       dest = malloc((src_len+1)*sizeof(char));
+       memset(dest, 0, (src_len+1)*sizeof(char));
+
+       for(count = 0; count < src_len; count++){
+               dest[count] = src[count] + '0';
+       }
+       dest[count] = '\0';
+
+       dbg("PARSER - number(%s) len(%d)", dest, strlen(dest));
+       return dest;
+}
+
+
 GHashTable *tcore_util_marshal_create()
 {
        GHashTable *ht = NULL;
@@ -2041,9 +1623,13 @@ void tcore_util_marshal_destory(GHashTable *ht)
 
 GHashTable *tcore_util_marshal_deserialize_string(const gchar *serialized_string)
 {
-       int index = 0;
+       int count = 0;
        gchar **tuple = NULL;
        GHashTable *ht = NULL;
+       GValue src = G_VALUE_INIT;
+
+       if (!serialized_string)
+               return NULL;
 
        ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
                        _tcore_util_marshal_remove_value);
@@ -2052,30 +1638,31 @@ GHashTable *tcore_util_marshal_deserialize_string(const gchar *serialized_string
                return ht;
        }
 
-       tuple = g_strsplit((gchar *) serialized_string, " ", 0);
+       g_value_init(&src, G_TYPE_STRING);
+
+       tuple = g_strsplit(serialized_string, " ", 0);
 
-       while (strlen(tuple[index]) > 3) {
+       while (strlen(tuple[count]) > 3) {
                int tmp = 0;
                guchar *content = NULL;
                gchar **inner_tuple = NULL;
-               GValue *src = g_new0(GValue, 1);
                GValue *dest = g_new0(GValue, 1);
-               guint type = 0;
+               unsigned int type = 0;
 
-               inner_tuple = g_strsplit(tuple[index], ":", 0);
+               inner_tuple = g_strsplit(tuple[count], ":", 0);
                type = atoi(inner_tuple[1]);
                content = g_base64_decode(inner_tuple[2], (gsize *)&tmp);
 
-               g_value_init(src, G_TYPE_STRING);
                g_value_init(dest, type);
 
-               g_value_set_string(src, (const gchar *)content);
-               _tcore_util_marshal__convert_str_to_type(src, dest, type);
-               g_hash_table_insert(ht, tcore_strdup(inner_tuple[0]), dest);
+               g_value_set_string(&src, (const gchar *)content);
+               _tcore_util_marshal_convert_str_to_type(&src, dest, type);
+               g_hash_table_insert(ht, g_strdup(inner_tuple[0]), dest);
 
-               tcore_free(content);
+               g_value_reset(&src);
+               g_free(content);
                g_strfreev(inner_tuple);
-               index++;
+               count++;
        }
 
        g_strfreev(tuple);
@@ -2092,7 +1679,7 @@ gchar *tcore_util_marshal_serialize(GHashTable *ht)
        gstring_tmp = g_string_new(NULL);
        g_hash_table_iter_init(&iter, ht);
        while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
-               guint gtype = 0;
+               unsigned int gtype = 0;
                gchar *tmp = NULL, *encoded_d = NULL;
                GValue gval = { 0,{ { 0 } } };
 
@@ -2110,22 +1697,22 @@ gchar *tcore_util_marshal_serialize(GHashTable *ht)
                }
 
                encoded_d = g_base64_encode((guchar *)tmp, (gsize)strlen(tmp));
-               tcore_free(tmp);
+               g_free(tmp);
 
                g_string_append_printf(gstring_tmp, "%s:%d:%s ", (gchar *)key,
                                gtype, encoded_d);
-               tcore_free((gpointer)encoded_d);
+               g_free((gpointer)encoded_d);
                g_value_unset(&gval);
        }
 
-       rv_str = tcore_strdup(gstring_tmp->str);
+       rv_str = g_strdup(gstring_tmp->str);
        g_string_free(gstring_tmp, TRUE);
 
        return rv_str;
 }
 
 gboolean tcore_util_marshal_add_data(GHashTable *ht, const gchar *key,
-               const void *data, TcoreUtilMarshalData type)
+               const void *data, enum tcore_util_marshal_data_type type)
 {
        gboolean rv = FALSE;
        GValue *value;
@@ -2143,13 +1730,13 @@ gboolean tcore_util_marshal_add_data(GHashTable *ht, const gchar *key,
        if (!rv)
                return FALSE;
 
-       g_hash_table_insert(ht, tcore_strdup(key), value);
+       g_hash_table_insert(ht, g_strdup(key), value);
 
        return TRUE;
 }
 
 gboolean tcore_util_marshal_get_data(GHashTable *ht, const gchar *key,
-               void **data, TcoreUtilMarshalData type)
+               void **data, enum tcore_util_marshal_data_type type)
 {
        gboolean rv = FALSE;
        gpointer value;
@@ -2183,7 +1770,7 @@ gint tcore_util_marshal_get_int(GHashTable *ht, const gchar *key)
                return 0;
 
        rvalue = *tmp;
-       tcore_free(tmp);
+       g_free(tmp);
 
        return rvalue;
 }
@@ -2219,5 +1806,14 @@ GHashTable *tcore_util_marshal_get_object(GHashTable *ht, const gchar *key)
 
        return rvalue;
 }
-#endif /* #if 0 */
+
+char *tcore_util_get_version(void)
+{
+       return strdup(TCORE_VERSION);
+}
+
+void tcore_util_set_log(gboolean enable)
+{
+       tcore_debug = enable;
+}
 
index 10d45f9..bd55cd1 100644 (file)
@@ -6,6 +6,7 @@ includedir=${prefix}/include
 Name: tcore
 Description: SLP Telephony core API
 Version: 1.0
-Requires: glib-2.0 gobject-2.0 gudev-1.0 gio-unix-2.0 gio-2.0
+Requires: glib-2.0 gobject-2.0 gudev-1.0
 Libs: -L${libdir} -ltcore -ldl
 Cflags: -I${includedir}/tcore
+
diff --git a/tel-headers/CMakeLists.txt b/tel-headers/CMakeLists.txt
deleted file mode 100644 (file)
index e4834ec..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(tel-headers C)
-
-#SET(EXEC_PREFIX "\${prefix}")
-#SET(LIBDIR "\${prefix}/lib")
-#SET(INCLUDEDIR "\${prefix}/include")
-
-# Set required packages
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0)
-
-FOREACH(flag ${pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wextra -Wall -Wno-unused-parameter -Wno-missing-field-initializers")
-
-#Garbage collection - Unused code
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections")
-
-INCLUDE_DIRECTORIES(
-       ${CMAKE_BINARY_DIR}
-       ${CMAKE_BINARY_DIR}/tel-headers
-       ${CMAKE_SOURCE_DIR}/tel-headers/include
-       ${CMAKE_SOURCE_DIR}/tel-headers/introspection
-)
-
-MESSAGE(${CMAKE_C_FLAGS})
-MESSAGE(${CMAKE_EXE_LINKER_FLAGS})
-
-SET(INTROSPECTION_PATH ${CMAKE_SOURCE_DIR}/tel-headers/introspection)
-
-ADD_CUSTOM_COMMAND(
-       OUTPUT ${CMAKE_BINARY_DIR}/tel-headers/tel_generated_code.c
-       COMMAND gdbus-codegen
-       --interface-prefix org.tizen.telephony.
-       --generate-c-code tel_generated_code
-       --c-namespace Telephony
-       --c-generate-object-manager
-       ${INTROSPECTION_PATH}/manager.xml
-       ${INTROSPECTION_PATH}/network.xml
-       ${INTROSPECTION_PATH}/sim.xml
-       ${INTROSPECTION_PATH}/phonebook.xml
-       ${INTROSPECTION_PATH}/sap.xml
-       ${INTROSPECTION_PATH}/sat.xml
-       ${INTROSPECTION_PATH}/sms.xml
-       ${INTROSPECTION_PATH}/call.xml
-       ${INTROSPECTION_PATH}/ss.xml
-       ${INTROSPECTION_PATH}/modem.xml
-       ${INTROSPECTION_PATH}/gps.xml
-       COMMENT "Generating GDBus .c/.h")
-
-# pkgconfig file
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-CONFIGURE_FILE(tel-headers.pc.in tel-headers.pc @ONLY)
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${CMAKE_BINARY_DIR}/tel-headers/tel_generated_code.c)
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION 0.0.0 SOVERSION 0 OUTPUT_NAME ${PROJECT_NAME})
-
-# install
-INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/tel-headers/include/ DESTINATION include/tel-headers/include)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/tel-headers/tel_generated_code.h DESTINATION ${DBUS_GEN_CODE_PATH})
-INSTALL(TARGETS tel-headers LIBRARY DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tel-headers.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
diff --git a/tel-headers/include/tel_call.h b/tel-headers/include/tel_call.h
deleted file mode 100644 (file)
index 5b18ac6..0000000
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_CALL_H__
-#define __TEL_CALL_H__
-
-#include <glib.h>
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_CALL
-*  @{
-*
-*  @file tel_call.h
-*  @brief TAPI Call Interface
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TELEPHONY_CALL_INTERFACE TELEPHONY_SERVICE".Call"
-
-#define TEL_CALL_CALLING_NAME_LEN_MAX          82      /**< The maximum length of the string for calling party name.   */
-#define TEL_CALL_CALLING_NUMBER_LEN_MAX                82      /**< Maximum Dialling Digit Length  */
-#define TEL_CALL_MAX_CALLS_COUNT               6                       /**< Maximum number of call can be possible at a time */
-#define TEL_CALL_MAX_SOUND_EQ_PARAMETER_SIZE   6       /**< Maximum number of sound equalization parameter size */
-#define TEL_CALL_MAX_VOLUME_INFO_RECORD                20      /**< Maximum number of record for volume information */
-
-/**
- * @enum TelCallResult
- * Response (Return) values.
- */
-typedef enum {
-       TEL_CALL_RESULT_SUCCESS,                                                /**< Operation completed successfully */
-       TEL_CALL_RESULT_FAILURE,                                                /**< Operation Failed */
-       TEL_CALL_RESULT_INVALID_PARAMETER,                      /**< Invalid input parameters */
-       TEL_CALL_RESULT_MEMORY_FAILURE,                         /**< Memory allocation failed */
-       TEL_CALL_RESULT_OPERATION_NOT_SUPPORTED,        /**< Operation not supported */
-       TEL_CALL_RESULT_FDN_RESTRICTED,                         /**< FDN calls only */
-       TEL_CALL_RESULT_NETWORK_BUSY,                           /**< Network busy */
-       TEL_CALL_RESULT_SERVICE_NOT_ALLOWED,            /**< Service is not allowed */
-       TEL_CALL_RESULT_OPERATION_NOT_PERMITTED /**< Operation not permitted */
-} TelCallResult;
-
-/**
- * @enum TelCallEndCause
- * Call End Cause.
- */
-typedef enum {
-       TEL_CALL_END_CAUSE_NONE,                                                        /**< No Cause */
-       TEL_CALL_END_CAUSE_FAILED,                                              /**< Call failed */
-       TEL_CALL_END_CAUSE_UNASSIGNED_NUMBER,                   /**< Unassigned Number */
-       TEL_CALL_END_CAUSE_NO_ROUTE_TO_DEST,                    /**< No Route to Destination */
-       TEL_CALL_END_CAUSE_OPERATOR_DETERMINED_BARRING, /**< Operator Determined Barring */
-       TEL_CALL_END_CAUSE_NORMAL_CALL_CLEARING,                /**< Normal Call Clearing */
-       TEL_CALL_END_CAUSE_USER_BUSY,                                   /**< User Busy */
-       TEL_CALL_END_CAUSE_NO_USER_RESPONDING,          /**< No user Responding */
-       TEL_CALL_END_CAUSE_USER_ALERTING_NO_ANSWER,             /**< User Alerting no Answer */
-       TEL_CALL_END_CAUSE_CALL_REJECTED,                               /**< Call Rejected */
-       TEL_CALL_END_CAUSE_NUMBER_CHANGED,                              /**< Number Changed */
-       TEL_CALL_END_CAUSE_DESTINATION_OUT_OF_ORDER,    /**< Destination out of Order */
-       TEL_CALL_END_CAUSE_INVALID_NUMBER_FORMAT,               /**< Invalid Number Format */
-       TEL_CALL_END_CAUSE_FACILITY_REJECTED,                   /**< Facility Rejected */
-       TEL_CALL_END_CAUSE_NO_CIRCUIT_CHANNEL_AVAILABLE,        /**< No Circuit Channel Available */
-       TEL_CALL_END_CAUSE_NETWORK_OUT_OF_ORDER,                        /**< Network out of Order */
-       TEL_CALL_END_CAUSE_TEMPORARY_FAILURE,                           /**< Temporary Failure */
-       TEL_CALL_END_CAUSE_SWITCHING_EQUIPMENT_CONGESTION,      /**< Switching Equipment Congestion */
-       TEL_CALL_END_CAUSE_REQUESTED_CIRCUIT_CHANNEL_NOT_AVAILABLE,     /**< Requested Circuit channel not available */
-       TEL_CALL_END_CAUSE_REQUESTED_FACILITY_NOT_SUBSCRIBED,           /**< Requested facility not subscribed */
-       TEL_CALL_END_CAUSE_ACM_GEQ_ACMMAX,                      /**< ACM equal to greater than ACMAX */
-       TEL_CALL_END_CAUSE_IMEI_NOT_ACCEPTED,                   /**< IMEI not accepted */
-       TEL_CALL_END_CAUSE_NETWORK_FAILURE,             /**< Network unavailable */
-       TEL_CALL_END_CAUSE_CONGESTION,                  /**< Congestion */
-       TEL_CALL_END_CAUSE_SERVICE_OPTION_OUT_OF_ORDER, /**< Service option temporarily out of order */
-       TEL_CALL_END_CAUSE_ACCESS_CLASS_BLOCKED,                /**< Access class blocked */
-} TelCallEndCause;
-
-/**
- * @enum TelCallState
- * Call States.
- */
-typedef enum {
-       TEL_CALL_STATE_IDLE,            /**< Call is in idle state - i.e. no call */
-       TEL_CALL_STATE_ACTIVE,          /**< Call is in connected and conversation state */
-       TEL_CALL_STATE_HELD,            /**< Call is in held state */
-       TEL_CALL_STATE_DIALING,         /**< Call is in dialing state */
-       TEL_CALL_STATE_ALERT,           /**< Call is in alerting state */
-       TEL_CALL_STATE_INCOMING,        /**< Call is in incoming state */
-       TEL_CALL_STATE_WAITING,         /**< Call is in waiting state */
-} TelCallState;
-
-/**
- * @enum TelCallActiveLine
- * IN GSM ONLY: Call Active Line.
- */
-typedef enum {
-       TEL_CALL_ACTIVE_LINE1,          /**< Line 1 */
-       TEL_CALL_ACTIVE_LINE2           /**< Line 2 */
-} TelCallActiveLine;
-
-/**
- * @enum TelCallAnswerType
- * Call Answer Types.
- */
-typedef enum {
-       TEL_CALL_ANSWER_ACCEPT,                 /**< Used to answer an incoming call when there are no current active calls. */
-       TEL_CALL_ANSWER_REJECT,                 /**< Used to reject the incoming call */
-       TEL_CALL_ANSWER_REPLACE,                /**< Release current active call and accept the incoming call */
-       TEL_CALL_ANSWER_HOLD_AND_ACCEPT,        /**< Hold the current active call, and accept the wating call */
-} TelCallAnswerType;
-
-/**
- * @enum TelCallEndType
- * Call End Types.
- */
-typedef enum {
-       TEL_CALL_END,                           /**< Used to end single call with call handle */
-       TEL_CALL_END_ALL,                       /**< Used to end all calls */
-       TEL_CALL_END_ACTIVE_ALL,                /**< Used to end all active calls */
-       TEL_CALL_END_HOLD_ALL,                  /**< Used to end all hold calls */
-} TelCallEndType;
-
-/**
- * @enum TelCallType
- * Call Type.
- */
-typedef enum {
-       TEL_CALL_TYPE_VOICE,    /**< Voice call type. */
-       TEL_CALL_TYPE_VIDEO,    /**< Video call type  */
-       TEL_CALL_TYPE_E911      /**< Emergency call type. */
-} TelCallType;
-
-/**
- * @enum TelCallActiveState
- * Current Call State.
- */
-typedef enum {
-       TEL_CALL_CONNECT_IDLE,          /**< Call is in Idle state. */
-       TEL_CALL_CONNECT_ACTIVE,        /**< Call is in Active state.*/
-       TEL_CALL_CONNECT_HELD           /**< Call is in Held state. */
-} TelCallActiveState;
-
-/**
- * @enum TelCallCliValidity
- * CLI(Calling Line Identification) Validity.
- */
-typedef enum {
-       TEL_CALL_CLI_VALIDITY_VALID,                            /**< CLI is valid */
-       TEL_CALL_CLI_VALIDITY_WITHHELD,                 /**< CLI is withheld ("Rejected by user")*/
-       TEL_CALL_CLI_VALIDITY_NOT_AVAILABLE,            /**< CLI is not available ("Interaction with other service" or "Unavailable")*/
-       TEL_CALL_CLI_VALIDITY_NOT_AVAILABLE_PAYPHONE,   /**< CLI is not available ("Coin line/payphone")*/
-} TelCallCliValidity;
-
-/**
- * @enum TelCallCniValidity
- * CNI(Calling Name Identification) Validity.
- */
-typedef enum {
-       TEL_CALL_CNI_VALIDITY_VALID,                            /**< CLI is valid */
-       TEL_CALL_CNI_VALIDITY_WITHHELD,                 /**< CLI is withheld */
-       TEL_CALL_CNI_VALIDITY_NOT_AVAILABLE,            /**< CLI is not available */
-} TelCallCniValidity;
-
-/**
- * @enum TelCallEmergencyCategory
- * Emergency Call Category.
- */
-typedef enum {
-       TEL_CALL_ECC_DEFAULT = 0x00,            /**< ECC is default */
-       TEL_CALL_ECC_POLICE = 0x01,             /**< ECC is police */
-       TEL_CALL_ECC_AMBULANCE = 0x02,  /**< ECC is ambulance */
-       TEL_CALL_ECC_FIREBRIGADE = 0x04,        /**< ECC is fire station */
-       TEL_CALL_ECC_MARINEGUARD = 0x08,        /**< ECC is marine gaurd */
-       TEL_CALL_ECC_MOUNTAINRESCUE = 0x10,     /**< ECC is mountaion rescue */
-       TEL_CALL_ECC_MANUAL_ECALL = 0x20,       /**< ECC is manual Ecall */
-       TEL_CALL_ECC_AUTO_ECALL = 0x40  /**< ECC is Auto Ecall */
-} TelCallEmergencyCategory;
-
-/**
- * Call Dial Info.
- */
-typedef struct {
-       TelCallType call_type;                                  /**< Sets type of call (voice, data, video, emergency) */
-       TelCallEmergencyCategory ecc;                   /**< In case of emergency call, may provide category instead of number */
-       char number[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1];       /**< A string containing the destination phone number. This follows the dial number format.*/
-} TelCallDial;
-
-/**
- * Call End Info.
- */
-typedef struct {
-       unsigned int call_id;                   /**< Unique id for referring the call to release */
-       TelCallEndType end_type;                /**< End type used */
-} TelCallEnd;
-
-/**
- * Call Status Info.
- */
-typedef struct {
-       unsigned int call_id;                                   /**< Unique id for referring the call */
-
-       TelCallType call_type;                                  /**< Specifies type of call (voice, data, emergency) */
-       TelCallState call_state;                                        /**< Current Call state */
-
-       gboolean mo_call;                                       /**< TRUE for MO Call; FALSE if MT call*/
-       gboolean mpty;                                          /**< TRUE for Multi-party Call; FALSE if not Multi-party Call*/
-
-       TelCallCliValidity cli_validity;                                /**< Calling Line Identificatoin (only if mobile terminated call) */
-       char number[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1];       /**< Mobile Number */
-
-       TelCallCniValidity cni_validity;                                /**< Calling Name Identification (only if mobile terminated call) */
-       char name[TEL_CALL_CALLING_NAME_LEN_MAX + 1];           /**< Caller name */
-
-       gboolean forward;                                       /**< TRUE if call is forwared (only if mobile terminated call) */
-
-       TelCallActiveLine active_line;                          /**< Active line */
-} TelCallStatus;
-
-/**
- * All Call Status Info.
- */
-typedef struct {
-       unsigned int count;     /**< Number of calls */
-       TelCallStatus status[TEL_CALL_MAX_CALLS_COUNT]; /**< Call Status Info */
-} TelCallStatusList;
-
-/**
- * Incoming Call Info.
- */
-typedef struct {
-       unsigned int call_id;                                   /**< Unique id for referring the call */
-
-       TelCallCliValidity cli_validity;                                /**< Calling Line Identificatoin (only if mobile terminated call) */
-       char number[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1];       /**< Mobile Number */
-
-       TelCallCniValidity cni_validity;                                /**< Calling Name Identification (only if mobile terminated call) */
-       char name[TEL_CALL_CALLING_NAME_LEN_MAX + 1];           /**< Caller name */
-
-       gboolean forward;                                       /**< TRUE if call is forwared (only if mobile terminated call) */
-
-       TelCallActiveLine active_line;                          /**< Active line */
-}TelCallIncomingInfo;
-
-/**
- * All Call Status idle notification.
- */
-typedef struct {
-       unsigned int call_id;   /**< Unique id for referring the call */
-       TelCallEndCause cause;  /**< End cause for the call indicates whether the call is released normally or due to other cause*/
-} TelCallStatusIdleNoti;
-
-/**
- * @enum TelCallSoundRecording
- * Call Sound Recording status.
- */
-typedef enum {
-       TEL_SOUND_RECORDING_STOP,       /**< Stop call recording */
-       TEL_SOUND_RECORDING_START,      /**< Start call recording */
-       TEL_SOUND_RECORDING_PAUSE       /**< Pause call recording */
-} TelCallSoundRecording;
-
-/**
- * @enum TelCallSoundDevice
- * Call Sound Device type.
- */
-typedef enum {
-       TEL_SOUND_DEVICE_RECEIVER = 0x00,                       /**< Receiving the sound on receiver */
-       TEL_SOUND_DEVICE_SPEAKER_PHONE = 0x10,  /**< Receiving the sound on speaker phone */
-       TEL_SOUND_DEVICE_HFK = 0x20,                            /**< Receiving the sound on HFK */
-       TEL_SOUND_DEVICE_HEADSET = 0x30,                        /**< Receiving the sound on Headset */
-       TEL_SOUND_DEVICE_BLUETOOTH = 0x40,              /**< Receiving the sound on Bluetooth */
-       TEL_SOUND_DEVICE_EC = 0xA0,                             /**< Receiving the sound on Echo Cancellation device */
-} TelCallSoundDevice;
-
-/**
- * Call Sound Volume Info.
- */
-typedef struct {
-       TelCallSoundDevice device;              /**< Sound device */
-       unsigned int volume;            /**<Volume level(0 ~ 100)*/
-} TelCallVolumeInfo;
-
-/**
- * @enum TelCallSoundPath
- * Call Sound Path.
- */
-typedef enum {
-       TEL_SOUND_PATH_HANDSET  ,               /**<Audio path is handset*/
-       TEL_SOUND_PATH_HEADSET,                 /**<Audio path is headset*/
-       TEL_SOUND_PATH_HANDSFREE,               /**<Audio path is Handsfree*/
-       TEL_SOUND_PATH_BLUETOOTH,               /**<Audio path is bluetooth*/
-       TEL_SOUND_PATH_STEREO_BLUETOOTH,        /**<Audio path is stereo bluetooth*/
-       TEL_SOUND_PATH_SPK_PHONE,               /**<Audio path is speaker phone*/
-       TEL_SOUND_PATH_HEADSET_3_5PI,           /**<Audio path is headset_3_5PI*/
-       TEL_SOUND_PATH_BT_NSEC_OFF,             /**<Audio path is bluetooth NSEC off*/
-       TEL_SOUND_PATH_MIC2,                            /**<Audio path is Mic 1*/
-       TEL_SOUND_PATH_MIC1,                            /**<Audio path is Mic 2*/
-       TEL_SOUND_PATH_HEADSET_HAC,             /**<Audio path is Hearing aid*/
-} TelCallSoundPath;
-
-/**
- * Call Sound Path Info
- */
-typedef struct {
-       TelCallSoundPath path;  /**< Sound path */
-       gboolean ex_volume;     /**< TEL_SOUND_EX_VOLUME_ OFF/ON*/
-} TelCallSoundPathInfo;
-
-/**
- * @enum TelCallSoundEqualizationMode
- * Call Sound Equalization Mode.
- */
-typedef enum {
-       TEL_SOUND_EQUALIZATION_MODE_OFF,                /**< Sound Equalization is off */
-       TEL_SOUND_EQUALIZATION_MODE_ON,         /**< Sound Equalization is on */
-       TEL_SOUND_EQUALIZATION_MODE_FLAG_OFF,   /**< Sound Equalization mode flag is off */
-       TEL_SOUND_EQUALIZATION_MODE_FLAG_ON,    /**< Sound Equalization mode flag is on */
-       TEL_SOUND_EQUALIZATION_MODE_SOFT1,              /**< Sound Equalization is in soft1 mode */
-       TEL_SOUND_EQUALIZATION_MODE_SOFT2,              /**< Sound Equalization is in soft2 mode */
-} TelCallSoundEqualizationMode;
-
-/**
- * @enum TelCallSoundDirection
- * Call Sound Direction.
- */
-typedef enum {
-       TEL_SOUND_DIRECTION_LEFT,       /**< Sound direction is left */
-       TEL_SOUND_DIRECTION_RIGHT,      /**< Sound direction is right */
-} TelCallSoundDirection;
-
-/**
- * Call Sound Equalization Info
- */
-typedef struct {
-       TelCallSoundEqualizationMode mode;      /**< Sound equalization mode */
-       TelCallSoundDirection direction;                /**< Sound direction */
-       unsigned short parameter[TEL_CALL_MAX_SOUND_EQ_PARAMETER_SIZE]; /**< Sound equalization parameter */
-} TelCallSoundEqualization;
-
-/**
- * Call Volume Info
- */
-typedef struct {
-       unsigned int record_num;        /**< Number of call records */
-       TelCallVolumeInfo record[TEL_CALL_MAX_VOLUME_INFO_RECORD];      /**< Call volume info records */
-} TelCallGetVolumeInfo;
-
-/**
- * @enum TelCallSoundRingbackToneNoti
- * Call Sound ring back tone.
- */
-typedef enum {
-       TEL_CALL_SOUND_RINGBACK_TONE_START,     /**< Sound ringback tone start */
-       TEL_CALL_SOUND_RINGBACK_TONE_END,               /**< Sound ringback tone end */
-} TelCallSoundRingbackToneNoti;
-
-/**
- * @enum TelCallSoundWbamrNoti
- * Call AMR-WB Status
- */
-typedef enum {
-       TEL_CALL_SOUND_WBAMR_STATUS_OFF,        /**< Call sound WBAMR is off */
-       TEL_CALL_SOUND_WBAMR_STATUS_ON, /**< Call sound WBAMR is on */
-} TelCallSoundWbamrNoti;
-
-/**
- * Call Sound Equilization Notification Info.
- */
-typedef struct {
-       TelCallSoundEqualizationMode mode;      /**< Call sound equalization mode */
-       TelCallSoundDirection direction;                /**< Call sound direction */
-} TelCallSoundEqualizationNoti;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TEL_EVENT_CALL Call Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief Voice Call status idle
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VOICE_CALL_STATUS_IDLE
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VOICE_CALL_STATUS_IDLE
- *  @retval data \ref TelCallStatusIdleNoti
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VOICE_CALL_STATUS_IDLE                TELEPHONY_CALL_INTERFACE":VoiceCallStatusIdle"
-
- /**
- *  @hideinitializer
- *  @brief Voice Call status active
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VOICE_CALL_STATUS_ACTIVE
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VOICE_CALL_STATUS_ACTIVE
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VOICE_CALL_STATUS_ACTIVE              TELEPHONY_CALL_INTERFACE":VoiceCallStatusActive"
-
- /**
- *  @hideinitializer
- *  @brief Voice Call status held
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VOICE_CALL_STATUS_HELD
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VOICE_CALL_STATUS_HELD
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VOICE_CALL_STATUS_HELD                TELEPHONY_CALL_INTERFACE":VoiceCallStatusHeld"
-
- /**
- *  @hideinitializer
- *  @brief Voice Call status dialing
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VOICE_CALL_STATUS_DIALING
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VOICE_CALL_STATUS_DIALING
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VOICE_CALL_STATUS_DIALING             TELEPHONY_CALL_INTERFACE":VoiceCallStatusDialing"
-
-/**
- *  @hideinitializer
- *  @brief Voice Call status alert
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VOICE_CALL_STATUS_ALERT
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VOICE_CALL_STATUS_ALERT
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VOICE_CALL_STATUS_ALERT               TELEPHONY_CALL_INTERFACE":VoiceCallStatusAlert"
-
-/**
- *  @hideinitializer
- *  @brief Voice Call status incoming
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VOICE_CALL_STATUS_INCOMING
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VOICE_CALL_STATUS_INCOMING
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VOICE_CALL_STATUS_INCOMING    TELEPHONY_CALL_INTERFACE":VoiceCallStatusIncoming"
-
-/**
- *  @hideinitializer
- *  @brief Video Call status idle
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VIDEO_CALL_STATUS_IDLE
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VIDEO_CALL_STATUS_IDLE
- *  @retval data reference to \ref TelCallStatusIdleNoti structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VIDEO_CALL_STATUS_IDLE                TELEPHONY_CALL_INTERFACE":VideoCallStatusIdle"
-
-/**
- *  @hideinitializer
- *  @brief Video Call status active
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VIDEO_CALL_STATUS_ACTIVE
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VIDEO_CALL_STATUS_ACTIVE
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VIDEO_CALL_STATUS_ACTIVE              TELEPHONY_CALL_INTERFACE":VideoCallStatusActive"
-
- /**
- *  @hideinitializer
- *  @brief Video Call status dialing
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VIDEO_CALL_STATUS_DIALING
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VIDEO_CALL_STATUS_DIALING
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VIDEO_CALL_STATUS_DIALING             TELEPHONY_CALL_INTERFACE":VideoCallStatusDialing"
-
- /**
- *  @hideinitializer
- *  @brief Video Call status alert
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VIDEO_CALL_STATUS_ALERT
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VIDEO_CALL_STATUS_ALERT
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VIDEO_CALL_STATUS_ALERT               TELEPHONY_CALL_INTERFACE":VideoCallStatusAlert"
-
- /**
- *  @hideinitializer
- *  @brief Video Call status incoming
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_VIDEO_CALL_STATUS_INCOMING
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_VIDEO_CALL_STATUS_INCOMING
- *  @retval data \ref unsigned int call_id
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_VIDEO_CALL_STATUS_INCOMING    TELEPHONY_CALL_INTERFACE":VideoCallStatusIncoming"
-
- /**
- *  @hideinitializer
- *  @brief MO Call wating
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MO_WAITING
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MO_WAITING
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MO_WAITING                  TELEPHONY_CALL_INTERFACE":MoWaiting"
-
- /**
- *  @hideinitializer
- *  @brief MO Call forwarded
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MO_FORWARDED
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MO_FORWARDED
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MO_FORWARDED                TELEPHONY_CALL_INTERFACE":MoForwarded"
-
- /**
- *  @hideinitializer
- *  @brief MO Incoming call barred
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MO_BARRED_INCOMING
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MO_BARRED_INCOMING
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MO_BARRED_INCOMING          TELEPHONY_CALL_INTERFACE":MoBarredIncoming"
-
- /**
- *  @hideinitializer
- *  @brief MO Outgoing call barred
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MO_BARRED_OUTGOING
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MO_BARRED_OUTGOING
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MO_BARRED_OUTGOING          TELEPHONY_CALL_INTERFACE":MoBarredOutgoing"
-
- /**
- *  @hideinitializer
- *  @brief MO Call forward unconditional
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MO_FORWARD_UNCONDITIONAL
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MO_FORWARD_UNCONDITIONAL
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MO_FORWARD_UNCONDITIONAL    TELEPHONY_CALL_INTERFACE":MoForwardUnconditional"
-
- /**
- *  @hideinitializer
- *  @brief MO Call forward conditional
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MO_FORWARD_CONDITIONAL
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MO_FORWARD_CONDITIONAL
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MO_FORWARD_CONDITIONAL      TELEPHONY_CALL_INTERFACE":MoForwardConditional"
-
- /**
- *  @hideinitializer
- *  @brief MO Call deflected
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MO_DEFLECTED
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MO_DEFLECTED
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MO_DEFLECTED                        TELEPHONY_CALL_INTERFACE":MoDeflected"
-
- /**
- *  @hideinitializer
- *  @brief MT Call forwarded
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MT_FORWARDED
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MT_FORWARDED
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MT_FORWARDED                        TELEPHONY_CALL_INTERFACE":MtForwarded"
-
- /**
- *  @hideinitializer
- *  @brief MT Call deflected
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_MT_DEFLECTED
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_MT_DEFLECTED
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_MT_DEFLECTED                        TELEPHONY_CALL_INTERFACE":MtDeflected"
-
- /**
- *  @hideinitializer
- *  @brief Call Transfered
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_TRANSFERED
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_TRANSFERED
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_TRANSFERED          TELEPHONY_CALL_INTERFACE":Transfered"
-
- /**
- *  @hideinitializer
- *  @brief Call held
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_HELD
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_HELD
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_HELD                        TELEPHONY_CALL_INTERFACE":CallHeld"
-
- /**
- *  @hideinitializer
- *  @brief Call active
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_ACTIVE
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_ACTIVE
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_ACTIVE                      TELEPHONY_CALL_INTERFACE":CallActive"
-
- /**
- *  @hideinitializer
- *  @brief Call joined
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_INFO_JOINED
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_INFO_JOINED
- *  @retval data none
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_INFO_JOINED                      TELEPHONY_CALL_INTERFACE":CallJoined"
-
- /**
- *  @hideinitializer
- *  @brief Call Sound Ringback Tone
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_SOUND_RINGBACK_TONE
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_SOUND_RINGBACK_TONE
- *  @retval data \ref TelCallSoundRingbackToneNoti
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_SOUND_RINGBACK_TONE              TELEPHONY_CALL_INTERFACE":CallSoundRingbackToneControl"
-
- /**
- *  @hideinitializer
- *  @brief Call Sound WBAMR
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_SOUND_WBAMR
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_SOUND_WBAMR
- *  @retval data \ref TelCallSoundWbamrNoti
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_SOUND_WBAMR                      TELEPHONY_CALL_INTERFACE":CallSoundWbamr"
-
- /**
- *  @hideinitializer
- *  @brief Call Sound Equalization
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_SOUND_EQUALIZATION
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_SOUND_EQUALIZATION
- *  @retval data \ref TelCallSoundEqualizationNoti
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_SOUND_EQUALIZATION               TELEPHONY_CALL_INTERFACE":CallSoundEqualiztion"
-
- /**
- *  @hideinitializer
- *  @brief Call Sound Clock Status
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_CALL_SOUND_CLOCK_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_CALL_SOUND_CLOCK_STATUS
- *  @retval data <b>TRUE</b>: Sound clock is ON\n <b>FALSE</b>: Sound clock is OFF
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_CALL_SOUND_CLOCK_STATUS               TELEPHONY_CALL_INTERFACE":CallSoundClockStatus"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
- #endif  /* __TEL_CALL_H__ */
diff --git a/tel-headers/include/tel_gps.h b/tel-headers/include/tel_gps.h
deleted file mode 100644 (file)
index d84efbc..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_GPS_H__
-#define __TEL_GPS_H__
-
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_GPS
-*  @{
-*
-*  @file tel_gps.h
-*  @brief TAPI GPS Interface
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TELEPHONY_GPS_INTERFACE TELEPHONY_SERVICE".Gps"
-
-/**
- * @enum TelGpsResult
- * Response (Return) values.
- */
-typedef enum {
-       TEL_GPS_RESULT_SUCCESS,                                         /**< Operation completed successfully */
-       TEL_GPS_RESULT_FAILURE,                                         /**< Operation Failed */
-       TEL_GPS_RESULT_INVALID_PARAMETER,                       /**< Invalid input parameters */
-       TEL_GPS_RESULT_MEMORY_FAILURE,                          /**< Memory allocation failed */
-       TEL_GPS_RESULT_OPERATION_NOT_SUPPORTED, /**< Operation not supported */
-       TEL_GPS_RESULT_OPERATION_NOT_PERMITTED, /**< Operation not permitted */
-       TEL_GPS_RESULT_UNKNOWN_FAILURE                          /**< Unknown failure */
-} TelGpsResult;
-
-/**
- * GPS info.
- */
-typedef struct {
-       unsigned int data_len;          /**< Data length of GPS info */
-       unsigned char *data;            /**< GPS information */
-} TelGpsDataInfo;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TEL_EVENT_GPS GPS Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief GPS assist data
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_GPS_ASSIST_DATA
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_GPS_ASSIST_DATA
- *  @retval data reference to GPS data (as a string)
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_GPS_ASSIST_DATA                       TELEPHONY_GPS_INTERFACE":AssistData"
-
-/**
- *  @hideinitializer
- *  @brief GPS position information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_GPS_MEASURE_POSITION
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_GPS_MEASURE_POSITION
- *  @retval data reference to GPS data (as a string)
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_GPS_MEASURE_POSITION          TELEPHONY_GPS_INTERFACE":MeasurePosition"
-
-/**
- *  @hideinitializer
- *  @brief GPS reset assist data
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_GPS_RESET_ASSIST_DATA
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_GPS_RESET_ASSIST_DATA
- *  @retval data None
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_GPS_RESET_ASSIST_DATA         TELEPHONY_GPS_INTERFACE":ResetAssistData"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
-#endif /* __TEL_GPS_H__ */
diff --git a/tel-headers/include/tel_modem.h b/tel-headers/include/tel_modem.h
deleted file mode 100644 (file)
index de62261..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_MODEM_H__
-#define __TEL_MODEM_H__
-
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_MODEM
-*  @{
-*
-*  @file tel_modem.h
-*  @brief TAPI Modem Interface
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TELEPHONY_MODEM_INTERFACE   TELEPHONY_SERVICE".Modem"
-
-#define TEL_MODEM_IMEI_LENGTH_MAX 15   /**< Maximum IMEI length */
-
-#define TEL_MODEM_VERSION_LENGTH_MAX 32        /**< Maximum version information length */
-
-/**
- * @enum TelModemResult
- * Response (Result) codes
- */
-typedef enum {
-       TEL_MODEM_RESULT_SUCCESS,                                       /**< Operation completed successfully */
-       TEL_MODEM_RESULT_FAILURE,                                       /**< Operation Failed */
-       TEL_MODEM_RESULT_INVALID_PARAMETER,             /**< Invalid input parameters */
-       TEL_MODEM_RESULT_MEMORY_FAILURE,                        /**< Memory allocation failed */
-       TEL_MODEM_RESULT_OPERATION_NOT_SUPPORTED,/**< Operation not supported */
-       TEL_MODEM_RESULT_OPERATION_NOT_PERMITTED,       /**< Operation not permitted */
-       TEL_MODEM_RESULT_UNKNOWN_FAILURE                        /**< Unknown failure */
-} TelModemResult;
-
-/**
- * @enum TelModemPowerStatus
- * Power Status
- */
-typedef enum {
-       TEL_MODEM_POWER_OFF, /**< Modem power off */
-       TEL_MODEM_POWER_ON, /**< Modem power on */
-       TEL_MODEM_POWER_ERROR /**< Modem power error */
-} TelModemPowerStatus;
-
-/**
- * @enum TelModemFlightModeStatus
- * Flight Mode Status
- */
-typedef enum {
-       TEL_MODEM_FLIGHT_MODE_UNKNOWN, /**< Status is unknown at the moment */
-       TEL_MODEM_FLIGHT_MODE_OFF, /**< Flight mode is OFF. Device is Online */
-       TEL_MODEM_FLIGHT_MODE_ON /**< Flight mode is ON. Device is in Low Power */
-} TelModemFlightModeStatus;
-
-/**
- * Version Information
- */
-typedef struct {
-       char software_version[TEL_MODEM_VERSION_LENGTH_MAX + 1]; /**< Software Version */
-       char hardware_version[TEL_MODEM_VERSION_LENGTH_MAX + 1]; /**< Hardware Version */
-       char calibration_date[TEL_MODEM_VERSION_LENGTH_MAX + 1]; /**< Calibration Date */
-       char product_code[TEL_MODEM_VERSION_LENGTH_MAX + 1]; /**< Product Code */
-} TelModemVersion;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TAPI_EVENT_MODEM Modem Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief Power Status
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_MODEM_POWER_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_MODEM_POWER_STATUS
- *  @retval data \ref TelModemPowerStatus
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_MODEM_POWER_STATUS            TELEPHONY_MODEM_INTERFACE":power_status"
-
-/**
- *  @hideinitializer
- *  @brief Flight Mode Status
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_MODEM_FLIGHT_MODE_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_MODEM_FLIGHT_MODE_STATUS
- *  @retval data <b>TRUE</b>: Flight mode is ON\n <b>FALSE</b>: Flight mode is OFF
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_MODEM_FLIGHT_MODE_STATUS              TELEPHONY_MODEM_INTERFACE":flight_mode_status"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-
-#endif /* __TEL_MODEM_H__ */
diff --git a/tel-headers/include/tel_network.h b/tel-headers/include/tel_network.h
deleted file mode 100644 (file)
index e3120a9..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_NETWORK_H__
-#define __TEL_NETWORK_H__
-
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_NETWORK
-*  @{
-*
-*  @file tel_network.h
-*  @brief TAPI Network Interface
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TELEPHONY_NETWORK_INTERFACE TELEPHONY_SERVICE".Network"
-
-#define TEL_NETWORK_PLMN_LEN_MAX 6     /**< Maximum PLMN(MCCMNC) length */
-
-/**
- * @enum TelNetworkResult
- * Response (Return) values.
- */
-typedef enum {
-       TEL_NETWORK_RESULT_SUCCESS,                                             /**< Operation completed successfully */
-       TEL_NETWORK_RESULT_FAILURE,                                             /**< Operation Failed */
-       TEL_NETWORK_RESULT_INVALID_PARAMETER,                   /**< Invalid input parameters */
-       TEL_NETWORK_RESULT_MEMORY_FAILURE,                              /**< Memory allocation failed */
-       TEL_NETWORK_RESULT_OPERATION_NOT_PERMITTED,     /**< Operation not permitted */
-       TEL_NETWORK_RESULT_OPERATION_NOT_SUPPORTED      /**< Operation not supported */
-} TelNetworkResult;
-
-/**
- * @enum TelNetworkMode
- * Network Mode
- */
-typedef enum {
-       TEL_NETWORK_MODE_AUTO, /**< auto select network mode or hybrid */
-       TEL_NETWORK_MODE_2G, /**< 2G: GSM, GPRS, EDGE etc */
-       TEL_NETWORK_MODE_3G,    /**< 3G: UMTS, HSDPA, HSUPA etc */
-       TEL_NETWORK_MODE_LTE, /**< LTE */
-} TelNetworkMode;
-
-/**
- * @enum TelNetworkSelectionMode
- * Network Selection Mode
- */
-typedef enum {
-       TEL_NETWORK_SELECTION_MODE_AUTOMATIC, /**< Automatic selection mode*/
-       TEL_NETWORK_SELECTION_MODE_MANUAL, /**< Manual selection mode */
-} TelNetworkSelectionMode;
-
-/**
- * @enum TelNetworkAct
- * Network Access Technology
- */
-typedef enum {
-       TEL_NETWORK_ACT_UNKNOWN, /**< ACT is not presented */
-       TEL_NETWORK_ACT_GSM, /**< GSM */
-       TEL_NETWORK_ACT_GPRS, /**< GPRS */
-       TEL_NETWORK_ACT_EGPRS, /**< EDGE */
-       TEL_NETWORK_ACT_UMTS, /**< 3G */
-       TEL_NETWORK_ACT_GSM_AND_UMTS, /**< Both GSM and UMTS available */
-       TEL_NETWORK_ACT_HSDPA, /**< HSDPA */
-       TEL_NETWORK_ACT_HSUPA, /**< HSUPA */
-       TEL_NETWORK_ACT_HSPA, /**< HSDPA & HSUPA */
-       TEL_NETWORK_ACT_LTE, /**< LTE */
-} TelNetworkAct;
-
-/**
- * @enum TelNetworkRegStatus
- * Network Registration Status
- */
-typedef enum {
-       TEL_NETWORK_REG_STATUS_UNREGISTERED, /**< Not registered, not searching */
-       TEL_NETWORK_REG_STATUS_REGISTERED, /**< Registered, home network */
-       TEL_NETWORK_REG_STATUS_SEARCHING, /**< Not regsitered, searching */
-       TEL_NETWORK_REG_STATUS_DENIED, /**< Registration is denied */
-       TEL_NETWORK_REG_STATUS_UNKNOWN, /**< Unknown */
-       TEL_NETWORK_REG_STATUS_ROAMING, /**< Registered, roaming */
-} TelNetworkRegStatus;
-
-/**
- * @enum TelNetworkPlmnStatus
- * Network Plmn Status
- */
-typedef enum
-{
-       TEL_NETWORK_STATUS_UNKNOWN, /**< Unknown Plmn */
-       TEL_NETWORK_STATUS_AVAILABLE, /**< Available Plmn */
-       TEL_NETWORK_STATUS_CURRENT, /**< Network currently registered */
-       TEL_NETWORK_STATUS_FORBIDDEN, /**< Forbidden Plmn  */
-} TelNetworkPlmnStatus;
-
-/**
- * Network Registration Status Information
- */
-typedef struct {
-       TelNetworkRegStatus cs_status; /**< CS domain registration status */
-       TelNetworkRegStatus ps_status; /**< PS domain registration status */
-       TelNetworkAct act; /**< Access technology */
-} TelNetworkRegStatusInfo;
-
-/**
- * Network Cell Information
- */
-typedef struct {
-       unsigned int lac; /**< Location Area Code */
-       unsigned int cell_id; /**< Cell id */
-       unsigned int rac; /**< Routing Area Code - PS network specific */
-} TelNetworkCellInfo;
-
-/**
- * Network Registration Information
- */
-typedef struct {
-       TelNetworkRegStatusInfo reg_status_info; /**< Registration Status Information */
-       TelNetworkCellInfo cell_info; /**< Cell Information */
-} TelNetworkRegistrationInfo;
-
-/**
- * Network Identity Information
- */
-typedef struct {
-       char *plmn; /**< numeric name (MCCMNC) */
-       char *short_name; /**< short alphanumeric operator name */
-       char *long_name; /**< long alphanumeric operator name */
-} TelNetworkIdentityInfo;
-
-/**
- * Network Selection Manual Information
- */
-typedef struct {
-       char *plmn; /**< numeric name (MCCMNC) */
-       TelNetworkAct act; /**< Access technology */
-} TelNetworkSelectManualInfo;
-
-/**
- * Network Information
- */
-typedef struct {
-       TelNetworkPlmnStatus plmn_status; /**< Plmn Status */
-       TelNetworkAct act; /**< Access technology */
-       TelNetworkIdentityInfo network_identity; /**< Network Identity Information */
-} TelNetworkInfo;
-
-/**
- * Network Plmn List
- */
-typedef struct {
-       unsigned int count; /**< Network Plmn count */
-       TelNetworkInfo *network_list; /**< Network list */
-} TelNetworkPlmnList;
-
-/**
- * Network Preferred Plmn Information
- */
-typedef struct {
-       unsigned int index; /**< Preferred Plmn list index, start from 1 */
-       char *plmn; /**< numeric operator name (MCCMNC) */
-       TelNetworkAct act; /**< Access technology */
-} TelNetworkPreferredPlmnInfo;
-
-/**
- * Network Preferred Plmn List
- */
-typedef struct {
-       unsigned int count; /**< Number of preferred plmns in the list */
-       TelNetworkPreferredPlmnInfo *list; /**< Preferred Plmns List */
-} TelNetworkPreferredPlmnList;
-
-/**
- * Network Gsm Neighbour Cell Information
- */
-typedef struct {
-       int cell_id; /**< Cell ID (-1 indicates cell ID not present)*/
-       int lac; /**< Location area code (ignored when cell_id not present) */
-       int bcch; /**< Broadcast Control Channel Frequency number */
-       int bsic; /**< Base Station Identification Code  */
-       int rxlev; /**< Received Signal Strength level. Valid values: (0-63,99)
-                               * Reference: 33GPP TS 45.008 [20] subclause 8.1.4
-                               - Rxlev 0 is a signal strength less than -110 dBm
-                               - Rxlev 1 is -110 dBm to -109 dBm
-                               - Rxlev 2 is -109 dBm to -108 dBm
-                                - ...
-                               - Rxlev 62 is -49 dBm to -48 dBm
-                               - Rxlev 63 is greater than -48 dBm
-                               - Rxlev 99 is not known or not detectable
-                       */
-} TelNetworkGsmNeighbourCellInfo;
-
-/**
- * Network Umts Neighbour Cell Information
- */
-typedef struct {
-       int cell_id; /**< Cell ID (-1 indicates cell ID not present)*/
-       int lac; /**< Location area code (ignored if cell_id not present)*/
-       int arfcn; /**< UTRA Absolute RF Channel Number */
-       int psc; /**< Primary scrambling Code   */
-       int rscp; /**< Received Signal Code Power. Valid values: (0-96, 255)
-                               * Reference : 3GPP TS 25.133 [95] subclause 9.1.1.3
-                                and 3GPP TS 25.123 [96] subclause 9.1.1.1.3)
-                               - Rscp 0 is a signal strength less than -120 dBm
-                               - Rscp 1 is -120 dBm to -119 dBm
-                               - Rscp 2 is -119 dBm to -118 dBm
-                               - ...
-                               - Rscp 95 is -26 dBm to -25 dBm
-                               - Rscp 96 is greater than -25 dBm
-                               - Rscp 255 is not known or not detectable
-                       */
-} TelNetworkUmtsNeighbourCellInfo;
-
-/**
- * Network Neighbour Cell Information
- */
-typedef struct {
-       unsigned int gsm_list_count; /**< GSM cells count */
-       TelNetworkGsmNeighbourCellInfo *gsm_list; /**< GSM cells information */
-       unsigned int umts_list_count; /**< UMTS cells count */
-       TelNetworkUmtsNeighbourCellInfo *umts_list; /**< UMTS cells information */
-} TelNetworkNeighbourCellInfo;
-
-/**
- * Network Nitz Information
- */
-typedef struct {
-       unsigned int year; /**< Last two digits of year */
-       unsigned int month; /**< Month */
-       unsigned int day; /**< Day */
-       unsigned int hour; /**< Hour */
-       unsigned int minute; /**< Minute */
-       unsigned int second; /**< Second */
-       int gmtoff; /**< GMT Offset */
-       gboolean isdst; /**< Daylight Saving Time Valid */
-       int dstoff; /**< Daylight Saving Time Offset */
-       char *plmn; /**< numeric name (MCCMNC) */
-} TelNetworkNitzInfoNoti;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TAPI_EVENT_NETWORK Network Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief Network registration status
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_NETWORK_REGISTRATION_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_NETWORK_REGISTRATION_STATUS
- *  @retval data reference to \ref TelNetworkRegStatusInfo structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_NETWORK_REGISTRATION_STATUS   TELEPHONY_NETWORK_INTERFACE":RegistrationStatus"
-
-/**
- *  @hideinitializer
- *  @brief Network cell information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_NETWORK_CELL_INFO
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_NETWORK_CELL_INFO
- *  @retval data reference to \ref TelNetworkCellInfo structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_NETWORK_CELL_INFO                     TELEPHONY_NETWORK_INTERFACE":CellInfo"
-
-/**
- *  @hideinitializer
- *  @brief Network Identity information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_NETWORK_IDENTITY
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_NETWORK_IDENTITY
- *  @retval data reference to \ref TelNetworkIdentityInfo structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_NETWORK_IDENTITY                      TELEPHONY_NETWORK_INTERFACE":Identity"
-
-/**
- *  @hideinitializer
- *  @brief Network RSSI
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_NETWORK_RSSI
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_NETWORK_RSSI
- *  @retval data \ref unsigned int rssi
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_NETWORK_RSSI                          TELEPHONY_NETWORK_INTERFACE":Rssi"
-
-/**
- *  @hideinitializer
- *  @brief Network time information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_NETWORK_TIME_INFO
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_NETWORK_TIME_INFO
- *  @retval data reference to \ref TelNetworkNitzInfoNoti structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_NETWORK_TIME_INFO                     TELEPHONY_NETWORK_INTERFACE":TimeInfo"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-
-#endif /* __TEL_NETWORK_H__ */
-
diff --git a/tel-headers/include/tel_phonebook.h b/tel-headers/include/tel_phonebook.h
deleted file mode 100644 (file)
index fc39db7..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_PHONEBOOK_H__
-#define __TEL_PHONEBOOK_H__
-
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_PHONEBOOK
-*  @{
-*
-*  @file tel_phonebook.h
-*  @brief TAPI Phonebook Interface
-*/
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define TELEPHONY_PB_INTERFACE  TELEPHONY_SERVICE".Phonebook"
-
-#define TEL_PB_TEXT_MAX_LEN    255 /**< Phone book text maximum length */
-#define TEL_PB_NUMBER_MAX_LEN  82 /**< Phone book number maximum length */
-#define TEL_PB_ANR_MAX_COUNT   3 /**< Phone book ANR maximum count */
-#define TEL_PB_EMAIL_MAX_COUNT 4 /**< Phone book email maximum count */
-
-/**
- * @enum TelPbResult
- * Response (Return) values.
- */
-typedef enum {
-       TEL_PB_RESULT_SUCCESS, /**< Operation completed successfully */
-       TEL_PB_RESULT_FAILURE, /**< Operation Failed */
-       TEL_PB_RESULT_INVALID_PARAMETER, /**< Invalid input parameters */
-       TEL_PB_RESULT_MEMORY_FAILURE, /**< Memory allocation failed */
-       TEL_PB_RESULT_OPERATION_NOT_SUPPORTED, /**< Operation not supported */
-       TEL_PB_RESULT_UNKNOWN_FAILURE, /**< Unknown failure */
-       TEL_PB_RESULT_INVALID_INDEX, /**< The index passed was not a valid index. */
-       TEL_PB_RESULT_NOT_INITIALIZED, /**< Phonebook not initialized */
-       TEL_PB_RESULT_PIN2_REQUIRED, /**< PIN2 Required */
-       TEL_PB_RESULT_PUK2_REQUIRED, /**< PUK2 Required */
-       TEL_PB_RESULT_ACCESS_RESTRICTED, /**< Access restricted */
-       TEL_PB_RESULT_OPERATION_NOT_PERMITTED   /**< Operation not permitted */
-} TelPbResult;
-
-/**
- * @enum TelPbType
- * This enumeration defines the Phonebook type.
- */
-typedef enum {
-       TEL_PB_FDN, /**< Fixed Dialing Number */
-       TEL_PB_ADN, /**< Abbreviated dialling numbers */
-       TEL_PB_SDN, /**< Service Dialing Number */
-       TEL_PB_USIM, /**< USIM - 3G phone book */
-} TelPbType;
-
-/**
- * This data structure gives the phone book availability of current SIM
- */
-typedef struct {
-       gboolean fdn; /**< Availability of Fixed Dialing Number */
-       gboolean adn; /**< Availability of Abbreviated dialling numbers */
-       gboolean sdn; /**< Availability of Service Dialing Number */
-       gboolean usim; /**< Availability of USIM - 3G phone book */
-} TelPbList;
-
-/**
- * @enum TelPbInitInfo
- * This data structure gives the phonebook init information
- */
-typedef struct {
-       gboolean init_status; /**< Phonebook init status */
-       TelPbList pb_list; /**< Phonebook availability of current SIM */
-} TelPbInitInfo;
-
-/**
- *This data structure gives the phone book entry information(SIM).
- */
-typedef struct {
-       unsigned int max_count; /**< Total number of locations in selected memory */
-       unsigned int used_count; /**< Number of used locations in selected memory */
-       unsigned int max_num_len; /**< maximum length of field "number" */
-       unsigned int max_text_len; /**< maximum length of field "text" */
-} TelPbSimInfo;
-
-/**
- *This data structure gives the phone book entry information(USIM).
- */
-typedef struct {
-       unsigned int max_count; /**< Total number of locations in selected memory */
-       unsigned int used_count; /**< Number of used locations in selected memory */
-       unsigned int max_num_len; /**< maximum length of field "number" */
-       unsigned int max_text_len; /**< maximum length of field "text" */
-
-       unsigned char max_anr_count; /**< Total number of locations for Additional Number */
-       unsigned int max_anr_len; /**< Maximun length for Additional Number */
-
-       unsigned char max_email_count; /**< Total number of locations for email */
-       unsigned int max_email_len; /**< Maximun length for email */
-
-       unsigned int max_sne_len; /**< Maximun length for second name*/
-
-       unsigned int max_gas_count; /**< Total number of locations for Grouping Alpha String */
-       unsigned int max_gas_len; /**< Maximun length for Grouping Alpha String */
-
-       unsigned int max_aas_count; /**< Total number of locations for Additional Alpha String */
-       unsigned int max_aas_len; /**< Maximun length for Additional Alpha String */
-} TelPbUsimInfo;
-
-/**
- *This data structure gives SIM/USIM the phone book entry information.
- */
-typedef struct {
-       TelPbType pb_type; /**< Type of Phone book */
-       union {
-               TelPbSimInfo sim; /**< 2G sim phone book info */
-               TelPbUsimInfo usim; /**< 3G sim phone book info */
-       } info_u; /**< union */
-} TelPbInfo;
-
-/**
- *These data structures defines the phone book record fields.
- */
-typedef char TelPbName[TEL_PB_TEXT_MAX_LEN + 1]; /**< Record of Phone book name */
-
-typedef char TelPbNumber[TEL_PB_NUMBER_MAX_LEN + 1]; /**< Record of Phone book number */
-
-typedef char TelPbEmail[TEL_PB_TEXT_MAX_LEN + 1]; /**< Record of Phone book email */
-
-/**
- *These data structures defines the phone book Additional number information
- */
-typedef struct {
-       TelPbNumber number; /**< Additional number */
-       gboolean description;   /**< TRUE if the ANR has an additional number description */
-       TelPbName aas;          /**< Additional number description   */
-} TelPbAnr;
-
-/**
- *These data structures defines the USIM phone book records
- */
-typedef struct {
-       TelPbName name; /**< USIM Phone book name */
-       TelPbNumber number; /**< USIM Phone book number */
-
-       TelPbName sne; /**< USIM Phone book second name */
-       TelPbName grp_name; /**< USIM Phone book group name */
-
-       unsigned char anr_count; /**< USIM Phone book Additional number count */
-       TelPbAnr anr[TEL_PB_ANR_MAX_COUNT]; /**< USIM Phone book Additional number description */
-
-       unsigned char email_count; /**< USIM Phone book email count */
-       TelPbEmail email[TEL_PB_EMAIL_MAX_COUNT]; /**< USIM Phone book email description */
-
-       gboolean hidden; /**< indicates if the entry is hidden or not - only available, if a UICC with an active USIM application is present */
-} TelPbUsimRecord;
-
-/**
- *These data structures defines the SIM phone book records
- */
-typedef struct {
-       TelPbName name; /**< SIM Phone book name */
-       TelPbNumber number; /**< SIM Phone book number */
-} TelPbSimRecord;
-
-/**
- *These data structures defines the read record informations
- */
-typedef struct {
-       unsigned int index; /**< Index of phonebook memory */
-       unsigned int next_index; /**< Next index of phonebook memory */
-
-       TelPbType pb_type; /**< Type of Phone book */
-       union {
-               TelPbSimRecord sim; /**< 2G sim phone book info */
-               TelPbUsimRecord usim; /**< 3G sim phone book info */
-       } rec_u; /**< union */
-} TelPbReadRecord;
-
-/**
- *These data structures defines the update record informations
- */
-typedef struct {
-       unsigned int index; /**< Index of phonebook memory */
-
-       TelPbType pb_type; /**< Type of Phone book */
-       union {
-               TelPbSimRecord sim; /**< 2G sim phone book info */
-               TelPbUsimRecord usim; /**< 3G sim phone book info */
-       } rec_u; /**< union */
-} TelPbUpdateRecord;
-
-/**
- *These data structures defines the phone book record informations
- */
-typedef struct {
-       TelPbType pb_type; /**< Type of Phone book */
-       unsigned int index; /**< Index of phonebook memory */
-} TelPbRecordInfo;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TEL_EVENT_PHONEBOOK Phonebook Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief Phonebook init status
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_PB_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_PB_STATUS
- *  #retval data \ref TelPbInitInfo
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_PB_STATUS                             TELEPHONY_PB_INTERFACE":Status"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-
-#endif /* __TEL_PHONEBOOK_H__ */
diff --git a/tel-headers/include/tel_return.h b/tel-headers/include/tel_return.h
deleted file mode 100644 (file)
index 2dc87a6..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_RETURN_H__
-#define __TEL_RETURN_H__
-
-/**
-*  @addtogroup TAPI_COMMON
-*  @{
-*
-*  @file tel_return.h
-*  @brief TAPI return values
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @enum TelReturn
- * TAPI return values
- */
-typedef enum {
-       TEL_RETURN_SUCCESS, /**< Operation completed successfully */
-       TEL_RETURN_FAILURE, /**< Operation Failed */
-       TEL_RETURN_INVALID_PARAMETER, /**< Invalid input parameters */
-       TEL_RETURN_MEMORY_FAILURE, /**< Memory allocation failed */
-       TEL_RETURN_OPERATION_NOT_SUPPORTED, /**< Operation not supported */
-       TEL_RETURN_UNKNOWN_FAILURE /**< Unknown failure */
-} TelReturn;
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-
-#endif /* __TEL_RETURN_H__ */
diff --git a/tel-headers/include/tel_sap.h b/tel-headers/include/tel_sap.h
deleted file mode 100644 (file)
index d22d363..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-
-#ifndef __TEL_SAP_H__
-#define __TEL_SAP_H__
-
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_SAP
-*  @{
-*
-*  @file tel_sap.h
-*  @brief TAPI SAP Interface
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TELEPHONY_SAP_INTERFACE         TELEPHONY_SERVICE".Sap"
-
-#define TEL_SAP_APDU_LEN_MAX           261     /**< APDU max command length */
-#define TEL_SAP_APDU_RESP_LEN_MAX      258     /**< APDU max response length */
-#define TEL_SAP_ATR_LEN_MAX            33      /**< Answer to Reset data max length */
-
-/**
- * @enum TelSapResult
- * This enum gives the SAP result information.
- */
-
-typedef enum {
-       TEL_SAP_RESULT_SUCCESS,                 /**<  operation successfully completed*/
-       TEL_SAP_RESULT_FAILURE_NO_REASON,       /**<  no reason*/
-       TEL_SAP_RESULT_CARD_NOT_ACCESSIBLE,     /**<  not accessible*/
-       TEL_SAP_RESULT_CARD_ALREADY_POWERED_OFF,/**<  card already powered off*/
-       TEL_SAP_RESULT_CARD_REMOVED,            /**<  card removed*/
-       TEL_SAP_RESULT_CARD_ALREADY_POWERED_ON, /**<  card already powered on*/
-       TEL_SAP_RESULT_DATA_NOT_AVAILABLE,      /**<  data not available*/
-       TEL_SAP_RESULT_NOT_SUPPORTED,           /**<  not supported*/
-       TEL_SAP_RESULT_UNABLE_TO_ESTABLISH,     /**<  unable to establish connection*/
-       TEL_SAP_RESULT_NOT_SUPPORT_MAX_SIZE,    /**<  server does not support message length that client want send*/
-       TEL_SAP_RESULT_TOO_SMALL_MAX_SIZE,      /**<  client wants to connect with very small message length which is not supported by Server */
-       TEL_SAP_RESULT_ONGOING_CALL,            /**<  server cannot reset the SIM due to an ongoing call */
-       TEL_SAP_RESULT_OPERATION_NOT_PERMITTED  /** Operation not permitted */
-} TelSapResult;
-
-/**
- * @enum TelSapPowerMode
- * This enum gives the SAP message Ids between SAP client and SAP server.
- */
-typedef enum {
-       TEL_SAP_SIM_POWER_ON_REQ,       /**< SAP Client request for Power ON SIM off in Server */
-       TEL_SAP_SIM_POWER_OFF_REQ,      /**< SAP Client request for Power OFF SIM off in Server */
-       TEL_SAP_SIM_RESET_REQ,          /**< SAP Client request for reset SIM in Server */
-} TelSapPowerMode;
-
-/**
- * @enum TelSapDisconnectType
- * This enum gives the SAP disconnect type information.
- */
-typedef enum {
-       TEL_SAP_DISCONNECT_TYPE_GRACEFUL,       /**< disconnection procedure ends after finishing current work */
-       TEL_SAP_DISCONNECT_TYPE_IMMEDIATE       /**< disconnection procedure ends immediately */
-} TelSapDisconnectType;
-
-/**
- * @enum TelSapCardStatus
- * This enum gives the SIM card status if server`s status changed about connection with subscription module
- */
-typedef enum {
-       TEL_SAP_CARD_STATUS_UNKNOWN,            /**<  SAP server status - unknown*/
-       TEL_SAP_CARD_STATUS_RESET,              /**<  SAP server status - reset*/
-       TEL_SAP_CARD_STATUS_NOT_ACCESSIBLE,     /**<  SAP server status - not accessible*/
-       TEL_SAP_CARD_STATUS_REMOVED,            /**<  SAP server status - removed*/
-       TEL_SAP_CARD_STATUS_INSERTED,           /**<  SAP server status - inserted*/
-       TEL_SAP_CARD_STATUS_RECOVERED           /**<  SAP server status - recovered*/
-} TelSapCardStatus;
-
-/**
- * @enum TelSimSapProtocol
- * This enum gives SAP transport protocol type
- */
-typedef enum {
-       TEL_SIM_SAP_PROTOCOL_T0,        /**< T = 0, character*/
-       TEL_SIM_SAP_PROTOCOL_T1         /**< T = 1, block*/
-} TelSimSapProtocol;
-
-/**
- * This data structure gives the SAP ATR response data information.
- */
-typedef struct {
-       unsigned int atr_len; /**<  SAP ATR response data length */
-       unsigned char atr[TEL_SAP_ATR_LEN_MAX]; /**<  SAP ATR response data */
-} TelSapAtr;
-
-/**
- * This data structure is used to transfer the SAP APDU command.
- */
-typedef struct {
-       unsigned int apdu_len;  /**<  SAP APDU length */
-       unsigned char apdu[TEL_SAP_APDU_LEN_MAX];  /**<  SAP APDU data */
-} TelSapApdu;
-
-/**
- * This data structure gives the SAP APDU response.
- */
-typedef struct {
-       unsigned int apdu_resp_len; /**<  SAP APDU response data length */
-       unsigned char apdu_resp[TEL_SAP_APDU_RESP_LEN_MAX]; /**<  SAP APDU response data */
-} TelSapApduResp;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TEL_EVENT_SAP SAP Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief SAP status
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAP_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAP_STATUS
- *  @retval data \ref TelSapCardStatus
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAP_STATUS                            TELEPHONY_SAP_INTERFACE":Status"
-
-/**
- *  @hideinitializer
- *  @brief SAP disconnect type
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAP_DISCONNECT
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAP_DISCONNECT
- *  @retval data \ref TelSapDisconnectType
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAP_DISCONNECT                        TELEPHONY_SAP_INTERFACE":Disconnect"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-
-#endif /* __TEL_SAP_H__ */
diff --git a/tel-headers/include/tel_sat.h b/tel-headers/include/tel_sat.h
deleted file mode 100644 (file)
index 58e819c..0000000
+++ /dev/null
@@ -1,1813 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_SAT_H__
-#define __TEL_SAT_H__
-
-#include <glib.h>
-#include <tel_if.h>
-#include <tel_call.h>
-#include <tel_ss.h>
-
-/**
-*  @addtogroup TAPI_SAT
-*  @{
-*
-*  @file tel_sat.h
-*  @brief TAPI sat Interface
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TELEPHONY_SAT_INTERFACE TELEPHONY_SERVICE".Sat"
-
-#define TEL_SAT_DEF_TEXT_STRING_LEN_MAX        500 /**< max length for Text String  */
-#define TEL_SAT_DEF_TITLE_LEN_MAX      50 /**< max length for Menu Title */
-#define TEL_SAT_DEF_ITEM_STR_LEN_MAX   50 /**< max length for default item string */
-#define TEL_SAT_TEXT_STRING_LEN_MAX            500 /**< max length for text string */
-#define TEL_SAT_DEF_BIT_MASK_CONTACT   0x01 /**< Bit Mask for Contact */
-#define TEL_SAT_DEF_BIT_MASK_MSG       0x02 /**< Bit Mask for Msg */
-#define TEL_SAT_DEF_BIT_MASK_OTHER     0x04 /**< Bit Mask for Psh */
-#define TEL_SAT_REFRESH_FILE_LIST              20 /**< Refresh File List */
-#define TEL_SAT_DEF_SS_LEN_MAX 250 /**< max length for SS */
-#define TEL_SAT_DEF_USSD_LEN_MAX       250 /**< max length for USSD */
-#define TEL_SAT_DIALING_NUMBER_LEN_MAX 200 /**< max length for dailing number */
-#define TEL_SAT_ALPHA_ID_LEN_MAX       255     /**< max length of  alpha identifier */
-#define TEL_SAT_SUB_ADDR_LEN_MAX       30 /**< max length for Sub address */
-#define TEL_SAT_CCP_DATA_LEN_MAX       30 /**< max length of ccp data */
-#define TEL_SAT_SS_STRING_LEN_MAX      160 /**< max length for SS string */
-#define TEL_SAT_USSD_STRING_LEN_MAX    255 /**< max length for USSD string */
-#define TEL_SAT_ITEM_TEXT_LEN_MAX      45 /**< max length of item text */
-#define TEL_SAT_SMS_TPDU_SMS_DATA_LEN_MAX      175 /**< max length for SMS TPDU SMS data */
-#define TEL_SAT_FILE_ID_LIST_MAX_COUNT 255 /**< max length for file id list */
-#define TEL_SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT  50 /**< max count of items next action indication list */
-#define TEL_SAT_EVENT_LIST_MAX 17 /**< max count of event list */
-#define TEL_SAT_IMG_DATA_FILE_PATH_LEN_MAX     50 /**< max length of image data file name (Icon, CLUT) */
-#define TEL_SAT_ICON_LIST_MAX_COUNT    50 /**< max count of icon list */
-#define TEL_SAT_DTMF_STRING_LEN_MAX    30 /**< max length of dtmf string */
-#define TEL_SAT_URL_LEN_MAX    129 /**< max length of URL*/
-#define TEL_SAT_PROVISIONING_FILE_PATH_LEN_MAX 50 /**< max length of provisioning file path */
-#define TEL_SAT_CHANNEL_DATA_STRING_LEN_MAX    255 /**< max length for channel data string */
-#define TEL_SAT_OTHER_ADDR_LEN_MAX     30 /**< max length of other address */
-#define TEL_SAT_NET_ACC_NAM_LEN_MAX    30 /**< max length of net acc name */
-#define TEL_SAT_REMOTE_ENTITY_ADDR_LEN_MAX     50 /**< max length of remote entity address */
-#define TEL_SAT_ITEM_TEXT_ATTRIBUTES_LIST_MAX_COUNT    50 /**< max count of item text attributes list */
-#define TEL_SAT_MENU_ITEM_COUNT_MAX    40 /**< max count for Menu items */
-
-/**
- * @enum TelSatResult
- * Response (Result) codes
-*/
-typedef enum {
-       TEL_SAT_RESULT_SUCCESS, /**< Operation completed successfully */
-       TEL_SAT_RESULT_FAILURE, /**< Operation Failed */
-       TEL_SAT_RESULT_INVALID_PARAMETER, /**< Invalid input parameters */
-       TEL_SAT_RESULT_MEMORY_FAILURE, /**< Memory allocation failed */
-       TEL_SAT_RESULT_OPERATION_NOT_SUPPORTED, /**< Operation not supported */
-       TEL_SAT_RESULT_UNKNOWN_FAILURE, /**< Unknown failure */
-
-       TEL_SAT_RESULT_REQUIRED_VALUE_MISSING, /**< Required value missing */
-       TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD, /**< Command not understood by ME */
-       TEL_SAT_RESULT_BEYOND_ME_CAPABILITY /**< Beyond ME capability */
-} TelSatResult;
-
-/**
- * @enum TelSatUiUserConfirmType
- * This enumeration defines UI user confirm types
-*/
-typedef enum {
-       TEL_SAT_USER_CONFIRM_YES, /**<This Enum Informs That user confirms yes */
-       TEL_SAT_USER_CONFIRM_NO_OR_CANCEL, /**<This enum informs that user confirms no/cancel */
-       TEL_SAT_USER_CONFIRM_HELP_INFO, /**<This enum informs that user wants help information */
-       TEL_SAT_USER_CONFIRM_END, /**<This enum informs that user confirms end */
-       TEL_SAT_USER_CONFIRM_TIMEOUT, /**<This enum informs that user did not respond */
-} TelSatUiUserConfirmType;
-
-/**
- * @enum TelSatUiDisplayStatusType
- * This enumeration defines the UI Display Status.
- */
-typedef enum
-{
-       TEL_SAT_DISPLAY_SUCCESS = 0x00, /**< This enum informs  UI display success */
-       TEL_SAT_DISPLAY_FAIL = 0x01, /**< This enum informs  UI display failure */
-}TelSatUiDisplayStatusType;
-
-/**
- * @enum TelSatRefreshAppType
- * This enumeration defines the Refresh Application Type.
- */
- typedef enum
-{
-       TEL_SAT_REFRESH_CONTACT = 0x00,  /**< refresh application type - Phonebook */
-       TEL_SAT_REFRESH_MSG, /**< refresh application type - SMS */
-       TEL_SAT_REFRESH_OTHER, /**< refresh application type - other */
-       TEL_SAT_REFRESH_MAX      /**< Maximum Enumeration Value */
-}TelSatRefreshAppType;
-
-/**
- * @enum TelSatCallCtrlType
- * This enumeration defines Call Control Type.
- */
-typedef enum
-{
-       TEL_SAT_CALL_CNF_NONE = 0x00, /**< call control confirm type - None */
-       TEL_SAT_CALL_CNF_CALL, /**< call control confirm type - call */
-       TEL_SAT_CALL_CNF_SS, /**< call control confirm type - ss */
-       TEL_SAT_CALL_CNF_USSD, /**< call control confirm type - ussd */
-       TEL_SAT_CALL_CNF_MAX /**< Maximum Enumeration Value */
-}TelSatCallCtrlType;
-
-/**
- * @enum TelSatProactiveCmdType
- * This enumeration defines Proactive command types
-*/
-typedef enum {
-       TEL_SAT_PROATV_CMD_NONE = 0x00, /**< command type - None */
-       TEL_SAT_PROATV_CMD_REFRESH = 0x01, /**< command type - refresh */
-       TEL_SAT_PROATV_CMD_MORE_TIME = 0x02, /**< command type - more time      */
-       TEL_SAT_PROATV_CMD_SETUP_EVENT_LIST = 0x05, /**< command type - setup event list */
-       TEL_SAT_PROATV_CMD_SETUP_CALL = 0x10, /**<      command type - setup call */
-       TEL_SAT_PROATV_CMD_SEND_SS = 0x11, /**< command type - send ss */
-       TEL_SAT_PROATV_CMD_SEND_USSD = 0x12, /**< command type - send ussd       */
-       TEL_SAT_PROATV_CMD_SEND_SMS = 0x13, /**< command type - send sms */
-       TEL_SAT_PROATV_CMD_SEND_DTMF = 0x14, /**< command type - send dtmf      */
-       TEL_SAT_PROATV_CMD_LAUNCH_BROWSER = 0x15, /**< command type - launch browser     */
-       TEL_SAT_PROATV_CMD_PLAY_TONE = 0x20, /**< command type - play tone */
-       TEL_SAT_PROATV_CMD_DISPLAY_TEXT = 0x21, /**< command type - display text */
-       TEL_SAT_PROATV_CMD_GET_INKEY = 0x22, /**< command type - get inkey */
-       TEL_SAT_PROATV_CMD_GET_INPUT = 0x23, /**< command type - get input */
-       TEL_SAT_PROATV_CMD_SELECT_ITEM = 0x24, /**< command type - select item */
-       TEL_SAT_PROATV_CMD_SETUP_MENU = 0x25, /**< command type - setup menu */
-       TEL_SAT_PROATV_CMD_PROVIDE_LOCAL_INFO = 0x26, /**< command type - provide local info */
-       TEL_SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT = 0x28, /**< command type - setup idle mode text */
-       TEL_SAT_PROATV_CMD_LANGUAGE_NOTIFICATION = 0x35, /**< command type - language notification */
-       TEL_SAT_PROATV_CMD_OPEN_CHANNEL = 0x40, /**< command type - open channel -class e */
-       TEL_SAT_PROATV_CMD_CLOSE_CHANNEL = 0x41, /**< command type - close channel - class e */
-       TEL_SAT_PROATV_CMD_RECEIVE_DATA = 0x42, /**< command type - receive data -class e */
-       TEL_SAT_PROATV_CMD_SEND_DATA = 0x43, /**< command type - send data */
-       TEL_SAT_PROATV_CMD_GET_CHANNEL_STATUS = 0x44, /**< command type - get channel status -class e */
-       TEL_SAT_PROATV_CMD_TYPE_END_PROACTIVE_SESSION = 0xFE, /**< command type - end proactive session */
-       TEL_SAT_PROATV_CMD_RESERVED = 0xFF /**< command type - reserved */
-} TelSatProactiveCmdType;
-
-/**
- * @enum TelSatAlphabetFormatType
- * This enumeration defines Alphabet format type
-*/
-typedef enum {
-       TEL_SAT_ALPHABET_FORMAT_SMS_DEFAULT = 0x00, /**< Alphabet type -SMS default format */
-       TEL_SAT_ALPHABET_FORMAT_8BIT_DATA = 0x01, /**< Alphabet type -8 bit format data */
-       TEL_SAT_ALPHABET_FORMAT_UCS2 = 0x02, /**< Alphabet type -UCS2 format */
-       TEL_SAT_ALPHABET_FORMAT_RESERVED = 0x03 /**< Alphabet type -format reserved */
-} TelSatAlphabetFormatType;
-
-/**
- * @enum TelSatMsgClassType
- * This enumeration defines message class types
-*/
-typedef enum {
-       TEL_SAT_MSG_CLASS_NONE = 0x00, /**< class none */
-       TEL_SAT_MSG_CLASS_0 = 0x01, /**< class 0 */
-       TEL_SAT_MSG_CLASS_1, /**< class 1 Default meaning:ME-specific */
-       TEL_SAT_MSG_CLASS_2, /**< class 2 SIM specific message */
-       TEL_SAT_MSG_CLASS_3, /**< class 3 Default meaning: TE specific */
-       TEL_SAT_MSG_CLASS_RESERVED = 0xFF /**< class reserved */
-} TelSatMsgClassType;
-
-/**
- * @enum TelSatCallCtrlResultType
- * This enum indicates the result of call control by SIM.
- */
-typedef enum {
-       TEL_SAT_CALL_CTRL_R_ALLOWED_NO_MOD = 0, /**<    call control result type -  ALLOWED WITH NO MOD */
-       TEL_SAT_CALL_CTRL_R_NOT_ALLOWED = 1, /**< call control result type -  NOT ALLOWED */
-       TEL_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD = 2, /**< call control result type -  ALLOWED WITH MOD     */
-       TEL_SAT_CALL_CTRL_R_RESERVED = 0xFF /**< call control result type -  RESERVED */
-} TelSatCallCtrlResultType;
-
-/**
- * @enum TelSatCallType
- * This enum indicates the SAT call type
- */
-typedef enum {
-       TEL_SAT_CALL_TYPE_MO_VOICE = 0X00,      /**<    call type -mo voice */
-       TEL_SAT_CALL_TYPE_MO_SMS, /**< call type - mo sms */
-       TEL_SAT_CALL_TYPE_SS, /**< call type -  ss */
-       TEL_SAT_CALL_TYPE_USSD, /**< call type -  ussd */
-       TEL_SAT_PDP_CNTXT_ACT, /**< call type -  pdp context action */
-       TEL_SAT_CALL_TYPE_MAX /**< call type -  max */
-}TelSatCallType;
-
-/**
- * @enum TelSatUseInputAlphabetType
- * This is associated with the command qualifier for get input.
- */
-typedef enum {
-       TEL_SAT_USER_INPUT_ALPHABET_TYPE_SMS_DEFAULT = 1, /**< command qualifier for  ALPHABET TYPE SMS DEFAULT */
-       TEL_SAT_USER_INPUT_ALPHABET_TYPE_UCS2 = 2 /**< command qualifier for  ALPHABET TYPE UCS2 */
-} TelSatUseInputAlphabetType;
-
-/**
- * @enum TelSatResultType
- * This enumeration defines sat result types
-*/
-typedef enum {
-       TEL_SAT_RESULT_SUCCESS_RETURN = 0x0, /**< command performed successfully */
-       TEL_SAT_RESULT_SUCCESS_WITH_PARTIAL_COMPREHENSION = 0x01, /**< command performed with partial comprehension */
-       TEL_SAT_RESULT_SUCCESS_WITH_MISSING_INFO = 0x02, /**< command performed, with missing information */
-
-       TEL_SAT_RESULT_REFRESH_PERFORMED_WITH_ADDITIONAL_EFS_READ = 0x03, /**< REFRESH PERFORMED WITH ADDITIONAL EFS READ */
-       TEL_SAT_RESULT_SUCCESS_BUT_REQUESTED_ICON_NOT_DISPLAYED = 0x04, /**<     command performed but REQUESTED ICON NOT DISPLAYED */
-       TEL_SAT_RESULT_SUCCESS_BUT_MODIFIED_BY_CALL_CONTROL_BY_SIM = 0x05, /**< command performed but MODIFIED BY CALL CONTROL BY SIM */
-       TEL_SAT_RESULT_SUCCESS_LIMITED_SERVICE = 0x06, /**< command performed with LIMITED SERVICE */
-       TEL_SAT_RESULT_SUCCESS_WITH_MODIFICATION = 0x07, /**< command performed with MODIFICATION */
-       TEL_SAT_RESULT_REFRESH_PRFRMD_BUT_INDICATED_USIM_NOT_ACTIVE = 0x08, /**< REFRESH PERFORMED BUT INDICATED USIM NOT ACTIVE */
-       TEL_SAT_RESULT_SUCCESS_BUT_TONE_NOT_PLAYED = 0x09, /**< command performed successfully, tone not played */
-
-       TEL_SAT_RESULT_PROACTIVE_SESSION_TERMINATED_BY_USER = 0x10, /**< proactive sim application session terminated by user    */
-       TEL_SAT_RESULT_BACKWARD_MOVE_BY_USER = 0x11, /**< backward move in the proactive sim application session request by the user */
-       TEL_SAT_RESULT_NO_RESPONSE_FROM_USER = 0x12, /**< no response from user */
-
-       TEL_SAT_RESULT_HELP_INFO_REQUIRED_BY_USER = 0x13, /**< HELP INFO REQUIRED BY USER */
-       TEL_SAT_RESULT_USSD_OR_SS_TRANSACTION_TERMINATED_BY_USER = 0x14, /**< USSD OR SS TRANSACTION TERMINATED BY USER */
-
-       TEL_SAT_RESULT_ME_UNABLE_TO_PROCESS_COMMAND = 0x20, /**<        ME currently unable to process command  */
-       TEL_SAT_RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND = 0x21, /**< Network currently unable to process command */
-       TEL_SAT_RESULT_USER_DID_NOT_ACCEPT_CALL_SETUP_REQ = 0x22, /**< User did not accept call setup request */
-       TEL_SAT_RESULT_USER_CLEAR_DOWN_CALL_BEFORE_CONN = 0x23, /**< User cleared down call before connection or network released */
-
-       TEL_SAT_RESULT_INTERACTION_WITH_CC_BY_SIM_IN_TMP_PRBLM = 0x25, /**< INTERACTION WITH CALL CONTROL BY SIM IN TEMPORARY PROBLEM */
-       TEL_SAT_RESULT_LAUNCH_BROWSER_GENERIC_ERROR_CODE = 0x26, /**< LAUNCH BROWSER GENERIC ERROR CODE */
-
-       TEL_SAT_RESULT_BEYOND_ME_CAPABILITIES = 0x30, /**< command beyond ME's capabilities */
-       TEL_SAT_RESULT_COMMAND_TYPE_NOT_UNDERSTOOD_BY_ME = 0x31, /**< command type not understood by ME */
-       TEL_SAT_RESULT_COMMAND_DATA_NOT_UNDERSTOOD_BY_ME = 0x32, /**< command data not understood by ME */
-       TEL_SAT_RESULT_COMMAND_NUMBER_NOT_KNOWN_BY_ME = 0x33, /**<      command number not known by ME */
-       TEL_SAT_RESULT_SS_RETURN_ERROR = 0x34, /**< SS return error */
-       TEL_SAT_RESULT_SMS_RP_ERROR = 0x35, /**< SMS rp-error */
-       TEL_SAT_RESULT_ERROR_REQUIRED_VALUES_ARE_MISSING = 0x36, /**< Error, required values are missing */
-
-       TEL_SAT_RESULT_USSD_RETURN_ERROR = 0x37, /**<   USSD_RETURN_ERROR */
-       TEL_SAT_RESULT_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM = 0x39, /**<     INTERACTION WITH CALL CONTROL OR SMS CONTROL PERMANENT PROBLEM */
-       TEL_SAT_RESULT_BEARER_INDEPENDENT_PROTOCOL_ERROR = 0x3A, /**< BEARER INDEPENDENT PROTOCOL ERROR */
-       TEL_SAT_RESULT_FRAMES_ERROR = 0x3C, /**< FRAMES ERROR */
-} TelSatResultType;
-
-/**
- * @enum TelSatMeProblemType
- * This enumeration defines ME problem types
-*/
-typedef enum {
-       TEL_SAT_ME_PROBLEM_NO_SPECIFIC_CAUSE = 0x0, /**< ME problem with NO SPECIFIC CAUSE */
-       TEL_SAT_ME_PROBLEM_SCREEN_BUSY = 0x01, /**< ME problem with SCREEN BUSY */
-       TEL_SAT_ME_PROBLEM_ME_BUSY_ON_CALL = 0x02, /**< ME problem with ME BUSY ON CALL */
-       TEL_SAT_ME_PROBLEM_ME_BUSY_ON_SS = 0x03, /**< ME problem with ME_BUSY ON SS */
-       TEL_SAT_ME_PROBLEM_NO_SERVICE = 0x04, /**<      ME problem with NO SERVICE */
-       TEL_SAT_ME_PROBLEM_ACCESS_CONTROL_CLASS_BAR = 0x05, /**< ME problem with ACCESS CONTROL CLASS BAR */
-       TEL_SAT_ME_PROBLEM_RADIO_RES_NOT_GRANTED = 0x06, /**< ME problem with RADIO RES NOT GRANTED */
-       TEL_SAT_ME_PROBLEM_NOT_IN_SPEECH_CALL = 0x07, /**< ME problem with NOT IN SPEECH CALL */
-       TEL_SAT_ME_PROBLEM_ME_BUSY_ON_USSD = 0x08, /**< ME problem with ME BUSY ON USSD */
-       TEL_SAT_ME_PROBLEM_ME_BUSY_ON_SEND_DTMF_CMD = 0x09, /**<        ME problem with ME BUSY ON SEND DTMF CMD */
-       TEL_SAT_ME_PROBLEM_NO_USIM_ACTIVE = 0x0A, /**< ME problem with NO USIM ACTIVE */
-       TEL_SAT_ME_PROBLEM_INVALID = 0xFF /**< ME problem with INVALID */
-} TelSatMeProblemType;
-
-/**
- * @enum TelSatCallControlResult
- * This enumeration defines call control result types
-*/
-typedef enum {
-       TEL_SAT_CALL_CTRL_RESULT_ALLOWED_NO_MOD = 0x00, /**< call control result type -ALLOWED NO MOD */
-       TEL_SAT_CALL_CTRL_RESULT_NOT_ALLOWED = 0x01, /**< call control result type -NOT ALLOWED */
-       TEL_SAT_CALL_CTRL_RESULT_ALLOWED_WITH_MOD = 0x02, /**< call control result type -ALLOWED WITH MOD */
-       TEL_SAT_CALL_CTRL_RESULT_RESERVED /**< call control result type -RESERVED */
-} TelSatCallControlResult;
-
-/**
- * @enum TelSatTypeOfNum
- * This enumeration defines sat type of number
-*/
-typedef enum {
-       TEL_SAT_TON_UNKNOWN = 0,                        /*< unknown */
-       TEL_SAT_TON_INTERNATIONAL = 1,          /*< international number */
-       TEL_SAT_TON_NATIONAL = 2,                       /*< national number */
-       TEL_SAT_TON_NETWORK_SPECIFIC = 3,       /*< network specific number */
-       TEL_SAT_TON_DEDICATED_ACCESS = 4,       /*< subscriber number */
-       TEL_SAT_TON_ALPHA_NUMERIC = 5,          /*< alphanumeric, GSM 7-bit default alphabet) */
-       TEL_SAT_TON_ABBREVIATED_NUMBER = 6,     /*< abbreviated number */
-       TEL_SAT_TON_RESERVED_FOR_EXT = 7        /*< reserved for extension */
-} TelSatTypeOfNum;
-
-/**
- * @enum TelSatNumberingPlanIdentity
- * This enumeration defines numbering plan identity
-*/
-typedef enum {
-       TEL_SAT_NPI_UNKNOWN = 0,                                /*< Unknown */
-       TEL_SAT_NPI_ISDN_TEL = 1,                               /*< ISDN Telephone numbering plan */
-       TEL_SAT_NPI_DATA_NUMBERING_PLAN = 3,    /*< Data numbering plan */
-       TEL_SAT_NPI_TELEX = 4,                                  /*< Telex numbering plan */
-       TEL_SAT_NPI_SVC_CNTR_SPECIFIC_PLAN = 5, /*< Service Center Specific plan */
-       TEL_SAT_NPI_SVC_CNTR_SPECIFIC_PLAN2 = 6,/*< Service Center Specific plan */
-       TEL_SAT_NPI_NATIONAL = 8,                               /*< National numbering plan */
-       TEL_SAT_NPI_PRIVATE = 9,                                /*< Private numbering plan */
-       TEL_SAT_NPI_ERMES_NUMBERING_PLAN = 10,  /*< ERMES numbering plan */
-       TEL_SAT_NPI_RESERVED_FOR_EXT = 0xF              /*< Reserved for extension */
-} TelSatNumberingPlanIdentity;
-
-/**
- * @enum TelSatDeviceIdentitiesTagType
- * This enumeration defines device identities tag types
-*/
-typedef enum {
-       TEL_SAT_DEVICE_ID_KEYPAD = 0x01, /**< device identities tag type -ID KEYPAD */
-       TEL_SAT_DEVICE_ID_DISPLAY = 0x02, /**< device identities tag type -ID DISPLAY */
-       TEL_SAT_DEVICE_ID_EARPIECE = 0x03, /**< device identities tag type -ID EARPIECE */
-       /* 21-27 for channel */
-       TEL_SAT_DEVICE_ID_SIM = 0x81, /**< device identities tag type -ID SIM */
-       TEL_SAT_DEVICE_ID_ME = 0x82, /**< device identities tag type -ID ME */
-       TEL_SAT_DEVICE_ID_NETWORK = 0x83, /**< device identities tag type -ID NETWORK */
-       TEL_SAT_DEVICE_ID_RESERVED = 0XFF /**< device identities tag type -ID RESERVED */
-} TelSatDeviceIdentitiesTagType;
-
-/**
- * @enum TelSatTimeUnitType
- * This enumeration defines time unit types
-*/
-typedef enum {
-       TEL_SAT_TIME_UNIT_MINUTES = 0x0, /**< Time unit type -MINUTES */
-       TEL_SAT_TIME_UNIT_SECONDS = 0x01, /**< Time unit type -SECONDS */
-       TEL_SAT_TIME_UNIT_TENTHS_OF_SECONDS     = 0x02, /**< Time unit type -TENTHS_OF_SECONDS */
-       TEL_SAT_TIME_UNIT_RESERVED       = 0xFF /**< Time unit type -RESERVED */
-} TelSatTimeUnitType;
-
-/**
- * @enum TelSatSmsTpduType
- * This enumeration defines SMS TPDU types
-*/
-typedef enum {
-       TEL_SAT_SMS_TPDU_TYPE_DELIVER_TPDU = 0, /**< SMS TPDU type -DELIVER TPDU */
-       TEL_SAT_SMS_TPDU_TYPE_DELIVER_RPT = 1, /**< SMS TPDU type -DELIVER RPT */
-       TEL_SAT_SMS_TPDU_TYPE_SUBMIT_TPDU = 2, /**< SMS TPDU type -SUBMIT TPDU */
-       TEL_SAT_SMS_TPDU_TYPE_SUBMIT_RPT        = 3, /**< SMS TPDU type -SUBMIT RPT */
-       TEL_SAT_SMS_TPDU_TYPE_STATUS_RPT        = 4, /**< SMS TPDU type -STATUS RPT */
-       TEL_SAT_SMS_TPDU_TYPE_TPDU_CMD = 5 /**< SMS TPDU type -TPDU CMD */
-} TelSatSmsTpduType;
-
-/**
- * @enum TelSatEventListType
- * This enumeration defines event list types
-*/
-typedef enum {
-       TEL_SAT_EVENT_MT_CALL = 0, /**< event type -MT CALL */
-       TEL_SAT_EVENT_CALL_CONNECTED = 1, /**< event type -CALL CONNECTED */
-       TEL_SAT_EVENT_CALL_DISCONNECTED = 2, /**< event type -CALL DISCONNECTED */
-       TEL_SAT_EVENT_LOCATION_STATUS = 3, /**< event type -LOCATION STATUS */
-       TEL_SAT_EVENT_USER_ACTIVITY = 4, /**< event type - USER_ACTIVITY */
-       TEL_SAT_EVENT_IDLE_SCREEN_AVAILABLE = 5, /**< event type - IDLE SCREEN AVAILABLE */
-       TEL_SAT_EVENT_CARD_READER_STATUS = 6, /**< event type -CARD READER STATUS */
-       TEL_SAT_EVENT_LANGUAGE_SELECTION = 7, /**<      event type - LANGUAGE SELECTION */
-       TEL_SAT_EVENT_BROWSER_TERMINATION = 8, /**< event type - BROWSER TERMINATION */
-       TEL_SAT_EVENT_DATA_AVAILABLE = 9, /**< event type -DATA AVAILABLE */
-       TEL_SAT_EVENT_CHANNEL_STATUS = 0x0A, /**< event type - CHANNEL STATUS    */
-       TEL_SAT_EVENT_ACCESS_TECHNOLOGY_CHANGED = 0x0B, /**< event type -TECHNOLOGY CHANGED */
-       TEL_SAT_EVENT_DISPLAY_PARAMETERS_CHANGED = 0x0C, /**< event type -PARAMETERS CHANGED */
-       TEL_SAT_EVENT_LOCAL_CONNECTION = 0x0D, /**< event type -LOCAL CONNECTION */
-       TEL_SAT_EVENT_NW_SEARCH_MODE_CHANGED = 0X0E, /**< event type -NW SEARCH MODE CHANGED */
-       TEL_SAT_EVENT_BROWSING_STATUS = 0X0F, /**< event type -BROWSING STATUS */
-       TEL_SAT_EVENT_FRAMES_INFORMATION_CHANGED = 0X10, /**< event type -FRAMES INFORMATION CHANGED */
-       TEL_SAT_EVENT_RESERVED_FOR_3GPP = 0X11, /**< event type -RESERVED FOR 3GPP */
-       TEL_SAT_EVENT_UNKNOWN = 0xFF /**< event type - UNKNOWN */
-} TelSatEventListType;
-
-/**
- * @enum TelSatCallCtrlStringType
- * This enumeration defines call control string type.
- */
-typedef enum {
-       TEL_SAT_CC_VOICE = 0x00, /**< Call Control String Type - voice */
-       TEL_SAT_CC_SS = 0x01, /**< Call Control String Type - ss */
-       TEL_SAT_CC_USSD = 0x02, /**< Call Control String Type - ussd */
-       TEL_SAT_CC_NONE = 0xFF /**< Call Control String Type - none */
-} TelSatCallCtrlStringType;
-
-/**
- * @enum TelSatInkeyType
- * This enumeration defines inkey type
-*/
-typedef enum {
-       TEL_SAT_INKEY_TYPE_CHARACTER_SET_ENABLED = 0, /**< Display inkey type -character set enabled */
-       TEL_SAT_INKEY_TYPE_YES_NO_REQUESTED = 1 /**< Display inkey type -yes/No requested */
-} TelSatInkeyType;
-
-/**
- * @enum TelSatToneType
- * This enumeration defines tone types
-*/
-typedef enum {
-       /* standard supervisory tones */
-       TEL_SAT_DIAL_TONE = 0x01, /**<  TONE TYPE DIAL TONE */
-       TEL_SAT_CALLED_SUBSCRIBER_BUSY = 0x02, /**< TONE TYPE CALLED SUBSCRIBER BUSY */
-       TEL_SAT_CONGESTION = 0x03, /**< TONE TYPE CONGESTION */
-       TEL_SAT_RADIO_PATH_ACK = 0x04, /**< TONE TYPE RADIO PATH ACK */
-       TEL_SAT_RADIO_PATH_NOT_AVAILABLE_CALL_DROPPED = 0x05, /**< TONE TYPE RADIO PATH NOT AVAILABLE CALL DROPPED */
-       TEL_SAT_ERR_SPECIAL_INFO = 0x06, /**<   TONE TYPE ERR SPECIAL INFO */
-       TEL_SAT_CALL_WAITING_TONE = 0x07, /**< TONE TYPE CALL WAITING TONE */
-       TEL_SAT_RINGING_TONE = 0x08, /**< TONE TYPE RINGING TONE */
-
-       /* ME proprietary tones */
-       TEL_SAT_GENERAL_BEEP = 0x10, /**<       TONE TYPE GENERAL BEEP */
-       TEL_SAT_POSITIVE_ACK_TONE = 0x11, /**< TONE TYPE POSITIVE ACK TONE */
-       TEL_SAT_NEGATIVE_ACK_OR_ERROR_TONE = 0x12, /**< TONE TYPE NEGATIVE ACK OR ERROR TONE */
-       TEL_SAT_RINGING_TONE_SLCTD_BY_USR_FOR_INCOM_SPEECH_CALL = 0x13, /**<    TONE TYPE RINGING TONE SELECTED BY USER FOR INCOMING SPEECH CALL */
-       TEL_SAT_ALERT_TONE_SELECTED_BY_USER_FOR_INCOMING_SMS = 0x14, /**< TONE TYPE ALERT TONE SELECTED BY USER FOR INCOMING SMS */
-       TEL_SAT_CRITICAL_ALERT = 0x15, /**< TONE TYPE CRITICAL ALERT */
-
-       /* Themed tones */
-       TEL_SAT_HAPPY_TONE = 0x30, /**< TONE TYPE HAPPY TONE */
-       TEL_SAT_SAD_TONE = 0x31, /**< TONE TYPE SAD TONE */
-       TEL_SAT_URGENT_ACTION_TONE = 0x32, /**< TONE TYPE URGENT ACTION TONE */
-       TEL_SAT_QUESTION_TONE = 0x33, /**< TONE TYPE QUESTION TONE */
-       TEL_SAT_MESSAGE_RECEIVED_TONE = 0x34, /**< TONE TYPE MESSAGE RECEIVED TONE */
-
-       /* Melody tones */
-       TEL_SAT_MELODY_1 = 0x40, /**<   TONE TYPE MELODY 1 */
-       TEL_SAT_MELODY_2 = 0x41, /**<   TONE TYPE MELODY 2 */
-       TEL_SAT_MELODY_3 = 0x42, /**<   TONE TYPE MELODY 3 */
-       TEL_SAT_MELODY_4 = 0x43, /**<   TONE TYPE MELODY 4 */
-       TEL_SAT_MELODY_5 = 0x44, /**<   TONE TYPE MELODY 5 */
-       TEL_SAT_MELODY_6 = 0x45, /**<   TONE TYPE MELODY 6 */
-       TEL_SAT_MELODY_7 = 0x46, /**<   TONE TYPE MELODY 7 */
-       TEL_SAT_MELODY_8 = 0x47, /**<   TONE TYPE MELODY 8 */
-
-       TEL_SAT_TONE_TYPE_RESERVED = 0xFF /**< TONE TYPE RESERVED */
-} TelSatToneType;
-
-/**
- * @enum TelSatBcRepeatIndicatorType
- * This enumeration defines BC repeat indicator types
-*/
-typedef enum {
-       TEL_SAT_BC_REPEAT_INDI_ALTERNATE_MODE = 0x01, /**< BC REPEAT ALTERNATE MODE */
-       TEL_SAT_BC_REPEAT_INDI_SEQUENTIAL_MODE = 0x03, /**< BC REPEAT SEQUENTIAL MODE */
-       TEL_SAT_BC_REPEAT_INDI_RESERVED = 0xFF /**< RESERVED */
-} TelSatBcRepeatIndicatorType;
-
-/**
- * @enum TelSatImageCodingSchemeType
- * This enumeration defines image coding scheme types
-*/
-typedef enum {
-       TEL_SAT_SIM_IMAGE_CODING_SCHEME_BASIC = 0x11, /**< Image coding scheme type - BASIC */
-       TEL_SAT_SIM_IMAGE_CODING_SCHEME_COLOUR = 0x21, /**< Image coding scheme type - COLOUR */
-       TEL_SAT_SIM_IMAGE_CODING_SCHEME_RESERVED = 0xFF /**< Image coding scheme type - RESERVED */
-} TelSatImageCodingSchemeType;
-
-/**
- * @enum TelSatIconQualifierType
- * This enumeration defines icon qualifier types
-*/
-typedef enum {
-       TEL_SAT_ICON_QUALI_SELF_EXPLANATORY = 0, /**< Icon qualifier type - SELF EXPLANATORY */
-       TEL_SAT_ICON_QUALI_NOT_SELF_EXPLANATORY = 1, /**< Icon qualifier type - NOT SELF EXPLANATORY */
-       TEL_SAT_ICON_QUALI_RESERVED = 0xFF /**< Icon qualifier type - RESERVED */
-} TelSatIconQualifierType;
-
-/**
- * @enum TelSatBrowserIdentityType
- * This enumeration defines browser identity types
-*/
-typedef enum {
-       TEL_SAT_BROWSER_ID_DEFAULT = 0, /**< DEFAULT BROWSER */
-       TEL_SAT_BROWSER_ID_WML, /**< BROWSER WML */
-       TEL_SAT_BROWSER_ID_HTML, /**< BROWSER HTML */
-       TEL_SAT_BROWSER_ID_XHTML, /**< BROWSER XHTML */
-       TEL_SAT_BROWSER_ID_CHTML, /**<  BROWSER CHTML */
-       TEL_SAT_BROWSER_ID_RESERVED = 0xFF /**< RESERVED */
-} TelSatBrowserIdentityType;
-
-/**
- * @enum TelSatBearerListType
- * This enumeration defines bearer list types
-*/
-typedef enum {
-       TEL_SAT_BEARER_LIST_SMS = 0, /**<       BEARER SMS */
-       TEL_SAT_BEARER_LIST_CSD = 1, /**<       BEARER CSD */
-       TEL_SAT_BEARER_LIST_USSD = 2, /**< BEARER USSD  */
-       TEL_SAT_BEARER_LIST_GPRS = 3, /**< BEARER GPRS */
-       TEL_SAT_BEARER_LIST_RESERVED = 0xFF /**< BEARER RESERVED */
-} TelSatBearerListType;
-
-/**
- * @enum TelSatChannelStatusType
- * This enumeration defines channel status types
-*/
-typedef enum {
-       TEL_SAT_LINK_OR_PACKET_SERVICE_NOT_ACTIVATED, /**< channel status type -LINK OR PACKET SERVICE NOT ACTIVATED */
-       TEL_SAT_LINK_OR_PACKET_SERVICE_ACTIVATED /**< channel status type -LINK OR PACKET SERVICE ACTIVATED */
-} TelSatChannelStatusType;
-
-/**
- * @enum TelSatChannelStatusInfoType
- * This enumeration defines channel status info types
-*/
-typedef enum {
-       TEL_SAT_CHANNEL_STATUS_NO_FURTHER_INFO = 0x00, /**< channel status info type - NO FURTHER INFO */
-       TEL_SAT_CHANNEL_STATUS_LINK_DROPPED = 0x05 /**< channel status info type -LINK DROPPED */
-} TelSatChannelStatusInfoType;
-
-/**
- * @enum TelSatAddressType
- * This enumeration defines address types
-*/
-typedef enum {
-       TEL_SAT_ADDR_TYPE_IPv4 = 0x21, /**< address type - IPv4 */
-       TEL_SAT_ADDR_TYPE_IPv6 = 0x57, /**< address type - IPv6 */
-       TEL_SAT_ADDR_RESERVED = 0xFF /**< reserved */
-} TelSatAddressType;
-
-/**
- * @enum TelSatTransportProtocolType
- * This enumeration defines transport protocal types
-*/
-typedef enum {
-       TEL_SAT_TP_TYPE_UDP_UICC_CLIENT = 0x01, /**< transport protocol type- UDP UICC CLIENT */
-       TEL_SAT_TP_TYPE_TCP_UICC_CLIENT = 0x02, /**< transport protocol type-TCP UICC CLIENT */
-       TEL_SAT_TP_TYPE_TCP_UICC_SERVER = 0x03 /**< transport protocol type- TCP UICC SERVER    */
-} TelSatTransportProtocolType;
-
-/**
- * @enum TelSatRemoteEntityAddrCodingType
- * This enumeration defines remote entity address coding types
-*/
-typedef enum {
-       TEL_SAT_REMOTE_ENTITY_ADDR_CODING_TYPE_IEEE802_48BIT = 0, /**<  remote entity address coding type- IEEE802 48BIT */
-       TEL_SAT_REMOTE_ENTITY_ADDR_CODING_TYPE_IRDA_32BIT = 1, /**< remote entity address coding type- IRDA 32BIT */
-       TEL_SAT_REMOTE_ENTITY_ADDR_CODING_TYPE_RESERVED = 0xFF /**< reserved */
-} TelSatRemoteEntityAddrCodingType;
-
-/**
- * @enum TelSatLanguageInfo
- * This enumeration defines lists the language values.
- */
-typedef enum {
-       TEL_SAT_LP_GERMAN = 0x00, /**< GERMAN */
-       TEL_SAT_LP_ENGLISH = 0x01, /**< ENGLISH */
-       TEL_SAT_LP_ITALIAN = 0x02, /**< ITALIAN */
-       TEL_SAT_LP_FRENCH = 0x03, /**< FRENCH */
-       TEL_SAT_LP_SPANISH = 0x04, /**< SPANISH */
-       TEL_SAT_LP_DUTCH = 0x05, /**<   DUTCH */
-       TEL_SAT_LP_SWEDISH = 0x06, /**< SWEDISH */
-       TEL_SAT_LP_DANISH = 0x07, /**<  DANISH  */
-       TEL_SAT_LP_PORTUGUESE = 0x08, /**< PORTUGUESE   */
-       TEL_SAT_LP_FINNISH = 0x09, /**< FINNISH */
-       TEL_SAT_LP_NORWEGIAN = 0x0A, /**< NORWEGIAN */
-       TEL_SAT_LP_GREEK = 0x0B, /**< GREEK */
-       TEL_SAT_LP_TURKISH = 0x0C, /**< TURKISH */
-       TEL_SAT_LP_HUNGARIAN = 0x0D, /**< HUNGARIAN */
-       TEL_SAT_LP_POLISH = 0x0E, /**<  POLISH  */
-       TEL_SAT_LP_LANG_UNSPECIFIED = 0x0F /**< LANGUAGE UNSPECIFIED */
-} TelSatLanguageInfo;
-
-/**
- * @enum TelSatCmdQualifierLaunchBrowser
- * This enumeration defines cmd qualifier for launch browser
-*/
-typedef enum {
-       TEL_SAT_LAUNCH_BROWSER_IF_NOT_ALREADY_LAUNCHED = 0, /**<        command qualifier for  LAUNCH BROWSER */
-       TEL_SAT_LAUNCH_BROWSER_NOT_USED = 1, /**< command qualifier for  NOT USED */
-       TEL_SAT_LAUNCH_BROWSER_USE_EXISTING_BROWSER = 2, /**< command qualifier for  USE EXISTING BROWSER if secure session, do not use it */
-       TEL_SAT_LAUNCH_BROWSER_CLOSE_AND_LAUNCH_NEW_BROWSER = 3, /**<   command qualifier for CLOSE AND LAUNCH NEW BROWSER      */
-       TEL_SAT_LAUNCH_BROWSER_NOT_USED2 = 4, /**< command qualifier for  NOT USED2 */
-       TEL_SAT_LAUNCH_BROWSER_RESERVED = 0xFF /**<     reserved        */
-} TelSatCmdQualifierLaunchBrowser;
-
-/**
- * @enum TelSatCmdQualifierRefresh
- * This enumeration defines cmd qualifier for refresh cmd
-*/
-typedef enum {
-       TEL_SAT_REFRESH_SIM_INIT_AND_FULL_FCN = 0, /**< command qualifier for REFRESH SIM INIT AND FULL FILE CHANGE_NOTIFICATION */
-       TEL_SAT_REFRESH_FCN = 1, /**<   command qualifier for REFRESH FILE CHANGE NOTIFICATION */
-       TEL_SAT_REFRESH_SIM_INIT_AND_FCN = 2, /**< command qualifier for REFRESH SIM INIT AND FILE CHANGE NOTIFICATION  */
-       TEL_SAT_REFRESH_SIM_INIT = 3, /**< command qualifier for REFRESH SIM INIT */
-       TEL_SAT_REFRESH_SIM_RESET = 4, /**< command qualifier for REFRESH SIM RESET */
-       TEL_SAT_REFRESH_3G_APPLICATION_RESET = 5, /**<  command qualifier for REFRESH 3G APPLICATION RESET */
-       TEL_SAT_REFRESH_3G_SESSION_RESET = 6, /**< command qualifier for REFRESH 3G SESSION RESET       */
-       TEL_SAT_REFRESH_RESERVED = 0xFF /**< command qualifier for REFRESH RESERVED */
-} TelSatCmdQualifierRefresh;
-
-/**
- * @enum TelSatCmdQualifierProvideLocalInfo
- * This enumeration defines cmd qualifier for local info
-*/
-typedef enum {
-       TEL_SAT_LOCAL_INFO_LOCATION = 0, /**< local info cmd qualifier -location */
-       TEL_SAT_LOCAL_INFO_IMEI = 1, /**< local info cmd qualifier -IMEI */
-       TEL_SAT_LOCAL_INFO_NMR = 2, /**< local info cmd qualifier -NMR */
-       TEL_SAT_LOCAL_INFO_DATE_TIME_AND_TIMEZONE = 3, /**< local info cmd qualifier -DATE TIME AND TIMEZONE */
-       TEL_SAT_LOCAL_INFO_LANGUAGE = 4, /**< local info cmd qualifier -LANGUAGE */
-       TEL_SAT_LOCAL_INFO_TIMING_ADVANCE = 5, /**< local info cmd qualifier -TIMING ADVANCE */
-       TEL_SAT_LOCAL_INFO_ACT = 6, /**< local info cmd qualifier -ACT */
-       TEL_SAT_LOCAL_INFO_ESN = 7, /**< local info cmd qualifier -ESN */
-       TEL_SAT_LOCAL_INFO_IMEISV = 8, /* *<local info cmd qualifier -IMEISV */
-       TEL_SAT_LOCAL_INFO_MEID = 0x0B, /**< local info cmd qualifier -MEID */
-       TEL_SAT_LOCAL_INFO_RESERVED = 0xFF /* local info cmd qualifier -RESERVED */
-} TelSatCmdQualifierProvideLocalInfo;
-
-/**
- * @enum TelSatCmdQualifierSetupCall
- * This enumeration defines cmd qualifier for setup call
-*/
-typedef enum {
-       TEL_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY = 0x00, /**< command qualifier for SETUP CALL IF ANOTHER CALL NOT BUSY       */
-       TEL_SAT_SETUP_CALL_IF_ANOTHER_CALL_NOT_BUSY_WITH_REDIAL = 0x01, /**< command qualifier for SETUP CALL IF ANOTHER CALL NOT BUSY WITH REDIAL */
-       TEL_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD = 0x02, /**< command qualifier for SETUP CALL PUTTING ALL OTHER CALLS ON HOLD */
-       TEL_SAT_SETUP_CALL_PUT_ALL_OTHER_CALLS_ON_HOLD_WITH_REDIAL = 0x03, /**< command qualifier for SETUP CALL PUTTING ALL OTHER CALLS ON HOLD WITH REDIAL */
-       TEL_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS = 0x04, /**< command qualifier for SETUP CALL DISCONNECTING ALL OTHER CALLS */
-       TEL_SAT_SETUP_CALL_DISCONN_ALL_OTHER_CALLS_WITH_REDIAL = 0x05, /**< command qualifier for SETUP CALL DISCONNECTING ALL OTHER CALLS WITH REDIAL */
-       TEL_SAT_SETUP_CALL_RESERVED = 0xFF /**<  command qualifier for SETUP CALL RESERVED      */
-} TelSatCmdQualifierSetupCall;
-
-/**
- * @enum TelSatCallCtrlProblemType
- * This enumeration defines call control problem types
-*/
-typedef enum {
-       TEL_SAT_CC_PROBLEM_NO_SPECIFIC_CAUSE = 0, /**< Call Control problem with no specific cause */
-       TEL_SAT_CC_PROBLEM_ACTION_NOT_ALLOWED = 1, /**< Call Control problem with action not allowed */
-       TEL_SAT_CC_PROBLEM_REQUEST_TYPE_HAS_CHANGED = 2 /**< Call Control problem with request type has changed */
-} TelSatCallCtrlProblemType;
-
-/**
- * @enum TelSatLaunchBrowserProblemType
- * This enumeration defines launch browser problem types
-*/
-typedef enum {
-       TEL_SAT_BROWSER_PROBLEM_NO_SPECIFIC_CAUSE = 0, /**<     Browser problem with no specific cause */
-       TEL_SAT_BROWSER_PROBLEM_BEARER_UNAVAILABLE = 1, /**< Browser problem with bearer unavailable */
-       TEL_SAT_BROWSER_PROBLEM_BROWSER_UNAVAILABLE = 2, /**<   Browser problem with browser unavailable */
-       TEL_SAT_BROWSER_PRBLM_ME_UNABLE_TO_READ_PROV_DATA = 3 /**< Browser problem with ME unable to read provisioning data */
-} TelSatLaunchBrowserProblemType;
-
-/**
- * @enum TelSatBrowserTerminationCauseType
- * This enumeration defines browser termination cause types
-*/
-typedef enum {
-       TEL_SAT_BROWSER_TERMINATED_BY_USER = 0, /**<    BROWSER TERMINATED BY USER */
-       TEL_SAT_BROWSER_TERMINATED_BY_ERROR = 1, /**< BROWSER TERMINATED BY ERROR */
-} TelSatBrowserTerminationCauseType;
-
-/**
- * This structure defines Result data object.
- */
-typedef struct {
-       TelSatResultType general_result; /**< general result */
-       TelSatMeProblemType me_problem; /**< additional information on general result */
-} TelSatResultInfo;
-
-/**
- * This structure defines expected user response length.
- */
-typedef struct {
-       unsigned char min; /**< user response length minimum value */
-       unsigned char max; /**< user response length maximum value */
-} TelSatRespLenInfo;
-
-/**
-* This structure defines Address Info
-*/
-typedef struct {
-       TelSatTypeOfNum ton; /**< type of number */
-       TelSatNumberingPlanIdentity npi; /**< numbering plan identity */
-       unsigned int dialing_number_len; /**< Dialing Number length */
-       char dialing_number[TEL_SAT_DIALING_NUMBER_LEN_MAX]; /**< Dialing Number */
-} TelSatAddressInfo;
-
-/**
-* This structure defines Data Coding Scheme Info
-*/
-typedef struct {
-       gboolean is_compressed_format;          /**< if FALSE, unpacked format */
-       TelSatAlphabetFormatType a_format; /**< Alphabet format type */
-       TelSatMsgClassType m_class; /**< msg class type */
-       unsigned char raw_dcs; /**< raw dcs data */
-} TelSatDataCodingSchemeInfo;
-
-/**
-* This structure defines Alpha identifier Info
-*/
-typedef struct {
-       gboolean is_exist; /**< identifier check */
-       TelSatDataCodingSchemeInfo dcs; /**< data coding scheme */
-       unsigned char alpha_data_len; /**< alpha identifier length */
-       char alpha_data[TEL_SAT_ALPHA_ID_LEN_MAX]; /**< alpha identifier info */
-} TelSatAlphaIdentifierInfo;
-
-/**
-* This structure defines the Sub Address data object.
-*/
-typedef struct {
-       unsigned int subaddress_len; /**< sub address length */
-       char subaddress[TEL_SAT_SUB_ADDR_LEN_MAX]; /**< sub address data */
-} TelSatSubAddressInfo;
-
-/**
-* This structure defines Capability configuration parameters Info
-*/
-typedef struct {
-       unsigned int data_len; /**< ccp info data length */
-       char data[TEL_SAT_CCP_DATA_LEN_MAX]; /**< ccp info data */
-} TelSatCcpInfo;
-
-/**
-* This structure defines device identities tag Info
-*/
-typedef struct {
-       TelSatDeviceIdentitiesTagType src; /**< src device identities tag type */
-       TelSatDeviceIdentitiesTagType dest; /**< dest device identities tag type */
-} TelSatDeviceIdentitiesInfo;
-
-/**
-* This structure defines duration Info
-*/
-typedef struct {
-       TelSatTimeUnitType time_unit;  /**< duration info -time unit type */
-       unsigned char time_interval; /**< duration info -time interval type */
-} TelSatDurationInfo;
-
-/**
-* This structure defines menu item Info
-*/
-typedef struct {
-       unsigned char item_id; /**< menu item info -item id */
-       unsigned char text_len; /**< menu item info -text len */
-       unsigned char text[TEL_SAT_ITEM_TEXT_LEN_MAX + 1]; /**< menu item info -text */
-} TelSatMenuItemInfo;
-
-/**
-* This structure defines Response length Info
-*/
-typedef struct {
-       unsigned char min; /**< min Response length */
-       unsigned char max; /**< max Response length */
-} TelSatResponseLength;
-
-/**
-* This structure defines SMS TPDU Info
-*/
-typedef struct {
-       TelSatSmsTpduType tpdu_type;  /**< SMS TPDU info -tpdu type */
-       unsigned int data_len; /**< SMS TPDU info -data len */
-       char data[TEL_SAT_SMS_TPDU_SMS_DATA_LEN_MAX]; /**< SMS TPDU info -data */
-} TelSatSmsTpduInfo;
-
-/**
-* This structure defines SS string Info
-*/
-typedef struct {
-       TelSatTypeOfNum ton; /**< SS string info -type of number */
-       TelSatNumberingPlanIdentity npi; /**< SS string info -numbering plan identity */
-       unsigned char string_len; /**< SS string length */
-       char ss_string[TEL_SAT_SS_STRING_LEN_MAX];      /**< SS string */
-} TelSatSsStringInfo;
-
-/**
-* This structure defines Text string Info
-*/
-typedef struct {
-       gboolean is_digit_only; /**< text type is digit check */
-       TelSatDataCodingSchemeInfo dcs; /**< text data coding scheme */
-       unsigned int string_length; /**< text string length */
-       char string[TEL_SAT_TEXT_STRING_LEN_MAX+1]; /**< text string */
-} TelSatTextTypeInfo;
-
-/**
-* This structure defines USSD string Info
-*/
-typedef struct {
-       TelSatDataCodingSchemeInfo dsc; /**< USSD string data coding scheme */
-       unsigned char string_len; /**< USSD string length */
-       char ussd_string[TEL_SAT_USSD_STRING_LEN_MAX]; /**< USSD string */
-} TelSatUssdStringInfo;
-
-/**
-* This structure defines File List Info
-*/
-typedef struct {
-       int file_count; /**< file count */
-       int file_id[TEL_SAT_FILE_ID_LIST_MAX_COUNT]; /**< file id */
-} TelSatFileListInfo;
-
-/**
-* This structure defines Location information Info
-*/
-typedef struct {
-       char mcc[3+1]; /**< MCC */
-       char mnc[3+1]; /**< MNC */
-       char lac [4+1]; /**< LAC */
-       char cell_id[4+1]; /**< cell id */
-       char extended_cell_id[4+1]; /**< extended cell id */
-} TelSatLocationInformationInfo;
-
-/**
-* This structure defines Items next action indicator List Info
-*/
-typedef struct {
-       unsigned char cnt; /**< next action indicator items count */
-       unsigned char indicator_list[TEL_SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT]; /**< next action indicator items list */
-} TelSatItemsNextActionIndiListInfo;
-
-/**
-* This structure defines Event List Info
-*/
-typedef struct {
-       int event_list_cnt; /**< event list count */
-       TelSatEventListType evt_list[TEL_SAT_EVENT_LIST_MAX]; /**< event list type */
-} TelSatEventListInfo;
-
-/**
- * This structure defines call control strings.
- */
-typedef struct {
-       TelSatCallCtrlStringType call_ctrl_string_type; /**< call control type  */
-       union {
-               TelSatAddressInfo voice_string; /**< voice call string */
-               TelSatSsStringInfo ss_string; /**< ss string */
-               TelSatUssdStringInfo ussd_string; /**< ussd string */
-       } call_ctrl_data; /**< call ctrl data Union */
-} TelSatCallCtrlAddressStringInfo;
-
-/**
-* This structure defines Call control requested action Info
-*/
-typedef struct {
-       TelSatCallCtrlAddressStringInfo call_ctrl_add_string; /**< Call control address string info */
-       TelSatCcpInfo ccp1; /**< Call control CCP info */
-       TelSatSubAddressInfo sub_address; /**< Call control sub address info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< Call control alpha identifier info */
-       TelSatBcRepeatIndicatorType bc_repeat_type; /**< Call control bc repeat indicator type info */
-       TelSatCcpInfo ccp2; /**< Call control CCP info */
-} TelSatCallCtrlRequestedActionInfo;
-
-/**
-* This structure defines Item icon Info
-*/
-typedef struct {
-       unsigned char width; /**< icon info -width */
-       unsigned char height;  /**< icon info -height */
-       TelSatImageCodingSchemeType ics; /**< icon info -image coding scheme */
-       unsigned short icon_data_len; /**< icon info -data len */
-       unsigned short clut_data_len; /**< icon info -CLUT data len */
-       char icon_file[TEL_SAT_IMG_DATA_FILE_PATH_LEN_MAX]; /**< icon info -image data file data */
-       char clut_file[TEL_SAT_IMG_DATA_FILE_PATH_LEN_MAX]; /**< icon info -clut file data */
-} TelSatIconInfo;
-
-/**
-* This structure defines Item icon identifier Info
-*/
-typedef struct {
-       gboolean is_exist; /**< icon identifier check */
-       TelSatIconQualifierType icon_qualifer; /**< icon qualifer type */
-       unsigned char icon_identifier; /**< icon identifier data */
-       TelSatIconInfo icon_info; /**< icon info data */
-} TelSatIconIdentifierInfo;
-
-/**
-* This structure defines Item icon identifier list Info
-*/
-typedef struct {
-       gboolean is_exist; /**< icon identifier list present check */
-       TelSatIconQualifierType icon_qualifer; /**< icon qualifer type */
-       unsigned char icon_cnt; /**< icon count */
-       unsigned char icon_id_list[TEL_SAT_ICON_LIST_MAX_COUNT]; /**< icon id list data */
-       TelSatIconInfo icon_info[TEL_SAT_ICON_LIST_MAX_COUNT]; /**< icon info data */
-} TelSatIconIdentifierListInfo;
-
-/**
-* This structure defines date, time and timezone Info
-*/
-typedef struct {
-       unsigned char year; /**< year */
-       unsigned char month; /**<       month */
-       unsigned char day; /**< day */
-       unsigned char hour; /**< hour */
-       unsigned char minute; /**< minute */
-       unsigned char second; /**< second */
-       unsigned char time_zone; /**< timeZone  */
-} TelSatDateTimeZoneInfo;
-
-/**
-* This structure defines Dtmf String Info
-*/
-typedef struct {
-       unsigned int dtmf_length; /**< DTMF string length */
-       char dtmf_string[TEL_SAT_DTMF_STRING_LEN_MAX]; /**< DTMF string */
-} TelSatDtmfStringInfo;
-
-/**
- * 8.48 URL
- * URL shall be coded as defined in RFC 1738 on using the "SMS 7bit default alphabet" with bit 8 set to 0.
- */
-typedef struct {
-       unsigned int url_length; /**< URL length */
-       char url[TEL_SAT_URL_LEN_MAX]; /**< URL data */
-} TelSatUrlInfo;
-
-/**
-* This structure defines Bearer List Info
-*/
-typedef struct {
-       int count; /**< Bearer List count */
-       TelSatBearerListType bear[6]; /**< Bearer List type */
-} TelSatBearerList;
-
-/**
-* This structure defines Provisioning file Info
-*/
-typedef struct {
-       unsigned int file_path_length; /**< Provisioning file path length */
-       char file_path[TEL_SAT_PROVISIONING_FILE_PATH_LEN_MAX]; /**< Provisioning file path data */
-} TelSatProvisioningFileRef;
-
-/**
-* This structure defines channel data Info
-*/
-typedef struct {
-       unsigned char data_string_len; /**< channel data string length */
-       char    data_string[TEL_SAT_CHANNEL_DATA_STRING_LEN_MAX]; /**< channel data string */
-} TelSatChannelDataInfo;
-
-/**
-* This structure defines Channel Status Info
-*/
-typedef struct {
-       unsigned char channel_id; /**< channel id */
-       TelSatChannelStatusType status; /**< channel Status Type */
-       TelSatChannelStatusInfoType status_info; /**< channel Status info Type */
-} TelSatChannelStatusInfo;
-
-/**
-* This structure defines Other Address Info
-*/
-typedef struct {
-       TelSatAddressType address_type; /**< channel address type */
-       unsigned char address_len; /**< channel address length */
-       char address[TEL_SAT_OTHER_ADDR_LEN_MAX]; /**< channel address */
-} TelSatOtherAddressInfo;
-
-/**
-* This structure defines Me Interface Transport Level Info
-*/
-typedef struct {
-       TelSatTransportProtocolType protocol_type; /**< Transport Protocol Type */
-       unsigned short port_number; /**< Transport Protocol port number */
-} TelSatSimMeInterfaceTransportLevelInfo;
-
-/**
-* This structure defines Remote Entity Address info
-*/
-typedef struct {
-       TelSatRemoteEntityAddrCodingType coding_type; /**< Remote Entity Addr Coding Type */
-       unsigned short length;  /**< Remote Entity Addr length */
-       unsigned char remote_entity_address[TEL_SAT_REMOTE_ENTITY_ADDR_LEN_MAX]; /**< Remote Entity Addr data */
-} TelSatRemoteEntityAddressInfo;
-
-/**
-* This structure defines Network access name info
-*/
-typedef struct {
-       unsigned short length; /**< Network access name length */
-       unsigned char network_access_name[TEL_SAT_NET_ACC_NAM_LEN_MAX]; /**< Network access name data */
-} TelSatNetworkAccessNameInfo;
-
-/**
-* This structure defines Item text attribute list
-*/
-typedef struct {
-       unsigned int list_cnt; /**< text attribute list count */
-       unsigned char text_attribute_list[TEL_SAT_ITEM_TEXT_ATTRIBUTES_LIST_MAX_COUNT]; /**< text attribute list data */
-} TelSatTextAttributeListInfo;
-
-
-/**
- * This structure defines the call control result ind data.
- */
-typedef struct {
-       TelSatCallControlResult cc_result; /**< Call Control Result */
-
-       TelSatAddressInfo address; /**< Address Info */
-       TelSatSsStringInfo ss_string; /**< Ss String Info  */
-
-       TelSatCcpInfo ccp1; /**< Ccp Info */
-       TelSatSubAddressInfo sub_address; /**< Sub Address Info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< alpha id */
-       TelSatBcRepeatIndicatorType bc_repeat_type; /**< Bc Repeat Indicator Type */
-       TelSatCcpInfo ccp2; /**< Ccp Info */
-} TelSatNotiCallControlResultInd;
-
-/**
- * This structure defines the mo sms control result ind data.
- */
-typedef struct {
-       TelSatCallControlResult cc_result; /**< Call Control Result */
-
-       TelSatAddressInfo rp_dst_address; /**< Address Info */
-       TelSatAddressInfo tp_dst_address; /**< Address Info */
-       TelSatAlphaIdentifierInfo alpha_id; /**< Alpha Identifier Info */
-} TelSatNotiMoSmControlResultInd;
-
-/**
- * This structure defines the user confirmation data.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatProactiveCmdType command_type; /**< Proactive Command Type */
-       TelSatUiUserConfirmType key_type; /**< User Response Type */
-       unsigned char* additional_data; /**< Additional Data */
-       unsigned int data_len; /**< Additional Data Length */
-} TelSatUiUserConfirmInfo;
-
-/**
- * This structure defines the character data for sat engine data structure.
- */
-typedef struct
-{
-       unsigned short string_len;      /**< character data length */
-       unsigned char string[TEL_SAT_DEF_TEXT_STRING_LEN_MAX+1]; /**< character data */
-} TelSatTextInfo;
-
-/**
- * This structure defines the main menu title to check sat menu.
- */
-typedef struct
-{
-       gboolean is_main_menu_present; /**<flag to check sat main menu existence */
-       TelSatTextInfo main_menu_title; /**< main menu title data */
-} TelSatMainMenuTitleInfo;
-
-/**
- * This structure defines the display text proactive command for sat ui.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatTextInfo text; /**< character data to display on screen */
-       unsigned int duration; /**< the duration of display */
-       gboolean is_priority_high;       /**< indicates whether the text is to be displayed if some other app is using the screen */
-       gboolean is_user_resp_required; /**< indicates whether user response required or Not */
-       gboolean immediately_resp; /**< indicates whether response is immediate or not */
-       TelSatIconIdentifierInfo icon_id; /**< Icon Identifier */
-} TelSatDisplayTextInd;
-
-/**
- * This structure defines the get inkey proactive command data for sat ui.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatInkeyType key_type; /**< input Type:Character Set or Yes/No */
-       TelSatUseInputAlphabetType input_char_mode; /**< input character mode(SMS default, UCS2) */
-       gboolean is_numeric;    /**< is input character numeric(0-9, *, # and +) */
-       gboolean is_help_info_available; /**< help info request flag */
-       TelSatTextInfo text; /**< character data to display on screen */
-       unsigned int duration;   /**< the duration of display */
-       TelSatIconIdentifierInfo icon_id; /**< Icon Identifier */
-} TelSatGetInkeyInd;
-
-/**
- * This structure defines the get input proactive command data for sat ui.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatUseInputAlphabetType input_char_mode; /**< input character mode(SMS default, UCS2) */
-       gboolean is_numeric;    /**< is input character numeric(0-9, *, # and +) */
-       gboolean is_help_info_available; /**< flag for help info request */
-       gboolean is_echo_input; /**< indicates whether to show input data on screen or not */
-       TelSatTextInfo text; /**< character data to display on screen */
-       TelSatRespLenInfo resp_len; /**< input data min, max length */
-       TelSatTextInfo default_text; /**< default input character data */
-       TelSatIconIdentifierInfo icon_id; /**< Icon Identifier */
-} TelSatGetInputInd;
-
-/**
- * This structure defines the play tone proactive command data for application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatTextInfo text; /**< character data to display on screen */
-       TelSatToneType tone; /**< tone info */
-       unsigned int duration; /**< the duration for playing tone */
-       TelSatIconIdentifierInfo icon_id; /**< Icon Identifier */
-} TelSatPlayToneInd;
-
-/**
- * This structure defines the data for sat ui.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       int user_confirm; /**< user confirmation */
-       TelSatTextInfo text; /**< character data to display on screen */
-       TelSatIconIdentifierInfo icon_id; /**< Icon Identifier */
-} TelSatSendUiInfo;
-
-/**
- * This structure defines the menu item info for setup menu.
- */
-typedef struct
-{
-       char item_string[TEL_SAT_DEF_ITEM_STR_LEN_MAX + 6]; /**< menu item character data */
-       char item_id; /**< identifies the item on the menu that user selected */
-} TelSatMenuInfo;
-
-/**
- * This structure defines the sat main menu info.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       gboolean is_main_menu_present; /**< is main menu present check */
-       char sat_main_title[TEL_SAT_DEF_TITLE_LEN_MAX + 1]; /**< menu title text */
-       unsigned short sat_main_menu_item_count; /**< number of menu items */
-       TelSatMenuInfo sat_main_menu_item[TEL_SAT_MENU_ITEM_COUNT_MAX]; /**< menu items */
-       gboolean is_sat_main_menu_help_info; /**< flag for help information request */
-       gboolean is_updated_sat_main_menu; /**< check whether sat_main_menu is updated or not */
-       TelSatIconIdentifierInfo icon_id; /**< Icon Identifier */
-       TelSatIconIdentifierListInfo icon_id_list; /**< List of Icon Identifiers */
-} TelSatSetupMenuInfo;
-
-/**
- * This structure defines the select item proactive command data for sat ui.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       gboolean is_help_info_available; /**< flag for help information request */
-       TelSatTextInfo text; /**< menu title text */
-       char default_item_index; /**< selected default item - default value is 0 */
-       char menu_item_count; /**< number of menu items */
-       TelSatMenuItemInfo menu_item[TEL_SAT_MENU_ITEM_COUNT_MAX]; /**< menu items */
-       TelSatIconIdentifierInfo icon_id; /**< Icon Identifier */
-       TelSatIconIdentifierListInfo icon_id_list; /**< List of Icon Identifiers */
-}TelSatSelectItemInd;
-
-/**
- * This structure defines the setup idle mode text proactive command for idle application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatTextInfo text; /**< character data to display on screen */
-       TelSatIconIdentifierInfo icon_id; /**< Icon Identifier */
-} TelSatSetupIdleModeTextInd;
-
-/**
- * This structure defines the refresh proactive command data for sat ui.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       unsigned int duration; /**< the duration of display */
-       TelSatCmdQualifierRefresh       refresh_type; /**< refresh mode */
-} TelSatRefreshIndUiInfo;
-
-/**
- * This structure defines the refresh proactive command data for applications which are concerned with files resident on USIM .
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatRefreshAppType     app_type; /**< concerned application type */
-       TelSatCmdQualifierRefresh       refresh_mode; /**< refresh mode */
-       unsigned char file_count; /**< refresh file count */
-       int file_id[TEL_SAT_REFRESH_FILE_LIST]; /**< refresh file identifier */
-} TelSatRefreshInd;
-
-/**
- * This structure defines the data objects to indicate to sat ui, the end of execution of a specific proactive command by other application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       char command_type;      /**< Command Type */
-       gboolean result; /**< result of command execution by application */
-} TelSatProactiveCmdEndIndInfo;
-
-/**
- * This structure defines the send sms proactive command data for sms application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       gboolean is_packing_required; /**< flag to check if packing required for sms tpdu */
-       TelSatAddressInfo address; /**< destination address */
-       TelSatSmsTpduInfo sms_tpdu; /**< SMS TPDU data */
-} TelSatSendSmsIndSmsData;
-
-/**
- * This structure defines the send ss proactive command data for ss application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       unsigned short ss_string_len; /**< SS string data length */
-       unsigned char ss_string[TEL_SAT_DEF_SS_LEN_MAX+1]; /**< SS string data */
-} TelSatSendSsIndSsData;
-
-/**
- * This structure defines the send ussd proactive command data for ussd application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       unsigned char raw_dcs; /**< data coding scheme */
-       unsigned short ussd_string_len; /**< USSD string data length */
-       unsigned char ussd_string[TEL_SAT_DEF_USSD_LEN_MAX+1]; /**< USSD string data */
-} TelSatSendUssdIndUssdData;
-
-/**
- * This structure defines the send dtmf proactive command data for dtmf application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       gboolean is_hidden_mode; /**< hidden mode flag */
-       TelSatTextInfo dtmf_string; /**< dtmf string data */
-} TelSatSendDtmfIndDtmfData;
-
-/**
- * This structure defines the setup call proactive command data for call application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatCmdQualifierSetupCall call_type; /**< call type */
-       TelSatTextInfo disp_text; /**< display data for calling */
-       TelSatTextInfo call_number; /**< call number */
-       unsigned int duration; /**< maximum repeat duration */
-       TelSatIconIdentifierInfo icon_id; /**< icon identifier for call application */
-} TelSatSetupCallIndCallData;
-
-/**
- * This structure defines the launch browser proactive command data for browser application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       char url[TEL_SAT_URL_LEN_MAX + 1]; /**< url to connect */
-       TelSatCmdQualifierLaunchBrowser launch_type; /**< launch type */
-       TelSatBrowserIdentityType identity_type; /**< Browser Identity -default, html, etc */
-} TelSatLaunchBrowserIndBrowserData;
-
-/**
- * This structure defines the provide local info proactive command data for application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       TelSatCmdQualifierProvideLocalInfo local_info_type; /**< Provide Local Information Type */
-} TelSatProvideLocalInfoInd;
-
-/**
- * This structure defines the language notification proactive command data for application.
- */
-typedef struct
-{
-       int command_id; /**< Proactive Command Number sent by USIM */
-       gboolean specific_language_notification;  /**< flag for checking specific language notification. if FALSE, non-specific language notification */
-       TelSatLanguageInfo language; /**< language info from USIM application */
-} TelSatLanguageNotiInfoInd;
-
-/**
- * This structure defines the return result data for refresh proactive command.
- */
-typedef struct
-{
-       TelSatRefreshAppType     app_type; /**< application type */
-       TelSatResultType resp; /**< result response value */
-} TelSatRefreshRetInfo;
-
-/**
- * This structure defines the return result data for setup call proactive command.
- */
-typedef struct
-{
-       TelSatResultType resp; /**< result response value */
-       gboolean is_tapi_cause_exist; /**< flag for checking tapi error cause */
-       TelCallResult call_cause; /**< call error(result) cause */
-       TelSsResult ss_cause; /**< ss error(result) cause */
-       TelSatMeProblemType me_problem; /**< me problem error cause */
-       gboolean is_other_info_exist; /**< call control result existence flag */
-       TelSatCallCtrlProblemType permanent_call_ctrl_problem; /**< call control problem type */
-       TelSatCallCtrlRequestedActionInfo call_ctrl_requested_action; /**< call control request data */
-       TelSatResultInfo result2; /**< call control envelope result value */
-       TelSatTextTypeInfo text; /**< call control envelope display data */
-} TelSatCallRetInfo;
-
-/**
- * This structure defines the return result data for send ss proactive command.
- */
-typedef struct
-{
-       TelSatResultType resp; /**< result response value */
-       TelSsResult ss_cause; /**< ss error(result) cause */
-       TelSatTextInfo ss_string; /**< ss result string */
-       TelSatMeProblemType me_problem; /**< error - me problem */
-       gboolean is_other_info_exist; /**< call control result exist flag */
-       TelSatCallCtrlProblemType additional_call_ctrl_problem_info; /**< call control problem */
-       TelSatCallCtrlRequestedActionInfo call_ctrl_requested_action; /**< call control request data */
-       TelSatResultInfo result2; /**< call control envelope result value */
-} TelSatSsRetInfo;
-
-/**
- * This structure defines the return result data for send ussd proactive command.
- */
-typedef struct
-{
-       TelSatResultType resp; /**< result response value */
-       TelSsResult ss_cause; /**< ss error(result) cause */
-       TelSatTextInfo ussd_string; /**< ussd result string */
-       TelSatDataCodingSchemeInfo dcs_ussd_string; /**< dcs of ussd result string */
-       TelSatMeProblemType me_problem; /**< error - me problem */
-       gboolean is_other_info_exist; /**< call control result exist flag */
-       TelSatCallCtrlProblemType additional_call_ctrl_problem_info; /**< call control problem */
-       gboolean is_call_ctrl_has_modification; /**< call control request modification flag */
-       TelSatCallCtrlRequestedActionInfo call_ctrl_requested_action; /**< call control request data */
-       TelSatResultInfo result2; /**< call control envelope result value */
-       TelSatTextTypeInfo text2; /**< cc envelope display data */
-} TelSatUssdRetInfo;
-
-/**
- * This structure defines the return result data for launch browser proactive command.
- */
-typedef struct
-{
-       TelSatResultType resp; /**< result response value */
-       TelSatLaunchBrowserProblemType browser_problem; /**< specific browser problem */
-} TelSatBrowserRetInfo;
-
-/**
- * This structure defines the return result data for setup idle mode text proactive command.
- */
-typedef struct
-{
-       TelSatResultType resp; /**< result response value */
-       gboolean other_info; /**< flag to check whether other information are required or not */
-       TelSatCmdQualifierProvideLocalInfo      info_type; /**< local info type - e.g. time zone or language info, etc */
-       union
-       {
-               TelSatDateTimeZoneInfo time_zone_info; /**< current time zone info */
-               TelSatLanguageInfo language_info; /**< current ME language setting info */
-       }local_info; /**< Union */
-} TelSatProvideLocalRetInfo;
-
-/**
- * This structure defines the return result data for setup idle mode text proactive command.
- */
-typedef struct
-{
-       TelSatResultType resp; /**< result response value */
-       TelSatMeProblemType      me_problem; /**< Me Problem Type */
-} TelSatDiplayTextRetInfo;
-
-/**
- * This structure defines the common return result data for applications proactive command.
- */
-typedef struct
-{
-       TelSatProactiveCmdType command_type; /**< Proactive Command type */
-       int command_id; /**< Proactive Command Number sent by USIM */
-       union
-               {
-                       TelSatResultType setup_menu_resp; /**< result response value for setup menu */
-                       TelSatRefreshRetInfo refresh; /**< result response value for refresh */
-                       TelSatCallRetInfo setup_call; /**< result response value for setup call */
-                       TelSatSsRetInfo send_ss; /**< result response value for send ss */
-                       TelSatUssdRetInfo send_ussd; /**< result response value for send ussd */
-                       TelSatResultType send_sms_resp; /**< result response value for send sms */
-                       TelSatResultType send_dtmf_resp; /**< result response value for send dtmf */
-                       TelSatBrowserRetInfo launch_browser; /**< result response value for launch browser */
-                       TelSatResultType setup_idle_mode_text_resp; /**< result response value for setup idle mode text */
-                       TelSatResultType language_noti_resp; /**< result response value for language notification */
-                       TelSatProvideLocalRetInfo provide_local_info; /**< result response value for provide local info */
-                       TelSatDiplayTextRetInfo display_text; /**< result response value for dsiplay text */
-                       TelSatResultType play_tone_resp; /**< result response value for play tone */
-               }apps_ret; /**< common union result value */
-}TelSatAppsRetInfo;
-
-/**
- * This structure defines the call control confirm data for call.
- */
-typedef struct
-{
-       TelSatTextInfo address; /**< call destination address */
-       TelSatTextInfo sub_address; /**< call SUB address */
-       TelSatBcRepeatIndicatorType bc_repeat_indicator; /**< bc repeat indicator*/
-       TelSatTextInfo ccp1; /**< Configuration Capability Parameter 1*/
-       TelSatTextInfo ccp2; /**< Configuration Capability Parameter 2*/
-} TelSatCallCtrlIndCallData;
-
-/**
- * This structure defines the call control confirm data for ss.
- */
-typedef struct
-{
-       TelSatTextInfo ss_string; /**< ss destination address */
-       TelSatTextInfo sub_address; /**< call SUB address */
-       TelSatBcRepeatIndicatorType bc_repeat_indicator; /**< bc repeat indicator */
-       TelSatTextInfo ccp1; /**< Configuration Capability Parameter 1 */
-       TelSatTextInfo ccp2; /**< Configuration Capability Parameter 2 */
-} TelSatCallCtrlIndSsData;
-
-/**
- * This structure defines the common call control confirm data.
- */
-typedef struct
-{
-       TelSatCallType call_ctrl_cnf_type; /**< call control confirm type - call, ss or ussd */
-       TelSatCallCtrlResultType call_ctrl_result; /**< call control result */
-       TelSatTextInfo disp_data; /**< call control display data */
-       gboolean is_user_info_display_enabled; /**< flag for checking existence of call control display */
-
-       union
-               {
-                       TelSatCallCtrlIndCallData call_ctrl_cnf_call_data; /**< call control call address */
-                       TelSatCallCtrlIndSsData call_ctrl_cnf_ss_data; /**< call control ss string */
-                       TelSatTextInfo call_ctrl_cnf_ussd_data; /**< call control ussd string */
-               }call_ctrl_data; /**< Union */
-} TelSatCallCtrlIndData;
-
-/**
- * This structure defines the mo sms control confirm data.
- */
-typedef struct
-{
-       TelSatCallCtrlResultType mo_sms_ctrl_result; /**< envelope result */
-       gboolean is_user_info_display_enabled; /**< display present flag */
-       TelSatTextTypeInfo disp_data; /**< display data for sending SMS */
-       TelSatTextTypeInfo rp_dest_addr; /**< the RP_Destination_Address of the Service Center */
-       TelSatTextTypeInfo tp_dest_addr; /**< the TP_Destination_Address */
-} TelSatMoSmCtrlIndData;
-
-/**
- * This structure defines the Event List Info.
- */
-typedef struct
-{
-       gboolean is_event_download_active; /**< Is Event Download Active */
-       gboolean is_mt_call_event; /**< Is Mt Call Event */
-       gboolean is_call_connected; /**< Is Call Connected */
-       gboolean is_call_disconnected; /**< Is Call Disconnected */
-       gboolean is_location_status; /**< Is Location Status */
-       gboolean is_user_activity;      /**< Is User Activity */
-       gboolean is_idle_screen_available;      /**< Is Idle Screen Available */
-       gboolean is_card_reader_status; /**< Is Card Reader Status */
-       gboolean is_language_selection; /**< Is Language Selection */
-       gboolean is_browser_termination;        /**< Is Browser Termination */
-       gboolean is_data_available; /**< Is Data Available */
-       gboolean is_channel_status; /**< Is Channel Status */
-} TelSatEventListData;
-
-/**
- * This structure contains the data objects for MENU SELECTION envelope.
- */
-typedef struct
-{
-       unsigned char item_identifier; /**< menu selection item identifier */
-       gboolean is_help_requested; /**< flag to check whether help information required or not */
-} TelSatMenuSelectionReqInfo;
-
-/**
- * This struct contains the data objects for Call Control result data sent by USIM.
- */
-typedef struct
-{
-       TelSatAddressInfo address; /**< call number */
-       TelSatSubAddressInfo sub_address; /**< call number sub address */
-       TelSatBcRepeatIndicatorType bc_repeat_indicator; /**< bc repeat indicator */
-       TelSatCcpInfo ccp1; /**< capability configuration parameter1 */
-       TelSatCcpInfo ccp2; /**< capability configuration parameter2 */
-}TelSatVoiceCallCtrlIndInfo;
-
-/**
- * This struct contains SAT ss control result data sent by USIM.
- */
-typedef struct
-{
-       TelSatSsStringInfo ss_string; /**< ss number */
-       TelSatSubAddressInfo sub_address; /**< ss sub address */
-       TelSatBcRepeatIndicatorType bc_repeat_indicator; /**< bc repeat indicator */
-       TelSatCcpInfo ccp1; /**< capability configuration parameter1 */
-       TelSatCcpInfo ccp2; /**< capability configuration parameter2 */
-}TelSatSsCtrlIndInfo;
-
-/**
- * This struct contains SAT mo SMS control configuration data
- */
-typedef struct
-{
-       TelSatAddressInfo rp_dest_address; /**< sms control rp destination address */
-       TelSatAddressInfo       tp_dest_address; /**<    sms control tp destination address */
-} TelSatMoSmsCtrlIndInfo;
-
-/**
- * This struct contains SAT call control configuration data
- */
-typedef struct
-{
-       TelSatCallType call_type; /**< call type */
-       TelSatCallCtrlResultType call_ctrl_result; /**< call control result     */
-       TelSatAlphaIdentifierInfo alpha_identifier; /**< alpha identifier */
-       unsigned char call_id; /**< call id */
-       TelSatCallType old_call_type; /**< old call type */
-       union
-       {
-               TelSatVoiceCallCtrlIndInfo      voice_call_data; /**< voice call control data */
-               TelSatSsCtrlIndInfo ss_data; /**< ss control data */
-               TelSatMoSmsCtrlIndInfo sms_data; /**< Mo Sms Ctrl Ind Info */
-       }call_ctrl_data; /**< Union */
-} TelSatCallCtrlIndInfo;
-
-/**
- * This struct contains SAT mo ss control request data
- */
- typedef struct
-{
-       TelSatCallCtrlResultType call_ctrl_result; /**< call control result     */
-       TelSatAlphaIdentifierInfo alpha_identifier; /**< alpha identifier */
-       TelSatMoSmsCtrlIndInfo sms_data;        /**< sms control data */
-}TelSatMoSMCtrlResult;
-
-/**
- * This struct contains SAT user activity event request data
- */
-typedef struct
-{
-       TelSatEventListInfo event_list; /**< event List  */
-       TelSatDeviceIdentitiesInfo device_identities;   /**<    device identities info */
-
-} TelSatUserActivityEventReqInfo;
-
-/**
- * This struct contains SAT data available event request data
- */
-typedef struct
-{
-       TelSatEventListInfo event_list; /**< event List  */
-       TelSatDeviceIdentitiesInfo device_identities;   /**<    device identities info */
-       TelSatChannelStatusInfo channel_status; /**< channel status */
-       unsigned char channel_data_len; /**< channel data length */
-
-} TelSatDataAvailableEventReqInfo;
-
-/**
- * This struct contains SAT channel status even request data
- */
-typedef struct
-{
-       TelSatEventListInfo event_list; /**< event list */
-       TelSatDeviceIdentitiesInfo device_identities;   /**<    device identities info */
-       TelSatChannelStatusInfo channel_status; /**< channel Status */
-} TelSatChannelStatusEventReqInfo;
-
-/**
- * This is the structure to be used by the Application to send envelope/event download data.
- * This contains the data structures to be used to send any envelope/event download data.
- */
-typedef struct
-{
-       TelSatEventListType event_download_type; /**< eventDownload Type */
-       union
-       {
-               gboolean is_idle_screen_available; /**< flag to specify whether Idle Screen is Available or not */
-               TelSatLanguageInfo language_selection_event_req_info; /**< Selected Language Information */
-               TelSatBrowserTerminationCauseType browser_termination_event_req_info; /**< BrowserTermination Event Information */
-               TelSatDataAvailableEventReqInfo data_available_event_req_info; /**< dataAvailableEventReqInfo */
-               TelSatChannelStatusEventReqInfo channel_status_event_req_info; /**< channelStatusEventReqInfo */
-       } event_download_data; /**< Union */
-} TelSatEventDownloadReqInfo;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TEL_EVENT_SAT SAT Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief Setup menu information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_SETUP_MENU
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_SETUP_MENU
- *  @retval data reference to \ref TelSatSetupMenuInfo structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_SETUP_MENU                                        TELEPHONY_SAT_INTERFACE":SetupMenu"
-
-/**
- *  @hideinitializer
- *  @brief Display text information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_DISPLAY_TEXT
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_DISPLAY_TEXT
- *  @retval data reference to \ref TelSatDisplayTextInd structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_DISPLAY_TEXT                                      TELEPHONY_SAT_INTERFACE":DisplayText"
-
-/**
- *  @hideinitializer
- *  @brief Select item information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_SELECT_ITEM
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_SELECT_ITEM
- *  @retval data reference to \ref TelSatSelectItemInd structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_SELECT_ITEM                                       TELEPHONY_SAT_INTERFACE":SelectItem"
-
-/**
- *  @hideinitializer
- *  @brief Get inkey information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_GET_INKEY
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_GET_INKEY
- *  @retval data reference to \ref TelSatGetInkeyInd structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_GET_INKEY                                         TELEPHONY_SAT_INTERFACE":GetInkey"
-
-/**
- *  @hideinitializer
- *  @brief Get input information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_GET_INPUT
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_GET_INPUT
- *  @retval data reference to \ref TelSatGetInputInd structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_GET_INPUT                                         TELEPHONY_SAT_INTERFACE":GetInput"
-
-/**
- *  @hideinitializer
- *  @brief Refresh information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_REFRESH
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_REFRESH
- *  @retval data reference to \ref TelSatRefreshInd structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_REFRESH                                           TELEPHONY_SAT_INTERFACE":Refresh"
-
-/**
- *  @hideinitializer
- *  @brief Send SMS information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_SEND_SMS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_SEND_SMS
- *  @retval data reference to \ref TelSatSendSmsIndSmsData structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_SEND_SMS                                          TELEPHONY_SAT_INTERFACE":SendSMS"
-
-/**
- *  @hideinitializer
- *  @brief Setup event list information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_SETUP_EVENT_LIST
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_SETUP_EVENT_LIST
- *  @retval data reference to \ref TelSatEventListData structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_SETUP_EVENT_LIST                          TELEPHONY_SAT_INTERFACE":SetupEventList"
-
-/**
- *  @hideinitializer
- *  @brief Send DTMF information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_SEND_DTMF
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_SEND_DTMF
- *  @retval data reference to \ref TelSatSendDtmfIndDtmfData structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_SEND_DTMF                                         TELEPHONY_SAT_INTERFACE":SendDtmf"
-
-/**
- *  @hideinitializer
- *  @brief Session end event information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_SESSION_END_EVENT
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_SESSION_END_EVENT
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_SESSION_END_EVENT                 TELEPHONY_SAT_INTERFACE":EndProactiveSession"
-
-/**
- *  @hideinitializer
- *  @brief Call control information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_CALL_CONTROL_RESULT
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_CALL_CONTROL_RESULT
- *  @retval data reference to \ref TelSatCallCtrlIndData structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_CALL_CONTROL_RESULT                       TELEPHONY_SAT_INTERFACE":CallControlResult"
-
-/**
- *  @hideinitializer
- *  @brief MO SM control information
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SAT_MO_SM_CONTROL_RESULT
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SAT_MO_SM_CONTROL_RESULT
- *  @retval data reference to \ref TelSatMoSmCtrlIndData structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SAT_MO_SM_CONTROL_RESULT              TELEPHONY_SAT_INTERFACE":MoSmControlResult"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
- #endif /* __TEL_SAT_H_ */
diff --git a/tel-headers/include/tel_sim.h b/tel-headers/include/tel_sim.h
deleted file mode 100644 (file)
index dc9082b..0000000
+++ /dev/null
@@ -1,703 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_SIM_H__
-#define __TEL_SIM_H__
-
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_SIM
-*  @{
-*
-*  @file tel_sim.h
-*  @brief TAPI sim Interface
-*/
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define TELEPHONY_SIM_INTERFACE                 TELEPHONY_SERVICE".Sim"
-
-#define TEL_SIM_ICCID_LEN_MAX                  20      /**< Maximum ICCID Length */
-#define TEL_SIM_MSIN_LEN_MAX                   10      /**< Mobile Station Identification Number max length */
-#define TEL_SIM_MCC_MNC_LEN_MAX                        3       /**< MCC/MNC max length */
-
-#define TEL_SIM_PLMN_LEN_MAX                   6       /**< PLMN max length */
-#define TEL_SIM_SPN_LEN_MAX                    16      /**< Service Provider Name max length */
-
-#define TEL_SIM_ECC_NUMBER_LEN_MAX             6       /**< Emergency code max length */
-#define TEL_SIM_ECC_LIST_MAX                   16      /**< Emergency list max items */
-#define TEL_SIM_ECC_TEXT_MAX                   255     /**< Emergency alpha identifier max length */
-
-#define TEL_SIM_EXT_RECORD_CNT_MAX 15  /** EXT record count max length */
-#define TEL_SIM_OPL_PNN_RECORD_CNT_MAX 5 /* OPL PNN record count max  */
-#define TEL_SIM_NW_FULL_NAME_LEN_MAX 40 /* Full name length max */
-#define TEL_SIM_MBDN_NUM_LEN_MAX               20      /**< Max length of the Number supported*/
-#define TEL_SIM_ALPHA_ID_LEN_MAX               241     /**< Max length of the Alpha ID supported*/
-
-#define TEL_SIM_MSP_CNT_MAX                    4       /**< The Profile Identity shall be between 1and 4 as defined in TS 23.097 for MSP.*/
-
-#define TEL_SIM_AUTH_MAX_REQ_DATA_LEN          16      /**< Authentication code max length */
-#define TEL_SIM_AUTH_MAX_RESP_DATA_LEN         16      /**< Authentication response data max length */
-
-#define TEL_SIM_APDU_LEN_MAX                   261     /**< APDU max command length */
-#define TEL_SIM_APDU_RESP_LEN_MAX              258     /**< APDU max response length */
-#define TEL_SIM_ATR_LEN_MAX                    33      /**< Answer to Reset data max length */
-
-#define TEL_SIM_MAILBOX_TYPE_MAX               5       /**< Mailbox type count */
-#define TEL_SIM_CALL_FORWARDING_TYPE_MAX               5       /** Call forwarding type count */
-
-/**
- * @enum TelSimResult
- * Response (Return) values.
- */
-typedef enum {
-       TEL_SIM_RESULT_SUCCESS, /**< Operation completed successfully */
-       TEL_SIM_RESULT_FAILURE, /**< Operation Failed */
-       TEL_SIM_RESULT_INVALID_PARAMETER, /**< Invalid input parameters */
-       TEL_SIM_RESULT_MEMORY_FAILURE, /**< Memory allocation failed */
-       TEL_SIM_RESULT_OPERATION_NOT_SUPPORTED, /**< Operation not supported */
-
-       TEL_SIM_RESULT_CARD_ERROR,  /**< SIM card error - Permanently blocked and general errors   */
-       TEL_SIM_RESULT_ACCESS_CONDITION_NOT_SATISFIED, /**< SIM Incompatible pin operation that is in case when invalid SIM command is given or incorrect parameters are supplied to the SIM. */
-       TEL_SIM_RESULT_INCOMPATIBLE_PIN_OPERATION, /**< SIM PIN  Incorrect password */
-       TEL_SIM_RESULT_INCORRECT_PASSWORD, /**< SIM Incorrect password */
-       TEL_SIM_RESULT_PIN_REQUIRED, /**< PIN Required */
-       TEL_SIM_RESULT_PUK_REQUIRED, /**< PUK Required */
-       TEL_SIM_RESULT_PERM_BLOCKED, /**< Permanent block SIM */
-       TEL_SIM_RESULT_SQN_FAILURE, /**< status - SQN(SeQuenceNumber) failure */
-       TEL_SIM_RESULT_OPERATION_NOT_PERMITTED  /**< Operation not permitted */
-} TelSimResult;
-
-/**
- * @enum TelSimCardType
- * This enumeration defines the card type.
- */
-typedef enum {
-       TEL_SIM_CARD_TYPE_UNKNOWN,      /**< Unknown card */
-       TEL_SIM_CARD_TYPE_GSM,          /**< 2G SIM(GSM) card */
-       TEL_SIM_CARD_TYPE_USIM,         /**< 3G USIM card */
-       TEL_SIM_CARD_TYPE_RUIM,         /**< CDMA based card */
-       TEL_SIM_CARD_TYPE_ISIM          /**< IMS based card */
-} TelSimCardType;
-
-typedef enum {
-       TEL_SIM_MWIS_NONE = 0x00, /**< MWIS none*/
-       TEL_SIM_MWIS_VOICE = 0x01, /**< MWIS voice*/
-       TEL_SIM_MWIS_FAX = 0x02, /**< MWIS FAX*/
-       TEL_SIM_MWIS_EMAIL = 0x04, /**< MWIS email*/
-       TEL_SIM_MWIS_OTHER = 0x08, /**< MWIS other*/
-       TEL_SIM_MWIS_VIDEO = 0x10, /**< MWIS video*/
-       TEL_SIM_MWIS_RFU = 0xff /**< MWIS RFU*/
-} TelSimMwisMask;
-
-/** * @enum TelSimFacilityStatus
- * This enumeration defines the pin status.
- */
-typedef enum {
-       TEL_SIM_FACILITY_STATUS_UNKNOWN = -1, /**< SIM facility UNKNOWN status*/
-       TEL_SIM_FACILITY_STATUS_DISABLED, /**< SIM facility DISABLED status*/
-       TEL_SIM_FACILITY_STATUS_ENABLED /**< SIM facility ENABLED status*/
-} TelSimFacilityStatus;
-
-/**
- * @enum TelSimPinType
- * This enumeration defines the pin type.
- */
-typedef enum {
-       TEL_SIM_PIN_TYPE_PIN1, /**< PIN 1 code */
-       TEL_SIM_PIN_TYPE_PIN2 /**< PIN 2 code */
-} TelSimPinType;
-
-/**
- * @enum TelSimPukType
- * This enumeration defines the puk type.
- */
-typedef enum {
-       TEL_SIM_PUK_TYPE_PUK1, /**< PUK 1 code */
-       TEL_SIM_PUK_TYPE_PUK2 /**< PUK 2 code */
-} TelSimPukType;
-
-/**
- * @enum TelSimEccEmergencyServiceInfo
- * This enumeration defines the emergency service type.
- */
-typedef enum {
-       TEL_SIM_ECC_ESC_DEFAULT =               0x00, /**< DEFAULT */
-       TEL_SIM_ECC_ESC_POLICE =                0x01, /**< Police */
-       TEL_SIM_ECC_ESC_AMBULANCE =             0x02, /**< Ambulance */
-       TEL_SIM_ECC_ESC_FIREBRIGADE =           0x04, /**< Fire brigade */
-       TEL_SIM_ECC_ESC_MARINEGUARD =           0x08, /**< Marine guard */
-       TEL_SIM_ECC_ESC_MOUNTAINRESCUE =        0x10, /**< Mountain rescue */
-       TEL_SIM_ECC_ESC_MANUAL_ECALL =          0x20, /**< Manual Emergency call */
-       TEL_SIM_ECC_ESC_AUTO_ECALL =            0x40 /**< Automatic Emergency call */
-} TelSimEccEmergencyServiceInfo;
-
-/**
- * @enum TelSimLanguagePreferenceCode
- * This enumeration defines the language indication code.
- */
-typedef enum {
-       TEL_SIM_LP_GERMAN =             0x00, /**< German */
-       TEL_SIM_LP_ENGLISH =            0x01, /**< English */
-       TEL_SIM_LP_ITALIAN =            0x02, /**< Italian */
-       TEL_SIM_LP_FRENCH =             0x03, /**< French */
-       TEL_SIM_LP_SPANISH =            0x04, /**< Spanish */
-       TEL_SIM_LP_DUTCH =              0x05, /**< Dutch */
-       TEL_SIM_LP_SWEDISH =            0x06, /**< Swedish */
-       TEL_SIM_LP_DANISH =             0x07, /**< Danish */
-       TEL_SIM_LP_PORTUGUESE =         0x08, /**< Portuguese */
-       TEL_SIM_LP_FINNISH =            0x09, /**< Finnish */
-       TEL_SIM_LP_NORWEGIAN =          0x0A, /**< Norwegian */
-       TEL_SIM_LP_GREEK =              0x0B, /**< Greek */
-       TEL_SIM_LP_TURKISH =            0x0C, /**< Turkish */
-       TEL_SIM_LP_HUNGARIAN =          0x0D, /**< Hungarian */
-       TEL_SIM_LP_POLISH =             0x0E, /**< Polish */
-       TEL_SIM_LP_KOREAN =             0x0F, /**< Korean */
-       TEL_SIM_LP_CHINESE =            0x10, /**< Chinese */
-       TEL_SIM_LP_RUSSIAN =            0x11, /**< Russian */
-       TEL_SIM_LP_JAPANESE =           0x12, /**< Japanese */
-       TEL_SIM_LP_LANG_UNSPECIFIED =   0xFF /**< Unspecified */
-} TelSimLanguagePreferenceCode;
-
-/**
- * @enum TelSimCardStatus
- * This enumeration defines the SIM card status
- */
-typedef enum {
-       TEL_SIM_STATUS_UNKNOWN,                         /**<  Unknown status. It can be initial status **/
-       TEL_SIM_STATUS_CARD_ERROR,                      /**<  Bad card / On the fly SIM gone bad **/
-       TEL_SIM_STATUS_SIM_CARD_POWEROFF,       /**<  SIM Card Powered OFF **/
-       TEL_SIM_STATUS_CARD_NOT_PRESENT,        /**<  Card not present **/
-       TEL_SIM_STATUS_SIM_INITIALIZING,                /**<  SIM is Initializing state **/
-       TEL_SIM_STATUS_SIM_INIT_COMPLETED,      /**<  SIM Initialization COMPLETE **/
-       TEL_SIM_STATUS_SIM_PIN_REQUIRED,        /**<  PIN  required state **/
-       TEL_SIM_STATUS_SIM_PUK_REQUIRED,        /**<  PUK  required state **/
-       TEL_SIM_STATUS_CARD_BLOCKED,            /**<  PIN/PUK blocked(permanently blocked - All the attempts for PIN/PUK failed) **/
-       TEL_SIM_STATUS_SIM_NCK_REQUIRED,        /**<  Network Control Key required state **/
-       TEL_SIM_STATUS_SIM_NSCK_REQUIRED,       /**<  Network Subset Control Key required state **/
-       TEL_SIM_STATUS_SIM_SPCK_REQUIRED,       /**<  Service Provider Control Key required state **/
-       TEL_SIM_STATUS_SIM_CCK_REQUIRED,        /**<  Corporate Control Key required state **/
-       TEL_SIM_STATUS_CARD_REMOVED,            /**<  Card removed **/
-       TEL_SIM_STATUS_SIM_LOCK_REQUIRED        /**<  PH-SIM (phone-SIM) locked state **/
-} TelSimCardStatus;
-
-/**
- * @enum TelSimCardChangeStatus
- * This enumeration defines whether SIM card is changed or not
- */
-typedef enum {
-       TEL_SIM_CHANGE_STATUS_UNKNOWN, /**< Unknown */
-       TEL_SIM_CHANGE_STATUS_SAME, /**< SIM card is same */
-       TEL_SIM_CHANGE_STATUS_CHANGED /**< SIM card is changed */
-} TelSimCardChangeStatus;
-
-/**
- * @enum TelSimRefreshCommandType
- * This enumeration defines the SIM card status
- */
-typedef enum {
-       TEL_SIM_REFRESH_CMD_INIT_AND_FULL_FCN           = 0x00, /**<    command qualifier for REFRESH SIM INIT AND FULL FILE CHANGE_NOTIFICATION                */
-       TEL_SIM_REFRESH_CMD_FCN                                         = 0x01, /**<    command qualifier for REFRESH FILE CHANGE NOTIFICATION          */
-       TEL_SIM_REFRESH_CMD_INIT_AND_FCN                        = 0x02, /**<    command qualifier for REFRESH SIM INIT AND FILE CHANGE NOTIFICATION             */
-       TEL_SIM_REFRESH_CMD_INIT                                        = 0x03, /**<    command qualifier for REFRESH SIM INIT          */
-       TEL_SIM_REFRESH_CMD_RESET                                       = 0x04, /**<    command qualifier for REFRESH SIM RESET         */
-       TEL_SIM_REFRESH_CMD_3G_APPLICATION_RESET        = 0x05, /**<    command qualifier for REFRESH 3G APPLICATION RESET              */
-       TEL_SIM_REFRESH_CMD_3G_SESSION_RESET            = 0x06, /**<    command qualifier for REFRESH 3G SESSION RESET          */
-       TEL_SIM_REFRESH_CMD_UNSPECIFIED                         = 0xFF  /**<    command qualifier for REFRESH RESERVED          */
-}TelSimRefreshCommandType;
-
-/**
- * @enum TelSimMailboxType
- * This enum gives mailbox type.
- */
-typedef enum {
-       TEL_SIM_MAILBOX_VOICE,  /**< Mailbox identifier voice */
-       TEL_SIM_MAILBOX_FAX,    /**< Mailbox identifier fax */
-       TEL_SIM_MAILBOX_EMAIL,  /**< Mailbox identifier email */
-       TEL_SIM_MAILBOX_OTHER,  /**< Mailbox identifier other */
-       TEL_SIM_MAILBOX_VIDEO   /**< Mailbox identifier video */
-} TelSimMailboxType;
-
-/**
- * @enum TelSimCallForwardingType
- * This enum gives Call forwarding type.
- */
-typedef enum {
-       TEL_SIM_CALL_FORWARDING_VOICE,  /**< Call forwarding identifier voice */
-       TEL_SIM_CALL_FORWARDING_FAX,    /**< Call forwarding identifier fax */
-       TEL_SIM_CALL_FORWARDING_EMAIL,  /**< Call forwarding identifier email */
-       TEL_SIM_CALL_FORWARDING_OTHER,  /**< Call forwarding identifier other */
-       TEL_SIM_CALL_FORWARDING_VIDEO   /**< Call forwarding identifier video */
-} TelSimCallForwardingType;
-
-/**
- * @enum TelSimAuthenticationType
- * This is used for Authentication Procedure by using SIM.
- */
-typedef enum {
-       TEL_SIM_AUTH_GSM, /**< GSM Authentication */
-       TEL_SIM_AUTH_GSM_CTX, /**< GSM CTX Authentication */
-       TEL_SIM_AUTH_3G_CTX, /**< 3G CTX Authentication */
-       TEL_SIM_AUTH_GBA, /**< GBA Authentication */
-       TEL_SIM_AUTH_GBA_NAF, /**< GBA NAF Authentication */
-       TEL_SIM_AUTH_IMS_AKA /**< IMS Authentication */
-} TelSimAuthenticationType;
-
-/**
- * @enum TelSimLockType
- *     This structure gives security lock type enum values
- */
-typedef enum {
-       TEL_SIM_LOCK_PS,
-       /**< PH-SIM (phone-SIM) locked.Lock Phone to SIM/UICC card
-        *      (MT asks password when other than current SIM/UICC card inserted;
-        *      MT may remember certain amount of previously used cards thus not
-        *      requiring password when they are inserted
-        */
-       TEL_SIM_LOCK_PF,
-       /**< PH-FSIM (phone-first-SIM) Lock Phone to the very
-        *      First inserted SIM/UICC card(MT asks password when other than the
-        *      first SIM/UICC card is inserted
-        */
-       TEL_SIM_LOCK_SC,
-        /**< SIM Lock (PIN, PIN2, PUK, PUK2) Lock SIM/UICC card ( SIM asks
-        *      password in ME power-up and when this command is issued */
-       TEL_SIM_LOCK_FD,
-       /**< FDN - SIM card or active application in the UICC (GSM or USIM)
-        *      fixed dialing memory feature */
-       TEL_SIM_LOCK_PN, /**< Network Personalization */
-       TEL_SIM_LOCK_PU, /**< Network subset Personalization */
-       TEL_SIM_LOCK_PP, /**< Service Provider Personalization */
-       TEL_SIM_LOCK_PC, /**< Corporate Personalization */
-} TelSimLockType;
-
-/**
- * @enum TelSimLockStatus
- * This structure gives security lock key information enum values
- */
-typedef enum {
-       TEL_SIM_LOCK_KEY_NOT_NEED,      /**< key not need */
-       TEL_SIM_LOCK_KEY_PIN,           /**< PIN required */
-       TEL_SIM_LOCK_KEY_PUK,           /**< PUK required */
-       TEL_SIM_LOCK_KEY_PIN2,          /**< PIN2 required */
-       TEL_SIM_LOCK_KEY_PUK2,          /**< PUK2 required */
-       TEL_SIM_LOCK_PERM_BLOCKED       /**< Permanent block SIM */
-} TelSimLockStatus;
-
-/**
- * @enum TelSimSpnDispCondition
- * This enumeration defines Service Provider Name display condition type.
- */
-typedef enum
-{
-       TEL_SIM_DISP_INVALID, /**< Invalid display condition */
-       TEL_SIM_DISP_SPN, /**< SPN display condition */
-       TEL_SIM_DISP_PLMN, /**< PLMN display condition */
-       TEL_SIM_DISP_SPN_PLMN /**< SPN/PLMN display condition */
-} TelSimSpnDispCondition;
-
-/**
- * This data structure defines plmn informations
- */
-typedef struct {
-       unsigned int index;     /**< Plmn list index */
-       char *plmn;             /**< numeric operator name (MCCMNC) */
-} TelSimSpPlmn;
-
-/**
- * This data structure defines plmn list
- */
-typedef struct {
-       unsigned int count;     /**< Number of service provider plmns in the list */
-       TelSimSpPlmn *list;     /**< service provider plmns list */
-} TelSimSpPlmnList;
-
-/**
- * This data structure defines the status of sim initialization
- */
-typedef struct {
-       TelSimCardStatus status; /**< Sim card status */
-       TelSimCardChangeStatus change_status; /**< Sim card change status */
-} TelSimCardStatusInfo;
-
-/**
- * This data structure defines the data for the Imsi information.
- */
-typedef struct {
-       char mcc[TEL_SIM_MCC_MNC_LEN_MAX + 1];  /**< mobile country code 3 digits*/
-       char mnc[TEL_SIM_MCC_MNC_LEN_MAX + 1];  /**< mobile network code 2 or 3 digits*/
-       char msin[TEL_SIM_MSIN_LEN_MAX + 1];    /**< Mobile Station Identification Number */
-} TelSimImsiInfo;
-
-/**
- * This data structure defines the data for the SIM ECC information.
- */
-typedef struct {
-       char number[TEL_SIM_ECC_NUMBER_LEN_MAX + 1];    /**< Emergency Call Code. null termination used*/
-       char name[TEL_SIM_ECC_TEXT_MAX + 1];            /**< Alpha identifier */
-       TelSimEccEmergencyServiceInfo category;         /**< ECC emergency service information */
-} TelSimEcc;
-
-/**
- * This data structure defines the data for the SIM ECC lists.
- */
-typedef struct {
-       unsigned int count; /**< Total count for ECC list */
-       TelSimEcc list[TEL_SIM_ECC_LIST_MAX];   /**< List of emergency numbers */
-} TelSimEccList;
-
-typedef struct {
-       int ext_len;
-       char ext[TEL_SIM_EXT_RECORD_CNT_MAX + 1];
-       unsigned short next_record;
-} TelSimExt;
-
-typedef struct {
-       unsigned char plmn[6+1];
-       unsigned short lac_from;
-       unsigned short lac_to;
-       unsigned char rec_identifier;
-} TelSimOpl;
-
-typedef struct {
-       int opl_count;
-       TelSimOpl list[TEL_SIM_OPL_PNN_RECORD_CNT_MAX];
-} TelSimOplList;
-
-typedef struct {
-       unsigned char full_name[TEL_SIM_NW_FULL_NAME_LEN_MAX + 1];
-       unsigned char short_name[TEL_SIM_NW_FULL_NAME_LEN_MAX + 1];
-} TelSimPnn;
-
-typedef struct {
-       int pnn_count;
-       TelSimPnn list[TEL_SIM_OPL_PNN_RECORD_CNT_MAX];
-} TelSimPnnList;
-
-typedef struct {
-       unsigned char profile_id;               /**< Profile Identity of the subscriber profile*/
-       TelSimMailboxType mb_type;      /**< Mailbox type */
-       unsigned int alpha_id_len; /**< Mailbox Alpha Identifier length */
-       char alpha_id[TEL_SIM_ALPHA_ID_LEN_MAX]; /**< Mailbox Alpha Identifier */
-       char number[TEL_SIM_MBDN_NUM_LEN_MAX]; /**< Dialing Number/SSC String */
-} TelSimMailBoxNumber;
-
-/**
- * This data structure defines the data for the Mailbox lists.
- */
-typedef struct {
-       unsigned int alpha_id_max_len;          /**< Alpha id max length in SIM */
-       unsigned int count;                                     /**< Number of mailbox count*/
-       TelSimMailBoxNumber list[TEL_SIM_MSP_CNT_MAX * TEL_SIM_MAILBOX_TYPE_MAX]; /**< Mailbox list info */
-} TelSimMailboxList;
-
-/**
- * This data structure defines the data for the Call Forwarding.
- */
-typedef struct {
-       unsigned char profile_id;       /**< Profile Identity of the subscriber profile*/
-       gboolean indication[TEL_SIM_CALL_FORWARDING_TYPE_MAX]; /**< 0: voice , 1 : fax, 2 : email, 3:other, 4 :video */
-} TelSimCfis;
-
-/**
- * This data structure defines the data for the Call Forwarding lists.
- */
-typedef struct {
-       unsigned int profile_count; /**< Call forwarding list count in SIM */
-       TelSimCfis cf[TEL_SIM_MSP_CNT_MAX]; /**< Call forwarding list info in SIM */
-} TelSimCfisList;
-
-/**
- * This data structure defines indication status for the Message Waiting.
- */
- typedef struct {
-       gboolean indication; /**< indication status for the Message Waiting */
-       unsigned char count; /**< indication count for the Message Waiting */
-} TelSimMsgWaitingIndicator;
-
-/**
- * This data structure defines the data for the Message Waiting.
- */
-typedef struct {
-       unsigned char profile_id; /**< Profile Identity of the subscriber profile */
-       gboolean count_valid; /**< whether count is valid or not (in case of cphs, count is not valid) */
-       TelSimMsgWaitingIndicator msg_waiting[TEL_SIM_MAILBOX_TYPE_MAX]; /**< 0: voice , 1 : fax, 2 : email, 3:other, 4 :video */
-} TelSimMwis;
-
-/**
- * This data structure defines the data for the Message Waiting lists.
- */
-typedef struct {
-       unsigned int profile_count; /**< Message waiting list count in SIM */
-       TelSimMwis mw[TEL_SIM_MSP_CNT_MAX]; /**< Message waiting list info in SIM */
-} TelSimMwisList;
-
-/**
- * This data structure defines the data for the MSISDN.
- */
-typedef struct {
-       char *alpha_id; /**< MSISDN Alpha Identifier. If not exist, Null string will be returned */
-       char *num;  /**< MSISDN number. If not exist, Null string will be returned*/
-} TelSimSubscriberInfo;
-
-/**
- * This data structure defines the data for the MSISDN lists.
- */
-typedef struct {
-       unsigned int count; /**< MSISDN list count in SIM */
-       TelSimSubscriberInfo *list; /**< MSISDN list info in SIM */
-} TelSimMsisdnList;
-
-/**
- * This data structure defines the data for the SPN.
- */
-typedef struct {
-       TelSimSpnDispCondition display_condition;       /**< display condition */
-       char spn[TEL_SIM_SPN_LEN_MAX + 1];              /**< SPN */
-} TelSimSpn;
-
-/**
- * This data structure defines the data for the CPHS Network Name.
- */
-typedef struct {
-       char *full_name; /**< Short Network Operator Name */
-       char *short_name; /**< Long Network Operator Name */
-}TelSimCphsNetName;
-
-typedef struct {
-       TelSimResult result;
-       union {
-               TelSimEccList ecc;
-               TelSimLanguagePreferenceCode language;
-               char iccid[TEL_SIM_ICCID_LEN_MAX + 1];
-               TelSimMailboxList mb;
-               TelSimCfisList cf;
-               TelSimMwisList mw;
-               TelSimMsisdnList msisdn_list;
-               TelSimSpn spn;
-               TelSimOplList opl;
-               TelSimPnnList pnn;
-               TelSimSpPlmnList spdi;
-               TelSimCphsNetName cphs_net;
-       } data;
-} TelSimFileResult;
-
-typedef struct {
-       /*      '00' - no mailbox dialing number associated with message waiting indication group type.
-        'xx' - record number in EFMBDN associated with message waiting indication group type.
-        */
-       int voice_index;        /**< voice mailbox identifier*/
-       int fax_index;  /**< FAX mailbox identifier*/
-       int email_index;        /**< email mailbox identifier*/
-       int other_index;        /**< other mailbox identifier*/
-       int video_index;        /**< video mailbox identifier*/
-} TelSimMbi;
-
-/**
- *This is used for authentication request procedure.
- */
-typedef struct {
-       TelSimAuthenticationType auth_type;             /**< Authentication type */
-       unsigned int rand_length;                       /**< the length of RAND */
-       unsigned int autn_length;                       /**< the length of AUTN. it is not used in case of GSM AUTH */
-       char rand_data[TEL_SIM_AUTH_MAX_REQ_DATA_LEN];  /**< RAND data */
-       char autn_data[TEL_SIM_AUTH_MAX_REQ_DATA_LEN];  /**< AUTN data. it is not used in case of GSM AUTH */
-} TelSimAuthenticationData;
-
-/**
- * @enum TelSimAuthenticationResult
- * This is used to get detailed result for Authentication Procedure.
- */
-typedef enum {
-       TEL_SIM_AUTH_NO_ERROR = 0x00, /**< ISIM no error */
-       TEL_SIM_AUTH_CANNOT_PERFORM, /**< status - can't perform authentication */
-       TEL_SIM_AUTH_SKIP_RESPONSE, /**< status - skip authentication response */
-       TEL_SIM_AUTH_MAK_CODE_FAILURE, /**< status - MAK(Multiple Activation Key) code failure */
-       TEL_SIM_AUTH_SQN_FAILURE, /**< status - SQN(SeQuenceNumber) failure */
-       TEL_SIM_AUTH_SYNCH_FAILURE, /**< status - synch failure */
-       TEL_SIM_AUTH_UNSUPPORTED_CONTEXT, /**< status - unsupported context */
-       TEL_SIM_AUTH_UNSPECIFIED /**< Unspecified error */
-} TelSimAuthenticationResult;
-
-/**
- * This is used for result data of authentication.
- */
-typedef struct {
-       TelSimAuthenticationType auth_type;                             /**< authentication type */
-       TelSimAuthenticationResult detailed_result;             /**<Detailed result for authentication procedure*/
-       unsigned int resp_length;                                       /**< response length. IMS and 3G case, it stands for RES_AUTS. GSM case, it stands for SRES. */
-       char resp_data[TEL_SIM_AUTH_MAX_RESP_DATA_LEN];                 /**< response data. IMS and 3G case, it stands for RES_AUTS. GSM case, it stands for SRES. */
-       unsigned int authentication_key_length;                         /**< the length of authentication key, Kc*/
-       char authentication_key[TEL_SIM_AUTH_MAX_RESP_DATA_LEN];        /**< the data of of authentication key, Kc*/
-       unsigned int cipher_length;                                     /**< the length of cipher key length */
-       char cipher_data[TEL_SIM_AUTH_MAX_RESP_DATA_LEN];               /**< cipher key */
-       unsigned int integrity_length;                                  /**< the length of integrity key length */
-       char integrity_data[TEL_SIM_AUTH_MAX_RESP_DATA_LEN];            /**< integrity key */
-} TelSimAuthenticationResponse;
-
-/**
- * @enum TelSimPowerState
- * This enumeration defines the power state of SIM.
- */
-typedef enum {
-       TEL_SIM_POWER_OFF = 0x00, /**< OFF */
-       TEL_SIM_POWER_ON = 0x01, /**< ON */
-       TEL_SIM_POWER_UNSPECIFIED = 0xFF /**< Unspecified */
-} TelSimPowerState;
-
-/**
- * This is used to verify PIN code.
- */
-typedef struct {
-       TelSimPinType pin_type; /**< Specifies the PIN type */
-       char *pw;               /**< Pin password*/
-} TelSimSecPinPw;
-
-/**
- * This is used to verify PUK code.
- */
-typedef struct {
-       TelSimPukType puk_type; /**< Specifies the PUK type */
-       char *puk_pw;           /**< Puk password */
-       char *new_pin_pw;       /**< New corresponding pin password */
-} TelSimSecPukPw;
-
-/**
- * This is used to change PIN code .
- */
-typedef struct {
-       TelSimPinType pin_type; /**< Specifies the PIN type */
-       char *old_pw;           /**< Current password */
-       char *new_pw;           /**< New pin password */
-} TelSimSecChangePinPw;
-
-/**
- * This is used to PIN code verification.
- */
-typedef struct {
-       TelSimPinType pin_type;         /**< Specifies the PIN type */
-       unsigned int retry_count;       /**< Number of attempts remaining for PIN verification */
-} TelSimSecPinResult;
-
-/**
- * This is used to PUK code verification.
- */
-typedef struct {
-       TelSimPukType puk_type;         /**< Specifies the PUK type */
-       unsigned int retry_count;       /**< Number of attempts remaining for PUK verification */
-} TelSimSecPukResult;
-
-/**
- * This structure is used to enable/disable facility
- */
-typedef struct {
-       TelSimLockType lock_type;       /**< Facility type */
-       char *pw;                       /**< password */
-} TelSimFacilityPw;
-
-/**
- * This structure is used to PIN/PUK verification
- */
-typedef struct {
-       TelSimLockType type;            /**< Specifies the PIN or PUK type.*/
-       unsigned int retry_count;       /**< Number of attempts remaining for PIN/PUK verification.*/
-} TelSimFacilityResult;
-
-/**
- * This structure is used to enable/disable facility
- */
-typedef struct {
-       TelSimLockType type; /**< Security lock type */
-       TelSimFacilityStatus f_status; /**< Lock status (enable/disable) */
-}TelSimFacilityInfo;
-
-/**
- *
- * This structure is used to get information about LOCK_TYPE
- */
-typedef struct {
-       TelSimLockType lock_type;       /**< Lock type */
-       TelSimLockStatus lock_status;   /**< Lock key */
-       unsigned int retry_count;       /**< retry counts */
-} TelSimLockInfo;
-
-/**
- * This data structure defines the data for the apdu command.
- */
-typedef struct {
-       unsigned int apdu_len; /**<  SIM APDU length */
-       unsigned char apdu[TEL_SIM_APDU_LEN_MAX]; /**<  SIM APDU data */
-} TelSimApdu;
-
-/**
- * This data structure defines the data for the Response of sending apdu.
- */
-typedef struct {
-       unsigned int apdu_resp_len; /**< Response apdu data length */
-       unsigned char apdu_resp[TEL_SIM_APDU_RESP_LEN_MAX]; /**< Response apdu data */
-} TelSimApduResp;
-
-/**
- * This data structure defines the data for the Response of ATR request.
- */
-typedef struct {
-       unsigned int atr_len; /**<  SIM ATR data length */
-       unsigned char atr[TEL_SIM_ATR_LEN_MAX]; /**<  SIM ATR data */
-} TelSimAtr;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TEL_EVENT_SIM SIM Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief SIM status
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SIM_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SIM_STATUS
- *  @retval data \ref TelSimCardStatus
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SIM_STATUS                            TELEPHONY_SIM_INTERFACE":card_status"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
-#endif /* __TEL_SIM_H__ */
diff --git a/tel-headers/include/tel_sms.h b/tel-headers/include/tel_sms.h
deleted file mode 100644 (file)
index 18b93e0..0000000
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_SMS_H__
-#define __TEL_SMS_H__
-
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_SMS
-*  @{
-*
-*  @file tel_sms.h
-*  @brief TAPI sms Interface
-*/
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define TELEPHONY_SMS_INTERFACE         TELEPHONY_SERVICE".Sms"
-
-#define TEL_SMS_SCA_LEN_MAX            20      /**< Maximum length of SCA (in string format)*/
-
-#define TEL_SMS_CB_DATA_SIZE_MAX       88      /**< Maximum CB Message Size. Cell broadcast message data [Refer 3GPP TS 23.041 9.4.1] */
-#define TEL_SMS_ETWS_DATA_SIZE_MAX     1252 /**< Maximum ETWS Message Size */
-
-#define TEL_SMS_GSM_MSG_NUM_MAX                255     /**< Maximum GSM SMS message number*/
-#define TEL_SMS_GSM_CBMI_LIST_SIZE_MAX 50      /**< Maximum GSM SMS CBMI list size*/
-#define TEL_SMS_SMDATA_SIZE_MAX                164     /**< Maximum SMS data size that can be stored*/
-
-/**
- * @enum TelSmsMsgStatus
- * This enumeration defines the sms Response (Result) codes.
- */
-typedef enum {
-       TEL_SMS_STATUS_MT_READ, /**< MT message, stored and read */
-       TEL_SMS_STATUS_MT_UNREAD,       /**< MT message, stored and unread */
-       TEL_SMS_STATUS_MO_SENT, /**< MO message, stored and  sent */
-       TEL_SMS_STATUS_MO_NOT_SENT,     /**< MO message, stored but not sent */
-       TEL_SMS_STATUS_MO_DELIVERED, /**< delivered destination */
-       TEL_SMS_STATUS_MO_DELIVERY_NOT_CONFIRMED, /**< Service centre forwarded message but is unable to confirm delivery*/
-       TEL_SMS_STATUS_REPLACED /**< Message has been replaced*/
-} TelSmsMsgStatus;
-
-
-/**
-* @enum TelSmsCbMsgType
-* This enumeration defines the different CB message types.
-*/
-typedef enum {
-       TEL_SMS_CB_MSG_GSM,     /**< GSM Cell broadcast message */
-       TEL_SMS_CB_MSG_UMTS     /**< UMTSCell broadcast message */
-} TelSmsCbMsgType;
-
-/**
-* @enum TelSmsEtwsMsgType
-* This enumeration defines the different ETWS message types.
-*/
-typedef enum {
-       TEL_SMS_ETWS_PRIMARY,    /**< Primary ETWS message */
-       TEL_SMS_ETWS_SECONDARY_GSM,     /**< GSM Secondary ETWS message  */
-       TEL_SMS_ETWS_SECONDARY_UMTS     /**< UMTS Secondary ETWS message  */
-} TelSmsEtwsMsgType;
-
-/**
- * @enum TelSmsResult
- * This enum defines the different SMS error causes that come in the
- * sent status acknowledgement/notification after sending a message to the network
- */
-typedef enum {
-       TEL_SMS_RESULT_SUCCESS, /**< Operation completed successfully */
-       TEL_SMS_RESULT_FAILURE, /**< Operation Failed */
-       TEL_SMS_RESULT_INVALID_PARAMETER,       /**< Invalid input parameters */
-       TEL_SMS_RESULT_MEMORY_FAILURE,   /**< Memory allocation failed */
-       TEL_SMS_RESULT_OPERATION_NOT_SUPPORTED, /**< Operation not supported */
-       TEL_SMS_RESULT_UNKNOWN_FAILURE, /**< Unknown failure */
-
-       TEL_SMS_RESULT_INVALID_MANDATORY_INFO,  /**< Invalid format for some parameters passed in Data package information(TPDU)*/
-       TEL_SMS_RESULT_NETWORK_CONGESTION,      /**< SMS SIM operation cannot be performed due to Network Congestion */
-       TEL_SMS_RESULT_SIM_FAILURE,     /**< SMS SIM operation cannot be performed due to SIM failure */
-       TEL_SMS_RESULT_NETWORK_FAILURE, /**< SMS SIM operation cannot be performed due to Network failure */
-       TEL_SMS_RESULT_OPERATION_NOT_PERMITTED  /** Operation not permitted */
-} TelSmsResult;
-
-/**
- * This structure defines the properties of a dialing number
- * Type of Number, Numbering Plan Indicator and the actual number.
- */
-typedef struct {
-       unsigned char ton; /**< Type of number*/
-       unsigned char npi; /**<Numbering plan identification*/
-       char number[TEL_SMS_SCA_LEN_MAX + 1]; /**< Destination address */
-} TelSmsSca;
-
-/**
- * This structure defines the different parameters of  CB configuration
- */
-typedef struct {
-       unsigned short from_msg_id; /**< Starting point of the range of CBS message ID */
-       unsigned short to_msg_id; /**< Ending point of the range of CBS message ID */
-       gboolean selected;      /**< 0x00 . Not selected. 0x01 . Selected */
-} TelSmsCbMsgInfo3gpp;
-
-/**
- * This structure defines the different parameters of  CB configuration informations
- */
-typedef struct {
-       gboolean cb_enabled; /**< CB service state. If cb_enabled is true then cell broadcast service will be enabled and
-                                               * underlying modem will enable CB Channel to receiving CB messages. Otherwise CB service
-                                               * will be disabled, underlying modem will deactivate the CB channel. (enabled/disabled) */
-       unsigned int msg_id_range_cnt;  /**< Range of CB message ID count */
-       TelSmsCbMsgInfo3gpp msg_ids[TEL_SMS_GSM_CBMI_LIST_SIZE_MAX]; /**< Range of CB message ID information */
-} TelSmsCbConfigInfo;
-
-/**
- * This structure defines different fields involved in setting the parameters of
- * a particular sms in EFsmsp.
- */
-typedef struct {
-       unsigned int index; /**< Index */
-       TelSmsSca sca; /**< Service Centre Address info */
-       unsigned short vp; /**< Validity Period */
-} TelSmsParamsInfo;
-
-/**
- * This structure defines different fields involved in getting the sms parameters
- */
-typedef struct {
-       unsigned int count; /**< SMS parameter count */
-       TelSmsParamsInfo *params; /**< SMS parameter informations */
-} TelSmsParamsInfoList;
-
-/**
- * This structure defines the fields related to an Sms like SIM index, TPDU
- * and length.
- */
-typedef struct {
-       TelSmsSca sca; /**< Service Centre Address info */
-       unsigned int tpdu_length; /**< Size of array tpdu (which is actual TPDU message) */
-       unsigned char tpdu[TEL_SMS_SMDATA_SIZE_MAX]; /**< SMS TPDU message */
-} TelSmsDatapackageInfo;
-
-/**
- *This structure defines the data Related to MessageStatus and SMS Data Stored.
- */
-typedef struct {
-       TelSmsMsgStatus status; /**< Message status.*/
-       TelSmsDatapackageInfo data; /**<SMS message data*/
-} TelSmsSimDataInfo;
-
-/**
- *This structure defines the data Related to SMS Data to be send.
- */
-typedef struct {
-       gboolean more_msgs; /**< More messages to be send exist */
-       TelSmsDatapackageInfo send_data; /**<SMS message data*/
-} TelSmsSendInfo;
-
-/**
- *This structure defines the data Related to set message status
- */
-typedef struct {
-       unsigned int index; /**< Index where message status to be set */
-       TelSmsMsgStatus status; /**< Message status.*/
-} TelSmsStatusInfo;
-
-/**
- * @enum TelSmsDeliveryReport
- * This enum defines the error causes for delivery report
- */
-typedef enum {
-       TEL_SMS_DELIVERY_REPORT_SUCCESS,  /**<Message was sent successfully*/
-       TEL_SMS_DELIVERY_REPORT_MEMORY_ERROR,   /**< Memory capacity exceeded/memory full*/
-       TEL_SMS_DELIVERY_REPORT_UNSPECIFIED_ERROR       /**<Unspecified error */
-} TelSmsDeliveryReport;
-
-/**
- *This structure defines the SMS delivery report information
- */
-typedef struct {
-       TelSmsDeliveryReport report;    /**<Delivery report response types*/
-       TelSmsDatapackageInfo data;     /**<SMS data */
-} TelSmsDeliverReportInfo;
-
-/**
- * This structure defines the different parameters that are related to the message count
- * in a particular memory(Phone/SIM)
- */
-typedef struct {
-       unsigned int total_count;       /**< Total count of messages stored in SIM*/
-       unsigned int used_count;        /**< Stored message count in SIM in SIM*/
-       unsigned int index_list[TEL_SMS_GSM_MSG_NUM_MAX]; /**< Message index list stored in SIM. And the maximum
-                                                                                                          *size of this array can be of totalCount.This array contains the
-                                                                                                          *list of index values in which the messages are stored.
-                                                                                                          *i.e. index_list[totalcount] = [2,3] denotes that indexs
-                                                                                                          *2 and 3 are stored(valid) and others not(empty).
-                                                                                                          */
-} TelSmsStoredMsgCountInfo;
-
-/**
- * This structure defines a cell broadcast message.
- */
-typedef struct {
-       TelSmsCbMsgType cb_type;        /**< Cell Broadcast  message type */
-       unsigned int length;    /**<Length of cb_data (which is actual TPDU message) */
-       unsigned char *cb_data;  /**<Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1]*/
-} TelSmsCbMsgInfo;
-
-/**
- * This structure defines a ETWS message.
- */
-typedef struct {
-       TelSmsEtwsMsgType etws_type;    /**< Cell Broadcast  message type */
-       unsigned int length;    /**<Length of etws_data (which is actual TPDU message) */
-       unsigned char *etws_data;       /**<Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1]*/
-} TelSmsEtwsMsgInfo;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TEL_EVENT_SMS SMS Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief Incoming Message
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SMS_INCOM_MSG
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SMS_INCOM_MSG
- *  @retval data reference to \ref TelSmsDatapackageInfo structure
- *  @retval user_data user data passed while registering the event
- */
- #define TEL_NOTI_SMS_INCOM_MSG                        TELEPHONY_SMS_INTERFACE":IncomingMsg"
-
-/**
- *  @hideinitializer
- *  @brief Incoming CB Message
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SMS_CB_INCOM_MSG
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SMS_CB_INCOM_MSG
- *  @retval data reference to \ref TelSmsCbMsgInfo structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SMS_CB_INCOM_MSG                      TELEPHONY_SMS_INTERFACE":IncomingCbMsg"
-
-/**
- *  @hideinitializer
- *  @brief Incoming ETWS Message
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SMS_ETWS_INCOM_MSG
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SMS_ETWS_INCOM_MSG
- *  @retval data reference to \ref TelSmsEtwsMsgInfo structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SMS_ETWS_INCOM_MSG            TELEPHONY_SMS_INTERFACE":IncomingEtwsMsg"
-
-/**
- *  @hideinitializer
- *  @brief SIM memory status for SMS
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SMS_SIM_MEMORY_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SMS_SIM_MEMORY_STATUS
- *  @retval data <b>TRUE</b>: Memory available\n <b>FALSE</b>: Memory NOT available
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SMS_SIM_MEMORY_STATUS         TELEPHONY_SMS_INTERFACE":SimMemoryStatus"
-
-/**
- *  @hideinitializer
- *  @brief SMS init status
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SMS_INIT_STATUS
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SMS_INIT_STATUS
- *  @retval data <b>TRUE</b>: SMS is Initialized\n <b>FALSE</b>: SMS is NOT initialized
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SMS_INIT_STATUS                       TELEPHONY_SMS_INTERFACE":InitStatus"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
-
-#endif  /* __TEL_SMS_H__ */
diff --git a/tel-headers/include/tel_ss.h b/tel-headers/include/tel_ss.h
deleted file mode 100644 (file)
index e2fafb2..0000000
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * tel-headers
- *
- * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
- * Copyright (c) 2013 Intel Corporation. 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.
- */
-
-#ifndef __TEL_SS_H__
-#define __TEL_SS_H__
-
-#include <tel_if.h>
-
-/**
-*  @addtogroup TAPI_SS
-*  @{
-*
-*  @file tel_ss.h
-*  @brief TAPI Ss Interface
-*/
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define TELEPHONY_SS_INTERFACE TELEPHONY_SERVICE".Ss"
-
-/** Maximum Barring Password length */
-#define TEL_SS_BARRING_PASSWORD_LEN_MAX 4      /**<Maximum length of barring password */
-
-/** Maximum Call Forwarding Number length */
-#define TEL_SS_NUMBER_LEN_MAX 82       /**<Maximum Call Forwarding Number length */
-
- /**
- * @enum TelSsResult
- * This enumeration defines the ss Response (Result) codes
- */
- typedef enum {
-       TEL_SS_RESULT_SUCCESS,                                  /**< Operation completed successfully */
-       TEL_SS_RESULT_FAILURE,                                  /**< Operation failed */
-       TEL_SS_RESULT_INVALID_PARAMETER,                /**< Invalid input parameters */
-       TEL_SS_RESULT_MEMORY_FAILURE,                   /**< Memory allocation falied */
-       TEL_SS_RESULT_OPERATION_NOT_SUPPORTED,/**< Operation is not supported */
-       TEL_SS_RESULT_SERVICE_NOT_AVAILABLE,    /**< Service is not available */
-       TEL_SS_RESULT_OPERATION_NOT_ALLOWED,    /**< Operation is not allowed currently */
-       TEL_SS_RESULT_INCORRECT_OPERATION,              /**< Incorrect Operation */
-       TEL_SS_RESULT_INVALID_PASSWORD,                 /**< Password is invalid */
-       TEL_SS_RESULT_PASSWORD_BLOCKED,                 /**< Password blocked */
-       TEL_SS_RESULT_UNKONWN_ALPHABET,         /**< SS error indicating unknown SS data coding of alphabet */
-       TEL_SS_RESULT_OPERATION_NOT_PERMITTED   /**< Operation not permitted */
-} TelSsResult;
-
-/**
- * @enum TelSsClass
- * This enumeration defines the Ss Class Information.
- */
-typedef enum {
-       TEL_SS_CLASS_ALL_TELE_BEARER = 0,
-       /* TELESERVICE */
-       TEL_SS_CLASS_ALL_TELE = 10,                     /**< 0x10 : All Teleservices */
-       TEL_SS_CLASS_VOICE = 11,                                /**< 0x11 : All Voice ( telephony ) */
-       TEL_SS_CLASS_ALL_DATA_TELE = 12,                /**< 0x12 : All Data Teleservices */
-       TEL_SS_CLASS_FAX = 13,                                  /**< 0x13 : All Fax Service */
-       TEL_SS_CLASS_SMS = 16,                                  /**< 0x16 : SMS service  */
-       TEL_SS_CLASS_VGCS = 17,                         /**< 0x17 : Voice Group Call Service */
-       TEL_SS_CLASS_VBS = 18,                                  /**< 0x18 : Voice Broadcast */
-       TEL_SS_CLASS_ALL_TELE_EXPT_SMS = 19,    /**< 0x19 : All teleservice except SMS */
-
-       /* BEARER SERVICE */
-       TEL_SS_CLASS_ALL_BEARER = 20,                   /**< 0X20 : all bearer services */
-       TEL_SS_CLASS_ALL_ASYNC = 21,                    /**< 0x21 : All Async services */
-       TEL_SS_CLASS_ALL_SYNC = 22,                     /**< 0x21 : All Async services */
-       TEL_SS_CLASS_ALL_CS_SYNC = 24,          /**< 0x24 : All Circuit switched sync */
-       TEL_SS_CLASS_ALL_CS_ASYNC = 25,         /**< 0x25 : All Circuit switched async */
-       TEL_SS_CLASS_ALL_DEDI_PS = 26,          /**< 0x26 : All Dedicated packet Access */
-       TEL_SS_CLASS_ALL_DEDI_PAD = 27,         /**< 0x27 : All Dedicated PAD Access */
-       TEL_SS_CLASS_ALL_DATA_CDA = 28,         /**< 0x28 : All Data CDA*/
-
-       /* CPHS - AUXILIARY SERVICE */
-       TEL_SS_CLASS_AUX_VOICE = 89,                    /**< 0x89 : All Auxiliary Voice ( Auxiliary telephony ) */
-
-       TEL_SS_CLASS_ALL_GPRS_BEARER = 99,      /**< 0x99 : All GPRS bearer services */
-} TelSsClass;
-
-/**
- * @enum TelSsBarringType
- * This enumeration defines the Call Barring Types
- */
-typedef enum {
-       TEL_SS_CB_TYPE_BAOC, /**< All Outgoing calls */
-       TEL_SS_CB_TYPE_BOIC, /**< Outgoing international calls */
-       TEL_SS_CB_TYPE_BOIC_NOT_HC, /**< Outgoing international calls except
-                                       to Home Country */
-       TEL_SS_CB_TYPE_BAIC, /**< All Incoming Calls */
-       TEL_SS_CB_TYPE_BIC_ROAM, /**< Incoming Calls when roam */
-       TEL_SS_CB_TYPE_NS, /**< Incoming calls from numbers Not stored to SIM */
-       TEL_SS_CB_TYPE_AB,  /**< All barring services */
-       TEL_SS_CB_TYPE_AOB, /**< All outgoing barring services */
-       TEL_SS_CB_TYPE_AIB, /**< All incoming barring services */
-} TelSsBarringType;
-
-/**
- * @enum TelSsForwardCondition
- * This enumeration defines the Call Forwarding Condition
- */
-typedef enum {
-       TEL_SS_CF_COND_CFU, /**< Unconditional */
-       TEL_SS_CF_COND_CFB,  /**< Mobile Subscriber Busy */
-       TEL_SS_CF_COND_CFNRY, /**< No Reply */
-       TEL_SS_CF_COND_CFNRC, /**< Not Reachable */
-       TEL_SS_CF_COND_ALL,   /**< All */
-       TEL_SS_CF_COND_ALL_CFC, /**< All Conditional */
-} TelSsForwardCondition;
-
-/**
- * @enum TelSsForwardMode
- * This enumeration defines the Call Forwarding Mode
- */
-typedef enum {
-       TEL_SS_CF_MODE_DISABLE, /**< Deactivate call forwarding  */
-       TEL_SS_CF_MODE_ENABLE, /**< Activate call forwarding */
-       TEL_SS_CF_MODE_REGISTER, /**< Register Call forwarding  */
-       TEL_SS_CF_MODE_DEREGISTER, /**< De-register call forwarding */
-} TelSsForwardMode;
-
-/**
- * @enum TelSsClirNetworkStatus
- * This enumeration defines the Clir Network Status
- */
-typedef enum {
-       TEL_CLIR_STATUS_NOT_PROVISIONED, /**<Service not provided by the service provider */
-       TEL_CLIR_STATUS_PROVISIONED, /**<Service is provided by the service provider */
-       TEL_CLIR_STATUS_UNKNOWN, /**<Service status is unknown*/
-       TEL_CLIR_STATUS_TEMP_RESTRICTED, /**<Service is temporarily restricted */
-       TEL_CLIR_STATUS_TEMP_ALLOWED, /**<Service is temporarily allowed */
-} TelSsClirNetworkStatus;
-
-/**
- * @enum TelSsClirDeviceStatus
- * This enumeration defines the Clir Device Status
- * The device CLIR status overrides the CLIR subscription when temporary mode is provisioned
- */
-typedef enum {
-       TEL_CLIR_STATUS_DEFAULT,  /**< According to the subscription of CLIR */
-       TEL_CLIR_STATUS_INVOCATION, /**< CLI presentation is restricted */
-       TEL_CLIR_STATUS_SUPPRESSION, /**< CLI presentation is allowed */
-} TelSsClirDeviceStatus;
-
-/**
- * @enum TelSsCliNetworkStatus
- * This enumeration defines the Cli Network Status
- */
-typedef enum {
-       TEL_SS_CLI_NOT_PROVISIONED, /**<Service not provided by the service provider */
-       TEL_SS_CLI_PROVISIONED, /**<Service is provided by the service provider */
-       TEL_SS_CLI_UNKNOWN, /**<Service status is unknown*/
-} TelSsCliNetworkStatus;
-
-/**
- * @enum TelSsCliDeviceStatus
- * This enumeration defines the Cli Device Status
- */
-typedef enum {
-       TEL_SS_CLI_DISABLE, /**<CLI is disabled */
-       TEL_SS_CLI_ENABLE, /**<<CLI is enabled */
-} TelSsCliDeviceStatus;
-
-/**
- * @enum TelSsCliType
- * This enumeration defines the Cli Service Types
- */
-typedef enum {
-       TEL_SS_CLI_CLIP, /**< Calling Line Identification Presentation */
-       TEL_SS_CLI_CLIR, /**< Calling Line Identification Restriction */
-       TEL_SS_CLI_COLP, /**< Connected Line Identification Presentation */
-       TEL_SS_CLI_COLR, /**< Connected Line Identification Restriction */
-       TEL_SS_CLI_CDIP, /**< Called Line Identification Presentation */
-       TEL_SS_CLI_CNAP, /**< Calling Name Presentation */
-} TelSsCliType;
-
-/**
- * @enum TelSsUssdStatus
- * This enumeration defines the ussd Indication Type
- */
-typedef enum {
-       TEL_SS_USSD_STATUS_NO_ACTION_REQUIRED, /**< No further user action required */
-       TEL_SS_USSD_STATUS_ACTION_REQUIRED, /**< Further user action required*/
-       TEL_SS_USSD_STATUS_TERMINATED_BY_NETWORK, /**< USSD terminated by network */
-       TEL_SS_USSD_STATUS_OTHER_CLIENT, /**< Other local client has responded */
-       TEL_SS_USSD_STATUS_NOT_SUPPORTED, /**< Operation not supported */
-       TEL_SS_USSD_STATUS_TIME_OUT, /**< Time out when there is no response from network */
-} TelSsUssdStatus;
-
-/**
- * @enum TelSsUssdType
- * This enum defines the values for USSD type
- */
-typedef enum {
-       TEL_SS_USSD_TYPE_USER_INIT, /**< USSD request type User Initiated. */
-       TEL_SS_USSD_TYPE_USER_RSP, /**< USSD request type User Response. */
-       TEL_SS_USSD_TYPE_USER_REL, /**< USSD request type User Release. */
-} TelSsUssdType;
-
-/**
- *  This structure  defines the different parameters related to call barring.
- */
- typedef struct {
-       TelSsClass class; /**< SS class */
-       gboolean enable; /**< Barring enable/disable */
-       TelSsBarringType type; /**< Barring type */
-       char pwd[TEL_SS_BARRING_PASSWORD_LEN_MAX + 1]; /**< Barring password */
-} TelSsBarringInfo;
-
-/**
- *  This structure  defines the different parameters related to Call Barring Service Information to get Status.
- */
-typedef struct {
-       TelSsClass class; /**< SS class */
-       TelSsBarringType type; /**< Call barring types providing various barring conditions on that basis call be barred */
-} TelSsBarringGetInfo;
-
-/**
- * This structure defines the values for ss call barring record
- */
-typedef struct {
-       TelSsClass class; /**< SS class */
-       gboolean enable; /**< Barring enable/disable */
-       TelSsBarringType type; /**< Call barring types providing various barring conditions on that basis call be barred */
-} TelSsBarringInfoRecord;
-
-/**
- * This structure defines the values for ss Call Barring Service Response Information
- */
-typedef struct {
-       unsigned int record_num; /**< Number of Call barring record */
-       TelSsBarringInfoRecord *records; /**< Call barring records */
-} TelSsBarringResp;
-
-/**
- * This structure defines the values for ss Call Barring Password Change Information
- */
-typedef struct {
-       char old_pwd[TEL_SS_BARRING_PASSWORD_LEN_MAX + 1]; /**< Call barring password(old) */
-       char new_pwd[TEL_SS_BARRING_PASSWORD_LEN_MAX + 1]; /**< Call barring password(new) */
-} TelSsBarringPwdInfo;
-
-/**
- * This structure defines the values for ss Call Forwarding Service Setting Information
- */
-typedef struct {
-       TelSsClass class; /**< SS class */
-       TelSsForwardMode mode; /**< Call Forwarding Mode */
-       TelSsForwardCondition condition; /**< Call Forwarding Condition */
-       char number[TEL_SS_NUMBER_LEN_MAX + 1]; /**< Call Forwarding Number*/
-       unsigned int wait_time; /**< No reply wait time 1-30 secs */
-} TelSsForwardInfo;
-
-/**
- * This structure defines the values for ss Call Forwarding Service Information to get Forwarding Status
- */
-typedef struct {
-       TelSsClass class; /**< SS class */
-       TelSsForwardCondition condition; /**< Call Forwarding Condition */
-} TelSsForwardGetInfo;
-
-/**
- * This structure defines the values for ss Call Forwarding Service Information to set Forwarding
- */
-typedef struct {
-       TelSsClass class; /**< SS class */
-       gboolean enable; /**< Call Forwarding enable/disable */
-       TelSsForwardCondition condition; /**< Call Forwarding Condition */
-       char number[TEL_SS_NUMBER_LEN_MAX + 1]; /**< Call forwarding number */
-       unsigned int wait_time; /**< Only be available when "no reply" is enabled
-                                       or queried, range: 1 - 30 */
-} TelSsForwardingInfoRecord;
-
-/**
- * This structure defines the values for ss Call Forwarding Service Response data
- */
-typedef struct {
-       unsigned int record_num; /**< Number of Call Forwarding record */
-       TelSsForwardingInfoRecord *records; /**< Call Forwarding records */
-} TelSsForwardingResp;
-
-/**
- * This structure defines the values for ss Call Waiting Service Setting Information
- */
-typedef struct {
-       TelSsClass class; /**< SS class */
-       gboolean enable; /**< Call waiting enable/disable */
-} TelSsWaitingInfo;
-
-/**
- * This structure defines the values for ss Call Waiting Service Response data
- */
-typedef struct {
-       unsigned int record_num; /**< Number of Call waiting record */
-       TelSsWaitingInfo *records; /**< Call waiting records */
-} TelSsWaitingResp;
-
-/**
- * This structure defines the values for ss CLIR status Information
- */
-typedef struct {
-       TelSsClirNetworkStatus net_status; /**< CLIR status (network side) */
-       TelSsClirDeviceStatus dev_status;  /**< CLIR status (device side) */
-} TelSsClirStatus;
-
-/**
- * This structure defines the values for ss CLI status Information
- */
-typedef struct {
-       TelSsCliNetworkStatus net_status; /**< CLI status (network side) */
-       TelSsCliDeviceStatus dev_status;  /**< CLI status (device side) */
-} TelSsCliStatus;
-
-/**
- * This structure defines the values for ss CLI Service Response data
- */
-typedef struct {
-       TelSsCliType type; /**< line identification service types */
-       union {
-               TelSsClirStatus clir; /**< CLIR status */
-               TelSsCliStatus clip; /**< CLIP status */
-               TelSsCliStatus colp; /**< COLP status */
-               TelSsCliStatus colr; /**< COLR status */
-               TelSsCliStatus cdip; /**< CDIP status */
-               TelSsCliStatus cnap; /**< CNAP status */
-       } status; /**< union */
-} TelSsCliResp;
-
-/**
- * This structure defines the values for ss CLI Service(include CLIR) Setting Information
- */
-typedef struct {
-       TelSsCliType type; /**< line identification service types */
-       union {
-               TelSsClirDeviceStatus clir; /**< CLIR status */
-               TelSsCliDeviceStatus clip; /**< CLIP status */
-               TelSsCliDeviceStatus colp; /**< COLP status */
-               TelSsCliDeviceStatus colr; /**< COLR status */
-               TelSsCliDeviceStatus cdip; /**< CDIP status */
-               TelSsCliDeviceStatus cnap; /**< CNAP status */
-       } status; /**< union */
-} TelSsCliInfo;
-
-/**
- * This structure defines the values for ss USSD Request Information
- */
-typedef struct {
-       TelSsUssdType type; /**< USSD type */
-       unsigned char *str; /**< NULL terminated UTF-8 USSD string */
-} TelSsUssdInfo;
-
-/**
- * This structure defines the values for ss USSD Response data
- */
-typedef struct {
-       TelSsUssdType type; /**< USSD type */
-       TelSsUssdStatus status; /**< USSD status */
-       unsigned char *str; /**< NULL terminated UTF-8 USSD string */
-} TelSsUssdResp;
-
-/**
- * This structure defines the values for ss USSD Notification data
- */
-typedef struct {
-       TelSsUssdStatus status; /**< USSD status */
-       unsigned char *str; /**< NULL terminated UTF-8 USSD string */
-} TelSsUssdNoti;
-
-/**
- *  \defgroup TAPI_EVENT TAPI Event IDs
- *  @{
- */
-
-/**
- *  \defgroup TEL_EVENT_SS SS Event IDs
- *  @{
- */
-
-/**
- *  @hideinitializer
- *  @brief USSD status and string
- *  @section subscription Event Subscription
- *  @details Event can be subscribed with event id TEL_NOTI_SS_USSD
- *  @sa tapi_register_event_id
- *  @section handling Event Handling
- *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
- *  @retval handle #TelHandle used for registering the event
- *  @retval evt_id TEL_NOTI_SS_USSD
- *  @retval data reference to \ref TelSsUssdNoti structure
- *  @retval user_data user data passed while registering the event
- */
-#define TEL_NOTI_SS_USSD                               TELEPHONY_SS_INTERFACE":NotifyUssd"
-
-/** @}*/
-/** @}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
-
-#endif /* __TEL_SS_H__ */
diff --git a/tel-headers/introspection/call.xml b/tel-headers/introspection/call.xml
deleted file mode 100644 (file)
index 5c2cbef..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-  <interface name="org.tizen.telephony.Call">
-
-    <!-- Refer to TAPI API: tapi_call_dial -->
-    <method name="Dial">
-      <arg direction="in" type="i" name="call_type"/>
-      <arg direction="in" type="i" name="ecc"/>
-      <arg direction="in" type="s" name="number"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_answer -->
-    <method name="Answer">
-      <arg direction="in" type="i" name="answer_type"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_end-->
-    <method name="End">
-      <arg direction="in" type="u" name="call_id"/>
-      <arg direction="in" type="i" name="end_type"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_send_dtmf -->
-    <method name="SendDtmf">
-      <arg direction="in" type="s" name="dtmf_str"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_hold -->
-    <method name="Hold">
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_active -->
-    <method name="Active">
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_swap -->
-    <method name="Swap">
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_join -->
-    <method name="Join">
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_split -->
-    <method name="Split">
-      <arg direction="in" type="u" name="call_id"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_transfer -->
-    <method name="Transfer">
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_deflect -->
-    <method name="Deflect">
-      <arg direction="in" type="s" name="deflect_to"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-     <!-- Refer to TAPI API: tapi_call_set_active_line -->
-    <method name="SetActiveLine">
-      <arg direction="in" type="i" name="active_line"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_get_active_line -->
-    <method name="GetActiveLine">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="i" name="active_line"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_get_status -->
-    <method name="GetStatus">
-      <arg direction="in" type="u" name="call_id"/>
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="call_id"/>
-      <arg direction="out" type="i" name="call_type"/>
-      <arg direction="out" type="i" name="call_state"/>
-      <arg direction="out" type="b" name="mo_call"/>
-      <arg direction="out" type="b" name="mpty"/>
-      <arg direction="out" type="i" name="cli_validity"/>
-      <arg direction="out" type="s" name="number"/>
-      <arg direction="out" type="i" name="cni_validity"/>
-      <arg direction="out" type="s" name="name"/>
-      <arg direction="out" type="b" name="forward"/>
-      <arg direction="out" type="i" name="active_line"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_get_status_all -->
-    <method name="GetStatusAll">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="count"/>
-      <arg direction="out" type="aa{sv}" name="status_list"/>
-    </method>
-
-    <!-- Refer to TAPI API: -->
-    <method name="SetVolumeInfo">
-      <arg direction="in" type="i" name="device"/>
-      <arg direction="in" type="u" name="volume"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_get_volume_info -->
-    <method name="GetVolumeInfo">
-      <arg direction="in" type="i" name="sound_device"/>
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="volume_info"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_set_sound_path -->
-    <method name="SetSoundPath">
-      <arg direction="in" type="i" name="path"/>
-      <arg direction="in" type="b" name="ex_volume"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_set_mute_status -->
-    <method name="SetMute">
-       <arg direction="in" type="b" name="mute"/>
-       <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_get_mute_status -->
-    <method name="GetMuteStatus">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="b" name="mute"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_set_sound_recording -->
-    <method name="SetSoundRecording">
-      <arg direction="in" type="i" name="sound_rec"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_call_set_sound_equalization -->
-    <method name="SetSoundEqualization">
-      <arg direction="in" type="i" name="mode"/>
-      <arg direction="in" type="i" name="direction"/>
-      <arg direction="in" type="aq" name="parameter"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TEL_NOTI_VOICE_CALL_STATUS_IDLE -->
-    <signal name="VoiceCallStatusIdle">
-      <arg type="u" name="call_id"/>
-      <arg type="i" name="cause"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VOICE_CALL_STATUS_ACTIVE -->
-    <signal name="VoiceCallStatusActive">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VOICE_CALL_STATUS_HELD -->
-    <signal name="VoiceCallStatusHeld">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VOICE_CALL_STATUS_DIALING -->
-    <signal name="VoiceCallStatusDialing">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VOICE_CALL_STATUS_ALERT -->
-    <signal name="VoiceCallStatusAlert">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VOICE_CALL_STATUS_INCOMING -->
-    <signal name="VoiceCallStatusIncoming">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VIDEO_CALL_STATUS_IDLE -->
-    <signal name="VideoCallStatusIdle">
-      <arg type="u" name="call_id"/>
-      <arg type="i" name="end_cause"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VIDEO_CALL_STATUS_ACTIVE -->
-    <signal name="VideoCallStatusActive">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VIDEO_CALL_STATUS_DIALING -->
-    <signal name="VideoCallStatusDialing">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VIDEO_CALL_STATUS_ALERT -->
-    <signal name="VideoCallStatusAlert">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_VIDEO_CALL_STATUS_INCOMING -->
-    <signal name="VideoCallStatusIncoming">
-      <arg type="u" name="call_id"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MO_WAITING -->
-    <signal name="MoWaiting">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MO_FORWARDED -->
-    <signal name="MoForwarded">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MO_BARRED_INCOMING -->
-    <signal name="MoBarredIncoming">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MO_BARRED_OUTGOING -->
-    <signal name="MoBarredOutgoing">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MO_FORWARD_UNCONDITIONAL -->
-    <signal name="MoForwardUnconditional">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MO_FORWARD_CONDITIONAL -->
-    <signal name="MoForwardConditional">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MO_DEFLECTED -->
-    <signal name="MoDeflected">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_TRANSFERED -->
-    <signal name="Transfered">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MT_FORWARDED -->
-    <signal name="MtForwarded">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_MT_DEFLECTED -->
-    <signal name="MtDeflected">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_HELD -->
-    <signal name="CallHeld">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_ACTIVE -->
-    <signal name="CallActive">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_INFO_JOINED -->
-    <signal name="CallJoined">
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_SOUND_RINGBACK_TONE -->
-    <signal name="CallSoundRingbackTone">
-      <arg type="i" name="status"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_SOUND_WBAMR -->
-    <signal name="CallSoundWbamr">
-      <arg type="i" name="status"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_SOUND_EQUALIZATION -->
-    <signal name="CallSoundEqualization">
-      <arg type="i" name="mode"/>
-      <arg type="i" name="direction"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_CALL_SOUND_CLOCK_STATUS -->
-    <signal name="CallSoundClockStatus">
-       <arg type="b" name="status"/>
-    </signal>
-
-    </interface>
-</node>
diff --git a/tel-headers/introspection/gen.sh b/tel-headers/introspection/gen.sh
deleted file mode 100755 (executable)
index 86fde51..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-gdbus-codegen --interface-prefix org.tizen.telephony. \
-       --generate-c-code generated-code                        \
-       --c-namespace Telephony                       \
-       --c-generate-object-manager                 \
-       --generate-docbook generated-docs                       \
-       manager.xml network.xml sim.xml phonebook.xml sat.xml sap.xml gps.xml call.xml ss.xml modem.xml sms.xml
diff --git a/tel-headers/introspection/gps.xml b/tel-headers/introspection/gps.xml
deleted file mode 100644 (file)
index 54523e5..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-  <interface name="org.tizen.telephony.Gps">
-
-    <!-- Refer to TAPI API: tapi_gps_confirm_measure_pos() -->
-    <method name="ConfirmMeasurePos">
-      <arg direction="in" type="s" name="data"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_gps_set_frequency_aiding() -->
-    <method name="SetFrequencyAiding">
-      <arg direction="in" type="b" name="state"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TEL_NOTI_GPS_ASSIST_DATA event -->
-    <signal name="AssistData">
-      <arg type="s" name="data"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_GPS_MEASURE_POSITION event -->
-    <signal name="MeasurePosition">
-      <arg type="s" name="data"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_GPS_RESET_ASSIST_DATA event -->
-    <signal name="ResetAssistData">
-    </signal>
-
-  </interface>
-</node>
diff --git a/tel-headers/introspection/manager.xml b/tel-headers/introspection/manager.xml
deleted file mode 100644 (file)
index 867b994..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-
-    <!-- Refer to TAPI API: tel_get_cp_name_list() -->
-    <interface name="org.tizen.telephony.Manager">
-        <method name="GetModems">
-            <arg direction="out" type="as" name="modem_list"/>
-        </method>
-    </interface>
-
-</node>
diff --git a/tel-headers/introspection/modem.xml b/tel-headers/introspection/modem.xml
deleted file mode 100644 (file)
index 16acfe9..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-  <interface name="org.tizen.telephony.Modem">
-
-    <!-- Refer to TAPI API: tapi_modem_set_power_status() -->
-    <method name="SetPowerStatus">
-      <arg direction="in" type="i" name="status"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_modem_set_flight_mode() -->
-    <method name="SetFlightMode">
-      <arg direction="in" type="b" name="enable"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_modem_get_flight_mode() -->
-    <method name="GetFlightMode">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="b" name="enable"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_modem_get_version() -->
-      <method name="GetVersion">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="s" name="software_version"/>
-      <arg direction="out" type="s" name="hardware_version"/>
-      <arg direction="out" type="s" name="calibration_date"/>
-      <arg direction="out" type="s" name="product_code"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_modem_get_imei() -->
-    <method name="GetImei">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="s" name="imei"/>
-    </method>
-
-    <!-- Caches power status -->
-    <property name="status" type="i" access="read"/>
-
-    <!-- Caches flight mode status -->
-    <property name="flight_mode_status" type="i" access="read"/>
-
-    <!-- Caches IMEI value -->
-    <property name="imei" type="s" access="read"/>
-
-    <!--
-         Version information
-         @version: software_version, hardware_version, calibration_date, product_code
-    -->
-    <property name="version" type="a{sv}" access="read"/>
-
-  </interface>
-</node>
diff --git a/tel-headers/introspection/network.xml b/tel-headers/introspection/network.xml
deleted file mode 100644 (file)
index edadd29..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-
-  <interface name="org.tizen.telephony.Network">
-
-    <!-- Refer to TAPI API: tapi_network_get_identity_info()-->
-    <method name="GetIdentityInfo">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="s" name="plmn"/>
-      <arg direction="out" type="s" name="short_name"/>
-      <arg direction="out" type="s" name="long_name"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_search()-->
-    <method name="Search">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="count"/>
-      <arg direction="out" type="aa{sv}" name="network_list"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_cancel_search()-->
-    <method name="CancelSearch">
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_select_automatic() -->
-    <method name="SelectAutomatic">
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API:tapi_network_select_manual() -->
-    <method name="SelectManual">
-      <arg direction="in" type="s" name="plmn"/>
-      <arg direction="in" type="i" name="act"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_get_selection_mode() -->
-    <method name="GetSelectionMode">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="i" name="selection_mode"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_set_preferred_plmn() -->
-    <method name="SetPreferredPlmn">
-      <arg direction="in" type="u" name="index"/>
-      <arg direction="in" type="s" name="plmn"/>
-      <arg direction="in" type="i" name="act"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_get_preferred_plmn()-->
-    <method name="GetPreferredPlmn">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="count"/>
-      <arg direction="out" type="aa{sv}" name="list"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_set_mode()-->
-    <method name="SetMode">
-      <arg direction="in" type="i" name="mode"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_get_mode()-->
-    <method name="GetMode">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="i" name="mode"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_network_get_neighboring_cell_info()-->
-    <method name="GetNgbrCellInfo">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="gsm_list_count"/>
-      <arg direction="out" type="aa{sv}" name="gsm_list"/>
-      <arg direction="out" type="u" name="umts_list_count"/>
-      <arg direction="out" type="aa{sv}" name="umts_list"/>
-    </method>
-
-    <!-- Refer to TEL_NOTI_NETWORK_REGISTRATION_STATUS -->
-    <signal name="RegistrationStatus">
-      <arg type="i" name="cs_status"/>
-      <arg type="i" name="ps_status"/>
-      <arg type="i" name="act"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_NETWORK_CELL_INFO -->
-    <signal name="CellInfo">
-      <arg type="u" name="lac"/>
-      <arg type="u" name="cell_id"/>
-      <arg type="u" name="rac"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_NETWORK_IDENTITY -->
-    <signal name="Identity">
-      <arg type="s" name="plmn"/>
-      <arg type="s" name="short_name"/>
-      <arg type="s" name="long_name"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_NETWORK_RSSI -->
-    <signal name="Rssi">
-      <arg type="u" name="rssi"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_NETWORK_TIME_INFO -->
-    <signal name="TimeInfo">
-      <arg type="u" name="year"/>
-      <arg type="u" name="month"/>
-      <arg type="u" name="day"/>
-      <arg type="u" name="hour"/>
-      <arg type="u" name="minute"/>
-      <arg type="u" name="second"/>
-      <arg type="i" name="gmtoff"/>
-      <arg type="b" name="isdst"/>
-      <arg type="i" name="dstoff"/>
-      <arg type="s" name="plmn"/>
-    </signal>
-
-     <!-- Caches rssi -->
-    <property name="rssi" type="u" access="read"/>
-
-    <!-- Caches lac  -->
-    <property name="lac" type="u" access="read"/>
-
-    <!-- Caches cell_id  -->
-    <property name="cell_id" type="u" access="read"/>
-
-    <!-- Caches rac  -->
-    <property name="rac" type="u" access="read"/>
-
-    <!-- Caches act -->
-    <property name="act" type="i" access="read"/>
-
-    <!-- Caches circuit_status  -->
-    <property name="cs_status" type="i" access="read"/>
-
-    <!-- Caches packet_status  -->
-    <property name="ps_status" type="i" access="read"/>
-
-  </interface>
-
-</node>
diff --git a/tel-headers/introspection/phonebook.xml b/tel-headers/introspection/phonebook.xml
deleted file mode 100644 (file)
index c3da7f1..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-
-    <interface name="org.tizen.telephony.Phonebook">
-        <!-- Refer to TAPI API: tapi_pb_get_sim_pb_init_info () -->
-        <method name="GetInitInfo">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="b" name="init_completed"/>
-            <arg direction="out" type="b" name="fdn"/>
-            <arg direction="out" type="b" name="adn"/>
-            <arg direction="out" type="b" name="sdn"/>
-            <arg direction="out" type="b" name="usim"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_pb_get_sim_pb_info() -->
-        <method name="GetInfo">
-            <arg direction="in" type="i" name="pb_type"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="pb_type"/>
-            <arg direction="out" type="a{sv}" name="info_u"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_pb_read_sim_pb_record() -->
-        <method name="ReadRecord">
-            <arg direction="in" type="i" name="pb_type"/>
-            <arg direction="in" type="u" name="index"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="u" name="index"/>
-            <arg direction="out" type="u" name="next_index"/>
-            <arg direction="out" type="i" name="pb_type"/>
-            <arg direction="out" type="a{sv}" name="rec_u"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_pb_update_sim_pb_record() -->
-        <method name="UpdateRecord">
-            <arg direction="in" type="i" name="pb_type"/>
-            <arg direction="in" type="u" name="index"/>
-            <arg direction="in" type="a{sv}" name="rec_u"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_pb_delete_sim_pb_record() -->
-        <method name="DeleteRecord">
-            <arg direction="in" type="i" name="pb_type"/>
-            <arg direction="in" type="u" name="index"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TEL_NOTI_PB_STATUS event -->
-        <signal name="Status">
-            <arg type="b" name="init_status"/>
-            <arg type="b" name="fdn"/>
-            <arg type="b" name="adn"/>
-            <arg type="b" name="sdn"/>
-            <arg type="b" name="usim"/>
-        </signal>
-
-    </interface>
-
-</node>
diff --git a/tel-headers/introspection/sap.xml b/tel-headers/introspection/sap.xml
deleted file mode 100644 (file)
index 36f0b01..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-
-       <interface name="org.tizen.telephony.Sap">
-
-               <!-- Refer to TAPI API: tapi_sap_req_connect() -->
-               <method name="ReqConnect">
-                       <arg direction="in" type="u" name="max_msg_size"/>
-                       <arg direction="out" type="i" name="result"/>
-                       <arg direction="out" type="u" name="max_msg_size_resp"/>
-               </method>
-
-               <!-- Refer to TAPI API: tapi_sap_req_disconnect() -->
-               <method name="ReqDisconnect">
-                       <arg direction="out" type="i" name="result"/>
-               </method>
-
-               <!-- Refer to TAPI API: tapi_sap_get_atr() -->
-               <method name="GetAtr">
-                       <arg direction="out" type="i" name="result"/>
-                       <arg direction="out" type="s" name="atr"/>
-               </method>
-
-               <!-- Refer to TAPI API: tapi_sap_req_transfer_apdu() -->
-               <method name="ReqTransferApdu">
-                       <arg direction="in" type="s" name="apdu"/>
-                       <arg direction="out" type="i" name="result"/>
-                       <arg direction="out" type="s" name="apdu_resp"/>
-               </method>
-
-               <!-- Refer to TAPI API: tapi_sap_req_transport_protocol() -->
-               <method name="ReqTransportProtocol">
-                       <arg direction="in" type="i" name="protocol"/>
-                       <arg direction="out" type="i" name="result"/>
-               </method>
-
-               <!-- Refer to TAPI API: tapi_sap_req_power_operation() -->
-               <method name="ReqPowerOperation">
-                       <arg direction="in" type="i" name="power_mode"/>
-                       <arg direction="out" type="i" name="result"/>
-               </method>
-
-               <!-- Refer to TAPI API: tapi_sap_get_cardreader_status() -->
-               <method name="GetCardReaderStatus">
-                       <arg direction="out" type="i" name="result"/>
-                       <arg direction="out" type="i" name="status"/>
-               </method>
-
-               <signal name="Status">
-                       <arg type="i" name="status"/>
-               </signal>
-
-       </interface>
-
-</node>
diff --git a/tel-headers/introspection/sat.xml b/tel-headers/introspection/sat.xml
deleted file mode 100644 (file)
index 0515c1e..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-<node>
-       <!--
-               org.tizen.telephony.Sat:
-               @short_description: Tizen Telephony SIM Application Toolkit interface
-
-               SAT interface.
-
-       -->
-       <interface name="org.tizen.telephony.Sat">
-
-               <method name="GetMainMenuInfo">
-                       <arg direction="out" type="i" name="result"/>
-                       <arg direction="out" type="i" name="command_id"/>
-                       <arg direction="out" type="b" name="menu_present"/>
-                       <arg direction="out" type="s" name="main_title"/>
-                       <arg direction="out" type="v" name="menu_item"/>
-                       <arg direction="out" type="i" name="menu_count"/>
-                       <arg direction="out" type="b" name="menu_help_info"/>
-                       <arg direction="out" type="b" name="menu_updated"/>
-               </method>
-
-               <method name="SendUiDisplayStatus">
-                       <arg direction="in" type="i" name="command_id"/>
-                       <arg direction="in" type="b" name="display_status"/>
-                       <arg direction="out" type="i" name="result"/>
-               </method>
-
-               <method name="SendUserConfirm">
-                       <arg direction="in" type="i" name="command_id"/>
-                       <arg direction="in" type="i" name="command_type"/>
-                       <arg direction="in" type="i" name="user_confirm_type"/>
-                       <arg direction="in" type="v" name="additional_data"/>
-                       <arg direction="out" type="i" name="result"/>
-               </method>
-
-               <method name="SelectMenu">
-                       <arg direction="in" type="i" name="item_identifier"/>
-                       <arg direction="in" type="b" name="help_request"/>
-                       <arg direction="out" type="i" name="result"/>
-                       <arg direction="out" type="i" name="envelop_rsp"/>
-               </method>
-
-               <method name="DownloadEvent">
-                       <arg direction="in" type="i" name="event_download_type"/>
-                       <arg direction="in" type="i" name="src_device"/>
-                       <arg direction="in" type="i" name="dest_device"/>
-                       <arg direction="in" type="v" name="download_data"/>
-                       <arg direction="out" type="i" name="result"/>
-                       <arg direction="out" type="i" name="envelop_rsp"/>
-               </method>
-
-               <method name="SendAppExecResult">
-                       <arg direction="in" type="i" name="command_id"/>
-                       <arg direction="in" type="i" name="command_type"/>
-                       <arg direction="in" type="v" name="exec_result"/>
-                       <arg direction="out" type="i" name="result"/>
-               </method>
-
-               <signal name="SetupMenu">
-                       <arg type="i" name="command_id"/>
-                       <arg type="b" name="menu_present"/>
-                       <arg type="s" name="main_title"/>
-                       <arg type="v" name="menu_item"/>
-                       <arg type="i" name="menu_count"/>
-                       <arg type="b" name="menu_help_info"/>
-                       <arg type="b" name="menu_updated"/>
-               </signal>
-
-               <signal name="DisplayText">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="duration"/>
-                       <arg type="b" name="priority_high"/>
-                       <arg type="b" name="user_rsp_required"/>
-                       <arg type="b" name="immediately_rsp"/>
-               </signal>
-
-               <signal name="SelectItem">
-                       <arg type="i" name="command_id"/>
-                       <arg type="b" name="help_info"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="default_item_index"/>
-                       <arg type="i" name="menu_count"/>
-                       <arg type="v" name="menu_item"/>
-               </signal>
-
-               <signal name="GetInkey">
-                       <arg type="i" name="command_id"/>
-                       <arg type="i" name="key_type"/>
-                       <arg type="i" name="input_alphabet_type"/>
-                       <arg type="b" name="numeric"/>
-                       <arg type="b" name="help_info"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="duration"/>
-               </signal>
-
-               <signal name="GetInput">
-                       <arg type="i" name="command_id"/>
-                       <arg type="i" name="input_alphabet_type"/>
-                       <arg type="b" name="numeric"/>
-                       <arg type="b" name="help_info"/>
-                       <arg type="b" name="echo_input"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="response_len_max"/>
-                       <arg type="i" name="response_len_min"/>
-                       <arg type="s" name="default_text"/>
-                       <arg type="i" name="default_text_len"/>
-               </signal>
-
-               <signal name="PlayTone">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="tone_type"/>
-                       <arg type="i" name="duration"/>
-               </signal>
-
-               <signal name="SendSMS">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="b" name="packing_required"/>
-                       <arg type="i" name="ton"/>
-                       <arg type="i" name="npi"/>
-                       <arg type="s" name="dialling_number"/>
-                       <arg type="i" name="number_len"/>
-                       <arg type="i" name="tpdu_type"/>
-                       <arg type="v" name="tpdu_data"/>
-                       <arg type="i" name="tpdu_data_len"/>
-               </signal>
-
-               <signal name="SendSS">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="ton"/>
-                       <arg type="i" name="npi"/>
-                       <arg type="s" name="ss_string"/>
-               </signal>
-
-               <signal name="SetupUSSD">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="s" name="ussd_string"/>
-               </signal>
-
-               <signal name="SetupCall">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="confirm_text"/>
-                       <arg type="i" name="confirm_text_len"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="call_type"/>
-                       <arg type="s" name="call_number"/>
-                       <arg type="i" name="duration"/>
-               </signal>
-
-               <signal name="SetupEventList">
-                       <arg type="i" name="event_cnt"/>
-                       <arg type="v" name="evt_list"/>
-               </signal>
-
-               <signal name="SetupIdleModeText">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-               </signal>
-
-               <signal name="OpenChannel">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="b" name="immediate_link"/>
-                       <arg type="b" name="auto_reconnection"/>
-                       <arg type="b" name="bg_mode"/>
-                       <arg type="i" name="bearer_type"/>
-                       <arg type="v" name="bearer_param"/>
-                       <arg type="i" name="buffer_size"/>
-                       <arg type="i" name="protocol_type"/>
-                       <arg type="i" name="port_number"/>
-                       <arg type="i" name="data_dest_address_type"/>
-                       <arg type="s" name="data_dest_address"/>
-                       <arg type="v" name="bearer_detail"/>
-               </signal>
-
-               <signal name="CloseChannel">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="channel_id"/>
-               </signal>
-
-               <signal name="ReceiveData">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="channel_id"/>
-                       <arg type="i" name="data_len"/>
-               </signal>
-
-               <signal name="SendData">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="i" name="channel_id"/>
-                       <arg type="b" name="send_data_immediately"/>
-                       <arg type="v" name="channel_data"/>
-                       <arg type="i" name="channel_data_len"/>
-               </signal>
-
-               <signal name="GetChannelStatus">
-                       <arg type="i" name="command_id"/>
-               </signal>
-
-               <signal name="Refresh">
-                       <arg type="i" name="command_id"/>
-                       <arg type="i" name="refresh_type"/>
-                       <arg type="v" name="file_list"/>
-               </signal>
-
-               <signal name="MoreTime">
-               </signal>
-
-               <signal name="SendDtmf">
-                       <arg type="i" name="command_id"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-                       <arg type="s" name="dtmf_str"/>
-                       <arg type="i" name="dtmf_str_len"/>
-               </signal>
-
-               <signal name="LaunchBrowser">
-                       <arg type="i" name="command_id"/>
-                       <arg type="i" name="launch_type"/>
-                       <arg type="i" name="browser_id"/>
-                       <arg type="s" name="url"/>
-                       <arg type="i" name="url_len"/>
-                       <arg type="s" name="gateway_proxy"/>
-                       <arg type="i" name="gateway_proxy_len"/>
-                       <arg type="s" name="text"/>
-                       <arg type="i" name="text_len"/>
-               </signal>
-
-               <signal name="ProvideLocalInfo">
-                       <arg type="i" name="info_type"/>
-               </signal>
-
-               <signal name="LanguageNotification">
-                       <arg type="i" name="command_id"/>
-                       <arg type="i" name="language"/>
-                       <arg type="b" name="b_specified"/>
-               </signal>
-
-               <signal name="EndProactiveSession">
-                       <arg type="i" name="command_type"/>
-               </signal>
-
-       </interface>
-
-</node>
diff --git a/tel-headers/introspection/sim.xml b/tel-headers/introspection/sim.xml
deleted file mode 100644 (file)
index 6cfa0eb..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-
-    <interface name="org.tizen.telephony.Sim">
-        <!-- Refer to TAPI API: tapi_sim_get_imsi () -->
-        <method name="GetImsi">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="s" name="mcc"/>
-            <arg direction="out" type="s" name="mnc"/>
-            <arg direction="out" type="s" name="msin"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_ecc () -->
-        <method name="GetEcc">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="u" name="count"/>
-            <arg direction="out" type="aa{sv}" name="ecc_list"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_iccid () -->
-        <method name="GetIccid">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="s" name="iccid"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_language () -->
-        <method name="GetLanguage">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="language"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_set_language () -->
-        <method name="SetLanguage">
-            <arg direction="in" type="i" name="language"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_callforwarding_info () -->
-        <method name="GetCallForwardingInfo">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="u" name="profile_count"/>
-            <arg direction="out" type="aa{sv}" name="cf"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_messagewaiting_info () -->
-        <method name="GetMessageWaitingInfo">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="u" name="profile_count"/>
-            <arg direction="out" type="aa{sv}" name="mw"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_set_messagewaiting_info () -->
-        <method name="SetMessageWaitingInfo">
-            <arg direction="in" type="y" name="profile_id"/>
-            <arg direction="in" type="b" name="count_valid"/>
-            <arg direction="in" type="a(by)" name="msg_waiting"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_mailbox_info () -->
-        <method name="GetMailboxInfo">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="u" name="alpha_id_max_len"/>
-            <arg direction="out" type="u" name="count"/>
-            <arg direction="out" type="aa{sv}" name="list"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_set_mailbox_info () -->
-        <method name="SetMailboxInfo">
-            <arg direction="in" type="y" name="profile_id"/>
-            <arg direction="in" type="i" name="mb_type"/>
-            <arg direction="in" type="u" name="alpha_id_len"/>
-            <arg direction="in" type="s" name="alpha_id"/>
-            <arg direction="in" type="s" name="number"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_msisdn () -->
-        <method name="GetMsisdn">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="u" name="count"/>
-            <arg direction="out" type="aa{sv}" name="list"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_spn () -->
-        <method name="GetSpn">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="display_condition"/>
-            <arg direction="out" type="s" name="spn"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_cphs_netname () -->
-        <method name="GetCphsNetName">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="s" name="full_name"/>
-            <arg direction="out" type="s" name="short_name"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_sp_display_info() -->
-        <method name="GetSpDisplayInfo">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="u" name="count"/>
-            <arg direction="out" type="aa{sv}" name="list"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_req_authentication () -->
-        <method name="ReqAuthentication">
-            <arg direction="in" type="i" name="auth_type"/>
-            <arg direction="in" type="s" name="rand_data"/>
-            <arg direction="in" type="s" name="autn_data"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="auth_type"/>
-            <arg direction="out" type="s" name="resp_data"/>
-            <arg direction="out" type="s" name="authentication_key"/>
-            <arg direction="out" type="s" name="cipher_data"/>
-            <arg direction="out" type="s" name="integrity_data"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_verify_pins () -->
-        <method name="VerifyPins">
-            <arg direction="in" type="i" name="pin_type"/>
-            <arg direction="in" type="s" name="pw"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="pin_type"/>
-            <arg direction="out" type="u" name="retry_count"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_verify_puks () -->
-        <method name="VerifyPuks">
-            <arg direction="in" type="i" name="puk_type"/>
-            <arg direction="in" type="s" name="puk_pw"/>
-            <arg direction="in" type="s" name="new_pin_pw"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="puk_type"/>
-            <arg direction="out" type="u" name="retry_count"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_change_pins () -->
-        <method name="ChangePins">
-            <arg direction="in" type="i" name="pin_type"/>
-            <arg direction="in" type="s" name="old_pw"/>
-            <arg direction="in" type="s" name="new_pw"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="pin_type"/>
-            <arg direction="out" type="u" name="retry_count"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_disable_facility () -->
-        <method name="DisableFacility">
-            <arg direction="in" type="i" name="lock_type"/>
-            <arg direction="in" type="s" name="pw"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="type"/>
-            <arg direction="out" type="u" name="retry_count"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_enable_facility () -->
-        <method name="EnableFacility">
-            <arg direction="in" type="i" name="lock_type"/>
-            <arg direction="in" type="s" name="pw"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="type"/>
-            <arg direction="out" type="u" name="retry_count"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_facility () -->
-        <method name="GetFacility">
-            <arg direction="in" type="i" name="type"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="type"/>
-            <arg direction="out" type="i" name="f_status"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_get_lock_info () -->
-        <method name="GetLockInfo">
-            <arg direction="in" type="i" name="type"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="lock_type"/>
-            <arg direction="out" type="i" name="lock_status"/>
-            <arg direction="out" type="u" name="retry_count"/>
-        </method>
-
-        <!--Refer to TAPI API: tapi_sim_req_apdu () -->
-        <method name="ReqApdu">
-            <arg direction="in" type="s" name="apdu"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="s" name="apdu_resp"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_sim_req_atr () -->
-        <method name="ReqAtr">
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="s" name="atr"/>
-        </method>
-
-       <!-- card_status: SIM Card Status -->
-       <property name="card_status" type="a{sv}" access="read"/>
-
-        <!-- sim_type: Type of SIM -->
-        <property name="sim_type" type="i" access="read"/>
-
-        <!-- mcc: Mobile Country Code -->
-        <property name="mcc" type="s" access="read"/>
-
-        <!-- mnc: Mobile Network Code -->
-        <property name="mnc" type="s" access="read"/>
-
-        <!-- msin: Mobile Subscriber Identification Number -->
-        <property name="msin" type="s" access="read"/>
-
-    </interface>
-
-</node>
diff --git a/tel-headers/introspection/sms.xml b/tel-headers/introspection/sms.xml
deleted file mode 100644 (file)
index 6928181..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-  <interface name="org.tizen.telephony.Sms">
-
-    <!-- Refer to TAPI API: tapi_sms_send() -->
-    <method name="Send">
-      <arg direction="in" type="b" name="more_msgs"/>
-      <arg direction="in" type="a{sv}" name="sca"/>
-      <arg direction="in" type="s" name="tpdu"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_read_sms_in_sim() -->
-    <method name="ReadInSim">
-      <arg direction="in" type="u" name="index"/>
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="i" name="status"/>
-      <arg direction="out" type="a{sv}" name="sca"/>
-      <arg direction="out" type="s" name="tpdu"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_write_sms_in_sim() -->
-    <method name="WriteInSim">
-      <arg direction="in" type="i" name="status"/>
-      <arg direction="in" type="a{sv}" name="sca"/>
-      <arg direction="in" type="s" name="tpdu"/>
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="index"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_delete_sms_in_sim() -->
-    <method name="DeleteInSim">
-      <arg direction="in" type="u" name="index"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_get_count() -->
-    <method name="GetCount">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="total_count"/>
-      <arg direction="out" type="u" name="used_count"/>
-      <arg direction="out" type="au" name="index_list"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_set_cb_config() -->
-    <method name="SetCbConfig">
-      <arg direction="in" type="b" name="cb_enabled"/>
-      <arg direction="in" type="u" name="msg_id_range_cnt"/>
-      <arg direction="in" type="aa{sv}" name="msg_ids"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_get_cb_config() -->
-    <method name="GetCbConfig">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="b" name="cb_enabled"/>
-      <arg direction="out" type="u" name="msg_id_range_cnt"/>
-      <arg direction="out" type="aa{sv}" name="msg_ids"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_get_parameters() -->
-    <method name="GetParameters">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="u" name="count"/>
-      <arg direction="out" type="aa{sv}" name="params"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_set_parameters() -->
-    <method name="SetParameters">
-      <arg direction="in" type="u" name="index"/>
-      <arg direction="in" type="a{sv}" name="sca"/>
-      <arg direction="in" type="q" name="vp"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_send_deliver_report() -->
-    <method name="SendDeliverReport">
-      <arg direction="in" type="i" name="report"/>
-      <arg direction="in" type="a{sv}" name="sca"/>
-      <arg direction="in" type="s" name="tpdu"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_set_sca() -->
-    <method name="SetSca">
-      <arg direction="in" type="a{sv}" name="sca"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_get_sca() -->
-    <method name="GetSca">
-      <arg direction="out" type="i" name="result"/>
-      <arg direction="out" type="a{sv}" name="sca"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_set_memory_status() -->
-    <method name="SetMemoryStatus">
-      <arg direction="in" type="b" name="available"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TAPI API: tapi_sms_set_message_status() -->
-    <method name="SetMessageStatus">
-      <arg direction="in" type="u" name="index"/>
-      <arg direction="in" type="i" name="status"/>
-      <arg direction="out" type="i" name="result"/>
-    </method>
-
-    <!-- Refer to TEL_NOTI_SMS_INCOM_MSG event -->
-    <signal name="IncomingMsg">
-      <arg type="a{sv}" name="sca"/>
-      <arg type="s" name="tpdu"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_SMS_CB_INCOM_MSG event -->
-    <signal name="IncomingCbMsg">
-      <arg type="i" name="cb_type"/>
-      <arg type="s" name="cb_data"/>
-    </signal>
-
-    <!-- Refer to TEL_NOTI_SMS_ETWS_INCOM_MSG event -->
-    <signal name="IncomingEtwsMsg">
-      <arg type="i" name="etws_type"/>
-      <arg type="s" name="etws_data"/>
-    </signal>
-
-    <!-- Caches memory available status -->
-    <property name="SimMemoryStatus" type="b" access="read"/>
-
-    <!-- Caches service init status -->
-    <property name="InitStatus" type="b" access="read"/>
-
-  </interface>
-</node>
diff --git a/tel-headers/introspection/ss.xml b/tel-headers/introspection/ss.xml
deleted file mode 100644 (file)
index 6ece3e5..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE node PUBLIC
-  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
-  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-
-<node>
-
-    <interface name="org.tizen.telephony.Ss">
-
-        <!-- Refer to TAPI API: tapi_ss_set_barring () -->
-        <method name="SetBarring">
-            <arg direction="in" type="i" name="class"/>
-            <arg direction="in" type="b" name="enable"/>
-            <arg direction="in" type="i" name="type"/>
-            <arg direction="in" type="s" name="pwd"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_get_barring_status () -->
-        <method name="GetBarringStatus">
-            <arg direction="in" type="i" name="class"/>
-            <arg direction="in" type="i" name="type"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="u" name="record_num"/>
-            <arg direction="out" type="aa{sv}" name="records"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_change_barring_password () -->
-        <method name="ChangeBarringPassword">
-            <arg direction="in" type="s" name="old_pwd"/>
-            <arg direction="in" type="s" name="new_pwd"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_set_forwarding () -->
-        <method name="SetForwarding">
-            <arg direction="in" type="i" name="class"/>
-            <arg direction="in" type="i" name="mode"/>
-            <arg direction="in" type="i" name="condition"/>
-            <arg direction="in" type="s" name="number"/>
-            <arg direction="in" type="u" name="wait_time"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_get_forwarding_status () -->
-        <method name="GetForwardingStatus">
-           <arg direction="in" type="i" name="class"/>
-           <arg direction="in" type="i" name="condition"/>
-           <arg direction="out" type="i" name="result"/>
-           <arg direction="out" type="u" name="record_num"/>
-           <arg direction="out" type="aa{sv}" name="records"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_set_waiting () -->
-        <method name="SetWaiting">
-           <arg direction="in" type="i" name="class"/>
-           <arg direction="in" type="b" name="enable"/>
-           <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_get_waiting_status () -->
-        <method name="GetWaitingStatus">
-           <arg direction="in" type="i" name="class"/>
-           <arg direction="out" type="i" name="result"/>
-           <arg direction="out" type="u" name="record_num"/>
-           <arg direction="out" type="aa{sv}" name="records"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_set_cli () -->
-        <method name="SetCli">
-            <arg direction="in" type="i" name="type"/>
-            <arg direction="in" type="i" name="status"/>
-            <arg direction="out" type="i" name="result"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_get_cli_status () -->
-        <method name="GetCliStatus">
-            <arg direction="in" type="i" name="type"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="type"/>
-            <arg direction="out" type="i" name="net_status"/>
-            <arg direction="out" type="i" name="dev_status"/>
-        </method>
-
-        <!-- Refer to TAPI API: tapi_ss_send_ussd_request () -->
-        <method name="SendUssdRequest">
-            <arg direction="in" type="i" name="type"/>
-            <arg direction="in" type="s" name="str"/>
-            <arg direction="out" type="i" name="result"/>
-            <arg direction="out" type="i" name="type"/>
-            <arg direction="out" type="i" name="status"/>
-            <arg direction="out" type="s" name="str"/>
-        </method>
-
-        <!-- Refer to TEL_NOTI_SS_USSD event -->
-        <signal name="NotifyUssd">
-            <arg type="i" name="status"/>
-            <arg type="s" name="str"/>
-        </signal>
-
-    </interface>
-
-</node>
diff --git a/tel-headers/tel-headers.pc.in b/tel-headers/tel-headers.pc.in
deleted file mode 100644 (file)
index 54be8bf..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@PREFIX@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
-
-Name: tcore
-Description: Telephony headers
-Version: 1.0
-Requires: glib-2.0 gobject-2.0 gio-unix-2.0 gio-2.0
-Libs: -L${libdir} -ldl -ltel-headers
-Cflags: -I${includedir}/tel-headers/include -I${includedir}/tel-headers/introspection
-
diff --git a/unit-test/CMakeLists.txt b/unit-test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f917c74
--- /dev/null
@@ -0,0 +1,38 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(libtcore-unit-test C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+REMOVE_DEFINITIONS("-DFEATURE_TLOG_DEBUG")
+
+SET(TESTS
+               test-at
+               test-co
+               test-queue
+               test-dcs
+               test-hal
+               test-util
+               test-network
+)
+
+FOREACH(test ${TESTS})
+       ADD_EXECUTABLE(${test} ${test}.c log.c)
+       TARGET_LINK_LIBRARIES(${test} ${pkgs_LDFLAGS} "-L${CMAKE_BINARY_DIR} -ltcore -ldl")
+#      INSTALL(TARGETS ${test} RUNTIME DESTINATION bin/)
+       ADD_DEPENDENCIES(${test} run.sh)
+       SET(TEST_LIST "${TEST_LIST} ${test}")
+ENDFOREACH(test)
+
+
+ADD_CUSTOM_TARGET(run.sh)
+ADD_CUSTOM_COMMAND(
+       TARGET run.sh
+       POST_BUILD
+       COMMAND echo "gtester ${TEST_LIST} -o report.xml" > run.sh
+       COMMAND chmod +x run.sh
+       COMMENT "Generating gtester script"
+       VERBATIM # for double-quoted strings..
+       )
+ADD_DEPENDENCIES(run.sh tcore)
diff --git a/unit-test/log.c b/unit-test/log.c
new file mode 100644 (file)
index 0000000..e641019
--- /dev/null
@@ -0,0 +1,20 @@
+#define FEATURE_TLOG_DEBUG
+
+#include <stdio.h>
+#include <glib.h>
+
+#include <tcore.h>
+#include <log.h>
+
+void tcore_log(enum tcore_log_type type, enum tcore_log_priority priority, const char *tag, const char *fmt, ...)
+{
+       va_list ap;
+       char buf[1024];
+
+       va_start(ap, fmt);
+       vsnprintf(buf, 1023, fmt, ap);
+       va_end(ap);
+
+       printf("%s: %s", tag, buf);
+       fflush(stdout);
+}
diff --git a/unit-test/test-at.c b/unit-test/test-at.c
new file mode 100644 (file)
index 0000000..b089616
--- /dev/null
@@ -0,0 +1,223 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <at.h>
+
+static gboolean on_cmti(TcoreAT *at, const GSList *lines, void *user_data)
+{
+       int *checked = user_data;
+
+       *checked = 1;
+
+       printf("data = [%s]\n", (char *)lines->data);
+
+       return FALSE;
+}
+
+static gboolean on_cmt(TcoreAT *at, const GSList *lines, void *user_data)
+{
+       int *checked = user_data;
+
+       if (g_slist_length((GSList *)lines) != 2) {
+               printf("invalid message\n");
+               return TRUE;
+       }
+
+       *checked = 2;
+
+       printf("data1 = [%s]\n", (char *)lines->data);
+       printf("data2 = [%s]\n", (char *)lines->next->data);
+
+       return TRUE;
+}
+
+static void test_noti(void)
+{
+       TcoreAT *at;
+       TReturn ret;
+       int checked = 0;
+       char *msg = NULL;
+
+       at = tcore_at_new(NULL);
+       g_assert(at);
+
+       ret = tcore_at_add_notification(at, "+CMTI:", FALSE, on_cmti, &checked);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       ret = tcore_at_add_notification(at, "+CMT:", TRUE, on_cmt, &checked);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+
+       /* Non type PDU message */
+       msg = (char *)"+CMTI: \"SM\", 1\r\n";
+       ret = tcore_at_process(at, strlen(msg), msg);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* callback check */
+       g_assert(checked == 1);
+
+
+       /* Completed PDU message */
+       msg = (char *)"+CMT: 19\r\n038121F3100481214301112170137192410404F17B590E\r\n";
+       ret = tcore_at_process(at, strlen(msg), msg);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* callback check */
+       g_assert(checked == 2);
+
+
+       /* Split PDU message */
+       checked = 0;
+       msg = (char *)"+CMT: 19\r\n";
+       ret = tcore_at_process(at, strlen(msg), msg);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* callback check */
+       g_assert(checked == 0);
+
+       msg = (char *)"038121F310";
+       ret = tcore_at_process(at, strlen(msg), msg);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* callback check */
+       g_assert(checked == 0);
+
+       msg = (char *)"0481214301112170137192410404F17B590E\r\n";
+       ret = tcore_at_process(at, strlen(msg), msg);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* callback check */
+       g_assert(checked == 2);
+
+}
+
+static void test_buf_write(void)
+{
+#define BUF_SIZE 1024
+       TcoreAT *at;
+       TReturn ret;
+       char *msg_1 = (char *)"ATZ";
+       char msg_2[BUF_SIZE + 1];
+
+       at = tcore_at_new(NULL);
+       g_assert(at);
+
+       ret = tcore_at_buf_write(at, strlen(msg_1), msg_1);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       memset(msg_2, '1', BUF_SIZE);
+       msg_2[BUF_SIZE] = '\0';
+       ret = tcore_at_buf_write(at, strlen(msg_2), msg_2);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       tcore_at_free (at);
+}
+
+static void test_tok(void)
+{
+       GSList *tokens;
+       char *buf;
+
+       /* test unsolicited message */
+       tokens = tcore_at_tok_new("CSQ: 31, 99");
+       g_assert(tokens);
+
+       g_assert_cmpstr((char *)g_slist_nth_data(tokens, 0), ==, "31");
+       g_assert_cmpstr(tcore_at_tok_nth(tokens, 1), ==, "99");
+       g_assert(g_slist_nth_data(tokens, 2) == NULL);
+
+       tcore_at_tok_free(tokens);
+
+       /* test sub token (list type) */
+       tokens = tcore_at_tok_new("(2, \"T-Meego\", \"TTAU\", \"23401\", 2)");
+       g_assert(tokens);
+
+       g_assert_cmpstr((char *)g_slist_nth_data(tokens, 0), ==, "2");
+       g_assert_cmpstr(tcore_at_tok_nth(tokens, 1), ==, "\"T-Meego\"");
+       g_assert_cmpstr(tcore_at_tok_nth(tokens, 2), ==, "\"TTAU\"");
+       g_assert_cmpstr(tcore_at_tok_nth(tokens, 3), ==, "\"23401\"");
+       g_assert_cmpstr(tcore_at_tok_nth(tokens, 4), ==, "2");
+
+       /* test extract */
+       buf = tcore_at_tok_extract(tcore_at_tok_nth(tokens, 2));
+       g_assert(buf);
+       g_assert_cmpstr(buf, ==, "TTAU");
+       free(buf);
+
+       tcore_at_tok_free(tokens);
+
+       /* test extract */
+       buf = tcore_at_tok_extract("(haha)");
+       g_assert(buf);
+       g_assert_cmpstr(buf, ==, "haha");
+       free(buf);
+
+       /* test extract */
+       buf = tcore_at_tok_extract("(a)");
+       g_assert(buf);
+       g_assert_cmpstr(buf, ==, "a");
+       free(buf);
+
+       /* test extract */
+       buf = tcore_at_tok_extract("()");
+       g_assert(buf);
+       g_assert_cmpstr(buf, ==, "");
+       free(buf);
+
+       /* test extract */
+       buf = tcore_at_tok_extract("(");
+       g_assert(buf);
+       g_assert_cmpstr(buf, ==, "(");
+       free(buf);
+
+       /* test extract */
+       buf = tcore_at_tok_extract(")");
+       g_assert(buf);
+       g_assert_cmpstr(buf, ==, ")");
+       free(buf);
+
+       /* test extract */
+       buf = tcore_at_tok_extract("");
+       g_assert(buf);
+       g_assert_cmpstr(buf, ==, "");
+       free(buf);
+}
+
+static void test_pdu_resp(void)
+{
+       TcoreAT *at;
+       TcoreATRequest *req;
+       TReturn ret;
+       char *msg;
+
+       at = tcore_at_new(NULL);
+       g_assert(at);
+
+       req = tcore_at_request_new("AT+CMGR=1", "+CMGR", TCORE_AT_PDU);
+       g_assert(req);
+
+       ret = tcore_at_set_request(at, req, TRUE);
+
+       msg = (char *)"+CMGR: 1,,105\r\n12345678901234567890\r\nOK\r\n";
+       ret = tcore_at_process(at, strlen(msg), msg);
+       g_assert(ret == TRUE);
+
+       tcore_at_free (at);
+}
+
+int main(int argc, char **argv)
+{
+       g_test_init(&argc, &argv, NULL);
+
+       g_test_add_func("/at/buf_write", test_buf_write);
+       g_test_add_func("/at/tok", test_tok);
+       g_test_add_func("/at/noti", test_noti);
+       g_test_add_func("/at/pdu_resp", test_pdu_resp);
+
+       return g_test_run();
+}
diff --git a/unit-test/test-co.c b/unit-test/test-co.c
new file mode 100644 (file)
index 0000000..325a98d
--- /dev/null
@@ -0,0 +1,313 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <core_object.h>
+
+static int _count = 0;
+
+static gboolean on_event1(CoreObject *o, const void *event_info, void *user_data)
+{
+       _count++;
+
+       g_assert(o);
+       g_assert(event_info);
+       g_assert_cmpstr(event_info, ==, "ok");
+
+       return TRUE;
+}
+
+static gboolean on_event2(CoreObject *o, const void *event_info, void *user_data)
+{
+       _count++;
+
+       g_assert(o);
+       g_assert(event_info);
+       g_assert_cmpstr(event_info, ==, "ok");
+
+       return FALSE;
+}
+
+
+static void test_co_new(void)
+{
+       CoreObject *co;
+
+       co = tcore_object_new(NULL, "test", NULL);
+       g_assert(co);
+
+       tcore_object_free (co);
+}
+
+static void test_callback_renew(void)
+{
+       CoreObject *co;
+       TReturn ret;
+
+       co = tcore_object_new(NULL, "test", NULL);
+       g_assert(co);
+
+       // lifetime: unlimit
+       _count = 0;
+       ret = tcore_object_add_callback(co, "event1", on_event1, NULL);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       ret = tcore_object_emit_callback(co, "event1", "ok");
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       ret = tcore_object_emit_callback(co, "event1", "ok");
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       g_assert(_count == 2);
+}
+
+static void test_callback_once(void)
+{
+       CoreObject *co;
+       TReturn ret;
+
+       co = tcore_object_new(NULL, "test", NULL);
+       g_assert(co);
+
+       // lifetime: one time callback + unlimit callback
+       _count = 0;
+       ret = tcore_object_add_callback(co, "event2", on_event2, NULL);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+       ret = tcore_object_add_callback(co, "event1", on_event1, NULL);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       ret = tcore_object_emit_callback(co, "event2", "ok");
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       ret = tcore_object_emit_callback(co, "event2", "ok");
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       g_assert(_count == 1);
+
+       ret = tcore_object_emit_callback(co, "event1", "ok");
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       g_assert(_count == 2);
+
+       tcore_object_free (co);
+}
+
+static gboolean on_prop_changed (CoreObject *co, const void *event_info,
+               void *user_data)
+{
+       int *mode = user_data;
+       GSList *key = (GSList *)event_info;
+       const char *data;
+
+       switch (*mode) {
+               case 1:
+                       g_assert (g_slist_length(key) == 1);
+                       g_assert_cmpstr (key->data, ==, "qqq");
+                       data = tcore_object_ref_property (co, "qqq");
+                       g_assert_cmpstr (data, ==, "1234");
+                       break;
+
+               case 2:
+                       g_assert (g_slist_length (key) == 1);
+                       g_assert_cmpstr (key->data, ==, "qqq");
+                       data = tcore_object_ref_property (co, "qqq");
+                       g_assert (data == NULL);
+                       break;
+
+               case 3:
+                       g_assert (g_slist_length (key) == 1);
+                       g_assert_cmpstr (key->data, ==, "www");
+                       data = tcore_object_ref_property (co, "www");
+                       g_assert_cmpstr (data, ==, "heap");
+                       break;
+
+               case 4:
+                       g_assert (g_slist_length (key) == 1);
+                       g_assert_cmpstr (key->data, ==, "www");
+                       data = tcore_object_ref_property (co, "www");
+                       g_assert (data == NULL);
+                       break;
+
+               case 5:
+                       g_assert (g_slist_length (key) == 1);
+                       g_assert_cmpstr (key->data, ==, "key");
+                       data = tcore_object_ref_property (co, "key");
+                       g_assert_cmpstr (data, ==, "1");
+                       break;
+
+               case 6:
+                       g_assert (g_slist_length (key) == 1);
+                       g_assert_cmpstr (key->data, ==, "key");
+                       data = tcore_object_ref_property (co, "key");
+                       g_assert_cmpstr (data, ==, "2");
+                       break;
+
+               case 7:
+                       g_assert (FALSE);
+                       break;
+
+               case 8:
+                       g_assert (g_slist_length (key) == 1);
+                       g_assert_cmpstr (key->data, ==, "key");
+                       data = tcore_object_ref_property (co, "key");
+                       g_assert_cmpstr (data, ==, "2");
+                       break;
+
+               case 9:
+                       g_assert (g_slist_length (key) == 2);
+                       g_assert_cmpstr (key->data, ==, "foo");
+                       g_assert_cmpstr (key->next->data, ==, "bar");
+                       data = tcore_object_ref_property (co, "foo");
+                       g_assert_cmpstr (data, ==, "1");
+                       data = tcore_object_ref_property (co, "bar");
+                       g_assert_cmpstr (data, ==, "2");
+                       break;
+
+               case 10:
+                       g_assert (g_slist_length (key) == 1);
+                       g_assert_cmpstr (key->data, ==, "foo");
+                       data = tcore_object_ref_property (co, "foo");
+                       g_assert (data == NULL);
+                       break;
+
+               case 11:
+                       g_assert (g_slist_length (key) == 2);
+                       g_assert (g_slist_find_custom (key, "foo",
+                                               (GCompareFunc)g_strcmp0) != NULL);
+                       g_assert (CORE_OBJECT_KEY_FIND(key, "bar") != NULL);
+                       data = tcore_object_ref_property (co, "foo");
+                       g_assert_cmpstr (data, ==, "1");
+                       data = tcore_object_ref_property (co, "bar");
+                       g_assert (data == NULL);
+                       break;
+
+               default:
+                       g_assert (FALSE);
+                       break;
+       }
+
+       /* Set flag to callback invocation success */
+       *mode = 0;
+
+       return TRUE;
+}
+
+static void test_property (void)
+{
+       CoreObject *co;
+       const char *data;
+       char *test;
+       GHashTable *raw;
+       int mode = 0;
+       GSList *tmp_list;
+
+       co = tcore_object_new (NULL, "test", NULL);
+       g_assert (co);
+
+       tcore_object_add_callback (co, CORE_OBJECT_EVENT_PROPERTY_CHANGED,
+                       on_prop_changed, &mode);
+
+       raw = tcore_object_ref_property_hash (co);
+       g_assert (raw);
+
+       /* Case: Basic property set */
+       mode = 1;
+       tcore_object_set_property (co, "qqq", "1234");
+       g_assert (g_hash_table_size (raw) == 1);
+       g_assert (mode == 0);
+
+       data = tcore_object_ref_property (co, "qqq");
+       g_assert_cmpstr(data, ==, "1234");
+
+       /* Case: Basic property remove */
+       mode = 2;
+       tcore_object_set_property (co, "qqq", NULL);
+       g_assert (g_hash_table_size (raw) == 0);
+       g_assert (mode == 0);
+
+       data = tcore_object_ref_property (co, "qqq");
+       g_assert (data == NULL);
+
+       /* Case: Malloc property set */
+       mode = 3;
+       test = strdup("heap");
+       tcore_object_set_property (co, "www", test);
+       g_assert (g_hash_table_size (raw) == 1);
+       g_assert (mode == 0);
+       free(test);
+
+       data = tcore_object_ref_property (co, "www");
+       g_assert_cmpstr(data, ==, "heap");
+
+       /* Case: Malloc property remove */
+       mode = 4;
+       tcore_object_set_property (co, "www", NULL);
+       g_assert (g_hash_table_size (raw) == 0);
+       g_assert (mode == 0);
+
+       data = tcore_object_ref_property (co, "www");
+       g_assert (data == NULL);
+
+       /* Case: Same key & Different value set */
+       mode = 5;
+       tcore_object_set_property (co, "key", "1");
+       g_assert (g_hash_table_size (raw) == 1);
+       g_assert (mode == 0);
+
+       mode = 6;
+       tcore_object_set_property (co, "key", "2");
+       g_assert (g_hash_table_size (raw) == 1);
+       g_assert (mode == 0);
+
+       /* Case: Same key & Same value set => No callback invocation */
+       mode = 7;
+       tcore_object_set_property (co, "key", "2");
+       g_assert (g_hash_table_size (raw) == 1);
+       g_assert (mode == 7);
+
+       /* Case: Same key & Same value set & force event invocation */
+       mode = 8;
+       tcore_object_set_property (co, "key", "2");
+       g_assert (g_hash_table_size (raw) == 1);
+
+       tmp_list = g_slist_append (NULL, (char*)"key");
+       tcore_object_emit_callback(co, CORE_OBJECT_EVENT_PROPERTY_CHANGED, tmp_list);
+       g_assert (mode == 0);
+       g_slist_free(tmp_list);
+
+       /* Case: Multiple property set */
+       mode = 9;
+       tcore_object_set_property (co, "foo", "1", "bar", "2");
+       g_assert (g_hash_table_size (raw) == 3);
+       g_assert (mode == 0);
+
+       /* Case: Set key without value => same as key with NULL: remove key */
+       mode = 10;
+       tcore_object_set_property (co, "foo");
+       g_assert (g_hash_table_size (raw) == 2);
+       g_assert (mode == 0);
+
+       /* Case: Multiple property set with unset (foo set, bar unset) */
+       mode = 11;
+       tcore_object_set_property (co, "foo", "1", "bar");
+       g_assert (g_hash_table_size (raw) == 2);
+       g_assert (mode == 0);
+
+       tcore_object_free (co);
+}
+
+int main(int argc, char **argv)
+{
+       g_test_init(&argc, &argv, NULL);
+
+       g_test_add_func("/co/new", test_co_new);
+       g_test_add_func("/co/callback_renew", test_callback_renew);
+       g_test_add_func("/co/callback_once", test_callback_once);
+       g_test_add_func("/co/property", test_property);
+
+       return g_test_run();
+}
diff --git a/unit-test/test-dcs.c b/unit-test/test-dcs.c
new file mode 100644 (file)
index 0000000..5d6a3b0
--- /dev/null
@@ -0,0 +1,69 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <util.h>
+
+#if 0
+static void dump_hex(const char *msg, unsigned char *data, int data_len)
+{
+       int i;
+
+       printf("%s", msg);
+
+       for (i = 0; i < data_len; i++) {
+               printf("%02X ", data[i]);
+       };
+
+       printf("\n");
+}
+#endif
+
+static void test_7bit(void)
+{
+       unsigned char *dest;
+       unsigned char packed[] = { 0xE8, 0x32, 0x9B, 0xFD, 0x06, 0x00 };
+
+       /* unpack packed-data('hello') */
+       dest = tcore_util_unpack_gsm7bit(packed, 0x05);
+       g_assert_cmpstr((char *)dest, ==, "hello");
+       free(dest);
+
+       /* pack 'hello' */
+       dest = tcore_util_pack_gsm7bit((unsigned char *)"hello", strlen("hello"));
+
+       if(!dest){
+               g_assert(memcmp(packed, dest, strlen((char *)dest)) == 0);
+               free(dest);
+       }
+}
+
+static void test_hex(void)
+{
+       char *hex = (char *)"1A2B3C4D5E6F";
+       unsigned char expected[] = { 0x1A, 0x2B, 0x3C, 0x4D, 0x5E, 0x6F };
+       unsigned char *dest;
+
+       dest = tcore_util_decode_hex(hex, strlen(hex));
+       g_assert(memcmp(dest, expected, strlen((char *)dest)) == 0);
+       free(dest);
+}
+
+static void test_ucs(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+       g_test_init(&argc, &argv, NULL);
+
+       g_test_add_func("/dcs/hex", test_hex);
+       g_test_add_func("/dcs/7bit", test_7bit);
+       g_test_add_func("/dcs/ucs", test_ucs);
+
+       return g_test_run();
+}
diff --git a/unit-test/test-hal.c b/unit-test/test-hal.c
new file mode 100644 (file)
index 0000000..43691ca
--- /dev/null
@@ -0,0 +1,96 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <hal.h>
+
+int g_flag;
+
+
+static void on_recv_callback(TcoreHal *h, unsigned int data_len, const void *data, void *user_data)
+{
+       g_assert(data_len == 3);
+       g_assert_cmpstr((char *)data, ==, "123");
+
+       g_flag++;
+}
+
+static void on_recv_callback2(TcoreHal *h, unsigned int data_len, const void *data, void *user_data)
+{
+       g_assert(data_len == 3);
+       g_assert_cmpstr((char *)data, ==, "123");
+
+       g_flag++;
+}
+
+static void test_callback(void)
+{
+       TcoreHal *h;
+
+       h = tcore_hal_new(NULL, "test_hal", NULL, TCORE_HAL_MODE_CUSTOM);
+       g_assert(h);
+
+       tcore_hal_add_recv_callback(h, on_recv_callback, NULL);
+
+       g_flag = 0;
+       tcore_hal_emit_recv_callback(h, 3, "123");
+       g_assert(g_flag == 1);
+
+       tcore_hal_remove_recv_callback(h, on_recv_callback);
+
+       g_flag = 0;
+       tcore_hal_emit_recv_callback(h, 3, "123");
+       g_assert(g_flag == 0);
+
+       tcore_hal_free(h);
+}
+
+static void test_callback2(void)
+{
+       TcoreHal *h;
+
+       h = tcore_hal_new(NULL, "test_hal", NULL, TCORE_HAL_MODE_CUSTOM);
+       g_assert(h);
+
+       tcore_hal_add_recv_callback(h, on_recv_callback, NULL);
+       tcore_hal_add_recv_callback(h, on_recv_callback2, NULL);
+
+       g_flag = 0;
+       tcore_hal_emit_recv_callback(h, 3, "123");
+       g_assert(g_flag == 2);
+
+       tcore_hal_remove_recv_callback(h, on_recv_callback);
+
+       g_flag = 0;
+       tcore_hal_emit_recv_callback(h, 3, "123");
+       g_assert(g_flag == 1);
+
+       /* remove already removed callback */
+       tcore_hal_remove_recv_callback(h, on_recv_callback);
+
+       g_flag = 0;
+       tcore_hal_emit_recv_callback(h, 3, "123");
+       g_assert(g_flag == 1);
+
+       tcore_hal_remove_recv_callback(h, on_recv_callback2);
+
+       g_flag = 0;
+       tcore_hal_emit_recv_callback(h, 3, "123");
+       g_assert(g_flag == 0);
+
+       tcore_hal_free(h);
+}
+
+int main(int argc, char **argv)
+{
+       g_test_init(&argc, &argv, NULL);
+
+       g_test_add_func("/hal/callback", test_callback);
+       g_test_add_func("/hal/callback2", test_callback2);
+
+       return g_test_run();
+}
diff --git a/unit-test/test-network.c b/unit-test/test-network.c
new file mode 100644 (file)
index 0000000..28f3af8
--- /dev/null
@@ -0,0 +1,76 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <plugin.h>
+#include <co_network.h>
+
+
+static void test_operator(void)
+{
+       TcorePlugin *p;
+       CoreObject *o;
+       struct tcore_network_operator_info noi;
+       struct tcore_network_operator_info *tmp_noi;
+       TReturn ret;
+
+       p = tcore_plugin_new (NULL, NULL, NULL, NULL);
+       g_assert (p);
+
+       o = tcore_network_new (p, "test_network", NULL, NULL);
+       g_assert (o);
+
+       /* Add 2 items */
+       snprintf (noi.mcc, 4, "123");
+       snprintf (noi.mnc, 4, "01");
+       snprintf (noi.name, 41, "Hello");
+       ret = tcore_network_operator_info_add (o, &noi);
+       g_assert (ret == TCORE_RETURN_SUCCESS);
+
+       snprintf (noi.mcc, 4, "123");
+       snprintf (noi.mnc, 4, "02");
+       snprintf (noi.name, 41, "World");
+       ret = tcore_network_operator_info_add (o, &noi);
+       g_assert (ret == TCORE_RETURN_SUCCESS);
+
+       /* Check items */
+       tmp_noi = tcore_network_operator_info_find (o, "123", "01");
+       g_assert (tmp_noi);
+       g_assert_cmpstr (tmp_noi->name, ==, "Hello");
+
+       tmp_noi = tcore_network_operator_info_find (o, "123", "02");
+       g_assert (tmp_noi);
+       g_assert_cmpstr (tmp_noi->name, ==, "World");
+
+       /* Replace item */
+       snprintf (noi.mcc, 4, "123");
+       snprintf (noi.mnc, 4, "02");
+       snprintf (noi.name, 41, "Update");
+       ret = tcore_network_operator_info_add (o, &noi);
+       g_assert (ret == TCORE_RETURN_SUCCESS);
+
+       /* Check items */
+       tmp_noi = tcore_network_operator_info_find (o, "123", "01");
+       g_assert (tmp_noi);
+       g_assert_cmpstr (tmp_noi->name, ==, "Hello");
+
+       tmp_noi = tcore_network_operator_info_find (o, "123", "02");
+       g_assert (tmp_noi);
+       g_assert_cmpstr (tmp_noi->name, ==, "Update");
+
+       tcore_network_free (o);
+       tcore_plugin_free (p);
+}
+
+int main(int argc, char **argv)
+{
+       g_test_init(&argc, &argv, NULL);
+
+       g_test_add_func("/network/operator", test_operator);
+
+       return g_test_run();
+}
diff --git a/unit-test/test-queue.c b/unit-test/test-queue.c
new file mode 100644 (file)
index 0000000..23ab692
--- /dev/null
@@ -0,0 +1,289 @@
+
+#include <stdio.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <queue.h>
+#include <hal.h>
+#include <user_request.h>
+
+static int g_flag;
+
+static TReturn always_send_ok(TcoreHal *hal, unsigned int data_len, void *data)
+{
+       return TCORE_RETURN_SUCCESS;
+}
+
+static struct tcore_hal_operations hops = {
+       .send = always_send_ok,
+};
+
+static void test_queue_hal(void)
+{
+       TcoreHal *h;
+       TcorePending *pending1;
+       TcorePending *pending2;
+       TcorePending *pending3;
+       TcorePending *pending = NULL;
+       TReturn ret;
+
+       h = tcore_hal_new(NULL, "test_hal", &hops, TCORE_HAL_MODE_CUSTOM);
+       g_assert(h);
+
+       ret = tcore_hal_set_power_state(h, TRUE);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* first item */
+       pending1 = tcore_pending_new(NULL, 1);
+       g_assert(pending1);
+       tcore_pending_set_priority(pending1, TCORE_PENDING_PRIORITY_IMMEDIATELY);
+
+       /* second item */
+       pending2 = tcore_pending_new(NULL, 1);
+       g_assert(pending2);
+       tcore_pending_set_auto_free_status_after_sent(pending2, TRUE);
+
+       /* third item */
+       pending3 = tcore_pending_new(NULL, 1);
+       g_assert(pending3);
+       tcore_pending_set_priority(pending3, TCORE_PENDING_PRIORITY_IMMEDIATELY);
+
+       /* send pending1 */
+       ret = tcore_hal_send_request(h, pending1);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* send pending2 -> queue */
+       ret = tcore_hal_send_request(h, pending2);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* remove pending1 */
+       ret = tcore_hal_dispatch_response_data(h, 1, 0, NULL);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* check next pending */
+       pending = tcore_queue_ref_pending_by_id(tcore_hal_ref_queue(h), 1);
+       g_assert(pending == pending2);
+
+       /* force send (because g_main_loop not work in unit test) */
+       tcore_hal_send_force(h);
+
+       /* check next pending (pending2 is auto free) */
+       pending = tcore_queue_ref_pending_by_id(tcore_hal_ref_queue(h), 1);
+       g_assert(pending == NULL);
+
+       /* send pending3 */
+       ret = tcore_hal_send_request(h, pending3);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       pending = tcore_queue_ref_pending_by_id(tcore_hal_ref_queue(h), 1);
+       g_assert(pending == pending3);
+
+       /* remove pending3 */
+       ret = tcore_hal_dispatch_response_data(h, 1, 0, NULL);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* check next pending (no more pending) */
+       pending = tcore_queue_ref_pending_by_id(tcore_hal_ref_queue(h), 1);
+       g_assert(pending == NULL);
+
+       tcore_hal_free(h);
+}
+
+static void test_queue_push_priority(void)
+{
+       TcoreQueue *q;
+       TcorePending *pending1;
+       TcorePending *pending2;
+       TcorePending *pending3;
+       TcorePending *pending = NULL;
+       TReturn ret;
+
+       q = tcore_queue_new(NULL);
+       g_assert(q);
+
+       /* first item */
+       pending1 = tcore_pending_new(NULL, 1);
+       g_assert(pending1);
+       tcore_pending_set_priority(pending1, TCORE_PENDING_PRIORITY_IMMEDIATELY);
+
+       ret = tcore_queue_push(q, pending1);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* second item */
+       pending2 = tcore_pending_new(NULL, 1);
+       g_assert(pending2);
+
+       ret = tcore_queue_push(q, pending2);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* third item, but push to second item position */
+       pending3 = tcore_pending_new(NULL, 1);
+       g_assert(pending3);
+       tcore_pending_set_priority(pending3, TCORE_PENDING_PRIORITY_IMMEDIATELY);
+
+       ret = tcore_queue_push(q, pending3);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* pop test (order by priority) */
+       pending = tcore_queue_pop_by_id(q, 1);
+       g_assert(pending == pending1);
+
+       pending = tcore_queue_pop_by_id(q, 1);
+       g_assert(pending == pending3);
+
+       pending = tcore_queue_pop_by_id(q, 1);
+       g_assert(pending == pending2);
+
+       tcore_queue_free(q);
+}
+
+static void test_queue_push(void)
+{
+       TcoreQueue *q;
+       TcorePending *pending1;
+       TcorePending *pending2;
+       TcorePending *pending3;
+       TcorePending *pending = NULL;
+       TReturn ret;
+
+       q = tcore_queue_new(NULL);
+       g_assert(q);
+
+       /* first item */
+       pending1 = tcore_pending_new(NULL, 1);
+       g_assert(pending1);
+
+       ret = tcore_queue_push(q, pending1);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* second item */
+       pending2 = tcore_pending_new(NULL, 1);
+       g_assert(pending2);
+
+       ret = tcore_queue_push(q, pending2);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* third item */
+       pending3 = tcore_pending_new(NULL, 1);
+       g_assert(pending3);
+
+       ret = tcore_queue_push(q, pending3);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* pop test (order by push sequence (same priority)) */
+       pending = tcore_queue_pop_by_id(q, 1);
+       g_assert(pending == pending1);
+
+       pending = tcore_queue_pop_by_id(q, 1);
+       g_assert(pending == pending2);
+
+       pending = tcore_queue_pop_by_id(q, 1);
+       g_assert(pending == pending3);
+
+       tcore_queue_free(q);
+}
+
+static void on_resp(TcorePending *pending, int data_len, const void *data, void *user_data)
+{
+       printf("on_resp !!\n");
+       g_flag++;
+}
+
+static void test_queue_push_cancel(void)
+{
+       TcoreHal *h;
+       TcorePending *pending1;
+       TcorePending *pending2;
+       TcorePending *pending3;
+       TcorePending *p;
+       TReturn ret;
+       UserRequest *ur1;
+       UserRequest *ur2;
+
+       h = tcore_hal_new(NULL, "test_hal", &hops, TCORE_HAL_MODE_CUSTOM);
+       g_assert(h);
+
+       ret = tcore_hal_set_power_state(h, TRUE);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* first item */
+       ur1 = tcore_user_request_new(NULL, NULL);
+       g_assert(ur1);
+
+       tcore_user_request_set_command(ur1, TREQ_NETWORK_SEARCH);
+
+       pending1 = tcore_pending_new(NULL, 1);
+       g_assert(pending1);
+
+       tcore_pending_set_response_callback(pending1, on_resp, NULL);
+       tcore_pending_link_user_request(pending1, ur1);
+
+       ret = tcore_hal_send_request(h, pending1);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* force update send state */
+       tcore_pending_emit_send_callback(pending1, TRUE);
+
+       /* second item */
+       ur2 = tcore_user_request_new(NULL, NULL);
+       g_assert(ur2);
+
+       tcore_user_request_set_command(ur2, TREQ_NETWORK_SEARCH);
+
+       pending2 = tcore_pending_new(NULL, 1);
+       g_assert(pending2);
+
+       tcore_pending_set_response_callback(pending2, on_resp, NULL);
+       tcore_pending_link_user_request(pending2, ur2);
+
+       ret = tcore_hal_send_request(h, pending2);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       /* third item */
+       pending3 = tcore_pending_new(NULL, 1);
+       g_assert(pending3);
+
+       ret = tcore_hal_send_request(h, pending3);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+
+       /* search */
+       p = tcore_queue_search_by_command(tcore_hal_ref_queue(h), TREQ_NETWORK_SEARCH, TRUE);
+       g_assert(p == pending1);
+
+       p = tcore_queue_search_by_command(tcore_hal_ref_queue(h), TREQ_NETWORK_SEARCH, FALSE);
+       g_assert(p == pending2);
+
+       /* cancel */
+       g_flag = 0;
+       ret = tcore_queue_cancel_pending_by_command(tcore_hal_ref_queue(h), TREQ_NETWORK_SEARCH);
+       g_assert(ret == TCORE_RETURN_SUCCESS);
+
+       g_assert(g_flag == 2);
+
+}
+
+static void test_queue_new(void)
+{
+       TcoreQueue *q;
+
+       q = tcore_queue_new(NULL);
+       g_assert(q);
+
+       tcore_queue_free(q);
+}
+
+int main(int argc, char **argv)
+{
+       g_test_init(&argc, &argv, NULL);
+
+       g_test_add_func("/queue/new", test_queue_new);
+       g_test_add_func("/queue/push", test_queue_push);
+       g_test_add_func("/queue/push_priority", test_queue_push_priority);
+       g_test_add_func("/queue/push_cancel", test_queue_push_cancel);
+       g_test_add_func("/queue/hal", test_queue_hal);
+
+       return g_test_run();
+}
diff --git a/unit-test/test-util.c b/unit-test/test-util.c
new file mode 100644 (file)
index 0000000..153fb8d
--- /dev/null
@@ -0,0 +1,94 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <util.h>
+
+static void test_marshal(void)
+{
+       GHashTable *list;
+       int value_int;
+
+       list = tcore_util_marshal_create ();
+       g_assert(list);
+
+       value_int = 1;
+       tcore_util_marshal_add_data (list, "key1", &value_int, TCORE_UTIL_MARSHAL_DATA_INT_TYPE);
+       g_assert(tcore_util_marshal_get_int (list, "key1") == value_int);
+
+       value_int = 2;
+       tcore_util_marshal_add_data (list, "key2", &value_int, TCORE_UTIL_MARSHAL_DATA_INT_TYPE);
+       g_assert(tcore_util_marshal_get_int (list, "key2") == value_int);
+
+       tcore_util_marshal_destory (list);
+}
+
+static void test_marshal_serialize(void)
+{
+       GHashTable *list;
+       GHashTable *item;
+       GHashTable *tmp;
+       gchar *serialized;
+       int i;
+       char buf[255];
+       int value_int;
+
+       list = tcore_util_marshal_create ();
+       g_assert(list);
+
+       value_int = 1;
+       tcore_util_marshal_add_data (list, "key1", &value_int, TCORE_UTIL_MARSHAL_DATA_INT_TYPE);
+       g_assert(tcore_util_marshal_get_int (list, "key1") == value_int);
+
+       value_int = 2;
+       tcore_util_marshal_add_data (list, "key2", &value_int, TCORE_UTIL_MARSHAL_DATA_INT_TYPE);
+       g_assert(tcore_util_marshal_get_int (list, "key2") == value_int);
+
+       item = tcore_util_marshal_create ();
+       g_assert (item);
+       tcore_util_marshal_add_data (list, "key_object", item, TCORE_UTIL_MARSHAL_DATA_OBJECT_TYPE);
+
+       for (i = 0; i < 3; i++) {
+               item = tcore_util_marshal_create ();
+               g_assert (item);
+
+               value_int = i * 10;
+               snprintf (buf, 255, "sub-%d", i);
+               tcore_util_marshal_add_data (item, buf, &value_int, TCORE_UTIL_MARSHAL_DATA_INT_TYPE);
+               g_assert(tcore_util_marshal_get_int (item, buf) == value_int);
+
+               tcore_util_marshal_add_data (list, buf, item, TCORE_UTIL_MARSHAL_DATA_OBJECT_TYPE);
+       }
+
+       serialized = tcore_util_marshal_serialize (list);
+       g_assert (serialized);
+       tcore_util_marshal_destory (list);
+
+       tmp = tcore_util_marshal_deserialize_string (serialized);
+       g_assert (tmp);
+
+       free (serialized);
+
+       g_assert(tcore_util_marshal_get_int (tmp, "key1") == 1);
+       g_assert(tcore_util_marshal_get_int (tmp, "key2") == 2);
+
+       tcore_util_marshal_destory (tmp);
+}
+
+int main(int argc, char **argv)
+{
+       g_test_init(&argc, &argv, NULL);
+
+#if !GLIB_CHECK_VERSION(2,35,0)
+       g_type_init();
+#endif
+
+       g_test_add_func("/util/marshal", test_marshal);
+       g_test_add_func("/util/marshal_serialize", test_marshal_serialize);
+
+       return g_test_run();
+}