+++ /dev/null
-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>
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}/include/common)
+
ADD_DEFINITIONS("-DFEATURE_TLOG_DEBUG")
ADD_DEFINITIONS("-DTCORE_LOG_TAG=\"TCORE\"")
ADD_DEFINITIONS("-DTCORE_VERSION=\"${VERSION}\"")
MESSAGE(${CMAKE_EXE_LINKER_FLAGS})
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/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/mux.c
+
+ 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
)
-Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
-\r
- Apache License\r
- Version 2.0, January 2004\r
- http://www.apache.org/licenses/\r
-\r
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
-\r
- 1. Definitions.\r
-\r
- "License" shall mean the terms and conditions for use, reproduction,\r
- and distribution as defined by Sections 1 through 9 of this document.\r
-\r
- "Licensor" shall mean the copyright owner or entity authorized by\r
- the copyright owner that is granting the License.\r
-\r
- "Legal Entity" shall mean the union of the acting entity and all\r
- other entities that control, are controlled by, or are under common\r
- control with that entity. For the purposes of this definition,\r
- "control" means (i) the power, direct or indirect, to cause the\r
- direction or management of such entity, whether by contract or\r
- otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
- outstanding shares, or (iii) beneficial ownership of such entity.\r
-\r
- "You" (or "Your") shall mean an individual or Legal Entity\r
- exercising permissions granted by this License.\r
-\r
- "Source" form shall mean the preferred form for making modifications,\r
- including but not limited to software source code, documentation\r
- source, and configuration files.\r
-\r
- "Object" form shall mean any form resulting from mechanical\r
- transformation or translation of a Source form, including but\r
- not limited to compiled object code, generated documentation,\r
- and conversions to other media types.\r
-\r
- "Work" shall mean the work of authorship, whether in Source or\r
- Object form, made available under the License, as indicated by a\r
- copyright notice that is included in or attached to the work\r
- (an example is provided in the Appendix below).\r
-\r
- "Derivative Works" shall mean any work, whether in Source or Object\r
- form, that is based on (or derived from) the Work and for which the\r
- editorial revisions, annotations, elaborations, or other modifications\r
- represent, as a whole, an original work of authorship. For the purposes\r
- of this License, Derivative Works shall not include works that remain\r
- separable from, or merely link (or bind by name) to the interfaces of,\r
- the Work and Derivative Works thereof.\r
-\r
- "Contribution" shall mean any work of authorship, including\r
- the original version of the Work and any modifications or additions\r
- to that Work or Derivative Works thereof, that is intentionally\r
- submitted to Licensor for inclusion in the Work by the copyright owner\r
- or by an individual or Legal Entity authorized to submit on behalf of\r
- the copyright owner. For the purposes of this definition, "submitted"\r
- means any form of electronic, verbal, or written communication sent\r
- to the Licensor or its representatives, including but not limited to\r
- communication on electronic mailing lists, source code control systems,\r
- and issue tracking systems that are managed by, or on behalf of, the\r
- Licensor for the purpose of discussing and improving the Work, but\r
- excluding communication that is conspicuously marked or otherwise\r
- designated in writing by the copyright owner as "Not a Contribution."\r
-\r
- "Contributor" shall mean Licensor and any individual or Legal Entity\r
- on behalf of whom a Contribution has been received by Licensor and\r
- subsequently incorporated within the Work.\r
-\r
- 2. Grant of Copyright License. Subject to the terms and conditions of\r
- this License, each Contributor hereby grants to You a perpetual,\r
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
- copyright license to reproduce, prepare Derivative Works of,\r
- publicly display, publicly perform, sublicense, and distribute the\r
- Work and such Derivative Works in Source or Object form.\r
-\r
- 3. Grant of Patent License. Subject to the terms and conditions of\r
- this License, each Contributor hereby grants to You a perpetual,\r
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
- (except as stated in this section) patent license to make, have made,\r
- use, offer to sell, sell, import, and otherwise transfer the Work,\r
- where such license applies only to those patent claims licensable\r
- by such Contributor that are necessarily infringed by their\r
- Contribution(s) alone or by combination of their Contribution(s)\r
- with the Work to which such Contribution(s) was submitted. If You\r
- institute patent litigation against any entity (including a\r
- cross-claim or counterclaim in a lawsuit) alleging that the Work\r
- or a Contribution incorporated within the Work constitutes direct\r
- or contributory patent infringement, then any patent licenses\r
- granted to You under this License for that Work shall terminate\r
- as of the date such litigation is filed.\r
-\r
- 4. Redistribution. You may reproduce and distribute copies of the\r
- Work or Derivative Works thereof in any medium, with or without\r
- modifications, and in Source or Object form, provided that You\r
- meet the following conditions:\r
-\r
- (a) You must give any other recipients of the Work or\r
- Derivative Works a copy of this License; and\r
-\r
- (b) You must cause any modified files to carry prominent notices\r
- stating that You changed the files; and\r
-\r
- (c) You must retain, in the Source form of any Derivative Works\r
- that You distribute, all copyright, patent, trademark, and\r
- attribution notices from the Source form of the Work,\r
- excluding those notices that do not pertain to any part of\r
- the Derivative Works; and\r
-\r
- (d) If the Work includes a "NOTICE" text file as part of its\r
- distribution, then any Derivative Works that You distribute must\r
- include a readable copy of the attribution notices contained\r
- within such NOTICE file, excluding those notices that do not\r
- pertain to any part of the Derivative Works, in at least one\r
- of the following places: within a NOTICE text file distributed\r
- as part of the Derivative Works; within the Source form or\r
- documentation, if provided along with the Derivative Works; or,\r
- within a display generated by the Derivative Works, if and\r
- wherever such third-party notices normally appear. The contents\r
- of the NOTICE file are for informational purposes only and\r
- do not modify the License. You may add Your own attribution\r
- notices within Derivative Works that You distribute, alongside\r
- or as an addendum to the NOTICE text from the Work, provided\r
- that such additional attribution notices cannot be construed\r
- as modifying the License.\r
-\r
- You may add Your own copyright statement to Your modifications and\r
- may provide additional or different license terms and conditions\r
- for use, reproduction, or distribution of Your modifications, or\r
- for any such Derivative Works as a whole, provided Your use,\r
- reproduction, and distribution of the Work otherwise complies with\r
- the conditions stated in this License.\r
-\r
- 5. Submission of Contributions. Unless You explicitly state otherwise,\r
- any Contribution intentionally submitted for inclusion in the Work\r
- by You to the Licensor shall be under the terms and conditions of\r
- this License, without any additional terms or conditions.\r
- Notwithstanding the above, nothing herein shall supersede or modify\r
- the terms of any separate license agreement you may have executed\r
- with Licensor regarding such Contributions.\r
-\r
- 6. Trademarks. This License does not grant permission to use the trade\r
- names, trademarks, service marks, or product names of the Licensor,\r
- except as required for reasonable and customary use in describing the\r
- origin of the Work and reproducing the content of the NOTICE file.\r
-\r
- 7. Disclaimer of Warranty. Unless required by applicable law or\r
- agreed to in writing, Licensor provides the Work (and each\r
- Contributor provides its Contributions) on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
- implied, including, without limitation, any warranties or conditions\r
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
- PARTICULAR PURPOSE. You are solely responsible for determining the\r
- appropriateness of using or redistributing the Work and assume any\r
- risks associated with Your exercise of permissions under this License.\r
-\r
- 8. Limitation of Liability. In no event and under no legal theory,\r
- whether in tort (including negligence), contract, or otherwise,\r
- unless required by applicable law (such as deliberate and grossly\r
- negligent acts) or agreed to in writing, shall any Contributor be\r
- liable to You for damages, including any direct, indirect, special,\r
- incidental, or consequential damages of any character arising as a\r
- result of this License or out of the use or inability to use the\r
- Work (including but not limited to damages for loss of goodwill,\r
- work stoppage, computer failure or malfunction, or any and all\r
- other commercial damages or losses), even if such Contributor\r
- has been advised of the possibility of such damages.\r
-\r
- 9. Accepting Warranty or Additional Liability. While redistributing\r
- the Work or Derivative Works thereof, You may choose to offer,\r
- and charge a fee for, acceptance of support, warranty, indemnity,\r
- or other liability obligations and/or rights consistent with this\r
- License. However, in accepting such obligations, You may act only\r
- on Your own behalf and on Your sole responsibility, not on behalf\r
- of any other Contributor, and only if You agree to indemnify,\r
- defend, and hold each Contributor harmless for any liability\r
- incurred by, or claims asserted against, such Contributor by reason\r
- of your accepting any such warranty or additional liability.\r
-\r
- END OF TERMS AND CONDITIONS\r
-\r
- APPENDIX: How to apply the Apache License to your work.\r
-\r
- To apply the Apache License to your work, attach the following\r
- boilerplate notice, with the fields enclosed by brackets "[]"\r
- replaced with your own identifying information. (Don't include\r
- the brackets!) The text should be enclosed in the appropriate\r
- comment syntax for the file format. We also recommend that a\r
- file or class name and description of purpose be included on the\r
- same "printed page" as the copyright notice for easier\r
- identification within third-party archives.\r
-\r
- Copyright [yyyy] [name of copyright owner]\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_AT_H__
-#define __TCORE_AT_H__
+#ifndef __AT_H__
+#define __AT_H__
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <tcore.h>
#include <queue.h>
-#define ZERO 0
-
-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 */
+#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 */
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);
-typedef struct tcore_at_response TcoreATResponse;
-typedef struct tcore_at_request TcoreATRequest;
+void tcore_at_process_binary_data(TcoreAT *at, gchar *position, guint data_len);
+gboolean tcore_at_add_hook(TcoreHal *hal, void *hook_func);
-void tcore_at_process_binary_data(TcoreAT *at,char *position,int data_len);
-int sum_4_bytes(char* posn);
+TcoreAT *tcore_at_new(TcoreHal *hal);
+void tcore_at_free(TcoreAT *at);
-gboolean tcore_at_add_hook(TcoreHal *hal, void *hook_func);
-TcoreAT* tcore_at_new(TcoreHal *hal);
-void tcore_at_free(TcoreAT *at);
-
-TReturn tcore_at_buf_write(TcoreAT *at, unsigned int data_len,
- const char *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);
-
-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);
-
-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);
-
-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);
-__END_DECLS
+TelReturn tcore_at_buf_write(TcoreAT *at, guint data_len, const gchar *data);
+TelReturn tcore_at_set_request(TcoreAT *at, TcoreAtRequest *req, gboolean send);
+TcoreAtRequest *tcore_at_get_request(TcoreAT *at);
+TcoreAtResponse *tcore_at_get_response(TcoreAT *at);
+
+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);
+
+TcoreAtRequest *tcore_at_request_new(const gchar *cmd, const gchar *prefix, TcoreAtCommandType type);
+void tcore_at_request_free(TcoreAtRequest *at_req);
+
+gboolean tcore_at_process(TcoreAT *at, guint data_len, const gchar *data);
+
+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);
+
+TelReturn tcore_at_prepare_and_send_request(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);
+
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __AT_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_CALL_H__
-#define __TCORE_CO_CALL_H__
-
-#include <core_object.h>
-
-__BEGIN_DECLS
-
-#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,
-};
-
-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_cli_mode {
- TCORE_CALL_CLI_MODE_DEFAULT,
- TCORE_CALL_CLI_MODE_PRESENT,
- TCORE_CALL_CLI_MODE_RESTRICT,
-};
-
-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 (*send_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 (*mute)(CoreObject *o, UserRequest *ur);
- TReturn (*unmute)(CoreObject *o, UserRequest *ur);
- TReturn (*get_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);
-};
-
-/* To be removed later */
-struct tcore_call_information_operations {
- void (*mo_call_col)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*mo_call_waiting)(CoreObject *o, enum tcore_notification_command);
- void (*mo_call_cug)(CoreObject *o, int cug_index);
- void (*mo_call_forwarded)(CoreObject *o, enum tcore_notification_command);
- void (*mo_call_barred_incoming)(CoreObject *o, enum tcore_notification_command);
- void (*mo_call_barred_outgoing)(CoreObject *o, enum tcore_notification_command);
- void (*mo_call_deflected)(CoreObject *o, enum tcore_notification_command);
- void (*mo_call_clir_suppression_reject)(CoreObject *o, enum tcore_notification_command);
- void (*mo_call_cfu)(CoreObject *o, enum tcore_notification_command);
- void (*mo_call_cfc)(CoreObject *o, enum tcore_notification_command);
- 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, enum tcore_notification_command);
- void (*mt_call_cug_call)(CoreObject *o, int cug_index, char *number);
- void (*mt_call_deflected_call)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*mt_call_transfered)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*call_held)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*call_active)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*call_joined)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*call_released_on_hold)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*call_transfer_alert)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*call_transfered)(CoreObject *o, char *number, enum tcore_notification_command);
- void (*call_cf_check_message)(CoreObject *o, char *number, enum tcore_notification_command);
-};
-
-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,
- struct tcore_call_operations *ops, TcoreHal *hal);
-void tcore_call_free( CoreObject *o);
-
-void tcore_call_override_ops(CoreObject *o,
- struct tcore_call_operations *call_ops,
- struct tcore_call_control_operations *control_ops);
-
-// Call Object API
-CallObject *tcore_call_object_new( CoreObject *o, int id );
-gboolean tcore_call_object_free( CoreObject *o, CallObject *co );
-
-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( CallObject *co, enum tcore_call_cli_mode mode, char *num );
-enum tcore_call_cli_mode tcore_call_object_get_cli_mode( CallObject *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 );
-
-
-// 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 );
-
-/* To be removed later */
-void tcore_call_information_set_operations( CoreObject *o, struct tcore_call_information_operations *ops );
-
-__END_DECLS
+#ifndef _CO_CALL_H__
+#define _CO_CALL_H__
+
+#include "core_object.h"
+#include <tel_call.h>
+#include <tel_return.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+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
#endif
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_CONTEXT_H__
-#define __TCORE_CO_CONTEXT_H__
+#ifndef __CO_CONTEXT_H__
+#define __CO_CONTEXT_H__
-#include <core_object.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
-__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,
-};
-
-enum co_context_role {
- CONTEXT_ROLE_UNKNOWN,
- CONTEXT_ROLE_INTERNET,
- CONTEXT_ROLE_MMS,
- CONTEXT_ROLE_PREPAID_INTERNET,
- CONTEXT_ROLE_PREPAID_MMS,
- CONTEXT_ROLE_TETHERING,
- 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
-};
+#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 *o);
-
-CoreObject *tcore_context_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
-
-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 int id);
-unsigned int 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_dns1(CoreObject *o, const char *dns);
-char *tcore_context_get_dns1(CoreObject *o);
-TReturn tcore_context_set_dns2(CoreObject *o, const char *dns);
-char *tcore_context_get_dns2(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_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_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_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);
+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);
+
+gboolean tcore_context_get_data_compression(CoreObject *co, TcoreContextDComp *comp);
+gboolean tcore_context_set_data_compression(CoreObject *co, TcoreContextDComp comp);
-TReturn tcore_context_set_ipv4_addr(CoreObject *o, const char *addr);
-char *tcore_context_get_ipv4_addr(CoreObject *o);
-TReturn tcore_context_set_ipv4_dns(CoreObject *o, const char *dns1, const char *dns2);
-char *tcore_context_get_ipv4_dns1(CoreObject *o);
-char *tcore_context_get_ipv4_dns2(CoreObject *o);
-char *tcore_context_get_ipv4_gw(CoreObject *o);
-TReturn tcore_context_set_ipv4_devname(CoreObject *o, const char *name);
-char *tcore_context_get_ipv4_devname(CoreObject *o);
+gboolean tcore_context_get_header_compression(CoreObject *co, TcoreContextHComp *comp);
+gboolean tcore_context_set_header_compression(CoreObject *co, TcoreContextHComp comp);
-__END_DECLS
+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__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_GPS_H__
-#define __TCORE_CO_GPS_H__
-
-#include <core_object.h>
+#ifndef __CO_GPS_H__
+#define __CO_GPS_H__
-__BEGIN_DECLS
+#include "core_object.h"
+#include <tel_gps.h>
+#include <tel_return.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
-struct tcore_gps_operations {
- TReturn (*confirm_measure_pos)(CoreObject *o, UserRequest *ur);
- TReturn (*set_frequency_aiding)(CoreObject *o, UserRequest *ur);
-};
+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;
-CoreObject *tcore_gps_new(TcorePlugin *p,
- struct tcore_gps_operations *ops, TcoreHal *hal);
-void tcore_gps_free(CoreObject *o);
-void tcore_gps_override_ops(CoreObject *o, struct tcore_gps_operations *gps_ops);
+CoreObject *tcore_gps_new(TcorePlugin *plugin, TcoreGpsOps *ops, TcoreHal *hal);
+void tcore_gps_free(CoreObject *co);
-__END_DECLS
+gboolean tcore_gps_set_ops(CoreObject *co, TcoreGpsOps *ops);
+void tcore_gps_override_ops(CoreObject *co, TcoreGpsOps *ops);
+#ifdef __cplusplus
+}
#endif
+
+#endif/* __CO_GPS_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_MODEM_H__
-#define __TCORE_CO_MODEM_H__
-
-#include <core_object.h>
-
-__BEGIN_DECLS
+#ifndef __CO_MODEM_H__
+#define __CO_MODEM_H__
+#include "core_object.h"
+#include <tel_modem.h>
+#include <tel_return.h>
-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 (*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);
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
-CoreObject *tcore_modem_new(TcorePlugin *p,
- struct tcore_modem_operations *ops, TcoreHal *hal);
-void tcore_modem_free(CoreObject *o);
+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;
-void tcore_modem_override_ops(CoreObject *o, struct tcore_modem_operations *modem_ops);
+CoreObject *tcore_modem_new(TcorePlugin *plugin, TcoreModemOps *ops, TcoreHal *hal);
+void tcore_modem_free(CoreObject *co);
-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);
+gboolean tcore_modem_set_ops(CoreObject *co, TcoreModemOps *ops);
+void tcore_modem_override_ops(CoreObject *co, TcoreModemOps *ops);
-__END_DECLS
+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);
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __CO_MODEM_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_NETWORK_H__
-#define __TCORE_CO_NETWORK_H__
-
-#include <core_object.h>
-
-__BEGIN_DECLS
-
-
-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,
-};
-
-struct tcore_network_operator_info {
- 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);
-};
-
-CoreObject *tcore_network_new(TcorePlugin *plugin,
- struct tcore_network_operations *ops, TcoreHal *hal);
+#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);
-void tcore_network_override_ops(CoreObject *o, struct tcore_network_operations *network_ops);
+gboolean tcore_network_set_ops(CoreObject *co, TcoreNetworkOps *ops);
+void tcore_network_override_ops(CoreObject *co, TcoreNetworkOps *ops);
+
-TReturn tcore_network_set_plmn(CoreObject *co, const char *plmn);
-char *tcore_network_get_plmn(CoreObject *co);
+gboolean tcore_network_get_cs_reg_status(CoreObject *co,
+ TelNetworkRegStatus *cs_status);
+gboolean tcore_network_set_cs_reg_status(CoreObject *co,
+ TelNetworkRegStatus cs_status);
-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);
+gboolean tcore_network_get_ps_reg_status(CoreObject *co,
+ TelNetworkRegStatus *ps_status);
+gboolean tcore_network_set_ps_reg_status(CoreObject *co,
+ TelNetworkRegStatus ps_status);
-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);
+gboolean tcore_network_get_access_technology(CoreObject *co,
+ TelNetworkAct *act);
+gboolean tcore_network_set_access_technology(CoreObject *co,
+ TelNetworkAct act);
-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);
+gboolean tcore_network_get_roam_state(CoreObject *co, gboolean *state);
+gboolean tcore_network_set_roam_state(CoreObject *co, gboolean state);
-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);
+gboolean tcore_network_get_lac(CoreObject *co, unsigned int *lac);
+gboolean tcore_network_set_lac(CoreObject *co, unsigned int lac);
-TReturn tcore_network_set_rac(CoreObject *co, unsigned int rac);
-TReturn tcore_network_get_rac(CoreObject *co, unsigned int *result);
+gboolean tcore_network_get_rac(CoreObject *co, unsigned int *rac);
+gboolean tcore_network_set_rac(CoreObject *co, unsigned int rac);
-TReturn tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id);
-TReturn tcore_network_get_cell_id(CoreObject *co, unsigned int *result);
+gboolean tcore_network_get_cell_id(CoreObject *co, unsigned int *cell_id);
+gboolean tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id);
-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);
+/* 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);
-TReturn tcore_network_operator_info_add(CoreObject *co,
- struct tcore_network_operator_info *noi);
+gboolean tcore_network_get_short_name(CoreObject *co, char **short_name);
+gboolean tcore_network_set_short_name(CoreObject *co, const char *short_name);
-struct tcore_network_operator_info *tcore_network_operator_info_find(CoreObject *co,
- const char *mcc, const char *mnc);
+gboolean tcore_network_get_long_name(CoreObject *co, char **long_name);
+gboolean tcore_network_set_long_name(CoreObject *co, const char *long_name);
-__END_DECLS
+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);
+
+#ifdef __cplusplus
+}
+#endif
#endif
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_PHONEBOOK_H__
-#define __TCORE_CO_PHONEBOOK_H__
-
-#include <core_object.h>
+#ifndef __CO_PHONEBOOK_H__
+#define __CO_PHONEBOOK_H__
-__BEGIN_DECLS
+#include "core_object.h"
+#include <tel_phonebook.h>
+#include <tel_return.h>
-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);
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
-CoreObject *tcore_phonebook_new(TcorePlugin *p,
- struct tcore_phonebook_operations *ops, TcoreHal *hal);
-void tcore_phonebook_free(CoreObject *n);
+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;
-void tcore_phonebook_override_ops(CoreObject *o, struct tcore_phonebook_operations *phonebook_ops);
+CoreObject *tcore_phonebook_new(TcorePlugin *p, TcorePbOps *ops, TcoreHal *hal);
+void tcore_phonebook_free(CoreObject *co);
-gboolean tcore_phonebook_get_status(CoreObject *o);
-gboolean tcore_phonebook_set_status(CoreObject *o, gboolean b_init);
+gboolean tcore_phonebook_set_ops(CoreObject *co, TcorePbOps *ops);
+void tcore_phonebook_override_ops(CoreObject *co, TcorePbOps *phonebook_ops);
-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_status(CoreObject *co, gboolean *init_status);
+gboolean tcore_phonebook_set_status(CoreObject *co, gboolean init_status);
-enum tel_phonebook_type tcore_phonebook_get_selected_type(CoreObject *o);
-gboolean tcore_phonebook_set_selected_type(CoreObject *o, enum tel_phonebook_type t);
+gboolean tcore_phonebook_get_support_list(CoreObject *co, TelPbList **pb_list);
+gboolean tcore_phonebook_set_support_list(CoreObject *co, TelPbList *pb_list);
-__END_DECLS
+gboolean tcore_phonebook_get_selected_type(CoreObject *co, TelPbType *pb_type);
+gboolean tcore_phonebook_set_selected_type(CoreObject *co, TelPbType pb_type);
+#ifdef __cplusplus
+}
#endif
+
+#endif /*__CO_PHONEBOOK_H__*/
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_PS_H__
-#define __TCORE_CO_PS_H__
+#ifndef __CO_PS_H__
+#define __CO_PS_H__
#include <core_object.h>
+#include <tel_return.h>
#include <co_context.h>
-__BEGIN_DECLS
-
+#ifdef __cplusplus
+extern "C" {
+#endif
-#define PS_MAX_CID 4
+#define TCORE_PS_MAX_CID 4
-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);
-};
+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;
CoreObject *tcore_ps_new(TcorePlugin *p,
- struct tcore_ps_operations *ops, TcoreHal *hal);
+ TcorePsOps *ops, TcoreHal *hal);
void tcore_ps_free(CoreObject *o);
-void tcore_ps_override_ops(CoreObject *o, struct tcore_ps_operations *ps_ops);
+gboolean tcore_ps_set_ops(CoreObject *o, TcorePsOps *ps_ops);
+void tcore_ps_override_ops(CoreObject *o, TcorePsOps *ps_ops);
-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_add_context(CoreObject *o, CoreObject *ctx_o);
+gboolean tcore_ps_remove_context(CoreObject *o, CoreObject *ctx_o);
-TReturn tcore_ps_set_online(CoreObject *o, gboolean state);
+gboolean tcore_ps_set_online(CoreObject *o, gboolean state);
-TReturn tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, unsigned int cid);
-TReturn tcore_ps_clear_context_id(CoreObject *o, CoreObject *context);
+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_define_context(CoreObject *o, CoreObject *ps_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);
-
-__END_DECLS
+CoreObject *tcore_ps_ref_context_by_role(CoreObject *o, TcoreContextRole role);
+gboolean tcore_ps_ref_context_by_id(CoreObject *o, guint id, GSList **list);
+gboolean tcore_ps_is_active_apn(CoreObject *o, const char* apn);
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __CO_PS_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_SAP_H__
-#define __TCORE_CO_SAP_H__
-
-#include <core_object.h>
+#ifndef __CO_SAP_H__
+#define __CO_SAP_H__
-__BEGIN_DECLS
+#include "core_object.h"
+#include <tel_sap.h>
-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);
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
-CoreObject *tcore_sap_new(TcorePlugin *p,
- struct tcore_sap_operations *ops, TcoreHal *hal);
-void tcore_sap_free(CoreObject *o);
+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;
-void tcore_sap_override_ops(CoreObject *o, struct tcore_sap_operations *sap_ops);
+CoreObject *tcore_sap_new(TcorePlugin *plugin, TcoreSapOps *sap_ops, TcoreHal *hal);
+void tcore_sap_free(CoreObject *co);
-__END_DECLS
+gboolean tcore_sap_set_ops(CoreObject *co, TcoreSapOps *ops);
+void tcore_sap_override_ops(CoreObject *co, TcoreSapOps *sap_ops);
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __CO_SAP_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_SAT_H__
-#define __TCORE_CO_SAT_H__
+#ifndef __CO_SAT_H__
+#define __CO_SAT_H__
#include <core_object.h>
+#include "type/sat_internal.h"
+#include <tel_return.h>
-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
-};
-
-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;
-/*
- TelSatRefreshIndInfo_t refresh;
- TelSatProvideLocalInfoIndInfo_t provideLocInfo;
- TelSatLaunchBrowserIndInfo_t launchBrowser;
- TelSatSetupIdleModeTextIndInfo_t idleText;
- TelSatSendDtmfIndInfo_t sendDtmf;
- TelSatLanguageNotificationIndInfo_t languageNotification;
- TelSatOpenChannelIndInfo_t openChannel;
- TelSatCloseChannelIndInfo_t closeChannel;
- TelSatReceiveDataIndInfo_t receiveData;
- TelSatSendDataIndInfo_t sendData;
- TelSatGetChannelStatusIndInfo_t getChannelStatus;
-*/
- } data;
-};
-
-struct tcore_sat_operations {
- TReturn (*envelope)(CoreObject *o, UserRequest *ur);
- TReturn (*terminal_response)(CoreObject *o, UserRequest *ur);
-};
-
-int tcore_sat_decode_proactive_command(unsigned char* tlv_origin, unsigned int tlv_length, struct tcore_sat_proactive_command* decoded_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,
- struct tcore_sat_operations *ops, TcoreHal *hal);
-void tcore_sat_free(CoreObject *n);
-
-void tcore_sat_override_ops(CoreObject *o, struct tcore_sat_operations *sat_ops);
+#ifdef __cplusplus
+ extern "C" {
+#endif
+/* 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
+
+#endif /* __CO_SAT_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#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);
-};
-
-CoreObject *tcore_sim_new(TcorePlugin *p,
- struct tcore_sim_operations *ops, TcoreHal *hal);
-void tcore_sim_free(CoreObject *n);
-
-void tcore_sim_override_ops(CoreObject *o,
- struct tcore_sim_operations *sim_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, 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, struct tel_sim_service_table *svct);
-
-gboolean tcore_sim_get_cphs_status(CoreObject *o);
-gboolean tcore_sim_set_cphs_status(CoreObject *o, gboolean b_support);
-
-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_sst(struct tel_sim_sst *p_sst, 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_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_xdn(struct tel_sim_dialing_number *p_xdn, unsigned char *p_in, int in_length);
-char *tcore_sim_encode_xdn(int out_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_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);
-gboolean tcore_sim_encode_mbi(char *p_out, int out_length, struct tel_sim_mbi *p_mbi);
-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);
-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);
-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);
-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);
-
-__END_DECLS
+#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;
+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, int 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, char *num);
+gboolean tcore_sim_encode_xdn(char *alpha_id, char *num, char *enc_xdn, int enc_xdn_len);
+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__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_SMS_H__
-#define __TCORE_CO_SMS_H__
-
-#include <core_object.h>
-
-__BEGIN_DECLS
-
-
-#define nDefaultSMSPWithoutAlphaId 28
-
-#define SMSPValidDestAddr 0x01
-#define SMSPValidSvcAddr 0x02
-#define SMSPValidPID 0x04
-#define SMSPValidDCS 0x08
-#define SMSPValidVP 0x10
+#ifndef __CO_SMS_H__
+#define __CO_SMS_H__
-#define nDestAddrOffset 1
-#define nSCAAddrOffset 13
-#define nPIDOffset 25
-#define nDCSOffset 26
-#define nVPOffset 27
+#define tcore_sms_convert_to_semioctet_length(length) ((length + 1) / 2)
-struct property_sms_info {
- int g_trans_id;
- int SMSPRecordLen;
-};
+#include "core_object.h"
+#include <tel_sms.h>
+#include <tel_return.h>
-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_stored_msg_cnt)(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);
-};
-
-
-int _tcore_util_sms_encode_smsParameters(const struct telephony_sms_Params *incoming, unsigned char *data, int SMSPRecordLen);
-gboolean tcore_sms_get_ready_status(CoreObject *o);
-gboolean tcore_sms_set_ready_status(CoreObject *o, int status);
-
-CoreObject* tcore_sms_new(TcorePlugin *p,
- struct tcore_sms_operations *ops, TcoreHal *hal);
-void tcore_sms_free(CoreObject * n);
-
-void tcore_sms_override_ops(CoreObject *o, struct tcore_sms_operations *sms_ops);
-
-__END_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
+}
#endif
+#endif /*__CO_SMS_H__*/
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CO_SS_H__
-#define __TCORE_CO_SS_H__
-
-#include <core_object.h>
-
-__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 */
-};
+#ifndef __CO_SS_H__
+#define __CO_SS_H__
-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
-};
+#include "core_object.h"
+#include <tel_ss.h>
+#include <tel_return.h>
-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
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef struct ussd_session UssdSession;
-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_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,
- struct tcore_ss_operations *ops, TcoreHal *hal);
-void tcore_ss_free(CoreObject *o);
-
-void tcore_ss_override_ops(CoreObject *o, struct tcore_ss_operations *ss_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);
+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
-__END_DECLS
#endif
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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__ */
/*
- * libtcore
+ * tel-headers
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TYPE_GPS_H__
-#define __TYPE_GPS_H__
-
-__BEGIN_DECLS
-
-struct treq_gps_set_frequency_aiding {
- unsigned char enable;
-};
+#ifndef __TEL_IF_H__
+#define __TEL_IF_H__
-struct tresp_gps_set_frequency_aiding {
- TReturn result;
-};
+/** Telephony service name */
+#define TELEPHONY_SERVICE "org.tizen.telephony"
-struct tnoti_gps_frequency_aiding {
- unsigned char lock_status;
- unsigned char afc_update;
-};
-
-__END_DECLS
+/** Telephony object path */
+#define TELEPHONY_OBJECT_PATH "/org/tizen/telephony"
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __TEL_IF_H__ */
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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__ */
+
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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_ */
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_COMMUNICATOR_H__
-#define __TCORE_COMMUNICATOR_H__
-
-__BEGIN_DECLS
-
-struct tcore_communitor_operations {
- TReturn (*send_response)(Communicator *comm, UserRequest *ur,
- enum tcore_response_command command,
- unsigned int data_len, const void *data);
-
- TReturn (*send_notification)(Communicator *comm, CoreObject *source,
- enum tcore_notification_command command,
- unsigned int data_len, const void *data);
-};
+#ifndef __COMMUNICATOR_H__
+#define __COMMUNICATOR_H__
-Communicator* tcore_communicator_new(TcorePlugin *plugin, const char *name,
- struct tcore_communitor_operations *ops);
-void tcore_communicator_free();
-
-TcorePlugin* tcore_communicator_ref_plugin(Communicator *comm);
-const char* tcore_communicator_ref_name(Communicator *comm);
+#ifdef __cplusplus
+extern "C" {
+#endif
-TReturn tcore_communicator_link_user_data(Communicator *comm, void *data);
-void* tcore_communicator_ref_user_data(Communicator *comm);
+typedef struct {
+ TelReturn (*send_notification)(Communicator *comm,
+ TcorePlugin *source, gint command, unsigned int data_len, const void *data);
+} TcoreCommunicatorOps ;
-TReturn tcore_communicator_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 tcore_communicator_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);
-TReturn tcore_communicator_dispatch_request(Communicator *comm, UserRequest *ur);
+TelReturn tcore_communicator_link_user_data(Communicator *comm, void *data);
+void *tcore_communicator_ref_user_data(Communicator *comm);
-__END_DECLS
+TelReturn tcore_communicator_send_notification(Communicator *comm,
+ TcorePlugin *source, gint command, guint data_len, const void *data);
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __COMMUNICATOR_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_CORE_OBJECT_H__
-#define __TCORE_CORE_OBJECT_H__
+#ifndef __CORE_OBJECT_H__
+#define __CORE_OBJECT_H__
-__BEGIN_DECLS
+#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_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_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; } \
return r; \
}
-typedef struct tcore_object_mapping_tbl object_mapping_table_t;
+#define GET_OBJECT_TYPE(command) ((command & 0x0FF00000) | CORE_OBJECT_TYPE_DEFAULT)
-typedef void (*tcore_object_free_hook)(CoreObject *co);
-typedef void (*tcore_object_clone_hook)(CoreObject *src, CoreObject *dest);
-typedef gboolean (*tcore_object_callback)(CoreObject *co,
- const void *event_info, void *user_data);
-typedef TReturn (*tcore_object_dispatcher)(CoreObject *co, UserRequest *ur);
+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 (*tcore_object_init)(TcorePlugin *plugin, CoreObject *co);
-typedef void (*tcore_object_deinit)(TcorePlugin *plugin, CoreObject *co);
+typedef gboolean (*TcoreObjectInit)(TcorePlugin *plugin, CoreObject *co);
+typedef void (*TcoreObjectDeinit)(TcorePlugin *plugin, CoreObject *co);
/* Core Object Initializers */
-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;
+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;
/* To be updated based on New modules */
-};
+} TcoreObjectInitializer;
/* Core Object De-initializers */
-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;
+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;
/* To be updated based on New modules */
-};
+} TcoreObjectDeinitializer;
CoreObject *tcore_object_new(TcorePlugin *plugin, TcoreHal *hal);
void tcore_object_free(CoreObject *co);
-TReturn tcore_object_set_free_hook(CoreObject *co, tcore_object_free_hook free_hook);
-TReturn tcore_object_set_clone_hook(CoreObject *co, tcore_object_clone_hook clone_hook);
+TelReturn tcore_object_set_free_hook(CoreObject *co,
+ TcoreObjectFreeHook free_hook);
+TelReturn tcore_object_set_clone_hook(CoreObject *co,
+ TcoreObjectCloneHook clone_hook);
CoreObject *tcore_object_clone(CoreObject *src, TcorePlugin *new_parent);
CoreObject *tcore_object_clone_template_object(TcorePlugin *p,
- unsigned int co_type);
+ guint co_type);
-TReturn tcore_object_set_plugin(CoreObject *co, TcorePlugin *plugin);
+TelReturn tcore_object_set_plugin(CoreObject *co, TcorePlugin *plugin);
TcorePlugin *tcore_object_ref_plugin(CoreObject *co);
-TReturn tcore_object_link_object(CoreObject *co, void *object);
+TelReturn 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);
+TelReturn tcore_object_set_type(CoreObject *co, guint type);
+guint tcore_object_get_type(CoreObject *co);
-TReturn tcore_object_set_hal(CoreObject *co, TcoreHal *hal);
+TelReturn 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);
+TelReturn 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, tcore_object_dispatcher func);
-TReturn tcore_object_dispatch_request(CoreObject *co, UserRequest *ur);
-
-TReturn tcore_object_add_callback(CoreObject *co, const char *event, tcore_object_callback callback, void *user_data);
-TReturn tcore_object_del_callback(CoreObject *co, const char *event, tcore_object_callback callback);
-TReturn tcore_object_override_callback(CoreObject *co, const char *event, tcore_object_callback callback, void *user_data);
-TReturn tcore_object_emit_callback(CoreObject *co, const char *event, const void *event_info);
+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);
void *tcore_object_add_mapping_tbl_entry(void *mapping_tbl,
- unsigned int object_type, TcoreHal *hal);
+ guint 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,
- unsigned int co_type);
+ guint co_type);
void tcore_object_print_mapping_tbl(void *mapping_tbl);
-TReturn tcore_object_init_objects(TcorePlugin *plugin,
- struct object_initializer *initializer_list);
+TelReturn tcore_object_init_objects(TcorePlugin *plugin,
+ TcoreObjectInitializer *initializer_list);
void tcore_object_deinit_objects(TcorePlugin *plugin,
- struct object_deinitializer *deinitializer_list);
-
-
-__END_DECLS
+ TcoreObjectDeinitializer *deinitializer_list);
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __CORE_OBJECT_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_HAL_H__
-#define __TCORE_HAL_H__
+#ifndef __HAL_H__
+#define __HAL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
-__BEGIN_DECLS
+typedef void (*TcoreHalReceiveCallback)(TcoreHal *hal,
+ guint data_len, const 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 TcoreHookReturn (*TcoreHalSendHook)(TcoreHal *hal,
+ guint data_len, void *data, void *user_data);
-enum tcore_hal_recv_data_type {
+typedef void (*TcoreHalSetupNetifCallback)(CoreObject *co,
+ gint result, const gchar* devname, void *user_data);
+
+typedef enum {
TCORE_HAL_RECV_INDICATION,
TCORE_HAL_RECV_RESPONSE,
TCORE_HAL_RECV_NOTIFICATION,
TCORE_HAL_RECV_UNKNOWN
-};
+} TcoreHalRecvDataType;
-enum tcore_hal_mode {
+typedef enum {
TCORE_HAL_MODE_UNKNOWN,
TCORE_HAL_MODE_AT,
TCORE_HAL_MODE_CUSTOM,
- 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);
+ 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);
-TReturn tcore_hal_set_name(TcoreHal *hal, const char *name);
-char *tcore_hal_get_name(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);
-enum tcore_hal_mode tcore_hal_get_mode(TcoreHal *hal);
-TReturn tcore_hal_set_mode(TcoreHal *hal, enum tcore_hal_mode mode);
+TcoreHalMode tcore_hal_get_mode(TcoreHal *hal);
+TelReturn tcore_hal_set_mode(TcoreHal *hal, TcoreHalMode mode);
-TReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag);
+TelReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag);
-TReturn tcore_hal_link_user_data(TcoreHal *hal, void *user_data);
+TelReturn 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_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);
+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);
-TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
- TcoreHalSetupNetifCallback func,
- void *user_data, unsigned int cid,
- gboolean enable);
-
-__END_DECLS
+TelReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
+ TcoreHalSetupNetifCallback func, void *user_data,
+ guint cid, gboolean enable);
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __HAL_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#ifndef __TCORE_LOG_H__
#define __TCORE_LOG_H__
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
#ifdef FEATURE_DLOG_DEBUG
*/
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...) 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:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
-#define warn(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
-#define err(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##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)
#else
#endif
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Arijit Sen <arijit.sen@samsung.com>
+ * 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.
} tcore_cmux_mode;
/* CMUX Channel */
-typedef struct cmux_channel tcore_cmux_channel;
+typedef struct cmux_channel TcoreCmuxChannel;
/* Global MUX Object */
-typedef struct cmux_obj tcore_cmux_object;
+typedef struct cmux_obj TcoreCmuxObject;
/* CMUX setup complete callback prototype */
-typedef void (*cmux_setup_complete_cb_func) (gpointer user_data);
+typedef void (*CmuxSetupCompleteCbFunc) (gpointer user_data);
/* CMUX setup callback prototype */
-typedef void (*cmux_setup_cb_func) (int channel_id, TcoreHal *hal,
- gpointer user_data);
+typedef void (*CmuxSetupCbFunc) (guint channel_id,
+ TcoreHal *hal, gpointer user_data);
/* CMUX Channel close callback prototype */
-typedef void (*cmux_channel_close_cb_func) (TcoreHal *hal, gpointer user_data);
+typedef void (*CmuxChannelCloseCbFunc) (TcoreHal *hal, gpointer user_data);
/* CMUX initialization - Internal and Kernel */
-TReturn tcore_cmux_init(TcoreHal *phy_hal, unsigned int frame_size,
- TcorePendingResponseCallback resp_cb, void *resp_cb_data);
+TelReturn tcore_cmux_init(TcoreHal *phy_hal, guint frame_size,
+ TcorePendingResponseCallback resp_cb, void *resp_cb_data);
/* Setup Internal CMUX */
-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);
+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);
/* Close CMUX */
void tcore_cmux_close(TcoreHal *phy_hal,
- cmux_channel_close_cb_func channel_close_cb, gpointer channel_close_user_data);
+ CmuxChannelCloseCbFunc channel_close_cb, gpointer channel_close_cb_data);
/* HAL Receive for Internal CMUX */
void tcore_cmux_rcv_from_hal(TcoreHal *hal, unsigned char *data, size_t length);
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_PLUGIN_H__
-#define __TCORE_PLUGIN_H__
+#ifndef __PLUGIN_H__
+#define __PLUGIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
-__BEGIN_DECLS
+typedef void (*TcoreResponseCallback)(gint result, const void *response, void *user_data);
enum tcore_plugin_priority {
TCORE_PLUGIN_PRIORITY_HIGH = -100,
TcorePlugin *tcore_plugin_new(Server *server,
const struct tcore_plugin_define_desc *desc,
- const char *filename, void *handle);
+ const gchar *filename, void *handle);
void tcore_plugin_free(TcorePlugin *plugin);
const struct tcore_plugin_define_desc *tcore_plugin_get_description(TcorePlugin *plugin);
-char *tcore_plugin_get_filename(TcorePlugin *plugin);
-char *tcore_plugin_ref_plugin_name(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);
-TReturn tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data);
+TelReturn tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data);
void *tcore_plugin_ref_user_data(TcorePlugin *plugin);
-TReturn tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co);
+TelReturn tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co);
+TelReturn 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);
-TReturn tcore_plugin_core_object_event_emit(TcorePlugin *plugin,
- const char *event, const void *event_info);
+TelReturn tcore_plugin_core_object_event_emit(TcorePlugin *plugin,
+ const gchar *event, const void *event_info);
-TReturn tcore_plugin_link_property(TcorePlugin *plugin, const char *key,
+TelReturn tcore_plugin_link_property(TcorePlugin *plugin, const gchar *key,
void *data);
-void *tcore_plugin_ref_property(TcorePlugin *plugin, const char *key);
+void *tcore_plugin_ref_property(TcorePlugin *plugin, const gchar *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__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_QUEUE_H__
-#define __TCORE_QUEUE_H__
+#ifndef __QUEUE_H__
+#define __QUEUE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
-__BEGIN_DECLS
+typedef void(*TcorePendingSendCallback)(TcorePending *p,
+ TelReturn send_status, void *user_data);
-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);
-enum tcore_pending_priority {
+typedef void(*TcorePendingResponseCallback)(TcorePending *p,
+ guint data_len, const void *data, void *user_data);
+
+typedef enum {
TCORE_PENDING_PRIORITY_IMMEDIATELY = 0,
TCORE_PENDING_PRIORITY_HIGH = 100,
TCORE_PENDING_PRIORITY_DEFAULT = 200,
TCORE_PENDING_PRIORITY_LOW = 300,
-};
-
-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);
-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_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);
-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
+} 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_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);
+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_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__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_SERVER_H__
-#define __TCORE_SERVER_H__
+#ifndef __SERVER_H__
+#define __SERVER_H__
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
-typedef enum tcore_hook_return (*tcore_server_request_hook)(Server *s,
- UserRequest *ur, void *user_data);
-typedef enum tcore_hook_return (*tcore_server_notification_hook)(Server *s,
- CoreObject *source, enum tcore_notification_command command,
- unsigned int data_len, void *data, void *user_data);
+typedef TcoreHookReturn (*TcoreServerNotificationHook)(Server *s,
+ TcoreServerNotification command, guint data_len, void *data, void *user_data);
Server *tcore_server_new();
void tcore_server_free(Server *s);
-TReturn tcore_server_run(Server *s);
-TReturn tcore_server_exit(Server *s);
+TelReturn tcore_server_run(Server *s);
+TelReturn tcore_server_exit(Server *s);
-TReturn tcore_server_add_plugin(Server *s, TcorePlugin *plugin);
+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 char *name);
+TcorePlugin *tcore_server_find_plugin(Server *s, const gchar *name);
-TReturn tcore_server_add_communicator(Server *s, Communicator *comm);
+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 char *name);
+Communicator *tcore_server_find_communicator(Server *s, const gchar *name);
-TReturn tcore_server_add_storage(Server *s, Storage *strg);
+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);
-Storage * tcore_server_find_storage(Server *s, const char *name);
+TcoreStorage * tcore_server_find_storage(Server *s, const gchar *name);
-TReturn tcore_server_add_template_object(Server *s, CoreObject *template_co);
+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, unsigned int type);
+CoreObject *tcore_server_find_template_object(Server *s, guint type);
-TReturn tcore_server_link_udev(Server *s, TcoreUdev *udev);
+TelReturn tcore_server_link_udev(Server *s, TcoreUdev *udev);
TcoreUdev *tcore_server_ref_udev(Server *s);
-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);
-
-TReturn tcore_server_add_request_hook(Server *s,
- enum tcore_request_command command,
- tcore_server_request_hook func, void *user_data);
-TReturn tcore_server_remove_request_hook(Server *s,
- tcore_server_request_hook func);
-TReturn tcore_server_add_notification_hook(Server *s,
- enum tcore_notification_command command,
- tcore_server_notification_hook func, void *user_data);
-TReturn tcore_server_remove_notification_hook(Server *s,
- tcore_server_notification_hook func);
+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);
+
+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);
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);
-GSList *tcore_server_get_cp_name_list(Server *s);
-const char *tcore_server_get_cp_name_by_plugin(TcorePlugin *plugin);
+ TcorePlugin *modem_plugin);
+
+const gchar *tcore_server_get_cp_name_by_plugin(TcorePlugin *plugin);
gboolean tcore_server_add_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
- unsigned int co_type, TcoreHal *hal);
+ 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);
+ TcoreHal *hal);
void *tcore_server_get_cp_mapping_tbl(TcorePlugin *modem_plugin);
void tcore_server_print_modems(TcorePlugin *plugin);
-TReturn tcore_server_load_modem_plugin(Server *s,
- TcorePlugin *modem_if_plugin,
- const char *name);
-void tcore_server_unload_modem_plugin(Server *s, TcorePlugin *modem_if_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);
-__END_DECLS
+GSList *tcore_server_get_modem_plugin_list(Server *s);
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __SERVER_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#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
+#ifndef __STORAGE_H__
+#define __STORAGE_H__
-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,
-
- STORAGE_KEY_TELEPHONY_SVC_PS,
- STORAGE_KEY_TELEPHONY_SVC_ROAM,
- 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,
- STORAGE_KEY_TELEPHONY_ZONE_ZUHAUSE,
- STORAGE_KEY_TELEPHONY_RSSI,
- STORAGE_KEY_TELEPHONY_SIM_SLOT,
+#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,
+
STORAGE_KEY_PACKET_SERVICE_STATE,
STORAGE_KEY_PACKET_INDICATOR_STATE,
- STORAGE_KEY_MESSAGE_NETWORK_MODE,
STORAGE_KEY_CELLULAR_STATE,
-
STORAGE_KEY_CELLULAR_PKT_TOTAL_RCV,
STORAGE_KEY_CELLULAR_PKT_TOTAL_SNT,
+
STORAGE_KEY_CELLULAR_PKT_LAST_RCV,
STORAGE_KEY_CELLULAR_PKT_LAST_SNT,
- 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_AUTOMATIC_TIME_UPDATE_BOOL,
- STORAGE_KEY_FLIGHT_MODE_BOOL,
-
- STORAGE_KEY_TELEPHONY_STRING = STORAGE_KEY_STRING,
- STORAGE_KEY_TELEPHONY_NWNAME,
- STORAGE_KEY_TELEPHONY_SPN_NAME,
- STORAGE_KEY_TELEPHONY_IMEI,
- STORAGE_KEY_TELEPHONY_SUBSCRIBER_NUMBER,
-
- STORAGE_KEY_TELEPHONY_SWVERSION,
- STORAGE_KEY_TELEPHONY_HWVERSION,
- STORAGE_KEY_TELEPHONY_IMEI_FACTORY_REBOOT,
- STORAGE_KEY_TELEPHONY_SIM_FACTORY_MODE,
- STORAGE_KEY_TELEPHONY_FACTORY_KSTRINGB,
-
- STORAGE_KEY_TELEPHONY_IMSI,
+ 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_IDLE_SCREEN_LAUNCHED,
+
+ STORAGE_KEY_STRING = 0x03000000,
+ STORAGE_KEY_NWNAME,
+ STORAGE_KEY_SPN_NAME,
STORAGE_KEY_LANGUAGE_SET,
- STORAGE_KEY_IDLE_SCREEN_LAUNCHED_BOOL,
- STORAGE_KEY_CISSAPPL_SHOW_MY_NUMBER_INT,
-};
-
-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
-
+} 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
+
+#endif /* __STORAGE_H__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#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/common.h"
+#include "type/command.h"
+#include "type/notification.h"
-#include <type/request.h>
-#include <type/response.h>
-#include <type/notification.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/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;
typedef struct tcore_hal_type TcoreHal;
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 Storage;
+typedef struct tcore_storage_type TcoreStorage;
typedef struct tcore_at_type TcoreAT;
typedef struct tcore_udev_type TcoreUdev;
-enum tcore_hook_return {
+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);
+/* 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__ */
+++ /dev/null
-/*
- * 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_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_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_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_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_cli_mode {
- CALL_CLI_MODE_DEFAULT,
- CALL_CLI_MODE_PRESENT,
- CALL_CLI_MODE_RESTRICT,
-};
-
-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_ringback_tone_status {
- CALL_SOUND_RINGBACK_TONE_START,
- CALL_SOUND_RINGBACK_TONE_END,
-};
-
-enum telephony_call_sound_direction {
- CALL_SOUND_DIRECTION_LEFT,
- CALL_SOUND_DIRECTION_RIGHT,
-};
-
-/**********
- Struct
- **********/
-
-// Request
-
-#define MAX_CALL_NUMBER_LEN 83
-#define MAX_CALL_DIAL_NUM_LEN MAX_CALL_NUMBER_LEN
-#define MAX_CALL_DTMF_DIGITS_LEN 32
-
-
-#define MAX_CALL_CLI_NUM_LEN MAX_CALL_NUMBER_LEN
-#define MAX_CALL_CNA_NAME_LEN 83
-
-struct telephony_call_cli_info {
- enum telephony_call_cli_mode mode;
- 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 treq_call_dial {
- enum telephony_call_type type;
- 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_dtmf {
- char digits[ MAX_CALL_DTMF_DIGITS_LEN ];
-};
-
-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_sound_set_path {
- enum telephony_call_sound_path path;
- gboolean extra_volume_on;
-};
-
-struct treq_call_sound_set_volume_level {
- enum telephony_call_sound_type sound;
- enum telephony_call_sound_device device;
- enum telephony_call_sound_volume_level volume;
-};
-
-struct treq_call_sound_get_volume_level {
- enum telephony_call_sound_type sound;
- enum telephony_call_sound_device device;
-};
-
-struct treq_call_sound_set_recording {
- gboolean state;
-};
-
-#define MAX_CALL_EQ_PARAMETER_SIZE 6
-struct treq_call_sound_set_equalization {
- gboolean mode;
- enum telephony_call_sound_direction direction;
- unsigned short parameter[ MAX_CALL_EQ_PARAMETER_SIZE ];
-};
-
-struct treq_call_sound_set_noise_reduction {
- gboolean status;
-};
-
-struct treq_call_sound_set_clock_status {
- gboolean status;
-};
-
-
-// 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_sound_set_path {
- gboolean err;
-};
-
-struct tresp_call_sound_set_volume_level {
- gboolean err;
-};
-
-struct tresp_call_sound_get_volume_level {
- int record_num;
- struct volume_info {
- enum telephony_call_sound_type sound;
- enum telephony_call_sound_volume_level volume;
- } *record;
- gboolean err;
-};
-
-struct tresp_call_mute {
- gboolean err;
-};
-
-struct tresp_call_unmute {
- gboolean err;
-};
-
-struct tresp_call_get_mute_status {
- int status;
- gboolean err;
-};
-
-struct tresp_call_sound_set_recording {
- gboolean err;
-};
-
-struct tresp_call_sound_set_equalization {
- gboolean err;
-};
-
-struct tresp_call_sound_set_noise_reduction {
- gboolean err;
-};
-
-struct tresp_call_sound_set_clock_status {
- gboolean 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 {
- gboolean mode;
- enum telephony_call_sound_direction direction;
-};
-
-struct tnoti_call_sound_noise_reduction {
- gboolean status;
-};
-
-struct tnoti_call_sound_clock_status {
- gboolean status;
-};
-
-
-__END_DECLS
-
-#endif
--- /dev/null
+/*
+ * 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__ */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include <errno.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_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,
-
- /* 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_UNKNOWN = TCORE_RETURN | 0x0FFFFFFF
-};
-
-typedef enum tcore_return TReturn;
-
-__END_DECLS
-
-#endif
+#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__ */
+++ /dev/null
-/*
- * 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
-
-enum modem_state {
- MODEM_STATE_ONLINE,
- MODEM_STATE_OFFLINE,
- MODEM_STATE_ERROR,
-};
-
-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_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_set_flightmode {
- TReturn result;
-};
-
-struct tresp_modem_get_flightmode {
- TReturn result;
- int enable;
-};
-
-struct tresp_modem_get_imei {
- TReturn result;
- char imei[17];
-};
-
-struct tresp_modem_get_version {
- TReturn result;
- char software[33];
- char hardware[33];
- char calibration[33];
- char product_code[33];
-};
-
-struct tresp_modem_get_sn {
- TReturn result;
- char sn[13];
-};
-
-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 {
-};
-
-__END_DECLS
-
-#endif
+++ /dev/null
-/*
- * 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_MODE_AUTO 0x00
-#define NETWORK_MODE_GSM 0x01
-#define NETWORK_MODE_WCDMA 0x02
-#define NETWORK_MODE_CDMA 0x04
-#define NETWORK_MODE_LTE 0x08
-
-#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,
- NETWORK_SELECT_MODE_MANUAL = 0x02
-};
-
-enum telephony_network_plmn_status {
- NETWORK_PLMN_UNKNOWN,
- NETWORK_PLMN_AVAILABLE,
- NETWORK_PLMN_CURRENT,
- 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_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_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_EVDV,
- 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
-};
-
-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_ALL = 0xFF
-};
-
-struct tel_network_geran_neighboring_cell_info{
- int cell_id;
- int lac;
- int bcch;
- int bsic;
- int rxlev;
-};
-
-struct tel_network_umts_neighboring_cell_info{
- int cell_id;
- int lac;
- int arfcn;
- int psc;
- int rscp;
-};
-
-struct tel_network_neighboring_cell_info{
- int geran_list_count;
- struct tel_network_geran_neighboring_cell_info geran_list[NETWORK_GERAN_NEIGHBORING_CELL_LIST_MAX];
- int umts_list_count;
- struct tel_network_umts_neighboring_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 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 */
-};
-
-
-struct tresp_network_search {
- TReturn result;
- int list_count;
- struct {
- enum telephony_network_plmn_status status;
- char name[40];
- 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 index;
- 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;
-};
-
-
-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;
-};
-
-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];
-};
-
-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;
-};
-
-__END_DECLS
-
-#endif
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include <type/common.h>
-__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_EXIT,
- TNOTI_SERVER_MODEM_ERR,
-
- 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_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_SS = TCORE_NOTIFICATION | TCORE_TYPE_SS,
- TNOTI_SS_INFO,
- TNOTI_SS_USSD,
- 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_SIM = TCORE_NOTIFICATION | TCORE_TYPE_SIM,
- TNOTI_SIM_STATUS,
-
- TNOTI_SAT = TCORE_NOTIFICATION | TCORE_TYPE_SAT,
- TNOTI_SAT_PROACTIVE_CMD,
- TNOTI_SAT_SESSION_END,
-
- 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_PS = TCORE_NOTIFICATION | TCORE_TYPE_PS,
- TNOTI_PS_CALL_STATUS,
- TNOTI_PS_CURRENT_SESSION_DATA_COUNTER,
- TNOTI_PS_PDP_IPCONFIGURATION,
- TNOTI_PS_EXTERNAL_CALL,
- TNOTI_PS_PROTOCOL_STATUS,
-
- 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_CUSTOM = TCORE_NOTIFICATION | TCORE_TYPE_CUSTOM,
-};
-
-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 {
-};
-
-struct tnoti_custom {
- unsigned int length;
- void *data;
-};
-
-__END_DECLS
+#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
#endif
+++ /dev/null
-/*
- * 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
-#define PHONEBOOK_NUMBER_BYTE_MAX 256
-#define PHONEBOOK_EMAIL_BYTE_MAX 256
-
-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 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;
-};
-
-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
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#ifndef __TYPE_PS_H__
#define __TYPE_PS_H__
-__BEGIN_DECLS
-
-enum telephony_ps_pdp_err {
- PDP_FAILURE_CAUSE_NORMAL,
- PDP_FAILURE_CAUSE_REL_BY_USER,
- PDP_FAILURE_CAUSE_REGULAR_DEACTIVATION,
- PDP_FAILURE_CAUSE_LLC_SNDCP,
- PDP_FAILURE_CAUSE_INSUFFICIENT_RESOURCE,
- PDP_FAILURE_CAUSE_UNKNOWN_APN,
- PDP_FAILURE_CAUSE_UNKNOWN_PDP_ADDRESS,
- PDP_FAILURE_CAUSE_USER_AUTH_FAILED,
- PDP_FAILURE_CAUSE_ACT_REJ_GGSN,
- PDP_FAILURE_CAUSE_ACT_REJ_UNSPECIFIED,
- PDP_FAILURE_CAUSE_SVC_OPTION_NOT_SUPPORTED,
- PDP_FAILURE_CAUSE_SVC_NOT_SUBSCRIBED,
- PDP_FAILURE_CAUSE_SVC_OPT_OUT_ORDER,
- PDP_FAILURE_CAUSE_NSAPI_USED,
- PDP_FAILURE_CAUSE_QOS_NOT_ACCEPTED,
- PDP_FAILURE_CAUSE_NETWORK_FAILURE,
- PDP_FAILURE_CAUSE_REACT_REQUIRED,
- PDP_FAILURE_CAUSE_FEATURE_NOT_SUPPORTED,
- PDP_FAILURE_CAUSE_TFT_FILTER_ERROR,
- PDP_FAILURE_CAUSE_UNKOWN_PDP_CONTEXT,
- PDP_FAILURE_CAUSE_INVALID_MSG,
- PDP_FAILURE_CAUSE_PROTOCOL_ERROR,
- PDP_FAILURE_CAUSE_MOBILE_FAILURE_ERROR,
- PDP_FAILURE_CAUSE_TIMEOUT_ERROR,
- PDP_FAILURE_CAUSE_UNKNOWN_ERROR,
- PDP_FAILURE_CAUSE_MAX
-};
-
-enum telephony_ps_protocol_status {
- TELEPHONY_HSDPA_OFF,
- TELEPHONY_HSDPA_ON,
- TELEPHONY_HSUPA_ON,
- TELEPHONY_HSPA_ON
-};
-
-enum telephony_ps_state {
- TELEPHONY_PS_ON,
- TELEPHONY_PS_3G_OFF,
- TELEPHONY_PS_ROAMING_OFF,
- TELEPHONY_PS_FLIGHT_MODE,
- TELEPHONY_PS_NO_SERVICE,
-};
-
-enum ps_data_call_status {
- PS_DATA_CALL_CTX_DEFINED,
- PS_DATA_CALL_NOT_CONNECTED,
- PS_DATA_CALL_CONNECTED
-};
-
-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 {
- unsigned int context_id;
- enum ps_data_call_status state;
-};
-
-struct tnoti_ps_pdp_ipconfiguration {
- int context_id;
- int secondary_context_id;
-
- enum telephony_ps_pdp_err err;
- unsigned short field_flag;
- unsigned char ip_address[4];
- unsigned char primary_dns[4];
- unsigned char secondary_dns[4];
- unsigned char gateway[4];
- unsigned char subnet_mask[4];
- char devname[16];
-};
-
-struct tnoti_ps_external_call {
-};
-
-struct tnoti_ps_protocol_status {
- enum telephony_ps_protocol_status status;
-};
-
-__END_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+#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__ */
+++ /dev/null
-/*
- * 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_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_SEND_DTMF,
- TREQ_CALL_SET_SOUND_PATH,
- TREQ_CALL_GET_SOUND_VOLUME_LEVEL,
- TREQ_CALL_SET_SOUND_VOLUME_LEVEL,
- TREQ_CALL_MUTE,
- TREQ_CALL_UNMUTE,
- TREQ_CALL_GET_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_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_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_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_SAT = TCORE_REQUEST | TCORE_TYPE_SAT,
- TREQ_SAT_REQ_ENVELOPE,
- TREQ_SAT_REQ_TERMINALRESPONSE,
-
- 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_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_CUSTOM = TCORE_REQUEST | TCORE_TYPE_CUSTOM,
-};
-
-struct treq_server_get_plugins {
-};
-
-struct treq_custom {
- unsigned int custom_command;
- GHashTable *data;
-};
-
-__END_DECLS
-
-#endif
+++ /dev/null
-/*
- * 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_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_SEND_DTMF,
- TRESP_CALL_SET_SOUND_PATH,
- TRESP_CALL_GET_SOUND_VOLUME_LEVEL,
- TRESP_CALL_SET_SOUND_VOLUME_LEVEL,
- TRESP_CALL_MUTE,
- TRESP_CALL_UNMUTE,
- TRESP_CALL_GET_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_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_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_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_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_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_CUSTOM = TCORE_RESPONSE | TCORE_TYPE_CUSTOM,
-};
-
-struct tresp_custom {
- unsigned int custom_command;
- GHashTable *data;
-};
-
-__END_DECLS
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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 45 /**< 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 = 7 /*< 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;
-};
-
-enum refresh_command{
- REFRESH_SIM_INIT_AND_FULL_FCN = 0, /**< command qualifier for REFRESH SIM INIT AND FULL FILE CHANGE_NOTIFICATION */
- REFRESH_FCN = 1, /**< command qualifier for REFRESH FILE CHANGE NOTIFICATION */
- REFRESH_SIM_INIT_AND_FCN = 2, /**< command qualifier for REFRESH SIM INIT AND FILE CHANGE NOTIFICATION */
- REFRESH_SIM_INIT = 3, /**< command qualifier for REFRESH SIM INIT */
- REFRESH_SIM_RESET = 4, /**< command qualifier for REFRESH SIM RESET */
- REFRESH_3G_APPLICATION_RESET = 5, /**< command qualifier for REFRESH 3G APPLICATION RESET */
- REFRESH_3G_SESSION_RESET = 6, /**< command qualifier for REFRESH 3G SESSION RESET */
- REFRESH_RESERVED = 0xFF /**< command qualifier for REFRESH RESERVED */
-};
-
-struct tel_sat_cmd_qualifier_refresh{
- enum 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];
-};
-
-/*
- * 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_YES, /**<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{
- 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;
- struct tel_sat_event_list modem_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;
-};
-
-/*
- * 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 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;
- }terminal_rsp_data;
-};
-
-/*
- * 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
- */
-struct tnoti_sat_proactive_ind{
- 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;
- }proactive_ind_data;
-};
-__END_DECLS
-
-#endif
--- /dev/null
+/*
+ * 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 50 /**< 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__ */
+++ /dev/null
-/*
- * 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_LEN_MAX 20 //telephony defined
-#define SIM_SST_SERVICE_CNT_MAX 56 //3gpp
-#define SIM_UST_BYTE_LEN_MAX 8 //telephony defined
-#define SIM_SPN_LEN_MAX 16 //3gpp
-#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_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_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_OPL_PNN_RECORD_CNT_MAX 5//85 //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 16 //telephony defined
-#define SIM_AUTH_RESP_DATA_LEN_MAX 16 //telephony defined
-#define SIM_CPHS_CALL_FORWARDING_LEN_MAX 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
-
-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_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*/
-
- /* 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 */
-
- /* 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_ISIM /** IMS based card */
-};
-
-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_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 - Permanently blocked and 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 **/
-};
-
-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,
- SIM_LOCK_STATUS_PIN,
- SIM_LOCK_STATUS_PUK,
- SIM_LOCK_STATUS_PIN2,
- SIM_LOCK_STATUS_PUK2,
- SIM_LOCK_STATUS_PERM_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, /**< voice */
- SIM_MAILBOX_FAX = 0x02, /**< fax*/
- SIM_MAILBOX_DATA = 0x03, /**< data*/
- SIM_MAILBOX_EMAIL = 0x04, /**< email*/
- SIM_MAILBOX_OTHER = 0x05, /**< other*/
-};
-
-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_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 */
-};
-
-struct tel_sim_sst {
- // service 1
- char bPIN1DisableFunction; /**< PIN1 disable function */
- char bAdn; /**< abbreviated Dialing number */
- char bFdn; /**< fixed Dialing number */
- char bSms; /**< short message storage */
- char bAoc; /**< advice of charge */
- char bCcp; /**< capability configuration parameters */
- char bPlmnSelector; /**< plmn selector */
- char bRfu1; /**< rfu */
-
- // service 9
- char bMsisdn; /**< msisdn */
- char bExtension1; /**< extension1 */
- char bExtension2; /**< extension2 */
- char bSmsParams; /**< sms parameteres */
- char blnd; /**< last number dialed */
- char bCellBroadCastMsgId; /**< cell broadcast message identifier */
- char bGroupIdLevel1; /**< group identifier level 1 */
- char bGroupIdLevel2; /**< group identifier level 2 */
-
- // service 17
- char bSpn; /**< service provider name */
- char bSdn; /**< service Dialing number */
- char bExtension3; /**< extension3 */
- char bRfu2; /**< rfu */
- char bVgcsGroupIdList; /**< vgcs group identifier (EF-VGCS, EF-VGCSS) */
- char bVbsGroupIDList; /**< vbs group identifier (EF-VBS, EF-VBSS) */
- char bEnhancedMultilevelPrecedencePreemptionService; /**< enhanced multi-level precedence and pre-emption service */
- char bAutoAnswerForeMLPP; /**< automatic answer fro eMLPP */
-
- // service 25
- char bSmsCbdDataDownload; /**< data download via sms-cb */
- char bSmsPpDataDownload; /**< data download via sms-pp */
- char bMenuSelection; /**< menu selection */
- char bCallControl; /**< call control */
- char bProactiveSimCommand; /**< proactive sim command */
- char bCellBroadcastMsgIdRanges; /**< cell broadcast message identifier ranges */
- char bBdn; /**< barred Dialing numbers */
- char bExtension4; /**< extension 4 */
-
- // service 33
- char bDePersonalizedControlKeys; /**< de-personalization control keys */
- char bCoOperativeNetworkList; /**< co-operative network list */
- char bSmsr; /**< short message status reports */
- char bNetworkAlertIndInMS; /**< network's indication of alerting in the MS */
- char bMoSMSControl; /**< mobile-originated short message control by sim */
- char bGPRS; /**< gprs */
- char bImage; /**< image */
- char bSolsa; /**< support of local service area */
-
- // service 41
- char bUSSDSupportedInCallControl; /**< ussd string data object supported in call control */
- char bRunAtCommand; /**< RUN AT COMMAND command */
- char bUserControlledPLMNSelectorAccessTech; /**< user controlled PLMN selector with Access technology */
- char bOperatorControlledPlmnSelectorAccessTech; /**< operator controlled PLMN selector with Access technology */
- char bHplmnSelectorAccessTech; /**< HPLMN selector with access technology */
- char bCPBCCHInfo; /**< CPBCCH information */
- char bInvestigationScan; /**< investigation scan */
- char bExtenedCapaConfigParams; /**< extended capability configuration parameters */
-
- // service 49
- char bMexe; /**< MExE */
- char bRplmnLastUsedAccessTech; /**< RPLMN last used access technology */
- char bPlmnNetworkName; /*PLMN Network Name*/
- char bOperatorPlmnList; /*Operator PLMN List*/
- char bMailboxDiallingNumber; /*Mailbox Dialling Numbers*/
- char bMessageWaitingIndicationStatus; /*Message Waiting Indication Status*/
- char bCallForwardingIndicationStatus; /*Call Forwarding Indication Status*/
- char bServiceProviderDisplayInformation; /*Service Provider Display Information*/
-};
-
-struct tel_sim_ust {
- // service 1
- char bLocalPhoneBook; /**< local phone book */
- char bFdn; /**< fixed Dialing number */
- char bExtension2; /**< extension 2 */
- char bSdn; /**< service Dialing number */
- char bExtension3; /**< extension 3 */
- char bBdn; /**< barred Dialing numbers */
- char bExtension4; /**< extension 4 */
- char bOCIOCT; /**< outgoing call information */
-
- // service 9
- char bIciIct; /**< incoming call information */
- char bSms; /**< short message storage */
- char bSmsr; /**< short message status reports */
- char bSMSP; /**< short message service parameters */
- char bAoc; /**< advice of charge */
- char bCcp; /**< capability config parameters */
- char bCellBroadcastMsgId; /**< cell broadcast message identifier */
- char bCellBroadcastMsgIdRanges; /**< cell broadcast message identifier charge */
-
- // sevice 17
- char bGroupIdLevel1; /**< group identifier level 1 */
- char bGroupIdLevel2; /**< group identifier level 2 */
- char bSpn; /**< service provide name */
- char bUserControlledPLMNSelectorAccessTech; /**< user controlled plmn selector with access technology */
- char bMsisdn; /**< msisdn */
- char bImage; /**< image */
- char bSolsa;
- char bEnhancedMultilevelPrecedencePreemptionService; /**< enhanced multi-level precedence and pre-emption service */
-
- // service 25
- char bAutoAnswerForeMLPP; /**< automatic answer fro eMLPP */
- char bRfu1;
- char bGsmAccess; /**< gsm access */
- char bSmsPpDataDownload; /**< data download via sms-pp */
- char bSmsCbdDataDownload; /**< data download via sms-cb */
- char bUsimCallControl; /**< usim call control */
- char bUsimMoSmsControl; /**< mo-sms control by usim */
- char bRunAtCommand; /**< RUN AT COMMAND command */
-
- // service 33
- char bShallBeSetToOne; /**< shall be set to 1 */
- char bEnabledServiceTable; /**< enabled service table */
- char bAcl; /**< APN control list */
- char bDePersonalizedControlKeys; /**< de-personalization control keys */
- char bCoOperativeNetworkList; /**< co-operative network list */
- char bGsmSecurityContext; /**< gsm security context */
- char bCpbcchiInformation; /**< cpbcch information */
- char bInvestigationScan; /**< investigation scan */
-
- // service 41
- char bMexe; /**< mexe */
- char bOperatorControlledPlmnSelectorAccessTech; /**< Operator controlled PLMN selector with Access Technology */
- char bHplmnSelectorAccessTech; /**< HPLMN selector with access technology */
- char bExtension5; /**< extension 5 */
- char bPlmnNetworkName; /**< plmn network name */
- char bOperatorPlmnList; /**< operator plmn list */
- char bMailBoxDiallingNumbers; /**< mailbox Dialing numbers */
- char bMsgWaitingIndStatus; /**< message waiting indication status */
-
- // service 49
- char bCallForwardingIndicationStatus; /**< call forwarding indication status */
- char bRplmnLastUsedAccessTech; /**< RPLMN last used access technology */
- char bServiceProviderDisplayInfo; /**< service provider display information */
- char bMms; /**< multi media messaging service */
- char bExtension8; /**< extension 8 */
- char bUsimGpsCallControl; /**< call control on gprs by usim */
- char bMmsUserConnectivityParameters; /**< mms user connectivity parameters */
- char bNia; /**< Network's indication of alerting in the MS (NIA) */
-
- //service 57
- char bVgcsIdList; /**< VGCS Group Identifier List (EFVGCS and EFVGCSS) */
- char bVbsGroupId; /**< VBS Group Identifier List (EFVBS and EFVBSS)*/
- char bPseudonym;
- char bUserCtrlPlmnSelectorForWlan;
- char bOperatorCtrlPlmnSelectorForWlan;
- char bUserCtrlWsidList;
- char bOperatorCtrlWsidList;
- char bVgcsSecurity;
-};
-
-struct tel_sim_service_table {
- struct tel_sim_sst sst;
- struct tel_sim_ust ust;
-};
-
-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 */
- char szGroupIdentifier[SIM_GROUP_IDENTIFIER_LEN_MAX]; /**< Group identifier */
-};
-
-struct tel_sim_cphs_svc_call_offering_s {
- int bCallForwardingUnconditional; /**< CallForwarding Unconditional */
- int bCallForwardingOnUserBusy; /**< CallForwarding On UserBusy */
- int bCallForwardingOnNoReply; /**< CallForwarding On NoReply */
- int bCallForwardingOnUserNotReachable; /**< CallForwarding On User Not Reachable */
- int bCallTransfer; /**< Call Transfer */
-};
-
-struct tel_sim_cphs_svc_call_restriction_s {
- int bBarringOfAllOutgoingCalls; /**< Barring Of All Outgoing Calls*/
- int bBarringOfOutgoingInternationalCalls; /**< Barring Of Outgoing International Calls */
- int bBarringOfOutgoingInternationalCallsExceptHplmn; /**< Barring Of Outgoing International Calls Except HPLMN */
- int bBarringOfAllIncomingCallsRoamingOutsideHplmn; /**< Barring Of All Incoming Calls Roaming Outside HPLMN */
- int bBarringOfIncomingCallsWhenRoaming; /**< Barring Of IncomingCalls When Roaming */
-};
-
-struct tel_sim_cphs_svc_other_ss_s {
- int bMultiPartyService; /**< MultiPartyService*/
- int bClosedUserGroup; /**< ClosedUserGroup*/
- int bAdviceOfCharge; /**< AdviceOfCharge*/
- int bPreferentialClosedUserGroup; /**< PreferentialClosedUserGroup*/
- int bClosedUserGroupOutgoingAccess; /**< ClosedUserGroupOutgoingAccess*/
-};
-
-struct tel_sim_cphs_svc_call_complete_s {
- int bCallHold; /**< Call Hold*/
- int bCallWaiting; /**< Call Waiting*/
- int bCompletionOfCallToBusySubscriber; /**< Completion Of Call To Busy Subscriber*/
- int bUserUserSignalling; /**< User User Signaling*/
-};
-
-struct tel_sim_cphs_svc_teleservices_s {
- int bShortMessageMobileOriginated; /**< Short Message Mobile Originated*/
- int bShortMessageMobileTerminated; /**< Short Message Mobile Terminated*/
- int bShortMessageCellBroadcast; /**< Short Message Cell Broadcast*/
- int bShortMessageReplyPath; /**< Short Message Reply Path*/
- int bShortMessageDeliveryConf; /**< Short Message Delivery Conf*/
- int bShortMessageProtocolIdentifier; /**< Short Message Protocol Identifier*/
- int bShortMessageValidityPeriod; /**< Short Message Validity Period*/
-};
-
-struct tel_sim_cphs_svc_cphs_teleservices_s {
- int bAlternativeLineService; /**< Alternative Line Service*/
-};
-
-struct tel_sim_cphs_svc_cphs_features_s {
- int bStringServiceTable; /**< String Service Table*/
-};
-
-struct tel_sim_cphs_svc_number_identifier_s {
- int bCallingLineIdentificationPresent; /**< Calling Line Identification Present*/
- int bConnectedLineIdentificationRestrict; /**< Connected Line Identification Restrict*/
- int bConnectedLineIdentificationPresent; /**< Connected Line Identification Present*/
- int bMaliciousCallIdentifier; /**< Malicious Call Identifier*/
- int bCallingLineIdentificationSend; /**< Calling Line Identification Send*/
- int bCallingLineIdentificationBlock; /**< Calling Line Identification Block*/
-};
-
-struct tel_sim_cphs_svc_phase_services_s {
- int bMenuForGprs; /**< Menu For group*/
- int bMenuForHighSpeedCsd; /**< Menu For HighSpeedCsd*/
- int bMenuForVoiceGroupCall; /**< Menu For VoiceGroupCall*/
- int bMenuForVoiceBroadcastService; /**< Menu For VoiceBroadcastService*/
- int bMenuForMultipleSubscriberProfile; /**< Menu For MultipleSubscriberProfile*/
- int bMenuForMultipleBand; /**< Menu For MultipleBand*/
-};
-
-struct tel_sim_cphs_svc_value_added_services_s {
- int bRestrictMenuForManualSelection; /**< RestrictMenu For ManualSelection*/
- int bRestrictMenuForVoiceMail; /**< RestrictMenu For VoiceMail*/
- int bRestrictMenuForMoSmsAndPaging; /**< RestrictMenu For MoSmsAndPaging*/
- int bRestrictMenuForMoSmsWithEmialType; /**< RestrictMenu For MoSmsWithEmialType*/
- int bRestrictMenuForFaxCalls; /**< RestrictMenu For FaxCalls*/
- int bRestrictMenuForDataCalls; /**< RestrictMenu For DataCalls*/
- int bRestrictMenuForChangeLanguage; /**< RestrictMenu For ChangeLanguage*/
-};
-
-struct tel_sim_cphs_svc_information_numbers_s {
- int bInformationNumbers; /**< Information Numbers*/
-};
-
-struct tel_sim_cphs_csp_entry_s {
- enum tel_sim_cphs_csp_group CustomerServiceGroup; /**< customer service group*/
- union {
- struct tel_sim_cphs_svc_call_offering_s CallOffering; /**< call offering*/
- struct tel_sim_cphs_svc_call_restriction_s CallRestriction; /**< call restriction*/
- struct tel_sim_cphs_svc_other_ss_s OtherSuppServices; /**< other SS services*/
- struct tel_sim_cphs_svc_call_complete_s CallComplete; /**< call complete*/
- struct tel_sim_cphs_svc_teleservices_s Teleservices; /**< teleservices*/
- struct tel_sim_cphs_svc_cphs_teleservices_s CphsTeleservices; /**< CPHS teleservices*/
- struct tel_sim_cphs_svc_cphs_features_s CphsFeatures; /**< CPHS features*/
- struct tel_sim_cphs_svc_number_identifier_s NumberIdentifiers; /**< number identifiers*/
- struct tel_sim_cphs_svc_phase_services_s PhaseServices; /**< phase services*/
- struct tel_sim_cphs_svc_value_added_services_s ValueAddedServices; /**< value added services*/
- struct tel_sim_cphs_svc_information_numbers_s InformationNumbers; /**< information numbers*/
- } u;
-};
-
-struct tel_sim_cphs_csp {
- struct tel_sim_cphs_csp_entry_s ServiceProfileEntry[SIM_CPHS_CSP_ENTRY_CNT_MAX]; /**< service profile entry*/
-};
-
-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 */
-};
-
-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[256];
-};
-
-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 tresp_sim_verify_pins {
- enum tel_sim_pin_operation_result result;
- enum tel_sim_pin_type pin_type;
- enum tel_sim_lock_status lock_status;
- int retry_count;
-};
-
-struct tresp_sim_verify_puks {
- enum tel_sim_pin_operation_result result;
- enum tel_sim_pin_type pin_type;
- enum tel_sim_lock_status lock_status;
- 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[256 + 2];
-};
-
-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_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_XDN_NUMBER_LEN_MAX + 1];
- enum tel_sim_ton ton;
- unsigned char name[SIM_XDN_ALPHA_ID_LEN_MAX + 1];
-};
-
-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_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 opl[SIM_OPL_PNN_RECORD_CNT_MAX];
-};
-
-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 pnn[SIM_OPL_PNN_RECORD_CNT_MAX];
-};
-
-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 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_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;
- } 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;
-};
-
-__END_DECLS
-
-#endif
+++ /dev/null
-/*
- * 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 93 /** Maximum CB Message Size */
-#define SMS_ETWS_SIZE_MAX 56 /** Maximum ETWS Message Size */
-
-#define SMS_ENCODED_SCA_LEN_MAX 12 /* Encoded SCA is 12 bytes long maximum */
-
-#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 164 /**< Maximum SMS data size that can be stored*/
-#define SMS_MAX_INDEX 255 /**< Maximum index value for SMS */
-
-#define SMS_SMSP_PARAMS_MAX_LEN 28
-
-// ************************ CDMA Features **************************//
-#define SMS_PARAM_TELESERVICE_MASK 1 << 0 /**< Teleservice parameter bit position */
-#define SMS_PARAM_SERVICE_CATEGORY_MASK 1 << 1 /**< Service Category parameter bit position */
-#define SMS_PARAM_ADDRESS_MASK 1 << 2 /**< Address parameter bit position */
-#define SMS_PARAM_SUBADDRESS_MASK 1 << 3 /**< Subaddress parameter bit position */
-#define SMS_PARAM_BEARER_REPLY_MASK 1 << 4 /**< Bearer reply parameter bit position */
-#define SMS_PARAM_CAUSE_CODES_MASK 1 << 5 /**< Cause Code parameter bit position */
-#define SMS_PARAM_MESSAGE_ID_MASK 1 << 6 /**< Message ID parameter bit position */
-#define SMS_PARAM_USER_DATA_MASK 1 << 7 /**< User Data parameter bit position */
-#define SMS_PARAM_USER_RESPONSE_CODE_MASK 1 << 8 /**< User Response Code parameter bit position */
-#define SMS_PARAM_MC_TIME_STAMP_MASK 1 << 9 /**< Message Center Timestamp parameter bit position */
-#define SMS_PARAM_VALIDITY_PERIOD_ABS_MASK 1 << 10 /**< Valid period Absolute parameter bit position */
-#define SMS_PARAM_VALIDITY_PERIOD_REL_MASK 1 << 11 /**< Valid period Relative parameter bit position */
-#define SMS_PARAM_DEFERRED_DELIVERY_ABS_MASK 1 << 12 /**< Deferred delivery absolute parameter bit position */
-#define SMS_PARAM_DEFERRED_DELIVERY_REL_MASK 1 << 13 /**< Deferred delivery relative parameter bit position */
-#define SMS_PARAM_PRIORITY_MASK 1 << 14 /**< Priority parameter bit position */
-#define SMS_PARAM_PRIVACY_MASK 1 << 15 /**< Privacy parameter bit position */
-#define SMS_PARAM_REPLY_OPTION_MASK 1 << 16 /**< Reply Option parameter bit position */
-#define SMS_PARAM_NUMBER_OF_MESSAGE_MASK 1 << 17 /**< Number of message parameter bit position */
-#define SMS_PARAM_ALERT_ON_DELIVERY_MASK 1 << 18 /**< Alert on delivery parameter bit position */
-#define SMS_PARAM_LANGUAGE_MASK 1 << 19 /**< Language parameter bit position */
-#define SMS_PARAM_CALLBACK_MASK 1 << 20 /**< Callback Number parameter bit position */
-#define SMS_PARAM_DISPLAY_MODE_MASK 1 << 21 /**< Display mode parameter bit position */
-#define SMS_PARAM_MULTI_ENCODING_USER_DATA_MASK 1 << 22 /**< Multi Encoding user data parameter bit position */
-
-#define SMS_MAXLENGTH_SMS_MT_USER_DATA 160 /**< Maximum MT user data size*/
-#define SMS_MAXLENGTH_SMS_MO_USER_DATA 160 /**< Maximum MO user data size*/
-
-#define SMS_MAXLENGTH_SMS_ADDRESS 32 /**< MAX sms destination(or origination ) address /call back number */
-
-#define SMS_ERR_CLASS0_STATUS_SEND_OK 0 /**< send success */
-#define SMS_ERR_CLASS23_ADDRESS_VACANT 0 /**< address vacant */
-#define SMS_ERR_CLASS23_ADDRESS_TRANSLATION_FAILURE 1 /**< address translation failure */
-#define SMS_ERR_CLASS23_NETWORK_RESOURCE_SHORTAGE 2 /**< network resource shortage */
-#define SMS_ERR_CLASS23_NETWORK_FAILURE 3 /**< network failure */
-#define SMS_ERR_CLASS23_INVALID_TELESERVICE_ID 4 /**< invalid teleservice id */
-#define SMS_ERR_CLASS23_OTHER_NETWORK_PROBLEM 5 /**< other network problem */
-#define SMS_ERR_CLASS23_OTHER_NETWORK_PROBLEM_MORE_FIRST 6 /**< other network problem more first */
-#define SMS_ERR_CLASS23_OTHER_NETWORK_PROBLEM_MORE_LAST 31 /**< other network problem more last */
-#define SMS_ERR_CLASS23_NO_PAGE_RESPONSE 32 /**< no page response */
-#define SMS_ERR_CLASS23_DESTINATION_BUSY 33 /**< destination busy */
-#define SMS_ERR_CLASS23_NO_ACK 34 /**< no ack */
-#define SMS_ERR_CLASS23_DESTINATION_RESOURCE_SHORTAGE 35 /**< destination resource shortage */
-#define SMS_ERR_CLASS23_SMS_DELIVERY_POSTPONED 36 /**< sms delivery postponed */
-#define SMS_ERR_CLASS23_DESTINATION_OUT_OF_SERVICE 37 /**< destination out of service */
-#define SMS_ERR_CLASS23_DESTINATION_NO_LONGER_AT_THIS_ADDRESS 38 /**< destination no longer at this address */
-#define SMS_ERR_CLASS23_OTHER_TERMINAL_PROBLEM 39 /**< other terminal problem */
-#define SMS_ERR_CLASS23_OTHER_TERMINAL_PROBLEM_MORE_FIRST 40 /**< other terminal problem more first */
-#define SMS_ERR_CLASS23_OTHER_TERMINAL_PROBLEM_MORE_LAST 47 /**< other terminal problem more last */
-#define SMS_ERR_CLASS23_SMS_DELIVERY_POSTPONED_MORE_FIRST 48 /**< sms delivery postpone more first */
-#define SMS_ERR_CLASS23_SMS_DELIVERY_POSTPONED_MORE_LAST 63 /**< sms delivery postpone more last */
-#define SMS_ERR_CLASS23_RADIO_IF_RESOURCE_SHORTAGE 64 /**< radio interface resource shortage */
-#define SMS_ERR_CLASS23_RADIO_IF_INCOMPATIBLE 65 /**< radio interface incompatible */
-#define SMS_ERR_CLASS23_OTHER_RADIO_IF_PROBLEM 66 /**< other radio interface problem */
-#define SMS_ERR_CLASS23_OTHER_RADIO_IF_PROBLEM_MORE_FIRST 67 /**< other radio interface problem more first */
-#define SMS_ERR_CLASS23_OTHER_RADIO_IF_PROBLEM_MORE_LAST 95 /**< other radio interface problem more last */
-#define SMS_ERR_CLASS23_UNEXPECTED_PARM_SIZE 96 /**< unexpected parameter size */
-#define SMS_ERR_CLASS23_SMS_ORIGINATION_DENIED 97 /**< sms origination denied */
-#define SMS_ERR_CLASS23_SMS_TERMINATION_DENIED 98 /**< sms termination denied */
-#define SMS_ERR_CLASS23_SUPPL_SERVICE_NOT_SUPPORTED 99 /**< supplementary service not supported */
-#define SMS_ERR_CLASS23_SMS_NOT_SUPPORTED 100 /**< sms not supported */
-#define SMS_ERR_CLASS23_RESERVED_101 101 /**< reserved 101 */
-#define SMS_ERR_CLASS23_MISSING_EXPECTED_PARM 102 /**< missing expected parameter */
-#define SMS_ERR_CLASS23_MISSING_MANDATORY_PARM 103 /**< missing mandatory parameter value */
-#define SMS_ERR_CLASS23_UNRECOGNIZED_PARM_VALUE 104 /**< unrecognized parameter value */
-#define SMS_ERR_CLASS23_UNEXPECTED_PARM_VALUE 105 /**< unexpected parameter value */
-#define SMS_ERR_CLASS23_USER_DATA_SIZE_ERROR 106 /**< user data size error */
-#define SMS_ERR_CLASS23_OTHER_GENERAL_PROBLEMS 107 /**< other general problem */
-#define SMS_ERR_CLASS23_OTHER_GENERAL_PROBLEMS_MORE_FIRST 108 /**< other general problem first */
-#define SMS_ERR_CLASS23_OTHER_GENERAL_PROBLEMS_MORE_LAST 255 /**< other general problem last */
-
-#define SMS_ERR_CLASS4_WAITING_FOR_TL_ACK 1 /**< waiting for transport ack */
-#define SMS_ERR_CLASS4_OUT_OF_RESOURCES 2 /**< out of resource */
-#define SMS_ERR_CLASS4_ACCESS_TOO_LARGE 3 /**< access to large */
-#define SMS_ERR_CLASS4_DTC_TOO_LARGE 4 /**< DTC too large */
-#define SMS_ERR_CLASS4_DTC_CONNECTED 5 /**< DTC connected */
-#define SMS_ERR_CLASS4_NETWORK_NOT_READY 6 /**< network not ready */
-#define SMS_ERR_CLASS4_NO_SVC 7 /**< no service */
-#define SMS_ERR_CLASS4_PHONE_NOT_READY 8 /**< phone not ready */
-#define SMS_ERR_CLASS4_NOT_ALLOWED_IN_AMPS 9 /**< fail to allowed in amps */
-#define SMS_ERR_CLASS4_CANNOT_SEND_BROADCAST 10 /**< fail to send broadcast */
-#define SMS_ERR_CLASS4_INVALID_TRANSACTION_ID
-// ********************************************************************//
-
-/*==================================================================================================
- ENUMS
-==================================================================================================*/
-/**
- * @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 */
-};
-
-/**
-* @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) */
-};
-
-
-/**
- * This structure defines the fields related to an Sms like SIM index, TPDU
- * and length.
- */
-struct telephony_sms_DataPackageInfo {
- /*
- * 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
- */
- unsigned char sca[SMS_ENCODED_SCA_LEN_MAX];
- /* Size of array szData (which is actual TPDU message) */
- int msgLength;
- /* SMS TPDU message */
- unsigned char tpduData[SMS_SMDATA_SIZE_MAX + 1];
-};
-
-/**
- *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 */
-};
-
-
-// ************************ CDMA Features **************************//
- /** @enum telephony_sms_Is637AlertPriority_t
- * This enum defines the type of alerts used to distinguish different priorities
- * of the message
- */
-enum telephony_sms_Is637AlertPriority {
- SMS_ALERT_PRIORITY_DEFAULT = 0, /* Mobile default alert */
- SMS_ALERT_PRIORITY_LOW, /* Low priority alert */
- SMS_ALERT_PRIORITY_MEDIUM, /* Medium priority alert */
- SMS_ALERT_PRIORITY_HIGH, /* High priority alert */
-};
-
- /** @enum telephony_sms_Is637Privacy_t
- * This enum defines the desired privacy level of the message
- */
-enum telephony_sms_Is637Privacy {
- SMS_PRIVACY_NOT_RESTRICTED = 0, /* Not restricted */
- SMS_PRIVACY_RESTRICTED, /* Restricted */
- SMS_PRIVACY_CONFIDENTIAL, /* Confidential */
- SMS_PRIVACY_SECRET, /* Secret */
-};
-
- /** @enum telephony_sms_Is637Priority_t
- * This enum defines the priority level of the message
- */
-enum telephony_sms_Is637Priority {
- SMS_PRIORITY_NORMAL = 0, /* Normal */
- SMS_PRIORITY_INTERACTIVE, /* Interactive */
- SMS_PRIORITY_URGENT, /* Urgent */
- SMS_PRIORITY_EMERGENCY, /* Emergency */
-};
-
- /** @enum telephony_sms_Is637LangIndicator_t
- * This enum defines the language of the message so that the receiving mobile station can
- * discard those messages that are not in the user's preferred language
- */
-enum telephony_sms_Is637LangIndicator {
- SMS_LANG_UNKNOWN = 0x0, /* Unknown or unspecified */
- SMS_LANG_ENGLISH, /* English */
- SMS_LANG_FRENCH, /* French */
- SMS_LANG_SPANISH, /* Spanish */
- SMS_LANG_JAPANESE, /* Japanese */
- SMS_LANG_KOREAN, /* Korean */
- SMS_LANG_CHINESE, /* Chinese */
- SMS_LANG_HEBREW, /* Hebrew */
-};
-
- /** @enum telephony_sms_Is637MsgDisplayMode_t
- * This enum defines the display mode to the mobile station when to display the received message
- */
-enum telephony_sms_Is637MsgDisplayMode {
- SMS_MSG_DISPLAY_IMMEDIATE = 0x0, /* The mobile station is to display the received message as soon as possible */
- SMS_MSG_DISPLAY_DEFAULT, /* he mobile station is to display the received message based on a pre-defined mode in the mobile station. */
- SMS_MSG_DISPLAY_USER_INVOKE = 0x3, /* The mobile station is to display the received message based on the mode selected by the user. */
- SMS_MSG_DISPLAY_RESERVED, /* Reserved */
-};
-
- /** @enum telephony_sms_Is637ErrorClass_t
- * This enum defines the error report class
- */
-enum telephony_sms_Is637ErrorClass {
- SMS_MSG_ERROR_CLASS_NONE = 0x0, /* None error(for SMS ack) */
- SMS_MSG_ERROR_CLASS_TEMPORARY_ERROR = 0x2, /* Temporary error(for SMS ack) */
- SMS_MSG_ERROR_CLASS_PERMANENT_ERROR = 0x3, /* Permanent error(for SMS ack) */
- SMS_MSG_ERROR_CLASS_PHONE_INTERNAL_ERROR = 0x4, /* Phone Internal Status (for Send status) */
-};
-
- /** @enum telephony_sms_BroadCastCategory_t
- * This enum defines the Broadcast Service Category
- */
-enum telephony_sms_BroadCastCategory {
- SMS_CATEGORY_UNKNOWN = 0x00, /* Unknown category */
- SMS_CATEGORY_EMERGENCY = 0x01, /* Emergency category */
- SMS_CATEGORY_ADMIN = 0x02, /* Admin category */
- SMS_CATEGORY_MAINTENANCE = 0x03, /* Maintenance category */
- SMS_CATEGORY_GEN_NEWS_LOC = 0x04, /* General News(Local) category */
- SMS_CATEGORY_GEN_NEWS_REG = 0x05, /* General News(Regional) category */
- SMS_CATEGORY_GEN_NEWS_NAT = 0x06, /* General News(National) category */
- SMS_CATEGORY_GEN_NEWS_INT = 0x07, /* General News(International) category */
- SMS_CATEGORY_FIN_NEWS_LOC = 0x08, /* Business/Financial News(Local) category */
- SMS_CATEGORY_FIN_NEWS_REG = 0x09, /* Business/Financial News(Regional) category */
- SMS_CATEGORY_FIN_NEWS_NAT = 0x0A, /* Business/Financial News(National) category */
- SMS_CATEGORY_FIN_NEWS_INT = 0x0B, /* Business/Financial News(International) category */
- SMS_CATEGORY_SPT_NEWS_LOC = 0x0C, /* Sports News(Local) category */
- SMS_CATEGORY_SPT_NEWS_REG = 0x0D, /* Sports News(Regional) category */
- SMS_CATEGORY_SPT_NEWS_NAT = 0x0E, /* Sports News(National) category */
- SMS_CATEGORY_SPT_NEWS_INT = 0x0F, /* Sports News(International) category */
- SMS_CATEGORY_ENT_NEWS_LOC = 0x10, /* Entertainment News(Local) category */
- SMS_CATEGORY_ENT_NEWS_REG = 0x11, /* Entertainment News(Regional) category */
- SMS_CATEGORY_ENT_NEWS_NAT = 0x12, /* Entertainment News(National) category */
- SMS_CATEGORY_ENT_NEWS_INT = 0x13, /* Entertainment News(International) category */
- SMS_CATEGORY_LOC_WEATHER = 0x14, /* Local Weather category */
- SMS_CATEGORY_AREA_TRAFFIC = 0x15, /* Area Traffic Reports category */
- SMS_CATEGORY_AIRPORT_SCHED = 0x16, /* Local Airport Flight Schedules category */
- SMS_CATEGORY_RESTAURANTS = 0x17, /* Restaurants category */
- SMS_CATEGORY_LODGINGS = 0x18, /* Lodgings category */
- SMS_CATEGORY_RETAILS = 0x19, /* Retail Directory category */
- SMS_CATEGORY_ADS = 0x1A, /* Advertisements category */
- SMS_CATEGORY_STOCK_QUOTES = 0x1B, /* Stock Quotes category */
- SMS_CATEGORY_JOBS = 0x1C, /* Employment Opportunities category */
- SMS_CATEGORY_MEDICAL = 0x1D, /* Medical/Health/Hospitals category */
- SMS_CATEGORY_TECH_NEWS = 0x1E, /* Technology News category */
- SMS_CATEGORY_MULTI = 0x1F, /* Multi-category */
-};
-
-/** @enum telephony_sms_MsgType_t
- * This enum defines the type of IS637 message
- */
-enum telephony_sms_CdmaMsgType {
- SMS_MESSAGETYPE_DELIVER = 0x01, /* sms deliver message */
- SMS_MESSAGETYPE_SUBMIT = 0x02, /* sms submit message */
- SMS_MESSAGETYPE_CANCEL = 0x03, /* sms cancellation message */
- SMS_MESSAGETYPE_DELIVERY_ACK = 0x04, /* sms delivery acknowledgment message */
- SMS_MESSAGETYPE_USER_ACK = 0x05, /* sms user acknowledgment message */
-} telephony_sms_CdmaMsgType_e;
-
-/** @enum telephony_sms_Is637DigitMode_t
- * This enum defines the type of address whether it is 4-bit mode or 8-bit mode
- */
-enum telephony_sms_Is637DigitMode {
- SMS_DIGITMODE_4BITDTMF = 0x00, /* 4-bit mode */
- SMS_DIGITMODE_8BITCODE = 0x01, /* 8-bit mode */
-};
-
-/** @enum telephony_sms_Is637NumberMode_t
- * This enum defines the mode of address number to indicate whether the address type is as defined in ANSI TI.607 or is a data network address
- */
-enum telephony_sms_Is637NumberMode {
- SMS_NUMMODE_NONE_DATANETWORK = 0x00, /* in ANSI TI.607 */
- SMS_NUMMODE_DATANETWORK = 0x01, /* in Data Network */
-};
-
-/** @enum telephony_sms_Is637NumberType_t
- * This enum defines the type of address
- */
-enum telephony_sms_Is637NumberType {
- SMS_NUMBER_TYPE_UNKNOWN = 0x00, /* Unknown */
- SMS_NUMBER_TYPE_INTERNATIONAL = 0x01, /* International number*/
- SMS_NUMBER_TYPE_NATIONAL = 0x02, /* National number */
- SMS_NUMBER_TYPE_NETWORK = 0x03, /* Abbreviated number */
- SMS_NUMBER_TYPE_SUBSCRIBER = 0x04, /* Abbreviated number */
- SMS_NUMBER_TYPE_RESERVED_5 = 0x05, /* Reserved */
- SMS_NUMBER_TYPE_ABBREVIATED = 0x06, /* Abbreviated number */
- SMS_NUMBER_TYPE_RESERVED_7 = 0x07, /* Reserved */
- SMS_NUMBER_TYPE_IP = 0x11, /* Internet Protocol(RFC 791) */
- SMS_NUMBER_TYPE_EMAILADDR = 0x12, /* Internet Email Address(RFC 822) */
-} telephony_sms_Is637NumberType_e;
-
-/** @enum telephony_sms_Is637NumberPlan_t
- * This enum defines the plan of address
- */
-enum telephony_sms_Is637NumberPlan {
- SMS_NUMBER_PLAN_UNKNOWN = 0x00, /* Unknown */
- SMS_NUMBER_PLAN_TELEPHONY = 0x01, /* ISDN/Telephony numbering plan */
- SMS_NUMBER_PLAN_RESERVED_2 = 0x02, /* Reserved */
- SMS_NUMBER_PLAN_DATA = 0x03, /* Data numbering plan */
- SMS_NUMBER_PLAN_TELEX = 0x04, /* CTelex numbering plan */
- SMS_NUMBER_PLAN_RESERVED_5 = 0x05, /* Reserved */
- SMS_NUMBER_PLAN_RESERVED_6 = 0x06, /* Reserved */
- SMS_NUMBER_PLAN_RESERVED_7 = 0x07, /* Reserved */
- SMS_NUMBER_PLAN_RESERVED_8 = 0x08, /* Reserved */
- SMS_NUMBER_PLAN_PRIVATE = 0x09, /* Private numbering plan */
- SMS_NUMBER_PLAN_RESERVED_10 = 0x0A, /* Reserved */
- SMS_NUMBER_PLAN_RESERVED_11 = 0x0B, /* Reserved */
- SMS_NUMBER_PLAN_RESERVED_12 = 0x0C, /* Reserved */
- SMS_NUMBER_PLAN_RESERVED_13 = 0x0D, /* Reserved */
- SMS_NUMBER_PLAN_RESERVED_14 = 0x0E, /* Reserved */
- SMS_NUMBER_PLAN_RESERVED_15 = 0x0F, /* Reserved */
-};
-
-/** @enum telephony_sms_Is637SubAddressType_t
- * This enum defines the plan of address
- */
-enum telephony_sms_Is637SubAddressType {
-
- SMS_SUBADDR_NSAP = 0x00, /**< NSAP ( CCITT Recommendation X.213 or ISO 8348 AD2 ) */
- SMS_SUBADDR_USER_SPECIFIED = 0x01, /**< User-specified */
-};
-
-/**
- * This structure defines cause code as an indication whether an SMS error has occurred and
- * if so, whether the condition is considered temporary or permanent
- **/
-struct telephony_sms_Is637CauseCode {
- unsigned char ReplySeqNumber; /* Reply sequence number */
- enum telephony_sms_Is637ErrorClass ErrClass; /* Error report class */
- unsigned char Cause; /* Error cause identifier */
-};
-
-/**
- * This structure defines the parameters of address and its type
- */
-struct telephony_sms_Is637Address {
- enum telephony_sms_Is637DigitMode Digit; /* Digit mode indicator (0x00:4bit_dtmf, 0x01:8bit_code) */
- enum telephony_sms_Is637NumberMode NumberMode; /* Number mode indicator (0x00:ANSI TI607, 0x01:Data network) */
- enum telephony_sms_Is637NumberType NumberType; /* Type of number */
- enum telephony_sms_Is637NumberPlan NumberPlan; /* Numbering plan */
- unsigned char szAddrLength; /* The number of CHARi */
- unsigned char szAddress[SMS_MAXLENGTH_SMS_ADDRESS]; /* The address digit or character */
-};
-
-/**
- * This structure defines the parameters of subaddress of originator and destination
- */
-struct telephony_sms_Is637SubAddress {
- enum telephony_sms_Is637SubAddressType SubType; /* Subaddress type */
- unsigned char Odd; /* Odd/even indicator */
- unsigned char szAddrLength; /* The number of CHARi */
- unsigned char szAddress[SMS_MAXLENGTH_SMS_ADDRESS]; /* A subaddress octet */
-};
-
-/**
- * This structure defines the message center time stamp may be include
- * with SMS message sent from a message center
- */
-struct telephony_sms_TimeStamp {
- unsigned int year; /* Year - if the year is 2002, the year field contains 0x02 */
- unsigned int month; /* Month (1 ~ 12) */
- unsigned int day; /* Day (1 ~ 31) */
- unsigned int hours; /* Hours (0 ~ 23) */
- unsigned int minutes; /* Minute (0 ~ 59) */
- unsigned int seconds; /* Seconds (0 ~ 59) */
-};
-
-/**
- * The structure defines the parameter of SMS submit message
- */
-struct telephony_sms_Is637OutSubmit {
- struct telephony_sms_Is637Address DstAddr; /* Destination address */
- struct telephony_sms_Is637SubAddress DstSubAddr; /* Destination subaddress */
- unsigned short TeleService; /* Teleservice Identifier */
- int bBearerReplySeqRequest; /* Bearer reply sequence request */
- unsigned char ReplySeqNumber; /* Reply sequence number */
- unsigned short MsgId; /* Message identifier */
- unsigned short MsgEncoding; /* Message encoding (defined in TSB-58A) */
- unsigned short MsgLength; /* Message length */
- unsigned char szData[SMS_MAXLENGTH_SMS_MO_USER_DATA]; /* SMS user data */
- struct telephony_sms_TimeStamp ValidityPeriodAbs; /* Validity period - Absolute (not supported) */
- unsigned char ValidityPeriodRel; /* Validity period - Relative (not supported) */
- struct telephony_sms_TimeStamp DeferredDelTimeAbs; /* Deferred delivery time - Absolute */
- unsigned char DeferredDelTimeRel; /* Deferred delivery time - Relative */
- enum telephony_sms_Is637Priority Priority; /* Priority indicator */
- enum telephony_sms_Is637Privacy Privacy; /* Privacy indicator */
- int bUserAckRequest; /* User acknowledge request */
- int bDeliveryAckRequest; /* Delivery acknowledge request */
- enum telephony_sms_Is637AlertPriority AlertPriority; /* Alert priority of message */
- enum telephony_sms_Is637LangIndicator MsgLang; /* Language indicator */
- struct telephony_sms_Is637Address CallBackNumber; /* Callback number address */
-};
-
-/**
- * The structure defines the parameter of SMS acknowledgement message for submit
- */
-struct telephony_sms_Is637OutAck {
- struct telephony_sms_Is637Address DstAddr; /* Destination address */
- struct telephony_sms_Is637SubAddress DstSubAddr; /* Destination subaddress */
- unsigned short TeleService; /* Teleservice Identifier */
- int bBearerReplySeqRequest; /* Bearer reply sequence request */
- unsigned char ReplySeqNumber; /* Reply sequence number */
- unsigned short MsgId; /* Message identifier */
- unsigned short MsgEncoding; /* Message encoding (defined in TSB-58A) */
- unsigned short MsgLength; /* Message length */
- unsigned char szData[SMS_MAXLENGTH_SMS_MO_USER_DATA]; /* SMS user data */
- unsigned char UserResponseCode; /* User response code */
-};
-
-/**
- * The structure defines the parameter of SMS cancellation message
- */
-struct telephony_sms_Is637OutCancel {
- struct telephony_sms_Is637Address DstAddr; /* Destination address */
- struct telephony_sms_Is637SubAddress DstSubAddr; /* Destination subaddress */
- unsigned short TeleService; /* Teleservice Identifier */
- int bBearerReplySeqRequest; /* Bearer reply sequence request */
- unsigned char ReplySeqNumber; /* Reply sequence number */
- unsigned short MsgId; /* Message identifier */
-};
-
-/**
- * The structure defines the parameter of SMS devivery message
- */
-struct telephony_sms_Is637InDeliver {
- struct telephony_sms_Is637Address OrigAddr; /* Origination address */
- struct telephony_sms_Is637SubAddress OrigSubAddr; /* Origination subaddress */
- unsigned short TeleService; /* Teleservice Identifier */
- int bBearerReplySeqRequest; /* Bearer reply sequence request */
- unsigned char ReplySeqNumber; /* Reply sequence number */
- unsigned short MsgId; /* Message identifier */
- unsigned short MsgEncoding; /* Message encoding (defined in TSB-58A) */
- unsigned short MsgLength; /* Message length */
- unsigned char szData[SMS_MAXLENGTH_SMS_MT_USER_DATA]; /* SMS user data */
- struct telephony_sms_TimeStamp MessageCenterTimeStamp; /* Message center time stamp */
- struct telephony_sms_TimeStamp ValidityPeriodAbs; /* Validity period - Absolute */
- unsigned char ValidityPeriodRel; /* Validity period - Relative */
- struct telephony_sms_TimeStamp DeferredDelTimeAbs; /* Deferred delivery time - Absolute (not supported) */
- unsigned char DeferredDelTimeRel; /* Deferred delivery time - Relative (not supported) */
- enum telephony_sms_Is637Priority Priority; /* Priority indicator */
- enum telephony_sms_Is637Privacy Privacy; /* Privacy indicator */
- unsigned char NumMsg; /* Number of voice mail (0-99) */
- int bUserAckRequest; /* User acknowledge request */
- int bDeliveryAckRequest; /* Delivery acknowledge request */
- enum telephony_sms_Is637AlertPriority AlertPriority; /* Alert priority of message */
- enum telephony_sms_Is637LangIndicator MsgLang; /* Language indicator */
- struct telephony_sms_Is637Address CallBackNumer; /* Callback number address */
- enum telephony_sms_Is637MsgDisplayMode Display; /* Message display mode */
-};
-
-/**
- * The structure defines the parameter of SMS acknowledge message for deliver
- */
-struct telephony_sms_Is637InAck {
- struct telephony_sms_Is637Address OrigAddr; /* Origination address */
- struct telephony_sms_Is637SubAddress OrigSubAddr; /* Origination subaddress */
- unsigned short TeleService; /* Teleservice Identifier */
- int bBearerReplySeqRequest; /* Bearer reply sequence request */
- unsigned char ReplySeqNumber; /* Reply sequence number */
- unsigned short MsgId; /* Message identifier */
- unsigned short MsgEncoding; /* Message encoding (defined in TSB-58A) */
- unsigned short MsgLength; /* Message length */
- unsigned char szData[SMS_MAXLENGTH_SMS_MT_USER_DATA]; /* SMS user data */
- unsigned char UserResponseCode; /* User response code */
- struct telephony_sms_TimeStamp MessageCenterTimeStamp; /* Message center time stamp */
-};
-
-/**
- * The structure defines the parameter of SMS acknowledge message from message center
- */
-struct telephony_sms_Is637InDeliverAck {
- struct telephony_sms_Is637Address OrigAddr; /* Origination address */
- struct telephony_sms_Is637SubAddress OrigSubAddr; /* Origination subaddress */
- unsigned short TeleService; /* Teleservice Identifier */
- int bBearerReplySeqRequest; /* Bearer reply sequence request */
- unsigned char ReplySeqNumber; /* Reply sequence number */
- unsigned short MsgId; /* Message identifier */
- unsigned short MsgEncoding; /* Message encoding (defined in TSB-58A) */
- unsigned short MsgLength; /* Message length */
- unsigned char szData[SMS_MAXLENGTH_SMS_MT_USER_DATA]; /* SMS user data */
- struct telephony_sms_TimeStamp MessageCenterTimeStamp; /* Message center time stamp */
-};
-
-/**
- * The structure defines the parameter of SMS broadcast message
- */
-struct telephony_sms_Is637InBroadCast {
- enum telephony_sms_BroadCastCategory ServiceCategory; /* Broadcast service category */
- unsigned short MsgId; /* Message identifier */
- int bBearerReplySeqRequest; /* Bearer reply sequence request */
- unsigned char ReplySeqNumber; /* Reply sequence number */
- unsigned short MsgEncoding; /* Message encoding (defined in TSB-58A) */
- unsigned short MsgLength; /* Message length */
- unsigned char szData[SMS_MAXLENGTH_SMS_MT_USER_DATA]; /* SMS user data */
- struct telephony_sms_TimeStamp MessageCenterTimeStamp; /* Message center time stamp */
- struct telephony_sms_TimeStamp ValidityPeriodAbs; /* Validity period - Absolute */
- unsigned char ValidityPeriodRel; /* Validity period - Relative */
- enum telephony_sms_Is637Priority Priority; /* Priority indicator */
- enum telephony_sms_Is637AlertPriority AlertPriority; /* Alert priority of message */
- enum telephony_sms_Is637LangIndicator MsgLang; /* Language indicator */
- enum telephony_sms_Is637MsgDisplayMode Display; /* Message display mode */
-} telephony_sms_Is637InBroadCast_t;
-
-
-/**
- * The structure defines the type of SMS message as union
- */
-union telephony_sms_CdmaMessage_u {
- struct telephony_sms_Is637OutSubmit outSubmit; /* Outgoing Submit message */
- struct telephony_sms_Is637OutAck outAck; /* Outgoing Acknowledge message */
- struct telephony_sms_Is637OutCancel outCancel; /* Outgoing Cancel message */
- struct telephony_sms_Is637InDeliver inDeliver; /* Incoming Delivery message */
- struct telephony_sms_Is637InAck inAck; /* Incoming Acknowledge message */
- struct telephony_sms_Is637InDeliverAck inDeliverAck; /* Incoming Delivery Acknowledge message */
- struct telephony_sms_Is637InBroadCast inBc; /* Incoming Broadcast message */
-};
-
-/**
- * The structure defines the parameter of entire SMS message of each type
- */
-struct telephony_sms_CdmaMsgInfo {
- int ParamMask; /**< Parameter ID mask */
- enum telephony_sms_CdmaMsgType MsgType; /**< Message type */
- union telephony_sms_CdmaMessage_u MsgData; /**< Message data */
-};
-
-/*-----------------------------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------------------------------*/
-
-
-/*---------------------------------*/
-/* Structs of Requests */
-/*---------------------------------*/
-struct treq_sms_send_umts_msg {
- struct telephony_sms_DataPackageInfo msgDataPackage;
- int more;
-};
-
-struct treq_sms_send_cdma_msg {
- struct telephony_sms_CdmaMsgInfo cdmaMsgInfo;
- unsigned 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_umts_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 result;
-};
-
-struct tresp_sms_set_pref_bearer {
- 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;
-};
-
-struct tresp_sms_send_cdma_msg {
- struct telephony_sms_Is637CauseCode causeCode;
- int result;
-};
-
-/*-----------------------------------*/
-/* Structs of Notifications */
-/*-----------------------------------*/
-struct tnoti_sms_umts_msg {
- struct telephony_sms_DataPackageInfo msgInfo;
-};
-
-struct tnoti_sms_cdma_msg {
- struct telephony_sms_CdmaMsgInfo cdmaMsg;
-};
-
-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 {
- gboolean status;
-};
-
-__END_DECLS
-
-#endif
-
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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_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_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_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, /**< SS operation was successful */
- SS_ERROR_TIMEREXPIRE, /**< SS operation timer expired on network. */
- SS_ERROR_UNKNOWNSUBSCRIBER, /**< SS error indicating unknown/illegal subscriber. */
- SS_ERROR_BEARERSERVICENOTPROVISIONED, /**<The network returns this error when it is requested to @n
- perform an operation on a supplementary service */
- SS_ERROR_TELESERVICENOTPROVISIONED, /**<The network returns this error when it is requested to perform @n
- an operation on a supplementary service */
- SS_ERROR_ILLEGALSSOPERATION, /**<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, /**<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, /**< SS not available in network */
- SS_ERROR_SUBSCRIPTIONVIOLATION, /**< SS service subscription violation. */
- SS_ERROR_INCOMPATIBILITY, /**< 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_SYSTEMFAILURE, /**< This error is returned by the network, when it cannot perform an operation because of a failure in the network */
- SS_ERROR_DATAMISSING, /**< 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, /**< SS error indicating unexpected data value on network side *//**< SS operation barred. */
- SS_ERROR_PWREGISTRATIONFAILURE, /**< SS error indicating change password failure. */
- SS_ERROR_NEGATIVEPWCHECK, /**< SS error indicating negative password check. */
- SS_ERROR_FACILITYNOTSUPPORTED, /**< SS service facility not supported */
- SS_ERROR_RESOURCESNOTAVAILABLE, /**< SS error indicating resources not available in network. */
- SS_ERROR_MAXNOMPTYEXCEEDED, /**< SS error indicating Maximum MPTY is reached. */
- SS_ERROR_CALLBARRED, /**< This error is returned by the network to the MS when call independent subscriber control procedures are barred by the operator */
- SS_ERROR_NUMBEROFPWATTEMPTSVIOLATION, /**< SS error indicating barring password attempts violated. */
- SS_ERROR_ABSENTSUBSCRIBER, /**< This error is returned when the subscriber has activated the detach service or the system detects the absence condition */
- SS_ERROR_ILLEGALSUBSCRIBER, /**<This error is returned when illegality of the access has been @n
- established by use of authentication procedure. */
- SS_ERROR_ILLEGALEQUIPMENT, /**<This error is returned when the IMEI check procedure has shown that @n
- the IMEI is blacklisted or not whitelisted */
- SS_ERROR_USSDBUSY, /**< SS error indicating USSD Busy(Already SS / USSD is ongoing). */
- SS_ERROR_UNKNOWNALPHABET, /**< SS error indicating unknown SS data coding of alphabet */
- SS_ERROR_INVALIDDEFLECTEDTONUMBER, /**< SS error indicating the invalid deflected to number. */
- SS_ERROR_DEFLECTIONTOSERVEDSUBSCRIBER, /**< This error is returned if a diversion to the served @n
- subscriber's number was requested. */
- SS_ERROR_SPECIALSERVICECODE, /**< This error is returned if diversion to a special service code was requested. */
- SS_ERROR_REJECTEDBYUSER, /**< SS operation rejected by user. */
- SS_ERROR_REJECTEDBYNETWORK, /**< SS operation rejected by network. */
- SS_ERROR_NET_NOT_ALLOWED_EMERGENCY_CALLS_ONLY, /**< SS operation is not allowed by network. */
- SS_ERROR_UNKNOWNERROR, /**< SS error indicating unknown error */
- SS_ERROR_OEM_NOT_SUPPORTED /**< If oem do not support any of SS requests, then this error will be returned back */
-};
-
-
-#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;
- 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;
-};
-
-#define MAX_SS_USSD_LEN 208
-struct treq_ss_ussd {
- enum telephony_ss_ussd_type type;
- 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;
- gboolean number_present;
- int number_type;
- 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_cli {
- enum telephony_ss_cli_type type;
- gboolean status;
- enum telephony_ss_error err;
-};
-
-struct tresp_ss_ussd {
- enum telephony_ss_ussd_type type;
- enum telephony_ss_ussd_status status;
- char str[ MAX_SS_USSD_LEN ];
- enum telephony_ss_error err;
-};
-
-
-
-// notification
-
-struct tnoti_ss_ussd {
- enum telephony_ss_ussd_status status;
- char str[ MAX_SS_USSD_LEN ];
-};
-
-#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 ];
-};
-
-__END_DECLS
-
-#endif
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_UDEV_H__
-#define __TCORE_UDEV_H__
+#ifndef __UDEV_H__
+#define __UDEV_H__
#include <gudev/gudev.h>
-__BEGIN_DECLS
+#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);
GUdevClient* tcore_udev_ref_client(TcoreUdev *udev);
GUdevEnumerator* tcore_udev_ref_enumerator(TcoreUdev *udev);
-TReturn tcore_udev_add_enumerator_callback(TcoreUdev *udev, TcoreUdevEnumerCallback func, void *user_data);
+TelReturn tcore_udev_add_enumerator_callback(TcoreUdev *udev, TcoreUdevEnumerCallback func, void *user_data);
GList* tcore_udev_exec_enumerator(TcoreUdev *udev, gboolean event_emit_flag);
-TReturn tcore_udev_add_callback(TcoreUdev *udev, const char *subsystem, const char *action, TcoreUdevCallback func, void *user_data);
-
-__END_DECLS
+TelReturn tcore_udev_add_callback(TcoreUdev *udev, const char *subsystem, const char *action, TcoreUdevCallback func, void *user_data);
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __UDEV_H__ */
+++ /dev/null
-/*
- * 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
-
-struct tcore_user_info {
- uid_t uid;
- gid_t gid;
- pid_t pid;
-
- char *appname;
- unsigned int channel_id;
- unsigned int client_cmd;
-
- void *user_data;
-};
-
-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,
- const struct tcore_user_info *ui);
-const struct tcore_user_info*
- 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
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#ifndef __TCORE_UTIL_H__
-#define __TCORE_UTIL_H__
+#ifndef __UTIL_H__
+#define __UTIL_H__
#include <glib-object.h>
-__BEGIN_DECLS
+#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);
+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);
-enum tcore_util_marshal_data_type {
+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 {
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,
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,
-};
-
-
-union tcore_ip4_type {
- uint32_t i;
- unsigned char s[4];
-};
+} TcoreUtilMarshalData;
-enum tcore_dcs_type {
+typedef enum {
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,
-};
-
-TReturn tcore_util_netif(const char *name, gboolean enabled);
-TReturn tcore_util_netif_set(const char *name, const char *ipaddr,
- const char *gateway, const char *netmask);
-
-char* tcore_util_get_string_by_ip4type(union tcore_ip4_type ip);
+} TcoreUtilDcs;
-GHashTable* tcore_util_marshal_create();
-void tcore_util_marshal_destory(GHashTable *ht);
+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);
-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, 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);
+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, TcoreUtilMarshalData type);
+gboolean tcore_util_marshal_get_data(GHashTable *ht, const gchar *key,
+ void **data, TcoreUtilMarshalData type);
-enum tcore_dcs_type
- tcore_util_get_cbs_coding_scheme(unsigned char 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);
-unsigned char* tcore_util_decode_hex(const char *src, int len);
-long tcore_util_encode_hex(const unsigned char *src, long num_bytes,
- char *buf);
+TcoreUtilDcs tcore_util_get_cbs_coding_scheme(guchar encode);
-int tcore_util_pdu_encode(const unsigned char *sca, const unsigned char *tpdu,
- int tpdu_len, char *pdu);
-
-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_bcd2ascii(const char *src, int src_len, int max_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(unsigned 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);
-void tcore_util_swap_byte_order(unsigned short* dest, const unsigned short* src, int src_len);
-
-char* tcore_util_get_version(void);
-
-__END_DECLS
+guchar *tcore_util_decode_hex(const char *src, int len);
+#endif /* #if 0 */
+#ifdef __cplusplus
+}
#endif
+
+#endif /* __UTIL_H__ */
+%define major 3
+%define minor 0
+%define patchlevel 1
+
Name: libtcore
Summary: Telephony-core library
-Version: 0.1.85
+Version: %{major}.%{minor}.%{patchlevel}
Release: 1
Group: System/Libraries
License: Apache-2.0
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include "tcore.h"
#include "hal.h"
#include "queue.h"
-#include "user_request.h"
#include "at.h"
#include "core_object.h"
#define MAX_AT_RESPONSE 255
-typedef gboolean (*rfs_hook_cb) (const char *data);
+typedef gboolean (*rfs_hook_cb) (const gchar *data);
struct tcore_at_type {
TcoreHal *hal;
- enum tcore_at_command_type cmd_type;
+ TcoreAtCommandType cmd_type;
GHashTable *unsolicited_table;
- struct tcore_at_request *req;
- struct tcore_at_response *resp;
+ TcoreAtRequest *req;
+ TcoreAtResponse *resp;
- unsigned int buf_size;
- char *buf;
- char *buf_read_pos;
- char *buf_write_pos;
+ guint buf_size;
+ gchar *buf;
+ gchar *buf_read_pos;
+ gchar *buf_write_pos;
gboolean pdu_status;
struct _notification *pdu_noti;
};
struct _notification_callback {
- TcoreATNotificationCallback callback;
+ TcoreAtNotificationCallback callback;
void *user_data;
};
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 1 if line is a final response indicating success
+ * Returns TCORE_AT_RECV_MSG_TYPE_RESP_SUCCESS
+ * if line is a final response indicating success
+ *
* See 27.007 annex B
*/
-static const char *list_final_responses_success[] = {
+static const gchar *at_final_responses_success[] = {
"OK",
- "CONNECT",
+ "CONNECT"
};
/**
- * returns 1 if line is a final response indicating error
+ * Returns TCORE_AT_RECV_MSG_TYPE_RESP_FAILURE
+ * if line is a final response indicating error
+ *
* See 27.007 annex B
*/
-static const char *list_final_responses_error[] = {
- "ERROR",
+static const gchar *at_final_responses_error[] = {
"+CMS ERROR:",
"+CME ERROR:",
+ "ERROR",
"NO ANSWER",
- "NO DIALTONE",
+ "NO CARRIER",
+ "BUSY",
+ "NO DIALTONE"
};
-static int _check_final_response(const char *line)
+static TcoreAtRcvMsgType __check_final_response(const gchar *line)
{
- unsigned int i;
+ guint i;
- 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_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_error); i++) {
- if (g_str_has_prefix(line, list_final_responses_error[i])) {
- return 2;
- }
- }
+ 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;
- return 0;
+ return TCORE_AT_RECV_MSG_TYPE_NOTI;
}
-static char* _find_next_EOL(char *cur)
+static gchar *_find_next_EOL(gchar *cur)
{
- if (cur[0] == '>' && cur[1] == ' ' && cur[2] == '\0') {
- /* SMS prompt character...not \r terminated */
- return cur + 2;
- }
-
- // Find next newline
- while (*cur != '\0' && !((*cur == CR) && (*(cur + 1) == LF))) // avoid issue when AT response is having <CR> in between before end of line( <CR> <LF>) or '/0'
+ if (cur[0] == '>' && cur[1] == ' ' && cur[2] == '\0')
+ return cur + 2; /* SMS prompt character...not \r terminated */
+
+ /*
+ * Find next newline
+ *
+ * Avoid issue when AT response is having <CR> in between,
+ * before end of line ( <CR> <LF>) or '/0'
+ */
+ while (*cur != '\0' && !((*cur == CR) && (*(cur + 1) == LF)))
cur++;
return *cur == '\0' ? NULL : cur;
}
-static struct tcore_at_response* _response_new()
+static TcoreAtResponse *__response_new()
{
- struct tcore_at_response *resp;
+ TcoreAtResponse *at_resp;
- resp = calloc(1, sizeof(struct tcore_at_response));
- if (resp == NULL)
+ at_resp = tcore_try_malloc0(sizeof(TcoreAtResponse));
+ if (at_resp == NULL) {
+ err("Failed to allocate memory");
return NULL;
+ }
- return resp;
+ return at_resp;
}
-static void _response_free(struct tcore_at_response *resp)
+static void __response_free(TcoreAtResponse *at_resp)
{
- if (resp == NULL)
+ if (at_resp == NULL) {
+ err("Response is NULL");
return;
-
- if (resp->lines) {
- g_slist_free_full(resp->lines, g_free);
}
- if (resp->final_response)
- free(resp->final_response);
-
- free(resp);
+ g_slist_free_full(at_resp->lines, g_free);
+ tcore_free(at_resp->final_response);
+ tcore_free(at_resp);
}
-static void _response_add(struct tcore_at_response *resp,
- const char *line)
+static void __response_add(TcoreAtResponse *at_resp, const gchar *line)
{
- if (resp == NULL || !line)
+ if ((at_resp == NULL) || (line == NULL)) {
+ err("at_resp: [%p] line: [%p]", at_resp, line);
return;
+ }
- dbg("current lines = %d", g_slist_length(resp->lines));
+ dbg("Current number of lines: [%d]", g_slist_length(at_resp->lines));
- resp->lines = g_slist_append(resp->lines, strdup(line));
+ at_resp->lines = g_slist_append(at_resp->lines, tcore_strdup(line));
}
-static void _emit_pending_response(TcoreAT *at)
+static void __emit_pending_response(TcoreAT *at)
{
TcorePending *p;
- if (at == NULL)
+ if (at == NULL) {
+ err("at is NULL");
return;
+ }
tcore_at_request_free(at->req);
at->req = NULL;
p = tcore_queue_pop(tcore_hal_ref_queue(at->hal));
if (p == NULL) {
- dbg("no pending");
+ warn("NO pending request!!!");
+ return;
}
- tcore_pending_emit_response_callback(p, sizeof(TcoreATResponse), at->resp);
- tcore_user_request_unref(tcore_pending_ref_user_request(p));
+ tcore_pending_emit_response_callback(p, sizeof(TcoreAtResponse), at->resp);
tcore_pending_free(p);
- _response_free(at->resp);
+ __response_free(at->resp);
at->resp = NULL;
}
-static void _emit_unsolicited_message(TcoreAT *at, const char *line)
+static void __emit_unsolicited_message(TcoreAT *at, const gchar *line)
{
struct _notification *noti = NULL;
struct _notification_callback *item = NULL;
gboolean ret;
GSList *data = NULL;
- if ((at == NULL) || !line)
+ if ((at == NULL) || (line == NULL)) {
+ err("at: [%p] line: [%p]", 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))
+ if (g_str_has_prefix(line, key) == 0)
continue;
noti = value;
break;
}
- if (!noti)
+ if (noti == NULL)
return;
if (noti->type_pdu == TRUE) {
+ dbg("PDU mode");
+
at->pdu_status = TRUE;
at->pdu_noti = noti;
- at->pdu_lines = g_slist_append(NULL, g_strdup(line));
- dbg("PDU mode");
+ at->pdu_lines =
+ g_slist_append(NULL, tcore_strdup(line));
+
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;
if (at->data_mode == MODE_BIN) {
dbg("Binary mode");
at->pdu_lines = g_slist_append(at->pdu_lines, (gpointer)line);
- dbg("at->pdu_lines: 0x%x", at->pdu_lines);
- } else {
- at->pdu_lines = g_slist_append(at->pdu_lines, g_strdup(line));
+ dbg("at->pdu_lines: [%p]", at->pdu_lines);
}
+ 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) {
- 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;
+ 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);
+ }
+ }
}
- p = p->next;
+ p = tmp_list->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) {
+ 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 (!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);
+ if (noti != NULL)
+ g_slist_free_full(noti->callbacks, g_free);
}
-#endif
-TcoreAT* tcore_at_new(TcoreHal *hal)
+TcoreAT *tcore_at_new(TcoreHal *hal)
{
TcoreAT *at;
at = g_try_new0(struct tcore_at_type, 1);
- if (at == NULL)
+ if (at == NULL) {
+ err("Failed to allocate memory");
return NULL;
+ }
at->hal = hal;
at->buf_size = MAX_AT_RESPONSE;
- at->buf = g_try_malloc0(at->buf_size + 1);
+ 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_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)
+ if (at == NULL) {
+ err("AT-Command is NULL");
return;
+ }
- if (at->buf)
- free(at->buf);
-
- if (at->unsolicited_table)
- g_hash_table_destroy(at->unsolicited_table);
-
- free(at);
+ g_hash_table_destroy(at->unsolicited_table);
+ tcore_free(at->buf);
+ tcore_free(at);
}
-TReturn tcore_at_remove_notification_full(TcoreAT *at, const char *prefix, TcoreATNotificationCallback callback, void *user_data)
+TelReturn tcore_at_remove_notification_full(TcoreAT *at, const gchar *prefix,
+ TcoreAtNotificationCallback callback, void *user_data)
{
struct _notification *noti;
struct _notification_callback *item;
GSList *p;
if ((at == NULL) || !prefix)
- return TCORE_RETURN_EINVAL;
+ return TEL_RETURN_INVALID_PARAMETER;
if (!callback) {
/* remove all callbacks for prefix */
g_hash_table_remove(at->unsolicited_table, prefix);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
noti = g_hash_table_lookup(at->unsolicited_table, prefix);
if (!noti)
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
p = noti->callbacks;
for (; p; p = p->next) {
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 TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_at_remove_notification(TcoreAT *at, const char *prefix, TcoreATNotificationCallback callback)
+TelReturn tcore_at_remove_notification(TcoreAT *at,
+ const gchar *prefix, TcoreAtNotificationCallback callback)
{
return tcore_at_remove_notification_full(at, prefix, callback, NULL);
}
-TReturn tcore_at_add_notification(TcoreAT *at, const char *prefix,
- gboolean pdu, TcoreATNotificationCallback callback,
- void *user_data)
+TelReturn tcore_at_add_notification(TcoreAT *at, const gchar *prefix,
+ gboolean pdu, TcoreAtNotificationCallback callback, void *user_data)
{
struct _notification *noti;
struct _notification_callback *item;
if ((at == NULL) || !prefix || !callback)
- return TCORE_RETURN_EINVAL;
+ return TEL_RETURN_INVALID_PARAMETER;
noti = g_hash_table_lookup(at->unsolicited_table, prefix);
- if (!noti) {
+ if (noti == NULL) {
noti = g_try_new0(struct _notification, 1);
if (!noti)
- return TCORE_RETURN_ENOMEM;
+ return TEL_RETURN_MEMORY_FAILURE;
noti->type_pdu = pdu;
noti->callbacks = NULL;
- g_hash_table_insert(at->unsolicited_table, g_strdup(prefix), noti);
+ g_hash_table_insert(at->unsolicited_table, tcore_strdup(prefix), noti);
}
if (noti->type_pdu != pdu)
- return TCORE_RETURN_EINVAL;
+ return TEL_RETURN_INVALID_PARAMETER;
item = g_try_new0(struct _notification_callback, 1);
- if (!item)
- return TCORE_RETURN_ENOMEM;
+ if (item == NULL)
+ return TEL_RETURN_MEMORY_FAILURE;
item->callback = callback;
item->user_data = user_data;
noti->callbacks = g_slist_append(noti->callbacks, item);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_at_set_request(TcoreAT *at, TcoreATRequest *req, gboolean send)
+TelReturn tcore_at_set_request(TcoreAT *at, TcoreAtRequest *req, gboolean send)
{
- TReturn ret;
- char *end;
- char next;
-
- if (at == NULL)
- return TCORE_RETURN_EINVAL;
+ TelReturn ret;
+ gchar *end;
+ gchar next;
+ if (at == NULL) {
+ err("AT-Command is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
at->req = req;
if (req) {
- dbg("req->cmd = [%s]", at->req->cmd);
- dbg("req->prefix = [%s]", at->req->prefix);
- dbg("req->type = %d", at->req->type);
+ dbg("AT Request - Command: [%s] Pre-fix: [%s] Type: [%d])",
+ at->req->cmd, at->req->prefix, at->req->type);
}
if (send == FALSE)
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
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;
return ret;
}
-TcoreATRequest* tcore_at_get_request(TcoreAT *at)
+TcoreAtRequest *tcore_at_get_request(TcoreAT *at)
{
- if (at == NULL)
+ if (at == NULL) {
+ err("AT-Command is NULL");
return NULL;
+ }
return at->req;
}
-TcoreATResponse* tcore_at_get_response(TcoreAT *at)
+TcoreAtResponse *tcore_at_get_response(TcoreAT *at)
{
- if (at == NULL)
+ if (at == NULL) {
+ err("AT-Command is NULL");
return NULL;
+ }
return at->resp;
}
-TReturn tcore_at_buf_write(TcoreAT *at, unsigned int data_len, const char *data)
+TelReturn tcore_at_buf_write(TcoreAT *at, guint data_len, const gchar *data)
{
- unsigned int read_pos;
- unsigned int write_pos;
+ guint read_pos;
+ guint write_pos;
- if (at == NULL)
- return TCORE_RETURN_EINVAL;
+ if (at == NULL) {
+ err("AT-Command is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
read_pos = at->buf_read_pos - at->buf;
write_pos = at->buf_write_pos - at->buf;
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, 0, 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, 0x0,
+ at->buf_size - (at->buf_write_pos - at->buf));
}
write_pos = at->buf_write_pos - at->buf;
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, 0, at->buf_size - (at->buf_write_pos - at->buf));
+ memset(at->buf_write_pos, 0x0,
+ at->buf_size - (at->buf_write_pos - at->buf));
dbg("resize buffer to %d", at->buf_size);
}
at->buf_write_pos += data_len;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TcoreATRequest* tcore_at_request_new(const char *cmd, const char *prefix, enum tcore_at_command_type type)
+TcoreAtRequest *tcore_at_request_new(const gchar *cmd,
+ const gchar *prefix, TcoreAtCommandType type)
{
- TcoreATRequest *req;
+ TcoreAtRequest *at_req;
- if (cmd == NULL)
+ if (cmd == NULL) {
+ err("AT-Command is NULL");
return NULL;
+ }
- if (strlen(cmd) < 1)
+ if (strlen(cmd) < 1) {
+ err("Invalid AT-Command length: [%d]", strlen(cmd));
return NULL;
+ }
- req = g_try_new0(struct tcore_at_request, 1);
- if (req == NULL)
+ at_req = g_try_new0(TcoreAtRequest, 1);
+ if (at_req == NULL) {
+ err("Failed to allocate memory");
return NULL;
+ }
- if (!strchr(cmd, CR))
- req->cmd = g_strdup_printf("%s%c", cmd, CR);
+ if (strchr(cmd, CR) == 0)
+ at_req->cmd = g_strdup_printf("%s%c", cmd, CR);
else
- req->cmd = g_strdup_printf("%s%c", cmd, 26);
+ at_req->cmd = g_strdup_printf("%s%c", cmd, 26);
if (prefix)
- req->prefix = strdup(prefix);
+ at_req->prefix = tcore_memdup(prefix, strlen(prefix) + 1);
- req->type = type;
+ 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));
- return req;
+ return at_req;
}
-void tcore_at_request_free(TcoreATRequest *req)
+void tcore_at_request_free(TcoreAtRequest *at_req)
{
- if (req == NULL)
+ if (at_req == NULL) {
+ err("AT-Command is NULL");
return;
+ }
- if (req->cmd)
- free(req->cmd);
-
- if (req->prefix)
- free(req->prefix);
-
- free(req);
+ tcore_free(at_req->cmd);
+ tcore_free(at_req->prefix);
+ tcore_free(at_req);
}
/* To get the length value from little-endian bytes */
-static int __sum_4_bytes(const char *posn)
+static gint __sum_4_bytes(const gchar *posn)
{
- int sum = 0;
+ gint sum = 0;
sum = sum | (*(posn+3)) << 24;
sum = sum | (*(posn+2)) << 16;
sum = sum | (*(posn+1)) << 8;
}
/* Function to process binary data received as part of XDRV Indication */
-void tcore_at_process_binary_data(TcoreAT *at, char *position, int data_len)
+void tcore_at_process_binary_data(TcoreAT *at, gchar *position, guint data_len)
{
#define NVM_PAYLOAD_LENGTH_0 52
#define NVM_PAYLOAD_LENGTH_1 68
- int m_length_0 = ZERO , m_length_1 = ZERO;
- static int data_len_final = ZERO, actual_buffer_size = ZERO;
+ gint m_length_0 = ZERO , m_length_1 = ZERO;
+ static gint data_len_final = ZERO, actual_buffer_size = ZERO;
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);
+ 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) {
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) {
- _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;
dbg("Exit");
}
-gboolean tcore_at_process(TcoreAT *at, unsigned int data_len, const char *data)
+gboolean tcore_at_process(TcoreAT *at, guint data_len, const gchar *data)
{
- char *pos;
- char *next_pos;
- int ret;
+ gchar *pos;
+ gchar *next_pos;
+ TcoreAtRcvMsgType ret;
if ((at == NULL) || (data == NULL))
return FALSE;
pos++;
next_pos = _find_next_EOL(pos);
- if (!next_pos)
- {
+ if (!next_pos) {
dbg("Data could be in Binary mode !!");
if (at->rfs_hook) {
if (TRUE == at->rfs_hook(pos)){
tcore_at_process_binary_data(at, pos, data_len);
}
dbg("Not Binary data");
- }
- dbg("Rfs hook is not set !!");
+ }else
+ dbg("Rfs hook is not set !!");
break;
}
if (pos != next_pos)
*next_pos = '\0';
- // dbg("complete line found.");
dbg("line = [%s]", pos);
- // check request
+
+ /* Check request */
if (at->req == NULL) {
- dbg(" Not At request " );
- _emit_unsolicited_message(at, pos);
+ dbg(" Not AT request " );
+ __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);
+ tcore_hal_send_data(at->hal,
+ strlen(at->req->next_send_pos),
+ at->req->next_send_pos);
+
pos += 2;
at->buf_read_pos = pos;
break;
}
}
- if (at->resp == NULL) {
- at->resp = _response_new();
- }
+ if (at->resp == NULL)
+ at->resp = __response_new();
- ret = _check_final_response(pos);
- if (ret) {
- if (ret == 1)
- at->resp->success = TRUE;
- else
- at->resp->success = FALSE;
+ 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);
- at->resp->final_response = strdup(pos);
+ at->resp->final_response = tcore_strdup(pos);
- _emit_pending_response(at);
+ __emit_pending_response(at);
at->buf_read_pos = next_pos + 1;
+
return TRUE;
- } else {
+ }
+
+ case TCORE_AT_RECV_MSG_TYPE_NOTI: {
switch (at->req->type) {
- case TCORE_AT_NO_RESULT:
- _emit_unsolicited_message(at, pos);
+ case TCORE_AT_COMMAND_TYPE_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);
- }
+ case TCORE_AT_COMMAND_TYPE_NUMERIC:
+ if (at->resp->lines == NULL && isdigit(pos[0]))
+ __response_add(at->resp, pos);
+ else
+ __emit_unsolicited_message(at, pos);
+ break;
- break;
+ 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))
+ __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_SINGLELINE:
- dbg("Type is 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_COMMAND_TYPE_MULTILINE:
+ dbg("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;
+ case TCORE_AT_COMMAND_TYPE_PDU:
+ dbg("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;
- }
- }
+ warn("UNKNOWN");
+ __emit_unsolicited_message(at, pos);
+ break;
+ } /* switch (at->req->type) */
+ } break;
+ } /* switch (ret) */
}
//
pos = next_pos + 1;
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 char *cmd, const char *prefix, enum tcore_at_command_type type, TcorePendingResponseCallback func, void *user_data)
+TcorePending *tcore_at_pending_new(CoreObject *co,
+ const gchar *cmd, const gchar *prefix, TcoreAtCommandType type,
+ TcorePendingResponseCallback func, void *user_data)
{
TcorePending *p;
- TcoreATRequest *req;
+ TcoreAtRequest *req;
if (cmd == NULL)
return NULL;
return p;
}
-#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)
+GSList *tcore_at_tok_new(const gchar *line)
{
- char *begin;
- char *pos;
- char *buf = NULL;
- char *mark_end = NULL;
- int type = TYPE_NONE;
+ gchar *begin;
+ gchar *pos;
+ gchar *buf = NULL;
+ gchar *mark_end = NULL;
+ TcoreAtTokenType type = TCORE_AT_TOKEN_TYPE_NONE;
GSList *tokens = NULL;
if (line == NULL)
if (line[0] == '(') {
/* list token container */
- pos = (char *) line;
+ pos = (gchar *) line;
if (line[strlen(line) - 1] == ')')
- mark_end = (char *) line + strlen(line) - 1;
+ mark_end = (gchar *) line + strlen(line) - 1;
} else {
- /* normal at message */
+ /* normal AT message */
pos = strchr(line, ':');
- if (!pos) {
- tokens = g_slist_append(tokens, strdup(line));
+ if (pos == NULL) {
+ tokens = g_slist_append(tokens, tcore_strdup(line));
return tokens;
}
}
pos++;
- /* skip whitespace */
- while (*pos != '\0' && isspace(*pos)) {
+ /* skip whitespace(s) */
+ while (*pos != '\0' && isspace(*pos))
pos++;
- }
begin = pos;
do {
switch (type) {
- 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;
- }
+ 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;
+
begin = pos;
- break;
+ } break;
- case TYPE_STR:
+ case TCORE_AT_TOKEN_TYPE_STR: {
if (*pos == '"') {
- type = TYPE_STR_FIN;
- buf = g_try_malloc0(pos - begin + 2);
+ type = TCORE_AT_TOKEN_TYPE_STR_FIN;
+
+ buf = tcore_try_malloc0(pos - begin + 2);
memcpy(buf, begin, pos - begin + 1);
tokens = g_slist_append(tokens, buf);
}
- break;
+ } break;
- case TYPE_PAREN:
+ case TCORE_AT_TOKEN_TYPE_PAREN: {
if (*pos == ')') {
- type = TYPE_PAREN_FIN;
- buf = g_try_malloc0(pos - begin + 2);
+ type = TCORE_AT_TOKEN_TYPE_PAREN_FIN;
+
+ buf = tcore_try_malloc0(pos - begin + 2);
memcpy(buf, begin, pos - begin + 1);
tokens = g_slist_append(tokens, buf);
}
- break;
+ } break;
- case TYPE_RAW:
+ case TCORE_AT_TOKEN_TYPE_RAW: {
if (*pos == ',' || *pos == '\0') {
- type = TYPE_NONE;
- buf = g_try_malloc0(pos - begin + 1);
+ type = TCORE_AT_TOKEN_TYPE_NONE;
+ buf = tcore_try_malloc0(pos - begin + 1);
memcpy(buf, begin, pos - begin);
tokens = g_slist_append(tokens, buf);
}
- break;
+ } break;
- case TYPE_STR_FIN:
- case TYPE_PAREN_FIN:
- if (*pos == ',') {
- type = TYPE_NONE;
- }
- break;
+ case TCORE_AT_TOKEN_TYPE_STR_FIN:
+ case TCORE_AT_TOKEN_TYPE_PAREN_FIN: {
+ if (*pos == ',')
+ type = TCORE_AT_TOKEN_TYPE_NONE;
+ } break;
}
if (*pos == '\0' || pos == mark_end)
pos++;
} while (1);
- if (type == TYPE_RAW) {
- buf = g_try_malloc0(pos - begin + 1);
+ if (type == TCORE_AT_TOKEN_TYPE_RAW) {
+ buf = tcore_try_malloc0(pos - begin + 1);
memcpy(buf, begin, pos - begin);
tokens = g_slist_append(tokens, buf);
}
void tcore_at_tok_free(GSList *tokens)
{
- if (tokens == NULL)
- return;
-
- g_slist_free_full(tokens, g_free);
+ if (tokens != NULL)
+ g_slist_free_full(tokens, g_free);
}
-char* tcore_at_tok_extract(const char *src)
+gchar *tcore_at_tok_extract(const gchar *src)
{
- char *dest = NULL;
- char *last = NULL;
+ gchar *dest = NULL;
+ gchar *last = NULL;
if (src == NULL)
return NULL;
if (strlen(src) < 2)
- return g_strdup(src);
+ return tcore_strdup(src);
- last = (char *) src + strlen(src) - 1;
+ last = (gchar *) src + strlen(src) - 1;
switch (*src) {
case '(':
if (*last == ')') {
- dest = g_strdup(src + 1);
+ dest = tcore_strdup(src + 1);
dest[strlen(dest) - 1] = '\0';
}
break;
case '"':
if (*last == '"') {
- dest = g_strdup(src + 1);
+ dest = tcore_strdup(src + 1);
dest[strlen(dest) - 1] = '\0';
}
break;
default:
- return g_strdup(src);
- break;
+ return tcore_strdup(src);
}
return dest;
}
-char* tcore_at_tok_nth(GSList *tokens, unsigned int token_index)
+gchar *tcore_at_tok_nth(GSList *tokens, guint index)
{
if (tokens == NULL)
return NULL;
- if (token_index > g_slist_length(tokens))
+ if (index > g_slist_length(tokens))
return NULL;
- return (char *) g_slist_nth_data(tokens, token_index);
+ return (gchar *) g_slist_nth_data(tokens, index);
}
gboolean tcore_at_add_hook(TcoreHal *hal, void *hook_func)
return FALSE;
}
-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)
+TelReturn tcore_at_prepare_and_send_request(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)
{
- TcorePending *pending = NULL;
- TcoreATRequest *req = NULL;
- TcoreHal *hal = NULL;
- TReturn ret = TCORE_RETURN_FAILURE;
+ TcorePending *pending;
+ TcoreAtRequest *at_req;
+ TcoreHal *hal;
+ TelReturn ret = TEL_RETURN_FAILURE;
hal = tcore_object_get_hal(co);
- if (!hal) {
- dbg("HAL is NULL");
+ if (hal == NULL) {
+ err("HAL is NULL");
return ret;
}
- dbg("hal: [0x%x]", hal);
+ dbg("hal: [%p]", hal);
/* Create Pending Request */
pending = tcore_pending_new(co, 0);
- if (!pending) {
- dbg("Pending is NULL");
+ if (pending == NULL) {
+ err("Pending is NULL");
return ret;
}
/* Create AT-Command Request */
- req = tcore_at_request_new(at_cmd, at_cmd_prefix, at_cmd_type);
- if (req == NULL) {
- dbg("Request is NULL");
+ at_req = tcore_at_request_new(cmd, prefix, type);
+ if (at_req == NULL) {
+ err("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, req);
+ tcore_pending_set_request_data(pending, 0, at_req);
+ tcore_pending_link_request(pending, request);
+
+ tcore_pending_set_priority(pending, priority);
+
tcore_pending_set_response_callback(pending, resp_cb, resp_cb_data);
tcore_pending_set_send_callback(pending, send_cb, send_cb_data);
- tcore_pending_link_user_request(pending, ur);
+
+ if (timeout > 0)
+ tcore_pending_set_timeout(pending, timeout);
+ tcore_pending_set_timeout_callback(pending, timeout_cb, timeout_cb_data);
ret = tcore_hal_send_request(hal, pending);
dbg("ret: [0x%x]", ret);
+
return ret;
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
*/
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-
#include <glib.h>
#include "tcore.h"
#include "plugin.h"
-#include "server.h"
-#include "queue.h"
-#include "user_request.h"
#include "co_call.h"
/* Max 6 Call Objects are supported */
-#define MAX_CALL_OBJECTS 6
-
-#define _check_null(name, value, err) { \
- if (NULL == value) { \
- dbg("[error] %s : NULL", name); \
- return err; \
- } \
-}
+#define MAX_CALL_OBJECTS 6
-typedef gboolean(*func)(struct call_object *co, void *data);
-
-struct call_cli_info {
- enum tcore_call_cli_mode mode;
- 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;
-};
-
-struct private_object_data {
+typedef struct {
GSList *cobjs;
- struct tcore_call_operations *ops;
- struct tcore_call_control_operations *cops;
+ TcoreCallOps *ops;
+} PrivateObject;
- /* To be removed later */
- struct tcore_call_information_operations *iops;
-};
+typedef gboolean(*TcoreCompareCallObject)(CallObject *call_obj, void *data);
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void _po_clone_hook(CoreObject *src, CoreObject *dest)
{
- struct private_object_data *src_po;
- struct private_object_data *dest_po;
+ PrivateObject *src_po;
+ PrivateObject *dest_po;
- if ((NULL == src) || (NULL == dest))
- return;
-
- dest_po = g_try_new0(struct private_object_data, 1);
- if (NULL == dest_po) {
- tcore_object_link_object(dest, NULL);
- return;
- }
+ tcore_check_return_assert(src != NULL);
+ tcore_check_return_assert(dest != NULL);
src_po = tcore_object_ref_object(src);
if (NULL == src_po) {
+ err("invalid source private object");
tcore_object_link_object(dest, NULL);
- g_free(dest_po);
return;
}
- dest_po->ops = src_po->ops;
- dest_po->cops = src_po->cops;
-
+ 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);
}
-static void _clone_call_operations(struct private_object_data *po,
- struct tcore_call_operations *call_ops)
-{
- if (call_ops->dial)
- po->ops->dial = call_ops->dial;
-
- if (call_ops->answer)
- po->ops->answer = call_ops->answer;
-
- if (call_ops->end)
- po->ops->end = call_ops->end;
-
- if (call_ops->hold)
- po->ops->hold = call_ops->hold;
-
- if (call_ops->active)
- po->ops->active = call_ops->active;
-
- if (call_ops->swap)
- po->ops->swap = call_ops->swap;
-
- if (call_ops->join)
- po->ops->join = call_ops->join;
-
- if (call_ops->split)
- po->ops->split = call_ops->split;
-
- if (call_ops->deflect)
- po->ops->deflect = call_ops->deflect;
-
- if (call_ops->transfer)
- po->ops->transfer = call_ops->transfer;
-
- if (call_ops->send_dtmf)
- po->ops->send_dtmf = call_ops->send_dtmf;
-
- if (call_ops->set_sound_path)
- po->ops->set_sound_path = call_ops->set_sound_path;
-
- if (call_ops->set_sound_volume_level)
- po->ops->set_sound_volume_level =
- call_ops->set_sound_volume_level;
-
- if (call_ops->get_sound_volume_level)
- po->ops->get_sound_volume_level =
- call_ops->get_sound_volume_level;
-
- if (call_ops->mute)
- po->ops->mute = call_ops->mute;
-
- if (call_ops->unmute)
- po->ops->unmute = call_ops->unmute;
-
- if (call_ops->get_mute_status)
- po->ops->get_mute_status = call_ops->get_mute_status;
-
- if (call_ops->set_sound_recording)
- po->ops->set_sound_recording = call_ops->set_sound_recording;
-
- if (call_ops->set_sound_equalization)
- po->ops->set_sound_equalization =
- call_ops->set_sound_equalization;
-
- if (call_ops->set_sound_noise_reduction)
- po->ops->set_sound_noise_reduction =
- call_ops->set_sound_noise_reduction;
-
- if (call_ops->set_active_line)
- po->ops->set_active_line = call_ops->set_active_line;
-
- if (call_ops->get_active_line)
- po->ops->get_active_line = call_ops->get_active_line;
-
- if (call_ops->activate_ccbs)
- po->ops->activate_ccbs = call_ops->activate_ccbs;
-}
-
-static void _clone_call_control_operations(struct private_object_data *po,
- struct tcore_call_control_operations *control_ops)
+static TelReturn _dispatcher(CoreObject *co, TcoreCommand command,
+ const void *request, TcoreObjectResponseCallback cb,
+ const void *user_data)
{
- if (control_ops->answer_hold_and_accept)
- po->cops->answer_hold_and_accept = control_ops->answer_hold_and_accept;
-
- if (control_ops->answer_replace)
- po->cops->answer_replace = control_ops->answer_replace;
-
- if (control_ops->answer_reject)
- po->cops->answer_reject = control_ops->answer_reject;
-
- if (control_ops->end_specific)
- po->cops->end_specific = control_ops->end_specific;
-
- if (control_ops->end_all_active)
- po->cops->end_all_active = control_ops->end_all_active;
-
- if (control_ops->end_all_held)
- po->cops->end_all_held = control_ops->end_all_held;
-
- if (control_ops->active)
- po->cops->active = control_ops->active;
+ PrivateObject *po;
- if (control_ops->hold)
- po->cops->hold = control_ops->hold;
+ 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 (control_ops->swap)
- po->cops->swap = control_ops->swap;
-
- if (control_ops->join)
- po->cops->join = control_ops->join;
-
- if (control_ops->split)
- po->cops->split = control_ops->split;
-
- if (control_ops->transfer)
- po->cops->transfer = control_ops->transfer;
-
- if (control_ops->deflect)
- po->cops->deflect = control_ops->deflect;
-
- return;
-}
-
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
-{
- enum tcore_request_command command;
-
- struct private_object_data *po;
- po = tcore_object_ref_object(o);
-
- _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);
+ dbg("command [0x%x]", command);
switch (command) {
- case TREQ_CALL_DIAL:
- _check_null("po->ops->dial", po->ops->dial,
- TCORE_RETURN_FAILURE);
- return po->ops->dial(o, ur);
-
- case TREQ_CALL_ANSWER:
- _check_null("po->ops->answer", po->ops->answer,
- TCORE_RETURN_FAILURE);
- return po->ops->answer(o, ur);
-
- case TREQ_CALL_END:
- _check_null("po->ops->end", po->ops->end,
- TCORE_RETURN_FAILURE);
- return po->ops->end(o, ur);
-
- case TREQ_CALL_HOLD:
- _check_null("po->ops->hold", po->ops->hold,
- TCORE_RETURN_FAILURE);
- return po->ops->hold(o, ur);
-
- 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_SEND_DTMF:
- _check_null("po->ops->send_dtmf", po->ops->send_dtmf,
- TCORE_RETURN_FAILURE);
- return po->ops->send_dtmf(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_MUTE:
- _check_null("po->ops->mute", po->ops->mute,
- TCORE_RETURN_FAILURE);
- return po->ops->mute(o, ur);
-
- case TREQ_CALL_UNMUTE:
- _check_null("po->ops->unmute", po->ops->unmute,
- TCORE_RETURN_FAILURE);
- return po->ops->unmute(o, ur);
-
- case TREQ_CALL_GET_MUTE_STATUS:
- _check_null("po->ops->get_mute_status",
- po->ops->get_mute_status,
- TCORE_RETURN_FAILURE);
- return po->ops->get_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);
-
- default:
+ 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;
}
-
- return TCORE_RETURN_SUCCESS;
+ err("Operation NOT Permitted");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
}
-static void _free_hook(CoreObject *o)
+static void _po_free_hook(CoreObject *co)
{
- struct private_object_data *po;
+ PrivateObject *po;
- po = tcore_object_ref_object(o);
- if (NULL == po)
- return;
+ po = tcore_object_ref_object(co);
+ tcore_check_return(po != NULL);
g_slist_free_full(po->cobjs, g_free);
- g_free(po);
-
- tcore_object_link_object(o, NULL);
+ tcore_free(po->ops);
+ tcore_free(po);
+ tcore_object_link_object(co, NULL);
}
-static struct call_object *_find_object(GSList *objs, void *data, func compare)
+static CallObject *_find_object(GSList *objs, void *data, TcoreCompareCallObject compare)
{
- struct call_object *co = 0;
- GSList *l = 0;
- _check_null("objs", objs, 0);
- _check_null("compare", compare, 0);
+ GSList *list = objs;
- l = objs;
- while (l) {
- co = (struct call_object *) l->data;
+ tcore_check_return_value(list != NULL, NULL);
+ tcore_check_return_value_assert(compare != NULL, NULL);
- if (compare(co, data))
- return co;
+ while (list) {
+ CallObject *call_obj = (CallObject *) list->data;
+ if (compare(call_obj, data))
+ return call_obj;
- l = g_slist_next(l);
+ list = g_slist_next(list);
}
-
return NULL;
}
-static GSList *_find_object_all(GSList *objs, void *data, func compare)
+static GSList *_find_object_all(GSList *objs, void *data, TcoreCompareCallObject compare)
{
- struct call_object *co;
- GSList *l;
- GSList *ret = NULL;
- _check_null("objs", objs, 0);
- _check_null("compare", compare, 0);
+ GSList *list = objs;
+ GSList *obj_list = NULL;
- l = objs;
- while (l) {
- co = (struct call_object*) l->data;
+ tcore_check_return_value(list != NULL, NULL);
+ tcore_check_return_value_assert(compare != NULL, NULL);
- if (compare(co, data))
- ret = g_slist_append(ret, co);
+ while (list) {
+ CallObject *call_obj = (CallObject *) list->data;
- l = g_slist_next(l);
+ if (compare(call_obj, data))
+ obj_list = g_slist_append(obj_list, call_obj);
+
+ list = g_slist_next(list);
}
- return ret;
+ return obj_list;
}
-static gboolean _compare_by_id(struct call_object *co, void *data)
+static gboolean _compare_by_id(CallObject *call_obj, void *data)
{
- unsigned int *id = (unsigned int*) data;
- _check_null("co", co, FALSE);
- _check_null("data", data, FALSE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(data != NULL, FALSE);
- if (co->id == *id)
+ if (call_obj->call_id == *(unsigned int*) data)
return TRUE;
return FALSE;
}
-static gboolean _compare_by_status(struct call_object *co, void *data)
+static gboolean _compare_by_status(CallObject *call_obj, void *data)
{
- enum tcore_call_status *ct = (enum tcore_call_status*) data;
- _check_null("co", co, FALSE);
- _check_null("data", data, FALSE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(data != NULL, FALSE);
- if (co->status == *ct)
+ if (call_obj->call_state == *(TelCallState *) data)
return TRUE;
return FALSE;
}
-static gboolean _compare_by_number(struct call_object *co, void *data)
+static gboolean _compare_by_number(CallObject *call_obj, void *data)
{
- char *number = (char*) data;
- _check_null("co", co, FALSE);
- _check_null("data", data, FALSE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(data != NULL, FALSE);
- if (0 == strcmp(co->cli.number, number))
+ if (0 == g_strcmp0(call_obj->number, (char *)data))
return TRUE;
return FALSE;
}
-static enum tcore_call_cli_mode _check_cli_mode_by_number(char *num)
+static gboolean _check_cli_mode_by_number(
+ char num[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1],
+ TelCallCliValidity *cli_validity)
{
- _check_null("num", num, TCORE_CALL_CLI_MODE_DEFAULT);
+ tcore_check_return_value_assert(cli_validity != NULL, FALSE);
if (0 == strncmp(num, "*31#", 4))
- return TCORE_CALL_CLI_MODE_PRESENT;
-
- if (0 == strncmp(num, "#31#", 4))
- return TCORE_CALL_CLI_MODE_RESTRICT;
-
- return TCORE_CALL_CLI_MODE_DEFAULT;
-}
+ *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;
-static void _call_information_mo_by_object(CoreObject *o,
- enum tcore_notification_command command)
-{
- TcorePlugin *plugin;
- CallObject *co;
- int id;
- dbg("Entry");
-
- /* Referring Parent plugin from Core Object */
- plugin = tcore_object_ref_plugin(o);
- if (NULL == plugin) {
- err("Failed to find Plug-in!");
- return;
- }
-
- /* Extracting the Call Core object from current MO Call objects */
- co = tcore_call_object_current_on_mo_processing(o);
- if (NULL == co) {
- err("Failed to find Call Core object!");
- return;
- }
-
- /* Extracting the Call ID from Call Object */
- id = tcore_call_object_get_id(co);
-
- /* Send notification to TAPI */
- tcore_server_send_notification(tcore_plugin_ref_server(plugin),
- o,
- command,
- sizeof(unsigned int),
- (void *)&id);
-
- dbg("Exit");
-}
-
-static void _call_information_mo_by_number(CoreObject *o,
- char *number, enum tcore_notification_command command)
-{
- TcorePlugin *plugin;
- CallObject *co;
- int id;
- dbg("Entry");
-
- /* Referring Parent plugin from Core Object */
- plugin = tcore_object_ref_plugin(o);
- if (NULL == plugin) {
- err("Failed to find Plug-in!");
- return;
- }
-
- /* Extracting the Call Core object by 'number' */
- co = tcore_call_object_find_by_number(o, number);
- if (NULL == co) {
- err("Failed to find Call Core object!");
- return;
- }
-
- /* Extracting the Call ID from Call Object */
- id = tcore_call_object_get_id(co);
-
- /* Send notification to TAPI */
- tcore_server_send_notification(tcore_plugin_ref_server(plugin),
- o,
- command,
- sizeof(unsigned int),
- (void *)&id);
-
- dbg("Exit");
-}
-
-static void _call_info_mt_cli(CoreObject *o, enum tcore_call_cli_mode mode,
- char *number)
-{
- CallObject *co;
- dbg("Entry");
-
- /* Extracting the Call Core object from current MT Call objects */
- co = tcore_call_object_current_on_mt_processing(o);
- if (NULL == co) {
- err("Failed to find Call Core object!");
- return;
- }
-
- /* Set CLI information */
- tcore_call_object_set_cli_info(co, mode, number);
-
- dbg("Exit");
-}
-
-static void _call_info_mt_cna(CoreObject *o, enum tcore_call_cna_mode mode,
- char *name, int dcs)
-{
- CallObject *co;
- dbg("Entry");
-
- /* Extracting the Call Core object from current MT Call objects */
- co = tcore_call_object_current_on_mt_processing(o);
- if (NULL == co) {
- err("Failed to find Call Core object!");
- return;
- }
-
- /* Set CNA information */
- tcore_call_object_set_cna_info(co, mode, name, dcs);
-
- dbg("Exit");
+ return TRUE;
}
/* Call Object API */
-struct call_object *tcore_call_object_new(CoreObject *o, int id)
+CallObject *tcore_call_object_new(CoreObject *co, unsigned int call_id)
{
- struct private_object_data *po;
- struct call_object *co;
-
- po = tcore_object_ref_object(o);
- _check_null("po", po, NULL);
+ PrivateObject *po;
+ CallObject *call_obj;
+ unsigned int my_call_id;
- co = g_try_new0(struct call_object, 1);
- if (NULL == co) {
- err("Failed to allocate memory for Call Core object!");
- return NULL;
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, NULL);
- if (id > 0) {
- if (NULL == _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);
+ 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);
return NULL;
}
} else {
- int i = 0;
-
+ 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,
- (void *) _compare_by_id)) {
- co->id = i;
+ if (NULL == _find_object(po->cobjs, (void *)&i,
+ (TcoreCompareCallObject) _compare_by_id)) {
+ my_call_id = i;
break;
}
}
-
/* 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);
+ err("failed to assign call id");
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, co);
- dbg("new call object id : [%d]", co->id);
+ po->cobjs = g_slist_append(po->cobjs, call_obj);
+ dbg("new call object id : [%d]", call_obj->call_id);
- return co;
+ return call_obj;
}
-gboolean tcore_call_object_free(CoreObject *o, struct call_object *co)
+void tcore_call_object_free(CoreObject *co, CallObject *call_obj)
{
- struct private_object_data *po;
+ PrivateObject *po;
- po = tcore_object_ref_object(o);
- _check_null("po", po, FALSE);
- _check_null("po->cobjs", po->cobjs, FALSE);
+ 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("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);
+gboolean tcore_call_object_get_count(CoreObject *co, unsigned int *count)
+{
+ PrivateObject *po = NULL;
- dbg("Freeing call core object");
- g_free(co);
+ 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);
+
+ *count = g_slist_length(po->cobjs);
return TRUE;
}
-struct call_object *tcore_call_object_current_on_mt_processing(CoreObject *o)
+CallObject *tcore_call_object_current_on_mt_processing(CoreObject *co)
{
- struct private_object_data *po;
- GSList *l;
+ PrivateObject *po;
+ CallObject *call_obj = NULL;
+ TelCallState call_state = TEL_CALL_STATE_INCOMING;
- enum tcore_call_status cs = CALL_STATUS_INCOMING;
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
- po = tcore_object_ref_object(o);
- _check_null("po", po, 0);
- _check_null("po->cobjs", po->cobjs, 0);
-
- l = _find_object_all(po->cobjs, (void *) &cs, (void *) _compare_by_status);
- if (NULL == l) {
- cs = CALL_STATUS_WAITING;
- l = _find_object_all(po->cobjs, (void *) &cs, (void *)
- _compare_by_status);
- if (NULL == l)
- return 0;
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, NULL);
+ tcore_check_return_value_assert(po->cobjs != NULL, NULL);
- return (struct call_object*) l->data;
+ 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;
+ }
+ }
+ return call_obj;
}
-struct call_object *tcore_call_object_current_on_mo_processing(CoreObject *o)
+CallObject *tcore_call_object_current_on_mo_processing(CoreObject *co)
{
- struct private_object_data *po;
- GSList *l;
+ PrivateObject *po;
+ CallObject *call_obj = NULL;
+ TelCallState call_state = TEL_CALL_STATE_DIALING;
- enum tcore_call_status cs = CALL_STATUS_DIALING;
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
- po = tcore_object_ref_object(o);
- _check_null("po", po, 0);
- _check_null("po->cobjs", po->cobjs, 0);
-
- l = _find_object_all(po->cobjs, (void *) &cs, (void *) _compare_by_status);
- if (NULL == l) {
- cs = CALL_STATUS_ALERT;
- l = _find_object_all(po->cobjs, (void *) &cs, (void *) _compare_by_status);
- if (NULL == l)
- return 0;
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, NULL);
+ tcore_check_return_value_assert(po->cobjs != NULL, NULL);
- return (struct call_object*) l->data;
+ 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;
+ }
+ }
+ return call_obj;
}
-struct call_object *tcore_call_object_find_by_id(CoreObject *o, int id)
+CallObject *tcore_call_object_find_by_id(CoreObject *co, unsigned int call_id)
{
- struct private_object_data *po;
+ PrivateObject *po;
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
- po = tcore_object_ref_object(o);
- _check_null("po", po, 0);
- _check_null("po->cobjs", po->cobjs, 0);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, NULL);
- return _find_object(po->cobjs, (void *) &id, (void *) _compare_by_id);
+ return _find_object(po->cobjs, (void *)&call_id,
+ (TcoreCompareCallObject) _compare_by_id);
}
-struct call_object *tcore_call_object_find_by_number(CoreObject *o, char *num)
+CallObject *tcore_call_object_find_by_number(CoreObject *co,
+ const char num[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1])
{
- struct private_object_data *po;
+ PrivateObject *po;
- po = tcore_object_ref_object(o);
- _check_null("po", po, 0);
- _check_null("po->cobjs", po->cobjs, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
- _check_null("num", num, 0);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, NULL);
- return _find_object(po->cobjs, (void *) num, (void *) _compare_by_number);
+ return _find_object(po->cobjs, (void *)num,
+ (TcoreCompareCallObject)_compare_by_number);
}
-GSList *tcore_call_object_find_by_status(CoreObject *o,
- enum tcore_call_status cs)
+GSList *tcore_call_object_find_by_status(CoreObject *co, TelCallState call_state)
{
- struct private_object_data *po;
+ PrivateObject *po;
- po = tcore_object_ref_object(o);
- _check_null("po", po, 0);
- _check_null("po->cobjs", po->cobjs, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_CALL, NULL);
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, NULL);
- return _find_object_all(po->cobjs, (void *) &cs,
- (void *) _compare_by_status);
+ return _find_object_all(po->cobjs, (void *) &call_state,
+ (void *) _compare_by_status);
}
-int tcore_call_object_get_id(struct call_object *co)
+gboolean tcore_call_object_get_id(CallObject *call_obj, unsigned int *call_id)
{
- _check_null("co", co, -1);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(call_id != NULL, FALSE);
- return co->id;
+ *call_id = call_obj->call_id;
+ return TRUE;
}
-gboolean tcore_call_object_set_type(struct call_object *co,
- enum tcore_call_type ct)
+gboolean tcore_call_object_set_type(CallObject *call_obj, TelCallType call_type)
{
- _check_null("co", co, FALSE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
- co->type = ct;
+ call_obj->call_type = call_type;
return TRUE;
}
-enum tcore_call_type tcore_call_object_get_type(struct call_object *co)
+gboolean tcore_call_object_get_call_type(CallObject *call_obj, TelCallType *call_type)
{
- _check_null("co", co, -1);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(call_type != NULL, FALSE);
- return co->type;
+ *call_type = call_obj->call_type;
+ return TRUE;
}
-gboolean tcore_call_object_set_direction(struct call_object *co,
- enum tcore_call_direction cd)
+gboolean tcore_call_object_set_direction(CallObject *call_obj, gboolean mo_call)
{
- _check_null("co", co, FALSE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
- co->direction = cd;
+ call_obj->mo_call = mo_call;
return TRUE;
}
-enum tcore_call_direction tcore_call_object_get_direction(struct call_object *co)
+gboolean tcore_call_object_get_direction(CallObject *call_obj, gboolean *mo_call)
{
- _check_null("co", co, -1);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(mo_call != NULL, FALSE);
- return co->direction;
+ *mo_call = call_obj->mo_call;
+ return TRUE;
}
-gboolean tcore_call_object_set_status(struct call_object *co,
- enum tcore_call_status cs)
+gboolean tcore_call_object_set_state(CallObject *call_obj, TelCallState call_state)
{
- _check_null("co", co, FALSE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
- co->status = cs;
+ call_obj->call_state = call_state;
return TRUE;
}
-enum tcore_call_status tcore_call_object_get_status(struct call_object *co)
+gboolean tcore_call_object_get_state(CallObject *call_obj, TelCallState *call_state)
{
- _check_null("co", co, -1);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(call_state != NULL, FALSE);
- return co->status;
+ *call_state = call_obj->call_state;
+ return TRUE;
}
-gboolean tcore_call_object_set_cli_info(struct call_object *co,
- enum tcore_call_cli_mode mode, char *num)
+gboolean tcore_call_object_set_cli_info(CallObject *call_obj,
+ TelCallCliValidity cli_validity, char *num)
{
char *pos;
-
- _check_null("co", co, FALSE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
if (NULL == num) {
- co->cli.mode = mode;
+ call_obj->cli_validity = cli_validity;
return TRUE;
}
-
- dbg("num : %s", num);
- dbg("mode : 0x%x", mode);
-
+ dbg("num : %s, cli_validity:%d", num, cli_validity);
pos = num;
+ if (TEL_CALL_CLI_VALIDITY_NOT_AVAILABLE == cli_validity) {
- if (TCORE_CALL_CLI_MODE_DEFAULT == mode) {
- co->cli.mode = _check_cli_mode_by_number(num);
+ _check_cli_mode_by_number(num, &(call_obj->cli_validity));
- if (co->cli.mode)
+ if (call_obj->cli_validity != TEL_CALL_CLI_VALIDITY_NOT_AVAILABLE)
pos = (num + 4);
} else {
- co->cli.mode = mode;
+ call_obj->cli_validity = cli_validity;
}
- strncpy(co->cli.number, pos, (strlen(pos) + 1));
- co->cli.number_len = strlen(co->cli.number);
-
- dbg("co->cli.mode : 0x%x", co->cli.mode);
- 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;
}
-int tcore_call_object_get_number(struct call_object *co, char *num)
+gsize tcore_call_object_get_number(CallObject *call_obj,
+ char num[TEL_CALL_CALLING_NUMBER_LEN_MAX + 1])
{
- _check_null("co", co, -1);
- _check_null("num", num, -1);
+ tcore_check_return_value(call_obj != NULL, 0);
- strncpy(num, co->cli.number, MAX_CALL_NUMBER_LEN);
- return co->cli.number_len;
+ return g_strlcpy(num, call_obj->number,
+ TEL_CALL_CALLING_NUMBER_LEN_MAX + 1);
}
-enum tcore_call_cli_mode tcore_call_object_get_cli_mode(struct call_object *co)
+gboolean tcore_call_object_get_cli_validity(CallObject *call_obj,
+ TelCallCliValidity *cli_validity)
{
- _check_null("co", co, -1);
- return co->cli.mode;
-}
-
-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) {
- dbg("Call name is too long");
- return FALSE;
- }
-
- strncpy(co->cna.name, name, len);
- co->cna.name[len] = '\0';
-
- co->cna.mode = mode;
-
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ *cli_validity = call_obj->cli_validity;
return TRUE;
}
-int tcore_call_object_get_name(struct call_object *co, char *name)
+gboolean tcore_call_object_set_cni_info(CallObject *call_obj,
+ TelCallCniValidity cni_validity,
+ char name[TEL_CALL_CALLING_NAME_LEN_MAX + 1])
{
- _check_null("co", co, -1);
- _check_null("name", name, -1);
-
- strncpy(name, co->cna.name, MAX_CALL_NAME_LEN);
- return co->cna.name_len;
-}
-
-enum tcore_call_cna_mode tcore_call_object_get_cna_mode(struct call_object *co)
-{
- _check_null("co", co, -1);
-
- return co->cna.mode;
-}
+ tcore_check_return_value(call_obj != NULL, FALSE);
-gboolean tcore_call_object_set_multiparty_state(struct call_object *co, gboolean is)
-{
- _check_null("co", co, FALSE);
-
- co->mpty = is;
+ g_strlcpy(call_obj->name, name, TEL_CALL_CALLING_NAME_LEN_MAX + 1);
+ call_obj->cni_validity = cni_validity;
return TRUE;
}
-gboolean tcore_call_object_get_multiparty_state(struct call_object *co)
+gsize tcore_call_object_get_name(CallObject *call_obj,
+ char name[TEL_CALL_CALLING_NAME_LEN_MAX + 1])
{
- _check_null("co", co, FALSE);
+ tcore_check_return_value(call_obj != NULL, 0);
- return co->mpty;
+ return g_strlcpy(name, call_obj->name,
+ TEL_CALL_CALLING_NAME_LEN_MAX + 1);
}
-gboolean tcore_call_object_set_active_line(struct call_object *co, unsigned int line)
+gboolean tcore_call_object_get_cni_validity(CallObject *call_obj,
+ TelCallCniValidity *cni_validity)
{
- _check_null("co", co, FALSE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(cni_validity != NULL, FALSE);
- co->active_line = line;
+ *cni_validity = call_obj->cni_validity;
return TRUE;
}
-int tcore_call_object_get_active_line(struct call_object *co)
-{
- _check_null("co", co, -1);
-
- return co->active_line;
-}
-
-TReturn tcore_call_control_answer_hold_and_accept(CoreObject *o,
- UserRequest *ur, ConfirmCallback cb, void *user_data)
+gboolean tcore_call_object_set_multiparty_state (CallObject *call_obj,
+ gboolean mpty_state)
{
- struct private_object_data *po;
- 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->answer_hold_and_accept(o, ur, cb, user_data);
-}
-
-TReturn tcore_call_control_answer_replace(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
-{
- struct private_object_data *po;
- 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->answer_replace(o, ur, cb, user_data);
-}
-
-TReturn tcore_call_control_answer_reject(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
-{
- struct private_object_data *po;
- 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->answer_reject(o, ur, cb, user_data);
-}
-
-TReturn tcore_call_control_end_specific(CoreObject *o, UserRequest *ur,
- const int id, ConfirmCallback cb,
- void *user_data)
-{
- struct private_object_data *po;
- 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->end_specific(o, ur, id, cb, user_data);
-}
-
-TReturn tcore_call_control_end_all_active(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
-{
- struct private_object_data *po;
- 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->end_all_active(o, ur, cb, user_data);
-}
-
-TReturn tcore_call_control_end_all_held(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
-{
- struct private_object_data *po;
- 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->end_all_held(o, ur, cb, user_data);
-}
-
-TReturn tcore_call_control_active(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
-{
- struct private_object_data *po;
- 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->active(o, ur, cb, user_data);
-}
-
-TReturn tcore_call_control_hold(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
-{
- struct private_object_data *po;
- 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->hold(o, ur, cb, user_data);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ call_obj->mpty = mpty_state;
+ return TRUE;
}
-TReturn tcore_call_control_swap(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
+gboolean tcore_call_object_get_multiparty_state(CallObject *call_obj,
+ gboolean *mpty_state)
{
- struct private_object_data *po;
- po = tcore_object_ref_object(o);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(mpty_state != NULL, FALSE);
- _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);
+ *mpty_state = call_obj->mpty;
+ return TRUE;
}
-TReturn tcore_call_control_join(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
+gboolean tcore_call_object_set_mt_forward (CallObject *call_obj,
+ gboolean forward)
{
- struct private_object_data *po;
- po = tcore_object_ref_object(o);
+ tcore_check_return_value(call_obj != NULL, FALSE);
- _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);
+ call_obj->forward = forward;
+ return TRUE;
}
-TReturn tcore_call_control_split(CoreObject *o, UserRequest *ur, const int id,
- ConfirmCallback cb, void *user_data)
+gboolean tcore_call_object_get_mt_forward(CallObject *call_obj,
+ gboolean *forward)
{
- struct private_object_data *po;
- po = tcore_object_ref_object(o);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(forward != NULL, FALSE);
- _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);
+ *forward = call_obj->forward;
+ return TRUE;
}
-TReturn tcore_call_control_transfer(CoreObject *o, UserRequest *ur,
- ConfirmCallback cb, void *user_data)
+gboolean tcore_call_object_set_active_line(CallObject *call_obj,
+ TelCallActiveLine active_line)
{
- struct private_object_data *po;
- po = tcore_object_ref_object(o);
-
- _check_null( "po", po, TCORE_RETURN_FAILURE);
- _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
- return po->cops->transfer(o, ur, cb, user_data);
+ call_obj->active_line = active_line;
+ return TRUE;
}
-TReturn tcore_call_control_deflect(CoreObject *o, UserRequest *ur,
- const char *number, ConfirmCallback cb,
- void *user_data)
+gboolean tcore_call_object_get_active_line(CallObject *call_obj,
+ TelCallActiveLine *active_line)
{
- struct private_object_data *po;
- po = tcore_object_ref_object(o);
-
- _check_null( "po", po, TCORE_RETURN_FAILURE);
- _check_null( "po->cops", po->cops, TCORE_RETURN_FAILURE);
+ tcore_check_return_value(call_obj != NULL, FALSE);
+ tcore_check_return_value_assert(active_line != NULL, FALSE);
- return po->cops->deflect(o, ur, number, cb, user_data);
+ *active_line = call_obj->active_line;
+ return TRUE;
}
-void tcore_call_control_set_operations(CoreObject *o,
- struct tcore_call_control_operations *ops)
+void tcore_call_override_ops(CoreObject *o, TcoreCallOps *call_ops)
{
- struct private_object_data *po;
-
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
+ PrivateObject *po;
po = tcore_object_ref_object(o);
- if (NULL == po)
- return;
- po->cops = ops;
-}
+ tcore_check_return_assert(po != NULL);
+ tcore_check_return_assert(po->ops != NULL);
+ tcore_check_return_assert(call_ops != NULL);
-void tcore_call_information_mo_col(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-}
-
-void tcore_call_information_mo_waiting(CoreObject *o)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_object(o, TNOTI_CALL_INFO_WAITING);
-}
-
-void tcore_call_information_mo_cug(CoreObject *o, int cug_index)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-}
-
-void tcore_call_information_mo_forwarded(CoreObject *o)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_object(o, TNOTI_CALL_INFO_FORWARDED);
-}
-
-void tcore_call_information_mo_barred_incoming(CoreObject *o)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_object(o, TNOTI_CALL_INFO_BARRED_INCOMING);
-}
-
-void tcore_call_information_mo_barred_outgoing(CoreObject *o)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_object(o, TNOTI_CALL_INFO_BARRED_OUTGOING);
-}
-
-void tcore_call_information_mo_deflected(CoreObject *o)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_object(o, TNOTI_CALL_INFO_DEFLECTED);
-}
-
-void tcore_call_information_mo_clir_suppression_reject(CoreObject *o)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_object(o, TNOTI_CALL_INFO_CLIR_SUPPRESSION_REJECT);
-}
-
-void tcore_call_information_mo_cfu(CoreObject *o)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_object(o, TNOTI_CALL_INFO_FORWARD_UNCONDITIONAL);
-}
-
-void tcore_call_information_mo_cfc(CoreObject *o)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_object(o, TNOTI_CALL_INFO_FORWARD_CONDITIONAL);
-}
-
-void tcore_call_information_mt_cli(CoreObject *o,
- enum tcore_call_cli_mode mode, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_info_mt_cli(o, mode, number);
-}
-
-void tcore_call_information_mt_cna(CoreObject *o,
- enum tcore_call_cna_mode mode, char *name, int dcs)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- _call_info_mt_cna(o, mode, name, dcs);
-}
-
-void tcore_call_information_mt_forwarded_call(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_FORWARDED_CALL);
-}
-
-void tcore_call_information_mt_cug_call(CoreObject *o, int cug_index, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-}
-
-void tcore_call_information_mt_deflected_call(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_DEFLECTED_CALL);
-}
-
-void tcore_call_information_mt_transfered(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->dial)
+ po->ops->dial = call_ops->dial;
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_TRANSFERED_CALL);
-}
+ if (call_ops->answer)
+ po->ops->answer = call_ops->answer;
-void tcore_call_information_held(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->end)
+ po->ops->end = call_ops->end;
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_HELD);
-}
+ if (call_ops->send_dtmf)
+ po->ops->send_dtmf = call_ops->send_dtmf;
-void tcore_call_information_active(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->hold)
+ po->ops->hold = call_ops->hold;
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_ACTIVE);
-}
+ if (call_ops->active)
+ po->ops->active = call_ops->active;
-void tcore_call_information_joined(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->swap)
+ po->ops->swap = call_ops->swap;
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_JOINED);
-}
+ if (call_ops->join)
+ po->ops->join = call_ops->join;
-void tcore_call_information_released_on_hold(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->split)
+ po->ops->split = call_ops->split;
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_RELEASED_ON_HOLD);
-}
+ if (call_ops->transfer)
+ po->ops->transfer = call_ops->transfer;
-void tcore_call_information_transfer_alert(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->deflect)
+ po->ops->deflect = call_ops->deflect;
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_TRANSFERED_CALL);
-}
+ if (call_ops->set_active_line)
+ po->ops->set_active_line = call_ops->set_active_line;
-void tcore_call_information_transfered(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->get_active_line)
+ po->ops->get_active_line = call_ops->get_active_line;
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_TRANSFER_ALERT);
-}
+ if (call_ops->set_volume_info)
+ po->ops->set_volume_info = call_ops->set_volume_info;
-void tcore_call_information_cf_check_ss_message(CoreObject *o, char *number)
-{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->get_volume_info)
+ po->ops->get_volume_info = call_ops->get_volume_info;
- return _call_information_mo_by_number(o, number, TNOTI_CALL_INFO_CF_CHECK_MESSAGE);
-}
+ if (call_ops->set_sound_path)
+ po->ops->set_sound_path = call_ops->set_sound_path;
-/* To be removed later */
-void tcore_call_information_set_operations(CoreObject *o,
- struct tcore_call_information_operations *ops)
-{
- struct private_object_data *po;
+ if (call_ops->set_mute)
+ po->ops->set_mute = call_ops->set_mute;
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ if (call_ops->get_mute_status)
+ po->ops->get_mute_status = call_ops->get_mute_status;
- po = tcore_object_ref_object(o);
- if (NULL == po)
- return;
+ if (call_ops->set_sound_recording)
+ po->ops->set_sound_recording = call_ops->set_sound_recording;
- po->iops = ops;
+ if (call_ops->set_sound_equalization)
+ po->ops->set_sound_equalization = call_ops->set_sound_equalization;
}
-void tcore_call_override_ops(CoreObject *o,
- struct tcore_call_operations *call_ops,
- struct tcore_call_control_operations *control_ops)
+gboolean tcore_call_set_ops(CoreObject *co, TcoreCallOps *ops)
{
- struct private_object_data *po;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (NULL == po)
- return;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
+ }
- if (call_ops)
- _clone_call_operations(po, call_ops);
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreCallOps));
- if (control_ops)
- _clone_call_control_operations(po, control_ops);
+ return TRUE;
}
-CoreObject *tcore_call_new(TcorePlugin *p,
- struct tcore_call_operations *ops, TcoreHal *hal)
+CoreObject *tcore_call_new(TcorePlugin *p, TcoreCallOps *ops, TcoreHal *hal)
{
- CoreObject *o;
- struct private_object_data *po;
-
- if (NULL == p)
- return NULL;
+ CoreObject *co;
+ PrivateObject *po;
+ tcore_check_return_value_assert(p != NULL, NULL);
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
+ co = tcore_object_new(p, hal);
+ tcore_check_return_value_assert(co != NULL, NULL);
- po = g_try_new0(struct private_object_data, 1);
- if (NULL == po) {
- tcore_object_free(o);
- return NULL;
- }
+ po = tcore_malloc0(sizeof(PrivateObject));
- po->ops = ops;
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreCallOps));
- 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_clone_hook(o, _clone_hook);
- tcore_object_set_dispatcher(o, _dispatcher);
+ 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);
- return o;
+ return co;
}
void tcore_call_free(CoreObject *o)
{
- struct private_object_data *po;
-
CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
-
- po = tcore_object_ref_object(o);
- if (NULL == po)
- return;
-
- free(po);
tcore_object_free(o);
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include "tcore.h"
#include "util.h"
#include "plugin.h"
-#include "user_request.h"
#include "co_context.h"
#define DEVNAME_LEN_MAX 16
-struct private_object_data {
- enum co_context_state state;
- unsigned int id;
- enum co_context_role role;
+typedef struct {
+ TcoreContextState state;
+ guint id;
+ TcoreContextRole role;
- char *apn;
- char *addr;
- enum co_context_type type;
- enum co_context_d_comp d_comp;
- enum co_context_h_comp h_comp;
+ gchar *apn;
+ gchar *addr;
+ TcoreContextType type;
+ TcoreContextDComp d_comp;
+ TcoreContextHComp h_comp;
- char *username;
- char *password;
- char *dns1;
- char *dns2;
- enum co_context_auth auth;
+ gchar *username;
+ gchar *password;
+ gchar *dns1;
+ gchar *dns2;
+ TcoreContextAuth 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;
+ TcoreIp4Type ip_v4;
+ TcoreIp4Type gateway_v4;
+ TcoreIp4Type dns_primary_v4;
+ TcoreIp4Type dns_secondary_v4;
- /*IPv6 will be supported*/
+ /* IPv6 will be supported */
- char *proxy;
- char *mmsurl;
- char *profile_name;
- char devname[DEVNAME_LEN_MAX];
-};
+ gchar *proxy;
+ gchar *mmsurl;
+ gchar *profile_name;
+ gchar devname[DEVNAME_LEN_MAX];
+} PrivateObject;
-static void _free_hook(CoreObject *o)
+static void __context_set_ipv4_atoi(guchar *ip4, const gchar *str)
{
- struct private_object_data *po = NULL;
+ gchar *token = NULL;
+ gchar *temp = NULL;
+ guint index = 0;
- po = tcore_object_ref_object(o);
- if (po) {
- g_free(po);
- tcore_object_link_object(o, NULL);
+ temp = tcore_strdup(str);
+ token = strtok(temp, ".");
+ while (token != NULL) {
+ ip4[index++] = atoi(token);
+ msg(" [%c]", ip4[index-1]);
+ token = strtok(NULL, ".");
}
+ tcore_free(temp);
}
-CoreObject *tcore_context_new(TcorePlugin *p, TcoreHal *hal)
+static void __po_free_hook(CoreObject *co)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- if (!p)
- return NULL;
+ po = tcore_object_ref_object(co);
+ tcore_check_return(po != NULL);
- o = tcore_object_new(p, hal);
- if (!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 = calloc(1, sizeof(struct private_object_data));
- if (!po) {
- tcore_object_free(o);
- return NULL;
- }
+ tcore_object_link_object(co, NULL);
+}
- 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;
+CoreObject *tcore_context_new(TcorePlugin *p, TcoreHal *hal)
+{
+ CoreObject *co = NULL;
+ PrivateObject *po = 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);
+ tcore_check_return_value_assert(p != NULL, NULL);
- return o;
-}
+ co = tcore_object_new(p, hal);
+ tcore_check_return_value_assert(co != NULL, NULL);
-void tcore_context_free(CoreObject *o)
-{
- struct private_object_data *po = NULL;
+ 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;
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PS_CONTEXT);
+ 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 = tcore_object_ref_object(o);
- if (!po)
- return;
+ return co;
+}
- g_free(po);
- tcore_object_link_object(o, NULL);
- tcore_object_free(o);
+void tcore_context_free(CoreObject *co)
+{
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_PS_CONTEXT);
+ tcore_object_free(co);
}
-TReturn tcore_context_set_state(CoreObject *o, enum co_context_state state)
+gboolean tcore_context_set_state(CoreObject *co, TcoreContextState state)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- dbg("Set State: [%s]", ((state == CONTEXT_STATE_ACTIVATED) ? "ACTIVATED"
- : (state == CONTEXT_STATE_ACTIVATING) ? "ACTIVATING"
- : (state == CONTEXT_STATE_DEACTIVATED) ? "DEACTIVATED"
- : "DEACTIVATING"));
+ 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->state = state;
-
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-enum co_context_state tcore_context_get_state(CoreObject *o)
+gboolean tcore_context_get_state(CoreObject *co, TcoreContextState *state)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return po->state;
+ *state = po->state;
+ return TRUE;
}
-TReturn tcore_context_set_id(CoreObject *o, unsigned int id)
+gboolean tcore_context_set_id(CoreObject *co, guint id)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->id = id;
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-unsigned int tcore_context_get_id(CoreObject *o)
+gboolean tcore_context_get_id(CoreObject *co, guint *id)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return po->id;
+ *id = po->id;
+ return TRUE;
}
-TReturn tcore_context_set_apn(CoreObject *o, const char *apn)
+gboolean tcore_context_set_apn(CoreObject *co, const gchar *apn)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->apn) {
- free(po->apn);
- po->apn = NULL;
- }
-
- if (apn) {
- po->apn = g_strdup(apn);
- }
-
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->apn);
+ po->apn = tcore_strdup(apn);
+ return TRUE;
}
-char *tcore_context_get_apn(CoreObject *o)
+gboolean tcore_context_get_apn(CoreObject *co, gchar **apn)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
+ PrivateObject *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po)
- return NULL;
-
- if (!po->apn)
- return NULL;
-
- return g_strdup(po->apn);
+ 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;
}
-TReturn tcore_context_set_role(CoreObject *o, enum co_context_role role)
+gboolean tcore_context_set_role(CoreObject *co, TcoreContextRole role)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->role = role;
-
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-enum co_context_role tcore_context_get_role(CoreObject *o)
+gboolean tcore_context_get_role(CoreObject *co, TcoreContextRole *role)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return po->role;
+ *role = po->role;
+ return TRUE;
}
-TReturn tcore_context_set_type(CoreObject *o, enum co_context_type type)
+gboolean tcore_context_set_type(CoreObject *co, TcoreContextType type)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->type = type;
-
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-enum co_context_type tcore_context_get_type(CoreObject *o)
+gboolean tcore_context_get_type(CoreObject *co, TcoreContextType *type)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return po->type;
+ *type = po->type;
+ return TRUE;
}
-TReturn tcore_context_set_data_compression(CoreObject *o, enum co_context_d_comp comp)
+gboolean tcore_context_set_data_compression(CoreObject *co, TcoreContextDComp comp)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->d_comp = comp;
-
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-enum co_context_d_comp tcore_context_get_data_compression(CoreObject *o)
+gboolean tcore_context_get_data_compression(CoreObject *co, TcoreContextDComp *comp)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return po->d_comp;
+ *comp = po->d_comp;
+ return TRUE;
}
-TReturn tcore_context_set_header_compression(CoreObject *o, enum co_context_h_comp comp)
+gboolean tcore_context_set_header_compression(CoreObject *co, TcoreContextHComp comp)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->h_comp = comp;
-
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-enum co_context_h_comp tcore_context_get_header_compression(CoreObject *o)
+gboolean tcore_context_get_header_compression(CoreObject *co, TcoreContextHComp *comp)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return po->h_comp;
+ *comp = po->h_comp;
+ return TRUE;
}
-TReturn tcore_context_set_username(CoreObject *o, const char *username)
+gboolean tcore_context_set_username(CoreObject *co, const gchar *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;
+ PrivateObject *po = NULL;
- if (po->username) {
- free(po->username);
- po->username = NULL;
- }
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- if (username) {
- po->username = g_strdup(username);
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->username);
+ po->username = tcore_strdup(username);
+ return TRUE;
}
-char *tcore_context_get_username(CoreObject *o)
+gboolean tcore_context_get_username(CoreObject *co, gchar **username)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->username)
- return NULL;
-
- return g_strdup(po->username);
+ *username = tcore_strdup(po->username);
+ return TRUE;
}
-TReturn tcore_context_set_password(CoreObject *o, const char *password)
+gboolean tcore_context_set_password(CoreObject *co, const gchar *password)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+ PrivateObject *po = NULL;
- 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->password) {
- free(po->password);
- po->password = NULL;
- }
-
- if (password) {
- po->password = g_strdup(password);
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->password);
+ po->password = tcore_strdup(password);
+ return TRUE;
}
-char *tcore_context_get_password(CoreObject *o)
+gboolean tcore_context_get_password(CoreObject *co, gchar **password)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->password)
- return NULL;
-
- return g_strdup(po->password);
+ *password = tcore_strdup(po->password);
+ return TRUE;
}
-TReturn tcore_context_set_auth(CoreObject *o, enum co_context_auth auth)
+gboolean tcore_context_set_auth(CoreObject *co, TcoreContextAuth auth)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->auth = auth;
-
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-enum co_context_auth tcore_context_get_auth(CoreObject *o)
+gboolean tcore_context_get_auth(CoreObject *co, TcoreContextAuth *auth)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0);
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return po->auth;
+ *auth = po->auth;
+ return TRUE;
}
-TReturn tcore_context_set_proxy(CoreObject *o, const char *proxy)
+gboolean tcore_context_set_proxy(CoreObject *co, const gchar *proxy)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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;
-
- if (po->proxy) {
- free(po->proxy);
- po->apn = NULL;
- }
-
- if (proxy) {
- po->proxy = g_strdup(proxy);
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->proxy);
+ po->proxy = tcore_strdup(proxy);
+ return TRUE;
}
-char *tcore_context_get_proxy(CoreObject *o)
+gboolean tcore_context_get_proxy(CoreObject *co, gchar **proxy)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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;
-
- return g_strdup(po->proxy);
+ *proxy = tcore_strdup(po->proxy);
+ return TRUE;
}
-TReturn tcore_context_set_mmsurl(CoreObject *o, const char *mmsurl)
+gboolean tcore_context_set_mmsurl(CoreObject *co, const gchar *mmsurl)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
+ PrivateObject *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po)
- return FALSE;
-
- if (po->mmsurl) {
- free(po->mmsurl);
- po->mmsurl = NULL;
- }
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- if (mmsurl) {
- po->mmsurl = g_strdup(mmsurl);
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->mmsurl);
+ po->mmsurl = tcore_strdup(mmsurl);
+ return TRUE;
}
-char *tcore_context_get_mmsurl(CoreObject *o)
+gboolean tcore_context_get_mmsurl(CoreObject *co, gchar **mmsurl)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL);
+ PrivateObject *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po)
- return NULL;
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- if (!po->mmsurl)
- return NULL;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return g_strdup(po->mmsurl);
+ *mmsurl = tcore_strdup(po->mmsurl);
+ return TRUE;
}
-TReturn tcore_context_set_profile_name(CoreObject *o, const char *profile_name)
+gboolean tcore_context_set_profile_name(CoreObject *co, const gchar *profile_name)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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;
-
- if (po->profile_name) {
- free(po->profile_name);
- po->profile_name = NULL;
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- if (profile_name) {
- po->profile_name = g_strdup(profile_name);
- }
-
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->profile_name);
+ po->profile_name = tcore_strdup(profile_name);
+ return TRUE;
}
-char *tcore_context_get_profile_name(CoreObject *o)
+gboolean tcore_context_get_profile_name(CoreObject *co, gchar **profile_name)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->profile_name)
- return NULL;
-
- return g_strdup(po->profile_name);
+ *profile_name = tcore_strdup(po->profile_name);
+ return TRUE;
}
-TReturn tcore_context_set_devinfo(CoreObject *o, struct tnoti_ps_pdp_ipconfiguration *devinfo)
+gboolean tcore_context_set_devinfo(CoreObject *co, TcorePsPdpIpConf *devinfo)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
dbg("Setup device information");
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL);
-
- po = tcore_object_ref_object(o);
- if (!po) {
- err("Failed to refer Object");
- return FALSE;
- }
+ CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
- if (!devinfo) {
- err("Device info is NULL");
- return FALSE;
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(devinfo != NULL, FALSE);
- 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);
+ 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);
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);
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-TReturn tcore_context_reset_devinfo(CoreObject *o)
+gboolean tcore_context_reset_devinfo(CoreObject *co)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
dbg("Reset device information");
- 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_FAILURE;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- 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);
+ 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);
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
void tcore_context_cp_service_info(CoreObject *dest, CoreObject *src)
{
- struct private_object_data *d_po = NULL;
- struct private_object_data *s_po = NULL;
+ PrivateObject *d_po = NULL;
+ PrivateObject *s_po = NULL;
CORE_OBJECT_CHECK(dest, CORE_OBJECT_TYPE_PS_CONTEXT);
CORE_OBJECT_CHECK(src, CORE_OBJECT_TYPE_PS_CONTEXT);
d_po->state = s_po->state;
d_po->id = s_po->id;
- 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);
+ 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;
}
-static void tcore_context_set_ipv4_atoi(unsigned char *ip4, const char *str)
-{
- char *token = NULL;
- char *temp = NULL;
- int index = 0;
-
- temp = g_strdup(str);
- token = strtok(temp, ".");
- while (token != NULL) {
- ip4[index++] = atoi(token);
- msg(" [%c]", ip4[index-1]);
- token = strtok(NULL, ".");
- }
- g_free(temp);
-}
-
-TReturn tcore_context_set_ipv4_addr(CoreObject *o, const char *addr)
+gboolean tcore_context_set_ipv4_addr(CoreObject *co, const gchar *addr)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->addr) {
- free(po->addr);
+ tcore_free(po->addr);
po->addr = NULL;
}
if (addr) {
- po->addr = g_strdup(addr);
- tcore_context_set_ipv4_atoi(po->ip_v4.s, addr);
+ po->addr = tcore_strdup(addr);
+ __context_set_ipv4_atoi(po->ip_v4.s, addr);
dbg("IP Address: [%s]", addr);
}
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-char* tcore_context_get_ipv4_addr(CoreObject *o)
+gboolean tcore_context_get_ipv4_addr(CoreObject *co, gchar **ip)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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);
- return tcore_util_get_string_by_ip4type(po->ip_v4);
+ *ip = tcore_util_get_string_by_ip4type(po->ip_v4);
+ return TRUE;
}
-TReturn tcore_context_set_ipv4_dns(CoreObject *o, const char *dns1, const char *dns2)
+gboolean tcore_context_set_ipv4_dns(CoreObject *co, const gchar *dns1, const gchar *dns2)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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);
- g_free(po->dns1);
+ tcore_free(po->dns1);
po->dns1 = NULL;
- g_free(po->dns2);
+ tcore_free(po->dns2);
po->dns2 = NULL;
if (dns1) {
- po->dns1 = g_strdup(dns1);
- tcore_context_set_ipv4_atoi(po->dns_primary_v4.s, dns1);
+ po->dns1 = tcore_strdup(dns1);
+ __context_set_ipv4_atoi(po->dns_primary_v4.s, dns1);
}
if (dns2) {
- po->dns2 = g_strdup(dns2);
- tcore_context_set_ipv4_atoi(po->dns_secondary_v4.s, dns2);
+ po->dns2 = tcore_strdup(dns2);
+ __context_set_ipv4_atoi(po->dns_secondary_v4.s, dns2);
}
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-char* tcore_context_get_ipv4_dns1(CoreObject *o)
+gboolean tcore_context_get_ipv4_dns1(CoreObject *co, gchar **ip)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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);
- return tcore_util_get_string_by_ip4type(po->dns_primary_v4);
+ *ip = tcore_util_get_string_by_ip4type(po->dns_primary_v4);
+ return TRUE;
}
-char* tcore_context_get_ipv4_dns2(CoreObject *o)
+gboolean tcore_context_get_ipv4_dns2(CoreObject *co, gchar **ip)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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);
- return tcore_util_get_string_by_ip4type(po->dns_secondary_v4);
+ *ip = tcore_util_get_string_by_ip4type(po->dns_secondary_v4);
+ return TRUE;
}
-char* tcore_context_get_ipv4_gw(CoreObject *o)
+gboolean tcore_context_get_ipv4_gw(CoreObject *co, gchar **ip)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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);
- return tcore_util_get_string_by_ip4type(po->gateway_v4);
+ *ip = tcore_util_get_string_by_ip4type(po->gateway_v4);
+ return TRUE;
}
-TReturn tcore_context_set_ipv4_devname(CoreObject *o, const char *name)
+gboolean tcore_context_set_ipv4_devname(CoreObject *co, const gchar *name)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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 (name) {
snprintf(po->devname, DEVNAME_LEN_MAX, "%s", name);
}
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-char* tcore_context_get_ipv4_devname(CoreObject *o)
+gboolean tcore_context_get_ipv4_devname(CoreObject *co, gchar **dev_name)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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->devname[0] == 0)
- return NULL;
+ return TRUE;
- return g_strdup(po->devname);
+ *dev_name = tcore_strdup(po->devname);
+ return TRUE;
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* 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"
-struct private_object_data {
- struct tcore_gps_operations *ops;
-};
+typedef struct {
+ TcoreGpsOps *ops;
+} PrivateObject;
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void _po_free_hook(CoreObject *co)
{
- 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return(po != NULL);
- tcore_object_link_object(dest, dest_po);
+ tcore_free(po->ops);
+ tcore_free(po);
+ tcore_object_link_object(co, NULL);
}
-static void _clone_gps_operations(struct private_object_data *po, struct tcore_gps_operations *gps_ops)
+static void _po_clone_hook(CoreObject *src, CoreObject *dest)
{
- if(gps_ops->confirm_measure_pos) {
- po->ops->confirm_measure_pos = gps_ops->confirm_measure_pos;
- }
+ 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);
+
+ dest_po = tcore_malloc0(sizeof(PrivateObject));
+ dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreGpsOps));
- return;
+ tcore_object_link_object(dest, dest_po);
}
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
+static TelReturn _dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, const void *user_data)
{
- enum tcore_request_command command;
- struct private_object_data *po = NULL;
-
- if (!o || !ur)
- return TCORE_RETURN_EINVAL;
+ 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);
- po = tcore_object_ref_object(o);
- if (!po || !po->ops)
- return TCORE_RETURN_ENOSYS;
+ gps = po->ops;
- 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;
-
- return po->ops->confirm_measure_pos(o, ur);
- break;
+ 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);
- break;
+ tcore_check_return_assert(po != NULL);
+ tcore_check_return_assert(po->ops != NULL);
+ tcore_check_return_assert(ops != NULL);
- default:
- dbg("not supported cmd");
- break;
- }
- return TCORE_RETURN_SUCCESS;
+ 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;
}
-void tcore_gps_override_ops(CoreObject *o, struct tcore_gps_operations *gps_ops)
+gboolean tcore_gps_set_ops(CoreObject *co, TcoreGpsOps *ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_GPS);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- if(gps_ops) {
- _clone_gps_operations(po, gps_ops);
- }
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreGpsOps));
- return;
+ return TRUE;
}
CoreObject *tcore_gps_new(TcorePlugin *p,
- struct tcore_gps_operations *ops, TcoreHal *hal)
+ TcoreGpsOps *ops, TcoreHal *hal)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
-
- if (!p)
- return NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
+ tcore_check_return_value_assert(p != NULL, NULL);
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
+ co = tcore_object_new(p, 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->ops = ops;
+ po = tcore_malloc0(sizeof(PrivateObject));
- tcore_object_set_type(o, CORE_OBJECT_TYPE_GPS);
- tcore_object_link_object(o, po);
- tcore_object_set_dispatcher(o, _dispatcher);
- tcore_object_set_clone_hook(o, _clone_hook);
+ if (ops != NULL)
+ po->ops = tcore_memdup(ops, sizeof(TcoreGpsOps));
- return o;
+ 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;
}
-void tcore_gps_free(CoreObject *o)
+void tcore_gps_free(CoreObject *co)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_GPS);
-
- po = tcore_object_ref_object(o);
- if (!po)
- return;
-
- g_free(po);
- tcore_object_link_object(o, po);
- tcore_object_free(o);
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_GPS);
+ tcore_object_free(co);
}
-
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* 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"
-struct private_object_data {
- struct tcore_modem_operations *ops;
+typedef struct {
+ TcoreModemOps *ops;
gboolean flight_mode;
gboolean powered;
-};
+} PrivateObject;
-static void _free_hook(CoreObject *o)
+static void _po_free_hook(CoreObject *co)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return(po != NULL);
- po = tcore_object_ref_object(o);
- if (po) {
- free(po);
- tcore_object_link_object(o, NULL);
- }
+ tcore_free(po->ops);
+ tcore_free(po);
+ tcore_object_link_object(co, NULL);
}
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void _po_clone_hook(CoreObject *src, CoreObject *dest)
{
- struct private_object_data *src_po = NULL;
- struct private_object_data *dest_po = NULL;
-
- if (!src || !dest)
- return;
+ PrivateObject *dest_po = NULL;
+ PrivateObject *src_po = tcore_object_ref_object(src);
- 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_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(TcoreModemOps));
tcore_object_link_object(dest, dest_po);
}
-static void _clone_modem_operations(struct private_object_data *po, struct tcore_modem_operations *modem_ops)
+static TelReturn _dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, const void *user_data)
{
- if(modem_ops->power_on) {
- po->ops->power_on = modem_ops->power_on;
- }
- if(modem_ops->power_off) {
- po->ops->power_off = modem_ops->power_off;
- }
- if(modem_ops->power_reset) {
- po->ops->power_reset = modem_ops->power_reset;
- }
- if(modem_ops->set_flight_mode) {
- po->ops->set_flight_mode = modem_ops->set_flight_mode;
- }
- if(modem_ops->get_imei) {
- po->ops->get_imei = modem_ops->get_imei;
- }
- if(modem_ops->get_version) {
- po->ops->get_version = modem_ops->get_version;
- }
- if(modem_ops->get_sn) {
- po->ops->get_sn = modem_ops->get_sn;
- }
- if(modem_ops->dun_pin_ctrl) {
- po->ops->dun_pin_ctrl = modem_ops->dun_pin_ctrl;
- }
- if(modem_ops->get_flight_mode) {
- po->ops->get_flight_mode = modem_ops->get_flight_mode;
- }
+ 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;
- return;
-}
-
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
-{
- 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_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;
-
- return po->ops->get_sn(o, ur);
- break;
-
- 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;
+ 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;
}
+ err("Operation NOT Supported");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+}
- return TCORE_RETURN_SUCCESS;
+void tcore_modem_override_ops(CoreObject *co, TcoreModemOps *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 (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;
}
-void tcore_modem_override_ops(CoreObject *o, struct tcore_modem_operations *modem_ops)
+gboolean tcore_modem_set_ops(CoreObject *co, TcoreModemOps *ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_MODEM);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- if(modem_ops) {
- _clone_modem_operations(po, modem_ops);
- }
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreModemOps));
- return;
+ return TRUE;
}
CoreObject *tcore_modem_new(TcorePlugin *p,
- struct tcore_modem_operations *ops, TcoreHal *hal)
+ TcoreModemOps *ops, TcoreHal *hal)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
-
- //dbg("Entered");
- if (!p)
- return NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
+ tcore_check_return_value_assert(p != NULL, NULL);
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
+ co = tcore_object_new(p, 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));
- po->ops = ops;
+ if (ops != NULL)
+ po->ops = tcore_memdup(ops, sizeof(TcoreModemOps));
- 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_clone_hook(o, _clone_hook);
- tcore_object_set_dispatcher(o, _dispatcher);
- return o;
+ 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;
}
-void tcore_modem_free(CoreObject *o)
+void tcore_modem_free(CoreObject *co)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_MODEM);
-
- po = tcore_object_ref_object(o);
- if (!po)
- return;
-
- free(po);
- tcore_object_free(o);
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_MODEM);
+ tcore_object_free(co);
}
-TReturn tcore_modem_set_flight_mode_state(CoreObject *o, gboolean flag)
+gboolean tcore_modem_set_flight_mode_state(CoreObject *co, gboolean state)
{
- 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)
- return TCORE_RETURN_EINVAL;
-
- po->flight_mode = flag;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ po->flight_mode = state;
+ return TRUE;
}
-gboolean tcore_modem_get_flight_mode_state(CoreObject *o)
+gboolean tcore_modem_get_flight_mode_state(CoreObject *co, gboolean *state)
{
- struct private_object_data *po = NULL;
+ 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;
-
- return po->flight_mode;
+ *state = po->flight_mode;
+ return TRUE;
}
-TReturn tcore_modem_set_powered(CoreObject *o, gboolean pwr)
+gboolean tcore_modem_set_powered(CoreObject *co, gboolean pwr)
{
- struct private_object_data *po;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, TCORE_RETURN_EINVAL);
-
- po = tcore_object_ref_object(o);
- if (!po)
- return FALSE;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
po->powered = pwr;
-
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-gboolean tcore_modem_get_powered(CoreObject *o)
+gboolean tcore_modem_get_powered(CoreObject *co, gboolean *pwr)
{
- struct private_object_data *po;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, FALSE);
-
- po = tcore_object_ref_object(o);
- if (!po)
- return FALSE;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return po->powered;
+ *pwr = po->powered;
+ return TRUE;
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* 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"
-struct private_object_data {
- struct tcore_network_operations *ops;
+typedef struct {
+ TcoreNetworkOps *ops;
+
+ TelNetworkRegStatus cs_status;
+ TelNetworkRegStatus ps_status;
+ TelNetworkAct act;
+ gboolean roam_state;
- 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;
unsigned int lac;
unsigned int rac;
unsigned int cell_id;
- char *network_name_short;
- char *network_name_full;
- char *network_name_spn;
- enum tcore_network_name_priority network_name_priority;
-
- GSList *network_operator_info_table[1000];
-};
-
-static void _clone_network_operations(struct private_object_data *po, struct tcore_network_operations *network_ops)
-{
- if(network_ops->search) {
- po->ops->search = network_ops->search;
- }
- if(network_ops->set_plmn_selection_mode) {
- po->ops->set_plmn_selection_mode = network_ops->set_plmn_selection_mode;
- }
- if(network_ops->get_plmn_selection_mode) {
- po->ops->get_plmn_selection_mode = network_ops->get_plmn_selection_mode;
- }
- if(network_ops->set_service_domain) {
- po->ops->set_service_domain = network_ops->set_service_domain;
- }
- if(network_ops->get_service_domain) {
- po->ops->get_service_domain = network_ops->get_service_domain;
- }
- if(network_ops->set_band) {
- po->ops->set_band = network_ops->set_band;
- }
- if(network_ops->get_band) {
- po->ops->get_band = network_ops->get_band;
- }
- if(network_ops->set_preferred_plmn) {
- po->ops->set_preferred_plmn = network_ops->set_preferred_plmn;
- }
- if(network_ops->get_preferred_plmn) {
- po->ops->get_preferred_plmn = network_ops->get_preferred_plmn;
- }
- if(network_ops->set_order) {
- po->ops->set_order = network_ops->set_order;
- }
- if(network_ops->get_order) {
- po->ops->get_order = network_ops->get_order;
- }
- if(network_ops->set_power_on_attach) {
- po->ops->set_power_on_attach = network_ops->set_power_on_attach;
- }
- if(network_ops->get_power_on_attach) {
- po->ops->get_power_on_attach = network_ops->get_power_on_attach;
- }
- if(network_ops->set_cancel_manual_search) {
- po->ops->set_cancel_manual_search = network_ops->set_cancel_manual_search;
- }
- if(network_ops->get_serving_network) {
- po->ops->get_serving_network = network_ops->get_serving_network;
- }
- if(network_ops->set_mode) {
- po->ops->set_mode = network_ops->set_mode;
- }
- if(network_ops->get_mode) {
- po->ops->get_mode = network_ops->get_mode;
- }
+ char *plmn;
+ char *short_name;
+ char *long_name;
- return;
-}
+ GHashTable *operator_name_hash;
+} PrivateObject;
-static TReturn _dispatcher(CoreObject *co, UserRequest *ur)
+static TelReturn _dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, const void *user_data)
{
- enum tcore_request_command command;
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+ 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);
- po = tcore_object_ref_object(co);
- if (!po || !po->ops)
- return TCORE_RETURN_ENOSYS;
+ network = po->ops;
- command = tcore_user_request_get_command(ur);
switch (command) {
- case TREQ_NETWORK_SEARCH:
- if (!po->ops->search)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->search(co, ur);
- break;
-
- 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);
- break;
-
- 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);
- break;
-
- case TREQ_NETWORK_SET_SERVICE_DOMAIN:
- if (!po->ops->set_service_domain)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->set_service_domain(co, ur);
- break;
-
- case TREQ_NETWORK_GET_SERVICE_DOMAIN:
- if (!po->ops->get_service_domain)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->get_service_domain(co, ur);
- break;
-
- case TREQ_NETWORK_SET_BAND:
- if (!po->ops->set_band)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->set_band(co, ur);
- break;
-
- case TREQ_NETWORK_GET_BAND:
- if (!po->ops->get_band)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->get_band(co, ur);
- break;
-
- case TREQ_NETWORK_SET_PREFERRED_PLMN:
- if (!po->ops->set_preferred_plmn)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->set_preferred_plmn(co, ur);
- break;
-
- case TREQ_NETWORK_GET_PREFERRED_PLMN:
- if (!po->ops->get_preferred_plmn)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->get_preferred_plmn(co, ur);
- break;
-
- case TREQ_NETWORK_SET_ORDER:
- if (!po->ops->set_order)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->set_order(co, ur);
- break;
-
- case TREQ_NETWORK_GET_ORDER:
- if (!po->ops->get_order)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->get_order(co, ur);
- break;
-
- 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);
- break;
-
- 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);
- break;
-
- 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);
- break;
-
- case TREQ_NETWORK_GET_SERVING_NETWORK:
- if (!po->ops->get_serving_network)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->get_serving_network(co, ur);
- break;
-
- case TREQ_NETWORK_SET_MODE:
- if (!po->ops->set_mode)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->set_mode(co, ur);
- break;
-
- case TREQ_NETWORK_GET_MODE:
- if (!po->ops->get_mode)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->get_mode(co, ur);
- break;
-
- 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);
- break;
-
- 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);
- break;
-
- default:
- break;
- }
-
- return TCORE_RETURN_SUCCESS;
+ 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;
+
+ }
+ err("Unsupported Operation");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
}
-static void _free_hook(CoreObject *co)
+static void _po_free_hook(CoreObject *co)
{
- 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);
- }
+ 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);
}
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void _po_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;
- }
-
- src_po = tcore_object_ref_object(src);
- dest_po->ops = src_po->ops;
+ 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);
}
-void tcore_network_override_ops(CoreObject *o, struct tcore_network_operations *network_ops)
+void tcore_network_override_ops(CoreObject *co, TcoreNetworkOps *ops)
{
- struct private_object_data *po = NULL;
+ 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;
+}
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_NETWORK);
+gboolean tcore_network_set_ops(CoreObject *co, TcoreNetworkOps *ops)
+{
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- if(network_ops) {
- _clone_network_operations(po, network_ops);
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- return;
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreNetworkOps));
+
+ return TRUE;
}
CoreObject *tcore_network_new(TcorePlugin *plugin,
- struct tcore_network_operations *ops, TcoreHal *hal)
+ TcoreNetworkOps *ops, TcoreHal *hal)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
-
- if (!plugin)
- return NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
+ tcore_check_return_value_assert(plugin != NULL, NULL);
- o = tcore_object_new(plugin, 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));
- po->ops = ops;
+ if (ops != NULL)
+ po->ops = tcore_memdup(ops, sizeof(TcoreNetworkOps));
- 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_clone_hook(o, _clone_hook);
- tcore_object_set_dispatcher(o, _dispatcher);
+ po->operator_name_hash = g_hash_table_new_full(g_str_hash,
+ g_str_equal, g_free, g_free);
- return o;
+ 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;
}
void tcore_network_free(CoreObject *co)
{
- struct private_object_data *po = NULL;
- GSList *list;
- int i;
-
CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_NETWORK);
-
- po = tcore_object_ref_object(co);
- if (!po)
- return;
-
- for (i=0; i<999; i++) {
- list = po->network_operator_info_table[i];
- if (!list)
- continue;
-
- for (; list; list = list->next) {
-
- if (list->data)
- free(list->data);
- }
-
- g_slist_free(po->network_operator_info_table[i]);
- }
-
- 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);
-
- free(po);
tcore_object_free(co);
}
-char* tcore_network_get_plmn(CoreObject *co)
+gboolean tcore_network_get_cs_reg_status(CoreObject *co,
+ TelNetworkRegStatus *cs_status)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(cs_status != NULL, FALSE);
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, NULL);
-
- po = tcore_object_ref_object(co);
- if (!po)
- return NULL;
-
- return g_strdup(po->plmn);
+ *cs_status = po->cs_status;
+ return TRUE;
}
-TReturn tcore_network_set_plmn(CoreObject *co, const char *plmn)
+gboolean tcore_network_set_cs_reg_status(CoreObject *co,
+ TelNetworkRegStatus cs_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;
-
- if (po->plmn)
- free(po->plmn);
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po->plmn = g_strdup(plmn);
-
- return TCORE_RETURN_SUCCESS;
+ po->cs_status = cs_status;
+ return TRUE;
}
-
-char* tcore_network_get_network_name(CoreObject *co,
- enum tcore_network_name_type type)
+gboolean tcore_network_get_ps_reg_status(CoreObject *co,
+ TelNetworkRegStatus *ps_status)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, NULL);
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(ps_status != NULL, FALSE);
- 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;
+ *ps_status = po->ps_status;
+ return TRUE;
}
-TReturn tcore_network_set_network_name(CoreObject *co,
- enum tcore_network_name_type type, const char *network_name)
+gboolean tcore_network_set_ps_reg_status(CoreObject *co,
+ TelNetworkRegStatus ps_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;
-
- if (type == TCORE_NETWORK_NAME_TYPE_SHORT) {
- if (po->network_name_short)
- free(po->network_name_short);
-
- dbg("short network_name = [%s]", network_name);
- po->network_name_short = g_strdup(network_name);
- }
- else if (type == TCORE_NETWORK_NAME_TYPE_FULL) {
- if (po->network_name_full)
- free(po->network_name_full);
-
- dbg("full network_name = [%s]", network_name);
- po->network_name_full = g_strdup(network_name);
- }
- else if (type == TCORE_NETWORK_NAME_TYPE_SPN) {
- if (po->network_name_spn)
- free(po->network_name_spn);
-
- dbg("spn network_name = [%s]", network_name);
- po->network_name_spn = g_strdup(network_name);
- }
- else {
- return TCORE_RETURN_EINVAL;
- }
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ po->ps_status = ps_status;
+ return TRUE;
}
-
-TReturn tcore_network_get_network_name_priority(CoreObject *co,
- enum tcore_network_name_priority *priority)
+gboolean tcore_network_set_access_technology(CoreObject *co,
+ TelNetworkAct act)
{
- 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- *priority = po->network_name_priority;
+ po->act = act;
+ return TRUE;
- return TCORE_RETURN_SUCCESS;
}
-TReturn tcore_network_set_network_name_priority(CoreObject *co,
- enum tcore_network_name_priority priority)
+gboolean tcore_network_get_access_technology(CoreObject *co,
+ TelNetworkAct *act)
{
- 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(act != NULL, FALSE);
- po->network_name_priority = priority;
-
- return TCORE_RETURN_SUCCESS;
+ *act = po->act;
+ return TRUE;
}
-gboolean tcore_network_get_roaming_state(CoreObject *co)
+gboolean tcore_network_get_roam_state(CoreObject *co, gboolean *state)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, FALSE);
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(state != NULL, FALSE);
- po = tcore_object_ref_object(co);
- if (!po)
- return FALSE;
-
- return po->roaming_state;
+ *state = po->roam_state;
+ return TRUE;
}
-TReturn tcore_network_set_roaming_state(CoreObject *co, gboolean state)
+gboolean tcore_network_set_roam_state(CoreObject *co, gboolean state)
{
- 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->roaming_state = state;
- dbg("roaming_state = 0x%x", state);
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ po->roam_state = state;
+ return TRUE;
}
-TReturn tcore_network_get_service_status(CoreObject *co,
- enum tcore_network_service_domain_type type,
- enum telephony_network_service_domain_status *result)
+gboolean tcore_network_get_lac(CoreObject *co, unsigned int *lac)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(lac != NULL, FALSE);
- 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;
- }
-
- return TCORE_RETURN_SUCCESS;
+ *lac = po->lac;
+ return TRUE;
}
-TReturn tcore_network_set_service_status(CoreObject *co,
- enum tcore_network_service_domain_type type,
- enum telephony_network_service_domain_status status)
+gboolean tcore_network_set_lac(CoreObject *co, unsigned int lac)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- 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("cs.status = 0x%x", status);
- break;
- }
-
- return TCORE_RETURN_SUCCESS;
+ po->lac = lac;
+ return TRUE;
}
-TReturn tcore_network_set_access_technology(CoreObject *co,
- enum telephony_network_access_technology act)
+gboolean tcore_network_get_rac(CoreObject *co, unsigned int *rac)
{
- 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(rac != NULL, FALSE);
- po->act = act;
-
- return TCORE_RETURN_SUCCESS;
+ *rac = po->rac;
+ return TRUE;
}
-TReturn tcore_network_get_access_technology(CoreObject *co,
- enum telephony_network_access_technology *result)
+gboolean tcore_network_set_rac(CoreObject *co, unsigned int rac)
{
- 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ po->rac = rac;
+ return TRUE;
}
-TReturn tcore_network_set_lac(CoreObject *co, unsigned int lac)
+gboolean tcore_network_get_cell_id(CoreObject *co, unsigned int *cell_id)
{
- 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(cell_id != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ *cell_id = po->cell_id;
+ return TRUE;
}
-TReturn tcore_network_get_lac(CoreObject *co, unsigned int *result)
+gboolean tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- 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;
+ po->cell_id = cell_id;
+ return TRUE;
}
-TReturn tcore_network_set_rac(CoreObject *co, unsigned int rac)
+gboolean tcore_network_get_plmn(CoreObject *co, char **plmn)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(plmn != NULL, FALSE);
- po = tcore_object_ref_object(co);
- if (!po)
- return TCORE_RETURN_EINVAL;
-
- po->rac = rac;
-
- return TCORE_RETURN_SUCCESS;
+ *plmn = tcore_strdup(po->plmn);
+ return TRUE;
}
-TReturn tcore_network_get_rac(CoreObject *co, unsigned int *result)
+gboolean tcore_network_set_plmn(CoreObject *co, const char *plmn)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(plmn != NULL, FALSE);
- 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->rac;
-
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->plmn);
+ po->plmn = tcore_strdup(plmn);
+ return TRUE;
}
-TReturn tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id)
+gboolean tcore_network_get_short_name(CoreObject *co, char **short_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;
-
- po->cell_id = cell_id;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(short_name != NULL, FALSE);
- return TCORE_RETURN_SUCCESS;
+ *short_name = tcore_strdup(po->short_name);
+ return TRUE;
}
-TReturn tcore_network_get_cell_id(CoreObject *co, unsigned int *result)
+gboolean tcore_network_set_short_name(CoreObject *co, const char *short_name)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(short_name != NULL, FALSE);
- 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->cell_id;
-
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->short_name);
+ po->short_name = tcore_strdup(short_name);
+ return TRUE;
}
-TReturn tcore_network_set_service_type(CoreObject *co,
- enum telephony_network_service_type service_type)
+gboolean tcore_network_get_long_name(CoreObject *co, char **long_name)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(long_name != NULL, FALSE);
- po = tcore_object_ref_object(co);
- if (!po)
- return TCORE_RETURN_EINVAL;
-
- po->service_type = service_type;
-
- return TCORE_RETURN_SUCCESS;
+ *long_name = tcore_strdup(po->long_name);
+ return TRUE;
}
-TReturn tcore_network_get_service_type(CoreObject *co,
- enum telephony_network_service_type *result)
+gboolean tcore_network_set_long_name(CoreObject *co, const char *long_name)
{
- 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(long_name != NULL, FALSE);
- *result = po->service_type;
-
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->long_name);
+ po->long_name = tcore_strdup(long_name);
+ return TRUE;
}
-TReturn tcore_network_operator_info_add(CoreObject *co,
- struct tcore_network_operator_info *noi)
+gboolean tcore_network_get_operator_name(CoreObject *co,
+ const char *plmn, char **name)
{
- struct private_object_data *po = NULL;
- int mcc_index = 0;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL);
-
- if (!noi)
- return TCORE_RETURN_EINVAL;
-
- po = tcore_object_ref_object(co);
- if (!po)
- return TCORE_RETURN_EINVAL;
-
- mcc_index = atoi(noi->mcc);
- if (mcc_index > 999)
- return TCORE_RETURN_EINVAL;
-
- po->network_operator_info_table[mcc_index] = g_slist_append(
- po->network_operator_info_table[mcc_index], noi);
-
- return TCORE_RETURN_SUCCESS;
+ 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);
+
+ network_name = (char *)g_hash_table_lookup(po->operator_name_hash, plmn);
+ *name = tcore_strdup(network_name);
+ return TRUE;
}
-struct tcore_network_operator_info *
-tcore_network_operator_info_find(CoreObject *co, const char *mcc, const char *mnc)
-{
- struct private_object_data *po = NULL;
- GSList *list;
- int mcc_index = 0;
- struct tcore_network_operator_info *data;
-
- CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, NULL);
-
- if (!mcc || !mnc)
- return NULL;
-
- po = tcore_object_ref_object(co);
- if (!po)
- return NULL;
- mcc_index = atoi(mcc);
- if (mcc_index > 999)
- return NULL;
-
- list = po->network_operator_info_table[mcc_index];
- if (list == NULL) {
- dbg("mcc[%d] is not in operator table", mcc_index);
- return NULL;
- }
-
- for (; list; list = list->next) {
- if (!list->data)
- continue;
-
- data = list->data;
+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);
- dbg(" +- mnc[%s]", data->mnc);
- if (g_strcmp0(data->mnc, mnc) == 0)
- return data;
- }
+ dbg("Set Operator Name, PLMN: [%s], Name: [%s]", plmn, name);
- dbg("mcc[%s] mnc[%s] is not in operator table", mcc, mnc);
+ g_hash_table_insert(po->operator_name_hash,
+ tcore_strdup(plmn), tcore_strdup(name));
- return NULL;
+ return TRUE;
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include <glib.h>
+#include <string.h>
#include "tcore.h"
#include "plugin.h"
-#include "queue.h"
-#include "user_request.h"
-#include "core_object.h"
#include "co_phonebook.h"
-struct private_object_data {
- struct tcore_phonebook_operations *ops;
- gboolean b_init;
- struct tel_phonebook_support_list support_list;
- enum tel_phonebook_type selected;
-};
-
-static void _clone_phonebook_operations(struct private_object_data *po, struct tcore_phonebook_operations *phonebook_ops)
-{
- if(phonebook_ops->get_count) {
- po->ops->get_count = phonebook_ops->get_count;
- }
- if(phonebook_ops->get_info) {
- po->ops->get_info = phonebook_ops->get_info;
- }
- if(phonebook_ops->get_usim_info) {
- po->ops->get_usim_info = phonebook_ops->get_usim_info;
- }
- if(phonebook_ops->read_record) {
- po->ops->read_record = phonebook_ops->read_record;
- }
- if(phonebook_ops->update_record) {
- po->ops->update_record = phonebook_ops->update_record;
- }
- if(phonebook_ops->delete_record) {
- po->ops->delete_record = phonebook_ops->delete_record;
- }
-
- return;
-}
+typedef struct {
+ TcorePbOps *ops;
+ gboolean init;
+ TelPbList support_list;
+ TelPbType pb_type;
+} PrivateObject;
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
+static TelReturn _dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, const void *user_data)
{
- enum tcore_request_command command;
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, TCORE_RETURN_EINVAL);
+ 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;
- 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_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;
+ 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;
}
-
- return TCORE_RETURN_SUCCESS;
+ err("Operation NOT supported");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
}
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void _po_clone_hook(CoreObject *src, CoreObject *dest)
{
- struct private_object_data *src_po = NULL;
- struct private_object_data *dest_po = NULL;
+ PrivateObject *dest_po = NULL;
+ PrivateObject *src_po = tcore_object_ref_object(src);
- 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_check_return_assert(src_po != NULL);
+ tcore_check_return_assert(src_po->ops != NULL);
+ tcore_check_return_assert(dest != NULL);
+ dest_po = tcore_malloc0(sizeof(PrivateObject));
+ dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcorePbOps));
tcore_object_link_object(dest, dest_po);
}
-static void _free_hook(CoreObject *o)
+static void _po_free_hook(CoreObject *co)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_assert(po != NULL);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PHONEBOOK);
+ 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);
- }
+void tcore_phonebook_override_ops(CoreObject *co, TcorePbOps *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 (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;
}
-gboolean tcore_phonebook_get_status(CoreObject *o)
+gboolean tcore_phonebook_get_status(CoreObject *co, gboolean *init_status)
{
- 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;
+ 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;
}
-gboolean tcore_phonebook_set_status(CoreObject *o, gboolean b_init)
+gboolean tcore_phonebook_set_status(CoreObject *co, gboolean init_status)
{
- 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ po->init = init_status;
return TRUE;
}
-struct tel_phonebook_support_list* tcore_phonebook_get_support_list(CoreObject *o)
+gboolean tcore_phonebook_get_support_list(CoreObject *co, TelPbList **pb_list)
{
- 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;
+ 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;
}
-gboolean tcore_phonebook_set_support_list(CoreObject *o, struct tel_phonebook_support_list *list)
+gboolean tcore_phonebook_set_support_list(CoreObject *co, TelPbList *pb_list)
{
- 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));
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ memcpy(&po->support_list, pb_list, sizeof(TelPbList));
return TRUE;
}
-enum tel_phonebook_type tcore_phonebook_get_selected_type(CoreObject *o)
+gboolean tcore_phonebook_get_selected_type(CoreObject *co, TelPbType *pb_type)
{
- 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;
+ 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;
}
-gboolean tcore_phonebook_set_selected_type(CoreObject *o, enum tel_phonebook_type t)
+gboolean tcore_phonebook_set_selected_type(CoreObject *co, TelPbType 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;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ po->pb_type = pb_type;
return TRUE;
}
-void tcore_phonebook_override_ops(CoreObject *o, struct tcore_phonebook_operations *phonebook_ops)
+gboolean tcore_phonebook_set_ops(CoreObject *co, TcorePbOps *ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PHONEBOOK);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- if(phonebook_ops) {
- _clone_phonebook_operations(po, phonebook_ops);
- }
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcorePbOps));
- return;
+ return TRUE;
}
-CoreObject *tcore_phonebook_new(TcorePlugin *p,
- struct tcore_phonebook_operations *ops, TcoreHal *hal)
+CoreObject *tcore_phonebook_new(TcorePlugin *p, TcorePbOps *ops, TcoreHal *hal)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
+ tcore_check_return_value_assert(p != NULL, NULL);
- if (!p)
- return NULL;
+ co = tcore_object_new(p, hal);
+ tcore_check_return_value_assert(co != NULL, NULL);
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
+ po = tcore_malloc0(sizeof(PrivateObject));
- po = calloc(1, sizeof(struct private_object_data));
- if (!po) {
- tcore_object_free(o);
- return NULL;
- }
-
- po->ops = ops;
- po->selected = PB_TYPE_UNKNOWNN;
-
- 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_clone_hook(o, _clone_hook);
- tcore_object_set_dispatcher(o, _dispatcher);
+ if (ops != NULL)
+ po->ops = tcore_memdup(ops, sizeof(TcorePbOps));
- return o;
+ 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;
}
-void tcore_phonebook_free(CoreObject *o)
+void tcore_phonebook_free(CoreObject *co)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PHONEBOOK);
-
- po = tcore_object_ref_object(o);
- if (!po)
- return;
-
- free(po);
- tcore_object_free(o);
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_PHONEBOOK);
+ tcore_object_free(co);
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include "tcore.h"
#include "plugin.h"
-#include "user_request.h"
#include "co_ps.h"
-struct p_callid_type{
- unsigned int cid;
+typedef struct {
+ guint cid;
GSList *contexts;
-};
+} TcorePsContextInfo;
-struct private_object_data {
- struct tcore_ps_operations *ops;
+typedef struct {
+ TcorePsOps *ops;
gboolean online;
- /* 1 ~ UMTS_PS_MAX_CID */
- struct p_callid_type cid[PS_MAX_CID + 1];
- //CoreObject *cid[PS_MAX_CID + 1];
-
+ TcorePsContextInfo context_id[TCORE_PS_MAX_CID + 1];
GSList *context_list;
-};
-
-static void _clone_ps_operations(struct private_object_data *po, struct tcore_ps_operations *ps_ops)
+} PrivateObject;
+
+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);
+
+static TelReturn __dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, const void *user_data)
{
- if(ps_ops->define_context) {
- po->ops->define_context = ps_ops->define_context;
- }
- if(ps_ops->activate_context) {
- po->ops->activate_context = ps_ops->activate_context;
- }
- if(ps_ops->deactivate_context) {
- po->ops->deactivate_context = ps_ops->deactivate_context;
- }
+ TcorePsOps *ps = NULL;
+ CoreObject **co_context;
+ PrivateObject *po = tcore_object_ref_object(co);
- return;
-}
+ tcore_check_return_value_assert(po != NULL, TEL_RETURN_INVALID_PARAMETER);
+ tcore_check_return_value_assert(po->ops != NULL, TEL_RETURN_INVALID_PARAMETER);
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
-{
- enum tcore_request_command command;
- struct private_object_data *po = NULL;
+ ps = po->ops;
+ co_context = ( CoreObject **)request;
+
+ switch (command) {
+ case TCORE_COMMAND_PS_DEFINE_CONTEXT:
+ if (ps->define_context)
+ return __ps_define_context(co, *co_context, cb, (void *)user_data);
- if (!o || !ur)
- return TCORE_RETURN_EINVAL;
+ case TCORE_COMMAND_PS_ACTIVATE_CONTEXT:
+ if (ps->activate_context)
+ return __ps_activate_context (co, *co_context, cb, (void *)user_data);
- po = tcore_object_ref_object(o);
- if (!po || !po->ops)
- return TCORE_RETURN_ENOSYS;
+ case TCORE_COMMAND_PS_DEACTIVATE_CONTEXT:
+ if (ps->deactivate_context)
+ return __ps_deactivate_context (co, *co_context, cb, (void *)user_data);
- command = tcore_user_request_get_command(ur);
- switch (command) {
- default:
- break;
+ default:
+ err("Unsupported Command: [0x%x]");
+ return TEL_RETURN_INVALID_PARAMETER;
}
- return TCORE_RETURN_SUCCESS;
+ err("Unsupported Operation");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
}
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void __po_free_hook(CoreObject *co)
{
- struct private_object_data *src_po = NULL;
- struct private_object_data *dest_po = NULL;
+ PrivateObject *po = NULL;
- if (!src || !dest)
- return;
+ po = tcore_object_ref_object(co);
+ tcore_check_return(po != NULL);
- dest_po = calloc(1, sizeof(struct private_object_data));
- if (!dest_po) {
- tcore_object_link_object(dest, NULL);
- return;
- }
+ g_slist_free_full(po->context_list, g_free);
+ tcore_free(po->ops);
+ tcore_free(po);
- src_po = tcore_object_ref_object(src);
- dest_po->ops = src_po->ops;
+ tcore_object_link_object(co, NULL);
+}
+static void __po_clone_hook(CoreObject *src, CoreObject *dest)
+{
+ 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);
+
+ dest_po = tcore_malloc0(sizeof(PrivateObject));
+ dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcorePsOps));
tcore_object_link_object(dest, dest_po);
}
-static void _free_hook(CoreObject *o)
+void tcore_ps_override_ops(CoreObject *co, TcorePsOps *ops)
{
- struct private_object_data *po = NULL;
- GSList *list;
+ 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);
- po = tcore_object_ref_object(o);
- if (!po)
- return;
+ if (ops->define_context)
+ po->ops->define_context = ops->define_context;
- if (po->context_list) {
- for (list = po->context_list; list; list = list->next) {
- if (list->data)
- free(list->data);
+ if (ops->activate_context)
+ po->ops->activate_context = ops->activate_context;
- list->data = NULL;
- }
+ if (ops->deactivate_context)
+ po->ops->deactivate_context = ops->deactivate_context;
+}
- g_slist_free(po->context_list);
- po->context_list = NULL;
+gboolean tcore_ps_set_ops(CoreObject *co, TcorePsOps *ops)
+{
+ PrivateObject *po;
+ tcore_check_return_value (co != NULL, FALSE);
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- free(po);
- tcore_object_link_object(o, NULL);
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcorePsOps));
+
+ return TRUE;
}
-static gboolean _ps_is_active_context(CoreObject *o, CoreObject *ps_context)
+static gboolean __ps_is_context_active(CoreObject *o, CoreObject *ps_context)
{
- GSList *contexts = NULL;
- CoreObject *s_context = NULL;
- int idx_cid = 0;
- struct private_object_data *po = NULL;
+ guint idx_cid = 0;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+ dbg("Context [%p] to be checked for activeness", ps_context);
po = tcore_object_ref_object(o);
-
- for (idx_cid = 0; idx_cid < PS_MAX_CID; idx_cid++) {
- if (po->cid[idx_cid].cid != 0) {
- contexts = po->cid[idx_cid].contexts;
- if (contexts == NULL)
- continue;
-
- for (; contexts != NULL; contexts = g_slist_next(contexts)) {
- s_context = contexts->data;
- if (s_context == NULL)
- continue;
-
- if (ps_context == s_context) {
- dbg("find contexts(%p) in cid(%d)",
- ps_context, idx_cid);
- return TRUE;
- }
- }
+ 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]",s_context, idx_cid);
+ return TRUE;
+ }
+ }
+ contexts = g_slist_next(contexts);
+ }
}
}
- dbg("cannot find contexts(%p) ", ps_context);
+ dbg("Cannot find context (%p) ", ps_context);
return FALSE;
}
-static gboolean _ps_is_duplicated_apn(CoreObject *o, CoreObject *ps_context)
+static gboolean __ps_is_apn_duplicated(CoreObject *o, CoreObject *ps_context, guint *cid)
{
- GSList *contexts = NULL;
- CoreObject *s_context = NULL;
- gchar *t_apn = NULL, *s_apn = NULL;
+ gchar *t_apn = NULL;
- int idx_cid = 0;
- struct private_object_data *po = NULL;
+ guint idx_cid = 0;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+ dbg("Entered");
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
po = tcore_object_ref_object(o);
- t_apn = tcore_context_get_apn(ps_context);
-
- for (idx_cid = 0; idx_cid < PS_MAX_CID; idx_cid++) {
- if (po->cid[idx_cid].cid != 0) {
- contexts = po->cid[idx_cid].contexts;
- if (contexts == NULL)
- continue;
+ 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;
+ }
- for (; contexts != NULL; contexts = g_slist_next(contexts)) {
- s_context = contexts->data;
- if (s_context == NULL)
- continue;
+ for (idx_cid = 1; idx_cid <= TCORE_PS_MAX_CID; idx_cid++) {
+ if( po->context_id[idx_cid].cid == 0)
+ continue;
- if (ps_context == s_context)
- continue;
+ CoreObject *s_context = NULL;
+ gchar *s_apn = NULL;
+ GSList *contexts = po->context_id[idx_cid].contexts;
- s_apn = tcore_context_get_apn(s_context);
+ for (; contexts; contexts = contexts->next) {
+ s_context = contexts->data;
+ if ((s_context == NULL) || (ps_context == s_context)){
+ continue;
+ }
- if (g_strcmp0(t_apn, s_apn) == 0) {
- dbg("target and source have same APN");
- tcore_context_cp_service_info(
- ps_context, s_context);
- g_free(t_apn);
- g_free(s_apn);
- return TRUE;
- }
+ if (FALSE == tcore_context_get_apn(s_context, &s_apn)){
+ tcore_free(s_apn);
+ continue;
+ }
- g_free(s_apn);
+ if (g_strcmp0(t_apn, s_apn) == 0) {
+ dbg("target and source have same APN");
+ tcore_context_cp_service_info(
+ ps_context, s_context);
+ *cid = idx_cid;
+ tcore_free(t_apn);
+ tcore_free(s_apn);
+ return TRUE;
}
+
+ tcore_free(s_apn);
+ s_apn = NULL;
}
}
- g_free(t_apn);
+ tcore_free(t_apn);
return FALSE;
}
-void tcore_ps_override_ops(CoreObject *o, struct tcore_ps_operations *ps_ops)
+CoreObject *tcore_ps_new(TcorePlugin *plugin,
+ TcorePsOps *ops, TcoreHal *hal)
{
- struct private_object_data *po = NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
+ tcore_check_return_value_assert(plugin != NULL, NULL);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PS);
-
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
- }
-
- if(ps_ops) {
- _clone_ps_operations(po, ps_ops);
- }
-
- return;
-}
-
-CoreObject *tcore_ps_new(TcorePlugin *p,
- struct tcore_ps_operations *ops, TcoreHal *hal)
-{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
-
- if (!p)
- return NULL;
-
- o = tcore_object_new(p, 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(plugin, hal);
+ tcore_check_return_value_assert(co != NULL, NULL);
- po->ops = ops;
+ po = tcore_malloc0(sizeof(PrivateObject));
+ if (ops != NULL)
+ po->ops = tcore_memdup(ops, sizeof(TcorePsOps));
- 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_clone_hook(o, _clone_hook);
- tcore_object_set_dispatcher(o, _dispatcher);
+ 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);
- return o;
+ return co;
}
-void tcore_ps_free(CoreObject *o)
+void tcore_ps_free(CoreObject *co)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PS);
-
- po = tcore_object_ref_object(o);
- if (!po)
- return;
-
- g_free(po);
- tcore_object_link_object(o, po);
- tcore_object_free(o);
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_PS);
+ tcore_object_free(co);
}
-TReturn tcore_ps_add_context(CoreObject *o, CoreObject *ctx_o)
+gboolean tcore_ps_add_context(CoreObject *o, CoreObject *ctx_o)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+ CORE_OBJECT_CHECK_RETURN(ctx_o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
po = tcore_object_ref_object(o);
- if (!po)
- return TCORE_RETURN_EINVAL;
+ tcore_check_return_value_assert (po != NULL, FALSE);
po->context_list = g_slist_insert(po->context_list, ctx_o, 0);
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-TReturn tcore_ps_remove_context(CoreObject *o, CoreObject *ctx_o)
+gboolean tcore_ps_remove_context(CoreObject *o, CoreObject *ctx_o)
{
- struct private_object_data *po = NULL;
+ PrivateObject *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);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+ CORE_OBJECT_CHECK_RETURN(ctx_o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
po = tcore_object_ref_object(o);
- if (!po)
- return TCORE_RETURN_EINVAL;
+ tcore_check_return_value_assert (po != NULL, FALSE);
- tcore_ps_clear_context_id(o, ctx_o);
+ (void)tcore_ps_clear_context_id(o, ctx_o);
po->context_list = g_slist_remove(po->context_list, ctx_o);
- return TCORE_RETURN_SUCCESS;
+ return TRUE;
}
-TReturn tcore_ps_set_online(CoreObject *o, gboolean state)
+gboolean tcore_ps_set_online(CoreObject *o, gboolean state)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
po = tcore_object_ref_object(o);
- if (!po)
- return TCORE_RETURN_EINVAL;
+ tcore_check_return_value_assert (po != NULL, FALSE);
po->online = state;
dbg("ps status = %d", po->online);
- return TCORE_RETURN_SUCCESS;
-}
-
-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;
-
- 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;
-
- pdp_o = list->data;
- if (!pdp_o)
- continue;
-
- 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;
+ return TRUE;
}
-GSList *tcore_ps_ref_context_by_id(CoreObject *o, unsigned int id)
+gboolean tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, guint cid)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
+ guint idx;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+ CORE_OBJECT_CHECK_RETURN(context, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
+ dbg("Entered");
po = tcore_object_ref_object(o);
- if (!po)
- return NULL;
-
- if (id == 0 || id > PS_MAX_CID)
- return NULL;
-
- if (po->cid[id].cid != id)
- return NULL;
-
- return po->cid[id].contexts;
-}
-
-TReturn tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, unsigned int cid)
-{
- struct private_object_data *po = NULL;
- int idx;
-
- 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;
+ tcore_check_return_value_assert (po != NULL, FALSE);
if (cid == 0) {
/* Automatic assign */
- for (idx = 1; idx <= PS_MAX_CID; idx++) {
- if (po->cid[idx].cid == 0) {
- po->cid[idx].cid = idx;
- po->cid[idx].contexts = g_slist_append(po->cid[idx].contexts, context);
+ dbg("Automatic assigning of context id ");
+ for (idx = 1; idx <= TCORE_PS_MAX_CID; idx++) {
+ if (po->context_id[idx].cid == 0) {
+ po->context_id[idx].cid = idx;
+ po->context_id[idx].contexts = g_slist_append(po->context_id[idx].contexts, context);
dbg("assign contexts(%p) in cid(%d)", context, idx);
return tcore_context_set_id(context, idx);
}
}
else {
/* Manual assign */
- if (po->cid[cid].cid == cid) {
- po->cid[cid].contexts = g_slist_append(po->cid[cid].contexts, context);
+ if (po->context_id[cid].cid == cid) {
+ po->context_id[cid].contexts = g_slist_append(po->context_id[cid].contexts, context);
return tcore_context_set_id(context, cid);
}
else {
- dbg("cid[%d] is not null", cid);
+ dbg("cid: [%d] is not null", cid);
}
}
-
- return TCORE_RETURN_PS_CID_ERROR;
+ dbg("Exiting");
+ return FALSE;
}
-TReturn tcore_ps_clear_context_id(CoreObject *o, CoreObject *context)
+gboolean tcore_ps_clear_context_id(CoreObject *o, CoreObject *context)
{
- struct private_object_data *po = NULL;
- int i = 0, cnt = 0;
+ PrivateObject *po = NULL;
+ guint 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);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+ CORE_OBJECT_CHECK_RETURN(context, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE);
po = tcore_object_ref_object(o);
- if (!po)
- return TCORE_RETURN_EINVAL;
+ tcore_check_return_value_assert (po != NULL, FALSE);
- i = tcore_context_get_id(context);
- if (i == 0) {
- return TCORE_RETURN_PS_CID_ERROR;
- }
+ if (FALSE == tcore_context_get_id(context, &i))
+ return FALSE;
- if (i > PS_MAX_CID)
- return TCORE_RETURN_PS_CID_ERROR;
+ if ((i == 0) || (i > TCORE_PS_MAX_CID))
+ return FALSE;
- po->cid[i].contexts = g_slist_remove(po->cid[i].contexts, context);
- cnt = g_slist_length(po->cid[i].contexts);
+ po->context_id[i].contexts = g_slist_remove(po->context_id[i].contexts, context);
+ cnt = g_slist_length(po->context_id[i].contexts);
if (cnt <= 0)
- po->cid[i].cid = 0;
+ po->context_id[i].cid = 0;
return tcore_context_set_id(context, 0);
}
-TReturn tcore_ps_define_context(CoreObject *o, CoreObject *ps_context, void *user_data)
+CoreObject *tcore_ps_ref_context_by_role(CoreObject *o, TcoreContextRole role)
{
- int rv;
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
+ GSList *list;
+ CoreObject *pdp_o;
+ TcoreContextRole context_role;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL);
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;
-
- rv = _ps_is_duplicated_apn(o, ps_context);
- if (rv) {
- int 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;
- }
+ tcore_check_return_value_assert (po != NULL, NULL);
- 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;
+ if (po->context_list) {
+ for (list = po->context_list; list; list = list->next) {
+ pdp_o = list->data;
+ if (pdp_o && (tcore_object_get_type(pdp_o) == CORE_OBJECT_TYPE_PS_CONTEXT))
+ if (tcore_context_get_role(pdp_o, &context_role))
+ if (context_role == role)
+ return pdp_o;
+ }
}
- dbg("contexts(%p), cid = %d", ps_context, tcore_context_get_id(ps_context));
-
- return po->ops->define_context(o, ps_context, user_data);
+ return NULL;
}
-TReturn tcore_ps_activate_context(CoreObject *o, CoreObject *ps_context, void *user_data)
+gboolean tcore_ps_ref_context_by_id(CoreObject *o, guint id, GSList **list)
{
- int rv;
- struct private_object_data *po = NULL;
- enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
po = tcore_object_ref_object(o);
- if (!po)
- return TCORE_RETURN_EINVAL;
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(list != NULL, FALSE);
- if (!po->online) {
- dbg("ps network is not online !");
- return TCORE_RETURN_PS_NETWORK_NOT_READY;
- }
+ if ((id == 0) || (id > TCORE_PS_MAX_CID))
+ return FALSE;
- if (!ps_context)
- return TCORE_RETURN_EINVAL;
+ if (po->context_id[id].cid != id)
+ return FALSE;
- rv = _ps_is_active_context(o, ps_context);
- if (!rv)
- {
- dbg("it is not defined context");
- return TCORE_RETURN_EINVAL;
- }
+ *list = po->context_id[id].contexts;
- 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;
- }
+ return TRUE;
+}
- context_state = tcore_context_get_state(ps_context);
+static TelReturn __ps_define_context(CoreObject *o, CoreObject *ps_context,
+ TcoreObjectResponseCallback cb, void *user_data)
+{
+ PrivateObject *po = NULL;
+ guint cid = 0;
- if (context_state == CONTEXT_STATE_ACTIVATED)
- return TCORE_RETURN_SUCCESS;
- else if (context_state == CONTEXT_STATE_ACTIVATING)
- return TCORE_RETURN_SUCCESS;
- else if (context_state == CONTEXT_STATE_DEACTIVATING)
- return TCORE_RETURN_PS_DEACTIVATING;
+ dbg(" Entered ps_context: [%p]", ps_context);
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TEL_RETURN_INVALID_PARAMETER);
+ 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("cid = %d", tcore_context_get_id(ps_context));
+ 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)) {
+ po->context_id[cid].contexts = g_slist_append(po->context_id[cid].contexts, ps_context);
+ 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;
+ }
- tcore_context_set_state(ps_context, CONTEXT_STATE_ACTIVATING);
- return po->ops->activate_context(o, ps_context, user_data);
+ /* 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;
+ }
+ }
+ } else {
+ err("Failed to get context Id for context[%p]", ps_context);
+ return TEL_RETURN_FAILURE;
+ }
+
+ if (FALSE == tcore_context_get_id(ps_context, &cid))
+ return TEL_RETURN_FAILURE;
+ dbg("context: [%p] cid: [%d]", ps_context, cid);
+
+ dbg("Sending define request to modem");
+ return po->ops->define_context(o, ps_context, cb, user_data);
}
-TReturn tcore_ps_deactivate_context(CoreObject *o, CoreObject *ps_context, void *user_data)
+static TelReturn __ps_activate_context(CoreObject *o, CoreObject *ps_context,
+ TcoreObjectResponseCallback cb, void *user_data)
{
- int rv;
- struct private_object_data *po = NULL;
- enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED;
+ PrivateObject *po = NULL;
+ TcoreContextState context_state = TCORE_CONTEXT_STATE_DEACTIVATED;
+ guint cid = 0;
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL);
+ dbg("Entered");
+
+ 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;
+ 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->online) {
- dbg("ps network is not online !");
- return TCORE_RETURN_PS_NETWORK_NOT_READY;
+ if (!po->online) {
+ err("PS service is not online");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
}
- 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) {
- int 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)) {
+ err("Context[%p] is not defined yet", ps_context);
+ return TEL_RETURN_INVALID_PARAMETER;
}
- context_state = tcore_context_get_state(ps_context);
- if (context_state == CONTEXT_STATE_DEACTIVATED)
- return TCORE_RETURN_SUCCESS;
- else if (context_state == CONTEXT_STATE_DEACTIVATING)
- return TCORE_RETURN_SUCCESS;
- else if (context_state == CONTEXT_STATE_ACTIVATING)
- return TCORE_RETURN_PS_ACTIVATING;
+ (void)tcore_context_get_state(ps_context, &context_state);
+ dbg("Context[%p] current state[%d] ", ps_context, context_state);
+
+ 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;
- tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATING);
- return po->ops->deactivate_context(o, ps_context, user_data);
+ (void)tcore_context_set_state(ps_context, TCORE_CONTEXT_STATE_ACTIVATING);
+ dbg("sending activate command for context[%p]", ps_context);
+ return po->ops->activate_context(o, ps_context, cb, user_data);
}
-TReturn tcore_ps_deactivate_contexts(CoreObject *o)
+static TelReturn __ps_deactivate_context(CoreObject *o, CoreObject *ps_context,
+ TcoreObjectResponseCallback cb, void *user_data)
{
- GSList *contexts = NULL;
- CoreObject *context = NULL;
- int index = 0;
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
+ TcoreContextState context_state = TCORE_CONTEXT_STATE_DEACTIVATED;
- 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;
-
+ 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->online) {
- dbg("ps network is not online !");
- return TCORE_RETURN_PS_NETWORK_NOT_READY;
+ dbg("PS service is not online");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+ }
+ if (FALSE == __ps_is_context_active(o, ps_context)){
+ dbg("Context is not in active state");
+ return TEL_RETURN_INVALID_PARAMETER;
}
- for (index = 0; index < PS_MAX_CID; index++) {
- if (po->cid[index].cid != 0) {
- contexts = po->cid[index].contexts;
- if (contexts == NULL)
- continue;
+ (void)tcore_context_get_state(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 (; contexts != NULL; contexts = g_slist_next(contexts)) {
- context = contexts->data;
- if (context == NULL)
- continue;
+ tcore_context_set_state(ps_context, TCORE_CONTEXT_STATE_DEACTIVATING);
- tcore_ps_deactivate_context(o, context, NULL);
- }
+ dbg("Sending deactivation request");
+ return po->ops->deactivate_context(o, ps_context, cb , user_data);
+}
+
+gboolean tcore_ps_is_active_apn(CoreObject *o, const char *apn)
+{
+ guint idx_cid = 0;
+ PrivateObject *po = NULL;
+ CoreObject *s_context = NULL;
+ gchar *s_apn = NULL;
+ GSList *contexts;
+
+ CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE);
+
+ po = tcore_object_ref_object(o);
+
+ 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( contexts->data == NULL) {
+ contexts = g_slist_next(contexts);
+ continue;
}
+ s_context = (gchar *)(contexts->data);
+ tcore_context_get_apn(s_context, &s_apn);
+ if( 0 == g_strcmp0(apn, s_apn)){
+ tcore_free(s_apn);
+ return TRUE;
+ }
+ tcore_free(s_apn);
+ s_apn = NULL;
+ contexts = g_slist_next(contexts);
}
- return TCORE_RETURN_SUCCESS;
+ return FALSE;
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* 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"
-struct private_object_data {
- struct tcore_sap_operations *ops;
-};
-
-static void _clone_sap_operations(struct private_object_data *po, struct tcore_sap_operations *sap_ops)
-{
- if(sap_ops->connect) {
- po->ops->connect = sap_ops->connect;
- }
- if(sap_ops->disconnect) {
- po->ops->disconnect = sap_ops->disconnect;
- }
- if(sap_ops->req_status) {
- po->ops->req_status = sap_ops->req_status;
- }
- if(sap_ops->set_transport_protocol) {
- po->ops->set_transport_protocol = sap_ops->set_transport_protocol;
- }
- if(sap_ops->set_power) {
- po->ops->set_power = sap_ops->set_power;
- }
- if(sap_ops->get_atr) {
- po->ops->get_atr = sap_ops->get_atr;
- }
- if(sap_ops->transfer_apdu) {
- po->ops->transfer_apdu = sap_ops->transfer_apdu;
- }
- if(sap_ops->get_cardreader_status) {
- po->ops->get_cardreader_status = sap_ops->get_cardreader_status;
- }
-
- return;
-}
+typedef struct {
+ TcoreSapOps *ops;
+} PrivateObject;
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
+static TelReturn _dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, const void *user_data)
{
- enum tcore_request_command command;
- struct private_object_data *po = NULL;
+ 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);
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_SAP, TCORE_RETURN_EINVAL);
+ sap = po->ops;
- 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_SAP_REQ_CONNECT:
- po = tcore_object_ref_object(o);
- if (!po->ops->connect)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->connect(o, ur);
- break;
-
- case TREQ_SAP_REQ_DISCONNECT:
- if (!po->ops->disconnect)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->disconnect(o, ur);
- break;
-
- case TREQ_SAP_REQ_STATUS:
- if (!po->ops->req_status)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->req_status(o, ur);
- break;
-
- case TREQ_SAP_REQ_ATR:
- if (!po->ops->get_atr)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->get_atr(o, ur);
- break;
-
- case TREQ_SAP_TRANSFER_APDU:
- if (!po->ops->transfer_apdu)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->transfer_apdu(o, ur);
- break;
+ 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_SET_PROTOCOL:
- if (!po->ops->set_transport_protocol)
- return TCORE_RETURN_ENOSYS;
+ err("Operation not Supported");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
+}
- return po->ops->set_transport_protocol(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_SET_POWER:
- if (!po->ops->set_power)
- 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->set_power(o, ur);
- break;
+ dest_po = tcore_malloc0(sizeof(PrivateObject));
+ dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreSapOps));
- case TREQ_SAP_REQ_CARDREADERSTATUS:
- if (!po->ops->get_cardreader_status)
- return TCORE_RETURN_ENOSYS;
+ tcore_object_link_object(dest, dest_po);
+}
- return po->ops->get_cardreader_status(o, ur);
- break;
+static void _po_free_hook(CoreObject *co)
+{
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return(po != NULL);
- default:
- break;
- }
- return TCORE_RETURN_SUCCESS;
+ tcore_free(po->ops);
+ tcore_free(po);
+ tcore_object_link_object(co, NULL);
}
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+void tcore_sap_override_ops(CoreObject *co, TcoreSapOps *ops)
{
- struct private_object_data *src_po = NULL;
- struct private_object_data *dest_po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
- if (!src || !dest)
- return;
+ tcore_check_return_assert(po != NULL);
+ tcore_check_return_assert(po->ops != NULL);
+ tcore_check_return_assert(ops != NULL);
- dest_po = calloc(1, sizeof(struct private_object_data));
- if (!dest_po) {
- tcore_object_link_object(dest, NULL);
- return;
- }
+ if (ops->req_connect)
+ po->ops->req_connect = ops->req_connect;
- src_po = tcore_object_ref_object(src);
- dest_po->ops = src_po->ops;
+ if (ops->req_disconnect)
+ po->ops->req_disconnect = ops->req_disconnect;
- tcore_object_link_object(dest, dest_po);
-}
+ if (ops->get_atr)
+ po->ops->get_atr = ops->get_atr;
-static void _free_hook(CoreObject *o)
-{
- struct private_object_data *po = NULL;
+ if (ops->req_transfer_apdu)
+ po->ops->req_transfer_apdu = ops->req_transfer_apdu;
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAP);
+ if (ops->req_transport_protocol)
+ po->ops->req_transport_protocol = ops->req_transport_protocol;
- po = tcore_object_ref_object(o);
- if (po) {
- free(po);
- tcore_object_link_object(o, NULL);
- }
+ if (ops->req_power_operation)
+ po->ops->req_power_operation = ops->req_power_operation;
+
+ if (ops->get_cardreader_status)
+ po->ops->get_cardreader_status = ops->get_cardreader_status;
}
-void tcore_sap_override_ops(CoreObject *o, struct tcore_sap_operations *sap_ops)
+gboolean tcore_sap_set_ops(CoreObject *co, TcoreSapOps *ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAP);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- if(sap_ops) {
- _clone_sap_operations(po, sap_ops);
- }
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSapOps));
- return;
+ return TRUE;
}
-CoreObject *tcore_sap_new(TcorePlugin *p,
- struct tcore_sap_operations *ops, TcoreHal *hal)
+CoreObject *tcore_sap_new(TcorePlugin *plugin, TcoreSapOps *ops, TcoreHal *hal)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
+ tcore_check_return_value_assert(plugin != NULL, NULL);
- if (!p)
- return NULL;
+ co = tcore_object_new(plugin, hal);
+ tcore_check_return_value_assert(co != NULL, NULL);
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
+ po = tcore_malloc0(sizeof(PrivateObject));
- po = calloc(1, sizeof(struct private_object_data));
- if (!po) {
- tcore_object_free(o);
- return NULL;
- }
-
- po->ops = ops;
+ if (ops != NULL)
+ po->ops = tcore_memdup(ops, sizeof(TcoreSapOps));
- 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);
+ 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);
- return o;
+ return co;
}
-void tcore_sap_free(CoreObject *o)
+void tcore_sap_free(CoreObject *co)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAP);
-
- po = tcore_object_ref_object(o);
- if (!po)
- return;
-
- free(po);
- tcore_object_free(o);
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SAP);
+ tcore_object_free(co);
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#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*/
#define SATK_CHANNEL_DATA_LENGTH_VALUE_LENGTH 0x01 /* CHANNEL DATA LENGTH VALUE LENGTH */
#define SATK_CHANNEL_STATUS_LENGTH 0x02 /* CHANNEL STATUS LENGTH */
-struct private_object_data {
- struct tcore_sat_operations *ops;
-};
-
-gboolean b_comprehensive = FALSE;
-
-static void _clone_sat_operations(struct private_object_data *po, struct tcore_sat_operations *sat_ops)
-{
- if (sat_ops->envelope) {
- po->ops->envelope = sat_ops->envelope;
- }
- if (sat_ops->terminal_response) {
- po->ops->terminal_response = sat_ops->terminal_response;
- }
+typedef struct {
+ TcoreSatOps *ops;
+} PrivateObject;
- return;
-}
+gboolean is_comprehensive = FALSE;
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
+static TelReturn _dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, void *user_data)
{
- enum tcore_request_command command;
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
+ po = tcore_object_ref_object(co);
- 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;
-
- command = tcore_user_request_get_command(ur);
+ dbg("Tcore SAT Command: %d", command);
switch (command) {
- case TREQ_SAT_REQ_ENVELOPE:
- if (!po->ops->envelope)
- return TCORE_RETURN_ENOSYS;
-
- return po->ops->envelope(o, ur);
- break;
+ case TCORE_COMMAND_SAT_REQ_ENVELOPE:
+ if (po->ops->send_envelope)
+ return po->ops->send_envelope(co, request, cb, (void *)user_data);
- case TREQ_SAT_REQ_TERMINALRESPONSE:
- if (!po->ops->terminal_response)
- 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);
- return po->ops->terminal_response(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);
- default:
- break;
+ default:
+ err("unsupported operation");
+ return TEL_RETURN_INVALID_PARAMETER;;
}
-
- return TCORE_RETURN_SUCCESS;
+ err("Operation NOT Permitted");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
}
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void _po_clone_hook(CoreObject *src, CoreObject *dest)
{
- struct private_object_data *src_po = NULL;
- struct private_object_data *dest_po = NULL;
+ PrivateObject *src_po = NULL;
+ PrivateObject *dest_po = NULL;
- if (!src || !dest)
- return;
+ tcore_check_return_assert(src != NULL);
+ tcore_check_return_assert(dest != NULL);
- dest_po = calloc(1, sizeof(struct private_object_data));
- if (!dest_po) {
+ src_po = tcore_object_ref_object(src);
+ if (NULL == src_po) {
+ err("invalid source private object");
tcore_object_link_object(dest, NULL);
return;
}
+ 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(TcoreSatOps));
tcore_object_link_object(dest, dest_po);
}
-static void _free_hook(CoreObject *o)
+static void _po_free_hook(CoreObject *co)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAT);
+ po = tcore_object_ref_object(co);
+ tcore_check_return(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 gboolean _check_file_for_refresh(enum tel_sim_file_id file_id)
+static gboolean _check_file_for_refresh(TelSimFileId file_id)
{
int i;
- 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 };
+ 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 };
dbg("[SAT] SAT PARSER - FILE ID=0x%04x", (unsigned int)file_id);
return FALSE;
}
-static int _get_length_filed_size(unsigned char firstLenByte)
+static int _get_length_filed_size(unsigned char first_len_byte)
{
- if (firstLenByte <= 0x7F) return 1;
- else if (firstLenByte == 0x81) return 2;
+ if (first_len_byte <= 0x7F) return 1;
+ else if (first_len_byte == 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,
- struct tel_sat_text_string_object *text_obj)
+ TelSatTextTypeInfo *text_obj)
{
- if (!src || !text_obj) return;
+ tcore_check_return_assert(src != NULL);
+ tcore_check_return_assert(text_obj != NULL);
switch (text_obj->dcs.a_format) {
- case ALPHABET_FORMAT_SMS_DEFAULT: {
- char* unpacked_str;
+ case TEL_SAT_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) return;
-
- text_obj->dcs.a_format = ALPHABET_FORMAT_8BIT_DATA;
- text_obj->string_length = strlen(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;
+ }
- 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;
- }
+ text_obj->dcs.a_format = TEL_SAT_ALPHABET_FORMAT_8BIT_DATA;
+ text_obj->string_length = strlen(unpacked_str);
- g_free(unpacked_str);
- }break;
- case ALPHABET_FORMAT_UCS2:
- case 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, 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, 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] = 0x00;
- }
- }break;
- default: {
- dbg("[SAT] SAT PARSER - Unknown alphabet format(%d)", text_obj->dcs.a_format);
- }break;
+ 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);
}
-
- return;
}
-static void _sat_decode_dcs(unsigned char dcs, struct data_coding_scheme* dsc_obj)
+static void _sat_decode_dcs(unsigned char dcs, TelSatDataCodingSchemeInfo* dsc_obj)
{
dbg("[SAT] SAT PARSER - dcs=[0x%x]", dcs);
dsc_obj->raw_dcs = dcs;
dsc_obj->is_compressed_format = FALSE;
//bit 4 when set, indicates that bits 0 & 1 have message class meaning.
- dsc_obj->m_class = MSG_CLASS_NONE;
+ dsc_obj->m_class = TEL_SAT_MSG_CLASS_NONE;
if (dcs & 0x10) {
switch (dcs & 0x03) {
- 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;
+ 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;
+ break;
+ default:
+ dsc_obj->m_class = TEL_SAT_MSG_CLASS_RESERVED;
}
}
/*bits 2 & 3 indicate the character set being used*/
switch (dcs & 0x0C) {
- 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;
+ 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;
}
dbg("[SAT] SAT PARSER - is_compressed_format(%d), msgClass(0x%x), alpha_format(0x%x)",
return;
}
-static void _sat_decode_ton_npi(unsigned char ton_npi, enum type_of_number *ton, enum numbering_plan_identifier *npi)
+static void _sat_decode_ton_npi(unsigned char ton_npi, TelSatTypeOfNum *ton, TelSatNumberingPlanIdentity *npi)
{
int ton_value = 0;
int npi_value = 0;
- if (!ton || !npi)
- return;
+ tcore_check_return_assert(ton != NULL);
+ tcore_check_return_assert(npi != NULL);
ton_value = (ton_npi & 0x70) >> 4;
*ton = ton_value;
- if (*ton > TON_NETWORK_SPECIFIC)
- *ton = TON_UNKNOWN;
+ if (*ton > TEL_SAT_TON_NETWORK_SPECIFIC)
+ *ton = TEL_SAT_TON_UNKNOWN;
npi_value = (ton_npi & 0x0F);
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;
+ 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;
}
dbg("[SAT] SAT PATSER - ton(0x%x) npi(0x%x)", *ton, *npi);
return;
}
-static enum tel_sim_language_type _sat_decode_language(unsigned char byte1, unsigned char byte2)
+static TelSatLanguageInfo _sat_decode_language(unsigned char byte1, unsigned char byte2)
{
if ((byte1 == 'e')&&(byte2 == 'n')) {
- return SIM_LANG_ENGLISH;
+ return TEL_SAT_LP_ENGLISH;
} else if ((byte1 == 'd')&&(byte2 == 'e')) {
- return SIM_LANG_GERMAN;
+ return TEL_SAT_LP_GERMAN;
} else if ((byte1 == 'i')&&(byte2 == 't')) {
- return SIM_LANG_ITALIAN;
+ return TEL_SAT_LP_ITALIAN;
} else if ((byte1 == 'f')&&(byte2 == 'r')) {
- return SIM_LANG_FRENCH;
+ return TEL_SAT_LP_FRENCH;
} else if ((byte1 == 'e')&&(byte2 == 's')) {
- return SIM_LANG_SPANISH;
+ return TEL_SAT_LP_SPANISH;
} else if ((byte1 == 'n')&&(byte2 == 'l')) {
- return SIM_LANG_DUTCH;
+ return TEL_SAT_LP_DUTCH;
} else if ((byte1 == 's')&&(byte2 == 'v')) {
- return SIM_LANG_SWEDISH;
+ return TEL_SAT_LP_SWEDISH;
} else if ((byte1 == 'd')&&(byte2 == 'a')) {
- return SIM_LANG_DANISH;
+ return TEL_SAT_LP_DANISH;
} else if ((byte1 == 'p')&&(byte2 == 't')) {
- return SIM_LANG_PORTUGUESE;
+ return TEL_SAT_LP_PORTUGUESE;
} else if ((byte1 == 'f')&&(byte2 == 'i')) {
- return SIM_LANG_FINNISH;
+ return TEL_SAT_LP_FINNISH;
} else if ((byte1 == 'n')&&(byte2 == 'o')) {
- return SIM_LANG_NORWEGIAN;
+ return TEL_SAT_LP_NORWEGIAN;
} else if ((byte1 == 'e')&&(byte2 == 'l')) {
- return SIM_LANG_GREEK;
+ return TEL_SAT_LP_GREEK;
} else if ((byte1 == 't')&&(byte2 == 'r')) {
- return SIM_LANG_TURKISH;
+ return TEL_SAT_LP_TURKISH;
} else if ((byte1 == 'h')&&(byte2 == 'u')) {
- return SIM_LANG_HUNGARIAN;
+ return TEL_SAT_LP_HUNGARIAN;
} else if ((byte1 == 'p')&&(byte2 == 'i')) {
- return SIM_LANG_POLISH;
+ return TEL_SAT_LP_POLISH;
} else {
- dbg("[SAT] SAT PARSER - unknown language, default to english.");
- return SIM_LANG_ENGLISH;
+ err("[SAT] SAT PARSER - unknown language, default to english.");
+ return TEL_SAT_LP_ENGLISH;
}
}
/*
* Decode TLV data object
*/
-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)
+static TelSatResult _sat_decode_address_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatAddressInfo* address_obj, int* consumed_data_len)
{
unsigned char* src_data;
int index, len_of_len = 0;
int address_len = 0;
gboolean comprehensive_req = FALSE;
- 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;
- }
+ 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_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index] & 0x7F) != SATK_ADDRESS_TAG) {
- dbg("[SAT] SAT PARSER - address TAG missing");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ err("[SAT] SAT PARSER - address TAG missing");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
//comprehensive required
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
address_len = src_data[index + len_of_len - 1];
//check the address length
index += len_of_len;
if ((index + address_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
address_obj->dialing_number_len = 0;
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_bcd2ascii((const char*)&src_data[index], address_len-1, SAT_DIALING_NUMBER_LEN_MAX);
+ 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) {
memcpy(address_obj->dialing_number, str_ascii, strlen(str_ascii));
address_obj->dialing_number_len = strlen(str_ascii);
- g_free(str_ascii);
+ tcore_free(str_ascii);
}
}
if (address_obj->dialing_number_len == 0) {
if (comprehensive_req) {
err("[SAT] SAT PARSER - incorrect address");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
dbg("comprehensive partial proactive command");
//global variable (comprehensive_partial= TRUE)
}
*consumed_data_len = 1 + len_of_len + address_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_subaddress_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatSubAddressInfo* sub_address_obj, int* consumed_data_len)
{
unsigned char* src_data;
int index, len_of_len = 0;
int sub_address_len = 0;
gboolean comprehensive_req = FALSE;
- 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;
- }
+ 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_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index] & 0x7F) != SATK_SUB_ADDRESS_TAG) {
- dbg("[SAT] SAT PARSER - sub address TAG missing");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ err("[SAT] SAT PARSER - sub address TAG missing");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
//comprehensive required
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
sub_address_len = src_data[index + len_of_len - 1];
//check the address length
index += len_of_len;
if ((index + sub_address_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//sub address
if (sub_address_len <= 0) {
- dbg("[SAT] SAT PARSER - no sub address data");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - no sub address data");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
sub_address_obj->subaddress_len = sub_address_len;
- if ( sub_address_obj->subaddress_len > SAT_CCP_DATA_LEN_MAX) {
+ if ( sub_address_obj->subaddress_len > TEL_SAT_CCP_DATA_LEN_MAX) {
if (comprehensive_req) {
- dbg("[SAT] SAT PARSER - sub address is too big");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - sub address is too big");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
else{
//bIsComprehensionPartial = TRUE;
}
*consumed_data_len = 1 + len_of_len + sub_address_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
unsigned char* src_data;
int index, len_of_len = 0;
int alpha_len = 0;
- 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;
- }
+ 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_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++] & 0x7F) != SATK_ALPHA_IDENTIFIER_TAG) {
- dbg("[SAT] SAT PARSER - alphaID TAG missing");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - alphaID TAG missing");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//length
alpha_id_obj->is_exist = TRUE;
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
alpha_len = alpha_id_obj->alpha_data_len = src_data[index + len_of_len - 1];
//alpha identifier
index += len_of_len;
if ((index + alpha_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if (alpha_id_obj->alpha_data_len > 0) {
unsigned char dcs;
- if (alpha_id_obj->alpha_data_len >= SAT_ALPHA_ID_LEN_MAX)
- alpha_id_obj->alpha_data_len = SAT_ALPHA_ID_LEN_MAX - 1;
+ 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;
memcpy(alpha_id_obj->alpha_data, &src_data[index], alpha_id_obj->alpha_data_len);
alpha_id_obj->alpha_data[alpha_id_obj->alpha_data_len] = 0x00;
*consumed_data_len = 1 + len_of_len + alpha_len;
dbg("[SAT] SAT PARSER alphaId= %s", alpha_id_obj->alpha_data);
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
- int i = 0;
+ unsigned int i = 0;
int index, len_of_len = 0;
int sub_address_len = 0;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- 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;
- }
+ 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_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index] & 0x7F) != SATK_SUB_ADDRESS_TAG) {
- dbg("[SAT] SAT PARSER - address TAG missing");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ err("[SAT] SAT PARSER - address TAG missing");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
//comprehensive required
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
sub_address_len = src_data[index + len_of_len - 1];
//check the address length
index += len_of_len;
if ((index + sub_address_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ 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;
+ err("[SAT] SAT PARSER - no sub address");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
sub_address_obj->subaddress_len = sub_address_len;
- if (sub_address_obj->subaddress_len > SAT_SUB_ADDR_LEN_MAX) {
- if (comprehension_req)
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
+ }
else
sub_address_obj->subaddress_len = 0;
}
dbg("[SAT] SAT PARSER - 0x%02x\t",sub_address_obj->subaddress[i]);
*consumed_data_len = 1+len_of_len+sub_address_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_ccp_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatCcpInfo* ccp_obj, int* consumed_data_len)
{
- int i = 0;
+ unsigned int i = 0;
int index, len_of_len = 0;
int ccp_len = 0;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- 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;
- }
+ 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_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index] & 0x7F) != SATK_CAPABILITY_CONFIGURATION_PARAMETERS_TAG) {
- dbg("[SAT] SAT PARSER - CCP TAG missing");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ err("[SAT] SAT PARSER - CCP TAG missing");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
//comprehensive required
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
ccp_len = src_data[index + len_of_len - 1];
//check the address length
index += len_of_len;
if ((index + ccp_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if (ccp_len <= 0) {
- dbg("[SAT] SAT PARSER - no ccp data");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - no ccp data");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
ccp_obj->data_len = ccp_len;
- if (ccp_obj->data_len > SAT_CCP_DATA_LEN_MAX) {
- if (comprehension_req)
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
+ }
else
ccp_obj->data_len = 0;
}
dbg("[SAT] SAT PARSER - 0x%02x\t",ccp_obj->data[i]);
*consumed_data_len = 1+len_of_len+ccp_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-static enum tcore_sat_result _sat_decode_device_identities_tlv(unsigned char* tlv_str,
- struct tel_sat_device_identities* dev_id_obj)
+static TelSatResult _sat_decode_device_identities_tlv(unsigned char* tlv_str,
+ TelSatDeviceIdentitiesInfo* dev_id_obj)
{
int index = 0, i;
- if (tlv_str == NULL || dev_id_obj == NULL) {
- dbg("[SAT] SAT PARSER - tlv_str ==NULL || dev_id_obj == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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[index++] & 0x7F) != SATK_DEVICE_IDENTITY_TAG) {
- dbg("[SAT] SAT PARSER - device identity tag missing.");
- return TCORE_SAT_REQUIRED_VALUE_MISSING; //send TR
+ err("[SAT] SAT PARSER - device identity tag missing.");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING; //send TR
}
if (tlv_str[index++] != SATK_DEVICE_IDENTITY_LENGTH) {
- dbg("[SAT] SAT PARSER - device identity length incorrect.");
- return TCORE_SAT_REQUIRED_VALUE_MISSING; //send TR
+ err("[SAT] SAT PARSER - device identity length incorrect.");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING; //send TR
}
for (i = 0; i < 2; i++) {
switch (tlv_str[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:
+ 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];
- 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{
- dbg("unmatched device id");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
- }
- }break;
+ }
+ else{
+ err("unmatched device id");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+ }
}
index++;
}
dbg("[SAT] SAT PARSER - source=%d, dest=%d", dev_id_obj->src, dev_id_obj->dest);
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_duration_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatDurationInfo *duration_obj, int* consumed_data_len)
{
int index = 0;
unsigned char* src_data = NULL;
- if (!tlv_str || !duration_obj || !consumed_data_len) {
- err("[SAT] SAT PARSER data is null");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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_len < curr_offset + 3) {
err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++] & 0x7F) != SATK_DURATION_TAG) {
err("[SAT] SAT PARSER - duration tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
if (src_data[index++] != SATK_DURATION_LENGTH) {
err("[SAT] SAT PARSER - incorrect length value.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//time unit
switch (src_data[index]) {
- case TIME_UNIT_MINUTES:
- case TIME_UNIT_SECONDS:
- case TIME_UNIT_TENTHS_OF_SECONDS:
- duration_obj->time_unit = src_data[index];
- break;
- default:
- duration_obj->time_unit = TIME_UNIT_RESERVED;
- break;
+ 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;
}
//interval
dbg("[SAT] SAT PARSER - timeUnit=%d, interval=%d", duration_obj->time_unit, duration_obj->time_interval);
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_item_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatMenuItemInfo* item_obj, int* consumed_data_len)
{
int index, len_of_len=0, i=0;
int item_len =0;
unsigned char* src_data = NULL;
- if ((tlv_str == NULL)
- || (consumed_data_len == NULL)
- || (item_obj == NULL)) {
- err("[SAT PARSER] TLV: [0x%x] Item Object: [0x%x] Consumed Data length(ptr): [0x%x]",
- tlv_str, item_obj, consumed_data_len);
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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_len <= (curr_offset+1)) {
err("[SAT PARSER] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
/* ITEM TAG - 0x0F */
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 TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_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 TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
item_len = src_data[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 TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
- memset(item_obj->text, 0x00,(SAT_ITEM_TEXT_LEN_MAX+1));
+ memset(item_obj->text, 0x00,(TEL_SAT_ITEM_TEXT_LEN_MAX+1));
if (item_len <= 0) {
- dbg("[SAT PARSER] Menu Text is NULL, remove the Menu");
+ err("[SAT PARSER] Menu Text is NULL, remove the Menu");
*consumed_data_len = 1+len_of_len+item_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
/* Item */
item_obj->text_len = i;
if (item_obj->text_len <= 0) {
- dbg("[SAT PARSER] Text length: [%d]", item_obj->text_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT PARSER] Text length: [%d]", item_obj->text_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
- if (item_obj->text_len > SAT_ITEM_TEXT_LEN_MAX)
- item_obj->text_len = SAT_ITEM_TEXT_LEN_MAX;
+ if (item_obj->text_len > TEL_SAT_ITEM_TEXT_LEN_MAX)
+ item_obj->text_len = TEL_SAT_ITEM_TEXT_LEN_MAX;
memcpy(item_obj->text, &src_data[index], item_obj->text_len);
dbg("[SAT PARSER] Item Text: [%s]", item_obj->text);
*consumed_data_len = 1+len_of_len+item_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_response_length_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatResponseLength *response_obj, int* consumed_data_len)
{
int index = 0;
unsigned char* src_data = NULL;
- if (!tlv_str || !response_obj || !consumed_data_len) {
- err("[SAT] SAT PARSER data is null");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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_len <= curr_offset + 1) {
err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++] & 0x7F) != SATK_RESPONSE_LENGTH_TAG) {
err("[SAT] SAT PARSER - response length tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
if (src_data[index++] != SATK_RESPONSE_LENGTH_LENGTH) {
err("[SAT] SAT PARSER - incorrect length value.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
response_obj->min = src_data[index++];
*consumed_data_len = 4;
if (response_obj->min > response_obj->max) {
err("[SAT] SAT PARSER - : min length is larger than max length");
- return TCORE_SAT_BEYOND_ME_CAPABILITY;
+ return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
}
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
int index = 0, len_of_len = 0;
int tpdu_len = 0;
unsigned char* src_data = NULL;
- if (!tlv_str || !sms_tpdu_obj || !consumed_data_len) {
- err("[SAT] SAT PARSER data is null");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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_len <= curr_offset + 1) {
err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++] & 0x7F) != SATK_SMS_TPDU_TAG) {
err("[SAT] SAT PARSER - sat tpdu tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
tpdu_len = src_data[index+len_of_len-1];
index += len_of_len;
- if (tpdu_len <= 0)
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ if (tpdu_len <= 0) {
+ err("[SAT] parser: invalid tpdu_len.");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+ }
//data len
sms_tpdu_obj->data_len = tpdu_len;
- 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;
+ 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;
}
//data
dbg("[SAT] SAT PARSER tpdu_len (%d)", sms_tpdu_obj->data_len);
*consumed_data_len = 1+len_of_len+tpdu_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
int index = 0;
unsigned char* src_data = NULL;
- if (!tlv_str || !item_identifier_obj || !consumed_data_len) {
- err("[SAT] SAT PARSER data is null");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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_len <= curr_offset + 1) {
err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++] & 0x7F) != SATK_ITEM_IDENTIFIER_TAG) {
err("[SAT] SAT PARSER - Item identifier tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
if (src_data[index++] != SATK_ITEM_IDENTIFIER_LENGTH) {
err("[SAT] SAT PARSER - incorrect length value.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
- item_identifier_obj->item_identifier = src_data[index++];
+ *item_identifier = src_data[index++];
*consumed_data_len = 3;
- dbg("[SAT] SAT PARSER item identifier(0x%02x)", item_identifier_obj->item_identifier);
+ dbg("[SAT] SAT PARSER item identifier(0x%02x)", item_identifier);
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
char* str_ascii = NULL;
int index, len_of_len=0;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- if (!tlv_str || !ss_str_obj || !consumed_data_len) {
- err("[SAT] SAT PARSER data is null");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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_len <= curr_offset + 1) {
err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index] & 0x7F) != SATK_SS_STRING_TAG) {
err("[SAT] SAT PARSER - SS string tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
if (src_data[index++]&0x80)
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
ss_len = src_data[index+len_of_len-1];
ss_str_obj->string_len = 0;
//ss data
- if (ss_len <= 1)
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ if (ss_len <= 1) {
+ err("[SAT] parser: invalid ss_len.");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+ }
_sat_decode_ton_npi(src_data[index++], &ss_str_obj->ton, &ss_str_obj->npi);
- str_ascii = tcore_util_convert_bcd2ascii((const char*)&src_data[index], ss_len-1, SAT_SS_STRING_LEN_MAX);
+ 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) {
memcpy(ss_str_obj->ss_string, str_ascii, strlen(str_ascii));
ss_str_obj->string_len = strlen(str_ascii);
- g_free(str_ascii);
+ tcore_free(str_ascii);
}
// 1 is the length of Tag.
*consumed_data_len = 1 + len_of_len + ss_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_text_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatTextTypeInfo *text_obj, int* consumed_data_len)
{
int index, len_of_len=0;
int text_len =0;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- if (!tlv_str || !consumed_data_len ) {
- err("[SAT] parser: data is null");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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_len <= (curr_offset+1)) {
err("[SAT] parser: incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
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 TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if (src_data[index++]&0x80)
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_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, SAT_TEXT_STRING_LEN_MAX);
+ memset(text_obj->string, 0x00, TEL_SAT_TEXT_STRING_LEN_MAX);
//text
if (text_len <=1) {
// 1 is the length of Tag.
*consumed_data_len = 1 + len_of_len + text_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_tone_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatToneType *tone_type, int* consumed_data_len)
{
int index;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- 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;
- }
+ 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_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
src_data = &tlv_str[0];
if ((src_data[index]&0x7F) != SATK_TONE_TAG) {
err("[SAT] parser: tone tag missing");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if (src_data[index++]&0x80)
//length
if (src_data[index++] != SATK_TONE_LENGTH) {
err("[SAT] SAT PARSER - incorrect length value.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
if ((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 TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tone
- switch(src_data[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[index]);
- tone_obj->tone_type = src_data[index];
- break;
-
- case TONE_TYPE_RESERVED:
- default:
- dbg("[SAT] SAT PARSER - Reserved value of Tone =0x%x", src_data[index]);
- if (comprehension_req)
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
- break;
+ 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;
+ }
}
*consumed_data_len = 3;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
int index, len_of_len=0;
int ussd_len =0;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- if (!tlv_str || !ussd_str_obj || !consumed_data_len) {
- err("[SAT] SAT PARSER data is null");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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_len <= curr_offset + 1) {
err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index] & 0x7F) != SATK_USSD_STRING_TAG) {
err("[SAT] SAT PARSER - SS string tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
if (src_data[index++]&0x80)
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
ussd_len = src_data[index+len_of_len-1];
ussd_str_obj->string_len = 0;
//ussd data
- if (ussd_len <= 1)
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ if (ussd_len <= 1) {
+ err("[SAT] parser: invalid ussd_len");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
+ }
_sat_decode_dcs(src_data[index++], &ussd_str_obj->dsc);
ussd_str_obj->string_len = ussd_len - 1;
// 1 is the length of Tag.
*consumed_data_len = 1 + len_of_len + ussd_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
//tmp
int tmp_cnt, tmp_path_len;
int file_list_len = 0;
unsigned char* src_data;
- 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;
- }
+ 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_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
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 TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
file_list_len = src_data[index+len_of_len-1];
index += len_of_len;
if ((index+file_list_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+file_list_len),tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
tmp_cnt = src_data[index++];
tmp_path_len = file_list_len - 1;
file_list_obj->file_count = 0;
- memset(file_list_obj->file_id, 0, SAT_FILE_ID_LIST_MAX_COUNT);
+ memset(file_list_obj->file_id, 0, TEL_SAT_FILE_ID_LIST_MAX_COUNT);
if (!tmp_cnt) {
- dbg("file cnt = 0");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("file cnt = 0");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
f_count = 0;
index++;
ef = ef | src_data[index];
- if ( _check_file_for_refresh((enum tel_sim_file_id)ef) ) {//check file registered for refresh?
+ if ( _check_file_for_refresh((TelSimFileId)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) {
//USIM DIRECTORY FILE (DIR) 0x7FFF
index++;
ef = ef | src_data[index];
- if ( _check_file_for_refresh((enum tel_sim_file_id)ef) ) {//check file registered for refresh?
+ if ( _check_file_for_refresh((TelSimFileId)ef) ) {//check file registered for refresh?
file_list_obj->file_id[file_list_obj->file_count] = ef;
file_list_obj->file_count++;
}
index++;
ef = ef | src_data[index];
- if ( _check_file_for_refresh((enum tel_sim_file_id)ef) ) {//check file registered for refresh?
+ if ( _check_file_for_refresh((TelSimFileId)ef) ) {//check file registered for refresh?
file_list_obj->file_id[file_list_obj->file_count] = ef;
file_list_obj->file_count++;
}
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 TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-static enum tcore_sat_result _sat_decode_item_next_action_indicator_tlv(unsigned char* tlv_str,
+static TelSatResult _sat_decode_item_next_action_indicator_tlv(unsigned char* tlv_str,
int tlv_len, int curr_offset,
- struct tel_sat_item_next_action_indicatior_list* item_next_act_indi_obj,
+ TelSatItemsNextActionIndiListInfo* item_next_act_indi_obj,
int* consumed_data_len)
{
int index;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- 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;
- }
+ 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_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index]&0x7F) != SATK_ITEMS_NEXT_ACTION_INDICATOR_TAG) {
- dbg("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if ((src_data[index++]&0x7F))
//item cnt
item_nai_len = item_next_act_indi_obj->cnt = src_data[index++];
if ((index+item_nai_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+item_nai_len),tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
- if (item_next_act_indi_obj->cnt > SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT) {
+ if (item_next_act_indi_obj->cnt > TEL_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;
+ err("[SAT] SAT PARSER - list count exceeds maximum allowed count=%d",item_next_act_indi_obj->cnt);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
item_next_act_indi_obj->cnt = 0;
}
- memset(item_next_act_indi_obj->indicator_list, 0xFF, SAT_ITEMS_NEXT_ACTION_INDI_LIST_MAX_COUNT);
+ 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);
*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 TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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, struct tel_sat_event_list* modem_event_list_obj, int* consumed_data_len)
+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)
{
int i = 0;
int index, len_of_len=0;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- 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;
- }
+ 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_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index]&0x7F) != SATK_EVENT_LIST_TAG) {
- dbg("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if ((src_data[index++]&0x80))
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
evt_list_len = src_data[index+len_of_len-1];
index += len_of_len;
if ((index+evt_list_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+evt_list_len),tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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 (evt_list_len > SAT_EVENT_LIST_MAX) {
+ if (evt_list_len > TEL_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)
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ if (comprehension_req) {
+ err("[SAT] SAT PARSER - comprehension_required ");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
+ }
else
- evt_list_len = SAT_EVENT_LIST_MAX;
+ evt_list_len = TEL_SAT_EVENT_LIST_MAX;
}
event_list_obj->event_list_cnt = 0;
- memset(event_list_obj->evt_list, 0xFF, SAT_EVENT_LIST_MAX);
+ 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, SAT_EVENT_LIST_MAX);
+ memset(modem_event_list_obj->evt_list, 0xFF, TEL_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 EVENT_USER_ACTIVITY:
- case EVENT_IDLE_SCREEN_AVAILABLE:
- case EVENT_LANGUAGE_SELECTION:
- case EVENT_BROWSER_TERMINATION:
- case EVENT_DATA_AVAILABLE:
- case EVENT_CHANNEL_STATUS:
- event_list_obj->evt_list[i] = src_data[index];
- event_list_obj->event_list_cnt++;
- break;
- /*MODEM events*/
- case EVENT_MT_CALL :
- case EVENT_CALL_CONNECTED:
- case EVENT_CALL_DISCONNECTED:
- case EVENT_LOCATION_STATUS:
- case EVENT_ACCESS_TECHNOLOGY_CHANGED:
- modem_event_list_obj->evt_list[i] = src_data[index];
- modem_event_list_obj->event_list_cnt++;
- break;
- case EVENT_UNKNOWN:
- default:
- if (comprehension_req)
- return TCORE_SAT_BEYOND_ME_CAPABILITY;
- break;
+ /*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;
+ }
}
index++;
}
// 1 is the length of Tag.
*consumed_data_len = 1 + len_of_len + evt_list_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
unsigned char* src_data;
int index = 0;
- 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;
- }
+ 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_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;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++]&0x7F) != SATK_ICON_IDENTIFIER_TAG) {
- dbg("[SAT] SAT PARSER - icon identity tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - icon identity tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
if (src_data[index++] != SATK_ICON_IDENTITY_LENGTH) {
- dbg("[SAT] SAT PARSER - incorrect length value.");
+ err("[SAT] SAT PARSER - incorrect length value.");
return FALSE; //send TR
}
if ((index+SATK_ICON_IDENTITY_LENGTH) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+SATK_ICON_IDENTITY_LENGTH),tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
icon_id_obj->is_exist = TRUE;
if ((src_data[index++]&0x01))
- icon_id_obj->icon_qualifer = ICON_QUALI_NOT_SELF_EXPLANATORY;
+ icon_id_obj->icon_qualifer = TEL_SAT_ICON_QUALI_NOT_SELF_EXPLANATORY;
else
- icon_id_obj->icon_qualifer = ICON_QUALI_SELF_EXPLANATORY;
+ icon_id_obj->icon_qualifer = TEL_SAT_ICON_QUALI_SELF_EXPLANATORY;
if (src_data[index] > 0x00) {
icon_id_obj->icon_identifier = src_data[index];
}
else {
- dbg("[SAT] SAT PARSER - incorrect icon identifier");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - incorrect icon identifier");
+ return TEL_SAT_RESULT_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 TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_icon_identifier_list_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, TelSatIconIdentifierListInfo* icon_list_obj,
int* consumed_data_len)
{
int index, i;
unsigned char* src_data;
gboolean comprehension_req = FALSE;
- 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;
- }
+ 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_len <= (curr_offset+1)+1) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index]&0x7F) != SATK_ITEM_ICON_IDENTIFIER_LIST_TAG) {
- dbg("[SAT] SAT PARSER - icon identity tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - icon identity tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
icon_list_obj->is_exist = TRUE;
len_value = src_data[index++];
if (src_data[index++]&0x01)
- icon_list_obj->icon_qualifer = ICON_QUALI_NOT_SELF_EXPLANATORY;
+ icon_list_obj->icon_qualifer = TEL_SAT_ICON_QUALI_NOT_SELF_EXPLANATORY;
else
- icon_list_obj->icon_qualifer = ICON_QUALI_SELF_EXPLANATORY;
+ icon_list_obj->icon_qualifer = TEL_SAT_ICON_QUALI_SELF_EXPLANATORY;
icon_list_obj->icon_cnt = len_value-1;
- if (icon_list_obj->icon_cnt > SAT_ICON_LIST_MAX_COUNT) {
+ if (icon_list_obj->icon_cnt > TEL_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;
+ err("[SAT] SAT PARSER - list count exceeds maximum allowed count=%d",icon_list_obj->icon_cnt);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
icon_list_obj->icon_cnt = 0;
}
if (src_data[index] > 0x00) {
icon_list_obj->icon_id_list[i]= src_data[index++];
} else {
- dbg("[SAT] SAT PARSER - incorrect icon identifier");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - incorrect icon identifier");
+ return TEL_SAT_RESULT_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 TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+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)
{
unsigned char* src_data;
int index, len_of_len = 0;
gboolean comprehension_req = FALSE;
char* str_ascii = NULL;
- 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;
- }
+ 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);
src_data = &tlv_str[0];
if (tlv_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//Tag
index = curr_offset;
if ((src_data[index] & 0x7F) != SATK_DTMF_STRING_TAG) {
- dbg("[SAT] SAT PARSER - address tag missing");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ err("[SAT] SAT PARSER - address tag missing");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
//comprehensive required
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
dtmf_len = src_data[index + len_of_len - 1];
index += len_of_len; //index pointing to TON/NPI
if ((index + dtmf_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+dtmf_len), tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
dtmf_string_obj->dtmf_length = 0;
if (dtmf_len > 0) {
- str_ascii = tcore_util_convert_bcd2ascii((const char*)&src_data[index], dtmf_len, SAT_DTMF_STRING_LEN_MAX);
+ str_ascii = tcore_util_convert_bcd_to_ascii((const char*)&src_data[index], dtmf_len, TEL_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);
- g_free(str_ascii);
+ tcore_free(str_ascii);
}
}
if (dtmf_string_obj->dtmf_length == 0) {
- 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;
+ 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;
}
*consumed_data_len = 1 + len_of_len + dtmf_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_language_tlv(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatLanguageInfo* language_obj)
{
unsigned char* src_data;
int index = 0;
if (tlv_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
src_data = &tlv_str[0];
index = curr_offset;
if ((src_data[index++]&0x7F) != SATK_LANGUAGE_TAG) {
- dbg("[SAT] SAT PARSER - Language tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - Language tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if (src_data[index++] != SATK_LANGUAGE_LENGTH) {
- dbg("[SAT] SAT PARSER - incorrect length value.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length value.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if ((index+SATK_LANGUAGE_LENGTH) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+SATK_LANGUAGE_LENGTH),tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
*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 TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_browser_identity_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
+ TelSatBrowserIdentityType* browser_id, int* consumed_data_len)
{
unsigned char* src_data;
int index = 0;
- 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;
- }
+ 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_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++] & 0x7F) != SATK_BROWSER_IDENTITY_TAG) {
- dbg("[SAT] SAT PARSER - Browser ID tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - Browser ID tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if (src_data[index++] != SATK_BROWSER_ID_LENGTH) {
- dbg("[SAT] SAT PARSER - incorrect length value.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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 = 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;
+ 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;
}
*consumed_data_len = 3;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_url_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
+ TelSatUrlInfo* url, int* consumed_data_len)
{
unsigned char* src_data;
int index= curr_offset;
int len_of_len=0, url_len=0;
- 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;
- }
+ 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);
src_data = &tlv_str[0];
if (tlv_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if ((src_data[index++]&0x7F) != SATK_URL_TAG) {
- dbg("[SAT] SAT PARSER - Browser URL tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - Browser URL tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
url_len = src_data[index+len_of_len-1];
index+=len_of_len; //index pointing to url.
if (url_len > 0) {
- if (url_len > SAT_URL_LEN_MAX)
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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 {
- dbg("[SAT] SAT PARSER - NULL string for URL");
+ err("[SAT] SAT PARSER - NULL string for URL");
}
*consumed_data_len = 1+len_of_len+url_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_bearer_tlv(unsigned char* tlv_str, int tlv_len, int curr_offset,
+ TelSatBearerList* satk_bearer, int* consumed_data_len)
{
unsigned char* src_data;
int index, len_of_len = 0;
int list_len = 0, list_idx = 0;
- 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;
- }
+ 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_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
src_data = &tlv_str[0];
index = curr_offset;
if ((src_data[index++] & 0x7F) != SATK_BEARER_TAG) {
- dbg("[SAT] SAT PARSER - _sat_decode_bearer_tlv: alphaID TAG missing");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - _sat_decode_bearer_tlv: alphaID TAG missing");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
satk_bearer->count = src_data[index + len_of_len - 1];
index += len_of_len;
if ((index + list_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index + list_len), tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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 (satk_bearer->count > 0) {
- if (list_len > SAT_BEARER_LIST_MAX_COUNT)
- list_len = SAT_BEARER_LIST_MAX_COUNT;
+ if (list_len > TEL_SAT_BEARER_LIST_MAX_COUNT)
+ list_len = TEL_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] = 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;
+ 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;
}
dbg("[SAT] SAT PARSER - bearer[%d]=0x%x", list_idx, satk_bearer->bear[list_idx]);
index++;
}
} else {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - invalid bearer count");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
*consumed_data_len = 1 + len_of_len + list_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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)
+static TelSatResult _sat_decode_provisioning_file_ref_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, TelSatProvisioningFileRef* prf, int* data_len_consumed)
{
unsigned char* src_data;
int index = curr_offset;
int len_of_len = 0, prf_len = 0;
- 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;
- }
+ 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);
src_data = &tlv_str[0];
if (tlv_len <= (curr_offset + 1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d",tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d",tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if ((src_data[index++] & 0x7F) != SATK_PROVISIONING_REF_FILE_TAG) {
- dbg("[SAT] SAT PARSER - PRF tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - PRF tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
prf_len = src_data[index + len_of_len - 1];
index += len_of_len; //index pointing to prf.
if (prf_len > 0) {
- if (prf_len > SAT_PROVISIONING_FILE_PATH_LEN_MAX)
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
+ }
else
memcpy(prf->file_path, &src_data[index], prf_len);
} else {
- dbg("[SAT] SAT PARSER - NULL string for PRF");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - NULL string for PRF");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
*data_len_consumed = 1 + len_of_len + prf_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_bearer_description_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, TelSatBearerDescriptionInfo *bearer_desc_obj,
int* consumed_data_len)
{
int index, length=0;
unsigned char* src_data;
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;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
index = curr_offset;
if (index >= tlv_len) {
dbg("bearer desc cannot find. UICC Server mode");
*consumed_data_len = 0;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
if ( (src_data[index]&0x7F) == SATK_BEARER_DISCRIPTION_TAG ) {
//bearer parameter
switch(src_data[index++]) {
- case BEARER_CSD:
- bearer_desc_obj->bearer_type = 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 BEARER_GPRS:
- bearer_desc_obj->bearer_type = 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 = BIP_GPRS_PDP_TYPE_RESERVED;
- if (src_data[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;
+ 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;
}
*consumed_data_len = 1+1+length;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_channel_data_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, TelSatChannelDataInfo *channel_data_obj,
int* consumed_data_len)
{
int index = 0;
int len_of_len = 0, channel_data_len = 0;
unsigned char* src_data;
- 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;
- }
+ 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_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++]&0x7F) != SATK_CHANNEL_DATA_TAG) {
- dbg("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
channel_data_len = src_data[index+len_of_len-1];
index += len_of_len;
if ((index+channel_data_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+channel_data_len),tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
//data
memcpy(channel_data_obj->data_string, &src_data[index], channel_data_len);
*consumed_data_len = 1+len_of_len+channel_data_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_channel_data_length_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, unsigned char *data_len,
int* consumed_data_len)
{
int index;
unsigned char* src_data;
- 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;
- }
+ 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);
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++]&0x7F) != SATK_CHANNEL_DATA_LEN_TAG) {
- dbg("[SAT] SAT PARSER - channel data tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - channel data tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//length
if (src_data[index++] != SATK_CHANNEL_DATA_LENGTH_VALUE_LENGTH) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//data
- data_len_obj->data_len = src_data[index];
+ *data_len = (unsigned char)src_data[index];
*consumed_data_len = 3;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_buffer_size_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, unsigned char buffer_size[2],
int* consumed_data_len)
{
int index;
unsigned char* src_data;
- 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;
- }
+ 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_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;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++]&0x7F) != SATK_BUFFER_SIZE_TAG) {
- dbg("[SAT] SAT PARSER - buffer size tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - buffer size tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//length
if (src_data[index++] != SATK_BUFFER_SIZE_LENGTH) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
- buffer_size_obj->size[0] = src_data[index++];
- buffer_size_obj->size[1] = src_data[index];
+ buffer_size[0] = src_data[index++];
+ buffer_size[1] = src_data[index];
*consumed_data_len = 4;
- dbg("[SAT] SAT PARSER - buffer size = 0x%x%x", buffer_size_obj->size[0], buffer_size_obj->size[1]);
- return TCORE_SAT_SUCCESS;
+ dbg("[SAT] SAT PARSER - buffer size = 0x%x%x", buffer_size[0], buffer_size[1]);
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_other_address_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, TelSatOtherAddressInfo *other_address_obj,
int* consumed_data_len)
{
gchar* address = NULL;
int index, address_len;
unsigned char* src_data;
- 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;
- }
+ 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_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++]&0x7F) != SATK_OTHER_ADDRESS_TAG) {
- dbg("[SAT] SAT PARSER - other address tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - other address tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//length
address_len = src_data[index++];
if ((index+address_len) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+address_len),tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
- if (address_len-1 > SAT_OTHER_ADDR_LEN_MAX) {
- dbg("[SAT] SAT PARSER - address is longer than capability");
- return TCORE_SAT_BEYOND_ME_CAPABILITY;
+ 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;
}
//other address type
switch(src_data[index++]) {
- case ADDR_TYPE_IPv4:{
- other_address_obj->address_type = 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 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[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 = ADDR_RESERVED;
- address = g_strdup("");
- }break;
- }//end of switch
+ 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
//address
if (address) {
other_address_obj->address_len = strlen(address);
memcpy(other_address_obj->address, address, other_address_obj->address_len);
- g_free(address);
+ tcore_free(address);
dbg("destination address(%s)", other_address_obj->address);
}
*consumed_data_len = 2+address_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_uicc_terminal_interface_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, TelSatSimMeInterfaceTransportLevelInfo *level_obj,
int* consumed_data_len)
{
int index;
unsigned char* src_data;
- 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;
- }
+ 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_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;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[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
+ err("[SAT] SAT PARSER - UICC/TERMINAL Interface transport level tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//length
if (src_data[index++] != SATK_UICC_ME_TRANS_INTERFACE_LEVEL_LENGTH) {
- dbg("[SAT] SAT PARSER - incorrect length");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - incorrect length");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
level_obj->protocol_type = src_data[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 TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_remote_entity_address_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, TelSatRemoteEntityAddressInfo *remote_address_obj,
int* consumed_data_len)
{
int index = 0;
int len_of_len = 0, remote_data_len = 0;
unsigned char* src_data;
- 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;
- }
+ 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_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index]&0x7F) != SATK_REMOTE_ENTITY_ADDRESS_TAG) {
- dbg("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - tag not found.=%d",src_data[index]);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//length
len_of_len = _get_length_filed_size(src_data[index]);
if (!len_of_len) {
err("[SAT] parser: invalid length.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
remote_data_len = src_data[index+len_of_len-1];
//data
switch(src_data[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;
+ 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;
}
remote_address_obj->length = remote_data_len - 1;
memcpy(remote_address_obj->remote_entity_address, &src_data[index], remote_address_obj->length);
*consumed_data_len = 1+len_of_len+remote_data_len;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-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,
+static TelSatResult _sat_decode_network_access_name_tlv(unsigned char* tlv_str,
+ int tlv_len, int curr_offset, TelSatNetworkAccessNameInfo *access_name_obj,
int* consumed_data_len)
{
int index, idx, name_idx, name_length;
unsigned char* src_data;
- 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;
- }
+ 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_len <= (curr_offset+1)) {
- dbg("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ err("[SAT] SAT PARSER - incorrect length original_command_len=%d", tlv_len);
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
//tag
index = curr_offset;
src_data = &tlv_str[0];
if ((src_data[index++]&0x7F) != SATK_NETWORK_ACCESS_TAG) {
- dbg("[SAT] SAT PARSER - network access name tag missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //send TR
+ err("[SAT] SAT PARSER - network access name tag missing.");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD; //send TR
}
//length
name_length = src_data[index++];
if ((index+name_length) > tlv_len) {
- dbg("[SAT] SAT PARSER - incorrect cmd len, expected len = %d, orig_len=%d", (index+name_length),tlv_len);
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
access_name_obj->length = name_length;
- 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;
+ 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;
}
name_idx = 0;
dbg("network access name(%s)", access_name_obj->network_access_name);
*consumed_data_len = 2+name_length;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//decode proactive cmd
//6.4.1 DISPLAY TEXT
-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)
+static TelSatResult _sat_decode_display_text(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
/* ******decode command qualifier****** */
if (cmd_data[index] & 0x01) {
sat_cmd_ind_data->data.display_text.command_detail.cmd_qualifier.display_text.text_priority =
- TEXT_PRIORITY_HIGH;
+ TEL_SAT_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 =
- TEXT_PRIORITY_NORMAL;
+ TEL_SAT_TEXT_PRIORITY_NORMAL;
dbg("[SAT] SAT PARSER - : msg_prio=TAPI_SAT_MSG_PRIORITY_NORMAL.");
}
if (cmd_data[index] & 0x80) {
sat_cmd_ind_data->data.display_text.command_detail.cmd_qualifier.display_text.text_clear_type =
- TEXT_WAIT_FOR_USER_TO_CLEAR_MSG;
+ TEL_SAT_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 =
- TEXT_AUTO_CLEAR_MSG_AFTER_A_DELAY;
+ TEL_SAT_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);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.display_text.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding text tlv failed");
return rv;
+ }
if (sat_cmd_ind_data->data.display_text.text.string_length <= 0) {
err("[SAT] SAT PARSER - :string length is 0");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
dbg("[SAT] SAT PARSER text(%s)",sat_cmd_ind_data->data.display_text.text.string);
if (index+data_len_consumed > o_length) {
err("[SAT] SAT PARSER - Wrong String TLV");
- return TCORE_SAT_BEYOND_ME_CAPABILITY;
+ return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
}
else if (index+data_len_consumed == o_length) {
dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//icon identifier
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 (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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 (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
if (index >= o_length) {
dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding duration tlv failed");
return rv; //SEND TR
}
}
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.2 GET INKEY
-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)
+static TelSatResult _sat_decode_get_inkey(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
}
if (cmd_data[index]&0x02) {
- sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.alphabet_type = INPUT_ALPHABET_TYPE_UCS2;
+ sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.alphabet_type = TEL_SAT_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 = INPUT_ALPHABET_TYPE_SMS_DEFAULT;
+ sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.alphabet_type = TEL_SAT_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 = INKEY_TYPE_YES_NO_REQUESTED;
+ sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.inkey_type = TEL_SAT_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 = INKEY_TYPE_CHARACTER_SET_ENABLED;
+ sat_cmd_ind_data->data.get_inkey.command_detail.cmd_qualifier.get_inkey.inkey_type = TEL_SAT_INKEY_TYPE_CHARACTER_SET_ENABLED;
dbg("[SAT] SAT PARSER - INKEY_TYPE_YES_NO_REQUESTED");
}
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.get_inkey.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding text tlv failed");
return rv;
+ }
if (sat_cmd_ind_data->data.get_inkey.text.string_length <= 0) {
err("[SAT] SAT PARSER - :string length is 0");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
dbg("[SAT] SAT PARSER text(%s)",sat_cmd_ind_data->data.get_inkey.text.string);
if (index+data_len_consumed > o_length) {
err("[SAT] SAT PARSER - Wrong String TLV");
- return TCORE_SAT_BEYOND_ME_CAPABILITY;
+ return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
}
else if (index+data_len_consumed == o_length) {
dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//icon identifier
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);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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 (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding duration tlv failed");
return rv; //SEND TR
}
}
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.3 GET INPUT
-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)
+static TelSatResult _sat_decode_get_input(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
}
if (cmd_data[index]&0x02) {
- sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.alphabet_type = INPUT_ALPHABET_TYPE_UCS2;
+ sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.alphabet_type = TEL_SAT_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 = INPUT_ALPHABET_TYPE_SMS_DEFAULT;
+ sat_cmd_ind_data->data.get_input.command_detail.cmd_qualifier.get_input.alphabet_type = TEL_SAT_INPUT_ALPHABET_TYPE_SMS_DEFAULT;
dbg("[SAT] SAT PARSER - INPUT_ALPHABET_TYPE_SMS_DEFAULT");
}
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.get_input.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
//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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding text tlv failed");
return rv;
+ }
if (sat_cmd_ind_data->data.get_input.text.string_length <= 0) {
err("[SAT] SAT PARSER - :string length is 0");
//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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding response_length failed");
return rv;
+ }
if (index+data_len_consumed >= o_length) {
err("[SAT] SAT PARSER - no more TLVs");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding text tlv failed");
return rv;
+ }
if (sat_cmd_ind_data->data.get_input.default_text.string_length <= 0) {
err("[SAT] SAT PARSER - :string length is 0");
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 (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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 (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
}
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.4 MORE TIME
-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)
+static TelSatResult _sat_decode_more_time(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_event_list.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
index+=4;
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.5 PLAY TONE
-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)
+static TelSatResult _sat_decode_play_tone(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
/* ******decode command qualifier****** */
if (cmd_data[index] & 0x01)
- sat_cmd_ind_data->data.play_tone.command_detail.cmd_qualifier.play_tone.vibration_alert = VIBRATE_ALERT_REQUIRED;
+ sat_cmd_ind_data->data.play_tone.command_detail.cmd_qualifier.play_tone = TEL_SAT_VIBRATE_ALERT_REQUIRED;
else
- sat_cmd_ind_data->data.play_tone.command_detail.cmd_qualifier.play_tone.vibration_alert = VIBRATE_ALERT_OPTIONAL;
+ sat_cmd_ind_data->data.play_tone.command_detail.cmd_qualifier.play_tone = TEL_SAT_VIBRATE_ALERT_OPTIONAL;
//device identifier
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.play_tone.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
if (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.tone_type = GENERAL_BEEP;
- sat_cmd_ind_data->data.play_tone.duration.time_unit = TIME_UNIT_SECONDS;
+ 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.duration.time_interval = 2;
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding tone tlv failed");
return rv;
}
index+=data_len_consumed;
}
else{
- sat_cmd_ind_data->data.play_tone.tone.tone_type = GENERAL_BEEP;
+ sat_cmd_ind_data->data.play_tone.tone = TEL_SAT_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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding duration failed");
return rv; //SEND TR
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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 = TIME_UNIT_SECONDS;
+ sat_cmd_ind_data->data.play_tone.duration.time_unit = TEL_SAT_TIME_UNIT_SECONDS;
sat_cmd_ind_data->data.play_tone.duration.time_interval = 2;
}
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);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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 (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
//ToDo: Text Attribute and frames
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.7 REFRESH
-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)
+static TelSatResult _sat_decode_refresh(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
/* ******decode command qualifier****** */
switch(cmd_data[index]) {
- case REFRESH_SIM_INIT_AND_FULL_FCN:
- case REFRESH_FCN:
- case REFRESH_SIM_INIT_AND_FCN:
- case REFRESH_SIM_INIT :
- case REFRESH_SIM_RESET:
- sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh.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 REFRESH_3G_APPLICATION_RESET:
- case REFRESH_3G_SESSION_RESET:
- case REFRESH_RESERVED:
- default:
- dbg("[SAT] SAT PARSER - : refresh mode=0x%02x Not Supported", cmd_data[index]);
- return TCORE_SAT_BEYOND_ME_CAPABILITY;
- break;
+ 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;
}
//device identifier
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.refresh.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
//check file list
index+=4;
- if ( (sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh.refresh == REFRESH_FCN)
- || (sat_cmd_ind_data->data.refresh.command_detail.cmd_qualifier.refresh.refresh == REFRESH_SIM_INIT_AND_FCN) ) {
+ 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) ) {
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding file_list failed");
return rv;
+ }
}
else
sat_cmd_ind_data->data.refresh.file_list.file_count = 0;
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.8 SETUP MENU
-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)
+static TelSatResult _sat_decode_setup_menu(unsigned char* tlv_str, int tlv_len,
+ int curr_offset, TelSatDecodedProactiveData *pactive_cmd_ind_obj)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* src_data;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
//access command detail
index = curr_offset+2; //move the index to command detail info +2(tag and length)
//[2-1] selection preference
if (src_data[index] & 0x01) {
pactive_cmd_ind_obj->data.setup_menu.command_detail.cmd_qualifier.setup_menu.select_preference =
- SELECTION_PREFERENCE_USING_SOFT_KEY;
+ TEL_SAT_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 =
- SELECTION_PREFERENCE_NONE_REQUESTED;
+ TEL_SAT_SELECTION_PREFERENCE_NONE_REQUESTED;
dbg("[SAT] SAT PARSER - : sel_pref=SAT_SELECTION_PREFERENCE_NONE_REQUESTED.");
}
index++;
memcpy(dev_id, &src_data[index], 4);
rv = _sat_decode_device_identities_tlv(dev_id, &pactive_cmd_ind_obj->data.setup_menu.device_id);
- if (rv != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
//send TR in SatkProcessProactiveCmdInd()
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
}
dbg("[SAT] SAT PARSER - :index=%d",index);
rv = _sat_decode_alpha_identifier_tlv(src_data, tlv_len, index,
&pactive_cmd_ind_obj->data.setup_menu.alpha_id, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
&pactive_cmd_ind_obj->data.setup_menu.menu_item[pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt],
&data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding item failed");
return rv;
+ }
}
else {
if (pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt == 0) {
- dbg("menu item is not exist.");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ err("menu item is not exist.");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
//else
break; //???
if (index >= tlv_len)
break;
- }while(pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt < SAT_MENU_ITEM_COUNT_MAX);
+ }while(pactive_cmd_ind_obj->data.setup_menu.menu_item_cnt < TEL_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) {
dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
//send TR in SatkProcessProactiveCmdInd()
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//[6] (optional TLV) decode ITEMS NEXT ACTION INDICATOR TLV
data_len_consumed = 0;
rv = _sat_decode_item_next_action_indicator_tlv(tlv_str, tlv_len, index,
&pactive_cmd_ind_obj->data.setup_menu.next_act_ind_list, &data_len_consumed);
- if (rv!=TCORE_SAT_SUCCESS) return rv;
+ if (rv!=TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding item_next_action_indicator failed");
+ return rv;
+ }
if (index+data_len_consumed >= tlv_len) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
//send the data to Noti manager.
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
data_len_consumed = 0;
rv = _sat_decode_icon_identifier_tlv(tlv_str, tlv_len, index,
&pactive_cmd_ind_obj->data.setup_menu.icon_id, &data_len_consumed);
- if (rv !=TCORE_SAT_SUCCESS) return rv;
+ if (rv !=TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding icon_identifier failed");
+ return rv;
+ }
if (index+data_len_consumed >= tlv_len) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
//send the data to Noti manager.
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
data_len_consumed = 0;
rv = _sat_decode_icon_identifier_list_tlv(tlv_str, tlv_len, index,
&pactive_cmd_ind_obj->data.setup_menu.icon_list, &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_list failed");
+ return rv; //SEND TR
+ }
if (index+data_len_consumed >= tlv_len) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
//send the data to Noti manager.
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
//ToDo: Text Attribute, Text Attribute list. refer ETSI 102.223.
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.9 SELECT ITEM
-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)
+static TelSatResult _sat_decode_select_item(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
/* ******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 = PRESENTATION_TYPE_NAVIGATION_OPTION;
+ sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = TEL_SAT_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 = PRESENTATION_TYPE_DATA_VALUE;
+ sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = TEL_SAT_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 = PRESENTATION_TYPE_NOT_SPECIFIED;
+ sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.presentation_type = TEL_SAT_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 = SELECTION_PREFERENCE_USING_SOFT_KEY;
+ sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.select_preference = TEL_SAT_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 = SELECTION_PREFERENCE_NONE_REQUESTED;
+ sat_cmd_ind_data->data.select_item.command_detail.cmd_qualifier.select_item.select_preference = TEL_SAT_SELECTION_PREFERENCE_NONE_REQUESTED;
dbg("[SAT] SAT PARSER - SELECTION_PREFERENCE_NONE_REQUESTED");
}
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.select_item.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
index+=data_len_consumed;
&sat_cmd_ind_data->data.select_item.menu_item[sat_cmd_ind_data->data.select_item.menu_item_cnt],
&data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding item failed");
return rv;
+ }
}
else {
if (sat_cmd_ind_data->data.select_item.menu_item_cnt == 0) {
- dbg("menu item is not exist.");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ err("menu item is not exist.");
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
//else
break; //???
if (index >= o_length)
break;
- }while(sat_cmd_ind_data->data.select_item.menu_item_cnt < SAT_MENU_ITEM_COUNT_MAX);
+ }while(sat_cmd_ind_data->data.select_item.menu_item_cnt < TEL_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) {
dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//item next action indicator
data_len_consumed = 0;
rv = _sat_decode_item_next_action_indicator_tlv(o_cmd_data, o_length, index,
&sat_cmd_ind_data->data.select_item.item_next_act_ind_list, &data_len_consumed);
- if (rv!=TCORE_SAT_SUCCESS)
+ if (rv!=TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding item_next_action_indicator failed");
return rv;
+ }
if (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed;
data_len_consumed = 0;
rv = _sat_decode_item_identifier_tlv(o_cmd_data, o_length, index,
&sat_cmd_ind_data->data.select_item.item_identifier, &data_len_consumed);
- if (rv !=TCORE_SAT_SUCCESS)
+ if (rv !=TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding item_identifier failed");
return rv;
+ }
if (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index,
&sat_cmd_ind_data->data.select_item.icon_id, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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 (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
data_len_consumed = 0;
rv = _sat_decode_icon_identifier_list_tlv(o_cmd_data, o_length, index,
&sat_cmd_ind_data->data.select_item.icon_list, &data_len_consumed);
- if (rv !=TCORE_SAT_SUCCESS)
+ if (rv !=TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding icon_identifier_list failed");
return rv; //SEND TR
+ }
if (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
}
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.10 SEND SMS
-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)
+static TelSatResult _sat_decode_send_sms(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
/* ******decode command qualifier****** */
if (cmd_data[index] & 0x01) {
- sat_cmd_ind_data->data.send_sms.command_detail.cmd_qualifier.send_sms.packing_by_me_required = TRUE;
+ sat_cmd_ind_data->data.send_sms.command_detail.cmd_qualifier.cmd_quali_send_sms = TRUE;
}
else {
- sat_cmd_ind_data->data.send_sms.command_detail.cmd_qualifier.send_sms.packing_by_me_required = FALSE;
+ sat_cmd_ind_data->data.send_sms.command_detail.cmd_qualifier.cmd_quali_send_sms = FALSE;
dbg("[SAT] SAT PARSER - packing by me required is false");
}
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_sms.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
//alpha identifier
index+=4;
if ((cmd_data[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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
index+=data_len_consumed;
if ((cmd_data[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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding address failed");
return rv;
}
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding sms_tpdu failed");
return rv;
+ }
if (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//icon identifier
rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index,
&sat_cmd_ind_data->data.select_item.icon_id, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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 (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
}
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.11 SEND SS
-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)
+static TelSatResult _sat_decode_send_ss(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL || sat_cmd_ind_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
//device identities
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_ss.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding ss_string failed");
return rv;
+ }
//icon identifier- optional
index+=data_len_consumed;
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 != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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
}
}
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.12 SEND USSD
-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)
+static TelSatResult _sat_decode_send_ussd(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL || sat_cmd_ind_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
//device identities
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_ussd.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding ussd_string failed");
return rv;
+ }
//icon identifier- optional
index+=data_len_consumed;
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 != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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
}
}
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.13 SETUP CALL
-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)
+static TelSatResult _sat_decode_setup_call(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL || sat_cmd_ind_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ 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);
//command detail
cmd_data = &o_cmd_data[0];
/* ******decode command qualifier****** */
switch(cmd_data[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[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[index]);
- return TCORE_SAT_BEYOND_ME_CAPABILITY;
- break;
+ 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;
}
//device identifier
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_call.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding address failed");
return rv;
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding ccp failed");
return rv; //SEND TR
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding sub_address failed");
return rv; //SEND TR
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding duration failed");
return rv; //SEND TR
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
}
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);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
}
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);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
}
//ToDo: Text Attribute (user_confirmation , call_setup)
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.15 PROVIDE LOCAL INFO
-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)
+static TelSatResult _sat_decode_provide_local_info(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
/* ******decode command qualifier****** */
switch(cmd_data[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[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;
+ 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;
}
//device identifier
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_event_list.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
//TODO - UTRAN Measurement Qualifier
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.16 SETUP EVENT LIST
-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)
+static TelSatResult _sat_decode_setup_event_list(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_event_list.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
//event list
index+=4;
&sat_cmd_ind_data->data.setup_event_list.event_list, &data_len_consumed);
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.22 SETUP IDLE MODE TEXT
-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)
+static TelSatResult _sat_decode_setup_idle_mode_text(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.setup_idle_mode_text.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding text failed");
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 TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
dbg("[SAT] SAT PARSER text(%s)",sat_cmd_ind_data->data.setup_idle_mode_text.text.string);
if (index+data_len_consumed > o_length) {
err("[SAT] SAT PARSER - Wrong String TLV");
- return TCORE_SAT_BEYOND_ME_CAPABILITY;
+ return TEL_SAT_RESULT_BEYOND_ME_CAPABILITY;
}
else if (index+data_len_consumed == o_length) {
dbg("[SAT] SAT PARSER - :no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//icon identifier
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);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD; //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 (index+data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
//ToDo: Text Attribute
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.24 SEND DTMF
-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)
+static TelSatResult _sat_decode_send_dtmf(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_dtmf.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
index+=data_len_consumed;
if ((cmd_data[index] & 0x7F) == SATK_DTMF_STRING_TAG) {
rv = _sat_decode_dtmf_string_tlv(o_cmd_data, o_length, index,
&sat_cmd_ind_data->data.send_dtmf.dtmf_string, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding dtmf_string failed");
return rv;
}
if (index + data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index += data_len_consumed;
} else {
dbg("[SAT] SAT PARSER - DTMF tlv is missed.");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ return TEL_SAT_RESULT_REQUIRED_VALUE_MISSING;
}
//icon identifier - optional
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);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding icon_identifier failed");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if (index + data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index += data_len_consumed; //index pointing to the Tag of next TLV
}
//ToDo: Text Attribute, Frame Identifier
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.25 LANGUAGE NOTIFICATION
-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)
+static TelSatResult _sat_decode_language_notification(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
/* ******decode command qualifier****** */
if (cmd_data[index]&0x01)
- sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.language_notification.specific_language = TRUE;
+ sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.cmd_quali_language_notification = TRUE;
else
- sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.language_notification.specific_language = FALSE;
+ sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.cmd_quali_language_notification = FALSE;
//device identifier
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.language_notification.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
//language - conditional
index+=4;
- if (sat_cmd_ind_data->data.language_notification.command_detail.cmd_qualifier.language_notification.specific_language == TRUE) {
+ 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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding language failed");
return rv;
+ }
} else {
dbg("[SAT] SAT PARSER - Language TLV is required but missing.");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
} else {
- sat_cmd_ind_data->data.language_notification.language = SIM_LANG_UNSPECIFIED;
+ sat_cmd_ind_data->data.language_notification.language = TEL_SAT_LP_LANG_UNSPECIFIED;
dbg("[SAT] SAT PARSER - non-specific language");
}
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.26 LAUNCH BROWSER
-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)
+static TelSatResult _sat_decode_launch_browser(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0, data_len_consumed = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//command detail
cmd_data = &o_cmd_data[0];
// decode command qualifier
switch (cmd_data[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;
+ 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;
}
//device identifier
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.language_notification.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
return rv;
+ }
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding browser_identity failed");
return rv;
+ }
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding url failed");
return rv;
+ }
if (index + data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - No more TLVs to decode, decoding done.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
} else {
dbg("[SAT] SAT PARSER - more TLVs to decode, decoding continue.");
index += data_len_consumed;
}
} else {
dbg("[SAT] SAT PARSER - Browser URL NOT present! BUG! this value is mandatory!!!");
- return TCORE_SAT_REQUIRED_VALUE_MISSING;
+ return TEL_SAT_RESULT_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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS)
return rv;
if (index + data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - No more TLVs to decode, decoding done.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
} else {
index += data_len_consumed;
}
} else {
- dbg("[SAT] SAT PARSER - Bearer TLV Not present.");
+ err("[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 >= SAT_PROVISIONING_REF_MAX_COUNT) {
- dbg("[SAT] SAT PARSER - More number of PRF entries than can be handled");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ 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;
}
rv = _sat_decode_provisioning_file_ref_tlv(
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding provisioning_file_ref failed");
return rv;
} else {
sat_cmd_ind_data->data.launch_browser.file_ref_count++;
if (index + data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - No more TLVs to decode, decoding done.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
} else {
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 != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding text failed");
return rv;
+ }
if (index + data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - No more TLVs to decode, decoding done.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
} else {
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
if (index + data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - No more TLVs to decode, decoding done.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index+=data_len_consumed;
} else {
rv = _sat_decode_icon_identifier_tlv(o_cmd_data, o_length, index,
&sat_cmd_ind_data->data.launch_browser.user_confirm_icon_id, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding icon_identifier failed");
+ return TEL_SAT_RESULT_COMMAND_NOT_UNDERSTOOD;
}
if (index + data_len_consumed >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
index += data_len_consumed; //index pointing to the Tag of next TLV
}
//ToDo: Text Attribute, Frame Identifier
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.27 OPEN CHANNEL
-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)
+static TelSatResult _sat_decode_open_channel(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
- gboolean b_1st_duration = FALSE;
+ gboolean is_first_duration = FALSE;
int bearer_desc_len =0, data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.open_channel.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS){
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
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.open_channel.icon_id, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding icon_identifier failed");
return rv; //SEND TR
}
index+=data_len_consumed; //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);
bearer_desc_len = data_len_consumed;
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding bearer_description failed");
return rv;
+ }
//TODO UICC SERVER MODE
switch(sat_cmd_ind_data->data.open_channel.bearer_desc.bearer_type) {
- case BEARER_CSD:
+ 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;
- //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 != TCORE_SAT_SUCCESS) {
+ //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");
return rv;
}
index+=data_len_consumed;
+ }
- //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 != 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
}
+ index+=data_len_consumed;
+ is_first_duration = TRUE;
+ }
- //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 != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
- index+=data_len_consumed;
- b_1st_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 2- 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.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;
+ }
- if (!b_1st_duration) {
- dbg("duration 1 does not present!");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
- }
+ //bearer description - already did it
+ index+=bearer_desc_len;
- 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 != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
- index+=data_len_consumed;
- }
+ //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
+ }
- //bearer description - already did it
- index+=bearer_desc_len;
+ index+=data_len_consumed;
+ if (index >= o_length) {
+ dbg("[SAT] SAT PARSER - no more TLVs to decode.");
+ return TEL_SAT_RESULT_SUCCESS;
+ }
- //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 != 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.cs_bearer.other_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 TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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.cs_bearer.other_address, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
+ //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;
+ }
- index+=data_len_consumed;
- if (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[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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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 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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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[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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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;
}
- //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 != 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;
+ }
+ }
- index+=data_len_consumed;
- if (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");
+ return rv; //SEND TR
}
- break;
- case BEARER_GPRS:
- //bearer description - already did it
- index+=bearer_desc_len;
+ 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_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
+ }
- //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 != 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;
+ }
+
+ //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
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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 != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
+ //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
+ }
- index+=data_len_consumed;
- if (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;
}
+ }
- //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 != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
+ //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;
+ }
- index+=data_len_consumed;
- if (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[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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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.ps_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 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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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[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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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;
}
- dbg("the value (0x%x) after interface transport level", cmd_data[index]&0x7F);
+ 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 != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
+ dbg("the value (0x%x) after interface transport level", cmd_data[index]&0x7F);
- index+=data_len_consumed;
- if (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");
+ return rv; //SEND TR
}
- break;
- case BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER:
- //bearer description - already did it
- index+=bearer_desc_len;
+ 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_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
+ }
- //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 != 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;
+ }
+
+ //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");
return rv; //SEND TR
}
index+=data_len_consumed;
if (index >= o_length) {
dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_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.default_bearer.other_address, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
+ //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;
+ }
- index+=data_len_consumed;
- if (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[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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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.default_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 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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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[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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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;
}
- //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 != 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;
+ }
+ }
- index+=data_len_consumed;
- if (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");
+ return rv; //SEND TR
}
- break;
- case 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 != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
- index+=data_len_consumed;
- b_1st_duration = TRUE;
+ 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) {
+ //time duration 2- optional
+ if ((cmd_data[index]&0x7F)==SATK_DURATION_TAG) {
- if (!b_1st_duration) {
- dbg("duration 1 does not present!");
- return TCORE_SAT_COMMAND_NOT_UNDERSTOOD;
- }
+ 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 != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
- }
- index+=data_len_consumed;
+ 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;
+ //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 != TCORE_SAT_SUCCESS) {
- return rv; //SEND TR
+ //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 TCORE_SAT_SUCCESS;
+ 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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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[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 != TCORE_SAT_SUCCESS)
- return rv;
-
- index+=data_len_consumed;
- if (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[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 != 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 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");
+ 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 != 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;
+ }
+ }
- index+=data_len_consumed;
- if (index >= o_length) {
- dbg("[SAT] SAT PARSER - no more TLVs to decode.");
- return TCORE_SAT_SUCCESS;
- }
+ //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
}
- break;
- default:
- break;
+ 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);
}//end of switch
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.28 CLOSE CHANNEL
-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)
+static TelSatResult _sat_decode_close_channel(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
//device identities
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.close_channel.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
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.close_channel.icon_id, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding icon_identifier failed");
return rv; //SEND TR
}
index+=data_len_consumed; //index pointing to the Tag of next TLV
//ToDo: Text Attribute and frames
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.29 RECEIVE 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)
+static TelSatResult _sat_decode_receive_data(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
//device identities
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.receive_data.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
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.receive_data.icon_id, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding icon_identifier failed");
return rv; //SEND TR
}
index+=data_len_consumed; //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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding channel_data_length failed");
return rv; //SEND TR
}
//ToDo: Text Attribute and frames
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.30 SEND 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)
+static TelSatResult _sat_decode_send_data(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
int data_len_consumed=0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
sat_cmd_ind_data->data.send_data.command_detail.cmd_type = cmd_data[index++];
/** command detail **/
- sat_cmd_ind_data->data.send_data.command_detail.cmd_qualifier.send_data.send_data_immediately = FALSE;
+ 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.send_data.send_data_immediately = TRUE;
+ sat_cmd_ind_data->data.send_data.command_detail.cmd_qualifier.cmd_quali_send_data = TRUE;
dbg("[SAT] SAT PARSER - Send data immediately");
}
index++;
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.send_data.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device_identities failed");
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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding alpha_identifier failed");
return rv;
}
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.send_data.icon_id, &data_len_consumed);
- if (rv != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding icon_identifier failed");
return rv; //SEND TR
}
index+=data_len_consumed; //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 != TCORE_SAT_SUCCESS) {
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding channel_data failed");
return rv; //SEND TR
}
//ToDo: Text Attribute and frames
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
//6.4.31 GET CHANNEL STATUS
-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)
+static TelSatResult _sat_decode_get_channel_status(unsigned char* o_cmd_data, int o_length,
+ int curr_offset, TelSatDecodedProactiveData *sat_cmd_ind_data)
{
int index = 0;
unsigned char dev_id[4];
unsigned char* cmd_data = NULL;
- enum tcore_sat_result rv = TCORE_SAT_SUCCESS;
+ TelSatResult rv = TEL_SAT_RESULT_SUCCESS;
- if (o_cmd_data == NULL) {
- dbg("[SAT] SAT PARSER - o_cmd_data == NULL");
- return TCORE_SAT_ERROR_FATAL;
- }
+ tcore_check_return_value_assert(o_cmd_data != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
cmd_data = &o_cmd_data[0];
index = curr_offset+2;
//device identities
memcpy(dev_id,&cmd_data[index],4);
rv = _sat_decode_device_identities_tlv(dev_id, &sat_cmd_ind_data->data.get_channel_status.device_id);
- if (rv != TCORE_SAT_SUCCESS)
+ if (rv != TEL_SAT_RESULT_SUCCESS) {
+ err("[SAT] SAT PARSER - decoding device identities failed");
return rv;
+ }
dbg("[SAT] SAT PARSER - :decoding done!.");
- return TCORE_SAT_SUCCESS;
+ return TEL_SAT_RESULT_SUCCESS;
}
-int tcore_sat_decode_proactive_command(unsigned char* tlv_origin, unsigned int tlv_length,
- struct tcore_sat_proactive_command* decoded_tlv)
+gboolean tcore_sat_decode_proactive_command(unsigned char* tlv_origin, unsigned int tlv_length,
+ TelSatDecodedProactiveData* decoded_tlv, int* decode_err_code)
{
unsigned int index = 0;
int length_field_len = 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;
+ err("[SAT] SAT PARSER - pointer pData passed is NULL or invalid length.");
+ *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
+ return FALSE;
}
+ tcore_check_return_value_assert(decoded_tlv != NULL, TEL_SAT_RESULT_INVALID_PARAMETER);
//tag
if (tlv_origin[index++]!= SATK_PROACTIVE_CMD_TAG) {
- dbg("[SAT] SAT PARSER - Did not find Proactive command tag.tag=%d", tlv_origin[index-1]);
- return TCORE_SAT_ERROR_FATAL;
+ 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;
}
//length
length_field_len = _get_length_filed_size(tlv_origin[index]);
if (length_field_len == 0) {
- dbg("[SAT] SAT PARSER - Invalid length.");
- return TCORE_SAT_ERROR_FATAL;
+ err("[SAT] SAT PARSER - Invalid length.");
+ *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
+ return FALSE;
}
index+=length_field_len;
//check command validation
- if (tlv_length < index+5+4)//command detail(5) and device identities(4)
- return TCORE_SAT_ERROR_FATAL;
+ 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;
+ }
//check comprehensive value
if ((tlv_origin[index] | 0x7F) != 0x7F) {
dbg("comprehensive value 0x%x", tlv_origin[index] | 0x7F);
- b_comprehensive = TRUE;
+ is_comprehensive = TRUE;
}
if ( (tlv_origin[index] & 0x7F) != SATK_COMMAND_DETAILS_TAG) {
err("[SAT] no command detail info");
- return TCORE_SAT_ERROR_FATAL;
+ *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
+ return FALSE;
}
if ( tlv_origin[index+1] != SATK_COMMAND_DETAILS_LENGTH) {
err("[SAT] invalid command detail length");
- return TCORE_SAT_ERROR_FATAL;
+ *decode_err_code = TEL_SAT_RESULT_INVALID_PARAMETER;
+ return FALSE;
}
decoded_tlv->cmd_num= tlv_origin[index+2];
decoded_tlv->cmd_type = tlv_origin[index+3];
switch(decoded_tlv->cmd_type) {
- 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, index, decoded_tlv);
- break;
- default:
- dbg("[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.
- rv = TCORE_SAT_BEYOND_ME_CAPABILITY;
- break;
+ 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.
dbg("[SAT] SAT PARSER - each command parsing done.");
- return rv;
+ return TRUE;
}
-static unsigned char _sat_encode_dcs_tlv(const struct data_coding_scheme* src)
+static unsigned char _sat_encode_dcs_tlv(const TelSatDataCodingSchemeInfo* src)
{
unsigned char rv = 0x00;
- if (src == NULL)
- return 0;
+ tcore_check_return_value_assert(src != NULL, 0);
if (src->is_compressed_format)
rv |= 0x20;
//msg class
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;
+ 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;
}
//alphabet format
- 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;
+ 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;
}
return rv;
}
-static int _sat_encode_command_detail_tlv(const struct tel_sat_cmd_detail_info* src, char *dst, int current_index)
+static int _sat_encode_command_detail_tlv(const TelSatCmdDetailInfo* src, char *dst, int current_index)
{
- dst[current_index++] = (b_comprehensive ? (SATK_COMMAND_DETAILS_TAG | 0x80) : SATK_COMMAND_DETAILS_TAG);
+ 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 SAT_PROATV_CMD_DISPLAY_TEXT:{
- //command detail text priority
- if (src->cmd_qualifier.display_text.text_priority == TEXT_PRIORITY_HIGH)
- dst[current_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_index] += 0x80;
- }break;
- case 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 == INPUT_ALPHABET_TYPE_UCS2)
- dst[current_index] += 0x02;
-
- //command detail get inkey type
- if (src->cmd_qualifier.get_inkey.inkey_type == 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 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 == 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 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_index] += 0x01;
- }break;
- case SAT_PROATV_CMD_REFRESH:{
- //command detail refresh command
- dst[current_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_index] += 0x01;
-
- //command detail help available
- if (src->cmd_qualifier.setup_menu.help_info)
- dst[current_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_index] += 0x01;
- if (src->cmd_qualifier.select_item.presentation_type == PRESENTATION_TYPE_NAVIGATION_OPTION) {
- dst[current_index] += PRESENTATION_TYPE_NAVIGATION_OPTION;
- }
+ 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;
}
+ }
- //command detail selection preference
- if (src->cmd_qualifier.select_item.select_preference == 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 SAT_PROATV_CMD_SEND_SMS:{
- //command detail sms packing by me required
- if (src->cmd_qualifier.send_sms.packing_by_me_required)
- dst[current_index] += 0x01;
- }break;
- case SAT_PROATV_CMD_SETUP_CALL:{
- //command detail setup call command;
- dst[current_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_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 SAT_PROATV_CMD_SEND_DATA:{
- if (src->cmd_qualifier.send_data.send_data_immediately)
- dst[current_index] += 0x01;
- }break;
- case SAT_PROATV_CMD_PROVIDE_LOCAL_INFO:{
- dst[current_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_index] += 0x01;
- }break;
- case SAT_PROATV_CMD_LAUNCH_BROWSER:{
- dst[current_index] += src->cmd_qualifier.launch_browser.launch_browser;
- }break;
- default:
- err("no matched cmd type(%d)", src->cmd_type);
- break;
+ //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);
}
return 5;
}
-static int _sat_encode_device_identities_tlv(const struct tel_sat_device_identities* src, char *dst, int current_index)
+static int _sat_encode_device_identities_tlv(const TelSatDeviceIdentitiesInfo* src, char *dst, int current_index)
{
- dst[current_index++] = (b_comprehensive ? (SATK_DEVICE_IDENTITY_TAG | 0x80) : SATK_DEVICE_IDENTITY_TAG);
+ 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;
return 4;
}
-static int _sat_encode_item_identifier_tlv(const struct tel_sat_item_identifier* src, char *dst, int current_index)
+static int _sat_encode_item_identifier_tlv(const unsigned char src, char *dst, int current_index)
{
dst[current_index++] =SATK_ITEM_IDENTIFIER_TAG;
dst[current_index++] =SATK_ITEM_IDENTIFIER_LENGTH;
- dst[current_index++] = src->item_identifier;
+ dst[current_index++] = src;
//item identifier total len 3
return 3;
}
-/*static int _sat_encode_duration_tlv(const struct tel_sat_duration* src, char *dst, int current_index)
+/*static int _sat_encode_duration_tlv(const TelSatDurationInfo* src, char *dst, int current_index)
{
dst[current_index++] =SATK_DURATION_TAG;
dst[current_index++] =SATK_DURATION_LENGTH;
return 4;
}*/
-static int _sat_encode_text_tlv(const struct tel_sat_text_string_object* src, char *dst, int current_index, gboolean raw_dcs)
+static int _sat_encode_text_tlv(const TelSatTextTypeInfo* src, char *dst, int current_index, gboolean raw_dcs)
{
int total_len = 0;
int length_index = 0;
return total_len;
}
-static int _sat_encode_eventlist_tlv(const enum event_list src, char *dst, int current_index)
+static int _sat_encode_eventlist_tlv(const TelSatEventListType src, char *dst, int current_index)
{
dst[current_index++] =SATK_EVENT_LIST_TAG;
dst[current_index++] =0x01;
return 3;
}
-static int _sat_encode_date_time_and_timezone_tlv(const struct tel_sat_date_time_and_timezone *src, char *dst, int current_index)
+static int _sat_encode_date_time_and_timezone_tlv(const TelSatDateTimeZoneInfo *src, char *dst, int current_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->hour;
dst[current_index++] = src->minute;
dst[current_index++] = src->second;
- dst[current_index++] = src->timeZone;
+ dst[current_index++] = src->time_zone;
return 1+1+SATK_DATE_TIME_AND_TIME_ZONE_LENGTH; //tag length+len field length+value length;
}
-static int _sat_encode_language_tlv(const enum tel_sim_language_type src, char *dst, int current_index)
+static int _sat_encode_language_tlv(const TelSatLanguageInfo src, char *dst, int current_index)
{
dst[current_index++] =SATK_LANGUAGE_TAG;
dst[current_index++] =SATK_LANGUAGE_LENGTH;
dbg("language (%d)", src);
switch(src) {
-
- case SIM_LANG_GERMAN :
- dst[current_index++] = 'd';
- dst[current_index++] = 'e';
- break;
-
- case SIM_LANG_ENGLISH :
- dst[current_index++] = 'e';
- dst[current_index++] = 'n';
- break;
-
- case SIM_LANG_ITALIAN :
- dst[current_index++] = 'i';
- dst[current_index++] = 't';
- break;
-
- case SIM_LANG_FRENCH :
- dst[current_index++] = 'f';
- dst[current_index++] = 'r';
- break;
-
- case SIM_LANG_SPANISH :
- dst[current_index++] = 'e';
- dst[current_index++] = 's';
- break;
-
- case SIM_LANG_DUTCH :
- dst[current_index++] = 'n';
- dst[current_index++] = 'l';
- break;
-
- case SIM_LANG_SWEDISH :
- dst[current_index++] = 's';
- dst[current_index++] = 'v';
- break;
-
- case SIM_LANG_DANISH :
- dst[current_index++] = 'd';
- dst[current_index++] = 'a';
- break;
-
- case SIM_LANG_PORTUGUESE :
- dst[current_index++] = 'p';
- dst[current_index++] = 't';
- break;
-
- case SIM_LANG_FINNISH :
- dst[current_index++] = 'f';
- dst[current_index++] = 'i';
- break;
-
- case SIM_LANG_NORWEGIAN :
- dst[current_index++] = 'n';
- dst[current_index++] = 'b';
- break;
-
- case SIM_LANG_GREEK :
- dst[current_index++] = 'e';
- dst[current_index++] = 'l';
- break;
-
- case SIM_LANG_TURKISH :
- dst[current_index++] = 't';
- dst[current_index++] = 'k';
- break;
-
- case SIM_LANG_HUNGARIAN :
- dst[current_index++] = 'h';
- dst[current_index++] = 'u';
- break;
-
- case SIM_LANG_POLISH :
- dst[current_index++] = 'p';
- dst[current_index++] = 'l';
- break;
-
- default:{
- dst[current_index++] = 'e';
- dst[current_index++] = 'n';
- dbg("[SAT] SAT PARSER - Unknown Language: 0x%x",src);
- break;
- }
+ 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);
}
return 4;
}
-static int _sat_encode_browser_termination_tlv(const enum browser_termination_cause src, char *dst, int current_index)
+static int _sat_encode_browser_termination_tlv(const TelSatBrowserTerminationCauseType src, char *dst, int current_index)
{
dst[current_index++] =SATK_BROWSER_TERMINATION_CAUSE_TAG;
dst[current_index++] =SATK_BROWSER_TERMINATION_CAUSE_LENGTH;
return 3;
}
-static int _sat_encode_bearer_desc_tlv(const struct tel_sat_bearer_description* src, char *dst, int current_index)
+static int _sat_encode_bearer_desc_tlv(const TelSatBearerDescriptionInfo* src, char *dst, int current_index)
{
int total_len = 0;
int length_index = 0;
dst[current_index++] = src->bearer_type;
switch(src->bearer_type) {
- case 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 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 BEARER_DEFAULT_BEARER_FROM_TRANSPORT_LAYER:
- case BEARER_LOCAL_LINK_TECHNOLOGY_INDEPENDENT:
- default:
- break;
+ 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;
return total_len;
}
-static int _sat_encode_buffer_size_tlv(const struct tel_sat_buffer_size* src, char *dst, int current_index)
+static int _sat_encode_buffer_size_tlv(const unsigned char buffer_size[2], char *dst, int current_index)
{
dst[current_index++] = SATK_BUFFER_SIZE_TAG;
dst[current_index++] = SATK_BUFFER_SIZE_LENGTH;
- dst[current_index++] = src->size[0];
- dst[current_index++] = src->size[1];
+ dst[current_index++] = buffer_size[0];
+ dst[current_index++] = buffer_size[1];
return 4;
}
-static int _sat_encode_channel_data_tlv(const struct tel_sat_channel_data* src, char *dst, int current_index)
+static int _sat_encode_channel_data_tlv(const TelSatChannelDataInfo* src, char *dst, int current_index)
{
int total_len = 0;
int length_index = 0;
return total_len;
}
-static int _sat_encode_channel_data_length_tlv(const struct tel_sat_channel_data_len* src, char *dst, int current_index)
+static int _sat_encode_channel_data_length_tlv(const unsigned char data_len, char *dst, int current_index)
{
dst[current_index++] = SATK_CHANNEL_DATA_LEN_TAG;
dst[current_index++] = SATK_CHANNEL_DATA_LENGTH_VALUE_LENGTH;
- dst[current_index++] = src->data_len;
+ dst[current_index++] = data_len;
return 3;
}
-static int _sat_encode_channel_status_tlv(const struct tel_sat_channel_status* src, char *dst, int current_index)
+static int _sat_encode_channel_status_tlv(const TelSatChannelStatusInfo* src, char *dst, int current_index)
{
dst[current_index++] = SATK_CHANNEL_STATUS_TAG;
dst[current_index++] = SATK_CHANNEL_STATUS_LENGTH;
- if (src->status == link_or_packet_service_activated) //(bit 8)
+ if (src->status == TEL_SAT_LINK_OR_PACKET_SERVICE_ACTIVATED) //(bit 8)
dst[current_index] += 0x80;
dst[current_index++] += src->channel_id; //(bit 1~3)
return 4;
}
-static int _sat_encode_download_event(const struct tel_sat_envelop_event_download_tlv *evt_dl, char *dst_envelop)
+static int _sat_encode_download_event(const TelSatEnvelopEventDownloadTlv *evt_dl, char *dst_envelop)
{
int index = 2;
int encoded_len = 0;
index += encoded_len;
switch(evt_dl->event) {
- case EVENT_LANGUAGE_SELECTION:
- encoded_len = _sat_encode_language_tlv(evt_dl->language, dst_envelop, index);
- index += encoded_len;
- break;
- case EVENT_BROWSER_TERMINATION:
- encoded_len = _sat_encode_browser_termination_tlv(evt_dl->browser_termination, dst_envelop, index);
- index += encoded_len;
- break;
- case EVENT_DATA_AVAILABLE:
- encoded_len = _sat_encode_channel_status_tlv(&(evt_dl->channel_status), dst_envelop, index);
- index += encoded_len;
+ 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 EVENT_CHANNEL_STATUS:
- encoded_len = _sat_encode_channel_status_tlv(&(evt_dl->channel_status), dst_envelop, index);
- index += encoded_len;
- break;
- default:
- break;
+ 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);
}
dst_envelop[0] = SATK_EVENT_DOWNLOAD_TAG;
return index;
}
-int tcore_sat_encode_envelop_cmd(const struct treq_sat_envelop_cmd_data *src_envelop, char *dst_envelop)
+gboolean tcore_sat_encode_envelop_cmd(const TelSatRequestEnvelopCmdData *src_envelop, char *dst_envelop, int* envelope_length)
{
int index = 0, encoded_len= 0;
- if (!dst_envelop)
- return 0;
+ if (!dst_envelop) {
+ *envelope_length = 0;
+ return FALSE;
+ }
- if (src_envelop->sub_cmd == ENVELOP_MENU_SELECTION) {
+ 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.item_identifier);
+ 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;
//item identifier
- encoded_len = _sat_encode_item_identifier_tlv(&(src_envelop->envelop_data.menu_select.item_identifier), dst_envelop, index);
+ encoded_len = _sat_encode_item_identifier_tlv(src_envelop->envelop_data.menu_select.item_identifier, dst_envelop, index);
index += encoded_len;
if (src_envelop->envelop_data.menu_select.help_request) {
dst_envelop[0] = SATK_MENU_SELECTION_TAG;
dst_envelop[1] = index-2;
}
- else if (src_envelop->sub_cmd == ENVELOP_EVENT_DOWNLOAD) {
+ else if (src_envelop->sub_cmd == TEL_SAT_ENVELOP_EVENT_DOWNLOAD) {
index = _sat_encode_download_event(&(src_envelop->envelop_data.event_download),dst_envelop);
}
+ *envelope_length = index;
- return index;
+ return TRUE;
}
-static int _sat_encode_display_text(const struct tel_sat_tr_display_text_tlv *src_tr, char *dst_tr)
+static int _sat_encode_display_text(const TelSatTrDisplayTextTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_get_inkey(const struct tel_sat_tr_get_inkey_tlv *src_tr, char *dst_tr)
+static int _sat_encode_get_inkey(const TelSatTrGetInkeyTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_get_input(const struct tel_sat_tr_get_input_tlv *src_tr, char *dst_tr)
+static int _sat_encode_get_input(const TelSatTrGetInputTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index =0;
- break;
+ 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;
}
-static int _sat_encode_more_time(const struct tel_sat_tr_more_time_tlv *src_tr, char *dst_tr)
+static int _sat_encode_more_time(const TelSatTrMoreTimeTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_play_tone(const struct tel_sat_tr_play_tone_tlv *src_tr, char *dst_tr)
+static int _sat_encode_play_tone(const TelSatTrPlayToneTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_refresh(const struct tel_sat_tr_refresh_tlv *src_tr, char *dst_tr)
+static int _sat_encode_refresh(const TelSatTrRefreshTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_setup_menu(const struct tel_sat_tr_setup_menu_tlv *src_tr, char *dst_tr)
+static int _sat_encode_setup_menu(const TelSatTrSetupMenuTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_select_item(const struct tel_sat_tr_select_item_tlv *src_tr, char *dst_tr)
+static int _sat_encode_select_item(const TelSatTrSelectItemTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_send_sms(const struct tel_sat_tr_send_sms_tlv *src_tr, char *dst_tr)
+static int _sat_encode_send_sms(const TelSatTrSendSmsTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[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_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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_send_ss(const struct tel_sat_tr_send_ss_tlv *src_tr, char *dst_tr)
+static int _sat_encode_send_ss(const TelSatTrSendSsTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case 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 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 RESULT_SS_RETURN_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->ss_problem;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_send_ussd(const struct tel_sat_tr_send_ussd_tlv *src_tr, char *dst_tr)
+static int _sat_encode_send_ussd(const TelSatTrSendUssdTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case 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 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 RESULT_USSD_RETURN_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->ussd_problem;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_setup_call(const struct tel_sat_tr_setup_call_tlv *src_tr, char *dst_tr)
+static int _sat_encode_setup_call(const TelSatTrSetupCallTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[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[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- case 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 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_provide_local_info(const struct tel_sat_tr_provide_local_info_tlv *src_tr, char *dst_tr)
+static int _sat_encode_provide_local_info(const TelSatTrProvideLocalInfoTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[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, index);
- break;
- case LOCAL_INFO_LANGUAGE:
- encoded_len = _sat_encode_language_tlv(src_tr->other.language, dst_tr, index);
- break;
- default:
- dbg("local info type[%d] is not handled", src_tr->command_detail.cmd_qualifier.provide_local_info.provide_local_info);
- break;
- }
- 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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case 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;
+ 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;
default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_setup_event_list(const struct tel_sat_tr_setup_event_list_tlv *src_tr, char *dst_tr)
+static int _sat_encode_setup_event_list(const TelSatTrSetupEventListTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_setup_idle_mode_text(const struct tel_sat_tr_setup_idle_mode_text_tlv *src_tr, char *dst_tr)
+static int _sat_encode_setup_idle_mode_text(const TelSatTrSetupIdleModeTextTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_send_dtmf(const struct tel_sat_tr_send_dtmf_tlv *src_tr, char *dst_tr)
+static int _sat_encode_send_dtmf(const TelSatTrSendDtmfTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_language_notification(const struct tel_sat_tr_language_notification_tlv *src_tr, char *dst_tr)
+static int _sat_encode_language_notification(const TelSatTrLanguageNotificationTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- default:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_launch_browser(const struct tel_sat_tr_launch_browser_tlv *src_tr, char *dst_tr)
+static int _sat_encode_launch_browser(const TelSatTrLaunchBrowserTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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:
- dst_tr[index++] = 1;
- dst_tr[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[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_open_channel(const struct tel_sat_tr_open_channel_tlv *src_tr, char *dst_tr)
+static int _sat_encode_open_channel(const TelSatTrOpenChannelTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 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[index++] = 1;
- dst_tr[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[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- return 0;
- break;
+ 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;
}
//set buffer desc
index += encoded_len;
//set buffer size
- encoded_len = _sat_encode_buffer_size_tlv(&(src_tr->buffer_size), dst_tr, index);
+ encoded_len = _sat_encode_buffer_size_tlv(src_tr->buffer_size, dst_tr, index);
index += encoded_len;
return index;
}
-static int _sat_encode_close_channel(const struct tel_sat_tr_close_channel_tlv *src_tr, char *dst_tr)
+static int _sat_encode_close_channel(const TelSatTrCloseChannelTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_send_data(const struct tel_sat_tr_send_data_tlv *src_tr, char *dst_tr)
+static int _sat_encode_send_data(const TelSatTrSendDataTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_NETWORK_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
-
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_receive_data(const struct tel_sat_tr_receive_data_tlv *src_tr, char *dst_tr)
+static int _sat_encode_receive_data(const TelSatTrReceiveDataTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case RESULT_FRAMES_ERROR:
- dst_tr[index++] = 2;
- dst_tr[index++] = src_tr->result_type;
- dst_tr[index++] = src_tr->me_problem_type;
- break;
-
- case 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-static int _sat_encode_get_channel_status(const struct tel_sat_tr_get_channel_status_tlv *src_tr, char *dst_tr)
+static int _sat_encode_get_channel_status(const TelSatTrGetChannelStatusTlv *src_tr, char *dst_tr)
{
int index = 0, encoded_len = 0;
index += encoded_len;
//set result info
- dst_tr[index++] = (b_comprehensive ? (SATK_RESULT_TAG | 0x80) : SATK_RESULT_TAG);;
+ dst_tr[index++] = (is_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[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 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[index++] = 1;
- dst_tr[index++] = src_tr->result_type;
- break;
- case RESULT_ME_UNABLE_TO_PROCESS_COMMAND:
- case 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 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:
- dbg("invalid response value[0x%x] in current TR",src_tr->result_type);
- index = 0;
- break;
+ 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;
}
-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)
+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;
-
- 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:
- err("no matched cmd type(%d)", src_tr->cmd_type);
- break;
}
- return tr_len;
+ 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;
}
-void tcore_sat_override_ops(CoreObject *o, struct tcore_sat_operations *sat_ops)
+void tcore_sat_override_ops(CoreObject *co, TcoreSatOps *sat_ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAT);
+ po = (PrivateObject *)tcore_object_ref_object(co);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
- }
+ tcore_check_return_assert(po != NULL);
+ tcore_check_return_assert(po->ops != NULL);
+ tcore_check_return_assert(sat_ops != NULL);
- if (sat_ops) {
- _clone_sat_operations(po, sat_ops);
+ 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;
}
-CoreObject *tcore_sat_new(TcorePlugin *p,
- struct tcore_sat_operations *ops, TcoreHal *hal)
+gboolean tcore_sat_set_ops(CoreObject *co, TcoreSatOps *ops)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- if (!p)
- return NULL;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
-
- po = calloc(1, sizeof(struct private_object_data));
- if (!po) {
- tcore_object_free(o);
- return NULL;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- 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);
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSatOps));
- return o;
+ return TRUE;
}
-void tcore_sat_free(CoreObject *o)
+CoreObject *tcore_sat_new(TcorePlugin *p,
+ TcoreSatOps *ops, TcoreHal *hal)
{
- struct private_object_data *po = NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAT);
+ tcore_check_return_value_assert(p != NULL, NULL);
- po = tcore_object_ref_object(o);
- if (!po)
- return;
+ co = tcore_object_new(p, hal);
+ tcore_check_return_value_assert(co != NULL, NULL);
+
+ po = tcore_malloc0(sizeof(PrivateObject));
+ po->ops = tcore_memdup(ops, sizeof(TcoreSatOps));
+
+ 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);
- free(po);
- tcore_object_free(o);
+ return co;
+}
+
+void tcore_sat_free(CoreObject *co)
+{
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SAT);
+ tcore_object_free(co);
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include "tcore.h"
#include "plugin.h"
#include "queue.h"
-#include "user_request.h"
#include "core_object.h"
#include "co_sim.h"
-struct private_object_data {
- struct tcore_sim_operations *ops;
-
- 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*/
+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;
void *userdata; /**< free use data*/
-};
-
-static void _clone_sim_operations(struct private_object_data *po, struct tcore_sim_operations *sim_ops)
-{
- if(sim_ops->verify_pins) {
- po->ops->verify_pins = sim_ops->verify_pins;
- }
- if(sim_ops->verify_puks) {
- po->ops->verify_puks = sim_ops->verify_puks;
- }
- if(sim_ops->change_pins) {
- po->ops->change_pins = sim_ops->change_pins;
- }
- if(sim_ops->get_facility_status) {
- po->ops->get_facility_status = sim_ops->get_facility_status;
- }
- if(sim_ops->enable_facility) {
- po->ops->enable_facility = sim_ops->enable_facility;
- }
- if(sim_ops->disable_facility) {
- po->ops->disable_facility = sim_ops->disable_facility;
- }
- if(sim_ops->get_lock_info) {
- po->ops->get_lock_info = sim_ops->get_lock_info;
- }
- if(sim_ops->read_file) {
- po->ops->read_file = sim_ops->read_file;
- }
- if(sim_ops->update_file) {
- po->ops->update_file = sim_ops->update_file;
- }
- if(sim_ops->transmit_apdu) {
- po->ops->transmit_apdu = sim_ops->transmit_apdu;
- }
- if(sim_ops->get_atr) {
- po->ops->get_atr = sim_ops->get_atr;
- }
- if(sim_ops->req_authentication) {
- po->ops->req_authentication = sim_ops->req_authentication;
- }
-
- return;
-}
+} PrivateObject;
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
+static TelReturn _dispatcher(CoreObject *co, TcoreCommand command,
+ const void *request, TcoreObjectResponseCallback cb, const void *user_data)
{
- enum tcore_request_command command;
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_SIM, TCORE_RETURN_EINVAL);
+ PrivateObject *po = NULL;
+ po = tcore_object_ref_object(co);
- po = tcore_object_ref_object(o);
- if (!po || !po->ops)
- return TCORE_RETURN_ENOSYS;
+ 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);
+ dbg("command [0x%x]", command);
switch (command) {
- case TREQ_SIM_VERIFY_PINS:
- if (!po->ops->verify_pins)
- return TCORE_RETURN_ENOSYS;
-
- 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 (!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_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:
- 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;
-
- default:
- 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;
+ 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);
- dest_po = calloc(1, sizeof(struct private_object_data));
- if (!dest_po) {
+ src_po = tcore_object_ref_object(src);
+ if (NULL == src_po) {
+ err("invalid source private object");
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);
-}
-
-static void _free_hook(CoreObject *o)
-{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SIM);
-
- po = tcore_object_ref_object(o);
- if (po) {
- free(po);
- tcore_object_link_object(o, 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;
- }
-}
-
-static char* _acitoa(int n, char* str, int b)
-{
- int i = 0;
-
- do {
- str[i++] = "0123456789ABCDEF"[n % b];
- } while ((n /= b) > 0);
-
- _reverse(str, i);
-
- str[i] = '\0';
-
- return 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] 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 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
- */
-static unsigned long _bcd_to_digit(char* digit, char* bcdCode, int bcdLen)
-{
- 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);
- }
-
- 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;
- }
-
- digitLen = (unsigned long) strlen(digit);
- return digitLen;
-}
-
-/**
- * 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
- */
-static unsigned long _get_string(unsigned char* palpha_id, unsigned char* pRecord, unsigned long alphaIDMaxLen)
-{
- unsigned long i, alphaIDLen = 0;
- unsigned char *pAlphaID = (unsigned char*) palpha_id;
-
- memset((void*) pAlphaID, 0, alphaIDMaxLen);
-
- if (pRecord[0] == 0xFF)
- return alphaIDLen;
-
- 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 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
- */
-static void _set_string(unsigned char* pRecord, unsigned char* palpha_id, unsigned long alphaIDMaxLen)
-{
- unsigned long i;
- unsigned char* pAlphaID = (unsigned char*) palpha_id;
-
- memset((void*) pRecord, 0xFF, alphaIDMaxLen);
-
- for (i = 0; i < alphaIDMaxLen; i++)
- pRecord[i] = pAlphaID[i];
-}
-
-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;
- }
- 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] pBcdData - BCD Input data
- * @param[in] bcdMaxLen - BCD Max data Length
- * @Interface Synchronous.
- * @remark
- * @Refer
- */
-static int _get_valid_bcd_byte(unsigned char* pBcdData, int bcdMaxLen)
-{
- int i, bcd_length = 0;
-
- for (i = 0; i < bcdMaxLen; i++) {
- if (pBcdData[i] == 0xFF)
- break;
-
- bcd_length++;
- }
- return bcd_length;
-}
-
-/**
- * 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 = 0;
- unsigned int pos = 0;
- unsigned short shift = 0;
- int outlen = 0;
- outlen = (short int) ((inStringLen * 8) / 7);
-
- for (i = 0; pos < inStringLen; i++, pos++) {
- pOutString[i] = (pInString[pos] << shift) & 0x7F;
-
- if (pos != 0) {
- /* except the first byte, a character contains some bits from the previous byte.*/
- pOutString[i] |= pInString[pos - 1] >> (8 - shift);
- }
-
- shift++;
-
- if (shift == 7) {
- shift = 0;
-
- /* a possible extra complete character is available */
- i++;
- pOutString[i] = pInString[pos] >> 1;
- }
- }
+ tcore_check_return_assert(src_po->ops != NULL);
- /*If a character is '\r'(13), change it to space(32) */
- for (i = 0; i < outlen; i++)
- if (pOutString[i] == 13) pOutString[i] = 32;
+ dest_po = tcore_malloc0(sizeof(PrivateObject));
+ dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreSimOps));
- pOutString[outlen] = '\0';
-
- dbg( "unpack is done with outlen[%d] and array index[%d], out string[%s]", outlen, i, pOutString);
- return (unsigned int) (i);
+ tcore_object_link_object(dest, dest_po);
}
-static int _ucs2_to_utf8(int in_length, unsigned char *in_data, int *out_length, unsigned char *out_data)
+static void _po_free_hook(CoreObject *co)
{
- 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;
- }
+ PrivateObject *po = NULL;
- if (0 != (in_length % 2)) {
- dbg( " ##### Unicode decoding failed due to invalid text length [%d]", in_length);
- return FALSE;
- }
+ po = tcore_object_ref_object(co);
+ tcore_check_return(po != NULL);
- 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;
+ tcore_free(po->spn);
+ tcore_free(po->ops);
+ tcore_free(po);
+ tcore_object_link_object(co, NULL);
}
/**
* 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)
+gboolean tcore_sim_decode_iccid(unsigned char *enc_iccid, int enc_iccid_len, char *dec_iccid)
{
int bcd_byte = 0;
- int char_length = 0;
+ guint char_length = 0;
- if (p_in == NULL || p_out == NULL)
- return FALSE;
+ 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);
- if (in_length == 0 || in_length > 10)
+ 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);
- memset((void*) p_out->iccid, 0, SIM_ICCID_LEN_MAX+1);
-
- bcd_byte = _get_valid_bcd_byte(p_in, in_length);
- dbg( "ICCID valid bcd byte is[%d]", bcd_byte);
+ bcd_byte = (int) tcore_util_get_valid_bcd_byte(enc_iccid, enc_iccid_len);
- char_length = _bcd_to_digit(p_out->iccid, (char*) p_in, bcd_byte);
- dbg( "ICCID string length is[%d]", char_length);
+ char_length = tcore_util_convert_bcd_to_digit(dec_iccid, (char*)enc_iccid, bcd_byte);
+ dbg("ICCID string length is[%d]", char_length);
- *(p_out->iccid+char_length) = '\0';
+ dec_iccid[char_length] = '\0';
return TRUE;
}
/**
* 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)
+gboolean tcore_sim_decode_lp(unsigned char *enc_lang, int enc_lang_len, TelSimLanguagePreferenceCode *dec_lang)
{
int i = 0;
- memset((void*) p_out, 0xFF, sizeof(struct tel_sim_language));
- p_out->language_count = 0;
+ tcore_check_return_value_assert(enc_lang != NULL, FALSE);
+ tcore_check_return_value_assert(enc_lang_len != 0, FALSE);
+
+ *dec_lang = TEL_SIM_LP_LANG_UNSPECIFIED;
- 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.
*/
+ if (enc_lang_len > TEL_SIM_LANG_CNT_MAX)
+ enc_lang_len = TEL_SIM_LANG_CNT_MAX;
- if (in_length > SIM_LANG_CNT_MAX)
- in_length = SIM_LANG_CNT_MAX;
+ for (i = 0; i < enc_lang_len; i++) {
- 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)
+ if (enc_lang[i] == 0xFF)
continue;
- 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++;
+ *dec_lang = (TelSimLanguagePreferenceCode)enc_lang[i];
}
- dbg( "in_length %d, lang_cnt %d ", in_length, p_out->language_count);
+
+ dbg("enc_lang_len [%d] language[0x%x]", enc_lang_len, *dec_lang);
return TRUE;
}
/**
* This function is used to encode EFLP (2G)
*/
-char* tcore_sim_encode_lp( int *out_length, struct tel_sim_language *p_in)
+gboolean tcore_sim_encode_lp(TelSimLanguagePreferenceCode dec_lang, char **enc_lang, int *enc_lang_len)
{
- int i = 0;
- char *tmp_out = NULL;
-
- if ( out_length == NULL || p_in == NULL ){
- dbg("out_length or p_in is null");
- return NULL;
- }
+ char *language_code[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11",
+ "12", "13", "14", "15", "16", "17", "18" };
- tmp_out = (char*)malloc(p_in->language_count);
- memset((void*) tmp_out, 0xff, p_in->language_count);
+ tcore_check_return_value_assert(enc_lang != NULL, FALSE);
+ tcore_check_return_value_assert(enc_lang_len != NULL, FALSE);
- for (i = 0; i < p_in->language_count; i++)
- tmp_out[i] = p_in->language[i];
+ *enc_lang = g_strdup_printf("%d", atoi(language_code[dec_lang]));
+ *enc_lang_len = strlen(*enc_lang);
+ dbg("Encoded Language: [%s] Length: [%d]", *enc_lang, *enc_lang_len);
- *out_length = i;
- return tmp_out;
+ return TRUE;
}
/**
* 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)
+ /* TelSimFileID is replaced with int */
+gboolean tcore_sim_decode_li(unsigned char *enc_lang, int enc_lang_len, int file_id, TelSimLanguagePreferenceCode *dec_lang)
{
int i;
- unsigned short defaultLi;
- unsigned char tempLi[3] = { 0, 0, 0 };
+ unsigned short default_li;
+ unsigned char temp_li[3] = { 0, 0, 0 };
- memset((void*) p_out, 0xFF, sizeof(struct tel_sim_language));
- p_out->language_count = 0;
+ memset((void*) dec_lang, 0xFF, sizeof(TelSimLanguagePreferenceCode));
- if (in_length == 0)
- return FALSE;
+ tcore_check_return_value_assert(enc_lang != NULL, FALSE);
+ tcore_check_return_value_assert(enc_lang_len != 0, FALSE);
/*
* 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 (/*TODO g_sim.CardType == SIM_TYPE_USIM && */(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];
- if (defaultLi == 0xFFFF) // 1st language is default.
+ if (default_li == 0xFFFF) {
+ // 1st language is default.
+ dbg("1st language is default");
return FALSE;
+ }
}
- if (in_length > SIM_LANG_CNT_MAX)
- in_length = SIM_LANG_CNT_MAX;
+ if (enc_lang_len > TEL_SIM_LANG_CNT_MAX)
+ enc_lang_len = TEL_SIM_LANG_CNT_MAX;
- for (i = 0; i < in_length; i++) {
- tempLi[0] = p_in[i++];
- tempLi[1] = p_in[i];
+ for (i = 0; i < enc_lang_len; i++) {
+ temp_li[0] = enc_lang[i++];
+ temp_li[1] = enc_lang[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
+ if (temp_li[0] == 0xFF || temp_li[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;
+ *dec_lang = TEL_SIM_LP_LANG_UNSPECIFIED;
+
+ if (temp_li[0] == 'e') {
+ switch (temp_li[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 (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;
+ } else if (temp_li[0] == 'd') {
+ switch (temp_li[1]) {
+ case 'e':
+ *dec_lang = TEL_SIM_LP_GERMAN;
+ break;
+
+ case 'a':
+ *dec_lang = TEL_SIM_LP_DANISH;
+ 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;
+ } else if (temp_li[0] == 'i' && temp_li[1] == 't') {
+ *dec_lang = TEL_SIM_LP_ITALIAN;
+ } else if (temp_li[0] == 'f' && temp_li[1] == 'r') {
+ *dec_lang = TEL_SIM_LP_FRENCH;
+ } else if (temp_li[0] == 'n' && temp_li[1] == 'l') {
+ *dec_lang = TEL_SIM_LP_DUTCH;
+ } else if (temp_li[0] == 's' && temp_li[1] == 'v') {
+ *dec_lang = TEL_SIM_LP_SWEDISH;
+ } else if (temp_li[0] == 'f' && temp_li[1] == 'i') {
+ *dec_lang = TEL_SIM_LP_FINNISH;
+ } else if (temp_li[0] == 'n' && temp_li[1] == 'o') {
+ *dec_lang = TEL_SIM_LP_NORWEGIAN;
+ } else if (temp_li[0] == 't' && temp_li[1] == 'r') {
+ *dec_lang = TEL_SIM_LP_TURKISH;
+ } else if (temp_li[0] == 'h' && temp_li[1] == 'u') {
+ *dec_lang = TEL_SIM_LP_HUNGARIAN;
+ } else if (temp_li[0] == 'p') {
+ switch (temp_li[1]) {
+ case 'l':
+ *dec_lang = TEL_SIM_LP_POLISH;
+ break;
+ case 't':
+ *dec_lang = TEL_SIM_LP_PORTUGUESE;
+ 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;
+ } else if (temp_li[0] == 'k' && temp_li[1] == 'o') {
+ *dec_lang = TEL_SIM_LP_KOREAN;
+ } else if (temp_li[0] == 'z' && temp_li[1] == 'h') {
+ *dec_lang = TEL_SIM_LP_CHINESE;
+ } else if (temp_li[0] == 'r' && temp_li[1] == 'u') {
+ *dec_lang = TEL_SIM_LP_RUSSIAN;
+ } else if (temp_li[0] == 'j' && temp_li[1] == 'a') {
+ *dec_lang = TEL_SIM_LP_JAPANESE;
}
- dbg( "count %d & Codes %d ", p_out->language_count, p_out->language[p_out->language_count]);
- p_out->language_count++;
+ dbg( "Language %d ", *dec_lang);
}
- if (p_out->language_count == 0) {
- dbg( "p_out->language_count = %d ", p_out->language_count);
- return FALSE;
- }
- else {
- return TRUE;
- }
+ return TRUE;
}
/**
* This function is used to encode EFLI (3G)
*/
-char* tcore_sim_encode_li( int *out_length, struct tel_sim_language *p_in)
+gboolean tcore_sim_encode_li(TelSimLanguagePreferenceCode dec_lang, char **en_lang, int *en_lang_len)
{
- int i = 0;
- char *tmp_out = NULL;
- 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]);
- }
+ char *language_code[] = { "de", "en", "it", "fr", "es", "nl", "sv", "da", "pt", "fi", "no", "el",
+ "tr", "hu", "pl", "ko", "zh", "ru", "ja" };
+
+ tcore_check_return_value_assert(en_lang != NULL, FALSE);
+ tcore_check_return_value_assert(en_lang_len != NULL, FALSE);
+
+ *en_lang_len = 0;
+
+ if (dec_lang < TEL_SIM_LP_LANG_UNSPECIFIED) {
+ *en_lang = (char *) tcore_strdup((gchar *)language_code[dec_lang]);
+ dbg( "sim_encode_li:tmp_out[%s]", *en_lang);
+ *en_lang_len = strlen(*en_lang);
}
- *out_length = i*2;
- return tmp_out;
+
+ return TRUE;
}
-gboolean tcore_sim_decode_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_imsi(unsigned char *en_imsi, int en_imsi_len, TelSimImsiInfo *dec_imsi)
{
- int i,j=0;
+ int i, j=0;
char imsi_raw[16];
+ unsigned int mnc_len = 0;
dbg( "Func Entrance");
- if ((NULL == p_out) || (NULL == p_in))
- return FALSE;
+ tcore_check_return_value_assert(dec_imsi != NULL, FALSE);
+ tcore_check_return_value_assert(en_imsi != NULL, 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);
+ 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]", p_in[0], in_length);
+ dbg("imsi length[%d], input data length[%d]", en_imsi[0], en_imsi_len);
/* Decode IMSI value from nibbles */
- for (i = 1; i < in_length; i++) {
+ for (i = 1; i < en_imsi_len; 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';
+ 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++] = (p_in[i] & 0x0F) + '0';
- imsi_raw[j++] = ((p_in[i] & 0xF0) >> 4) + '0';
+ imsi_raw[j++] = (en_imsi[i] & 0x0F) + '0';
+ imsi_raw[j++] = ((en_imsi[i] & 0xF0) >> 4) + '0';
}
}
/* Terminate string */
imsi_raw[j] = '\0';
dbg("imsi_raw[%s], size[%d]", imsi_raw, strlen(imsi_raw));
- memcpy(p_out->plmn, imsi_raw, 5);
- p_out->plmn[5] = '\0';
- memcpy(p_out->msin, imsi_raw+5, strlen(imsi_raw)-5);
- p_out->msin[strlen(imsi_raw)-5] = '\0';
+ mnc_len = strlen(imsi_raw) - TEL_SIM_MSIN_LEN_MAX - TEL_SIM_MCC_MNC_LEN_MAX;
+
+ 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';
- dbg("p_out->plmn[%s], p_out->msin[%s]", p_out->plmn, p_out->msin);
+ dbg("dec_imsi->mcc[%s], dec_imsi->mcc[%s], dec_imsi->msin[%s]",
+ dec_imsi->mcc, dec_imsi->mnc, dec_imsi->msin);
return TRUE;
}
-gboolean tcore_sim_decode_sst(struct tel_sim_sst *p_sst, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_sst(unsigned char *enc_sst, int enc_sst_len, char *dec_sst)
{
- unsigned char sstByte, rast, mask = 0;
- char simServiceID = 1; // set "CHV1 disable function"
+ unsigned char sst_byte, rast, mask = 0;
+ char sim_service_id = 1; // set "CHV1 disable function"
int i, svc_count;
- char *p_index;
- memset((void*)p_sst, 0, sizeof(struct tel_sim_sst));
+ tcore_check_return_value_assert(enc_sst != NULL, FALSE);
+ tcore_check_return_value_assert(enc_sst_len != 0, FALSE);
- if (in_length == 0 || in_length > SIM_SST_LEN_MAX)
+ memset((void*)dec_sst, 0, TEL_SIM_SST_SERVICE_CNT_MAX);
+
+ if (enc_sst_len == 0 || enc_sst_len > TEL_SIM_SST_LEN_MAX) {
+ err("invalid length");
return FALSE;
+ }
// get count of SIM service id. one byte has four service status.
- svc_count = in_length * 4;
+ svc_count = enc_sst_len * 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)
- svc_count = SIM_SST_SERVICE_CNT_MAX;
-
- p_index = (char*)p_sst;
+ /*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;
for (i = 0; i < svc_count; i++) {
- sstByte = p_in[(simServiceID - 1) / 4];
- rast = simServiceID - 4 * (simServiceID / 4);
+ sst_byte = enc_sst[(sim_service_id - 1) / 4];
+ rast = sim_service_id - 4 * (sim_service_id / 4);
switch (rast) {
- case 1:
- mask = 0x02;
- break;
- case 2:
- mask = 0x08;
- break;
- case 3:
- mask = 0x20;
- break;
- case 0:
- mask = 0x80;
- break;
+ case 0:
+ mask = 0x80;
+ break;
+ case 1:
+ mask = 0x02;
+ break;
+ case 2:
+ mask = 0x08;
+ break;
+ case 3:
+ mask = 0x20;
+ break;
}
- if (sstByte & mask)
- *p_index = 1;
+ if (sst_byte & mask)
+ *dec_sst = 1;
else
- *p_index = 0;
+ *dec_sst = 0;
- p_index += sizeof(char);
- simServiceID++; // next service id
+ *dec_sst += sizeof(char);
+ sim_service_id++; // next service id
}
return TRUE;
}
-gboolean tcore_sim_decode_spn(struct tel_sim_spn *p_spn, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_spn(unsigned char *enc_spn, int enc_spn_len, TelSimSpn *dec_spn)
{
int i;
- if (in_length == 0)
- return FALSE;
+ 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);
- p_spn->display_condition = p_in[0];
- dbg( "The display condition is [%d]", p_spn->display_condition);
+ dec_spn->display_condition = enc_spn[0];
+ dbg( "The display condition is [%d]", dec_spn->display_condition);
- for (i = 1; i < SIM_SPN_LEN_MAX + 1; i++) {
- if (p_in[i] == 0xFF)
+ for (i = 1; i < TEL_SIM_SPN_LEN_MAX + 1; i++) {
+ if (enc_spn[i] == 0xFF)
break; /* loop break*/
- p_spn->spn[i - 1] = p_in[i];
- dbg( "EF-SPN name[%d][%c]", i, p_in[i]);
+ dec_spn->spn[i - 1] = enc_spn[i];
+ dbg("EF-SPN name[%d][%c]", i, enc_spn[i]);
}
- p_spn->spn[i-1] = '\0';
+ dec_spn->spn[i-1] = '\0';
return TRUE;
}
-gboolean tcore_sim_decode_spdi(struct tel_sim_spdi *p_spdi, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_spdi(unsigned char *enc_spdi, int enc_spdi_len, TelSimSpPlmnList *dec_spdi)
{
- int i, Src_plmn_start_len, total_data_len;
+ unsigned int i, src_plmn_start_len, total_data_len;
- if (in_length == 0)
- return FALSE;
+ 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[0] == 0xff){
+ if (enc_spdi[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);
+ dec_spdi->count = 0;
+ memset(dec_spdi->list, 0x00, sizeof(unsigned char)*7*TEL_SIM_SPDI_PLMN_MAX);
return TRUE;
}
//Display info tag('A3')
- if (p_in[0] == 0xA3) {
- total_data_len = p_in[1];
+ if (enc_spdi[0] == 0xA3) {
+ total_data_len = enc_spdi[1];
//PLMN list tag('80')
- if (p_in[2] == 0x80) {
- p_spdi->plmn_count = p_in[3] / 3;
+ if (enc_spdi[2] == 0x80) {
+ dec_spdi->count = enc_spdi[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;
+ if (dec_spdi->count > TEL_SIM_SPDI_PLMN_MAX)
+ dec_spdi->count = TEL_SIM_SPDI_PLMN_MAX;
- Src_plmn_start_len = 4;
+ src_plmn_start_len = 4;
- dbg( "p_spdi->num_of_plmn_entries[%d]", p_spdi->plmn_count);
+ dbg( "dec_spdi->num_of_plmn_entries[%d]", dec_spdi->count);
- for (i = 0; i < p_spdi->plmn_count; i++) {
- unsigned char packetInDigit[3 * 2 + 1];
- _bcd_to_digit((char*) packetInDigit, (char*) &p_in[Src_plmn_start_len], 3);
+ 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);
// get MCC (mobile country code)
- memcpy(p_spdi->list[i].plmn, &(packetInDigit[0]), 6);
- p_spdi->list[i].plmn[6] = '\0';
- dbg( "SPDI PLMN[%d][%s]", i, p_spdi->list[i].plmn);
+ 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;
+ src_plmn_start_len = src_plmn_start_len + 3;
}
return TRUE;
}
return FALSE;
}
-gboolean tcore_sim_decode_msisdn(struct tel_sim_msisdn *p_msisdn, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_msisdn(unsigned char *enc_msisdn,
+ int enc_msisdn_len, TelSimSubscriberInfo *dec_msisdn)
{
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 == 0)
- return FALSE;
+ 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);
- if (_is_empty(p_in, in_length) == TRUE) {
- memset(p_msisdn, 0, sizeof(struct tel_sim_msisdn));
+ if (tcore_util_is_empty(enc_msisdn, enc_msisdn_len) == TRUE) {
+ err("empty record");
return FALSE;
}
- X = in_length - 14; // get alpha id max length
+ X = enc_msisdn_len - 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;
+ if (alpha_id_length > TEL_SIM_XDN_ALPHA_ID_LEN_MAX)
+ alpha_id_length = TEL_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';
+ 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';
}
// get dialing number length
- // p_in[X] is BCD length of dialing number length plus TON/NPI 1 bytes.
+ // 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 (enc_msisdn[X] != 0xFF) {
+ dbg( "Dialing number Length %d, BCD length 0x%x ", (enc_msisdn[X] - 1) * 2, enc_msisdn[X]);
// get TON and NPI
- p_msisdn->ton = (p_in[X + 1] >> 4) & 0x07;
+ //p_msisdn->ton = (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);
+ 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);
// 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';
- dbg( "p_msisdn->num[%s]", p_msisdn->num);
+ 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;
}
-gboolean tcore_sim_decode_xdn(struct tel_sim_dialing_number *p_xdn, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_xdn(unsigned char *enc_xdn, int enc_xdn_len, char *alpha_id, char *num)
{
int X; // alpha id max length
int bcd_byte; // dialing number max length
- memset((void*) p_xdn, 0, sizeof(struct tel_sim_dialing_number));
+ memset((void*) alpha_id, 0, TEL_SIM_XDN_ALPHA_ID_LEN_MAX);
+ memset((void*) num, 0, TEL_SIM_XDN_NUMBER_LEN_MAX);
- if (in_length == 0)
- return FALSE;
+ tcore_check_return_value_assert(enc_xdn != NULL, FALSE);
+ tcore_check_return_value_assert(enc_xdn_len != 0, FALSE);
- if (_is_empty(p_in, in_length) == TRUE) {
+ if (tcore_util_is_empty(enc_xdn, enc_xdn_len) == TRUE) {
+ err("empty record");
return FALSE; // this is empty record
}
- X = in_length - 14; // get alpha id max length
+ X = enc_xdn_len - 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;
+ tcore_util_get_string((unsigned char *)alpha_id, enc_xdn, X);
}
// get dialing number length
- // p_in[X] is BCD length of dialing number length plus TON/NPI 1 bytes.
+ // 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 (enc_xdn[X] != 0xFF) {
+ dbg( "Dialing number Length %d, BCD length 0x%x ", (enc_xdn[X] - 1) * 2, enc_xdn[X]);
/* if (p_xdn->num_max_len > SIM_XDN_NUMBER_LEN_MAX) {
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);
+ 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.
- if (p_in[X] == 0x00)
+ if (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;
+ //p_xdn->ton = (in[X + 1] >> 4) & 0x07;
+ //p_xdn->npi = 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);
+ 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);
// 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);
+ 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 = p_in[X + 12];
+ //p_xdn->cc_id = enc_xdn[X + 12];
// get Extension1 id
- p_xdn->ext1_id = p_in[X + 13];
+ //p_xdn->ext1_id = enc_xdn[X + 13];
}
return TRUE;
}
-char* tcore_sim_encode_xdn(int out_length, struct tel_sim_dialing_number *p_xdn)
+gboolean tcore_sim_encode_xdn(char *alpha_id, char *num, char *enc_xdn, int enc_xdn_len)
{
int alpha_id_space =0, digit_len =0, str_len = 0;
- char bcdCode[SIM_XDN_NUMBER_LEN_MAX / 2];
- char * p_out = NULL;
- p_out = calloc(out_length,1);
- memset((void*) p_out, 0xFF, out_length);
+ char bcd_code[TEL_SIM_XDN_NUMBER_LEN_MAX / 2];
+ enc_xdn = tcore_malloc0(enc_xdn_len);
+ memset((void*) enc_xdn, 0xFF, enc_xdn_len);
+
+ tcore_check_return_value_assert(alpha_id != NULL, FALSE);
+ tcore_check_return_value_assert(num != NULL, FALSE);
// get alpha id max length
- alpha_id_space = out_length - 14;
+ alpha_id_space = enc_xdn_len - 14;
// alpha id is too big
- str_len = strlen(p_xdn->alpha_id);
+ str_len = strlen(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);
+ digit_len = strlen(num);
// this is digit length
- if ( digit_len > SIM_XDN_NUMBER_LEN_MAX) {
+ if ( digit_len > 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",
- SIM_XDN_NUMBER_LEN_MAX, digit_len, SIM_XDN_NUMBER_LEN_MAX);
- digit_len = SIM_XDN_NUMBER_LEN_MAX;
+ TEL_SIM_XDN_NUMBER_LEN_MAX, digit_len, TEL_SIM_XDN_NUMBER_LEN_MAX);
+ digit_len = TEL_SIM_XDN_NUMBER_LEN_MAX;
}
- _set_string((unsigned char *)p_out, (unsigned char *)p_xdn->alpha_id, str_len);
+ tcore_util_set_string((unsigned char *)enc_xdn, (unsigned char *)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;
+ enc_xdn[alpha_id_space] = ( (digit_len + 1) / 2 ) + 1;
+ /* set TON and NPI
+ xdn[alpha_id_space + 1] = 0x80;
+ xdn[alpha_id_space + 1] |= (p_xdn->ton & 0x07) << 4;
+ xdn[alpha_id_space + 1] |= p_xdn->npi & 0x0F;
+ */
// set dialing number/SSC string
- memset((void*) bcdCode, 0xFF, SIM_XDN_NUMBER_LEN_MAX / 2);
+ memset((void*) bcd_code, 0xFF, TEL_SIM_XDN_NUMBER_LEN_MAX / 2);
- _digit_to_bcd((char*) bcdCode, (char*) p_xdn->num, digit_len);
+ tcore_util_convert_digit_to_bcd((char*) bcd_code, (char*)num, digit_len);
- memcpy((void*) &p_out[alpha_id_space + 2], bcdCode, SIM_XDN_NUMBER_LEN_MAX / 2);
+ memcpy((void*) &enc_xdn[alpha_id_space + 2], bcd_code, TEL_SIM_XDN_NUMBER_LEN_MAX / 2);
// set Capability/Configuration Identifier
- p_out[alpha_id_space + 12] = (unsigned char) p_xdn->cc_id;
+ //out[alpha_id_space + 12] = (unsigned char) p_xdn->cc_id;
// set extension1 record Identifier
- p_out[alpha_id_space + 13] = (unsigned char) p_xdn->ext1_id;
+ //out[alpha_id_space + 13] = (unsigned char) p_xdn->ext1_id;
- return p_out;
+ return TRUE;
}
-gboolean tcore_sim_decode_ecc(struct tel_sim_ecc_list *p_ecc, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_ecc(unsigned char *enc_ecc, int enc_ecc_len, TelSimEccList *dec_ecc)
{
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");
+ 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);
+
+ memset((void*)dec_ecc, 0x00, sizeof(TelSimEccList));
+
+ if (enc_ecc_len%3 != 0) {
+ err("error - invalid data length");
return FALSE;
}
- for(i=0; i < in_length/3; i++){
+ for(i=0; i < enc_ecc_len/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++;
+ 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++;
}
}
return TRUE;
}
-gboolean tcore_sim_decode_ust(struct tel_sim_ust *p_ust, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_ust(unsigned char *enc_ust, int enc_ust_len, char *dec_ust)
{
int i, j;
char mask;
- char *p_index;
- memset((void*) p_ust, 0, sizeof(struct tel_sim_ust));
- p_index = (char*)p_ust;
+
+ tcore_check_return_value_assert(enc_ust != NULL, FALSE);
+ tcore_check_return_value_assert(enc_ust_len != 0, FALSE);
+
+ memset((void*) dec_ust, 0, TEL_SIM_UST_SERVICE_CNT_MAX);
/* 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_BYTE_LEN_MAX)
- in_length = SIM_UST_BYTE_LEN_MAX;
+ 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;
- for (i = 0; i < in_length; i++) {
+ for (i = 0; i < enc_ust_len; i++) {
mask = 0x01; // reset mast to check first bit
for (j = 0; j < 8; j++) {
- if (p_in[i] & mask) {
- *p_index = 1;
+ if (enc_ust[i] & mask) {
+ *dec_ust = 1;
}
- p_index += sizeof(char);
+ dec_ust += 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)
+gboolean tcore_sim_decode_uecc(unsigned char* enc_uecc, int enc_uecc_len, TelSimEcc *dec_ecc)
{
int bcd_byte; // dialing number max length
- unsigned char eccServiceCategory;
+ unsigned char ecc_service_category;
- if (_is_empty(p_in, in_length) == TRUE) {
- memset(p_ecc, 0, sizeof(struct tel_sim_ecc));
+ 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 (tcore_util_is_empty(enc_uecc, enc_uecc_len) == TRUE) {
+ err("empty record");
return FALSE;
}
//get the BCD length of the ECC
- bcd_byte = _get_valid_bcd_byte(&p_in[0], SIM_ECC_BYTE_LEN_MAX);
+ 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
- _bcd_to_digit((char*) p_ecc->ecc_num, (char*) &p_in[0], bcd_byte);
+ tcore_util_convert_bcd_to_digit((char*) dec_ecc->number, (char*) &enc_uecc[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);
+ tcore_util_get_string((unsigned char*) dec_ecc->name, (unsigned char*) &enc_uecc[3], enc_uecc_len - 3);
- eccServiceCategory = p_in[in_length - 1] & 0x1F; // Check for the first 5 bits
+ ecc_service_category = enc_uecc[enc_uecc_len - 1] & 0x1F; // Check for the first 5 bits
/*
Assign the service category
Bit 7 automatically initiated eCall
Bit 8 is spare and set to "0"
*/
- switch (eccServiceCategory) {
- case 0x01:
- p_ecc->ecc_category = SIM_ECC_POLICE;
- break;
- case 0x02:
- p_ecc->ecc_category = SIM_ECC_AMBULANCE;
- break;
- case 0x04:
- p_ecc->ecc_category = SIM_ECC_FIREBRIGADE;
- break;
- case 0x08:
- p_ecc->ecc_category = SIM_ECC_MARAINEGUARD;
- break;
- case 0x10:
- p_ecc->ecc_category = SIM_ECC_MOUTAINRESCUE;
- break;
- default:
- p_ecc->ecc_category = SIM_ECC_SPARE;
- break;
+ 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_gid( struct tel_sim_gid *p_gid, unsigned char* p_in, int in_length)
+gboolean tcore_sim_decode_mbi(unsigned char *enc_mbi, int enc_mbi_len, TelSimMbi *dec_mbi)
{
- 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;
+ 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);
- 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)
+ if (enc_mbi_len == 0 || enc_mbi_len > TEL_SIM_MAIL_BOX_IDENTIFIER_LEN_MAX) {
+ err("invalid length");
return FALSE;
+ }
- if ( _is_empty(p_in, in_length) == TRUE) {
+ if ( tcore_util_is_empty(enc_mbi, enc_mbi_len) == TRUE) {
+ err("empty record");
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];
+ 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];
// 5th byte is optional
- if (in_length == 5)
- p_mbi->video_index = p_in[4];
+ if (enc_mbi_len == 5)
+ dec_mbi->video_index = enc_mbi[4];
return TRUE;
}
-gboolean tcore_sim_encode_mbi(char *p_out, int out_length, struct tel_sim_mbi *p_mbi)
+gboolean tcore_sim_decode_cff(unsigned char *enc_cff, int enc_cff_len, TelSimMwis *dec_mwis)
{
- 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 (out_length == 5)
- p_out[4] = p_mbi->video_index;
-
- return TRUE;
-}
-
-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 i, j = 0;
- char *p_out = NULL;
- unsigned char* pTemp = (unsigned char*) cff;
- unsigned char present = 0x0A;
- unsigned char absent = 0x05;
+ int i;
+ unsigned char type = 0;
+ unsigned char mask = 0x01;
- p_out = calloc(SIM_CPHS_CALL_FORWARDING_LEN_MAX+1, 1);
+ 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);
- for (i = 0; i < SIM_CPHS_CALL_FORWARDING_LEN_MAX; i++) {
- present = 0x0A;
- absent = 0x05;
+ memset((void*) dec_mwis, 0, sizeof(TelSimMwis));
+ /* 1st byte is mandatory */
+ type = enc_cff[0];
- for (j = 0; j < 2; j++) {
- if (*pTemp) {
- p_out[i] = p_out[i] | present;
- } else {
- p_out[i] = p_out[i] | absent;
+ 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");
}
- pTemp += sizeof(gboolean);
- present = present << 4;
- absent = absent << 4;
+ mask = mask << 1;
}
}
- p_out[SIM_CPHS_CALL_FORWARDING_LEN_MAX] = '\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; j < SIM_CPHS_CSP_ENTRY_CNT_MAX; i++, j++) {
- p_csp->ServiceProfileEntry[j].CustomerServiceGroup = (enum tel_sim_cphs_csp_group) p_in[i];
- byteSignificance = p_in[++i];
- mask = 0x80;
- switch (p_csp->ServiceProfileEntry[j].CustomerServiceGroup) {
- case 0x01:
- for (k = 0; k < 5; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.CallOffering.bCallForwardingUnconditional = TRUE;
- break;
- case 0x40:
- p_csp->ServiceProfileEntry[j].u.CallOffering.bCallForwardingOnUserBusy = TRUE;
- break;
- case 0x20:
- p_csp->ServiceProfileEntry[j].u.CallOffering.bCallForwardingOnNoReply = TRUE;
- break;
- case 0x10:
- p_csp->ServiceProfileEntry[j].u.CallOffering.bCallForwardingOnUserNotReachable = TRUE;
- break;
- case 0x08:
- p_csp->ServiceProfileEntry[j].u.CallOffering.bCallTransfer = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
- break;
-
- case 0x02:
- for (k = 0; k < 5; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfAllOutgoingCalls = TRUE;
- break;
- case 0x40:
- p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfOutgoingInternationalCalls = TRUE;
- break;
- case 0x20:
- p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfOutgoingInternationalCallsExceptHplmn = TRUE;
- break;
- case 0x10:
- p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfAllIncomingCallsRoamingOutsideHplmn = TRUE;
- break;
- case 0x08:
- p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfIncomingCallsWhenRoaming = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
- break;
-
- case 0x03:
- for (k = 0; k < 5; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bMultiPartyService = TRUE;
- break;
- case 0x40:
- p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bClosedUserGroup = TRUE;
- break;
- case 0x20:
- p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bAdviceOfCharge = TRUE;
- break;
- case 0x10:
- p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bPreferentialClosedUserGroup = TRUE;
- break;
- case 0x08:
- p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bClosedUserGroupOutgoingAccess = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
- break;
-
- case 0x04:
- for (k = 0; k < 4; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.CallComplete.bCallHold = TRUE;
- break;
- case 0x40:
- p_csp->ServiceProfileEntry[j].u.CallComplete.bCallWaiting = TRUE;
- break;
- case 0x20:
- p_csp->ServiceProfileEntry[j].u.CallComplete.bCompletionOfCallToBusySubscriber = TRUE;
- break;
- case 0x10:
- p_csp->ServiceProfileEntry[j].u.CallComplete.bUserUserSignalling = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
- break;
-
- case 0x05:
- for (k = 0; k < 7; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageMobileTerminated = TRUE;
- break;
- case 0x40:
- p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageMobileOriginated = TRUE;
- break;
- case 0x20:
- p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageCellBroadcast = TRUE;
- break;
- case 0x10:
- p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageReplyPath = TRUE;
- break;
- case 0x08:
- p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageDeliveryConf = TRUE;
- break;
- case 0x04:
- p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageProtocolIdentifier = TRUE;
- break;
- case 0x02:
- p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageValidityPeriod = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
- break;
-
- case 0x06:
- for (k = 0; k < 1; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.CphsTeleservices.bAlternativeLineService = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
- break;
-
- case 0x07:
- for (k = 0; k < 1; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.CphsFeatures.bStringServiceTable = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
- break;
-
- case 0x08:
- for (k = 0; k < 8; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bCallingLineIdentificationPresent = TRUE;
- break;
- case 0x20:
- p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bConnectedLineIdentificationRestrict = TRUE;
- break;
- case 0x10:
- p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bConnectedLineIdentificationPresent = TRUE;
- break;
- case 0x08:
- p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bMaliciousCallIdentifier = TRUE;
- break;
- case 0x02:
- p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bCallingLineIdentificationSend = TRUE;
- break;
- case 0x01:
- p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bCallingLineIdentificationBlock = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
- break;
-
- case 0x09:
- for (k = 0; k < 6; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForGprs = TRUE;
- break;
- case 0x40:
- p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForHighSpeedCsd = TRUE;
- break;
- case 0x20:
- p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForVoiceGroupCall = TRUE;
- break;
- case 0x10:
- p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForVoiceBroadcastService = TRUE;
- break;
- case 0x08:
- p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForMultipleSubscriberProfile = TRUE;
- break;
- case 0x04:
- p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForMultipleBand = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
+ /* 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 0xC0:
- for (k = 0; k < 8; k++) {
- switch (byteSignificance & mask) {
- case 0x80:
- p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForManualSelection = TRUE;
- break;
- case 0x40:
- p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForVoiceMail = TRUE;
- break;
- case 0x20:
- p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForMoSmsAndPaging = TRUE;
- break;
- case 0x10:
- p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForMoSmsWithEmialType = TRUE;
- break;
- case 0x08:
- p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForFaxCalls = TRUE;
- break;
- case 0x04:
- p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForDataCalls = TRUE;
- break;
- case 0x01:
- p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForChangeLanguage = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
- }
+ case 0x05:
+ dec_mwis->profile_id = 2;
+ dec_mwis->msg_waiting[1].indication = TRUE;
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->ServiceProfileEntry[j].u.InformationNumbers.bInformationNumbers = TRUE;
- break;
- default:
- break;
- }
- mask = mask >> 1;
+ default:
+ dbg("CFF is NONE");
}
- break;
-
- default:
- break;
+ mask = mask << 1;
+ }
}
}
return TRUE;
}
-gboolean tcore_sim_encode_csp(unsigned char *p_out, int out_length, struct tel_sim_cphs_csp *p_csp)
+gboolean tcore_sim_decode_mwis(unsigned char *enc_mwis, int enc_mwis_len, TelSimMwis *dec_mwis)
{
- 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; j < SIM_CPHS_CSP_ENTRY_CNT_MAX; i++, j++) {
- p_out[i] = (unsigned char) p_csp->ServiceProfileEntry[j].CustomerServiceGroup;
- switch (p_out[i]) {
- case 0x01:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallOffering.bCallForwardingUnconditional) << 7)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallOffering.bCallForwardingOnUserBusy) << 6)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallOffering.bCallForwardingOnNoReply) << 5)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallOffering.bCallForwardingOnUserNotReachable) << 4)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallOffering.bCallTransfer) << 3);
- break;
-
- case 0x02:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfAllOutgoingCalls) << 7)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfOutgoingInternationalCalls) << 6)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfOutgoingInternationalCallsExceptHplmn) << 5)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfAllIncomingCallsRoamingOutsideHplmn) << 4)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallRestriction.bBarringOfIncomingCallsWhenRoaming) << 3);
- break;
-
- case 0x03:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bMultiPartyService) << 7)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bClosedUserGroup) << 6)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bAdviceOfCharge) << 5)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bPreferentialClosedUserGroup) << 4)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.OtherSuppServices.bClosedUserGroupOutgoingAccess) << 3);
- break;
-
- case 0x04:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallComplete.bCallHold) << 7)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallComplete.bCallWaiting) << 6)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallComplete.bCompletionOfCallToBusySubscriber) << 5)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.CallComplete.bUserUserSignalling) << 4);
- break;
-
- case 0x05:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageMobileTerminated) << 7)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageMobileOriginated) << 6)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageCellBroadcast) << 5)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageReplyPath) << 4)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageDeliveryConf) << 3)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageProtocolIdentifier) << 2)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.Teleservices.bShortMessageValidityPeriod) << 1);
- break;
-
- case 0x06:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.CphsTeleservices.bAlternativeLineService) << 7);
- break;
-
- case 0x07:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.CphsFeatures.bStringServiceTable) << 7);
- break;
-
- case 0x08:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bCallingLineIdentificationPresent) << 7)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bConnectedLineIdentificationRestrict) << 5)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bConnectedLineIdentificationPresent) << 4)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bMaliciousCallIdentifier) << 3)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bCallingLineIdentificationSend) << 1)
- + ((unsigned char) p_csp->ServiceProfileEntry[j].u.NumberIdentifiers.bCallingLineIdentificationBlock);
- break;
+ guint i;
+ guchar indicator_status = 0;
+ guchar mask_bit = 0x01;
- case 0x09:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForGprs) << 7)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForHighSpeedCsd) << 6)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForVoiceGroupCall) << 5)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForVoiceBroadcastService) << 4)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForMultipleSubscriberProfile) << 3)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.PhaseServices.bMenuForMultipleBand) << 2);
- break;
+ 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);
- case 0xC0:
- p_out[++i] = (((unsigned char) p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForManualSelection) << 7)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForVoiceMail) << 6)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForMoSmsAndPaging) << 5)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForMoSmsWithEmialType) << 4)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForFaxCalls) << 3)
- + (((unsigned char) p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForDataCalls) << 2)
- + ((unsigned char) p_csp->ServiceProfileEntry[j].u.ValueAddedServices.bRestrictMenuForChangeLanguage);
- break;
+ memset((void*)dec_mwis, 0x0, sizeof(TelSimMwis));
- case 0xD5:
- if (p_csp->ServiceProfileEntry[j].u.InformationNumbers.bInformationNumbers)
- p_out[++i] = 0xFF;
- else
- p_out[++i] = 0x00;
- 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
+ */
+ indicator_status = enc_mwis[0]; //0x07
+ if (indicator_status) {
+ /* Count is valid */
+ dec_mwis->count_valid = TRUE;
+ /*
+ * 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];
+ break;
+ case TEL_SIM_MWIS_VIDEO:
+ dec_mwis->msg_waiting[i].indication = TRUE;
+ dec_mwis->msg_waiting[i].count = enc_mwis[i+1];
+ break;
default:
- break;
+ dbg("MWIS is NONE");
+ }
}
}
+
return TRUE;
}
-gboolean tcore_sim_decode_mwis(struct tel_sim_mw *pMwis, unsigned char *p_in, int in_length)
+gboolean tcore_sim_encode_mwis(const TelSimMwis *mwis, guint field_count,
+ gchar **encoded_mwis, guint *encoded_mwis_len)
{
- int i;
- unsigned char type = 0;
- unsigned char mask = 0x01;
+ gchar *mwis_buf;
+ guint i;
- if (in_length == 0)
- return FALSE;
-
- memset((void*) pMwis, 0, sizeof(struct tel_sim_mw));
-
- type = p_in[0]; //0x07
+ tcore_check_return_value_assert(mwis != NULL, FALSE);
+ tcore_check_return_value_assert(field_count >= 5, FALSE);
- 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;
- }
+ /*
+ * 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);
- pMwis->voice_count = p_in[1];
- pMwis->fax_count = p_in[2];
- pMwis->email_count = p_in[3];
- pMwis->other_count = p_in[4];
+ /*
+ * 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;
- if (in_length == 6)
- pMwis->video_count = p_in[5];
+ /*
+ * 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));
}
- return TRUE;
-}
-
-char* tcore_sim_encode_mwis( int *out_length, const struct tel_sim_mw *pMwis)
-{
- char *p_out = NULL;
-
- if (out_length == 0)
- return FALSE;
-
- p_out = calloc(6,1);
- p_out[0] = (unsigned char) pMwis->indicator_status;
- p_out[1] = pMwis->voice_count;
- p_out[2] = pMwis->fax_count;
- p_out[3] = pMwis->email_count;
- p_out[4] = pMwis->other_count;
- p_out[5] = pMwis->video_count;
+ *encoded_mwis = mwis_buf;
+ *encoded_mwis_len = field_count;
- *out_length = 6;
- return p_out;
+ return TRUE;
}
-gboolean tcore_sim_decode_vmwf(struct tel_sim_cphs_mw *p_vmwf, unsigned char* p_in, unsigned long in_length)
+gboolean tcore_sim_decode_vmwf(unsigned char* enc_vmwf, unsigned long enc_vmwf_len, TelSimMwis *dec_vmwf)
{
int i, j = 0;
- unsigned char* pTemp = (unsigned char*) p_vmwf;
+ unsigned char* temp = (unsigned char*) dec_vmwf;
unsigned char mask = 0x0F;
- unsigned char voiceMsgFlg = 0;
+ unsigned char voice_msg_flg = 0;
- if (in_length == 0){
- dbg("fail - input length is zero");
- return FALSE;
- }
+ 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);
-/* current telephony supports 2 byte cphs-vmwf data*/
- for (i = 0; i < SIM_CPHS_VMWF_LEN_MAX; i++) {
- voiceMsgFlg = p_in[i];
+ /* 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 ((voiceMsgFlg & mask) == 0x0A) {
- *pTemp = 1; //TRUE
- } else if ((voiceMsgFlg & mask) == 0x05) {
- *pTemp = 0; // FALSE
+ if ((voice_msg_flg & mask) == 0x0A) {
+ *temp = 1; //TRUE
+ } else if ((voice_msg_flg & mask) == 0x05) {
+ *temp = 0; // FALSE
}
- pTemp += sizeof(gboolean);
- voiceMsgFlg = voiceMsgFlg >> 4;
+ temp += sizeof(gboolean);
+ voice_msg_flg = voice_msg_flg >> 4;
}
}
- return TRUE;
-}
-char* tcore_sim_encode_vmwf(int *out_length, const struct tel_sim_cphs_mw *p_vmwf)
-{
- int i, j = 0;
- char *p_out = NULL;
- unsigned char* pTemp = (unsigned char*) p_vmwf;
- unsigned char present = 0x0A;
- unsigned char absent = 0x05;
-
- if (out_length == 0)
- return NULL;
-
- p_out = calloc(2,1);
-
- for (i = 0; i < 2; i++) {
- present = 0x0A;
- absent = 0x05;
-
- 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 = 2;
- return p_out;
+ return TRUE;
}
-gboolean tcore_sim_decode_ons(unsigned char* p_out,unsigned char* p_in, int in_length)
+gboolean tcore_sim_decode_ons(unsigned char* enc_ons, int enc_ons_len, unsigned char *dec_ons)
{
int length;
- memset((void*) p_out, 0, SIM_CPHS_OPERATOR_NAME_LEN_MAX+1);
+ memset((void*) dec_ons, 0, TEL_SIM_CPHS_OPERATOR_NAME_LEN_MAX+1);
- if (in_length == 0)
- return FALSE;
+ tcore_check_return_value_assert(enc_ons != NULL, FALSE);
+ tcore_check_return_value_assert(enc_ons_len != 0, FALSE);
- if (_is_empty(p_in, in_length) == TRUE) {
+ if (tcore_util_is_empty(enc_ons, enc_ons_len) == TRUE) {
+ err("empty record");
return FALSE;
}
/* 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;
+ if (enc_ons_len >= TEL_SIM_CPHS_OPERATOR_NAME_LEN_MAX)
+ enc_ons_len = TEL_SIM_CPHS_OPERATOR_NAME_LEN_MAX;
- length = _get_string(p_out, p_in, in_length);
- p_out[length] = '\0';
- dbg( "Operator Name is (%s) & Length (%d) ", p_out, length);
+ 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);
return TRUE;
}
-gboolean tcore_sim_decode_cfis(struct tel_sim_cfis *p_cfis, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_cfis(unsigned char *enc_cfis, int enc_cfis_len, TelSimCfis *dec_cfis)
{
- int bcd_byte; // dialing number max length
- int digit_len;
+ unsigned char type = 0;
+ unsigned char mask = 0x01;
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");
+ 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 (tcore_util_is_empty(enc_cfis, enc_cfis_len) == TRUE) {
+ err("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++];
+ 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 0
// get TON and NPI
- p_cfis->ton = (p_in[++i] >> 4) & 0x07;
- p_cfis->npi = p_in[i++] & 0x0F;
+ 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 = _get_valid_bcd_byte(&p_in[i], SIM_XDN_NUMBER_LEN_MAX / 2);
+ bcd_byte = (int) tcore_util_get_valid_bcd_byte(&enc_cfis[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.
+ 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);
i = i + SIM_XDN_NUMBER_LEN_MAX / 2;
// get Capability/Configuration id
- p_cfis->cc2_id = p_in[i++];
+ p_cfis->cc2_id = enc_cfis[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);
+ 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);
-
- return TRUE;
-}
-
-char* tcore_sim_encode_cfis(int *out_length, const struct tel_sim_cfis *p_cfis)
-{
- char *encoded_o = NULL;
- char bcd[10];
-
- encoded_o = calloc(16, 1); // EF-CFIS record length is 16
- memset(bcd, 0xff, 10);
-
- /*
- 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
- */
- encoded_o[0] = p_cfis->msp_num;
- encoded_o[1] = p_cfis->cfu_status;
-
- 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 0x01:
- p_df->DynamicFlags = SIM_DYNAMIC_FLAGS_LINE1;
- break;
- }
- return TRUE;
-}
-
-gboolean tcore_sim_decode_dynamic2_flag(struct tel_sim_cphs_dflag2 *p_d2f, unsigned char *p_in, int in_length)
-{
- if (in_length == 0)
- return FALSE;
-
- memset((void*) p_d2f, 0, sizeof(struct tel_sim_cphs_dflag2));
-
- switch (p_in[0] & 0x01) {
- case 0x00:
- p_d2f->Dynamic2Flag = SIM_PIN2_ACCESSIBLE_FLAGS_UNLOCKED;
- break;
- case 0x01:
- p_d2f->Dynamic2Flag = SIM_PIN2_ACCESSIBLE_FLAGS_LOCKED;
- break;
- }
- 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_cphs_info(struct tel_sim_cphs_info *pCphsInfo, unsigned char *p_in, int in_length)
-{
- int i, j = 0;
- unsigned char mask = 0x03;
- unsigned char* pTemp = (unsigned char*) &pCphsInfo->CphsServiceTable;
-
- memset((void*) pCphsInfo, 0, sizeof(struct tel_sim_cphs_info));
-
- 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;
- }
- dbg( "Byte (%d), service (%d) ", i+1, *pTemp);
- pTemp += sizeof(gboolean);
- mask = mask << 2;
- }
- }
+*/
return TRUE;
}
-gboolean tcore_sim_decode_short_ons(unsigned char *p_out, unsigned char *p_in, int in_length)
+gboolean tcore_sim_decode_short_ons(unsigned char *enc_short_ons, int enc_short_ons_len, unsigned char *dec_short_ons)
{
int length;
- memset(p_out, 0x00, SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX+1);
+ tcore_check_return_value_assert(enc_short_ons != NULL, FALSE);
+ tcore_check_return_value_assert(enc_short_ons_len != 0, FALSE);
- if (_is_empty(p_in, in_length) == TRUE){
+ 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");
return FALSE; // this is empty record
}
/*CPHS specification shows current EF include 10 bytes */
- if (in_length == 0)
- return FALSE;
+ tcore_check_return_value_assert(enc_short_ons_len != 0, FALSE);
- if(in_length > SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX)
- in_length = SIM_CPHS_OPERATOR_NAME_SHORT_FORM_LEN_MAX;
+ 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;
- length = _get_string( p_out, p_in, in_length );
- p_out[length] = '\0';
- dbg( "Operator short Name is (%s) & length (%d)", p_out, length);
+ 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;
}
-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(unsigned char *enc_opl, int enc_opl_len, TelSimOpl *dec_opl)
{
- int i;
-
- if (in_length == 0)
- return FALSE;
-
- for (i = 0; i < in_length; i++) {
- dbg( " \t0x%04X.", p_in[i]);
- }
-
- if (_is_empty(p_in, in_length) == TRUE) {
- return FALSE; // this is empty record
- }
-
- p_info->AlphaIdLength = p_in[0];
-
- if (p_in[1] & 0x0F)
- p_info->IndexLevelIndicator = (enum tel_sim_cphs_index_level) (p_in[1] & 0x0F);
-
- if (p_in[1] & 0x10)
- p_info->PremiumServiceIndicator = TRUE;
+ unsigned char packet_in_digit[3 * 2 + 1];
- if (p_in[1] & 0x20)
- p_info->PremiumServiceIndicator = TRUE;
+ 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);
- _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_info->Ext1RecordId = p_in[4 + p_info->AlphaIdLength + p_info->DiallingnumLength / 2];
-
- return TRUE;
-}
-
-gboolean tcore_sim_decode_opl(struct tel_sim_opl *p_opl, unsigned char *p_in, int in_length)
-{
- unsigned char packetInDigit[3 * 2 + 1];
-
- if (_is_empty(p_in, in_length) == TRUE) {
- memset(p_opl, 0x00, sizeof(struct tel_sim_opl));
+ if (tcore_util_is_empty(enc_opl, enc_opl_len) == TRUE) {
+ err("empty record");
return FALSE; // this is empty record
}
- _bcd_to_digit((char*) packetInDigit, (char*) &p_in[0], 3);
- dbg( "AFTER _bcd_to_digit 4th[0x%x]", packetInDigit[3]);
+ 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(&p_opl->plmn, &(packetInDigit[0]), 3);
+ memcpy(&dec_opl->plmn, &(packet_in_digit[0]), 3);
// get MNC
- if (packetInDigit[3] == 0x00){
- memcpy(&(p_opl->plmn[3]), &(packetInDigit[3 + 1]), 2);
- p_opl->plmn[5] = '\0';
+ if (packet_in_digit[3] == 0x00){
+ memcpy(&(dec_opl->plmn[3]), &(packet_in_digit[3 + 1]), 2);
+ dec_opl->plmn[5] = '\0';
} else{
- memcpy(&(p_opl->plmn[3]), &(packetInDigit[3]), 3);
- p_opl->plmn[6] = '\0';
+ memcpy(&(dec_opl->plmn[3]), &(packet_in_digit[3]), 3);
+ dec_opl->plmn[6] = '\0';
}
- dbg( " PLMN Code[%s]", p_opl->plmn);
- p_opl->lac_from = (*(p_in+3) << 8) | (*(p_in+4) & 0x00ff);
- dbg( " Start value of the LAC range[%x]", p_opl->lac_from);
- p_opl->lac_to = (*(p_in+5) << 8) | (*(p_in+6) & 0x00ff);
- dbg( " End value of the LAC range[%x]", p_opl->lac_to);
- p_opl->rec_identifier = p_in[7];
- dbg( " PNN Record identifier[%x]", p_opl->rec_identifier);
+ 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(struct tel_sim_pnn *p_pnn, unsigned char* p_in, int in_length)
+gboolean tcore_sim_decode_pnn(unsigned char* enc_pnn, int enc_pnn_len, TelSimPnn *dec_pnn)
{
- int f_name_len = 0, s_name_len = 0;
- int cvt_leng = 0, s_name_base = 0;
+ 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;
- if (_is_empty(p_in, in_length) == TRUE) {
- memset(p_pnn, 0x00, sizeof(struct tel_sim_pnn));
+ 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");
return FALSE; // this is empty record
}
/*Full name for network IEI(Information Element Identifier),0x43*/
- if (p_in[0] == 0x43) {
+ if (enc_pnn[0] == 0x43) {
dbg( " Full name of network IEI exist");
//f_name_part includes information byte.
- f_name_len = (int)p_in[1] - 1;
+ full_name_len = (int)enc_pnn[1] - 1;
/* 3rd byte information element(according to TS 24.008 for Network Name)
8 :ext1
0 1 0 to reserved
1 1 1 to reserved
*/
- if ((p_in[2] & 0x70) >> 4 == 0) {
+ if ((enc_pnn[2] & 0x70) >> 4 == 0) {
dbg( "DCS:GSM7");
// In case of GSM7, 35byte packing data will be converted 40 bytes unpacking string.
- if (f_name_len > (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8)
- f_name_len = (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8;
+ 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;
- _unpack_7bit28bit(p_in + 3, f_name_len, (unsigned char *) (p_pnn->full_name));
- } else if ((p_in[2] & 0x70) >> 4 == 1) {
+ 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) {
dbg( "DCS:UCS2");
/* current telephony supports 40 bytes network name string */
- if (f_name_len > SIM_NW_FULL_NAME_LEN_MAX)
- f_name_len = SIM_NW_FULL_NAME_LEN_MAX;
+ if (full_name_len > TEL_SIM_NW_FULL_NAME_LEN_MAX)
+ full_name_len = TEL_SIM_NW_FULL_NAME_LEN_MAX;
- _ucs2_to_utf8(f_name_len, p_in + 3, (int*) &cvt_leng, (unsigned char *) (p_pnn->full_name));
+ 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);
} else {
dbg( "DCS:unknown");
return FALSE;
}
- dbg( " Full name of network contents[%s]", p_pnn->full_name);
+ dbg( " Full name of network contents[%s]", dec_pnn->full_name);
- s_name_base = (int)p_in[1] +2;
- dbg( " short name base byte [0x%02x]", s_name_base);
+ short_name_base = (int)enc_pnn[1] +2;
+ dbg( " short name base byte [0x%02x]", short_name_base);
/*Short Name for network IEI(Information Element Identifier), 0x45*/
- if (p_in[s_name_base] == 0x45) {
+ if (enc_pnn[short_name_base] == 0x45) {
dbg( " Short name of network IEI exist");
//s_name_part includes information byte.
- s_name_len = p_in[s_name_base +1] -1;
+ short_name_len = enc_pnn[short_name_base +1] -1;
- if ((p_in[s_name_base + 2] & 0x70) >> 4 == 0) {
+ if ((enc_pnn[short_name_base + 2] & 0x70) >> 4 == 0) {
dbg( "DCS:GSM7");
// In case of GSM7, 35byte packing data will be converted 40 bytes unpacking string.
- if (s_name_len > (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8)
- s_name_len = (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8;
+ 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;
- _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) {
+ 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) {
dbg( "DCS:UCS2");
- if (s_name_len > SIM_NW_FULL_NAME_LEN_MAX)
- s_name_len = SIM_NW_FULL_NAME_LEN_MAX;
+ if (short_name_len > TEL_SIM_NW_FULL_NAME_LEN_MAX)
+ short_name_len = TEL_SIM_NW_FULL_NAME_LEN_MAX;
- _ucs2_to_utf8(s_name_len, p_in + s_name_base+ 3, (int*) &cvt_leng, (unsigned char *) (p_pnn->short_name));
+ 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);
} else {
dbg( "DCS:unknown");
return FALSE;
}
- dbg( " Short name of network contents[%s]", p_pnn->short_name);
+ dbg( " Short name of network contents[%s]", dec_pnn->short_name);
}
return TRUE;
}
return FALSE;
}
-gboolean tcore_sim_decode_oplmnwact(struct tel_sim_oplmnwact_list *p_list, unsigned char *p_in, int in_length)
+gboolean tcore_sim_get_status(CoreObject *co, TelSimCardStatus *status)
{
- unsigned long m = 0;
-//unsigned long k, j, m = 0;
-// unsigned char mask = 0x00;
+ PrivateObject *po = NULL;
- //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;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- memset((void*) p_list, 0, sizeof(struct tel_sim_oplmnwact_list));
+ *status = po->sim_status;
- rawOplmnWactCount = in_length / 5;
+ return TRUE;
+}
- dbg( "rawOplmnWactCount[%d]", rawOplmnWactCount);
+gboolean tcore_sim_set_status(CoreObject *co, TelSimCardStatus status)
+{
+ PrivateObject *po = NULL;
- for (i = 0; i < rawOplmnWactCount; i++) {
- unsigned char packetInDigit[3 * 2 + 1];
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- //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;
- }
+ po->sim_status = status;
- _bcd_to_digit((char*) packetInDigit, (char*) &p_in[m], 3);
- dbg( "AFTER _bcd_to_digit 4th[0x%x]", packetInDigit[3]);
-
- // get MCC
- memcpy(&p_list->opwa[i].plmn, &(packetInDigit[0]), 3);
- // get MNC
- if (packetInDigit[3] == 0x00){
- memcpy(&(p_list->opwa[i].plmn[3]), &(packetInDigit[3 + 1]), 2);
- p_list->opwa[i].plmn[5] = '\0';
- } else{
- memcpy(&(p_list->opwa[i].plmn[3]), &(packetInDigit[3]), 3);
- p_list->opwa[i].plmn[6] = '\0';
- }
- dbg( "[%d] OPLMN PLMN Code[%s]", i, p_list->opwa[i].plmn);
+ return TRUE;
+}
- if(p_in[m+3] & 0x80)
- p_list->opwa[i].b_umts = 1;
+gboolean tcore_sim_get_identification(CoreObject *co, TelSimCardChangeStatus *change_status)
+{
+ PrivateObject *po = NULL;
- 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)
+{
+ PrivateObject *po = NULL;
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ po->change_status = change_status;
return TRUE;
}
-enum tel_sim_status tcore_sim_get_status(CoreObject *o)
+gboolean tcore_sim_get_type(CoreObject *co, TelSimCardType *type)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po) {
- dbg("po access fail");
- return -1;
- }
- return po->sim_status;
+ PrivateObject *po = NULL;
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ *type = po->type;
+
+ return TRUE;
}
-gboolean tcore_sim_set_status(CoreObject *o, enum tel_sim_status status)
+gboolean tcore_sim_set_type(CoreObject *co, TelSimCardType type)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po) {
- dbg("po access fail");
- return FALSE;
- }
- po->sim_status = status;
+ PrivateObject *po = NULL;
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ po->type = type;
return TRUE;
}
-gboolean tcore_sim_get_identification(CoreObject *o)
+gboolean tcore_sim_get_imsi(CoreObject *co, TelSimImsiInfo **imsi)
{
- 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;
+ 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));
+
+ return TRUE;
}
-gboolean tcore_sim_set_identification(CoreObject *o, gboolean b_changed)
+gboolean tcore_sim_set_imsi(CoreObject *co, TelSimImsiInfo *imsi)
{
- 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;
+ PrivateObject *po = NULL;
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ memcpy(&po->imsi, imsi, sizeof(TelSimImsiInfo));
return TRUE;
}
-enum tel_sim_type tcore_sim_get_type(CoreObject *o)
+gboolean tcore_sim_get_service_table(CoreObject *co, TelSimServiceTable **svct)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po) {
- dbg("po access fail");
- return -1;
- }
- return po->type;
+ PrivateObject *po = NULL;
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ *svct = (TelSimServiceTable *)tcore_memdup((gconstpointer)&po->svct, sizeof(TelSimServiceTable));
+
+ return TRUE;
}
-gboolean tcore_sim_set_type(CoreObject *o, enum tel_sim_type type)
+gboolean tcore_sim_set_service_table(CoreObject *co, TelSimServiceTable *svct)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po) {
- dbg("po access fail");
- return FALSE;
- }
- po->type = type;
+ PrivateObject *po = NULL;
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ memcpy(&po->svct, svct, sizeof(TelSimServiceTable));
+
return TRUE;
}
-struct tel_sim_imsi* tcore_sim_get_imsi(CoreObject *o)
+gboolean tcore_sim_get_cphs_status(CoreObject *co, gboolean *is_supported)
{
- 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;
+ PrivateObject *po = NULL;
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ *is_supported = po->is_cphs;
+
+ return TRUE;
}
-gboolean tcore_sim_set_imsi(CoreObject *o, struct tel_sim_imsi *imsi)
+gboolean tcore_sim_set_cphs_status(CoreObject *co, gboolean is_supported)
{
- 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));
+ PrivateObject *po = NULL;
+
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ po->is_cphs = is_supported;
+
return TRUE;
}
-struct tel_sim_service_table* tcore_sim_get_service_table(CoreObject *o)
+gboolean tcore_sim_get_spn(CoreObject *co, gchar **spn)
{
- 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;
- }
- tmp_svct = calloc(1, sizeof(struct tel_sim_service_table));
- memcpy(tmp_svct, &po->svct, sizeof(struct tel_sim_service_table));
- return tmp_svct;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(spn != NULL, FALSE);
+
+ *spn = tcore_strdup(po->spn);
+
+ return TRUE;
}
-gboolean tcore_sim_set_service_table(CoreObject *o, struct tel_sim_service_table *svct)
+gboolean tcore_sim_set_spn(CoreObject *co, gchar *spn)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po) {
- dbg("po access fail");
- return FALSE;
- }
- memcpy(&po->svct, svct, sizeof(struct tel_sim_service_table));
+ 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;
}
-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_get_disp_condition(CoreObject *co,
+ TelSimSpnDispCondition *disp_condition)
+{
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(disp_condition != NULL, FALSE);
+
+ *disp_condition = po->disp_condition;
+
+ return TRUE;
}
-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;
+gboolean tcore_sim_set_disp_condition(CoreObject *co,
+ TelSimSpnDispCondition disp_condition)
+{
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
+ po->disp_condition = disp_condition;
+
return TRUE;
}
-gboolean tcore_sim_link_userdata(CoreObject *o, void *userdata)
+gboolean tcore_sim_link_userdata(CoreObject *co, void *userdata)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po) {
- dbg("po access fail");
- return FALSE;
- }
+ PrivateObject *po = NULL;
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+
po->userdata = userdata;
+
return TRUE;
}
-void* tcore_sim_ref_userdata(CoreObject *o)
+void* tcore_sim_ref_userdata(CoreObject *co)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po || !po->userdata) {
- dbg("po access fail");
- return NULL;
- }
+ 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);
+
return po->userdata;
}
-static void tcore_sim_initialize_context(CoreObject *o)
+static void tcore_sim_initialize_context(CoreObject *co)
{
- 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;
- }
+ 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(struct private_object_data));
+ memset(po, 0x00, sizeof(PrivateObject));
po->ops = tmp_ops;
- po->sim_status = SIM_STATUS_UNKNOWN;
+ po->sim_status = TEL_SIM_STATUS_UNKNOWN;
}
-void tcore_sim_override_ops(CoreObject *o, struct tcore_sim_operations *sim_ops)
+void tcore_sim_override_ops(CoreObject *co, TcoreSimOps *sim_ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = NULL;
+ po = (PrivateObject *)tcore_object_ref_object(co);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SIM);
+ tcore_check_return_assert(po != NULL);
+ tcore_check_return_assert(po->ops != NULL);
+ tcore_check_return_assert(sim_ops != NULL);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
- }
+ if (sim_ops->get_ecc)
+ po->ops->get_ecc = sim_ops->get_ecc;
- if(sim_ops) {
- _clone_sim_operations(po, sim_ops);
- }
+ if (sim_ops->get_iccid)
+ po->ops->get_iccid = sim_ops->get_iccid;
- return;
-}
+ if (sim_ops->get_language)
+ po->ops->get_language = sim_ops->get_language;
-CoreObject *tcore_sim_new(TcorePlugin *p,
- struct tcore_sim_operations *ops, TcoreHal *hal)
-{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
+ if (sim_ops->set_language)
+ po->ops->set_language = sim_ops->set_language;
- if (!p)
- return NULL;
+ if (sim_ops->get_callforwarding_info)
+ po->ops->get_callforwarding_info = sim_ops->get_callforwarding_info;
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
+ if (sim_ops->get_messagewaiting_info)
+ po->ops->get_messagewaiting_info = sim_ops->get_messagewaiting_info;
- po = calloc(1, sizeof(struct private_object_data));
- if (!po) {
- tcore_object_free(o);
- return NULL;
- }
+ if (sim_ops->set_messagewaiting_info)
+ po->ops->set_messagewaiting_info = sim_ops->set_messagewaiting_info;
+
+ if (sim_ops->get_mailbox_info)
+ po->ops->get_mailbox_info = sim_ops->get_mailbox_info;
+
+ if (sim_ops->set_mailbox_info)
+ po->ops->set_mailbox_info = sim_ops->set_mailbox_info;
- po->ops = ops;
+ if (sim_ops->get_msisdn)
+ po->ops->get_msisdn = sim_ops->get_msisdn;
- 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);
+ if (sim_ops->get_spn)
+ po->ops->get_spn = sim_ops->get_spn;
- tcore_sim_initialize_context(o);
+ if (sim_ops->get_cphs_netname)
+ po->ops->get_cphs_netname = sim_ops->get_cphs_netname;
+
+ if (sim_ops->get_sp_display_info)
+ po->ops->get_sp_display_info = sim_ops->get_sp_display_info;
+
+ if (sim_ops->req_authentication)
+ po->ops->req_authentication = sim_ops->req_authentication;
+
+ if (sim_ops->verify_pins)
+ po->ops->verify_pins = sim_ops->verify_pins;
+
+ if (sim_ops->verify_puks)
+ po->ops->verify_puks = sim_ops->verify_puks;
+
+ if (sim_ops->change_pins)
+ po->ops->change_pins = sim_ops->change_pins;
- return o;
+ if (sim_ops->disable_facility)
+ po->ops->disable_facility = sim_ops->disable_facility;
+
+ if (sim_ops->enable_facility)
+ po->ops->enable_facility = sim_ops->enable_facility;
+
+ if (sim_ops->get_facility)
+ po->ops->get_facility = sim_ops->get_facility;
+
+ if (sim_ops->get_lock_info)
+ po->ops->get_lock_info = sim_ops->get_lock_info;
+
+ if (sim_ops->req_apdu)
+ po->ops->req_apdu = sim_ops->req_apdu;
+
+ if (sim_ops->req_atr)
+ po->ops->req_atr = sim_ops->req_atr;
}
-void tcore_sim_free(CoreObject *o)
+gboolean tcore_sim_set_ops(CoreObject *co, TcoreSimOps *ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SIM);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po = tcore_object_ref_object(o);
- if (!po)
- return;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
+ }
- free(po);
- tcore_object_free(o);
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSimOps));
+
+ return TRUE;
+}
+
+CoreObject *tcore_sim_new(TcorePlugin *p,
+ TcoreSimOps *ops, TcoreHal *hal)
+{
+ 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);
+
+ po = tcore_malloc0(sizeof(PrivateObject));
+ po->ops = tcore_memdup(ops, sizeof(TcoreSimOps));
+
+ 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(co);
+
+ return co;
+}
+
+void tcore_sim_free(CoreObject *co)
+{
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SIM);
+ tcore_object_free(co);
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* 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"
-struct private_object_data {
- struct tcore_sms_operations *ops;
- gboolean b_readyStatus;
-};
+typedef struct {
+ TcoreSmsOps *ops;
+ gboolean ready_status;
+} PrivateObject;
-/**
- * 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)
+static TelReturn _dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, const void *user_data)
{
- 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;
- }
-
- //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);
+ 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;
}
+ sms = po->ops;
- 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 _clone_sms_operations(struct private_object_data *po,
- struct tcore_sms_operations *sms_ops)
-{
- if (sms_ops->send_umts_msg)
- po->ops->send_umts_msg = sms_ops->send_umts_msg;
-
- if (sms_ops->read_msg)
- po->ops->read_msg = sms_ops->read_msg;
-
- if (sms_ops->save_msg)
- po->ops->save_msg = sms_ops->save_msg;
-
- if (sms_ops->delete_msg)
- po->ops->delete_msg = sms_ops->delete_msg;
-
- if (sms_ops->get_stored_msg_cnt)
- po->ops->get_stored_msg_cnt = sms_ops->get_stored_msg_cnt;
-
- if (sms_ops->get_sca)
- po->ops->get_sca = sms_ops->get_sca;
-
- if (sms_ops->set_sca)
- po->ops->set_sca = sms_ops->set_sca;
-
- if (sms_ops->get_cb_config)
- po->ops->get_cb_config = sms_ops->get_cb_config;
-
- if (sms_ops->set_cb_config)
- po->ops->set_cb_config = sms_ops->set_cb_config;
-
- if (sms_ops->set_mem_status)
- po->ops->set_mem_status = sms_ops->set_mem_status;
-
- if (sms_ops->get_pref_brearer)
- po->ops->get_pref_brearer = sms_ops->get_pref_brearer;
-
- if (sms_ops->set_pref_brearer)
- po->ops->set_pref_brearer = sms_ops->set_pref_brearer;
-
- if (sms_ops->set_delivery_report)
- po->ops->set_delivery_report = sms_ops->set_delivery_report;
-
- if (sms_ops->set_msg_status)
- po->ops->set_msg_status = sms_ops->set_msg_status;
-
- if (sms_ops->get_sms_params)
- po->ops->get_sms_params = sms_ops->get_sms_params;
-
- if (sms_ops->set_sms_params)
- po->ops->set_sms_params = sms_ops->set_sms_params;
-
- if (sms_ops->get_paramcnt)
- po->ops->get_paramcnt = sms_ops->get_paramcnt;
-
- if (sms_ops->send_cdma_msg)
- po->ops->send_cdma_msg = sms_ops->send_cdma_msg;
-
- return;
-}
-
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
-{
- enum tcore_request_command command;
- struct private_object_data *po;
- TReturn rtn = TCORE_RETURN_SUCCESS;
-
- CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_SMS, TCORE_RETURN_EINVAL);
-
- po = tcore_object_ref_object(o);
- if (NULL == po || NULL == po->ops) {
- dbg("[tcore_SMS] ERR: private_object is NULL or ops is NULL");
- return TCORE_RETURN_ENOSYS;
- }
-
- if(po->b_readyStatus == FALSE) {
- dbg("[tcore_SMS] DEVICE_NOT_READY");
- return TCORE_RETURN_ENOSYS;
- }
-
- command = tcore_user_request_get_command(ur);
switch (command) {
- case TREQ_SMS_SEND_UMTS_MSG:
- if (NULL == 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);
-
+ case TCORE_COMMAND_SMS_SEND_SMS:
+ if (sms->send_sms)
+ return sms->send_sms(co,
+ (const TelSmsSendInfo *)request,
+ cb,(void *)user_data);
break;
- case TREQ_SMS_READ_MSG:
- if (NULL == 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);
-
+ 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 TREQ_SMS_SAVE_MSG:
- if (NULL == 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);
-
+ 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 TREQ_SMS_DELETE_MSG:
- if (NULL == 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);
-
+ 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 TREQ_SMS_GET_COUNT:
- if (NULL == po->ops->get_stored_msg_cnt) {
- dbg("[tcore_SMS] ERR: po->ops->get_stored_msg_cnt is"
- "NULL");
- return TCORE_RETURN_ENOSYS;
- }
-
- rtn = po->ops->get_stored_msg_cnt(o, ur);
-
+ case TCORE_COMMAND_SMS_GET_COUNT:
+ if (sms->get_count)
+ return sms->get_count(co, cb, (void *)user_data);
break;
- case TREQ_SMS_GET_SCA:
- if (NULL == 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 (NULL == 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 (NULL == 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);
-
+ 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 TREQ_SMS_SET_CB_CONFIG:
- if (NULL == 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);
-
+ case TCORE_COMMAND_SMS_GET_CB_CONFIG:
+ if (sms->get_cb_config)
+ return sms->get_cb_config(co, cb, (void *)user_data);
break;
- case TREQ_SMS_SET_MEM_STATUS:
- if (NULL == 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);
-
+ case TCORE_COMMAND_SMS_GET_PARAMETERS:
+ if (sms->get_parameters)
+ return sms->get_parameters(co, cb, (void *)user_data);
break;
- case TREQ_SMS_GET_PREF_BEARER:
- if (NULL == 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);
-
+ case TCORE_COMMAND_SMS_SET_PARAMETERS:
+ if (sms->set_parameters)
+ return sms->set_parameters(co,
+ (const TelSmsParamsInfo *)request,
+ cb, (void *)user_data);
break;
- case TREQ_SMS_SET_PREF_BEARER:
- if (NULL == 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);
-
+ 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 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);
-
+ case TCORE_COMMAND_SMS_SET_SCA:
+ if (sms->set_sca)
+ return sms->set_sca(co,
+ (const TelSmsSca *)request,
+ cb, (void *)user_data);
break;
- case TREQ_SMS_SET_MSG_STATUS:
- if (NULL == 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);
-
+ case TCORE_COMMAND_SMS_GET_SCA:
+ if (sms->get_sca)
+ return sms->get_sca(co, cb, (void *)user_data);
break;
- case TREQ_SMS_GET_PARAMS:
- if (NULL == 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);
-
+ 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 TREQ_SMS_SET_PARAMS:
- if (NULL == 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 (NULL == 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 (NULL == 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);
-
+ 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:
- break;
+ err("Unsupported command:[%d]",command);
+ return TEL_RETURN_INVALID_PARAMETER;
}
-
- dbg("[tcore_SMS] result = [0x%x], command = [0x%x]", rtn, command);
-
- return rtn;
+ err("Operation NOT Supported");
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
}
-static void _free_hook(CoreObject *o)
+static void _po_free_hook(CoreObject *co)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SMS);
-
- po = tcore_object_ref_object(o);
- if (po) {
- free(po);
- tcore_object_link_object(o, NULL);
- }
+ tcore_check_return(po != NULL);
+ tcore_free(po->ops);
+ tcore_free(po);
+ tcore_object_link_object(co, NULL);
}
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void _po_clone_hook(CoreObject *src, CoreObject *dest)
{
- struct private_object_data *src_po = NULL;
- struct private_object_data *dest_po = NULL;
+ PrivateObject *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;
+ 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);
+ dest_po = tcore_malloc0(sizeof(PrivateObject));
+ dest_po->ops = tcore_memdup(src_po->ops, sizeof(TcoreSmsOps));
tcore_object_link_object(dest, dest_po);
}
-gboolean tcore_sms_get_ready_status(CoreObject *o)
+gboolean tcore_sms_get_ready_status(CoreObject *co, gboolean *status)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po) {
- dbg("po access fail");
- return FALSE;
- }
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ tcore_check_return_value_assert(status != NULL, FALSE);
- return po->b_readyStatus;
+ *status = po->ready_status;
+ return TRUE;
}
-gboolean tcore_sms_set_ready_status(CoreObject *o, int status)
+gboolean tcore_sms_set_ready_status(CoreObject *co, gboolean status)
{
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
- if (!po) {
- dbg("po access fail");
- return FALSE;
- }
-
- po->b_readyStatus = status;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
+ po->ready_status = status;
return TRUE;
}
-void tcore_sms_override_ops(CoreObject *o, struct tcore_sms_operations *sms_ops)
+void tcore_sms_override_ops(CoreObject *co, TcoreSmsOps *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 (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;
+}
+
+gboolean tcore_sms_set_ops(CoreObject *co, TcoreSmsOps *ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SMS);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- if(sms_ops) {
- _clone_sms_operations(po, sms_ops);
- }
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSmsOps));
- return;
+ return TRUE;
}
CoreObject *tcore_sms_new(TcorePlugin *p,
- struct tcore_sms_operations *ops, TcoreHal *hal)
+ TcoreSmsOps *ops, TcoreHal *hal)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
+ tcore_check_return_value_assert(p != NULL, NULL);
- if (!p)
- return NULL;
+ co = tcore_object_new(p, hal);
+ tcore_check_return_value_assert(co != NULL, NULL);
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
+ po = tcore_malloc0(sizeof(PrivateObject));
- po = calloc(1, sizeof(struct private_object_data));
- if (!po) {
- tcore_object_free(o);
- return NULL;
- }
-
- po->ops = ops;
+ if (ops != NULL)
+ po->ops = tcore_memdup(ops, sizeof(TcoreSmsOps));
- 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);
-
- 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)
+void tcore_sms_free(CoreObject *co)
{
- struct private_object_data *po = NULL;
-
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SMS);
-
- po = tcore_object_ref_object(o);
- if (!po)
- return;
-
- free(po);
- tcore_object_free(o);
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SMS);
+ tcore_object_free(co);
}
-
-
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
* limitations under the License.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include <glib.h>
+#include <string.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;
- enum tcore_ss_ussd_type type;
- void* data;
- int data_len;
+ TelSsUssdType type;
+ void *data;
+ guint data_len;
};
-struct private_object_data {
- struct ussd_session ussd_s;
- struct tcore_ss_operations *ops;
-};
-
-static void _clone_ss_operations(struct private_object_data *po, struct tcore_ss_operations *ss_ops)
-{
- if(ss_ops->barring_activate) {
- po->ops->barring_activate = ss_ops->barring_activate;
- }
- if(ss_ops->barring_deactivate) {
- po->ops->barring_deactivate = ss_ops->barring_deactivate;
- }
- if(ss_ops->barring_change_password) {
- po->ops->barring_change_password = ss_ops->barring_change_password;
- }
- if(ss_ops->barring_get_status) {
- po->ops->barring_get_status = ss_ops->barring_get_status;
- }
- if(ss_ops->forwarding_activate) {
- po->ops->forwarding_activate = ss_ops->forwarding_activate;
- }
- if(ss_ops->forwarding_deactivate) {
- po->ops->forwarding_deactivate = ss_ops->forwarding_deactivate;
- }
- if(ss_ops->forwarding_register) {
- po->ops->forwarding_register = ss_ops->forwarding_register;
- }
- if(ss_ops->forwarding_deregister) {
- po->ops->forwarding_deregister = ss_ops->forwarding_deregister;
- }
- if(ss_ops->forwarding_get_status) {
- po->ops->forwarding_get_status = ss_ops->forwarding_get_status;
- }
- if(ss_ops->waiting_activate) {
- po->ops->waiting_activate = ss_ops->waiting_activate;
- }
- if(ss_ops->waiting_deactivate) {
- po->ops->waiting_deactivate = ss_ops->waiting_deactivate;
- }
- if(ss_ops->waiting_get_status) {
- po->ops->waiting_get_status = ss_ops->waiting_get_status;
- }
- if(ss_ops->cli_activate) {
- po->ops->cli_activate = ss_ops->cli_activate;
- }
- if(ss_ops->cli_deactivate) {
- po->ops->cli_deactivate = ss_ops->cli_deactivate;
- }
- if(ss_ops->cli_get_status) {
- po->ops->cli_get_status = ss_ops->cli_get_status;
- }
- if(ss_ops->send_ussd) {
- po->ops->send_ussd = ss_ops->send_ussd;
- }
- if(ss_ops->set_aoc) {
- po->ops->set_aoc = ss_ops->set_aoc;
- }
- if(ss_ops->get_aoc) {
- po->ops->get_aoc = ss_ops->get_aoc;
- }
-
- return;
-}
+typedef struct {
+ UssdSession ussd_s;
+ TcoreSsOps *ops;
+} PrivateObject;
-static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
+static TelReturn _dispatcher(CoreObject *co,
+ TcoreCommand command, const void *request,
+ TcoreObjectResponseCallback cb, const void *user_data)
{
- enum tcore_request_command command;
- TReturn ret = 0;
-
- struct private_object_data *po = NULL;
- po = tcore_object_ref_object(o);
+ 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);
- _check_null( "po", po, TCORE_RETURN_FAILURE);
- _check_null( "po->ops", po->ops, TCORE_RETURN_FAILURE);
- _check_null( "ur", ur, TCORE_RETURN_FAILURE);
+ ss = po->ops;
- command = tcore_user_request_get_command(ur);
switch (command) {
- case TREQ_SS_BARRING_ACTIVATE:
- ret = po->ops->barring_activate(o, ur);
- break;
-
- case TREQ_SS_BARRING_DEACTIVATE:
- ret = po->ops->barring_deactivate(o, ur);
- break;
-
- case TREQ_SS_BARRING_CHANGE_PASSWORD:
- ret = po->ops->barring_change_password(o, ur);
- break;
-
- case TREQ_SS_BARRING_GET_STATUS:
- ret = po->ops->barring_get_status(o, ur);
- break;
-
- case TREQ_SS_FORWARDING_ACTIVATE:
- ret = po->ops->forwarding_activate(o, ur);
- break;
-
- case TREQ_SS_FORWARDING_DEACTIVATE:
- ret = po->ops->forwarding_deactivate(o, ur);
- break;
-
- case TREQ_SS_FORWARDING_REGISTER:
- ret = po->ops->forwarding_register(o, ur);
- break;
-
- case TREQ_SS_FORWARDING_DEREGISTER:
- ret = po->ops->forwarding_deregister(o, ur);
- break;
-
- case TREQ_SS_FORWARDING_GET_STATUS:
- ret = po->ops->forwarding_get_status(o, ur);
- break;
-
- case TREQ_SS_WAITING_ACTIVATE:
- ret = po->ops->waiting_activate(o, ur);
- break;
-
- case TREQ_SS_WAITING_DEACTIVATE:
- ret = po->ops->waiting_deactivate(o, ur);
- break;
-
- case TREQ_SS_WAITING_GET_STATUS:
- ret = po->ops->waiting_get_status(o, ur);
- break;
-
- case TREQ_SS_CLI_ACTIVATE:
- ret = po->ops->cli_activate(o, ur);
- break;
-
- case TREQ_SS_CLI_DEACTIVATE:
- ret = po->ops->cli_deactivate(o, ur);
- break;
-
- case TREQ_SS_CLI_GET_STATUS:
- ret = po->ops->cli_get_status(o, ur);
- break;
-
- case TREQ_SS_SEND_USSD:
- ret = po->ops->send_ussd(o, ur);
- break;
-
- case TREQ_SS_SET_AOC:
- ret = po->ops->set_aoc(o, ur);
- break;
-
- case TREQ_SS_GET_AOC:
- ret = po->ops->get_aoc(o, ur);
- break;
-
- default:
- break;
- }
-
- return ret;
+ 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;
+ }
+
+ err("Operation NOT Supported, Command: [0x%x]", command);
+ return TEL_RETURN_OPERATION_NOT_SUPPORTED;
}
-static void _clone_hook(CoreObject *src, CoreObject *dest)
+static void _po_clone_hook(CoreObject *src, CoreObject *dest)
{
- struct private_object_data *src_po = NULL;
- struct private_object_data *dest_po = NULL;
+ PrivateObject *dest_po = NULL;
+ PrivateObject *src_po = tcore_object_ref_object(src);
- 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_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(TcoreSsOps));
tcore_object_link_object(dest, dest_po);
}
-static void _free_hook(CoreObject *o)
+static void _po_free_hook(CoreObject *co)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
- po = tcore_object_ref_object(o);
- if (!po)
- return;
-
- free(po);
- tcore_object_link_object(o, NULL);
-}
+ tcore_check_return(po != NULL);
-static void _ussd_session_init(struct ussd_session *ussd_s)
-{
- ussd_s->session = FALSE;
- ussd_s->type = 0;
- ussd_s->data = 0;
- ussd_s->data_len = 0;
+ tcore_free(po->ops);
+ tcore_free(po);
+ tcore_object_link_object(co, NULL);
}
-struct ussd_session* tcore_ss_ussd_create_session(CoreObject *o,
- enum tcore_ss_ussd_type type, void *data, int data_len)
+UssdSession *tcore_ss_ussd_create_session(CoreObject *co,
+ TelSsUssdType type, void *data, guint data_len)
{
- struct private_object_data *po = NULL;
-
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, NULL);
- 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 (type > TEL_SS_USSD_TYPE_USER_REL) {
+ err("USSD type is Invalid");
+ return NULL;
}
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;
-
- }
- else {
- dbg("[ error ] already exist ussd session, type : (0x%x)", po->ussd_s.type);
- return 0;
}
+
+ warn("USSD session already exists, type: [%d]", po->ussd_s.type);
+ return NULL;
}
-void tcore_ss_ussd_destroy_session(struct ussd_session *ussd_s)
+void tcore_ss_ussd_destroy_session(UssdSession *ussd_s)
{
- if (!ussd_s || !ussd_s->session) {
- return;
- }
- else {
+ tcore_check_return_assert(ussd_s != NULL);
- _ussd_session_init(ussd_s);
- }
+ memset(ussd_s, 0x00, sizeof(UssdSession));
}
-struct ussd_session* tcore_ss_ussd_get_session(CoreObject *o)
+UssdSession *tcore_ss_ussd_get_session(CoreObject *co)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, NULL);
- po = tcore_object_ref_object(o);
- if (!po)
- return 0;
-
- if (!po->ussd_s.session)
- return 0;
- else
+ if (po->ussd_s.session)
return &po->ussd_s;
+
+ err("ussd session does not exist");
+ return NULL;
}
-enum tcore_ss_ussd_type tcore_ss_ussd_get_session_type(struct ussd_session *ussd_s)
+gboolean tcore_ss_ussd_get_session_type(UssdSession *ussd_s,
+ TelSsUssdType *ussd_type)
{
- if (!ussd_s || !ussd_s->session) {
- dbg("[ error ] there is no session");
- return 0;
+ tcore_check_return_value_assert(ussd_s != NULL, FALSE);
+ tcore_check_return_value_assert(ussd_type != NULL, FALSE);
+ if (ussd_s->session) {
+ *ussd_type = ussd_s->type;
+ return TRUE;
}
- else {
- return ussd_s->type;
- }
+
+ err("ussd session does not exist");
+ return FALSE;
}
-void tcore_ss_ussd_set_session_type(struct ussd_session* ussd_s,
- enum tcore_ss_ussd_type type)
+gboolean tcore_ss_ussd_set_session_type(UssdSession *ussd_s,
+ TelSsUssdType type)
{
- if (!ussd_s || !ussd_s->session) {
- dbg("[ error ] there is no session");
- return;
+ tcore_check_return_value_assert(ussd_s != NULL, FALSE);
- }
- else {
+ if (ussd_s->session) {
ussd_s->type = type;
+ return TRUE;
}
+
+ err("ussd session does not exist");
+ return FALSE;
}
-int tcore_ss_ussd_get_session_data(struct ussd_session* ussd_s, void **data)
+gboolean tcore_ss_ussd_get_session_data(UssdSession *ussd_s,
+ void **data, guint *data_len)
{
- if (!ussd_s || !ussd_s->session) {
- dbg("[ error ] there is no session");
- return -1;
-
- }
- else {
+ 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->session) {
*data = ussd_s->data;
- return ussd_s->data_len;
+ *data_len = ussd_s->data_len;
+ return TRUE;
}
+
+ err("ussd session does not exist");
+ return FALSE;
}
-void tcore_ss_ussd_set_session_data(struct ussd_session* ussd_s,
- void* data, int data_len)
+gboolean tcore_ss_ussd_set_session_data(UssdSession *ussd_s,
+ void *data, guint data_len)
{
- if (!ussd_s || !ussd_s->session) {
- dbg("[ error ] there is no session");
- return ;
-
- }
- else {
+ tcore_check_return_value_assert(ussd_s != NULL, FALSE);
+ 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;
}
-void tcore_ss_override_ops(CoreObject *o, struct tcore_ss_operations *ss_ops)
+gboolean tcore_ss_set_ops(CoreObject *co, TcoreSsOps *ops)
{
- struct private_object_data *po = NULL;
+ PrivateObject *po;
+ tcore_check_return_value(co != NULL, FALSE);
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SS);
+ po = tcore_object_ref_object(co);
+ tcore_check_return_value_assert(po != NULL, FALSE);
- po = (struct private_object_data *)tcore_object_ref_object(o);
- if (!po) {
- return;
+ if (po->ops != NULL) {
+ tcore_free(po->ops);
+ po->ops = NULL;
}
- if(ss_ops) {
- _clone_ss_operations(po, ss_ops);
- }
+ if (ops != NULL)
+ po->ops = tcore_memdup((gconstpointer)ops, sizeof(TcoreSsOps));
- return;
+ return TRUE;
}
-CoreObject *tcore_ss_new(TcorePlugin *p,
- struct tcore_ss_operations *ops, TcoreHal *hal)
+CoreObject *tcore_ss_new(TcorePlugin *p, TcoreSsOps *ops, TcoreHal *hal)
{
- CoreObject *o = NULL;
- struct private_object_data *po = NULL;
+ CoreObject *co = NULL;
+ PrivateObject *po = NULL;
+ tcore_check_return_value_assert(p != NULL, NULL);
- if (!p)
- return NULL;
+ co = tcore_object_new(p, hal);
+ tcore_check_return_value_assert(co != NULL, NULL);
- o = tcore_object_new(p, hal);
- if (!o)
- return NULL;
+ po = tcore_malloc0(sizeof(PrivateObject));
- po = calloc(1, sizeof(struct private_object_data));
- if (!po) {
- tcore_object_free(o);
- return NULL;
- }
-
- po->ops = ops;
-
- _ussd_session_init(&po->ussd_s);
+ if (ops != NULL)
+ po->ops = tcore_memdup(ops, sizeof(TcoreSsOps));
- 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;
+ 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;
}
-void tcore_ss_free(CoreObject *o)
+void tcore_ss_free(CoreObject *co)
{
- CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SS);
-
- tcore_object_free(o);
+ CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_SS);
+ tcore_object_free(co);
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include "communicator.h"
struct tcore_communicator_type {
- const char *name;
- struct tcore_communitor_operations *ops;
+ gchar *name;
+ TcoreCommunicatorOps *ops;
void *user_data;
};
-Communicator* tcore_communicator_new(TcorePlugin *plugin, const char *name,
- struct tcore_communitor_operations *ops)
+Communicator* tcore_communicator_new(TcorePlugin *plugin,
+ const gchar *name, TcoreCommunicatorOps *ops)
{
Communicator *comm;
- comm = calloc(1, sizeof(struct tcore_communicator_type));
- if (!comm)
+ comm = g_try_new0(struct tcore_communicator_type, 1);
+ if (comm == NULL) {
+ err("Failed to allocate memory");
return NULL;
+ }
- if (name)
- comm->name = strdup(name);
-
+ /* Update parameters */
+ comm->name = tcore_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;
void tcore_communicator_free(Communicator *comm)
{
- if (!comm)
+ if (comm == NULL) {
+ err("Communicator is NULL");
return;
+ }
- if (comm->name)
- free((void *)comm->name);
+ dbg("Comunicator '%s' free", comm->name);
- free(comm);
+ /* Free resources */
+ tcore_free((void *)comm->name);
+ tcore_free(comm);
}
TcorePlugin *tcore_communicator_ref_plugin(Communicator *comm)
{
- if (!comm)
+ if (comm == NULL) {
+ err("Communicator is NULL");
return NULL;
+ }
return comm->parent_plugin;
}
-const char *tcore_communicator_ref_name(Communicator *comm)
+const gchar *tcore_communicator_ref_name(Communicator *comm)
{
- if (!comm)
+ if (comm == NULL) {
+ err("Communicator is NULL");
return NULL;
+ }
return comm->name;
}
-TReturn tcore_communicator_link_user_data(Communicator *comm, void *data)
+TelReturn tcore_communicator_link_user_data(Communicator *comm, void *data)
{
- if (!comm)
- return TCORE_RETURN_EINVAL;
+ if (comm == NULL) {
+ err("Communicator is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
comm->user_data = data;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
void *tcore_communicator_ref_user_data(Communicator *comm)
{
- if (!comm)
+ if (comm == NULL) {
+ err("Communicator is NULL");
return NULL;
+ }
return comm->user_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)
+TelReturn tcore_communicator_send_notification(Communicator *comm,
+ TcorePlugin *source, gint command, guint data_len, const void *data)
{
- if (!comm || !comm->ops || !comm->ops->send_notification)
- return TCORE_RETURN_EINVAL;
+ 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;
+ }
return comm->ops->send_notification(comm, source, command, data_len, data);
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include "co_phonebook.h"
#include "co_gps.h"
-#define INIT_CORE_OBJECT(initializer, plugin, type, hal) do { \
- if (initializer != NULL) { \
- co = tcore_object_clone_template_object(plugin, type); \
- if (co == NULL) { \
- break; \
- } \
- \
- tcore_object_set_hal(co, hal); \
- \
- ret = initializer(plugin, co); \
- } \
-} while(0);
-
-#define DEINIT_CORE_OBJECT(deinitializer, plugin, type) do { \
- if (deinitializer != NULL) { \
- /* Assuming only one Core Object is present of a specific TYPE */ \
- co = tcore_plugin_ref_core_object(plugin, type); \
- if (co == NULL) { \
- break; \
- } \
- \
- deinitializer(plugin, co); \
- \
- tcore_object_free(co); \
- } \
-} while(0);
-
-
struct callback_type {
CoreObject *co;
- char *event;
- tcore_object_callback callback;
+ gchar *event;
+ TcoreObjectCallback 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 {
- unsigned int type;
+ guint type;
TcorePlugin *parent_plugin;
void *object;
void *user_data;
- tcore_object_free_hook free_hook;
- tcore_object_clone_hook clone_hook;
- tcore_object_dispatcher dispatcher;
+ TcoreObjectFreeHook free_hook;
+ TcoreObjectCloneHook clone_hook;
+ TcoreObjectDispatcher dispatcher;
GSList *callbacks;
+ /*
+ * Request Hooks Hash table
+ *
+ * key - TcoreCommand
+ * value - CoreObjectRequestHook*
+ */
+ GHashTable *request_hooks;
+
+ /* Notification Hooks */
+ GSList *notification_hooks;
+
TcoreHal *hal;
};
GSList *object_type;
};
-static void _util_print_mapping_tbl_entry(object_mapping_table_t *tbl_entry)
+typedef struct {
+ TcorePluginResponseCallback resp_cb;
+ void *resp_cbdata;
+
+ TcoreCommand command;
+ void *request;
+} TcoreObjectRespData;
+
+static void _util_print_mapping_tbl_entry(TcoreObjectMappingTable *tbl_entry)
{
GSList *co_list;
/* Search all the Table entries with matching 'type' */
for ( ; co_list ; co_list = co_list->next) {
- if (co_list->data == NULL)
- continue;
-
- msg(" Core Object type: [0x%x]", co_list->data);
+ if (co_list->data != NULL) {
+ msg(" Core Object type: [0x%x]", co_list->data);
+ }
}
}
static void _free_tbl_entry(gpointer data)
{
- object_mapping_table_t *tbl_entry;
+ TcoreObjectMappingTable *tbl_entry;
- if (data == NULL)
+ if (data == NULL) {
+ err("data is NULL");
return;
+ }
tbl_entry = data;
g_slist_free(tbl_entry->object_type);
/* Free Table entry */
- g_free(tbl_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);
+ }
}
-static CoreObject *_object_new(TcorePlugin *plugin, unsigned int type)
+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)
{
CoreObject *co;
- co = g_try_new0(struct tcore_object_type, 1);
- if (co == NULL)
+ co = tcore_malloc0(sizeof(CoreObject));
+ if (co == NULL) {
+ err("Failed allocate memory");
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);
+
return co;
}
static gboolean _on_at_event(TcoreAT *at, const GSList *lines, void *user_data)
{
- gboolean ret;
-
struct callback_type *cb = user_data;
+ gboolean ret;
ret = cb->callback(cb->co, lines, cb->user_data);
if (ret == FALSE) {
-
+ err("Callback failed");
}
return ret;
tcore_at_remove_notification_full(at, cb->event, _on_at_event, cb);
}
-static object_mapping_table_t *_object_search_mapping_tbl_entry(GSList *mapping_tbl_list,
+static TcoreObjectMappingTable *_object_search_mapping_tbl_entry(GSList *mapping_tbl_list,
TcoreHal *hal)
{
- GSList *list;
- object_mapping_table_t *tbl_entry = NULL;
+ GSList *list = mapping_tbl_list;
+ TcoreObjectMappingTable *tbl_entry = NULL;
- for (list = mapping_tbl_list; list ; list = list->next) {
+ for ( ; list ; list = list->next) {
tbl_entry = list->data;
- if (tbl_entry == NULL)
- continue;
-
- /* Search for Table entry with matching 'hal' */
- if (tbl_entry->hal == hal) {
- return tbl_entry;
+ if (tbl_entry != NULL) {
+ /* Search for Table entry with matching 'hal' */
+ if (tbl_entry->hal == hal)
+ return tbl_entry;
}
}
- return NULL;
+ return tbl_entry;
}
-static object_mapping_table_t *_object_search_mapping_tbl_entry_by_type(
- GSList *mapping_tbl_list, unsigned int type)
+static TcoreObjectMappingTable *_object_search_mapping_tbl_entry_by_type(
+ GSList *mapping_tbl_list, guint type)
{
- GSList *list;
- GSList *co_list;
- object_mapping_table_t *tbl_entry = NULL;
+ GSList *list = mapping_tbl_list;
+ TcoreObjectMappingTable *tbl_entry = NULL;
- for (list = mapping_tbl_list; list ; list = list->next) {
+ for ( ; list ; list = list->next) {
tbl_entry = list->data;
- 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;
+ 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;
}
}
}
return tbl_entry;
}
-
-static gboolean _init_core_object_by_type(unsigned int type,
- TcorePlugin *plugin, TcoreHal *hal, struct object_initializer *initializer_list)
+static CoreObject *_create_core_object_by_type(guint type,
+ TcorePlugin *plugin, TcoreHal *hal)
{
- CoreObject *co;
- gboolean ret = FALSE;
+ CoreObject *co = NULL;
switch (type) {
case CORE_OBJECT_TYPE_MODEM:
- INIT_CORE_OBJECT(initializer_list->modem_init,
- plugin, type, hal);
-
- /* Send Notification for MODEM ADDED */
- if (ret == TRUE)
- tcore_server_send_notification(tcore_plugin_ref_server(plugin),
- co, TNOTI_MODEM_ADDED, 0, NULL);
+ /* Create Core Object */
+ co = tcore_modem_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_CALL:
- INIT_CORE_OBJECT(initializer_list->call_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_call_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_SS:
- INIT_CORE_OBJECT(initializer_list->ss_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_ss_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_NETWORK:
- INIT_CORE_OBJECT(initializer_list->network_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_network_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_PS:
- INIT_CORE_OBJECT(initializer_list->ps_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_ps_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_SIM:
- INIT_CORE_OBJECT(initializer_list->sim_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_sim_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_SAT:
- INIT_CORE_OBJECT(initializer_list->sat_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_sat_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_SAP:
- INIT_CORE_OBJECT(initializer_list->sap_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_sap_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_SMS:
- INIT_CORE_OBJECT(initializer_list->sms_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_sms_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_PHONEBOOK:
- INIT_CORE_OBJECT(initializer_list->phonebook_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_phonebook_new(plugin, NULL, hal);
break;
case CORE_OBJECT_TYPE_GPS:
- INIT_CORE_OBJECT(initializer_list->gps_init,
- plugin, type, hal);
+ /* Create Core Object */
+ co = tcore_gps_new(plugin, NULL, hal);
break;
- case CORE_OBJECT_TYPE_SOUND: /* Fall through */
+ case CORE_OBJECT_TYPE_CUSTOM: /* Fall through */
+ default:
+ err("Unsupport/Invalid Core Object Type [0x%x]", type);
+ }
+
+ return co;
+}
+
+static gboolean _init_core_object_by_type(guint type,
+ TcorePlugin *plugin, TcoreObjectInitializer *initializer_list)
+{
+ CoreObject *co = tcore_plugin_ref_core_object(plugin, type);
+ gboolean ret = FALSE;
+
+ switch (type) {
+ case CORE_OBJECT_TYPE_MODEM: {
+ /* Invoke initializer */
+ if (initializer_list->modem_init)
+ ret = initializer_list->modem_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_CALL: {
+ /* Invoke initializer */
+ if (initializer_list->call_init)
+ ret = initializer_list->call_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_SS: {
+ /* Invoke initializer */
+ if (initializer_list->ss_init)
+ ret = initializer_list->ss_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_NETWORK: {
+ /* Invoke initializer */
+ if (initializer_list->network_init)
+ ret = initializer_list->network_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_PS: {
+ /* Invoke initializer */
+ if (initializer_list->ps_init)
+ ret = initializer_list->ps_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_SIM: {
+ /* Invoke initializer */
+ if (initializer_list->sim_init)
+ ret = initializer_list->sim_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_SAT: {
+ /* Invoke initializer */
+ if (initializer_list->sat_init)
+ ret = initializer_list->sat_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_SAP: {
+ /* Invoke initializer */
+ if (initializer_list->sap_init)
+ ret = initializer_list->sap_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_SMS:{
+ /* Invoke initializer */
+ if (initializer_list->sms_init)
+ ret = initializer_list->sms_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_PHONEBOOK: {
+ /* Invoke initializer */
+ if (initializer_list->phonebook_init)
+ ret = initializer_list->phonebook_init(plugin, co);
+ } break;
+
+ case CORE_OBJECT_TYPE_GPS:{
+ /* Invoke initializer */
+ if (initializer_list->gps_init)
+ ret = initializer_list->gps_init(plugin, co);
+ } break;
+
case CORE_OBJECT_TYPE_CUSTOM: /* Fall through */
default:
dbg("Unsupport/Invalid Core Object Type [0x%x]", type);
return ret;
}
-static void _deinit_core_object_by_type(unsigned int type,
- TcorePlugin *plugin, struct object_deinitializer *deinitializer_list)
+static void _deinit_core_object_by_type(guint type,
+ TcorePlugin *plugin, TcoreObjectDeinitializer *deinitializer_list)
{
CoreObject *co;
+ co = tcore_plugin_ref_core_object(plugin, type);
+ if (co == NULL) {
+ err("No Core Object of type: [0x%x]", type);
+ return;
+ }
+
switch (type) {
- case CORE_OBJECT_TYPE_MODEM:
- DEINIT_CORE_OBJECT(deinitializer_list->modem_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_MODEM: {
+ if (deinitializer_list->modem_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->modem_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_CALL:
- DEINIT_CORE_OBJECT(deinitializer_list->call_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_CALL: {
+ if (deinitializer_list->call_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->call_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_SS:
- DEINIT_CORE_OBJECT(deinitializer_list->ss_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_SS: {
+ if (deinitializer_list->ss_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->ss_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_NETWORK:
- DEINIT_CORE_OBJECT(deinitializer_list->network_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_NETWORK: {
+ if (deinitializer_list->network_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->network_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_PS:
- DEINIT_CORE_OBJECT(deinitializer_list->ps_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_PS: {
+ if (deinitializer_list->ps_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->ps_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_SIM:
- DEINIT_CORE_OBJECT(deinitializer_list->sim_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_SIM: {
+ if (deinitializer_list->sim_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->sim_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_SAT:
- DEINIT_CORE_OBJECT(deinitializer_list->sat_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_SAT: {
+#if 0
+ if (deinitializer_list->sat_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->sat_deinit(plugin, co);
+ }
+#endif
+ } break;
- case CORE_OBJECT_TYPE_SAP:
- DEINIT_CORE_OBJECT(deinitializer_list->sap_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_SAP: {
+ if (deinitializer_list->sap_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->sap_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_SMS:
- DEINIT_CORE_OBJECT(deinitializer_list->sms_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_SMS:{
+ if (deinitializer_list->sms_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->sms_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_PHONEBOOK:
- DEINIT_CORE_OBJECT(deinitializer_list->phonebook_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_PHONEBOOK: {
+ if (deinitializer_list->phonebook_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->phonebook_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_GPS:
- DEINIT_CORE_OBJECT(deinitializer_list->gps_deinit,
- plugin, type);
- break;
+ case CORE_OBJECT_TYPE_GPS:{
+ if (deinitializer_list->gps_deinit) {
+ /* Invoke deinitializer */
+ deinitializer_list->gps_deinit(plugin, co);
+ }
+ } break;
- case CORE_OBJECT_TYPE_SOUND: /* Fall through */
case CORE_OBJECT_TYPE_CUSTOM: /* Fall through */
default:
dbg("Unsupport/Invalid Core Object Type [0x%x]", type);
+ return;
+ }
+
+ /* Free Core Object */
+ 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 *co;
co = _object_new(plugin, CORE_OBJECT_TYPE_DEFAULT);
- if (co == NULL)
+ if (co == NULL) {
+ err("Failed to allocate memory");
return NULL;
+ }
+ /* Set HAL */
tcore_object_set_hal(co, hal);
+ /*
+ * Add Core Obejct to Plug-in is Core Object list
+ * if Plug-in is available
+ */
if (plugin)
tcore_plugin_add_core_object(plugin, co);
void tcore_object_free(CoreObject *co)
{
- GSList *l = NULL;
- struct callback_type *cb = NULL;
-
- if (co == NULL)
+ if (co == NULL) {
+ err("Core object is NULL");
return;
-
+ }
dbg("Type: [0x%x]", co->type);
if (co->free_hook)
co->free_hook(co);
- if (co->callbacks) {
- for (l = co->callbacks; l; l = l->next) {
- cb = l->data;
- if (cb == NULL)
- continue;
-
- /* Freeing 'event' and 'cb' node */
- g_free(cb->event);
- g_free(cb);
- }
-
- g_slist_free(co->callbacks);
- co->callbacks = NULL;
- }
-
- g_free(co);
+ /* Free resources */
+ g_slist_free_full(co->callbacks, __free_callback_data);
+ g_hash_table_destroy(co->request_hooks);
+ tcore_free(co);
}
CoreObject *tcore_object_clone(CoreObject *src, TcorePlugin *new_parent)
{
CoreObject *dest;
TcorePlugin *p;
- GSList *l;
+ GSList *list;
struct callback_type *cb = NULL;
- if (src == NULL)
+ if (src == NULL) {
+ err("Source Core object is NULL");
return NULL;
+ }
if (new_parent)
p = new_parent;
p = src->parent_plugin;
dest = _object_new(p, src->type);
- if (dest == NULL)
+ if (dest == NULL) {
+ err("Destination Core object is NULL");
return NULL;
+ }
+ /* Clone the parameters */
dest->object = src->object;
dest->user_data = src->user_data;
dest->free_hook = src->free_hook;
dest->dispatcher = src->dispatcher;
dest->hal = src->hal;
- for (l = src->callbacks; l; l = l->next) {
- cb = l->data;
- if (cb == NULL)
- continue;
-
- tcore_object_add_callback(dest, cb->event, cb->callback, cb->user_data);
+ 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);
}
+ /* 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);
}
CoreObject *tcore_object_clone_template_object(TcorePlugin *p,
- unsigned int co_type)
+ guint 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)
+ if (template_co == NULL) {
+ err("Failed to find Template Core object");
return NULL;
+ }
return tcore_object_clone(template_co, p);
-
}
-TReturn tcore_object_set_free_hook(CoreObject *co,
- tcore_object_free_hook free_hook)
+TelReturn tcore_object_set_free_hook(CoreObject *co,
+ TcoreObjectFreeHook free_hook)
{
- if (co == NULL)
- return TCORE_RETURN_EINVAL;
+ if (co == NULL) {
+ err("Core object is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
co->free_hook = free_hook;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_object_set_clone_hook(CoreObject *co,
- tcore_object_clone_hook clone_hook)
+TelReturn tcore_object_set_clone_hook(CoreObject *co,
+ TcoreObjectCloneHook clone_hook)
{
- if (co == NULL)
- return TCORE_RETURN_EINVAL;
+ if (co == NULL) {
+ err("Core object is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
co->clone_hook = clone_hook;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
TcorePlugin *tcore_object_ref_plugin(CoreObject *co)
{
- if (co == NULL)
+ if (co == NULL) {
+ err("Core object is NULL");
return NULL;
+ }
return co->parent_plugin;
}
-TReturn tcore_object_link_object(CoreObject *co, void *object)
+TelReturn tcore_object_link_object(CoreObject *co, void *object)
{
- if (co == NULL)
- return TCORE_RETURN_EINVAL;
+ if (co == NULL) {
+ err("Core object is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
co->object = object;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
void *tcore_object_ref_object(CoreObject *co)
{
- if (co == NULL)
+ if (co == NULL) {
+ err("Core object is NULL");
return NULL;
+ }
return co->object;
}
-TReturn tcore_object_set_type(CoreObject *co, unsigned int type)
+TelReturn tcore_object_set_type(CoreObject *co, guint type)
{
- if (co == NULL)
- return TCORE_RETURN_EINVAL;
+ if (co == NULL) {
+ err("Core object is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
co->type = type;
-
dbg("Set core_object to type: [0x%x])", type);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-unsigned int tcore_object_get_type(CoreObject *co)
+guint tcore_object_get_type(CoreObject *co)
{
- if (co == NULL)
+ if (co == NULL) {
+ err("Core object is NULL");
return 0;
+ }
return co->type;
}
-TReturn tcore_object_set_hal(CoreObject *co, TcoreHal *hal)
+TelReturn tcore_object_set_hal(CoreObject *co, TcoreHal *hal)
{
TcoreAT *at;
struct callback_type *cb = NULL;
- GSList *l = NULL;
+ GSList *list;
- if (co == NULL)
- return TCORE_RETURN_EINVAL;
+ 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);
/* Remove unsolicited callbacks */
if (tcore_hal_get_mode(co->hal) == TCORE_HAL_MODE_AT) {
at = tcore_hal_get_at(co->hal);
- for (l = co->callbacks; l != NULL; l = l->next) {
- cb = l->data;
- if (cb == NULL)
- continue;
-
- tcore_at_remove_notification_full(
- at, cb->event, _on_at_event, cb);
+ 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);
+ }
}
}
}
co->hal = hal;
- if (hal == NULL)
- return TCORE_RETURN_SUCCESS;
+ if (hal == NULL) {
+ dbg("hal is NULL");
+ return TEL_RETURN_SUCCESS;
+ }
/* Register unsolicited callbacks */
if (tcore_hal_get_mode(hal) == TCORE_HAL_MODE_AT) {
at = tcore_hal_get_at(hal);
- for (l = co->callbacks; l != NULL; l = l->next) {
- cb = l->data;
- if (cb == NULL)
- 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);
+ 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);
+ }
}
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
TcoreHal *tcore_object_get_hal(CoreObject *co)
{
- if (co == NULL)
+ if (co == NULL) {
+ err("Core object is NULL");
return NULL;
+ }
return co->hal;
}
-TReturn tcore_object_link_user_data(CoreObject *co,
+TelReturn tcore_object_link_user_data(CoreObject *co,
void *user_data)
{
- if (co == NULL)
- return TCORE_RETURN_EINVAL;
+ if (co == NULL) {
+ err("Core object is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
co->user_data = user_data;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
void *tcore_object_ref_user_data(CoreObject *co)
{
- if (co == NULL)
+ if (co == NULL) {
+ err("Core object is NULL");
return NULL;
+ }
return co->user_data;
}
-TReturn tcore_object_dispatch_request(CoreObject *co,
- UserRequest *ur)
+/* 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)
{
- if ((co == NULL) || (ur == NULL))
- return TCORE_RETURN_EINVAL;
+ TcoreObjectRespData *resp_cb_data = (TcoreObjectRespData *)user_data;
+
+ if (resp_cb_data == NULL) {
+ err("Response Callback data is NULL");
+ return;
+ }
- if (co->dispatcher == NULL) {
+ /* 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");
- return TCORE_RETURN_ENOSYS;
}
- return co->dispatcher(co, ur);
+ /*
+ * Free resources,
+ * in case Request processing is not Successful
+ */
+ if (ret != TEL_RETURN_SUCCESS) {
+ tcore_free(dispatch_request);
+ tcore_free(resp_cb_data);
+ }
+
+ return ret;
}
-TReturn tcore_object_set_dispatcher(CoreObject *co,
- tcore_object_dispatcher func)
+TelReturn tcore_object_set_dispatcher(CoreObject *co,
+ TcoreObjectDispatcher func)
{
- if ((co == NULL) || (func == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((co == NULL) || (func == NULL)) {
+ err("co: [%p] func: [%p]", co, func);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
co->dispatcher = func;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_object_override_callback(CoreObject *co,
- const char *event, tcore_object_callback callback, void *user_data)
+TelReturn tcore_object_override_callback(CoreObject *co,
+ const gchar *event, TcoreObjectCallback callback, void *user_data)
{
- struct callback_type *cb = NULL;
- GSList *l = NULL;
+ struct callback_type *cb;
+ GSList *list;
TcoreAT *at = NULL;
- if ((co == NULL) || (event == NULL) || (callback == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((co == NULL) || (event == NULL) || (callback == NULL)) {
+ err("co: [%p] event: [%p] callback: [%p]", co, event, callback);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- if (strlen(event) < 1)
- return TCORE_RETURN_EINVAL;
+ if (strlen(event) < 1) {
+ err("Invalid event!!!");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- 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 (l = co->callbacks; l; l = l->next) {
- cb = l->data;
- if (cb == NULL)
- continue;
-
- if (g_strcmp0(cb->event, event) != 0)
- continue;
- if (at)
- _remove_at_callback(at, cb);
+ 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);
- g_free(cb->event);
- co->callbacks = g_slist_remove(co->callbacks, cb);
- g_free(cb);
+ /* Free resources */
+ co->callbacks = g_slist_remove(co->callbacks, cb);
+ __free_callback_data(cb);
+ }
+ }
}
return tcore_object_add_callback(co, event, callback, user_data);
}
-TReturn tcore_object_add_callback(CoreObject *co,
- const char *event, tcore_object_callback callback, void *user_data)
+TelReturn tcore_object_add_callback(CoreObject *co,
+ const gchar *event, TcoreObjectCallback callback, void *user_data)
{
struct callback_type *cb = NULL;
TcoreAT *at = NULL;
- if ((co == NULL) || (event == NULL) || (callback == NULL))
- return TCORE_RETURN_EINVAL;
-
- if (strlen(event) < 1)
- return TCORE_RETURN_EINVAL;
+ if ((co == NULL) || (event == NULL) || (callback == NULL)) {
+ err("co: [%p] event: [%p] callback: [%p]", co, event, callback);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- cb = g_try_new0(struct callback_type, 1);
- if (cb == NULL)
- return TCORE_RETURN_ENOMEM;
+ if (strlen(event) < 1) {
+ err("Invalid event!!!");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+ cb = tcore_malloc0(sizeof(struct callback_type));
cb->co = co;
- cb->event = g_strdup(event);
+ cb->event = tcore_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) {
}
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_object_del_callback(CoreObject *co,
- const char *event, tcore_object_callback callback)
+TelReturn tcore_object_del_callback(CoreObject *co,
+ const gchar *event, TcoreObjectCallback callback)
{
- struct callback_type *cb = NULL;
- GSList *l = NULL;
+ struct callback_type *cb;
+ GSList *list;
TcoreAT *at = NULL;
- if ((co == NULL) || (event == NULL) || (callback == NULL) || (co->callbacks == NULL))
- return TCORE_RETURN_EINVAL;
+ 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 (strlen(event) < 1)
- return TCORE_RETURN_EINVAL;
+ if (strlen(event) < 1) {
+ err("Invalid event!!!");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- 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);
+ }
+ }
+ }
+ }
}
- for (l = co->callbacks; l; l = l->next) {
- cb = l->data;
- if (cb == NULL)
- 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;
+ }
- if (cb->callback != callback)
- continue;
+ /* Create Request hook list node */
+ req_hook_node = tcore_malloc0(sizeof(CoreObjectRequestCallbacks));
+ req_hook_node->func = func;
+ req_hook_node->user_data = user_data;
- if (g_strcmp0(cb->event, event) != 0)
- continue;
+ 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 (at)
- _remove_at_callback(at, cb);
+ /* Free resource */
+ tcore_free(req_hook_node);
+ return TEL_RETURN_MEMORY_FAILURE;
+ }
- g_free(cb->event);
- co->callbacks = g_slist_remove(co->callbacks, cb);
- g_free(cb);
+ /* Insert Request Hook node to Hash table */
+ g_hash_table_insert(co->request_hooks, (gpointer)command, req_hook);
}
- return TCORE_RETURN_SUCCESS;
+ /* 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);
+
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_object_emit_callback(CoreObject *co,
- const char *event, const void *event_info)
+void tcore_object_remove_request_hook(CoreObject *co,
+ TcoreCommand command, TcoreRequestHook func)
{
- struct callback_type *cb = NULL;
- GSList *l = NULL;
- TReturn ret;
-
- if ((co == NULL) || (event == NULL))
- return TCORE_RETURN_EINVAL;
-
- l = co->callbacks;
- while (l) {
- cb = l->data;
- if (cb == NULL) {
- l = l->next;
- continue;
+ 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);
+
+ /* Free resource */
+ tcore_free(req_hook_node);
+
+ /* Continue to next node */
+ req_hook_list = tmp_list;
+ continue;
+ }
}
- if (g_strcmp0(cb->event, event) != 0) {
- l = l->next;
- continue;
+ /* Continue to next node */
+ req_hook_list = req_hook_list->next;
+ }
+}
+
+TelReturn tcore_object_add_response_hook(CoreObject *co,
+ TcoreCommand command, const void *request, TcoreResponseHook func, void *user_data)
+{
+ CoreObjectRequestHook *req_hook;
+
+ if ((co == NULL) || (func == NULL)) {
+ err("co: [%p] func: [%p]", co, func);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+
+ /* 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;
+
+ /* 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);
+
+ return TEL_RETURN_SUCCESS;
+ }
+ }
}
+ }
+ else {
+ err("Abnormal behavior... Response Hooks need to be added in Request hook callbacks!!!");
+ }
- 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;
+ return TEL_RETURN_FAILURE;
+}
+
+void tcore_object_remove_response_hook(CoreObject *co,
+ TcoreCommand command, TcoreResponseHook func)
+{
+ CoreObjectRequestHook *req_hook;
+
+ 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) {
+ 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);
+ }
+ }
+
+ resp_list = tmp_list;
+ }
+ }
+ }
+ }
+}
+
+TelReturn tcore_object_add_notification_hook(CoreObject *co,
+ TcoreNotification command, TcoreNotificationHook func, void *user_data)
+{
+ CoreObjectNotificationHook *noti_hook;
+
+ if ((co == NULL) || (func == NULL)) {
+ err("co: [%p] func: [%p]", co, func);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+
+ /* 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;
+
+ /* Append Notification hook node to Notification hook list */
+ co->notification_hooks =
+ g_slist_append(co->notification_hooks, noti_hook);
+
+ dbg("Notification hook added for Command: [0x%x]", command);
+
+ return TEL_RETURN_SUCCESS;
+}
+
+void tcore_object_remove_notification_hook(CoreObject *co,
+ TcoreNotification command, TcoreNotificationHook func)
+{
+ 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);
}
}
- l = l->next;
+ noti_list = tmp_list;
+ }
+}
+
+TelReturn tcore_object_send_notification(CoreObject *co,
+ TcoreNotification command, guint data_len, void *data)
+{
+ 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;
+ }
+ }
+ }
}
- return TCORE_RETURN_SUCCESS;
+ /* Dispatch the Notification to Server */
+ return tcore_plugin_send_notification(plugin, command, data_len, data);
}
void *tcore_object_add_mapping_tbl_entry(void *mapping_tbl,
- unsigned int object_type, TcoreHal *hal)
+ guint object_type, TcoreHal *hal)
{
GSList *mapping_tbl_list = mapping_tbl;
- object_mapping_table_t *tbl_entry;
+ TcoreObjectMappingTable *tbl_entry;
if (hal == NULL) {
err("Mapping Table: [0x%x] HAL: [0x%x]", mapping_tbl, hal);
- return mapping_tbl;
+ return NULL;
}
/*
* new Table entry is created
*/
- 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;
- }
+ tbl_entry = tcore_malloc0(sizeof(TcoreObjectMappingTable));
+ tbl_entry->hal = hal;
/* Add the Mapping Table entry to Mapping Table */
mapping_tbl_list = g_slist_append(mapping_tbl_list, tbl_entry);
void *tcore_object_remove_mapping_tbl_entry(void *mapping_tbl, TcoreHal *hal)
{
GSList *mapping_tbl_list = mapping_tbl;
- object_mapping_table_t *tbl_entry;
+ TcoreObjectMappingTable *tbl_entry;
if (mapping_tbl_list == NULL) {
err("Mapping Table is NULL");
mapping_tbl_list = g_slist_remove(mapping_tbl_list, tbl_entry);
/* Free Table entry */
- g_free(tbl_entry);
+ tcore_free(tbl_entry);
return mapping_tbl_list;
}
void tcore_object_remove_mapping_tbl_entry_by_type(void *mapping_tbl,
- unsigned int co_type)
+ guint co_type)
{
GSList *mapping_tbl_list;
- object_mapping_table_t *tbl_entry;
+ TcoreObjectMappingTable *tbl_entry;
if (mapping_tbl == NULL) {
err("Mapping Table is NULL");
void tcore_object_print_mapping_tbl(void *mapping_tbl)
{
GSList *mapping_tbl_list;
- object_mapping_table_t *tbl_entry = NULL;
-
+ TcoreObjectMappingTable *tbl_entry = NULL;
if (mapping_tbl == NULL) {
err("Mapping Table is NULL");
for ( ; mapping_tbl_list ; mapping_tbl_list = mapping_tbl_list->next) {
tbl_entry = mapping_tbl_list->data;
- if (tbl_entry == NULL)
- continue;
-
- _util_print_mapping_tbl_entry(tbl_entry);
+ if (tbl_entry != NULL) {
+ _util_print_mapping_tbl_entry(tbl_entry);
+ }
}
}
/* Initialize Core Objects */
-TReturn tcore_object_init_objects(TcorePlugin *plugin,
- struct object_initializer *initializer_list)
+TelReturn tcore_object_init_objects(TcorePlugin *plugin,
+ TcoreObjectInitializer *initializer_list)
{
GSList *mapping_tbl_list;
gboolean ret = FALSE;
* else, it is treated as a Failure.
*/
if (mapping_tbl_list != NULL) {
- object_mapping_table_t *tbl_entry;
+ TcoreObjectMappingTable *tbl_entry;
+ GSList *mtbl_list;
GSList *object_type_list;
- unsigned int type;
+ guint type;
+
+ /* Create each Core Object based on the Mapping Table entries */
+ mtbl_list = mapping_tbl_list;
+ for ( ; mtbl_list ; mtbl_list = mtbl_list->next) {
+ tbl_entry = mtbl_list->data;
+ if (tbl_entry != NULL) {
+ CoreObject *co;
+
+ object_type_list = tbl_entry->object_type;
+ for ( ; object_type_list ; object_type_list = object_type_list->next) {
+ type = (guint)object_type_list->data;
+
+ 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;
+ }
+ dbg("Created Core Object - Type: [0x%x]", type);
+ }
+ }
+ }
/* 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)
- continue;
-
- /* To handle NULL 'init' function case */
- ret = FALSE;
-
- 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);
-
- ret = _init_core_object_by_type(type, plugin, tbl_entry->hal, initializer_list);
- if (ret == FALSE) {
- err("Failed to initialize Core Object Type [0x%x]", type);
-
- /*
- * Will stop initializing other Modules in case of Error,
- * but we need to check if we need to continue OR not as we cannot
- * define which Modules are Mandatory and which are NOT.
- */
- break;
+ mtbl_list = mapping_tbl_list;
+ for ( ; mtbl_list ; mtbl_list = mtbl_list->next) {
+ tbl_entry = mtbl_list->data;
+ if (tbl_entry != NULL) {
+ /* To handle NULL 'init' function case */
+ 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;
+
+ 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;
+ }
+ dbg("Initialized Core Object - Type: [0x%x]", type);
}
}
}
- } else
+ }
+ else {
err("Mapping Table is NOT present");
+ }
if (ret == FALSE) {
- err("Failed to initialize Core Objects");
- return TCORE_RETURN_FAILURE;
+ err("Failed to create/initialize Core Objects");
+ return TEL_RETURN_FAILURE;
}
dbg("Successfully initialized Core Objects");
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
/* De-initialize Core Objects */
void tcore_object_deinit_objects(TcorePlugin *plugin,
- struct object_deinitializer *deinitializer_list)
+ TcoreObjectDeinitializer *deinitializer_list)
{
GSList *mapping_tbl_list;
* just return with an Error log.
*/
if (mapping_tbl_list != NULL) {
- object_mapping_table_t *tbl_entry;
+ TcoreObjectMappingTable *tbl_entry;
GSList *object_type_list;
- unsigned int type;
+ guint 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)
- continue;
+ 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);
- 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);
+ _deinit_core_object_by_type(type, plugin, deinitializer_list);
+ }
}
}
dbg("Successfully de-initialized Core Objects");
- } else
+ }
+ else {
err("Mapping Table is NOT present");
+ }
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
*/
#include <stdio.h>
-#include <string.h>
-#include <pthread.h>
+//#include <string.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 {
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;
- enum tcore_hal_mode mode;
+ TcoreHalMode mode;
TcoreAT *at;
};
-static gboolean _hal_idle_send(void *user_data)
+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)
{
TcoreHal *hal = user_data;
- TcorePending *p = NULL;
- TcoreQueue *q;
- int ret = 0;
- void *data = NULL;
- unsigned int data_len = 0;
+ TcorePending *pending;
+ void *data;
+ guint data_len = 0;
+ TelReturn ret;
gboolean renew = FALSE;
- if (hal == NULL)
+ if (hal == NULL) {
+ err("hal is NULL");
return FALSE;
+ }
msg("--[Queue SEND]-------------------");
- p = tcore_queue_ref_next_pending(hal->queue);
- if (p == NULL) {
- dbg("next pending is NULL. no send, queue len=%d", tcore_queue_get_length(hal->queue));
+ pending = tcore_queue_ref_next_pending(hal->queue);
+ if (pending == NULL) {
+ dbg("Queue is empty!!! (queue length: %d)",
+ tcore_queue_get_length(hal->queue));
goto out;
}
- data = tcore_pending_ref_request_data(p, &data_len);
- dbg("queue len=%d, pending=0x%x, id=0x%x, data_len=%d",
- tcore_queue_get_length(hal->queue), (unsigned int)p, tcore_pending_get_id(p), data_len);
+ 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);
- if (hal->mode == TCORE_HAL_MODE_AT) {
+ if (hal->mode == TCORE_HAL_MODE_AT)
ret = tcore_at_set_request(hal->at, data, TRUE);
- }
- else {
+ else
ret = tcore_hal_send_data(hal, data_len, data);
- }
- if (ret == TCORE_RETURN_SUCCESS) {
- tcore_pending_emit_send_callback(p, TRUE);
- }
- else {
- tcore_pending_emit_send_callback(p, FALSE);
- }
+ tcore_pending_emit_send_callback(pending, ret);
- if (ret != TCORE_RETURN_HOOK_STOP) {
- if (tcore_pending_get_auto_free_status_after_sent(p)) {
- q = tcore_hal_ref_queue(hal);
- tcore_queue_pop_by_pending(q, p);
- tcore_pending_free(p);
+ if (ret != (TelReturn)TCORE_HAL_SEND_DATA_HOOK_STOP) {
+ TcoreQueue *queue;
+
+ 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);
/* renew idler */
renew = TRUE;
}
else {
/* Send fail */
- if (ret != TCORE_RETURN_SUCCESS) {
- dbg("send fail.");
- q = tcore_hal_ref_queue(hal);
- p = tcore_queue_pop(q);
- tcore_pending_free(p);
+ if (ret != TEL_RETURN_SUCCESS) {
+ err("HAL Send failed");
+
+ queue = tcore_hal_ref_queue(hal);
+ pending = tcore_queue_pop(queue);
+ tcore_pending_free(pending);
}
}
}
return renew;
}
-TcoreHal *tcore_hal_new(TcorePlugin *plugin, const char *name,
- struct tcore_hal_operations *hops,
- enum tcore_hal_mode mode)
+TcoreHal *tcore_hal_new(TcorePlugin *plugin, const gchar *name,
+ TcoreHalOperations *hops, TcoreHalMode mode)
{
TcoreHal *hal;
- if (name == NULL)
+ if (name == NULL) {
+ err("HAL name is NULL");
return NULL;
+ }
hal = g_try_new0(struct tcore_hal_type, 1);
- if (hal == NULL)
+ if (hal == NULL) {
+ err("Failed to allocate memory");
return NULL;
+ }
hal->parent_plugin = plugin;
+ hal->name = tcore_strdup(name);
hal->ops = hops;
- hal->name = g_strdup(name);
+
hal->queue = tcore_queue_new(hal);
hal->mode = mode;
void tcore_hal_free(TcoreHal *hal)
{
- if (hal == NULL)
+ if (hal == NULL) {
+ err("HAL is NULL");
return;
+ }
- dbg("hal=%s", hal->name);
+ dbg("hal: [%s]", hal->name);
/* Freeing HAL name */
- g_free(hal->name);
+ tcore_free(hal->name);
/* Freeing HAL callbacks list */
- g_slist_free(hal->callbacks);
+ g_slist_free_full(hal->callbacks, g_free);
/* Freeing HAL Queue */
tcore_queue_free(hal->queue);
/* Freeing AT parser linked to HAL */
- tcore_at_free(hal->at);
+ if (hal->mode == TCORE_HAL_MODE_AT)
+ tcore_at_free(hal->at);
/* Freeing HAL */
- g_free(hal);
+ tcore_free(hal);
}
-TReturn tcore_hal_set_name(TcoreHal *hal, const char *name)
+TelReturn tcore_hal_set_name(TcoreHal *hal, const gchar *name)
{
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
/* Freeing the previously assigned HAL name */
- g_free(hal->name);
+ tcore_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 = g_strdup(name);
+ hal->name = tcore_strdup(name);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-char *tcore_hal_get_name(TcoreHal *hal)
+gchar *tcore_hal_get_name(TcoreHal *hal)
{
- if (hal == NULL)
+ if (hal == NULL) {
+ err("HAL is NULL");
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 g_strdup(hal->name);
+ return tcore_strdup(hal->name);
}
TcoreAT *tcore_hal_get_at(TcoreHal *hal)
{
- if (hal == NULL)
+ if (hal == NULL) {
+ err("HAL is NULL");
return NULL;
+ }
return hal->at;
}
-enum tcore_hal_mode tcore_hal_get_mode(TcoreHal *hal)
+TcoreHalMode tcore_hal_get_mode(TcoreHal *hal)
{
- if (hal == NULL)
+ if (hal == NULL) {
+ err("HAL is NULL");
return TCORE_HAL_MODE_UNKNOWN;
+ }
return hal->mode;
}
-TReturn tcore_hal_set_mode(TcoreHal *hal, enum tcore_hal_mode mode)
+TelReturn tcore_hal_set_mode(TcoreHal *hal, TcoreHalMode mode)
{
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
hal->mode = mode;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_hal_link_user_data(TcoreHal *hal, void *user_data)
+TelReturn tcore_hal_link_user_data(TcoreHal *hal, void *user_data)
{
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
hal->user_data = user_data;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
void *tcore_hal_ref_user_data(TcoreHal *hal)
{
- if (hal == NULL)
+ if (hal == NULL) {
+ err("HAL is NULL");
return NULL;
+ }
return hal->user_data;
}
/* Send data without Queue */
-TReturn tcore_hal_send_data(TcoreHal *hal, unsigned int data_len, void *data)
+TelReturn tcore_hal_send_data(TcoreHal *hal, guint data_len, void *data)
{
struct hook_send_type *hook;
GSList *list;
- if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->send == NULL))
- return TCORE_RETURN_EINVAL;
+ 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;
+ }
for (list = hal->hook_list_send; list; list = list->next) {
hook = list->data;
- if (hook == NULL) {
- continue;
- }
-
- if (hook->func(hal, data_len, data, hook->user_data) == TCORE_HOOK_RETURN_STOP_PROPAGATION) {
- return TCORE_RETURN_HOOK_STOP;
- }
+ 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;
}
return hal->ops->send(hal, data_len, data);
}
/* Send data by Queue */
-TReturn tcore_hal_send_request(TcoreHal *hal, TcorePending *pending)
+TelReturn tcore_hal_send_request(TcoreHal *hal, TcorePending *pending)
{
- int qlen = 0;
- enum tcore_pending_priority priority;
- dbg("HAL: [0x%x]", hal);
+ TcorePendingPriority priority;
+ TelReturn ret;
+ dbg("HAL: [%p]", hal);
- if ((hal == NULL) || (pending == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((hal == NULL) || (pending == NULL)){
+ err("hal: [%p] pending: [%p]", hal, pending);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- if (hal->power_state == FALSE)
- return TCORE_RETURN_FAILURE;
+ if (hal->power_state == FALSE) {
+ err("HAL Power: [OFF]");
+ return TEL_RETURN_FAILURE;
+ }
- qlen = tcore_queue_get_length(hal->queue);
- tcore_queue_push(hal->queue, pending);
+ ret = tcore_queue_push(hal->queue, pending);
+ if (ret != TEL_RETURN_SUCCESS) {
+ err("Failed to PUSH request to Queue");
+ 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) {
- g_idle_add_full(IDLE_SEND_PRIORITY, _hal_idle_send, hal, NULL);
+ dbg("Single entry in pending Queue!!!");
+ g_idle_add_full(IDLE_SEND_PRIORITY,
+ __hal_idle_send, hal, NULL);
}
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_hal_send_force(TcoreHal *hal)
+TelReturn tcore_hal_send_force(TcoreHal *hal)
{
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- _hal_idle_send(hal);
+ __hal_idle_send(hal);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_hal_dispatch_response_data(TcoreHal *hal, int id,
- unsigned int data_len, const void *data)
+TelReturn tcore_hal_dispatch_response_data(TcoreHal *hal, guint id,
+ guint data_len, const void *data)
{
- TcorePending *p = NULL;
+ TcorePending *pending = NULL;
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- if (data_len > 0 && data == NULL)
- return TCORE_RETURN_EINVAL;
+ if ((data_len == 0) || (data == NULL)) {
+ err("data_len: [%d] data: [%p]", data_len, data);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
if (hal->mode == TCORE_HAL_MODE_AT) {
gboolean ret;
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");
- p = tcore_queue_pop_by_id(hal->queue, id);
- if (p == NULL) {
- dbg("unknown pending (id=0x%x)", id);
- return TCORE_RETURN_PENDING_WRONG_ID;
+ pending = tcore_queue_pop_by_id(hal->queue, id);
+ if (pending == NULL) {
+ err("unknown pending (id=0x%x)", id);
+ return TEL_RETURN_INVALID_PARAMETER;
}
- tcore_pending_emit_response_callback(p, data_len, data);
- tcore_user_request_free(tcore_pending_ref_user_request(p));
- tcore_pending_free(p);
+ /* Emit response callback */
+ tcore_pending_emit_response_callback(pending,
+ data_len, data);
+
+ /* Free pending request */
+ tcore_pending_free(pending);
}
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, (unsigned char *)data, data_len);
+ tcore_cmux_rcv_from_hal(hal, (guchar *)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 TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_hal_add_recv_callback(TcoreHal *hal, TcoreHalReceiveCallback func,
+TelReturn tcore_hal_add_recv_callback(TcoreHal *hal, TcoreHalReceiveCallback func,
void *user_data)
{
struct recv_callback_item_type *item;
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
item = g_try_new0(struct recv_callback_item_type, 1);
- if (item == NULL)
- return TCORE_RETURN_ENOMEM;
+ if (item == NULL) {
+ err("Failed to allocate memory");
+ return TEL_RETURN_MEMORY_FAILURE;
+ }
item->func = func;
item->user_data = user_data;
hal->callbacks = g_slist_append(hal->callbacks, item);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_hal_remove_recv_callback(TcoreHal *hal, TcoreHalReceiveCallback func)
+TelReturn tcore_hal_remove_recv_callback(TcoreHal *hal, TcoreHalReceiveCallback func)
{
struct recv_callback_item_type *item;
GSList *list;
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
for (list = hal->callbacks; list; list = list->next) {
item = list->data;
- if (item == NULL) {
- continue;
- }
-
- if (item->func == func) {
- hal->callbacks = g_slist_remove(hal->callbacks, item);
- g_free(item);
- if (hal->callbacks == NULL)
- break;
-
- list = hal->callbacks;
+ 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;
+ }
}
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_hal_emit_recv_callback(TcoreHal *hal, unsigned int data_len,
+TelReturn tcore_hal_emit_recv_callback(TcoreHal *hal, guint data_len,
const void *data)
{
GSList *list;
struct recv_callback_item_type *item;
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
for (list = hal->callbacks; list; list = list->next) {
item = list->data;
-
- if (item) {
- item->func(hal, data_len, data, item->user_data);
- }
+ if (item != NULL)
+ if (item->func)
+ item->func(hal, data_len, data, item->user_data);
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_hal_add_send_hook(TcoreHal *hal, TcoreHalSendHook func, void *user_data)
+TelReturn tcore_hal_add_send_hook(TcoreHal *hal,
+ TcoreHalSendHook func, void *user_data)
{
struct hook_send_type *hook;
- if ((hal == NULL) || (func == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((hal == NULL) || (func == NULL)) {
+ err("hal: [%p] func: [%p]", hal, func);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
hook = g_try_new0(struct hook_send_type, 1);
- if (hook == NULL)
- return TCORE_RETURN_ENOMEM;
+ if (hook == NULL) {
+ err("Failed to allocate memory");
+ return TEL_RETURN_MEMORY_FAILURE;
+ }
hook->func = func;
hook->user_data = user_data;
hal->hook_list_send = g_slist_append(hal->hook_list_send, hook);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_hal_remove_send_hook(TcoreHal *hal, TcoreHalSendHook func)
+TelReturn tcore_hal_remove_send_hook(TcoreHal *hal, TcoreHalSendHook func)
{
struct hook_send_type *hook;
GSList *list;
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
for (list = hal->hook_list_send; list; list = list->next) {
hook = list->data;
- if (hook == NULL) {
- continue;
- }
+ if (hook != NULL) {
+ if (hook->func == func) {
+ hal->hook_list_send =
+ g_slist_remove(hal->hook_list_send, hook);
- if (hook->func == func) {
- hal->hook_list_send = g_slist_remove(hal->hook_list_send, hook);
- g_free(hook);
- list = hal->hook_list_send;
+ tcore_free(hook);
+ list = hal->hook_list_send;
+ }
}
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
TcoreQueue *tcore_hal_ref_queue(TcoreHal *hal)
{
- if (hal == NULL)
+ if (hal == NULL) {
+ err("HAL is NULL");
return NULL;
+ }
return hal->queue;
}
TcorePlugin *tcore_hal_ref_plugin(TcoreHal *hal)
{
- if (hal == NULL)
+ if (hal == NULL) {
+ err("HAL is NULL");
return NULL;
+ }
return hal->parent_plugin;
}
-TReturn tcore_hal_set_power_state(TcoreHal *hal, gboolean flag)
+TelReturn tcore_hal_set_power_state(TcoreHal *hal, gboolean flag)
{
- if (hal == NULL)
- return TCORE_RETURN_EINVAL;
+ if (hal == NULL) {
+ err("HAL is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
hal->power_state = flag;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
gboolean tcore_hal_get_power_state(TcoreHal *hal)
{
- if (hal == NULL)
+ if (hal == NULL) {
+ err("HAL is NULL");
return FALSE;
+ }
return hal->power_state;
}
-TReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag)
+TelReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag)
{
- if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->power == NULL))
- return TCORE_RETURN_EINVAL;
+ 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;
+ }
return hal->ops->power(hal, flag);
}
-TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
- TcoreHalSetupNetifCallback func,
- void *user_data, unsigned int cid,
- gboolean enable)
+TelReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
+ TcoreHalSetupNetifCallback func, void *user_data,
+ guint cid, gboolean enable)
{
- if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->setup_netif == NULL))
- return TCORE_RETURN_EINVAL;
+ 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;
+ }
return hal->ops->setup_netif(co, func, user_data, cid, enable);
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- * Contact: Arijit Sen <arijit.sen@samsung.com>
+ * 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.
#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] -
CMUX_CHANNEL_0 = 0, /* CMUX Control Channel */
CMUX_CHANNEL_MAX = 65 /* Based on #GPP 27.010 */
-} tcore_cmux_channel_id;
+} TcoreCmuxChannelId;
/*
* CMUX Channel States
CMUX_CHANNEL_UA_SEND_CLOSING,
CMUX_CHANNEL_UA_RECEIVED,
CMUX_CHANNEL_UA_SENDING,
-} tcore_cmux_channel_state;
+} TcoreCmuxChannelState;
/* CMUX State */
typedef enum {
CMUX_NOT_INITIALIZED,
CMUX_INITIALIZED,
CMUX_CLOSED
-} tcore_cmux_state;
+} TcoreCmuxState;
/*
* 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 unsigned char crc_table[256] = { /* reversed, 8-bit, poly=0x07 */
+const guchar 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,
struct cmux_channel {
TcoreHal *hal;
- tcore_cmux_channel_state channel_state;
- tcore_cmux_channel_id channel_id;
+ TcoreCmuxChannelState channel_state;
+ TcoreCmuxChannelId channel_id;
- int frame_type;
- unsigned char ext_bit;
- unsigned char cr_bit;
- unsigned char poll_final_bit;
+ gint frame_type;
+ guchar ext_bit;
+ guchar cr_bit;
+ guchar poll_final_bit;
};
/* CMUX structure - Internal */
struct cmux_internal {
- tcore_cmux_channel *channel_info[CMUX_CHANNEL_MAX];
+ TcoreCmuxChannel *channel_info[CMUX_CHANNEL_MAX];
- int is_waiting;
+ gint is_waiting;
- int msg_len;
- int cur_main_buf_len;
+ guint msg_len;
+ gint cur_main_buf_len;
/* Channel Setup callbacks */
- cmux_setup_cb_func channel_setup_cb;
- gpointer channel_setup_user_data;
+ CmuxSetupCbFunc channel_setup_cb;
+ gpointer channel_setup_cb_data;
/* Channel Setup complete callback */
- cmux_setup_complete_cb_func setup_complete_cb;
- gpointer setup_complete_user_data;
+ CmuxSetupCompleteCbFunc setup_complete_cb;
+ gpointer setup_complete_cb_data;
- int info_field_len;
- unsigned char *info_field;
+ gint info_field_len;
+ guchar *info_field;
};
/* Global CMUX Object */
/* Modem Interface Plug-in */
TcorePlugin *plugin;
- tcore_cmux_state cmux_state;
+ TcoreCmuxState cmux_state;
tcore_cmux_mode cmux_mode;
- int max_cmux_channels;
- unsigned int max_cmux_buf_size;
+ guint max_cmux_channels;
+ guint max_cmux_buf_size;
/* CMUX frame processing buffer */
- unsigned char *cmux_buffer;
+ guchar *cmux_buffer;
/* Only Internal MUX is managed by libtcore */
struct cmux_internal internal_mux;
/* All the local functions declared below */
static void _cmux_on_confirmation_message_send(TcorePending *plugin,
- gboolean result, void *user_data);
+ TelReturn result, void *user_data);
-tcore_cmux_object *_cmux_new(int max_channels, unsigned int buffer_size);
-static void _cmux_free(tcore_cmux_object *cmux_obj);
+TcoreCmuxObject *_cmux_new(guint max_channels, guint buffer_size);
+static void _cmux_free(TcoreCmuxObject *cmux_obj);
-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 void _cmux_channel_init(TcoreCmuxObject *cmux_obj, gint channel_id);
+static void _cmux_close_channel(TcoreCmuxObject *cmux_obj, gint channel_id);
-static TcoreHal *_cmux_create_logical_hal(tcore_cmux_object *cmux_obj,
- tcore_cmux_channel *channel);
+static TcoreHal *_cmux_create_logical_hal(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 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 void _cmux_control_channel_handle(tcore_cmux_object *cmux_obj);
-static void _cmux_flush_channel_data(tcore_cmux_object *cmux_obj);
+static void _cmux_control_channel_handle(TcoreCmuxObject *cmux_obj);
+static void _cmux_flush_channel_data(TcoreCmuxObject *cmux_obj);
-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 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 tcore_cmux_object *_cmux_get_cmux_object(TcorePlugin *plugin);
+static TcoreCmuxObject *_cmux_get_cmux_object(TcorePlugin *plugin);
-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 gint _cmux_check_recv_crc(guchar *data,
+ guchar length, guchar rcv_fcs);
-static unsigned char _cmux_calc_crc(unsigned char *header, int length)
+static guchar _cmux_calc_crc(guchar *header, gint length)
{
- unsigned char fcs = 0xFF; /* Init */
- unsigned char crc = 0x00;
+ guchar fcs = 0xFF; /* Init */
+ guchar crc = 0x00;
/*
* 'length' is the number of bytes in the message,
return crc;
}
-static int _cmux_check_recv_crc(unsigned char *data,
- unsigned char length,
- unsigned char rcv_fcs)
+static gint _cmux_check_recv_crc(guchar *data,
+ guchar length, guchar rcv_fcs)
{
- unsigned char fcs = 0xFF; /* Init */
+ guchar fcs = 0xFF; /* Init */
/*
* 'length' is the number of bytes in the message,
return 0;
}
-static tcore_cmux_object *_cmux_get_cmux_object(TcorePlugin *plugin)
+static TcoreCmuxObject *_cmux_get_cmux_object(TcorePlugin *plugin)
{
- tcore_cmux_object *cmux_obj;
+ TcoreCmuxObject *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) {
return NULL;
}
-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 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)
{
- int frame_length = 0;
- int total_frame_length = 0;
- int crc_len = 0;
+ guint frame_length = 0;
+ guint total_frame_length = 0;
+ guint crc_len = 0;
dbg("Entry");
/* Flush channel data */
/* DLCI: Data Link Connection Identifier */
/* Check if the channel is within range */
- if (channel_id < cmux_obj->max_cmux_channels && channel_id >= 0) {
+ if (channel_id < cmux_obj->max_cmux_channels) {
dbg("Channel ID: [%d]", channel_id);
cmux_obj->internal_mux.info_field[frame_length] =
(cmux_obj->internal_mux.info_field[frame_length]
- | ((unsigned char)channel_id << 2));
+ | ((guchar)channel_id << 2));
} else {
err("Channel ID [%d] is out of range [0-%d]",
channel_id, cmux_obj->max_cmux_channels);
* 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++] =
- (char) length << 1 | 0x01;
+ (guchar) length << 1 | 0x01;
/* CRC calculatable length */
crc_len = 3;
} else {
cmux_obj->internal_mux.info_field[frame_length++] =
- (char) (length << 1);
+ (guchar) (length << 1);
cmux_obj->internal_mux.info_field[frame_length++] =
- (char) (length >> 7);
+ (guchar) (length >> 7);
/* CRC calculatable length */
crc_len = 4;
/* 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");
_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) {
return cmux_obj->internal_mux.info_field;
}
-static void _cmux_control_channel_handle(tcore_cmux_object *cmux_obj)
+static void _cmux_control_channel_handle(TcoreCmuxObject *cmux_obj)
{
- unsigned char cmd_type;
- int msg_len = 0;
- unsigned char *msg_start_ptr;
+ guchar cmd_type;
+ guint msg_len = 0;
+ guchar *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) {
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
dbg("Exit");
}
-static void _cmux_process_channel_data(tcore_cmux_object *cmux_obj,
- tcore_cmux_channel *channel)
+static void _cmux_process_channel_data(TcoreCmuxObject *cmux_obj,
+ TcoreCmuxChannel *channel)
{
- int frame_type;
- int channel_id;
- int len;
- unsigned char *send_data;
- static int count = 0;
- int ret;
+ gint frame_type;
+ guint channel_id;
+ guint len;
+ guchar *send_data;
+ static guint count = 0;
+ TelReturn ret;
dbg("Entry");
channel_id = channel->channel_id;
- dbg("Channel ID: [%d]", channel_id);
-
frame_type = channel->frame_type & 0xEF;
- dbg("Frame Type: [0x%02x]", frame_type);
+ dbg("Channel ID: [%d] Frame Type: [0x%02x]", channel_id, frame_type);
switch (frame_type) {
- 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);
+ 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);
/*
- * 'setup_complete_cb' cannot be NULL as it is MANDATED during
+ * 'channel_setup_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_user_data);
+ 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");
+ }
- /* Reset 'count' */
- count = 0;
- }
- } else if (CMUX_CHANNEL_DISC_SEND_WAITING_FOR_UA ==
- channel->channel_state) {
- channel->channel_state = CMUX_CHANNEL_CLOSED;
+ 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);
- if (channel_id == CMUX_CHANNEL_0) {
- cmux_obj->cmux_state = CMUX_CLOSED;
+ /* Reset 'count' */
+ count = 0;
+ }
+ } else if (channel->channel_state
+ == CMUX_CHANNEL_SABM_SEND_WAITING_FOR_UA) {
+ channel->channel_state = CMUX_CHANNEL_CLOSED;
- /* TODO - Need to notify regarding CMUX closure */
- tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
- }
- } else
- err("Received UA in wrong state!!!");
+ if (channel_id == CMUX_CHANNEL_0) {
+ cmux_obj->cmux_state = CMUX_CLOSED;
- break;
- case CMUX_COMMAND_DM:
+ /* 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) {
/*
- * 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.
+ * 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.
*/
- 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) {
+ } else {
+ if (channel->channel_state == CMUX_CHANNEL_CLOSED) {
/*
- * 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 a CMUX_COMMAND_DISC command is received
+ * while in disconnected mode a CMUX_COMMAND_DM
+ * response should be sent.
*/
- /* 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
- */
+ /* 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);
+ }
- /* 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;
- }
+ 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);
- /* 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.
- */
+ }
+ 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");
-
- 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;
}
dbg("Exit");
}
-static void _cmux_flush_channel_data(tcore_cmux_object *cmux_obj)
+static void _cmux_flush_channel_data(TcoreCmuxObject *cmux_obj)
{
- dbg("Entry");
-
- if (cmux_obj == NULL)
+ if (cmux_obj == NULL) {
+ err("cmux_obj is NULL");
return;
+ }
cmux_obj->internal_mux.info_field_len = 0x0;
- memset(cmux_obj->internal_mux.info_field, 0x0, cmux_obj->max_cmux_buf_size);
-
- dbg("Exit");
+ memset(cmux_obj->internal_mux.info_field,
+ 0x0, cmux_obj->max_cmux_buf_size);
}
-static void _cmux_process_rcv_frame(tcore_cmux_object *cmux_obj, int length)
+static void _cmux_process_rcv_frame(TcoreCmuxObject *cmux_obj, gint length)
{
- unsigned char *frame_process_ptr = cmux_obj->cmux_buffer;
- unsigned char *buf_start_ptr = cmux_obj->cmux_buffer;
+ guchar *frame_process_ptr = cmux_obj->cmux_buffer;
+ guchar *buf_start_ptr = cmux_obj->cmux_buffer;
- tcore_cmux_channel *ch;
- unsigned char channel_id;
- int header_length;
- dbg("Entry");
+ TcoreCmuxChannel *ch;
+ guchar channel_id;
+ gint header_length;
/* Flush channel data */
_cmux_flush_channel_data(cmux_obj);
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 =
- (cmux_obj->internal_mux.info_field_len
- | ((*frame_process_ptr++ & 0xFE) >> 1));
+ *(frame_process_ptr + 1) << 7;
+ cmux_obj->internal_mux.info_field_len =
+ (cmux_obj->internal_mux.info_field_len
+ | ((*frame_process_ptr++ & 0xFE) >> 1));
header_length = 4;
frame_process_ptr++;
}
memcpy(cmux_obj->internal_mux.info_field, frame_process_ptr,
cmux_obj->internal_mux.info_field_len);
- frame_process_ptr = frame_process_ptr + cmux_obj->internal_mux.info_field_len;
+ 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)) {
- dbg("Calling _cmux_process_channel_data");
+ if (_cmux_check_recv_crc((buf_start_ptr + 1),
+ header_length, *frame_process_ptr)) {
_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 TReturn _cmux_send_data(TcoreHal *hal, int data_len, unsigned char *data)
+static TelReturn _cmux_send_data(TcoreHal *hal, gint data_len, guchar *data)
{
- TReturn ret;
- dbg("Entry");
+ TelReturn ret;
/* Directly send to Physical HAL */
ret = tcore_hal_send_data(hal, data_len, (void *) data);
- if (ret != TCORE_RETURN_SUCCESS) {
+ if (ret != TEL_RETURN_SUCCESS) {
err("Failed to send CMUX data");
} else
dbg("Successfully sent CMUX data");
- dbg("Exit");
return ret;
}
-static gboolean _cmux_recv_cmux_data(tcore_cmux_object *cmux_obj,
- tcore_cmux_channel *channel)
+static gboolean _cmux_recv_cmux_data(TcoreCmuxObject *cmux_obj,
+ TcoreCmuxChannel *channel)
{
TcoreHal *hal;
- dbg("Entry");
/* Dereferencing HAL from Channel Pointer */
hal = channel->hal;
return FALSE;
}
- dbg("Dispatching to logical HAL - hal: [0x%x]", (unsigned int)hal);
+ dbg("Dispatching to logical HAL - hal: [0x%x]", (guint)hal);
if (tcore_hal_dispatch_response_data(hal, 0,
cmux_obj->internal_mux.info_field_len,
cmux_obj->internal_mux.info_field)
- != TCORE_RETURN_SUCCESS) {
+ != TEL_RETURN_SUCCESS) {
err("Exit");
return FALSE;
}
- dbg("Exit");
return TRUE;
}
-static TReturn _cmux_hal_power(TcoreHal *hal, gboolean flag)
+static TelReturn _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 TReturn _cmux_hal_send(TcoreHal *hal, unsigned int data_len, void *data)
+static TelReturn _cmux_hal_send(TcoreHal *hal,
+ guint data_len, void *data)
{
- 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");
+ TcoreCmuxObject *cmux_obj;
+ gchar *hal_name;
+ guchar *send_data;
+ gchar *channel_name;
+ guint channel_id;
+ guint len;
+
+ TelReturn ret = TEL_RETURN_FAILURE;
/* Check if Logical HAL is Powered ON */
if (tcore_hal_get_power_state(hal) == FALSE) {
err("HAL is not Powered UP");
- return TCORE_RETURN_FAILURE;
+ return TEL_RETURN_FAILURE;
}
/*
cmux_obj = _cmux_get_cmux_object(tcore_hal_ref_plugin(hal));
if (cmux_obj == NULL) {
err("Failed to find CMUX object");
- return TCORE_RETURN_FAILURE;
+ return TEL_RETURN_FAILURE;
}
channel_id = cmux_obj->max_cmux_channels + 1;
dbg("HAL name: [%s]", channel_name);
if (channel_name != NULL) {
- int i;
+ guint i;
/*
* Channel 0 is dedicated to CMUX Control Channel,
* 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 */
- g_free(hal_name);
+ tcore_free(hal_name);
break;
}
/* Free HAL name */
- g_free(hal_name);
+ tcore_free(hal_name);
}
/* Free memory */
- g_free(channel_name);
+ tcore_free(channel_name);
} else {
err("No name defined for HAL");
return ret;
/* 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 TCORE_RETURN_FAILURE;
+ return TEL_RETURN_FAILURE;
}
/* Send CMUX data */
return ret;
}
-static TReturn _cmux_hal_setup_netif(CoreObject *co,
- TcoreHalSetupNetifCallback func, void *user_data,
- unsigned int cid, gboolean enable)
+static TelReturn _cmux_hal_setup_netif(CoreObject *co,
+ TcoreHalSetupNetifCallback func, void *user_data,
+ guint cid, gboolean enable)
{
- tcore_cmux_object *cmux_obj;
+ TcoreCmuxObject *cmux_obj;
TcoreHal *hal;
dbg("Entry");
*/
cmux_obj = _cmux_get_cmux_object(tcore_hal_ref_plugin(hal));
if (cmux_obj == NULL)
- return TCORE_RETURN_FAILURE;
+ return TEL_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 struct tcore_hal_operations cmux_hops = {
+static TcoreHalOperations cmux_hops = {
.power = _cmux_hal_power,
.send = _cmux_hal_send,
.setup_netif = _cmux_hal_setup_netif,
};
-static TcoreHal *_cmux_create_logical_hal(tcore_cmux_object *cmux_obj,
- tcore_cmux_channel *channel)
+static TcoreHal *_cmux_create_logical_hal(TcoreCmuxObject *cmux_obj,
+ TcoreCmuxChannel *channel)
{
TcoreHal *hal;
- char channel_id_name[CMUX_MAX_CHANNEL_NAME];
+ gchar channel_id_name[CMUX_MAX_CHANNEL_NAME];
dbg("Entry");
if ((cmux_obj == NULL) || (channel == NULL)) {
/* 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,
- channel_id_name, &cmux_hops, TCORE_HAL_MODE_AT);
- dbg("hal: %p", hal);
+ (const gchar *)channel_id_name, &cmux_hops, TCORE_HAL_MODE_AT);
+ dbg("hal: [%p]", hal);
if (hal == NULL) {
err("Failed to allocate memory");
return NULL;
return hal;
}
-tcore_cmux_object *_cmux_new(int max_channels, unsigned int buffer_size)
+TcoreCmuxObject *_cmux_new(guint max_channels, guint buffer_size)
{
- tcore_cmux_object *cmux_obj;
- int i;
+ TcoreCmuxObject *cmux_obj;
+ guint i;
dbg("Entry");
/* Allocating memory for mux */
- cmux_obj = (tcore_cmux_object *)g_try_new0(tcore_cmux_object, 1);
+ cmux_obj = (TcoreCmuxObject *)tcore_try_malloc0(sizeof(TcoreCmuxObject));
if (cmux_obj == NULL) {
err("Failed to allocate memory");
return NULL;
/* Allocating memory for info_field */
cmux_obj->internal_mux.info_field =
- (unsigned char *)g_try_malloc0(buffer_size);
+ (guchar *)tcore_try_malloc0(buffer_size);
if (cmux_obj->internal_mux.info_field == NULL) {
err("Failed to allocate memory for info field");
goto ERROR;
for (i = 0; i < (max_channels + 1) ; i++) {
/* Allocating memory for channel_info */
cmux_obj->internal_mux.channel_info[i] =
- (tcore_cmux_channel *)g_try_new0(tcore_cmux_channel, 1);
+ (TcoreCmuxChannel *)tcore_try_malloc0(sizeof(TcoreCmuxChannel));
if (cmux_obj->internal_mux.channel_info[i] == NULL) {
err("Failed to allocate memory for channel_info of channel: [%d]", i);
goto ERROR;
ERROR:
/* Free allocated memory */
- 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);
- }
+ if (cmux_obj != NULL)
+ _cmux_free(cmux_obj);
err("Exit");
return NULL;
}
-static void _cmux_channel_init(tcore_cmux_object *cmux_obj, int channel_id)
+static void _cmux_channel_init(TcoreCmuxObject *cmux_obj, gint channel_id)
{
- tcore_cmux_channel *ch;
+ TcoreCmuxChannel *ch;
dbg("Entry");
ch = cmux_obj->internal_mux.channel_info[channel_id];
dbg("Channel ID [%d] - Initialized", channel_id);
}
-static void _cmux_close_channel(tcore_cmux_object *cmux_obj, int channel_id)
+static void _cmux_close_channel(TcoreCmuxObject *cmux_obj, gint channel_id)
{
- tcore_cmux_channel *ch;
- unsigned char *send_data;
- int ret, len = 0;
+ TcoreCmuxChannel *ch;
+ guchar *send_data;
+ guint len = 0;
+ TelReturn ret;
dbg("Entry");
ch = cmux_obj->internal_mux.channel_info[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);
+ 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);
dbg("Exit");
}
-static void _cmux_free(tcore_cmux_object *cmux_obj)
+static void _cmux_free(TcoreCmuxObject *cmux_obj)
{
- int channel;
+ guint channel;
dbg("Entry");
/*
* is NOT required.
*/
/* Free Information Field */
- g_free(cmux_obj->internal_mux.info_field);
+ tcore_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 */
- g_free(cmux_obj->internal_mux.channel_info[channel]);
+ tcore_free(cmux_obj->internal_mux.channel_info[channel]);
cmux_obj->internal_mux.channel_info[channel] = NULL;
}
/* Free CMUX Object */
- g_free(cmux_obj);
+ tcore_free(cmux_obj);
cmux_obj = NULL;
dbg("Exit");
}
static void _cmux_on_confirmation_message_send(TcorePending *plugin,
- gboolean result, void *user_data)
+ TelReturn result, void *user_data)
{
dbg("Message out from queue");
- if (result == FALSE) { /* Fail */
- err("SEND FAIL");
- } else
+ if (result == TEL_RETURN_SUCCESS) { /* Success */
dbg("SEND OK");
+ } else
+ err("SEND FAIL");
}
-void tcore_cmux_rcv_from_hal(TcoreHal *hal, unsigned char *data, size_t length)
+void tcore_cmux_rcv_from_hal(TcoreHal *hal, guchar *data, size_t length)
{
#define TCORE_CMUX_DECODE_FLAG_HUNT 0
#define TCORE_CMUX_DECODE_ADDR_HUNT 1
#define TCORE_CMUX_DECODE_DATA_HUNT 5
#define TCORE_CMUX_DECODE_FCS_HUNT 6
- tcore_cmux_object *cmux_obj;
+ TcoreCmuxObject *cmux_obj;
- static int decode_state = TCORE_CMUX_DECODE_FLAG_HUNT;
- static unsigned char dec_fcs;
- static unsigned char *dec_data;
+ static gint decode_state = TCORE_CMUX_DECODE_FLAG_HUNT;
+ static guchar dec_fcs;
+ static guchar *dec_data;
static unsigned short dec_length;
static size_t full_frame_len;
size_t pos = -1;
- int cp_len;
+ gint cp_len;
dbg("Entry");
/*
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;
}
FLAG_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;
}
}
/* CMUX initialization */
-TReturn tcore_cmux_init(TcoreHal *phy_hal, unsigned int frame_size,
- TcorePendingResponseCallback resp_cb, void *resp_cb_data)
+TelReturn tcore_cmux_init(TcoreHal *phy_hal, guint frame_size,
+ TcorePendingResponseCallback resp_cb, void *resp_cb_data)
{
TcorePending *pending = NULL;
- TcoreATRequest *req = NULL;
- TReturn ret = TCORE_RETURN_FAILURE;
- char *cmd_str;
+ TcoreAtRequest *req = NULL;
+ gchar *cmd_str;
+ TelReturn ret = TEL_RETURN_FAILURE;
dbg("Entry");
- if ((phy_hal == NULL) || (resp_cb == NULL))
- return TCORE_RETURN_EINVAL;
-
- if (frame_size > 32768)
- return TCORE_RETURN_EINVAL;
+ 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);
/*
* 3GPP 27.010 Section 5.7.2 Maximum Frame Size (N1)
cmd_str = g_strdup_printf("AT+CMUX=0,0,,1509,10,3,30,,");
if (cmd_str == NULL)
- return TCORE_RETURN_ENOMEM;
+ return TEL_RETURN_MEMORY_FAILURE;
/* Create Pending Request */
pending = tcore_pending_new(NULL, 0);
if (pending == NULL) {
dbg("Pending is NULL");
- g_free(cmd_str);
+ tcore_free(cmd_str);
return ret;
}
/* Create AT-Command Request */
- req = tcore_at_request_new(cmd_str, "+CMUX:", TCORE_AT_NO_RESULT);
+ req = tcore_at_request_new(cmd_str, "+CMUX:", TCORE_AT_COMMAND_TYPE_NO_RESULT);
/* Free command string */
- g_free(cmd_str);
+ tcore_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);
}
/* Setup Internal CMUX */
-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)
+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)
{
- tcore_cmux_object *cmux_obj;
- unsigned char *data;
- int data_len;
- int index;
+ TcoreCmuxObject *cmux_obj;
+ guchar *data;
+ guint data_len;
+ guint index;
- TReturn ret = TCORE_RETURN_FAILURE;
- dbg("Entry");
- dbg("Internal CMUX setup request");
+ TelReturn ret = TEL_RETURN_FAILURE;
+ dbg("Entry - Internal CMUX setup request");
/* Sanity Check */
- 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;
- }
+ 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);
dbg("Physical HAL: [0x%x] cmux_buf_size: [%d]",
- (unsigned int)phy_hal, cmux_buf_size);
+ (guint)phy_hal, cmux_buf_size);
/*
* Max Channels
*/
if ((max_channels +1) >= CMUX_CHANNEL_MAX) {
err("Number of Channels requested is greater than supported");
- return TCORE_RETURN_EINVAL;
+ return TEL_RETURN_INVALID_PARAMETER;
}
/* Create new CMUX Object */
cmux_obj = _cmux_new(max_channels, cmux_buf_size);
if (cmux_obj == NULL) {
err("Failed to create CMUX object");
- return TCORE_RETURN_ENOMEM;
+ return TEL_RETURN_MEMORY_FAILURE;
}
/* Maximum Buffer size for CMUX frame processing */
cmux_obj->max_cmux_channels = max_channels + 1;
/* Allocating buffer for CMUX frames proposing */
- cmux_obj->cmux_buffer = (unsigned char *)g_try_malloc0(cmux_buf_size);
+ cmux_obj->cmux_buffer =
+ (guchar *)tcore_try_malloc0(cmux_buf_size);
if (cmux_obj->cmux_buffer == NULL) {
err("Failed to allocate memory");
- ret = TCORE_RETURN_ENOMEM;
+ ret = TEL_RETURN_MEMORY_FAILURE;
goto ERROR;
}
/* CMUX setup callback function */
cmux_obj->internal_mux.channel_setup_cb = channel_setup_cb;
- cmux_obj->internal_mux.channel_setup_user_data = channel_setup_user_data;
+ cmux_obj->internal_mux.channel_setup_cb_data = channel_setup_cb_data;
/* CMUX setup complete callback function */
cmux_obj->internal_mux.setup_complete_cb = setup_complete_cb;
- cmux_obj->internal_mux.setup_complete_user_data = setup_complete_user_data;
+ cmux_obj->internal_mux.setup_complete_cb_data = setup_complete_cb_data;
/*
* After CMUX setup, AT parse functionality of PHY HAL should be disabled,
dbg("Opening Channel ID [%d]", 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, index,
+ CMUX_COMMAND_SABM,
+ 0x01, 0x01, 0x01, &data_len);
if (data_len == 0) {
err("Failed to encode");
goto ERROR;
/* Send CMUX data */
ret = _cmux_send_data(cmux_obj->phy_hal, data_len, data);
- if (ret != TCORE_RETURN_SUCCESS) {
- err("Failed to send CMUX Control Request for Channel ID: [%d]", index);
+ if (ret != TEL_RETURN_SUCCESS) {
+ err("Failed to send CMUX Control Request for "
+ "Channel ID: [%d]", index);
goto ERROR;
} else
dbg("CMUX Control Request sent to CP");
/* Close CMUX */
void tcore_cmux_close(TcoreHal *phy_hal,
- cmux_channel_close_cb_func channel_close_cb, gpointer channel_close_user_data)
+ CmuxChannelCloseCbFunc channel_close_cb, gpointer channel_close_cb_data)
{
- tcore_cmux_object *cmux_obj;
- int channel_id;
+ TcoreCmuxObject *cmux_obj;
+ guint channel_id;
dbg("Entry");
/*
/* Invoke callback */
if (channel_close_cb != NULL)
- channel_close_cb(cmux_obj->internal_mux.channel_info[channel_id]->hal,
- channel_close_user_data);
+ channel_close_cb(
+ cmux_obj->internal_mux.channel_info[channel_id]->hal,
+ channel_close_cb_data);
/* Free Logical HAL for Channel */
tcore_hal_free(cmux_obj->internal_mux.channel_info[channel_id]->hal);
}
/* Freeing CMUX frame processing buffer */
- g_free(cmux_obj->cmux_buffer);
+ tcore_free(cmux_obj->cmux_buffer);
cmux_obj->cmux_buffer = NULL;
/* Change the mode of PHYSICAL HAL from Transparent to AT */
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include "server.h"
struct tcore_plugin_type {
- char *filename;
+ gchar *filename;
const struct tcore_plugin_define_desc *desc;
void *handle;
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 char *filename, void *handle)
+ const struct tcore_plugin_define_desc *desc,
+ const gchar *filename, void *handle)
{
TcorePlugin *p;
p = g_try_new0(struct tcore_plugin_type, 1);
- if (p == NULL)
+ if (p == NULL) {
+ err("plugin is NULL");
return NULL;
+ }
/*
* Assign 'filename' name irrespective of if it is NULL,
* g_strdup would take care of this scenario.
*/
- p->filename = g_strdup(filename);
+ p->filename = tcore_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)
{
- GSList *list;
- CoreObject *o;
-
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
return;
-
- dbg("");
-
- if (plugin->list_co) {
- for (list = plugin->list_co; list; list = list->next) {
- o = list->data;
- if (o == NULL)
- continue;
-
- tcore_object_free(o);
- list->data = NULL;
- }
-
- g_slist_free(plugin->list_co);
- plugin->list_co = NULL;
}
- if (plugin->filename) {
- g_free(plugin->filename);
- plugin->filename = NULL;
- }
-
- if (plugin->property) {
- g_hash_table_destroy(plugin->property);
- plugin->property = NULL;
- }
+ dbg("Plug-in '%s' freeing", plugin->filename);
- plugin->desc = NULL;
+ /* 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->handle) {
+ if (plugin->handle)
dlclose(plugin->handle);
- plugin->handle = NULL;
- }
- g_free(plugin);
+ plugin->desc = NULL;
+
+ tcore_free(plugin);
}
const struct tcore_plugin_define_desc *tcore_plugin_get_description(TcorePlugin *plugin)
{
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
return NULL;
+ }
return plugin->desc;
}
-char *tcore_plugin_get_filename(TcorePlugin *plugin)
+gchar *tcore_plugin_get_filename(TcorePlugin *plugin)
{
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
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 g_strdup(plugin->filename);
+ return tcore_strdup(plugin->filename);
}
-char* tcore_plugin_ref_plugin_name(TcorePlugin *plugin)
+const gchar *tcore_plugin_ref_plugin_name(TcorePlugin *plugin)
{
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
return NULL;
+ }
- if (plugin->desc == NULL)
+ if (plugin->desc == NULL) {
+ err("desc is NULL");
return NULL;
+ }
return plugin->desc->name;
}
Server *tcore_plugin_ref_server(TcorePlugin *plugin)
{
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
return NULL;
+ }
return plugin->parent_server;
}
-TReturn tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data)
+TelReturn tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data)
{
- if (plugin == NULL)
- return TCORE_RETURN_EINVAL;
+ if (plugin == NULL) {
+ err("plugin is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
plugin->user_data = user_data;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
void *tcore_plugin_ref_user_data(TcorePlugin *plugin)
{
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
return FALSE;
+ };
return plugin->user_data;
}
-TReturn tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co)
+TelReturn tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co)
{
- if ((plugin == NULL) || (co == NULL))
- return TCORE_RETURN_EINVAL;
-
- dbg("add core_object! (Type: [0x%x])", tcore_object_get_type(co));
+ if ((plugin == NULL) || (co == NULL)) {
+ err("plugin: [%p] co: [%p]", plugin, co);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+ /* 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 TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
+}
+
+TelReturn 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;
+ }
+
+ 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;
+}
+
+GSList *tcore_plugin_ref_core_objects(TcorePlugin *plugin)
+{
+ if (plugin == NULL) {
+ err("plugin is NULL");
+ return NULL;
+ }
+
+ return plugin->list_co;
}
CoreObject *tcore_plugin_ref_core_object(TcorePlugin *plugin, unsigned int type)
GSList *list;
CoreObject *co;
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
return NULL;
+ }
for (list = plugin->list_co; list; list = list->next) {
co = list->data;
- if (co == NULL)
- continue;
-
- if (tcore_object_get_type(co) == type) {
- return co;
- }
+ if (co != NULL)
+ if (tcore_object_get_type(co) == type)
+ return co;
}
return NULL;
GSList *list, *rlist = NULL;
CoreObject *co;
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
return NULL;
+ }
for (list = plugin->list_co; list; list = list->next) {
co = list->data;
- if (co == NULL)
- continue;
-
- if (tcore_object_get_type(co) == type) {
- rlist = g_slist_append(rlist, co);
+ if (co != NULL) {
+ /* Generate list of Core Object of similar type */
+ if (tcore_object_get_type(co) == type)
+ rlist = g_slist_append(rlist, co);
}
}
return rlist;
}
-TReturn tcore_plugin_core_object_event_emit(TcorePlugin *plugin, const char *event, const void *event_info)
+TelReturn tcore_plugin_core_object_event_emit(TcorePlugin *plugin,
+ const gchar *event, const void *event_info)
{
GSList *list;
CoreObject *co;
- if (plugin == NULL)
- return TCORE_RETURN_EINVAL;
-
- dbg("event(%s) emit", event);
+ if (plugin == NULL) {
+ err("plugin is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+ dbg("Emitting '%s' event!!!", event);
for (list = plugin->list_co; list; list = list->next) {
co = list->data;
- if (co == NULL)
- continue;
-
- tcore_object_emit_callback(co, event, event_info);
+ if (co != NULL)
+ tcore_object_emit_callback(co, event, event_info);
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_plugin_link_property(TcorePlugin *plugin, const char *key, void *data)
+TelReturn tcore_plugin_link_property(TcorePlugin *plugin, const gchar *key, void *data)
{
void *prev;
- if (plugin == NULL)
- return TCORE_RETURN_EINVAL;
+ if (plugin == NULL) {
+ err("plugin is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- if (plugin->property == NULL)
- return TCORE_RETURN_EINVAL;
+ if (plugin->property == NULL) {
+ err("property is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
prev = g_hash_table_lookup(plugin->property, key);
if (prev != NULL) {
- g_free(prev);
+ tcore_free(prev);
g_hash_table_replace(plugin->property, (gpointer)key, data);
}
else {
- g_hash_table_insert(plugin->property, g_strdup(key), data);
+ g_hash_table_insert(plugin->property, tcore_strdup(key), data);
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-void *tcore_plugin_ref_property(TcorePlugin *plugin, const char *key)
+void *tcore_plugin_ref_property(TcorePlugin *plugin, const gchar *key)
{
- if (plugin == NULL)
+ if (plugin == NULL) {
+ err("plugin is NULL");
return NULL;
+ };
- if (plugin->property == NULL)
+ if (plugin->property == NULL) {
+ err("property is NULL");
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);
+}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#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;
- unsigned int next_id;
+ guint next_id;
};
struct tcore_pending_type {
- unsigned int id;
+ guint id; /**< Unique ID: to Identify the Pending Request */
- TcorePendingSendCallback on_send;
- void *on_send_user_data;
- TcorePendingTimeoutCallback on_timeout;
- void *on_timeout_user_data;
- TcorePendingResponseCallback on_response;
- void *on_response_user_data;
+ TcorePendingPriority priority; /**< Prority */
+ gboolean enable;
- enum tcore_pending_priority priority;
+ /**< Request data */
void *data;
- unsigned int data_len;
-
- gboolean enable;
- unsigned int timeout;
- time_t timestamp;
- gboolean flag_sent;
- gboolean flag_received_response;
- gboolean flag_auto_free_after_sent;
+ guint data_len;
- guint timer_src;
+ /**< 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 */
- UserRequest *ur;
+ /**< Essential references */
+ void *request;
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;
};
-enum search_field {
+typedef enum {
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,
-};
+ SEARCH_FIELD_COMMAND_SENT = 0x22
+} TcoreSearchField;
-static gboolean _on_pending_timeout(gpointer user_data)
+static gboolean __on_pending_timeout(gpointer user_data)
{
- TcorePending *p = user_data;
+ TcorePending *pending = user_data;
- dbg("pending timeout!!");
+ dbg("'pending' timeout!!!");
- if (p == NULL)
+ if (pending == NULL) {
+ err("pending is NULL");
return FALSE;
+ }
- tcore_pending_emit_timeout_callback(p);
+ /* Emit timeout callback */
+ tcore_pending_emit_timeout_callback(pending);
- p->on_response = NULL;
- tcore_hal_dispatch_response_data(p->queue->hal, p->id, 0, NULL);
+ pending->on_response = NULL;
+ tcore_hal_dispatch_response_data(pending->queue->hal, pending->id, 0, NULL);
return FALSE;
}
-TcorePending *tcore_pending_new(CoreObject *co, unsigned int id)
+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 *p;
+ TcorePending *pending;
- p = g_try_new0(struct tcore_pending_type, 1);
- if (p == NULL)
+ /* Create 'pending' */
+ pending = g_try_new0(struct tcore_pending_type, 1);
+ if (pending == NULL) {
+ err("pending is NULL");
return NULL;
+ }
- p->id = id;
- time(&p->timestamp);
+ /*
+ * Initialize parameters
+ *
+ * By default others are initialized to '0' or NULL.
+ */
+ pending->id = id;
+ pending->priority = TCORE_PENDING_PRIORITY_DEFAULT;
- 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);
+ time(&pending->timestamp);
- return p;
+ pending->co = co;
+ pending->plugin = tcore_object_ref_plugin(co);
+
+ return pending;
}
void tcore_pending_free(TcorePending *pending)
{
- if (pending == NULL)
+ TcoreHalMode hal_mode;
+
+ if (pending == NULL) {
+ err("pending is NULL");
return;
+ }
- dbg("pending(0x%x) free, id=0x%x", (unsigned int)pending, pending->id);
+ dbg("Freeing - pending: [%p] ID: [0x%x]", (guint)pending, pending->id);
- if ((tcore_hal_get_mode(pending->queue->hal) != TCORE_HAL_MODE_AT)
- && (tcore_hal_get_mode(pending->queue->hal) != TCORE_HAL_MODE_TRANSPARENT))
- {
+ 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)
- g_free(pending->data);
+ tcore_free(pending->data);
}
- if (pending->timer_src) {
+ if (pending->timer_src)
g_source_remove(pending->timer_src);
- }
- g_free(pending);
+ tcore_free(pending);
}
-unsigned int tcore_pending_get_id(TcorePending *pending)
+guint tcore_pending_get_id(TcorePending *pending)
{
- if (pending == NULL)
+ if (pending == NULL) {
+ err("pending is NULL");
return 0;
+ }
return pending->id;
}
-TReturn tcore_pending_set_auto_free_status_after_sent(TcorePending *pending,
+TelReturn tcore_pending_set_auto_free_status_after_sent(TcorePending *pending,
gboolean flag)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
pending->flag_auto_free_after_sent = flag;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
gboolean tcore_pending_get_auto_free_status_after_sent(TcorePending *pending)
{
- if (pending == NULL)
+ if (pending == NULL) {
+ err("pending is NULL");
return FALSE;
+ }
return pending->flag_auto_free_after_sent;
}
-TReturn tcore_pending_set_request_data(TcorePending *pending,
- unsigned int data_len, void *data)
+TelReturn tcore_pending_set_request_data(TcorePending *pending,
+ guint data_len, void *data)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
if (pending->data) {
if (pending->data_len != 0) {
- g_free(pending->data);
+ tcore_free(pending->data);
pending->data = NULL;
+ pending->data_len = 0;
}
}
pending->data_len = data_len;
- if (pending->data_len > 0) {
- pending->data = g_try_malloc0(data_len);
- if (pending->data == NULL)
- return TCORE_RETURN_ENOMEM;
-
- memcpy(pending->data, data, data_len);
- }
- else {
+ if (data_len > 0)
+ pending->data = tcore_memdup((gconstpointer)data, data_len);
+ else
pending->data = data;
- }
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-void *tcore_pending_ref_request_data(TcorePending *pending, unsigned int *data_len)
+void *tcore_pending_ref_request_data(TcorePending *pending, guint *data_len)
{
- if (pending == NULL)
+ if (pending == NULL) {
+ err("pending is NULL");
return NULL;
+ }
if (data_len)
*data_len = pending->data_len;
return pending->data;
}
-TReturn tcore_pending_set_priority(TcorePending *pending,
- enum tcore_pending_priority priority)
+TelReturn tcore_pending_set_priority(TcorePending *pending, TcorePendingPriority priority)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
pending->priority = priority;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_get_priority(TcorePending *pending,
- enum tcore_pending_priority *result_priority)
+TelReturn tcore_pending_get_priority(TcorePending *pending, TcorePendingPriority *priority)
{
- if ((pending == NULL) || (result_priority == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((pending == NULL) || (priority == NULL)) {
+ err("pending: [%p] priority: [%p]", pending, priority);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- *result_priority = pending->priority;
+ *priority = pending->priority;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_set_timeout(TcorePending *pending, unsigned int timeout)
+TelReturn tcore_pending_set_timeout(TcorePending *pending, guint timeout)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
pending->timeout = timeout;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_get_send_status(TcorePending *pending,
- gboolean *result_status)
+TelReturn tcore_pending_get_send_status(TcorePending *pending, gboolean *status)
{
- if ((pending == NULL) || (result_status == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((pending == NULL) || (status == NULL)) {
+ err("pending: [%p] status: [%p]", pending, status);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- *result_status = pending->flag_sent;
+ *status = pending->flag_sent;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_set_send_callback(TcorePending *pending,
+TelReturn tcore_pending_set_send_callback(TcorePending *pending,
TcorePendingSendCallback func, void *user_data)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
pending->on_send = func;
pending->on_send_user_data = user_data;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_set_timeout_callback(TcorePending *pending,
+TelReturn tcore_pending_set_timeout_callback(TcorePending *pending,
TcorePendingTimeoutCallback func, void *user_data)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
pending->on_timeout = func;
pending->on_timeout_user_data = user_data;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_set_response_callback(TcorePending *pending,
+TelReturn tcore_pending_set_response_callback(TcorePending *pending,
TcorePendingResponseCallback func, void *user_data)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
pending->on_response = func;
pending->on_response_user_data = user_data;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_emit_send_callback(TcorePending *pending, gboolean result)
+TelReturn tcore_pending_emit_send_callback(TcorePending *pending,
+ TelReturn send_status)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
pending->flag_sent = TRUE;
- if (pending->on_send)
- pending->on_send(pending, result, pending->on_send_user_data);
+ if (pending->on_send) {
+ pending->on_send(pending,
+ send_status, pending->on_send_user_data);
+ }
- if (result == TRUE) {
- if (pending->flag_auto_free_after_sent == FALSE && pending->timeout > 0) {
+ if (send_status == TEL_RETURN_SUCCESS) {
+ if (pending->flag_auto_free_after_sent == FALSE
+ && pending->timeout > 0) {
/* timer */
- dbg("start pending timer! (%d secs)", pending->timeout);
- pending->timer_src = g_timeout_add_seconds(pending->timeout, _on_pending_timeout, pending);
+ dbg("Start pending timer!!! [Timeout: %d secs]",
+ pending->timeout);
+ pending->timer_src =
+ g_timeout_add_seconds(pending->timeout,
+ __on_pending_timeout, pending);
}
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_emit_timeout_callback(TcorePending *pending)
+TelReturn tcore_pending_emit_timeout_callback(TcorePending *pending)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
if (pending->on_timeout)
pending->on_timeout(pending, pending->on_timeout_user_data);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_pending_emit_response_callback(TcorePending *pending,
- int data_len, const void *data)
+TelReturn tcore_pending_emit_response_callback(TcorePending *pending,
+ guint data_len, const void *data)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
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 TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
CoreObject *tcore_pending_ref_core_object(TcorePending *pending)
{
- if (pending == NULL)
+ if (pending == NULL) {
+ err("pending is NULL");
return NULL;
+ }
return pending->co;
}
TcorePlugin *tcore_pending_ref_plugin(TcorePending *pending)
{
- if (pending == NULL)
+ if (pending == NULL) {
+ err("pending is NULL");
return NULL;
+ }
return pending->plugin;
}
-TReturn tcore_pending_link_user_request(TcorePending *pending, UserRequest *ur)
+TelReturn tcore_pending_link_request(TcorePending *pending, void *request)
{
- if (pending == NULL)
- return TCORE_RETURN_EINVAL;
+ if (pending == NULL) {
+ err("pending is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- pending->ur = ur;
+ pending->request = request;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-UserRequest *tcore_pending_ref_user_request(TcorePending *pending)
+void *tcore_pending_ref_request(TcorePending *pending)
{
- if (pending == NULL)
+ if (pending == NULL) {
+ err("pending is NULL");
return NULL;
+ }
- return pending->ur;
+ return pending->request;
}
TcoreQueue *tcore_queue_new(TcoreHal *h)
TcoreQueue *queue;
queue = g_try_new0(struct tcore_queue_type, 1);
- if (queue == NULL)
+ if (queue == NULL) {
+ err("Failed to allocate memory");
return FALSE;
+ }
queue->hal = h;
queue->gq = g_queue_new();
if (queue->gq == NULL) {
- g_free(queue);
+ err("Failed to create Queue");
+
+ tcore_free(queue);
return FALSE;
}
void tcore_queue_free(TcoreQueue *queue)
{
- if (queue == NULL)
+ if (queue == NULL) {
+ err("pending is NULL");
return;
+ }
- if (queue->gq)
- g_queue_free(queue->gq);
-
- g_free(queue);
-}
-
-static void _tcore_queue_push_head(TcoreQueue *queue, TcorePending *pending)
-{
- int i = -1;
- TcorePending *tmp;
-
- do {
- i++;
- tmp = g_queue_peek_nth(queue->gq, i);
- if (tmp == NULL) {
- break;
- }
-
- if (tmp->priority == TCORE_PENDING_PRIORITY_IMMEDIATELY)
- continue;
-
- break;
- } while (1);
-
- g_queue_push_nth(queue->gq, pending, i);
+ /* Free resources */
+ g_queue_free(queue->gq);
+ tcore_free(queue);
}
-TReturn tcore_queue_push(TcoreQueue *queue, TcorePending *pending)
+TelReturn tcore_queue_push(TcoreQueue *queue, TcorePending *pending)
{
- enum tcore_pending_priority priority;
-
- if ((queue == NULL) || (pending == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((queue == NULL) || (pending == NULL)) {
+ err("queue: [%p] pending: [%p]", queue, pending);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
if (pending->id == 0) {
pending->id = queue->next_id;
queue->next_id++;
}
- 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;
+ switch (pending->priority) {
+ case TCORE_PENDING_PRIORITY_IMMEDIATELY:
+ case TCORE_PENDING_PRIORITY_HIGH:
+ __queue_push_head(queue, pending);
+ break;
- case TCORE_PENDING_PRIORITY_DEFAULT:
- case TCORE_PENDING_PRIORITY_LOW:
- pending->queue = queue;
- g_queue_push_tail(queue->gq, pending);
- break;
+ case TCORE_PENDING_PRIORITY_DEFAULT:
+ case TCORE_PENDING_PRIORITY_LOW:
+ g_queue_push_tail(queue->gq, pending);
+ break;
- default:
- return TCORE_RETURN_EINVAL;
- break;
+ default:
+ err("Invalid priority: [%d]", pending->priority);
+ return TEL_RETURN_INVALID_PARAMETER;
}
+ pending->queue = queue;
- dbg("pending(0x%x) push to queue. queue length=%d",
- (unsigned int)pending, g_queue_get_length(queue->gq));
+ dbg("Push to Queue - pending: [%p] queue length: [%d]",
+ (guint)pending, g_queue_get_length(queue->gq));
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
TcorePending *tcore_queue_pop(TcoreQueue *queue)
{
- if (queue == NULL)
+ if (queue == NULL) {
+ err("pending is NULL");
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;
- int i = 0;
+ guint i = 0;
- if (queue == NULL)
+ if (queue == NULL) {
+ err("queue is NULL");
return NULL;
+ }
do {
tmp = g_queue_peek_nth(queue->gq, i);
- if (tmp == NULL)
- return NULL;
-
if (tmp == pending) {
g_queue_pop_nth(queue->gq, i);
return tmp;
}
i++;
- } while(1);
+ } while(tmp != NULL);
return NULL;
}
TcorePending *tcore_queue_pop_timeout_pending(TcoreQueue *queue)
{
- int i = 0;
+ guint i = 0;
TcorePending *pending = NULL;
time_t cur_time = 0;
if (pending == NULL)
return NULL;
- if (cur_time - pending->timestamp >= (int)pending->timeout) {
+ if (cur_time - pending->timestamp >= (gint)pending->timeout) {
pending = g_queue_pop_nth(queue->gq, i);
break;
}
TcorePending *tcore_queue_ref_head(TcoreQueue *queue)
{
- if (queue == NULL)
+ if (queue == NULL) {
+ err("queue is NULL");
return NULL;
+ }
return g_queue_peek_head(queue->gq);
}
TcorePending *tcore_queue_ref_tail(TcoreQueue *queue)
{
- if (queue == NULL)
+ if (queue == NULL) {
+ err("queue is NULL");
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 == NULL)
- return NULL;
-
- do {
- pending = g_queue_peek_nth(queue->gq, i);
- if (pending == 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;
- }
- }
- 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,
- enum tcore_request_command command, gboolean flag_sent)
+ TcoreCommand command, gboolean flag_sent)
{
if (flag_sent)
- return _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_SENT, FALSE);
+ return __queue_search_full(queue, 0,
+ command, SEARCH_FIELD_COMMAND_SENT, FALSE);
- return _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_WAIT, FALSE);
+ return __queue_search_full(queue, 0,
+ command, SEARCH_FIELD_COMMAND_WAIT, FALSE);
}
-TcorePending *tcore_queue_pop_by_id(TcoreQueue *queue, unsigned int id)
+TcorePending *tcore_queue_pop_by_id(TcoreQueue *queue, guint id)
{
- if (queue == NULL)
+ if (queue == NULL) {
+ err("queue is NULL");
return NULL;
+ }
- return _tcore_queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, TRUE);
+ return __queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, TRUE);
}
-TcorePending *tcore_queue_ref_pending_by_id(TcoreQueue *queue, unsigned int id)
+TcorePending *tcore_queue_ref_pending_by_id(TcoreQueue *queue, guint id)
{
- if (queue == NULL)
+ if (queue == NULL) {
+ err("queue is NULL");
return NULL;
+ }
- return _tcore_queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, FALSE);
+ return __queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, FALSE);
}
TcorePending *tcore_queue_ref_next_pending(TcoreQueue *queue)
{
TcorePending *pending = NULL;
- int i = 0;
+ gint i = 0;
- if (queue == NULL)
+ 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;
}
/* 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(0x%x) is waiting state.", (unsigned int)pending);
+ dbg("pending: [%p] is waiting state", (guint)pending);
return NULL;
}
return pending;
}
-unsigned int tcore_queue_get_length(TcoreQueue *queue)
+guint tcore_queue_get_length(TcoreQueue *queue)
{
- if (queue == NULL)
+ if (queue == NULL) {
+ err("queue is NULL");
return 0;
+ }
return g_queue_get_length(queue->gq);
}
TcoreHal *tcore_queue_ref_hal(TcoreQueue *queue)
{
- if (queue == NULL)
+ if (queue == NULL) {
+ err("queue is NULL");
return NULL;
+ }
return queue->hal;
}
-TReturn tcore_queue_cancel_pending_by_command(TcoreQueue *queue, enum tcore_request_command command)
+TelReturn tcore_queue_cancel_pending_by_command(TcoreQueue *queue,
+ TcoreCommand command)
{
TcorePending *pending;
- if (queue == NULL)
- return TCORE_RETURN_EINVAL;
+ if (queue == NULL) {
+ err("queue is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
while (1) {
- pending = _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_ALL, FALSE);
+ pending = __queue_search_full(queue, 0,
+ command, SEARCH_FIELD_COMMAND_ALL, FALSE);
if (pending == NULL)
break;
- dbg("pending(0x%x) cancel", (unsigned int)pending);
+ dbg("pending: [%p] cancel", (guint)pending);
if (queue->hal) {
- tcore_hal_dispatch_response_data(queue->hal, pending->id, 0, NULL);
+ tcore_hal_dispatch_response_data(queue->hal,
+ pending->id, 0, NULL);
}
else {
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 TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
*/
#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/gprintf.h>
#include "tcore.h"
-#include "plugin.h"
#include "server.h"
-#include "user_request.h"
+#include "plugin.h"
#include "core_object.h"
-#include "co_ps.h"
#include "communicator.h"
#include "storage.h"
#include "udev.h"
struct tcore_server_type {
GMainLoop *mainloop;
+
GSList *plugins;
GSList *communicators;
GSList *storages;
GSList *template_co;
- GSList *hook_list_request;
GSList *hook_list_notification;
TcorePlugin *default_plugin;
};
struct tcore_modem_type {
- char *cp_name;
+ gchar *cp_name;
TcorePlugin *modem_iface_plugin;
TcorePlugin *modem_plugin;
void *mapping_tbl;
};
-struct hook_request_type {
- enum tcore_request_command command;
- tcore_server_request_hook func;
- void *user_data;
-};
-
struct hook_notification_type {
- enum tcore_notification_command command;
- tcore_server_notification_hook func;
+ TcoreServerNotification 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;
return 1;
return tcore_plugin_get_description(plugin1)->priority -
- tcore_plugin_get_description(plugin2)->priority;
+ tcore_plugin_get_description(plugin2)->priority;
}
-static char *_server_enumerate_modem(TcorePlugin *plugin)
+static gchar *_server_enumerate_modem(TcorePlugin *plugin)
{
- static unsigned int cp_counter = 0;
- char *filename;
+ static guint cp_counter = 0;
+ const gchar *filename;
if (plugin == NULL)
return NULL;
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 *__server_find_modem(Server *s,
+ TcorePlugin *modem_iface_plugin, TcorePlugin *modem_plugin)
{
GSList *list;
TcoreModem *modem;
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));
+ modem_plugin, tcore_plugin_ref_plugin_name(modem_plugin),
+ modem_iface_plugin, tcore_plugin_ref_plugin_name(modem_iface_plugin));
for (list = s->modems; list; list = list->next) {
modem = list->data;
*/
if ((modem_iface_plugin == modem_plugin)
&& ((modem_iface_plugin == modem->modem_iface_plugin)
- || (modem_plugin == modem->modem_plugin))) {
+ || (modem_plugin == modem->modem_plugin))) {
dbg("'modem' found!!!");
return modem;
}
}
err("Modem not found");
-
return NULL;
}
{
Server *s;
+ /* Server structure */
s = g_try_new0(struct tcore_server_type, 1);
- if (s == NULL)
+ if (s == NULL) {
+ err("Failed to allocate memory");
return NULL;
+ }
+ /* g-main loop */
s->mainloop = g_main_loop_new (NULL, FALSE);
if (s->mainloop == NULL) {
- free(s);
+ err("Failed to allocate memory");
+
+ /* Free resources */
+ tcore_free(s);
return NULL;
}
+ /* Initialize Server structure */
s->plugins = NULL;
s->communicators = NULL;
s->storages = NULL;
s->template_co = NULL;
- s->hook_list_request = NULL;
s->hook_list_notification = NULL;
s->default_plugin = NULL;
TcorePlugin *p;
const struct tcore_plugin_define_desc *desc;
- if (s == NULL)
+ if (s == NULL) {
+ err("Server is NULL");
return;
+ }
+ /* Unref g-main loop */
if (s->mainloop)
g_main_loop_unref(s->mainloop);
- for (list = s->plugins; list; list = list->next) {
- p = list->data;
- if (p == NULL)
- continue;
-
- desc = (struct tcore_plugin_define_desc *)tcore_plugin_get_description(p);
- if ((desc == NULL) || (desc->unload == NULL))
- continue;
-
- desc->unload(p);
+ /* Unload 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);
- tcore_plugin_free(p);
+ /* Unload Plug-in */
+ if ((desc != NULL) && (desc->unload != NULL))
+ desc->unload(p);
- list->data = NULL;
+ /* Free resource */
+ tcore_plugin_free(p);
+ list->data = NULL;
+ }
}
- if (s->hook_list_notification)
- g_slist_free_full(s->hook_list_notification, g_free);
-
- if (s->hook_list_request)
- g_slist_free_full(s->hook_list_request, g_free);
-
- if (s->template_co)
- g_slist_free(s->template_co);
-
- if (s->storages)
- g_slist_free(s->storages);
-
- if (s->communicators)
- g_slist_free(s->communicators);
-
- 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);
/* Freeing Server */
- g_free(s);
+ tcore_free(s);
}
-TReturn tcore_server_run(Server *s)
+TelReturn tcore_server_run(Server *s)
{
- char *version;
+ gchar *version;
- if ((s == NULL)|| (s->mainloop == NULL))
- return TCORE_RETURN_EINVAL;
+ 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;
+ }
version = tcore_util_get_version();
if (version) {
dbg("libtcore version: %s", version);
- free(version);
+ tcore_free(version);
}
- tcore_server_send_notification(s, NULL, TNOTI_SERVER_RUN, 0, NULL);
+ /* Send 'Server running' notification */
+ tcore_server_send_server_notification(s,
+ TCORE_SERVER_NOTIFICATION_SERVER_RUN,
+ 0, NULL);
+ /* Enter g-main loop */
g_main_loop_run(s->mainloop);
- return TCORE_RETURN_SUCCESS;
+ dbg("~*~*~* Server Exit *~*~*~");
+
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_server_exit(Server *s)
+TelReturn tcore_server_exit(Server *s)
{
- if ((s == NULL)|| (s->mainloop == NULL))
- return TCORE_RETURN_EINVAL;
+ 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;
+ }
+ /* Quit g-main loop */
g_main_loop_quit(s->mainloop);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_server_add_plugin(Server *s, TcorePlugin *plugin)
+TelReturn tcore_server_add_plugin(Server *s, TcorePlugin *plugin)
{
- if ((s == NULL)|| (plugin == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((s == NULL) || (plugin == NULL)) {
+ err("s: [%p] plugin: [%p]", s, plugin);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- s->plugins = g_slist_insert_sorted(s->plugins, plugin, _compare_priority);
+ /*
+ * 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);
- tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_PLUGIN, 0, NULL);
+ /* Send 'Plug-in added' notification */
+ tcore_server_send_server_notification(s,
+ TCORE_SERVER_NOTIFICATION_ADDED_PLUGIN,
+ 0, NULL);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TcorePlugin *tcore_server_find_plugin(Server *s, const char *name)
+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)
{
GSList *list;
TcoreModem *modem;
- dbg("Name: [%s]", name);
+ dbg("Plug-in Name: [%s]", name);
for (list = s->modems; list; list = list->next) {
modem = list->data;
- if (modem == NULL)
- continue;
-
- if (g_strcmp0(modem->cp_name, name) == 0)
- return modem->modem_plugin;
+ if (modem != NULL)
+ if (g_strcmp0(modem->cp_name, name) == 0)
+ return modem->modem_plugin;
}
- err("Modem plugin not found");
-
+ err("Modem plugin '%s' not found", name);
return NULL;
}
GSList *tcore_server_ref_plugins(Server *s)
{
- if (s == NULL)
+ if (s == NULL) {
+ err("server is NULL");
return NULL;
+ }
return s->plugins;
}
-TReturn tcore_server_add_communicator(Server *s, Communicator *comm)
+TelReturn tcore_server_add_communicator(Server *s, Communicator *comm)
{
- if ((s == NULL)|| (comm == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((s == NULL) || (comm == NULL)) {
+ err("s: [%p] comm: [%p]", s, comm);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+ /*
+ * Communication addition to Server list
+ *
+ * Communicators are added to the beginning of the list (prepended)
+ */
s->communicators = g_slist_insert(s->communicators, comm, 0);
- tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_COMMUNICATOR, 0, NULL);
+ /* Send 'Communicator added' notification */
+ tcore_server_send_server_notification(s,
+ TCORE_SERVER_NOTIFICATION_ADDED_COMMUNICATOR,
+ 0, NULL);
+
+ return TEL_RETURN_SUCCESS;
+}
+
+TelReturn 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);
+
+ /* Send 'Communicator removed' notification */
+ tcore_server_send_server_notification(s,
+ TCORE_SERVER_NOTIFICATION_REMOVED_COMMUNICATOR,
+ 0, NULL);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
GSList *tcore_server_ref_communicators(Server *s)
{
- if (s == NULL)
+ if (s == NULL) {
+ err("server is NULL");
return NULL;
+ }
return s->communicators;
}
-Communicator *tcore_server_find_communicator(Server *s, const char *name)
+Communicator *tcore_server_find_communicator(Server *s, const gchar *name)
{
GSList *list;
Communicator *comm;
+ dbg("Communicator Name: [%s]", name);
+
for (list = s->communicators; list; list = list->next) {
comm = list->data;
- if (comm == NULL) {
- continue;
- }
-
- if (g_strcmp0(tcore_communicator_ref_name(comm), name) == 0) {
- return comm;
- }
+ if (comm != NULL)
+ if (g_strcmp0(tcore_communicator_ref_name(comm), name) == 0)
+ return comm;
}
return NULL;
}
-TReturn tcore_server_add_storage(Server *s, Storage *strg)
+TelReturn tcore_server_add_storage(Server *s, TcoreStorage *strg)
{
- if ((s == NULL)|| (strg == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((s == NULL) || (strg == NULL)) {
+ err("s: [%p] strg: [%p]", s, strg);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+ /*
+ * Storage addition to Server list
+ *
+ * Storages are added to the beginning of the list (prepended)
+ */
s->storages = g_slist_insert(s->storages, strg, 0);
- tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_STORAGE, 0, NULL);
+ /* Send 'Storage added' notification */
+ tcore_server_send_server_notification(s,
+ TCORE_SERVER_NOTIFICATION_ADDED_STORAGE,
+ 0, NULL);
- return TCORE_RETURN_SUCCESS;
+ 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;
}
GSList *tcore_server_ref_storages(Server *s)
{
- if (s == NULL)
+ if (s == NULL) {
+ err("server is NULL");
return NULL;
+ }
return s->storages;
}
-Storage *tcore_server_find_storage(Server *s, const char *name)
+TcoreStorage *tcore_server_find_storage(Server *s, const gchar *name)
{
GSList *list;
- Storage *strg;
+ TcoreStorage *strg;
for (list = s->storages; list; list = list->next) {
strg = list->data;
- if (strg == NULL) {
- continue;
- }
-
- if (g_strcmp0(tcore_storage_ref_name(strg), name) == 0) {
- return strg;
- }
+ if (strg != NULL)
+ if (g_strcmp0(tcore_storage_ref_name(strg), name) == 0)
+ return strg;
}
return NULL;
}
-TReturn tcore_server_add_template_object(Server *s, CoreObject *template_co)
+TelReturn tcore_server_add_template_object(Server *s, CoreObject *template_co)
{
GSList *list;
CoreObject *temp;
- if ((s == NULL)|| (template_co == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((s == NULL) || (template_co == NULL)) {
+ err("s: [%p] template_co: [%p]", s, template_co);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+ /*
+ * 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) {
temp = list->data;
- if (temp == NULL) {
- continue;
- }
-
- if (tcore_object_get_type(temp) == tcore_object_get_type(template_co)) {
- return TCORE_RETURN_EALREADY;
- }
+ if (temp != NULL)
+ if (tcore_object_get_type(temp) ==
+ tcore_object_get_type(template_co))
+ return TEL_RETURN_FAILURE;
}
+ /* Template Core Objects are added to the beginning of the list (prepended) */
s->template_co = g_slist_insert(s->template_co, template_co, 0);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
+}
+
+TelReturn tcore_server_remove_template_object(Server *s, CoreObject *template_co)
+{
+ if ((s == NULL) || (template_co == NULL)) {
+ err("s: [%p] template_co: [%p]", s, template_co);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+
+ s->template_co = g_slist_remove(s->template_co, template_co);
+
+ return TEL_RETURN_SUCCESS;
}
GSList *tcore_server_ref_template_object(Server *s)
{
- if (s == NULL)
+ if (s == NULL) {
+ err("server is NULL");
return NULL;
+ }
return s->template_co;
}
-CoreObject *tcore_server_find_template_object(Server *s, unsigned int type)
+CoreObject *tcore_server_find_template_object(Server *s, guint 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)
- continue;
-
- if (type == tcore_object_get_type(template_co))
- return template_co;
+ if (template_co != NULL)
+ if (type == tcore_object_get_type(template_co))
+ return template_co;
}
return NULL;
}
-TReturn tcore_server_link_udev(Server *s, TcoreUdev *udev)
+TelReturn tcore_server_link_udev(Server *s, TcoreUdev *udev)
{
- if ((s == NULL)|| (udev == NULL))
- return TCORE_RETURN_EINVAL;
+ if ((s == NULL) || (udev == NULL)) {
+ err("s: [%p] udev: [%p]", s, udev);
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
s->udev = udev;
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
TcoreUdev *tcore_server_ref_udev(Server *s)
{
- if (s == NULL)
+ if (s == NULL) {
+ err("server is NULL");
return NULL;
-
- return s->udev;
-}
-
-TReturn tcore_server_dispatch_request(Server *s, UserRequest *ur)
-{
- char *modem = NULL;
- TcorePlugin *p;
- enum tcore_request_command command = 0;
- GSList *list;
- struct hook_request_type *hook;
- int category;
- CoreObject *co;
- TReturn ret = TCORE_RETURN_ENOSYS;
-
- if ((s == NULL)|| (ur == NULL))
- return TCORE_RETURN_EINVAL;
-
- for (list = s->hook_list_request; list; list = list->next) {
- hook = list->data;
- if (hook == NULL)
- continue;
-
- if (hook->command == tcore_user_request_get_command(ur))
- if (hook->func(s, ur, hook->user_data)
- == TCORE_HOOK_RETURN_STOP_PROPAGATION)
- return TCORE_RETURN_SUCCESS;
- }
-
- modem = tcore_user_request_get_modem_name(ur);
- if (modem == NULL)
- return TCORE_RETURN_EINVAL;
-
- p = tcore_server_find_plugin(s, modem);
- if (p == NULL) {
- free(modem);
- return TCORE_RETURN_SERVER_WRONG_PLUGIN;
- }
- free(modem);
-
- command = tcore_user_request_get_command(ur);
-
- category = CORE_OBJECT_TYPE_DEFAULT | (command & 0x0FF00000);
- dbg("Category: [0x%x]", category);
-
- co = tcore_plugin_ref_core_object(p, category);
- if (co == NULL) {
- warn("can't find 0x%x core_object", category);
- return TCORE_RETURN_ENOSYS;
}
- if (tcore_object_dispatch_request(co, ur) == TCORE_RETURN_SUCCESS)
- ret = TCORE_RETURN_SUCCESS;
- else
- dbg("failed...");
-
- return ret;
+ return s->udev;
}
-TReturn tcore_server_send_notification(Server *s, CoreObject *source,
- enum tcore_notification_command command,
- unsigned int data_len, void *data)
+TelReturn tcore_server_send_server_notification(Server *s,
+ TcoreServerNotification command, guint data_len, void *data)
{
GSList *list;
Communicator *comm;
struct hook_notification_type *hook;
- dbg("Send Notification!!! Command: [0x%x]", command);
- if (s == NULL)
- 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) {
hook = list->data;
- if (hook == NULL) {
- continue;
- }
-
- if (hook->command == command) {
- dbg("Invoking hook_func() for Command: [0x%x]", command);
- if (hook->func(s, source, command, data_len, data, hook->user_data)
- == TCORE_HOOK_RETURN_STOP_PROPAGATION)
- return TCORE_RETURN_SUCCESS;
+ 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;
+ }
}
}
for (list = s->communicators; list; list = list->next) {
comm = list->data;
- if (comm == NULL)
- continue;
-
- tcore_communicator_send_notification(comm, source, command, data_len, data);
+ if (comm != NULL)
+ tcore_communicator_send_notification(comm,
+ NULL, command, data_len, data);
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_server_add_request_hook(Server *s,
- enum tcore_request_command command,
- tcore_server_request_hook func, void *user_data)
+TelReturn tcore_server_send_notification(Server *s,
+ TcorePlugin *source, TcoreNotification command, guint data_len, void *data)
{
- struct hook_request_type *hook;
-
- if ((s == NULL)|| (func == NULL))
- return TCORE_RETURN_EINVAL;
-
- hook = g_try_new0(struct hook_request_type, 1);
- if (hook == NULL)
- 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;
-}
-
-TReturn tcore_server_remove_request_hook(Server *s, tcore_server_request_hook func)
-{
- struct hook_request_type *hook;
GSList *list;
+ Communicator *comm;
- if (s == NULL)
- return TCORE_RETURN_EINVAL;
+ dbg("Send Notification!!! Command: [0x%x]", command);
- for (list = s->hook_list_request; list; list = list->next) {
- hook = list->data;
- if (hook == NULL) {
- continue;
- }
+ if (s == NULL) {
+ err("server is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
- if (hook->func == func) {
- s->hook_list_request = g_slist_remove(s->hook_list_request, hook);
- list = s->hook_list_request;
- g_free(hook);
- }
+ for (list = s->communicators; list; list = list->next) {
+ comm = list->data;
+ if (comm != NULL)
+ tcore_communicator_send_notification(comm,
+ source, command, data_len, data);
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_server_add_notification_hook(Server *s,
- enum tcore_notification_command command,
- tcore_server_notification_hook func, void *user_data)
+TelReturn tcore_server_add_notification_hook(Server *s,
+ TcoreServerNotification 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 TCORE_RETURN_EINVAL;
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+
+ if (command < TCORE_SERVER_NOTIFICATION_SERVER_RUN
+ || command > TCORE_SERVER_NOTIFICATION_MODEM_ERR) {
+ err("Invalid command: [0x%x]", command);
+ return TEL_RETURN_INVALID_PARAMETER;
}
+ /* Create 'hook' node */
hook = g_try_new0(struct hook_notification_type, 1);
if (hook == NULL) {
err("Failed to allocate memory");
- return TCORE_RETURN_ENOMEM;
+ 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("Added hook_func() for Command: [0x%x]", command);
+ dbg("Server Notification hook added for Command: [0x%x]", command);
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
-TReturn tcore_server_remove_notification_hook(Server *s,
- tcore_server_notification_hook func)
+TelReturn tcore_server_remove_notification_hook(Server *s,
+ TcoreServerNotificationHook func)
{
struct hook_notification_type *hook;
GSList *list;
- if (s == NULL)
- return TCORE_RETURN_EINVAL;
+ if (s == NULL) {
+ err("Server is NULL");
+ return TEL_RETURN_INVALID_PARAMETER;
+ }
+
+ list = s->hook_list_notification;
+ while (list) {
+ GSList *tmp_list = list->next;
- for (list = s->hook_list_notification; list; list = list->next) {
hook = list->data;
- if (hook == NULL) {
- continue;
+ 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->func == func) {
- s->hook_list_notification = g_slist_remove(s->hook_list_notification, hook);
- list = s->hook_list_notification;
- g_free(hook);
- }
+ /* Proceed to next node */
+ list = tmp_list;
}
- return TCORE_RETURN_SUCCESS;
+ return TEL_RETURN_SUCCESS;
}
gboolean tcore_server_register_modem(Server *s, TcorePlugin *modem_iface_plugin)
return FALSE;
}
+ /* Enumerate CP Name */
modem->cp_name = _server_enumerate_modem(modem_iface_plugin);
modem->modem_iface_plugin = modem_iface_plugin;
+ /*
+ * 'modem' addition to modems list
+ *
+ * 'modem' is appended 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 = _server_find_modem(s, modem_iface_plugin, 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));
+ tcore_plugin_ref_plugin_name(modem_iface_plugin));
return;
}
+ /* Remove 'modem' from modems list */
s->modems = g_slist_remove(s->modems, modem);
- g_free(modem->cp_name);
- g_free(modem);
+ /* Free resources */
+ tcore_free(modem->cp_name);
+ tcore_free(modem);
}
gboolean tcore_server_update_modem_plugin(TcorePlugin *modem_iface_plugin,
- TcorePlugin *modem_plugin)
+ TcorePlugin *modem_plugin)
{
Server *s;
TcoreModem *modem;
- if ((modem_iface_plugin == NULL) || (modem_plugin == NULL)) {
- err("Modem Plug-in [0x%x] Modem Interface Plug-in: [0x%x]",
- modem_plugin, modem_iface_plugin);
+ if (modem_iface_plugin == NULL) {
+ err("Modem Interface Plug-in: [0x%x]", modem_iface_plugin);
return FALSE;
}
return FALSE;
}
- modem = _server_find_modem(s, modem_iface_plugin, 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));
+ tcore_plugin_ref_plugin_name(modem_iface_plugin));
return FALSE;
}
+ /* 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));
+ tcore_plugin_ref_plugin_name(modem_plugin),
+ tcore_plugin_ref_plugin_name(modem_iface_plugin));
return TRUE;
}
-GSList *tcore_server_get_cp_name_list(Server *s)
-{
- GSList *cp_name_list = NULL;
- GSList *list;
- unsigned int list_count;
- TcoreModem *modem;
-
- int i = 0;
-
- if (s == NULL) {
- err("server is NULL");
- return NULL;
- }
-
- list_count = g_slist_length(s->modems);
- if (list_count == 0) {
- err("No entries in Modems list");
- return NULL;
- }
-
- for (list = s->modems; list; list = list->next) {
- modem = list->data;
- if (modem == NULL) {
- dbg("No modem - continue");
- continue;
- }
-
- dbg("[%d] CP Name: [%s]", i++, modem->cp_name);
- cp_name_list = g_slist_append(cp_name_list, g_strdup(modem->cp_name));
- }
-
- /* 'cp_name_list' would be freed by the calling function */
- return cp_name_list;
-}
-
-const char *tcore_server_get_cp_name_by_plugin(TcorePlugin *plugin)
+const gchar *tcore_server_get_cp_name_by_plugin(TcorePlugin *plugin)
{
Server *s;
TcoreModem *modem;
return NULL;
}
- modem = _server_find_modem(s, plugin, plugin);
+ /* Find 'modem' */
+ 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));
+ tcore_plugin_ref_plugin_name(plugin));
return NULL;
}
- return (const char *)modem->cp_name;
+ return (const gchar *)modem->cp_name;
}
gboolean tcore_server_add_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
- unsigned int co_type, TcoreHal *hal)
+ guint co_type, TcoreHal *hal)
{
Server *s;
TcoreModem *modem;
return FALSE;
}
- modem = _server_find_modem(s, modem_iface_plugin, NULL);
+ 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));
+ tcore_plugin_ref_plugin_name(modem_iface_plugin));
return FALSE;
}
return;
}
- modem = _server_find_modem(s, modem_iface_plugin, NULL);
+ 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));
+ tcore_plugin_ref_plugin_name(modem_iface_plugin));
return;
}
}
void tcore_server_remove_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
- TcoreHal *hal)
+ TcoreHal *hal)
{
Server *s;
TcoreModem *modem;
return;
}
- modem = _server_find_modem(s, modem_iface_plugin, NULL);
+ 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));
+ tcore_plugin_ref_plugin_name(modem_iface_plugin));
return;
}
return NULL;
}
- modem = _server_find_modem(s, NULL, modem_plugin);
+ modem = __server_find_modem(s, NULL, 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 = _server_find_modem(s, plugin, plugin);
+ 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));
+ tcore_plugin_ref_plugin_name(plugin));
return;
}
- 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));
- msg("CP Name: [%s]", modem->cp_name);
+ 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);
tcore_object_print_mapping_tbl(modem->mapping_tbl);
}
-TReturn tcore_server_load_modem_plugin(Server *s,
- TcorePlugin *modem_if_plugin,
- const char *name)
+TelReturn tcore_server_load_modem_plugin(Server *s,
+ TcorePlugin *modem_if_plugin, const gchar *name)
{
struct tcore_plugin_define_desc *desc;
TcorePlugin *modem_plugin;
- char *filename = NULL;
+ gchar *filename;
void *handle;
- TReturn ret = TCORE_RETURN_FAILURE;
+ TelReturn ret = TEL_RETURN_FAILURE;
- dbg("Enter");
-
- if (s == NULL || name == NULL) {
- ret = TCORE_RETURN_EINVAL;
- goto out;
+ 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;
}
filename = g_build_filename(MODEMS_PATH, name, NULL);
+ /* Open .so */
handle = dlopen(filename, RTLD_NOW);
if (handle == NULL) {
- dbg("Failed to load '%s': %s", filename, dlerror());
- goto out;
+ err("Failed to load '%s': %s", filename, dlerror());
+
+ tcore_free(filename);
+ return ret;
}
+ /* Symbol 'plugin_define_desc' search */
desc = dlsym(handle, "plugin_define_desc");
if (desc == NULL) {
- dbg("Failed to load symbol: %s", dlerror());
+ err("Failed to load symbol: %s", dlerror());
+
+ /* Close handle */
dlclose(handle);
- goto out;
- }
- dbg("Plugin %s found", desc->name);
+ tcore_free(filename);
+ return ret;
+ }
+ 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);
+ err("Failed to load '%s' plugin", desc->name);
+
+ /* Close handle */
dlclose(handle);
- goto out;
+
+ tcore_free(filename);
+ return ret;
}
}
+ /* Create new Modem Plug-in and update to corresponding 'modem's structure */
modem_plugin = tcore_plugin_new(s, desc, filename, handle);
- tcore_server_add_plugin(s, modem_plugin);
-
- if (modem_if_plugin != NULL)
- tcore_server_update_modem_plugin(modem_if_plugin,
- modem_plugin);
-
+ tcore_server_update_modem_plugin(modem_if_plugin, modem_plugin);
dbg("Plugin %s loaded successfully", desc->name);
if (desc->init == NULL) {
- err("Plugin %s has not initializer", desc->name);
- dlclose(handle);
- goto out;
+ err("Plugin '%s' has no initializer", desc->name);
+ goto OUT;
}
+ /* Initialize Modem Plug-in */
if (desc->init(modem_plugin) == FALSE) {
err("Plugin %s initialization failed", desc->name);
- dlclose(handle);
- goto out;
+ goto OUT;
}
-
- dbg("Plugin %s initialization success", desc->name);
+ dbg("Plugin '%s' successfully initialized", desc->name);
/* Notify addition of Plug-in to Upper Layers */
- tcore_server_send_notification(s, NULL, TNOTI_SERVER_ADDED_PLUGIN,
- 0, modem_plugin);
+ tcore_server_send_server_notification(s,
+ TCORE_SERVER_NOTIFICATION_ADDED_MODEM_PLUGIN,
+ 0, modem_plugin);
+
+ ret = TEL_RETURN_SUCCESS;
- ret = TCORE_RETURN_SUCCESS;
+OUT:
+ tcore_free(filename);
-out:
- g_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);
+ }
- dbg("Exit");
+ /* Free Modem Plug-in and update the 'modem's structure */
+ tcore_server_update_modem_plugin(modem_if_plugin, NULL);
+ tcore_plugin_free(modem_plugin);
+
+ /* Close handle */
+ dlclose(handle);
+ }
return ret;
}
TcorePlugin *modem_plugin;
const struct tcore_plugin_define_desc *desc;
- dbg("Enter");
-
if ((s == NULL) || (modem_if_plugin == NULL)) {
- err("Invalid inputs");
+ err("s: [%p] modem_if_plugin: [%p]", s, modem_if_plugin);
return;
}
/* Find modem from Server's Modem's list */
- modem = _server_find_modem(s, modem_if_plugin, modem_if_plugin);
+ 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));
+ tcore_plugin_ref_plugin_name(modem_if_plugin));
return;
}
- 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));
- msg("CP Name: [%s]", modem->cp_name);
+ 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;
}
/* Notify deletion of Plug-in to Upper Layers */
- tcore_server_send_notification(s, NULL, TNOTI_SERVER_REMOVED_PLUGIN,
- 0, modem_plugin);
+ tcore_server_send_server_notification(s,
+ TCORE_SERVER_NOTIFICATION_REMOVED_MODEM_PLUGIN,
+ 0, modem_plugin);
/* Extract descriptor of Modem Plug-in */
desc = tcore_plugin_get_description(modem_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 */
+ /* Free Modem Plug-in and update the 'modem's structure */
+ tcore_server_update_modem_plugin(modem_if_plugin, NULL);
tcore_plugin_free(modem_plugin);
dbg("Unloaded Modem Plug-in");
}
+
+GSList *tcore_server_get_modem_plugin_list(Server *s)
+{
+ GSList *list;
+ GSList *modem_plugin_list = NULL;
+ TcoreModem *modem;
+
+ 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);
+ }
+
+ return modem_plugin_list;
+}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#include "storage.h"
struct tcore_storage_type {
- const char *name;
- struct storage_operations *ops;
- GHashTable *callback;
-
+ char *name;
TcorePlugin *parent_plugin;
+
+ TcoreStorageOperations *ops;
+ GHashTable *callback;
};
-struct storage_callback_type{
+typedef struct {
TcoreStorageKeyCallback cb_fn;
void *user_data;
-};
+} TcoreStorageCb;
-Storage *tcore_storage_new(TcorePlugin *plugin, const char *name,
- struct storage_operations *ops)
+TcoreStorage *tcore_storage_new(TcorePlugin *plugin,
+ const char *name, TcoreStorageOperations *ops)
{
- Storage *strg;
+ TcoreStorage *strg;
- strg = calloc(1, sizeof(struct tcore_storage_type));
- if (!strg)
- return NULL;
+ strg = tcore_malloc0(sizeof(TcoreStorage));
if (name)
- strg->name = strdup(name);
+ strg->name = tcore_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(Storage *strg)
+void tcore_storage_free(TcoreStorage *strg)
{
- if (!strg)
+ if (strg == NULL) {
+ err("Storage is NULL");
return;
+ }
- if (strg->name)
- free((void *)strg->name);
-
- free(strg);
+ tcore_free(strg->name);
+ tcore_free(strg);
}
-const char *tcore_storage_ref_name(Storage *strg)
+const char *tcore_storage_ref_name(TcoreStorage *strg)
{
- if (!strg)
+ if (strg == NULL) {
+ err("Storage is NULL");
return NULL;
+ }
- return strg->name;
+ return (const char *)strg->name;
}
-void *tcore_storage_create_handle(Storage *strg, const char *path)
+void *tcore_storage_create_handle(TcoreStorage *strg, const char *path)
{
- if (!path)
+ if (path == NULL) {
+ err("path is NULL");
return NULL;
+ }
- if (!strg || !strg->ops || !strg->ops->create_handle) {
+ 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));
return NULL;
}
return strg->ops->create_handle(strg, path);
}
-gboolean tcore_storage_remove_handle(Storage *strg, void *handle)
+gboolean tcore_storage_remove_handle(TcoreStorage *strg, void *handle)
{
- if (!handle)
+ if (handle == NULL) {
+ err("handle is NULL");
return FALSE;
+ }
- if (!strg || !strg->ops || !strg->ops->remove_handle) {
+ 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));
return FALSE;
}
return strg->ops->remove_handle(strg, handle);
}
-gboolean tcore_storage_set_int(Storage *strg, enum tcore_storage_key key,
- int value)
+gboolean tcore_storage_set_int(TcoreStorage *strg,
+ TcoreStorageKey key, int value)
{
- if (!strg || !strg->ops || !strg->ops->set_int) {
+ 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));
return FALSE;
}
return strg->ops->set_int(strg, key, value);
}
-gboolean tcore_storage_set_string(Storage *strg, enum tcore_storage_key key,
- const char *value)
+gboolean tcore_storage_set_string(TcoreStorage *strg,
+ TcoreStorageKey key, const char *value)
{
- if (!strg || !strg->ops || !strg->ops->set_string) {
+ 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));
return FALSE;
}
return strg->ops->set_string(strg, key, value);
}
-gboolean tcore_storage_set_bool(Storage *strg, enum tcore_storage_key key,
- gboolean value)
+gboolean tcore_storage_set_bool(TcoreStorage *strg,
+ TcoreStorageKey key, gboolean value)
{
- if (!strg || !strg->ops || !strg->ops->set_bool) {
+ 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));
return FALSE;
}
return strg->ops->set_bool(strg, key, value);
}
-int tcore_storage_get_int(Storage *strg, enum tcore_storage_key key)
+int tcore_storage_get_int(TcoreStorage *strg, TcoreStorageKey key)
{
- if (!strg || !strg->ops || !strg->ops->get_int) {
+ 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));
return -1;
}
return strg->ops->get_int(strg, key);
}
-char *tcore_storage_get_string(Storage *strg, enum tcore_storage_key key)
+char *tcore_storage_get_string(TcoreStorage *strg, TcoreStorageKey key)
{
- if (!strg || !strg->ops || !strg->ops->get_string) {
+ 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));
return NULL;
}
return strg->ops->get_string(strg, key);
}
-gboolean tcore_storage_get_bool(Storage *strg, enum tcore_storage_key key)
+gboolean tcore_storage_get_bool(TcoreStorage *strg, TcoreStorageKey key)
{
- if (!strg || !strg->ops || !strg->ops->get_bool) {
+ 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));
return FALSE;
}
return strg->ops->get_bool(strg, key);
}
-static void tcore_storage_vkey_callback_dispatcher(Storage *strg,
- enum tcore_storage_key key, void *value)
+static void tcore_storage_vkey_callback_dispatcher(TcoreStorage *strg,
+ TcoreStorageKey key, void *value)
{
- gpointer tmp = NULL;
gchar *key_gen = NULL;
- struct storage_callback_type *tmp_cb = NULL;
+ gpointer hash_node = NULL;
key_gen = g_strdup_printf("%d", key);
- tmp = g_hash_table_lookup(strg->callback, key_gen);
- if (tmp != NULL) {
- GSList *cb_data = (GSList *)tmp;
+ /* 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 {
- tmp_cb = cb_data->data;
- tmp_cb->cb_fn(key, value, tmp_cb->user_data);
- cb_data = g_slist_next(cb_data);
- } while (cb_data != NULL);
+ cb_node = cb_list->data;
+ if (cb_node && cb_node->cb_fn)
+ cb_node->cb_fn(key, value, cb_node->user_data);
+
+ cb_list = g_slist_next(cb_list);
+ } while (cb_list != NULL);
}
- g_free(key_gen);
- return;
+ tcore_free(key_gen);
}
-gboolean tcore_storage_set_key_callback(Storage *strg,
- enum tcore_storage_key key, TcoreStorageKeyCallback cb, void *user_data)
+gboolean tcore_storage_set_key_callback(TcoreStorage *strg,
+ TcoreStorageKey key, TcoreStorageKeyCallback cb, void *user_data)
{
- gpointer tmp = NULL;
+ gpointer hash_node = NULL;
gchar *key_gen = NULL;
- struct storage_callback_type *strg_cb_data = NULL;
- struct storage_callback_type *tmp_cb = NULL;
+ TcoreStorageCb *strg_cb_data = NULL;
- if (!strg || !strg->ops || !strg->ops->set_key_callback)
- {
+ 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));
return FALSE;
}
- strg_cb_data = g_new0(struct storage_callback_type, 1);
+ /* Create callback node */
+ strg_cb_data = tcore_malloc0(sizeof(TcoreStorageCb));
strg_cb_data->cb_fn = cb;
strg_cb_data->user_data = user_data;
key_gen = g_strdup_printf("%d", key);
- tmp = g_hash_table_lookup(strg->callback, key_gen);
- if (tmp != NULL) {
- GSList *cb_data = (GSList *) tmp;
+
+ /* 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 {
- tmp_cb = cb_data->data;
- if (tmp_cb->cb_fn == cb) {
- g_free(key_gen);
- g_free(strg_cb_data);
+ cb_node = cb_list->data;
+ if (cb_node && (cb_node->cb_fn == cb)) {
+ tcore_free(key_gen);
+ tcore_free(strg_cb_data);
return FALSE;
}
+ } while ((cb_list = g_slist_next(cb_list)));
- } while ((cb_data = g_slist_next(cb_data)));
-
- tmp = g_slist_append( (GSList *)tmp, strg_cb_data);
+ /* Append additional callback to same 'key' in Hash table */
+ hash_node = g_slist_append((GSList *)hash_node, strg_cb_data);
}
else {
+ /*
+ * There is no 'value' (hash_node) previously added
+ * for the 'key'.
+ */
GSList *data = NULL;
data = g_slist_append(data, strg_cb_data);
- g_hash_table_insert(strg->callback, g_strdup(key_gen), data);
- strg->ops->set_key_callback(strg, key, tcore_storage_vkey_callback_dispatcher);
+
+ /* 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_free(key_gen);
+ tcore_free(key_gen);
return TRUE;
}
-gboolean tcore_storage_remove_key_callback(Storage *strg,
- enum tcore_storage_key key, TcoreStorageKeyCallback cb)
+gboolean tcore_storage_remove_key_callback(TcoreStorage *strg,
+ TcoreStorageKey key, TcoreStorageKeyCallback cb)
{
- gpointer tmp = NULL;
+ gpointer hash_node = NULL;
gchar *key_gen = NULL;
- GSList *cb_data = NULL;
+ GSList *cb_list = NULL;
int cb_cnt = 0;
- struct storage_callback_type *tmp_cb = NULL;
+ TcoreStorageCb *cb_node = NULL;
- if (!strg || !strg->ops || !strg->ops->remove_key_callback) {
+ 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));
return FALSE;
}
key_gen = g_strdup_printf("%d", key);
- tmp = g_hash_table_lookup(strg->callback, key_gen);
- if (tmp == NULL){
- g_free(key_gen);
+ /* 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);
return FALSE;
}
- cb_data = (GSList *) tmp;
-
+ cb_list = (GSList *)hash_node;
do {
- tmp_cb = cb_data->data;
- if (tmp_cb->cb_fn == cb) {
- tmp = g_slist_remove((GSList *) tmp, cb_data->data);
- g_free(cb_data->data);
+ 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;
}
-
- } while ((cb_data = g_slist_next(cb_data)));
-
- cb_cnt = g_slist_length( (GSList *) tmp );
- dbg("glist cnt (%d)", cb_cnt);
-
- if(cb_cnt == 0){
+ } while ((cb_list = g_slist_next(cb_list)));
+
+ cb_cnt = g_slist_length((GSList *) hash_node);
+ dbg("Callback list count: [%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);
}
- g_free(key_gen);
+ tcore_free(key_gen);
return TRUE;
}
-gboolean tcore_storage_update_query_database(Storage *strg, void *handle,
- const char *query, GHashTable *in_param)
+gboolean tcore_storage_update_query_database(TcoreStorage *strg,
+ void *handle, const char *query, GHashTable *in_param)
{
- if (!strg || !handle || !query)
+ if ((strg == NULL) || (handle == NULL) || (query == NULL)) {
+ err("Storage: [%p] handle: [%p] query: [%p]", strg, handle, query);
return FALSE;
+ }
- if (!strg->ops || !strg->ops->update_query_database) {
+ 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));
return FALSE;
}
return strg->ops->update_query_database(strg, handle, query, 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_read_query_database(TcoreStorage *strg,
+ void *handle, const char *query, GHashTable *in_param,
+ GHashTable *out_param, int out_param_cnt)
{
- if (!strg || !handle || !query)
+ if ((strg == NULL) || (handle == NULL) || (query == NULL)) {
+ err("Storage: [%p] handle: [%p] query: [%p]", strg, handle, query);
return FALSE;
+ }
- if (!strg->ops || !strg->ops->read_query_database) {
+ 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));
return FALSE;
}
in_param, out_param, out_param_cnt);
}
-gboolean tcore_storage_insert_query_database(Storage *strg, void *handle,
- const char *query, GHashTable *in_param)
+gboolean tcore_storage_insert_query_database(TcoreStorage *strg,
+ void *handle, const char *query, GHashTable *in_param)
{
- if (!strg || !handle || !query)
+ if ((strg == NULL) || (handle == NULL) || (query == NULL)) {
+ err("Storage: [%p] handle: [%p] query: [%p]", strg, handle, query);
return FALSE;
+ }
- if (!strg->ops || !strg->ops->insert_query_database) {
+ 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));
return FALSE;
}
return strg->ops->insert_query_database(strg, handle, query, in_param);
}
-gboolean tcore_storage_remove_query_database(Storage *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)
{
- if (!strg || !handle || !query)
+ if ((strg == NULL) || (handle == NULL) || (query == NULL)) {
+ err("Storage: [%p] handle: [%p] query: [%p]", strg, handle, query);
return FALSE;
+ }
- if (!strg->ops || !strg->ops->remove_query_database) {
+ 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));
return FALSE;
}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
+++ /dev/null
-/*
- * 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;
- struct tcore_user_info ui;
-
- 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;
- UserRequestResponseHook response_hook;
- void *response_hook_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;
- }
-
- 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)
-{
- if (!ur)
- return TCORE_RETURN_EINVAL;
-
- ur->response_hook = resp_hook;
- ur->response_hook_user_data = user_data;
-
- 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,
- const struct tcore_user_info *ui)
-{
- if (!ur || !ui)
- return TCORE_RETURN_EINVAL;
-
- ur->ui.uid = ui->uid;
- ur->ui.gid = ui->gid;
- ur->ui.pid = ui->pid;
- ur->ui.channel_id = ui->channel_id;
- ur->ui.client_cmd = ui->client_cmd;
- ur->ui.user_data = ui->user_data;
-
- if (ur->ui.appname) {
- dbg("free old appname (%s)", ur->ui.appname);
- free(ur->ui.appname);
- ur->ui.appname = NULL;
- }
-
- if (ui->appname) {
- ur->ui.appname = strdup(ui->appname);
- dbg("alloc appname(%s, %s)", ur->ui.appname, ui->appname);
- }
-
- return TCORE_RETURN_SUCCESS;
-}
-
-const struct tcore_user_info *tcore_user_request_ref_user_info(UserRequest *ur)
-{
- if (!ur)
- return NULL;
-
- return &(ur->ui);
-}
-
-TReturn tcore_user_request_send_response(UserRequest *ur,
- enum tcore_response_command command,
- unsigned int data_len, const void *data)
-{
- if (!ur) {
- dbg("ur is NULL");
- return TCORE_RETURN_EINVAL;
- }
-
- if (ur->response_hook) {
- ur->response_hook(ur, command, data_len, data,
- ur->response_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;
-
- ur->data_len = data_len;
-
- if (data_len > 0 && data != NULL) {
- ur->data = calloc(data_len, 1);
- if (!ur->data)
- return TCORE_RETURN_ENOMEM;
-
- memcpy(ur->data, data, data_len);
- }
- 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 (metainfo_len > 0 && metainfo != NULL) {
- ur->metainfo = calloc(metainfo_len, 1);
- if (!ur->metainfo)
- return TCORE_RETURN_ENOMEM;
-
- ur->metainfo_len = metainfo_len;
- memcpy(ur->metainfo, metainfo, metainfo_len);
- }
- else {
- ur->metainfo = NULL;
- ur->metainfo_len = 0;
- }
-
- 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;
-}
/*
* libtcore
*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Ja-young Gu <jygu@samsung.com>
+ * 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.
#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 tabGsmUniMax2 9
-#define tabGsmUniMax 42
-
-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 int _convert_ucs2_to_utf8(char *out, unsigned short *out_len, char *in, unsigned short in_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 TEXT_STRING_LEN_MAX 512
-typedef struct {
- char gsm;
- unsigned short unicode;
-} GsmUniTable;
+/* Unicode table lengths */
+#define GSM_UNICODE2_TABLE_LEN_MAX 9
+#define GSM_UNICODE_TABLE_LEN_MAX 42
+
+#define convert_to_hex(in, out) (in <= 9) ? \
+ (out = '0' + in) : (out = 'A' + in - 10)
-const GsmUniTable gsm_unicode2_table[] = {
- { 0x14, 0x005E }, { 0x28, 0x007B }, { 0x29, 0x007D }, { 0x2F, 0x005C },
- { 0x3C, 0x005B }, { 0x3D, 0x007E }, { 0x3E, 0x005D }, { 0x40, 0x007C },
- { 0x65, 0x20AC } };
+ /* EF-SMSP digit length */
-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 MAX_GSM_SMS_PARAM_RECORD_SIZE 156 /* Maximum number of bytes SMSP Record size (Y + 28), y : 0 ~ 128 */
+#define SMS_SMSP_PARAMS_MAX_LEN 28
+#define SMS_SMSP_ALPHA_ID_LEN_MAX 128 /* EF-SMSP alpha id length */
+#define SMS_SMSP_ADDRESS_LEN 20 /* EF-SMSP digit length */
+#define SMS_DEFAULT_SMSP_WITHOUT_ALPHAID 28
+#define SMS_SMSP_SCA_ADDRESS 0x02
+#define SMS_SMSP_VP 0x10
-static gboolean _find_gsm_code_exception_table(unsigned short src)
+#define SMS_SCA_ADDR_OFFSET 13
+#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)
{
if ((src >= 0x0020 && src <= 0x0023)
|| (src >= 0x0025 && src <= 0x003F)
|| (src >= 0x0061 && src <= 0x007A)
|| src == 0x000A || src == 0x000D)
return TRUE;
+
return FALSE;
}
-static int _get_gsm_code_size(unsigned short* src, int src_len)
+static int __get_gsm_code_size(gushort *src, guint src_len)
{
gboolean in_table = FALSE;
gboolean in_sec_table = FALSE;
- int i, gsm_len = 0;
+ gint gsm_len = 0;
+ guint i;
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 < tabGsmUniMax; i++) {
+ for (i = 0; i < GSM_UNICODE_TABLE_LEN_MAX; i++) {
if (*src == gsm_unicode_table[i].unicode) {
src++;
in_table = TRUE;
break;
}
}
+
if (in_table == FALSE) {
in_sec_table = FALSE;
- for (i = 0; i < tabGsmUniMax2; i++) {/* second table */
+ for (i = 0; i < GSM_UNICODE2_TABLE_LEN_MAX; i++) {/* second table */
if (*src == gsm_unicode2_table[i].unicode) {
src++;
in_table = TRUE;
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++;
}
}
}
+
return gsm_len;
}
-static gboolean _convert_gsm_to_unicode(unsigned short *dest, int dest_len, unsigned char *src, unsigned int src_len)
+static char *__acitoa(int n, char* str, int b)
{
- int index, tmp_len;
+ guint i = 0;
- if(!dest || !src) {
- dbg( "dest(%p) or src(%p) is null",dest, src);
- return FALSE;
+ 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;
}
- if(!src_len){
- dest[0] = '\0';
- return TRUE;
+ 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++;
+ }
+ }
}
- dbg("source string (%s) len(%d)", src, src_len);
+ src = p;
+ return gsm_code_len;
+}
- for(index = 0; index < (int)src_len; index++){
- if(src[index] == 0x1B)
- src_len--;
+static gboolean __convert_unicode_to_gsm(guchar *dest, guint dest_len,
+ gushort *src, guint src_len)
+{
+ gchar *gsm_str;
+ int gsm_code_len = 0;
+
+ if ((NULL == dest) || (NULL == src)) {
+ dbg("INPUT PARAM was NULL");
+ return FALSE;
}
- dbg("strlen excluding escape character (%d)", src_len);
- tmp_len = _convert_gsm_to_ucs2(dest, src, src_len);
- dest[tmp_len] = '\0';
+ if (src_len == 0)
+ return FALSE;
+
+ /* 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);
+ 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;
+ }
+
+ gsm_str = tcore_malloc0(gsm_code_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;
+ }
+ memcpy((char*)dest, (char*)gsm_str, gsm_code_len);
+ tcore_free(gsm_str);
return TRUE;
}
-static int _convert_gsm_to_ucs2(unsigned short* dest, unsigned char* src, unsigned int src_len)
+static gint __convert_gsm_to_ucs2(gushort *dest,
+ guchar *src, guint src_len)
{
- int index;
- unsigned short* org;
+ gushort *org;
+ guint i;
org = dest;
- for(index=0; index < (int)src_len; index++){
- int table_index=0;
+ for (i = 0 ; i < src_len ; i++) {
+ guint 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++; index++;//move to next byte
- for(table_index=0; table_index < tabGsmUniMax2; table_index++){
- if(*src == gsm_unicode2_table[table_index].gsm){
+ 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) {
*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 < tabGsmUniMax; table_index++){
- if(*src == gsm_unicode_table[table_index].gsm){
+ else {
+ for (table_index = 0;
+ table_index < GSM_UNICODE_TABLE_LEN_MAX;
+ 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 void _convert_gsm_to_utf8(unsigned char* dest, unsigned short* dest_len, unsigned char* src, unsigned int src_len)
+static gchar *__convert_ucs_to_utf8(guchar *src, guint src_len)
{
- int tmp_len = 0;
- char *target_tmp = NULL;
- unsigned char *raw_unicode = NULL;
- unsigned short tmp_dest[SAT_TEXT_STRING_LEN_MAX];
+ gchar* utf_str = NULL;
+ iconv_t cd = NULL;
+ size_t ileft = 0;
+ size_t oleft = 0;
- memset(tmp_dest, 0 , SAT_TEXT_STRING_LEN_MAX);
+ gchar *pIn = NULL;
+ gchar *in_buf = NULL;
+ gchar *out_buf = 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
+ gint ret = 0;
- tmp_len = tmp_len*2; //for byte align
- raw_unicode = (unsigned char*)malloc(tmp_len);
- memset(raw_unicode, 0, tmp_len);
+ if (!src) {
+ err("src is null");
+ return NULL;
+ }
- memcpy(raw_unicode, (unsigned char*)tmp_dest, tmp_len);
+ 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
- *dest_len = tmp_len;
- target_tmp = _convert_ucs_to_utf8(raw_unicode, tmp_len);
- if(!target_tmp){
- dbg( "str is NULL");
- g_free(raw_unicode);
- return;
- }
+ pIn = in_buf = (gchar *)tcore_malloc0(ileft + 2);
+ memcpy(in_buf, src, ileft);
+ in_buf[ileft] = '\0';
- memcpy(dest, target_tmp, strlen((const char*)target_tmp));
- dbg("final utf8 str (%s), length (%d)", dest, tmp_len);
+ utf_str = out_buf = (gchar *)tcore_malloc0(oleft + 1);
- g_free(raw_unicode);
- g_free(target_tmp);
- return;
+ cd = iconv_open("UTF-8", "UCS-2");
+ ret = iconv(cd, (char**) &in_buf, &ileft, &out_buf, &oleft);
+
+ utf_str[src_len * 2 - ileft] = '\0';
+
+ iconv_close(cd);
+ tcore_free(pIn);
+
+ return utf_str;
}
-static gboolean _convert_unicode_to_gsm(unsigned char* dest, int dest_len, unsigned short* src, int src_len)
+static gint __convert_utf8_to_unicode(gushort *dest,
+ guchar *src, guint src_len)
{
- char* tmp_str;
- int gc_len = 0;
+ gushort *org;
+ guchar hi = 0;
+ guchar mid = 0;
+ guchar low = 0;
if ((NULL == dest) || (NULL == src)) {
- dbg( "INPUT PARAM was NULL");
- return FALSE;
- }
-
- 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;
+ dbg("INPUT PARAM NULL");
+ return -1;
}
+ org = dest;
- if (dest_len < gc_len) {
- if (dest_len == sizeof(void*)) {
- dbg( "Out buffer size seems to be small (%s)", 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;
} else {
- dbg("Buffer size is too small (%s): dest_len(%d), gc_len(%d)", dest, dest_len, gc_len);
+ *dest = (*src & 0x7F);
+ dest++;
+ src++;
+ src_len--;
+ err("UTF-8 range incorrect!!!");
}
- return FALSE;
- }
-
- tmp_str = calloc(1, (unsigned short) gc_len);
- if (tmp_str == NULL) {
- dbg( "Memory Allocation Failed!");
- return FALSE;
}
- 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;
- }
-
- free(tmp_str);
- return FALSE;
+ *dest = 0;
+ return (dest - org);
}
-static char* _convert_ucs_to_utf8(unsigned char* src, int src_len)
+static gboolean __convert_gsm_to_unicode(gushort *dest, guint dest_len,
+ guchar *src, guint src_len)
{
- char* utf_str = NULL;
- iconv_t cd = NULL;
- size_t ileft = 0;
- size_t oleft = 0;
- int err = 0;
-
- char* pIn = NULL;
- char* in_buf = NULL;
- char* out_buf = NULL;
+ guint i;
+ gint tmp_len;
- if (!src) {
- dbg("src is null");
- return NULL;
+ if (!dest || !src) {
+ dbg("dest(%p) or src(%p) is null",dest, src);
+ return FALSE;
}
- 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';
+ if (!src_len) {
+ dest[0] = '\0';
+ return TRUE;
+ }
- cd = iconv_open("UTF-8", "UCS-2");
- err = iconv(cd, (char**) &in_buf, &ileft, &out_buf, &oleft);
+ dbg("source string (%s) len(%d)", src, src_len);
- utf_str[src_len * 2 - ileft] = '\0';
- iconv_close(cd);
- free(pIn);
- return utf_str;
-}
+ for (i = 0; i < src_len; i++)
+ if (src[i] == 0x1B)
+ src_len--;
-static int _convert_ucs2_to_gsm(unsigned char* dest, unsigned short* src, unsigned int src_len)
-{
- unsigned char* rear = NULL;
- unsigned short* p;
- unsigned char temp;
- gboolean in_table = FALSE;
- gboolean in_sec_table = FALSE;
- int i, gc_len = 0;
+ dbg("strlen excluding escape character (%d)", src_len);
- if ((!dest) || (!src) || (0x00 == src_len)) {
- dbg( "Warning: Wrong Input");
- return -1;
- }
+ /* Conversion: GSM --> UCS2 */
+ tmp_len = __convert_gsm_to_ucs2(dest, src, src_len);
+ if (tmp_len == -1)
+ return FALSE;
- rear = dest;
- p = src;
+ dest[tmp_len] = '\0';
- 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;
+ return TRUE;
}
-static int _convert_ucs2_to_utf8(char *out, unsigned short *out_len, char *in, unsigned short in_len)
+static gboolean __convert_ucs2_to_utf8(gchar *dest, gushort *dest_len,
+ gchar *src, gushort src_len)
{
- char *p_o = NULL;
- size_t src_len = in_len;
- size_t dest_len = in_len*3;
+ gchar *p_o = NULL;
+ size_t in_len = (size_t)src_len;
+ size_t out_len = (size_t)src_len*3;
iconv_t cd = iconv_open("UTF-8", "UCS2");
if (cd == (iconv_t) (-1)) {
perror("iconv_open");
- return 0;
+ return FALSE;
}
- p_o = out;
+ p_o = dest;
- dbg("expected input bytes:%d dest_len:%d\n", src_len, dest_len);
+ dbg("Expected input bytes: [%d] output bytes: [%d]", in_len, out_len);
- if (iconv(cd, &in, &src_len, &p_o, &dest_len) == (size_t)(-1)) {
+ if (iconv(cd, &src, &in_len, &p_o, &out_len) == (size_t)(-1)) {
dbg("failed to iconv errno:%d", errno);
} else {
- dbg("remained input bytes:%d processed bytes:%d", src_len, in_len*3-dest_len);
- out[in_len*3-dest_len] = '\0';
+ dbg("remained input bytes:%d processed bytes:%d",
+ in_len, in_len*3 - out_len);
+ dest[in_len*3 - out_len] = '\0';
}
- *out_len = in_len*3-dest_len;
- dbg("out_len[%d], output[%s]", *out_len, out);
+ *dest_len = in_len*3 - out_len;
+
+ dbg("Output - Length: [%d] Data: [%s]", *dest_len, dest);
iconv_close(cd);
- return 0;
+
+ return TRUE;
+}
+
+static void __convert_gsm_to_utf8(guchar *dest, gushort *dest_len, guchar *src, guint src_len)
+{
+ int tmp_len = 0;
+ char *target_tmp = NULL;
+ guchar *raw_unicode = NULL;
+ gushort tmp_dest[TEXT_STRING_LEN_MAX];
+
+ memset(tmp_dest, 0x0, TEXT_STRING_LEN_MAX);
+
+ __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
+
+ tmp_len = tmp_len*2; //for byte align
+
+ raw_unicode = (guchar*)tcore_malloc0(tmp_len);
+ memcpy(raw_unicode, (guchar*)tmp_dest, tmp_len);
+
+ *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;
+ }
+ memcpy(dest, target_tmp, strlen((const char*)target_tmp));
+ dbg("final utf8 str (%s), length (%d)", dest, tmp_len);
+
+ tcore_free(raw_unicode);
+ tcore_free(target_tmp);
}
-static void _convert_alpha_field_ucs2_to_utf8(unsigned char *out, unsigned short *out_len, unsigned char *in, unsigned short in_len)
+static void __convert_alpha_field_ucs2_to_utf8(guchar *out, gushort *out_len, guchar *in, gushort in_len)
{
//input string UNSIGNED CHAR *IN should be encoded with BIG-ENDIAN
- switch(in[0]) {
+ switch (in[0]) {
case 0x80: {
- unsigned char num = in_len/2; //number of characters
+ guchar num = in_len/2; //number of characters
int i = 0;
int data_loc = 1; //starting location of data
- unsigned short* in_buf = NULL;
+ gushort* in_buf = NULL;
dbg("[UCS2] prefix case:[0x80]");
- in_buf = (unsigned short*)malloc(num * sizeof(unsigned short));
- for(i=0; i<num; i++,data_loc++) {
- in_buf[i] = ((unsigned short)in[data_loc]<<8) + (unsigned short)in[data_loc+1];
+ 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);
+ __convert_ucs2_to_utf8((char*)out, out_len, (char*) in_buf, num*2);
+ if (in_buf!=NULL) free(in_buf);
} break;
case 0x81: {
- unsigned char num = in[1]; //number of characters
- unsigned short base = (unsigned short) in[2] << 7; //base pointer for UCS2 type
+ guchar num = in[1]; //number of characters
+ gushort base = (gushort) in[2] << 7; //base pointer for UCS2 type
int i = 0;
int data_loc = 3; //starting location of data
- unsigned short* in_buf = NULL;
+ gushort* in_buf = NULL;
dbg("[UCS2] prefix case:[0x81]");
- 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], (unsigned char *)&in[data_loc], 1);
+ 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);
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 + ((unsigned short)(in[data_loc]) & 0x7F);
+ in_buf[i] = base + ((gushort)(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);
+ __convert_ucs2_to_utf8((char*)out, out_len, (char*) in_buf, num*2);
+ if (in_buf!=NULL) free(in_buf);
} break;
case 0x82: {
- 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
+ guchar num = in[1]; //number of characters
+ gushort base = ((gushort) in[2] << 8) | (gushort) in[3]; //base pointer for UCS2 type
int i = 0;
int data_loc = 4; //starting location of data
- unsigned short* in_buf = NULL;
+ gushort* in_buf = NULL;
dbg("[UCS2] prefix case:[0x82]");
- 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], (unsigned char *)&in[data_loc], (unsigned int)1);
+ 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);
dbg("[UCS2]in_buf[%d]=0x%04x", i, in_buf[i]);
} else {
- in_buf[i] = base + ((unsigned short)(in[data_loc]) & 0x7F);
+ in_buf[i] = base + ((gushort)(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);
+ __convert_ucs2_to_utf8((char*)out, out_len, (char*) in_buf, num*2);
+ if (in_buf!=NULL) free(in_buf);
} break;
default: {
- unsigned char num = in_len/2; //number of characters
+ guchar num = in_len/2; //number of characters
int i = 0;
int data_loc = 0; //starting location of data
- unsigned short* in_buf = NULL;
+ gushort* in_buf = NULL;
dbg("[UCS2] non-prefix case.");
- in_buf = (unsigned short*)malloc(num * sizeof(unsigned short));
- for(i=0; i<num; i++,data_loc++) {
- in_buf[i] = ((unsigned short)in[data_loc]<<8) + (unsigned short)in[data_loc+1];
+ 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);
+ __convert_ucs2_to_utf8((char*)out, out_len, (char*) in_buf, num*2);
+ if (in_buf!=NULL) free(in_buf);
} break;
}
}
-static int _convert_utf8_to_unicode(unsigned short* dest, unsigned char* src, unsigned int src_len)
+/*
+ * Conversion APIs
+ */
+
+/* BCD --> */
+gchar *tcore_util_convert_bcd_to_ascii(const gchar *bcd_str, guint bcd_str_len,
+ guint max_len)
{
- unsigned short* org = NULL;
- unsigned char hi = 0;
- unsigned char mid = 0;
- unsigned char low = 0;
+ guint index, len = 0;
+ gchar l_bcd, h_bcd = 0x0F;
+ gchar *ascii_str;
- if ((NULL == dest) || (NULL == src)) {
- dbg( "INPUT PARAM NULL");
- return -1;
+ tcore_check_return_value(bcd_str != NULL, NULL);
+
+ /* validate max length */
+ if (bcd_str_len*2 > max_len) {
+ err("PARSER - number length exceeds the maximum limit");
+ return NULL;
}
- org = dest;
+ ascii_str = tcore_malloc0(((bcd_str_len*2)*sizeof(char)) + 1);
- 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;
+ 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;
+
+ 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;
} else {
- *dest = (*src & 0x7F);
- dest++;
- src++;
- src_len--;
- dbg( "utf8 incorrect range");
+ higher = 0xFF;
}
+ 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)
+{
+ 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;
+ }
-gboolean tcore_util_convert_utf8_to_gsm(unsigned char *dest, int *dest_len, unsigned char* src, int src_len)
+ return (bcd_len * 2);
+}
+
+/* String --> */
+gboolean tcore_util_convert_str_to_utf8(guchar *dest, gushort *dest_len,
+ TelUtilAlphabetFormat dcs, const guchar *src, gushort src_len)
{
- unsigned short *uc = NULL;
- int gc_len = 0;
- int uc_len = 0;
+ 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);
- if (src == NULL || src_len == 0) {
- dbg( "WARNING: Invalid Parameter");
+ 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;
+
+ 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);
return FALSE;
}
+ }
- uc = (unsigned short*) calloc(src_len + 1, sizeof(unsigned short));
- if (!uc) {
- dbg( "WARNING: calloc Failed");
+ 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");
return FALSE;
}
- /*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);
+ 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);
return FALSE;
}
- /*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);
+ /* 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);
return FALSE;
}
- *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);
+ /*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);
return FALSE;
}
+ *dest_len = gsm_code_len;
- if(uc)
- free(uc);
+ tcore_free(unicode);
return TRUE;
}
-gboolean tcore_util_convert_utf8_to_ucs2(unsigned char* dest, int* dest_len, unsigned char* src, int src_len)
+gboolean tcore_util_convert_utf8_to_ucs2(guchar *dest, guint *dest_len,
+ guchar *src, guint src_len)
{
gsize byte_converted = 0;
gsize byte_read = 0;
gchar* str_converted = NULL;
GError *error = NULL;
- int i;
char tmp_char;
+ guint i;
if (dest == NULL || dest_len == NULL || src == NULL) {
- dbg( "Invalid Input Parameter");
+ dbg("Invalid Input Parameter");
return FALSE;
}
/*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);
+ 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) {
- dbg( "str_converted is NULL");
+ err("g_convert failed...");
if (error != NULL) {
- dbg( "Problem while conversion UTF8 => UCS2, ErrorCode[%d]", error->code);
+ err("UTF8 --> UCS2 conversion failed "
+ "- Error code: [%d]", error->code);
+ g_error_free(error);
}
return FALSE;
}
- dbg( "src_len[%u], byte_read[%u], byte_converted[%u]", src_len, byte_read, byte_converted);
- *dest_len = (int) byte_converted;
+ 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("String length is wrong!");
} else {
- for (i = 0; i < (int)byte_converted; i++) {
+ for (i = 0; i < (guint)byte_converted; i++) {
if (i % 2 == 0) {
tmp_char = str_converted[i];
str_converted[i] = str_converted[i + 1];
}
}
}
- memcpy((unsigned char*) dest, (unsigned char*) str_converted, byte_converted);
- g_free(str_converted);
+
+ memcpy((guchar*)dest, (guchar*)str_converted, byte_converted);
+
+ tcore_free(str_converted);
return TRUE;
}
-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)
+/* Packing/Unpacking */
+guchar *tcore_util_pack_gsm7bit(const guchar *src, guint src_len)
{
- dbg("dcs=[0x%02x]", dcs );
- dbg("src=[%s], src_len=[%d]", src, src_len);
+ guchar *dest;
+ guint i = 0;
+ guint pos = 0, shift = 0;
+ guint outlen = 0;
- if(src==NULL || src_len==0) {
- err("src is NULL or src_len is 0");
- return FALSE;
+ if (!src || src_len == 0) {
+ return NULL;
}
- switch (dcs) {
- case ALPHABET_FORMAT_SMS_DEFAULT: {
- unsigned char* tmp_dest_str = NULL;
- dbg( "case : [ALPHABET_FORMAT_SMS_DEFAULT]");
- tmp_dest_str = (unsigned char*)tcore_util_unpack_gsm7bit((const unsigned char *)src, src_len);
-
- if(!tmp_dest_str) {
- err("temp_dest_str is NULL");
- return FALSE;
- }
- _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;
-
- case ALPHABET_FORMAT_8BIT_DATA: { //GSM7bit with bit 8 set to 0
- int tmp_str_len = 0;
- unsigned char *src_buf = NULL;
- src_buf = (unsigned char*)malloc(src_len);
- if(NULL == src_buf){
- err("src_buf is NULL!");
- return FALSE;
- }
- memcpy(src_buf, src, src_len);
+ outlen = ((src_len * 7) / 8) + 1;
+
+ dest = calloc(outlen + 1, 1);
+ if (!dest)
+ return NULL;
- /*get string length*/
- /* 0xFF is the end of string */
- while (src[tmp_str_len] != 0xFF && tmp_str_len < src_len) {
- tmp_str_len++;
+ 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++;
}
- /* last space character must be deleted */
- while (src[tmp_str_len - 1] == 0x20 && tmp_str_len > 0) {
- tmp_str_len--;
+ }
+ 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);
+
+ outlen = (src_len * 8) / 7;
+
+ dest = tcore_malloc0(outlen + 1);
+
+ 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; i < outlen; i++)
+ if (dest[i] == '\r')
+ dest[i] = ' ';
+
+ dest[outlen] = '\0';
+ dbg("Converted string: [%s] length: [%d]", dest, outlen);
+
+ return dest;
+}
+
+/*
+ * 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;
+ guchar param_indicator;
+ guint pid_index = 0;
+
+ /* SMSP Record Length = 28 + Y bytes
+ * (Y = alphaid size)
+ * Order of EF-SMSP file
+ * Alpha-Identifier
+ * Parameter Indicators
+ * TP-Destination Address
+ * TS-Service Centre Address
+ * TP-Protocol Identifier
+ * TP-Data Coding Scheme
+ * TP-Validity Period
+ */
+
+ memset(set_params_data, 0xFF, smsp_record_length);
+
+ if (smsp_record_length >= SMS_DEFAULT_SMSP_WITHOUT_ALPHAID)
+ pid_index = smsp_record_length;
+
+ param_indicator = 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");
+ param_offset = SMS_SCA_ADDR_OFFSET;
+
+ /* SCA Length */
+ set_params_data[pid_index + (param_offset)] =(sca_length + 1);
+ /* SCA Type */
+ set_params_data[pid_index + (++param_offset)] = ((set_params->sca.ton << 4) |set_params->sca.npi) | 0x80;
+ /* Copy SCA */
+ memcpy(&(set_params_data[pid_index + (++param_offset)]), &(set_params->sca.number), sca_length + 1);
+ } else {
+ err("Invalid SCA Length.");
+ return FALSE;
+ }
+ } else {
+ dbg("SCA is NULL");
+ }
+ /*
+ * Validity Period
+ * Always send ValidityPeriod to CP
+ * becase period could be 0 day.
+ * Section: 3GPP TS 23.040 v6.5.0, Section 9.2.3.12.1
+ */
+ param_offset = SMS_VP_OFFSET;
+
+ set_params_data[pid_index + (param_offset)] = set_params->vp;
+
+ 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, param_offset = 0;
+ unsigned char param_indicator;
+
+ 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;
+
+ /* Iterate the loop to get alpha ID */
+ for (i = 0; i < alpha_id_len; i++) {
+ if (0xff == incoming[i]) {
+ dbg(" alpha iD found");
+ break;
}
- dbg( "case : [ALPHABET_FORMAT_8BIT_DATA]");
- dbg( "tmp_str_len[%d]", tmp_str_len);
-
- _convert_gsm_to_utf8(dest, dest_len, src_buf, tmp_str_len);
- free(src_buf);
- } break;
-
- case ALPHABET_FORMAT_UCS2: {
- unsigned char *src_buf = NULL;
- src_buf = (unsigned char*)malloc(src_len);
- if(NULL == src_buf){
- err("src_buf is NULL");
- return FALSE;
+ }
+ } else {
+ alpha_id_len = 0;
+ }
+
+ /*param indicator*/
+ param_indicator = incoming[alpha_id_len];
+
+ /* Service Centre Address*/
+ if ((0 == (param_indicator & SMS_SMSP_SCA_ADDRESS))
+ ||(0x00 < (int)incoming[alpha_id_len +SMS_SCA_ADDR_OFFSET] && (int)incoming[alpha_id_len +SMS_SCA_ADDR_OFFSET] <= 12 )
+ ||(0xff != (int)incoming[alpha_id_len +SMS_SCA_ADDR_OFFSET])) {
+
+ dbg(" SCA Address Present");
+ param_offset = SMS_SCA_ADDR_OFFSET;
+
+ if (0x00 == (int) incoming[alpha_id_len + param_offset] || 0xff == (int) incoming[alpha_id_len + param_offset]) {
+ sca_length = 0;
+
+ dbg(" SCAddr Length is 0");
+ } else {
+ if (0 < (int) incoming[alpha_id_len + param_offset]) {
+ sca_length = (int) (incoming[alpha_id_len + param_offset] - 1);
+
+ if (sca_length > SMS_SMSP_ADDRESS_LEN)
+ sca_length = SMS_SMSP_ADDRESS_LEN;
+
+ /*Filling the get SMS params info*/
+ get_params->sca.ton = incoming[alpha_id_len + (++param_offset)] & 0x0f;
+ get_params->sca.npi = (incoming[alpha_id_len + param_offset] & 0x70) >> 4;
+
+ /* Copying SCA*/
+ memcpy(&(get_params->sca.number[0]), &incoming[alpha_id_len + (++param_offset)], sca_length);
+ } else {
+ get_params->sca.number[0] = 0;
}
- memcpy(src_buf, src, src_len);
- dbg( "case : [ALPHABET_FORMAT_UCS2]");
- _convert_alpha_field_ucs2_to_utf8(dest, dest_len, src_buf, src_len);
- free(src_buf);
- } break;
+ }
+ } else {
+ dbg(" SCA Address NOT Present");
+ }
+ if( ((param_indicator & SMS_SMSP_VP) == 0 )&& (alpha_id_len + SMS_VP_OFFSET) < MAX_GSM_SMS_PARAM_RECORD_SIZE) {
+ /*Filling the Validity Period*/
+ get_params->vp = incoming[alpha_id_len + SMS_VP_OFFSET];
+ }
- default: {
- dbg("not handled alpha format[0x%02x]", dcs);
- return FALSE;
- } break;
+ return TRUE;
+}
+
+char tcore_util_unpackb(const char *src, int pos, int len)
+{
+ char result = 0;
+ int rshift = 0;
+
+ src += pos / 8;
+ pos %= 8;
+
+ rshift = MAX(8 - (pos + len), 0);
+
+ 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;
+
+ if (len > 0) result = (result << len) | (*src >> (8 - len)); // if any bits left
}
+
+ return result;
+}
+
+char tcore_util_convert_byte_hexchar(char val)
+{
+ char hex_char;
+
+ 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);
+}
+
+gboolean tcore_util_byte_to_hex(const char *byte_pdu, char *hex_pdu, int num_bytes)
+{
+ int i;
+ char nibble;
+ int buf_pos = 0;
+
+ 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);
+ }
+
return TRUE;
}
-void tcore_util_swap_byte_order(unsigned short* dest, const unsigned short* src, int src_len)
+void tcore_util_swap_byte_order(gushort* dest,
+ const gushort* src, guint src_len)
{
- int i = 0;
+ guint i = 0;
- for (i = 0; i < src_len; i++) {
+ 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);
+}
+
+long tcore_util_encode_hex(const guchar *src,
+ long num_bytes, gchar *buf)
+{
+ 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';
+
+ return j;
+}
+
+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;
+
+ if (size <= 0) {
+ msg("%sno data", pad);
+ return;
+ }
+
+ p = (unsigned char *) data;
+
+ snprintf(buf, 255, "%s%04X: ", pad, 0);
+ for (i = 0; i < size; i++) {
+ snprintf(hex, 4, "%02X ", p[i]);
+ strcat(buf, hex);
+
+ 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, " ");
+ }
+ }
+ }
+
+ msg("%s", buf);
+}
+
+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)
+{
+ 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);
+}
+
+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;
+ }
+}
+
+gboolean tcore_util_hexstring_to_bytes(gchar *hex_str,
+ gchar **bytes, guint *bytes_len)
+{
+ gchar *byte_str;
+ guint hex_str_len;
+ guint i;
+
+ if (hex_str == NULL)
+ return FALSE;
+
+ hex_str_len = strlen(hex_str);
+
+ byte_str = tcore_try_malloc0((hex_str_len / 2) + 1);
+
+ 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]);
}
+
+ *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;
+
+ alpha_id[i] = record[i];
+ alpha_id_len++;
+ }
+ 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);
+
+ for (i = 0; i < alpha_id_max_len; i++)
+ record[i] = alpha_id[i];
+}
+
+gboolean tcore_util_is_empty(unsigned char* in, guint in_length)
+{
+ guint i;
+
+ for (i = 0; i < in_length; i++) {
+ if (in[i] != 0xFF)
+ 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;
+}
+
+TelUtilAlphabetFormat tcore_util_get_cbs_coding_scheme(guchar encode)
+{
+ 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;
+
+ 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;
+
+ 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;
+
+ 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;
+
+ case 0x80: // 1000
+ case 0xA0:
+ case 0xB0:
+ case 0xC0:
+ case 0xD0: // 1010 .. 1101
+ case 0xE0: // 0x1110
+ break;
+
+ 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;
+ }
+
+ return alphabet_format;
+}
+
+gchar *tcore_util_get_string_by_ip4type(TcoreIp4Type ip)
+{
+ gchar *ip_addr_str = NULL;
+
+ 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);
+
+ return ip_addr_str;
+}
+
+TelReturn tcore_util_netif (const char *name, gboolean enabled)
+{
+ gint ret;
+ gint fd;
+ struct ifreq ifr;
+
+ if (!name)
+ return TEL_RETURN_INVALID_PARAMETER;
+
+ 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);
+
+ if (fd < 0) {
+ return TEL_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;
+ }
+
+ if (enabled == TRUE)
+ ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
+ else
+ ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING);
+
+ ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
+ if (ret < 0) {
+ close(fd);
+ return TEL_RETURN_FAILURE;
+ }
+
+ close(fd);
+ return TEL_RETURN_SUCCESS;
+}
+
+TelReturn tcore_util_netif_set(const char *name, const char *ipaddr,
+ const char *gateway, const char *netmask)
+{
+ gint ret;
+ gint fd;
+ struct ifreq ifr;
+ struct sockaddr_in sai;
+
+ if (!name)
+ return TEL_RETURN_INVALID_PARAMETER;
+
+ if (strlen(name) > IFNAMSIZ)
+ return TEL_RETURN_INVALID_PARAMETER;
+
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ return TEL_RETURN_FAILURE;
+ }
+
+ memset(&sai, 0, sizeof(struct sockaddr_in));
+ sai.sin_family = AF_INET;
+ sai.sin_port = 0;
+ memset(&ifr, 0, sizeof(struct ifreq));
+
+ if (ipaddr) {
+ dbg("ip = [%s]", ipaddr);
+ if (!inet_aton(ipaddr, &sai.sin_addr)) {
+ close(fd);
+ return TEL_RETURN_FAILURE;
+ }
+
+ strncpy(ifr.ifr_name, name, IFNAMSIZ);
+ ifr.ifr_name[IFNAMSIZ - 1] = '\0';
+ memcpy(&ifr.ifr_addr, &sai, sizeof(sai));
+
+ ret = ioctl(fd, SIOCSIFADDR, &ifr);
+ if (ret < 0) {
+ close(fd);
+ return TEL_RETURN_FAILURE;
+ }
+ }
+
+ if (gateway) {
+ dbg("gateway = [%s]", gateway);
+ if (!inet_aton(gateway, &sai.sin_addr)) {
+ close(fd);
+ return TEL_RETURN_FAILURE;
+ }
+
+ strncpy(ifr.ifr_name, name, IFNAMSIZ);
+ ifr.ifr_name[IFNAMSIZ - 1] = '\0';
+ memcpy(&ifr.ifr_dstaddr, &sai, sizeof(sai));
+
+ ret = ioctl(fd, SIOCSIFDSTADDR, &ifr);
+ if (ret < 0) {
+ close(fd);
+ return TEL_RETURN_FAILURE;
+ }
+ }
+
+ if (netmask) {
+ dbg("netmask = [%s]", netmask);
+ if (!inet_aton(netmask, &sai.sin_addr)) {
+ close(fd);
+ return TEL_RETURN_FAILURE;
+ }
+
+ strncpy(ifr.ifr_name, name, IFNAMSIZ);
+ ifr.ifr_name[IFNAMSIZ - 1] = '\0';
+ memcpy(&ifr.ifr_netmask, &sai, sizeof(sai));
+
+ ret = ioctl(fd, SIOCSIFNETMASK, &ifr);
+ if (ret < 0) {
+ close(fd);
+ return TEL_RETURN_FAILURE;
+ }
+ }
+
+ close(fd);
+ return TEL_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, enum tcore_util_marshal_data_type type)
+ const void *data, TcoreUtilMarshalData type)
{
switch (type) {
case TCORE_UTIL_MARSHAL_DATA_CHAR_TYPE:
static gboolean _tcore_util_return_value(GValue *src, void **dest,
- enum tcore_util_marshal_data_type type)
+ TcoreUtilMarshalData type)
{
switch (type) {
case TCORE_UTIL_MARSHAL_DATA_CHAR_TYPE:
static void _tcore_util_marshal_remove_value(gpointer value)
{
- unsigned int gtype = 0;
+ guint gtype = 0;
GHashTable *ht = NULL;
gtype = ((GValue *) value)->g_type;
return;
}
-static gboolean _tcore_util_marshal_convert_str_to_type(GValue *src,
- GValue *dest, unsigned int dest_type)
+static gboolean _tcore_util_marshal__convert_str_to_type(GValue *src,
+ GValue *dest, guint dest_type)
{
if (dest_type == G_TYPE_HASH_TABLE)
dest_type = G_TYPE_BOXED;
return TRUE;
}
-TReturn tcore_util_netif(const char *name, gboolean enabled)
-{
- int ret;
- int fd;
- struct ifreq ifr;
-
- if (!name)
- return TCORE_RETURN_EINVAL;
-
- if (strlen(name) > IFNAMSIZ)
- return TCORE_RETURN_EINVAL;
-
- if (enabled == TRUE)
- fd = socket(AF_INET, SOCK_DGRAM, 0);
- else
- fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
-
- if (fd < 0) {
- 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 TCORE_RETURN_FAILURE;
- }
-
- if (enabled == TRUE)
- ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
- else
- ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING);
-
- ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
- if (ret < 0) {
- close(fd);
- return TCORE_RETURN_FAILURE;
- }
-
- close(fd);
- return TCORE_RETURN_SUCCESS;
-}
-
-TReturn tcore_util_netif_set(const char *name, const char *ipaddr,
- const char *gateway, const char *netmask)
-{
- int ret;
- int fd;
- struct ifreq ifr;
- struct sockaddr_in sai;
-
- if (!name)
- return TCORE_RETURN_EINVAL;
-
- if (strlen(name) > IFNAMSIZ)
- return TCORE_RETURN_EINVAL;
-
- fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (fd < 0) {
- return TCORE_RETURN_FAILURE;
- }
-
- memset(&sai, 0, sizeof(struct sockaddr_in));
- sai.sin_family = AF_INET;
- sai.sin_port = 0;
- memset(&ifr, 0, sizeof(struct ifreq));
-
- if (ipaddr) {
- dbg("ip = [%s]", ipaddr);
- if (!inet_aton(ipaddr, &sai.sin_addr)) {
- close(fd);
- return TCORE_RETURN_FAILURE;
- }
-
- strncpy(ifr.ifr_name, name, IFNAMSIZ);
- ifr.ifr_name[IFNAMSIZ - 1] = '\0';
- memcpy(&ifr.ifr_addr, &sai, sizeof(sai));
-
- ret = ioctl(fd, SIOCSIFADDR, &ifr);
- if (ret < 0) {
- close(fd);
- return TCORE_RETURN_FAILURE;
- }
- }
-
- if (gateway) {
- dbg("gateway = [%s]", gateway);
- if (!inet_aton(gateway, &sai.sin_addr)) {
- close(fd);
- return TCORE_RETURN_FAILURE;
- }
-
- strncpy(ifr.ifr_name, name, IFNAMSIZ);
- ifr.ifr_name[IFNAMSIZ - 1] = '\0';
- memcpy(&ifr.ifr_dstaddr, &sai, sizeof(sai));
-
- ret = ioctl(fd, SIOCSIFDSTADDR, &ifr);
- if (ret < 0) {
- close(fd);
- return TCORE_RETURN_FAILURE;
- }
- }
-
- if (netmask) {
- dbg("netmask = [%s]", netmask);
- if (!inet_aton(netmask, &sai.sin_addr)) {
- close(fd);
- return TCORE_RETURN_FAILURE;
- }
-
- strncpy(ifr.ifr_name, name, IFNAMSIZ);
- ifr.ifr_name[IFNAMSIZ - 1] = '\0';
- memcpy(&ifr.ifr_netmask, &sai, sizeof(sai));
-
- ret = ioctl(fd, SIOCSIFNETMASK, &ifr);
- if (ret < 0) {
- close(fd);
- return TCORE_RETURN_FAILURE;
- }
- }
-
- close(fd);
- return TCORE_RETURN_SUCCESS;
-}
-
-char *tcore_util_get_string_by_ip4type(union tcore_ip4_type ip)
-{
- char buf[16]; /* 'nnn'*4 + '.'*3 + '\0' */
-
- snprintf(buf, 16, "%d.%d.%d.%d", ip.s[0], ip.s[1], ip.s[2], ip.s[3]);
- dbg("IP Address: [%s]", buf);
-
- return strdup(buf);
-}
-
-enum tcore_dcs_type tcore_util_get_cbs_coding_scheme(unsigned char encode)
+TcoreUtilDcs tcore_util_get_cbs_coding_scheme(guchar encode)
{
- enum tcore_dcs_type dcs = TCORE_DCS_TYPE_NONE;
+ TcoreUtilDcs dcs = TCORE_DCS_TYPE_NONE;
switch (encode & 0xf0)
{
else (i) = 0;
-unsigned char *tcore_util_decode_hex(const char *src, int len)
+guchar *tcore_util_decode_hex(const char *src, int len)
{
- unsigned char *buf;
+ guchar *buf;
int i = 0;
int j = 0;
int out_len = 0;
return buf;
}
-#define convert_to_hex(in, out) (in <= 9) ? \
- (out = '0' + in) : (out = 'A' + in - 10)
-
-long tcore_util_encode_hex(const unsigned char *src, long num_bytes,
- char *buf)
-{
- 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';
-
- return j;
-}
-
-/* pdu buffer size must be 12 (SCA max length) + 164 (TPDU max length) bytes */
-int tcore_util_pdu_encode(const unsigned char *sca, const unsigned char *tpdu,
- int tpdu_len, char *pdu)
-{
- int i, sca_len;
- unsigned char converted_sca[SMS_ENCODED_SCA_LEN_MAX];
-
- if (sca[0] == 0) {
- converted_sca[0] = 0;
- sca_len = 0;
-
- goto out;
- }
-
- /*
- * For PDU, the SC Address length is the number of packed BCD bytes
- * + 1 byte for SC Address type whereas the length given in
- * 3GPP 23.040 Address encoding is the number of digits without 1 byte
- * for address type.
- */
- sca_len = ((sca[0] + 1) / 2) + 1;
-
- converted_sca[0] = (unsigned char)sca_len;
-
- for (i = 1; i <= sca_len; i++)
- converted_sca[i] = sca[i];
-
-out:
- memcpy(pdu, converted_sca, sca_len + 1);
- memcpy(pdu + sca_len + 1, tpdu, tpdu_len);
-
- return sca_len + 1 + tpdu_len;
-}
-
-unsigned char *tcore_util_unpack_gsm7bit(const unsigned char *src, unsigned int src_len)
-{
- unsigned char *dest;
- int i = 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(outlen + 1, 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; i < outlen; i++)
- if (dest[i] == '\r')
- dest[i] = ' ';
-
- 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(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++;
-
- if (shift == 7) {
- shift = 0;
- i++;
- }
- }
- else {
- if (shift == 6)
- dest[pos] |= 0x1a;
- }
- }
-
- return dest;
-}
-
-char* tcore_util_convert_bcd2ascii(const char* src, int src_len, int max_len)
-{
- int index = 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(index = 0; index < src_len; index++){
- l_bcd = src[index] & 0x0F;
- h_bcd = (src[index] & 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;
-}
-
GHashTable *tcore_util_marshal_create()
{
GHashTable *ht = NULL;
gchar **inner_tuple = NULL;
GValue *src = g_new0(GValue, 1);
GValue *dest = g_new0(GValue, 1);
- unsigned int type = 0;
+ guint type = 0;
inner_tuple = g_strsplit(tuple[index], ":", 0);
type = atoi(inner_tuple[1]);
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, g_strdup(inner_tuple[0]), dest);
+ _tcore_util_marshal__convert_str_to_type(src, dest, type);
+ g_hash_table_insert(ht, tcore_strdup(inner_tuple[0]), dest);
- g_free(content);
+ tcore_free(content);
g_strfreev(inner_tuple);
index++;
}
gstring_tmp = g_string_new(NULL);
g_hash_table_iter_init(&iter, ht);
while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
- unsigned int gtype = 0;
+ guint gtype = 0;
gchar *tmp = NULL, *encoded_d = NULL;
GValue gval = { 0,{ { 0 } } };
}
encoded_d = g_base64_encode((guchar *)tmp, (gsize)strlen(tmp));
- g_free(tmp);
+ tcore_free(tmp);
g_string_append_printf(gstring_tmp, "%s:%d:%s ", (gchar *)key,
gtype, encoded_d);
- g_free((gpointer)encoded_d);
+ tcore_free((gpointer)encoded_d);
g_value_unset(&gval);
}
- rv_str = g_strdup(gstring_tmp->str);
+ rv_str = tcore_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, enum tcore_util_marshal_data_type type)
+ const void *data, TcoreUtilMarshalData type)
{
gboolean rv = FALSE;
GValue *value;
if (!rv)
return FALSE;
- g_hash_table_insert(ht, g_strdup(key), value);
+ g_hash_table_insert(ht, tcore_strdup(key), value);
return TRUE;
}
gboolean tcore_util_marshal_get_data(GHashTable *ht, const gchar *key,
- void **data, enum tcore_util_marshal_data_type type)
+ void **data, TcoreUtilMarshalData type)
{
gboolean rv = FALSE;
gpointer value;
return 0;
rvalue = *tmp;
- g_free(tmp);
+ tcore_free(tmp);
return rvalue;
}
return rvalue;
}
-
-char *tcore_util_get_version(void)
-{
- return strdup(TCORE_VERSION);
-}
+#endif /* #if 0 */
Version: 1.0
Requires: glib-2.0 gobject-2.0 gudev-1.0
Libs: -L${libdir} -ltcore -ldl
-Cflags: -I${includedir}/tcore
+Cflags: -I${includedir}/tcore -I${includedir}/tcore/common