From 0abccf103effb8753cb17e6cab89217df46d303c Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Thu, 2 Jul 2015 13:49:04 +0900 Subject: [PATCH] Code sync from tizen_2.4 - secure-storage function was changed, so need to change ssa_get / ssa_put function. Change-Id: I443d0439f8ddef649d828f9d877cb24f4bb50c62 --- CMakeLists.txt | 3 +- LICENSE | 408 +++++------ include/imc_common.h | 2 - include/nvm/nvm.h | 250 +++---- packaging/tel-plugin-imc.spec | 25 +- res/convert_to_sql.c | 123 ---- res/wiki_mcc_mnc_oper_list.csv | 1517 --------------------------------------- res/wiki_mcc_mnc_oper_list.db | Bin 43008 -> 0 bytes res/wiki_mcc_mnc_oper_list.sql | 1519 ---------------------------------------- src/desc_imc.c | 10 +- src/imc_call.c | 862 ++++++++++++----------- src/imc_common.c | 76 +- src/imc_gps.c | 1064 +++++++++++++--------------- src/imc_modem.c | 1147 +++++++++++++++--------------- src/imc_network.c | 466 +++++------- src/imc_phonebook.c | 125 ++-- src/imc_ps.c | 100 +-- src/imc_sap.c | 544 +++++++------- src/imc_sat.c | 47 +- src/imc_sim.c | 1287 +++++++++++++++++++--------------- src/imc_sms.c | 1400 +++++++++++++++++++----------------- src/imc_ss.c | 815 +++++++++++---------- src/nvm/nvm.c | 31 +- 23 files changed, 4460 insertions(+), 7361 deletions(-) delete mode 100644 res/convert_to_sql.c delete mode 100644 res/wiki_mcc_mnc_oper_list.csv delete mode 100644 res/wiki_mcc_mnc_oper_list.db delete mode 100644 res/wiki_mcc_mnc_oper_list.sql mode change 100755 => 100644 src/imc_sim.c mode change 100755 => 100644 src/imc_ss.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 277d2a0..f96ab0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ SET(INCLUDEDIR "\${prefix}/include") # Set required packages INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED glib-2.0 tcore dlog db-util libxml-2.0 vconf) +pkg_check_modules(pkgs REQUIRED glib-2.0 tcore dlog db-util libxml-2.0 vconf secure-storage) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -57,6 +57,5 @@ SET_TARGET_PROPERTIES(imc-plugin PROPERTIES PREFIX "" OUTPUT_NAME imc-plugin) INSTALL(TARGETS imc-plugin LIBRARY DESTINATION ${LIBDIR}/telephony/plugins/modems) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/res/wiki_mcc_mnc_oper_list.sql DESTINATION /tmp RENAME mcc_mnc_oper_list.sql) INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME tel-plugin-imc) diff --git a/LICENSE b/LICENSE index bae7f54..3d69259 100644 --- a/LICENSE +++ b/LICENSE @@ -1,204 +1,204 @@ -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. - +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. + diff --git a/include/imc_common.h b/include/imc_common.h index 746659c..d55302c 100644 --- a/include/imc_common.h +++ b/include/imc_common.h @@ -23,10 +23,8 @@ #include -void util_hex_dump(char *pad, int size, const void *data); unsigned char util_hexCharToInt(char c); char *util_hex_to_string(const char *src, unsigned int src_len); char* util_hexStringToBytes(char *s); -char* util_removeQuotes(void *data); #endif // __IMC_COMMON_H__ \ No newline at end of file diff --git a/include/nvm/nvm.h b/include/nvm/nvm.h index 4aaefd4..a654bf2 100644 --- a/include/nvm/nvm.h +++ b/include/nvm/nvm.h @@ -1,125 +1,125 @@ -/* - * tel-plugin-imc - * - * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Paresh Agarwal - * - * 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 __NVM_H__ -#define __NVM_H__ - -/* Priority level for suspension of all updates */ -#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_ALL 4294967295 /* 0xFFFFFFFF */ - -/* Priority level for suspension of High priority updates */ -#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_HIGH 3221225472 /* 0xFFFFFFFF */ - -/* Priority level for suspension of all updates of dynamic data */ -#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_ALL_DYN 1610612735 /* 0x5FFFFFFF */ - -/* Priority level for suspension of Medium all updates */ -#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_MEDIUM 2147483648 /* 0x5FFFFFFF */ - -/* Priority level for suspension of Low updates of Medium */ -#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_LOW 1073741824 /* 0x5FFFFFFF */ - -/* Priority level for unsuspension of all updates */ -#define UTA_FLASH_PLUGIN_PRIO_UNSUSPEND_ALL 0 /* 0x0 */ - -#define NVM_FUNCTION_ID_OFFSET 20 -#define XDRV_INDICATION 0x04 - -#define XDRV_DISABLE "0" -#define XDRV_ENABLE "1" -#define XDRV_UNSUSPEND "0" - -/* Identifies our group with the xdrv AT command set */ -#define IUFP_GROUP "43" -#define IUFP_GROUP_ID 43 - -#define IUFP_REGISTER 0 -#define IUFP_REGISTER_STR "0" - -#define IUFP_SUSPEND 1 -#define IUFP_SUSPEND_STR "1" - -#define IUFP_FLUSH 2 -#define IUFP_FLUSH_STR "2" - -#define IUFP_UPDATE_REQ 3 -#define IUFP_UPDATE_REQ_STR "3" - -#define IUFP_UPDATE_REQ_ACK 3 -#define IUFP_UPDATE_REQ_ACK_STR "3" - -#define IUFP_UPDATE 4 -#define IUFP_UPDATE_STR "4" - -#define IUFP_UPDATE_ACK 4 -#define IUFP_UPDATE_ACK_STR "4" - -#define IUFP_NO_PENDING_UPDATE 5 -#define IUFP_NO_PENDING_UPDATE_STR "5" - -/* XDRV command was executed without any error */ -#define XDRV_RESULT_OK 0 - -typedef enum uta_common_return_codes { - UTA_SUCCESS = 0, - UTA_FAILURE = -1, - UTA_ERROR_OUT_OF_MEMORY = -2, - UTA_ERROR_INVALID_HANDLE = -3, - UTA_ERROR_OUT_OF_RANGE_PARAM = -4, - UTA_ERROR_INVALID_PARAM = -5, - UTA_ERROR_TOO_SMALL_BUF_PARAM = -6, - UTA_ERROR_NOT_SUPPORTED = -7, - UTA_ERROR_TIMEOUT = -8, - UTA_ERROR_WRONG_STATE = -9, - UTA_ERROR_BAD_FORMAT = -10, - UTA_ERROR_INSUFFICIENT_PERMISSIONS = -11, - UTA_ERROR_IO_ERROR = -12, - UTA_ERROR_OUT_OF_HANDLES = -13, - UTA_ERROR_OPERATION_PENDING = -14, - UTA_ERROR_SPECIFIC = -100 -} nvm_return_codes; - -typedef enum nvm_error_numbers { - NVM_NO_ERR = 0, - NVM_CMD_ERR, - NVM_DATA_ERR, - NVM_MEM_FULL_ERR, - NVM_RES_ERR, - NVM_WRITE_ERR, - NVM_READ_ERR, - NVM_RES_LEN_ERR, - NVM_PCKT_ERR, - NVM_REG_FAIL_ERR, - NVM_DATA_LEN_ERR, - NVM_FILE_ERR, - NVM_AT_PORT_ERR, - NVM_READ_AT_ERR, - NVM_DATA_PORT_ERR, - NVM_NO_PENDING_UPDATE, - NVM_UPDATE, - NVM_REGISTER_ERR, - NVM_UNKNOWN_ERR -} nvm_error; - -int nvm_sum_4_bytes(const char *pos); -gboolean nvm_create_nvm_data(); -nvm_error nvm_process_nv_update(const char *data); - -#endif /* __NVM_H__ */ +/* + * tel-plugin-imc + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Paresh Agarwal + * + * 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 __NVM_H__ +#define __NVM_H__ + +/* Priority level for suspension of all updates */ +#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_ALL 4294967295 /* 0xFFFFFFFF */ + +/* Priority level for suspension of High priority updates */ +#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_HIGH 3221225472 /* 0xFFFFFFFF */ + +/* Priority level for suspension of all updates of dynamic data */ +#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_ALL_DYN 1610612735 /* 0x5FFFFFFF */ + +/* Priority level for suspension of Medium all updates */ +#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_MEDIUM 2147483648 /* 0x5FFFFFFF */ + +/* Priority level for suspension of Low updates of Medium */ +#define UTA_FLASH_PLUGIN_PRIO_SUSPEND_LOW 1073741824 /* 0x5FFFFFFF */ + +/* Priority level for unsuspension of all updates */ +#define UTA_FLASH_PLUGIN_PRIO_UNSUSPEND_ALL 0 /* 0x0 */ + +#define NVM_FUNCTION_ID_OFFSET 20 +#define XDRV_INDICATION 0x04 + +#define XDRV_DISABLE "0" +#define XDRV_ENABLE "1" +#define XDRV_UNSUSPEND "0" + +/* Identifies our group with the xdrv AT command set */ +#define IUFP_GROUP "43" +#define IUFP_GROUP_ID 43 + +#define IUFP_REGISTER 0 +#define IUFP_REGISTER_STR "0" + +#define IUFP_SUSPEND 1 +#define IUFP_SUSPEND_STR "1" + +#define IUFP_FLUSH 2 +#define IUFP_FLUSH_STR "2" + +#define IUFP_UPDATE_REQ 3 +#define IUFP_UPDATE_REQ_STR "3" + +#define IUFP_UPDATE_REQ_ACK 3 +#define IUFP_UPDATE_REQ_ACK_STR "3" + +#define IUFP_UPDATE 4 +#define IUFP_UPDATE_STR "4" + +#define IUFP_UPDATE_ACK 4 +#define IUFP_UPDATE_ACK_STR "4" + +#define IUFP_NO_PENDING_UPDATE 5 +#define IUFP_NO_PENDING_UPDATE_STR "5" + +/* XDRV command was executed without any error */ +#define XDRV_RESULT_OK 0 + +typedef enum uta_common_return_codes { + UTA_SUCCESS = 0, + UTA_FAILURE = -1, + UTA_ERROR_OUT_OF_MEMORY = -2, + UTA_ERROR_INVALID_HANDLE = -3, + UTA_ERROR_OUT_OF_RANGE_PARAM = -4, + UTA_ERROR_INVALID_PARAM = -5, + UTA_ERROR_TOO_SMALL_BUF_PARAM = -6, + UTA_ERROR_NOT_SUPPORTED = -7, + UTA_ERROR_TIMEOUT = -8, + UTA_ERROR_WRONG_STATE = -9, + UTA_ERROR_BAD_FORMAT = -10, + UTA_ERROR_INSUFFICIENT_PERMISSIONS = -11, + UTA_ERROR_IO_ERROR = -12, + UTA_ERROR_OUT_OF_HANDLES = -13, + UTA_ERROR_OPERATION_PENDING = -14, + UTA_ERROR_SPECIFIC = -100 +} nvm_return_codes; + +typedef enum nvm_error_numbers { + NVM_NO_ERR = 0, + NVM_CMD_ERR, + NVM_DATA_ERR, + NVM_MEM_FULL_ERR, + NVM_RES_ERR, + NVM_WRITE_ERR, + NVM_READ_ERR, + NVM_RES_LEN_ERR, + NVM_PCKT_ERR, + NVM_REG_FAIL_ERR, + NVM_DATA_LEN_ERR, + NVM_FILE_ERR, + NVM_AT_PORT_ERR, + NVM_READ_AT_ERR, + NVM_DATA_PORT_ERR, + NVM_NO_PENDING_UPDATE, + NVM_UPDATE, + NVM_REGISTER_ERR, + NVM_UNKNOWN_ERR +} nvm_error; + +int nvm_sum_4_bytes(const char *pos); +gboolean nvm_create_nvm_data(); +nvm_error nvm_process_nv_update(const char *data); + +#endif /* __NVM_H__ */ diff --git a/packaging/tel-plugin-imc.spec b/packaging/tel-plugin-imc.spec index eadfd08..bc5cfae 100755 --- a/packaging/tel-plugin-imc.spec +++ b/packaging/tel-plugin-imc.spec @@ -1,6 +1,6 @@ %define major 0 %define minor 1 -%define patchlevel 69 +%define patchlevel 84 Name: tel-plugin-imc Version: %{major}.%{minor}.%{patchlevel} @@ -16,6 +16,7 @@ BuildRequires: pkgconfig(tcore) BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(secure-storage) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -32,23 +33,6 @@ make %{?_smp_mflags} %post /sbin/ldconfig -mkdir -p /opt/dbspace - -if [ ! -f /opt/dbspace/.mcc_mnc_oper_list.db ] -then - sqlite3 /opt/dbspace/.mcc_mnc_oper_list.db < /tmp/mcc_mnc_oper_list.sql -fi - -rm -f /tmp/mcc_mnc_oper_list.sql - -if [ -f /opt/dbspace/.mcc_mnc_oper_list.db ] -then - chmod 600 /opt/dbspace/.mcc_mnc_oper_list.db -fi -if [ -f /opt/dbspace/.mcc_mnc_oper_list.db-journal ] -then - chmod 644 /opt/dbspace/.mcc_mnc_oper_list.db-journal -fi %postun -p /sbin/ldconfig @@ -58,9 +42,6 @@ mkdir -p %{buildroot}/usr/share/license cp LICENSE %{buildroot}/usr/share/license/%{name} %files - -%defattr(-,root,root,-) - +%defattr(644,system,system,-) %{_libdir}/telephony/plugins/modems/* -/tmp/mcc_mnc_oper_list.sql /usr/share/license/%{name} diff --git a/res/convert_to_sql.c b/res/convert_to_sql.c deleted file mode 100644 index 5b1b1ba..0000000 --- a/res/convert_to_sql.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * tel-plugin-imc - * - * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Hayoon Ko - * - * 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 -#include - -#define TABLE_NAME "mcc_mnc_oper_list" -#define TABLE_SCHEMA "create table " TABLE_NAME " (id integer primary key, country char(3), mcc integer, mnc char(3), oper char(45));" - -#define dbg(fmt, args ...) fprintf(stderr, fmt, ## args) - -int main(int argc, char *argv[]) -{ - FILE *fp_in; - - char buf[255]; - char brand[255]; - char oper[255]; - char *pos1, *pos2; - char country[10]; - char mnc[10]; - char *oper_select; - int mcc; - - if (argc != 2) { - printf("%s filename.csv\n", argv[0]); - return -1; - } - - fp_in = fopen(argv[1], "r"); - if (fp_in == NULL) { - printf("faild.\n"); - return -1; - } - - printf("%s\n", TABLE_SCHEMA); - - printf("BEGIN;\n"); - while (1) { - fgets(buf, 255, fp_in); - - if (feof(fp_in)) { - break; - } - - // remove '\n' - buf[strlen(buf) - 1] = '\0'; - - dbg("\n%s\n", buf); - - pos1 = strchr(buf, ','); - memset(country, 0, 10); - memcpy(country, buf, pos1 - buf); - - dbg("country=[%s]\n", country); - - sscanf(pos1 + 1, "%d", &mcc); - dbg("mcc=[%d]\n", mcc); - - // get mnc - pos1 = strchr(pos1 + 1, ','); - pos2 = strchr(pos1 + 1, ','); - - dbg("mnc=[%s]\n", pos1 + 1); - - memset(mnc, 0, 10); - strncpy(mnc, pos1 + 1, pos2 - pos1 - 1); - - // get brand - pos1 = pos2; - pos2 = strchr(pos1 + 1, ','); - - dbg("brand=[%s]\n", pos1 + 1); - - memset(brand, 0, 255); - strncpy(brand, pos1 + 1, pos2 - pos1 - 1); - - // get oper - pos1 = pos2; - pos2 = strchr(pos1 + 1, ','); - - dbg("oper=[%s]\n", pos1 + 1); - - memset(oper, 0, 255); - strcpy(oper, pos1 + 1); - - oper_select = brand; - if (strlen(brand) == 0) - oper_select = oper; - - if (oper_select[0] == '\"') { - memset(buf, 0, 255); - snprintf(buf, strlen(oper_select) - 2, "%s", oper_select + 1); - snprintf(oper_select, 255, "%s", buf); - } - - snprintf(buf, 255, "insert into %s " - " (country, mcc, mnc, oper) " - " values (\"%s\", %d, \"%s\", \"%s\");", - TABLE_NAME, country, mcc, mnc, oper_select); - printf("%s\n", buf); - } - printf("COMMIT;\n"); - - fclose(fp_in); -} diff --git a/res/wiki_mcc_mnc_oper_list.csv b/res/wiki_mcc_mnc_oper_list.csv deleted file mode 100644 index 6c6edf6..0000000 --- a/res/wiki_mcc_mnc_oper_list.csv +++ /dev/null @@ -1,1517 +0,0 @@ -Country,MCC,MNC,Brand,Operator -__,001,01,TEST,Test Network -GE,289,67,Aquafon,Aquafon -GE,289,88,A-Mobile,A-Mobile -AF,412,01,AWCC,Afghan Wireless Communication Company -AF,412,20,Roshan,Telecom Development Company Afghanistan Ltd. -AF,412,40,MTN,MTN Group Afghanistan -AF,412,50,Etisalat,Etisalat Afghanistan -AL,76,01,AMC,Albanian Mobile Communications -AL,276,02,Vodafone,Vodafone Albania -AL,276,03,Eagle Mobile,Eagle Mobile -AL,276,04,Plus Communication,Plus Communication -DZ,603,01,Mobilis,ATM Mobilis -DZ,603,02,Djezzy,Orascom Telecom Algerie Spa -DZ,603,03,Nedjma,Wataniya Telecom Algerie -AS,44,11,Bluesky,Bluesky -AD,213,03,Mobiland,Servei De Tele. DAndorra -AO,631,02,UNITEL,UNITEL S.a.r.l. -AO,631,04,MOVICEL,MOVICEL Telecommunications S.a. -AI,365,010,,Weblinks Limited -AI,365,840,,Cable & Wireless -AG,344,030,APUA,Antigua Public Utilities Authority -AG,344,920,LIME,Cable & Wireless Caribbean Cellular (Antigua) Limited -AG,338,050,Digicel,Antigua Wireless Ventures Limited -AR,722,010,Movistar,Telefonica Móviles Argentina SA -AR,722,020,Nextel,NII Holdings -AR,722,070,Movistar,Telefonica Móviles Argentina SA -AR,722,310,Claro,AMX Argentina S.A -AR,722,320,Claro,AMX Argentina S.A -AR,722,330,Claro,AMX Argentina S.A -AR,722,34,Personal,Telecom Personal SA -AR,722,341,Personal,Telecom Personal SA -AR,722,350,,Hutchinson (PORT HABLE) -AR,722,36,Personal,Telecom Personal SA -AM,283,01,Beeline,ArmenTel -AM,283,05,VivaCell-MTS,K Telecom CJSC -AM,283,10,Orange, -AW,363,01,SETAR,Servicio di Telecomunicacion di Aruba -AW,363,02,Digicel, -AU,505,01,Telstra,Telstra Corporation Limited -AU,505,02,Optus,Singtel Optus Proprietary Limited -AU,505,03,Vodafone,Vodafone Hutchison Australia Proprietary Limited -AU,505,04,,Department of Defence -AU,505,05,Ozitel, -AU,505,06,3,Vodafone Hutchison Australia Proprietary Limited -AU,505,08,One.Tel,One.Tel Limited -AU,505,09,Airnet, -AU,505,12,3,Vodafone Hutchison Australia Proprietary Limited -AU,505,13,Railcorp,Rail Corporation New South Wales -AU,505,14,AAPT,Telecom New Zealand -AU,505,15,3GIS, -AU,505,16,Victorian Rail Track, -AU,505,21,SOUL,TPG Telecom Limited -AU,505,24,Advance Communications Technologies Pty. Ltd., -AU,505,38,Crazy John's,Vodafone Hutchison Australia Proprietary Limited -AU,505,71,Telstra,Telstra Corporation Limited -AU,505,72,Telstra,Telstra Corporation Limited -AU,505,88,Localstar Holding Pty. Ltd., -AU,505,90,Optus,Singtel Optus Proprietary Limited -AU,505,99,One.Tel,One.Tel -AT,232,01,A1,A1 Telekom Austria -AT,232,03,T-Mobile,T-Mobile Austria -AT,232,05,Orange,Orange Austria -AT,232,07,tele.ring,T-Mobile Austria -AT,232,09,A1,A1 Telekom Austria -AT,232,10,3,Hutchison 3G -AT,232,11,bob,A1 Telekom Austria -AT,232,12,yesss,yesss -AT,232,14,3,Hutchison 3G -AT,232,15,Barablu,Barablu Mobile Ltd. -AT,232,91,GSM-R A,ÖBB -AZ,400,01,Azercell, -AZ,400,02,Bakcell, -AZ,400,03,FONEX,CATEL -AZ,400,04,Nar Mobile,Azerfon -BS,364,390,BaTelCo,The Bahamas Telecommunications Company Ltd -BH,426,01,Batelco,Bahrain Telecommunications Company -BH,426,02,zain BH,Zain Bahrain -BH,426,04,VIVA,Viva Bahrain -BD,470,01,Grameenphone,GrameenPhone Ltd -BD,470,02,Robi,Axiata Bangladesh Ltd. -BD,470,03,Banglalink,Orascom Telecom Holding -BD,470,04,TeleTalk, -BD,470,05,Citycell, -BD,470,06,Airtel formerly Warid Telcom,Bharti airtel Bangladesh Ltd. -BB,342,600,LIME,LIME (formerly known as Cable & Wireless) -BB,342,750,Digicel,Digicel (Barbados) Limited -BB,342,820,,Sunbeach Communications -BY,257,01,velcom, -BY,257,02,MTS,Mobile TeleSystems -BY,257,03,DIALLOG,BelCel -BY,257,04,life:),Belarussian Telecommunications Network -BY,257,501,BelCel JV, -BE,206,01,Proximus,Belgacom Mobile -BE,206,05,Telenet,Telenet -BE,206,10,Mobistar,France Telecom -BE,206,20,BASE,KPN -BZ,702,67,DigiCell,Belize Telemedia -BZ,702,99,Smart,SpeedNet Communications Limited -BJ,616,01,Libercom,Benin Telecoms Mobile -BJ,616,02,Moov,Telecel Benin -BJ,616,03,MTN,Spacetel Benin -BJ,616,04,BBCOM,Bell Benin Communications -BJ,616,05,Glo,Glo Communication Benin -BM,350,01,Digicel Bermuda,Telecommunications (Bermuda & West Indies) Ltd -BM,350,02,Mobility,M3 Wireless -BM,338,050,Digicel Bermuda, -BM,310,59,Cellular One, -BT,402,11,B-Mobile,B-Mobile -BT,402,77,TashiCell,Tashi InfoComm Limited -BO,736,01,Nuevatel,Nuevatel PCS De Bolivia SA -BO,736,02,Entel,Entel SA -BO,736,03,Tigo,Telefonica Celular De Bolivia S.A -BA,218,03,HT-ERONET,Public Enterprise Croatian Telecom Ltd. -BA,218,05,m:tel,RS Telecommunications JSC Banja Luka -BA,218,90,BH Mobile,BH Telecom -BW,652,01,Mascom,Mascom Wireless (Pty) Limited -BW,652,02,Orange,Orange (Botswana) Pty Limited -BW,652,04,BTC Mobile,Botswana Telecommunications Corporation -BR,724,00,Nextel,"NII Holdings, Inc." -BR,724,02,TIM,Telecom Italia Mobile -BR,724,03,TIM,Telecom Italia Mobile -BR,724,04,TIM,Telecom Italia Mobile -BR,724,05,Claro BR,Claro -BR,724,06,Vivo,Vivo S.A. -BR,724,07,Sercomtel,Sercomtel Celular -BR,724,10,Vivo,Vivo S.A. -BR,724,11,Vivo,Vivo S.A. -BR,724,15,CTBC Celular,CTBC Celular S.A. -BR,724,16,Brasil Telecom GSM,Brasil Telecom GSM -BR,724,23,Vivo,Vivo S.A. -BR,724,31,Oi,TNL PCS -BR,724,32,CTBC Celular,CTBC Celular S.A. -BR,724,33,CTBC Celular,CTBC Celular S.A. -BR,724,34,CTBC Celular,CTBC Celular S.A. -BR,724,39,Nextel,"NII Holdings, Inc." -VG,348,170,LIME,Cable & Wireless -VG,348,570,CCT Boatphone,Caribbean Cellular Telephone -VG,348,770,Digicel,Digicel (BVI) Limited -BN,528,01,,Jabatan Telekom Brunei -BN,528,02,B-Mobile,B-Mobile Communications Sdn Bhd -BN,528,11,DSTCom,Data Stream Technology -BG,284,01,M-Tel,Mobiltel -BG,284,03,Vivacom,BTC -BG,284,04,Undisclosed,Undisclosed -BG,284,05,GLOBUL,Cosmo Bulgaria Mobile -BF,613,01,Telmob,Onatal -BF,613,02,Zain,Celtel Burkina Faso -BF,613,03,Telecel Faso,Telecel Faso SA -BI,642,01,Spacetel,Econet Wireless Burundi PLC -BI,642,02,Africell,Africell PLC -BI,642,03,Onatel,Onatel -BI,642,07,Smart Mobile,LACELL SU -BI,642,08,HiTs Telecom,HiTs Telecom -BI,642,82,U-COM Burundi,U-COM Burundi S.A. -KH,456,01,Mobitel,CamGSM -KH,456,02,hello,Telekom Malaysia International (Cambodia) Co. Ltd -KH,456,03,,S Telecom -KH,456,04,qb,Cambodia Advance Communications Co. Ltd -KH,456,05,Star-Cell,APPLIFONE CO. LTD. -KH,456,06,Smart Mobile,"Latelz Co., Ltd" -KH,456,18,Mfone,Camshin / Shinawatra -KH,456,11,Excell, -KH,456,09,Beeline,Sotelco Ltd. -KH,456,08,Metfone,Viettel -CM,624,01,MTN Cameroon,Mobile Telephone Network Cameroon Ltd -CM,624,02,Orange,Orange Cameroun S.A. -CA,302,220,Telus,Telus Mobility -CA,302,221,Telus,Telus Mobility -CA,302,270,unknown,EastLink -CA,302,290,,Airtel Wireless -CA,302,320,Mobilicity,DAVE Wireless -CA,302,350,FIRST,FIRST Networks Operations -CA,302,360,MiKe,Telus Mobility -CA,302,361,Telus,Telus Mobility -CA,302,370,Fido,Fido Solutions (Rogers Wireless) -CA,302,380,DMTS,Dryden Mobility -CA,302,490,WIND Mobile,Globalive Communications -CA,302,500,Videotron,Videotron -CA,302,510,Videotron,Videotron -CA,302,610,Bell,Bell Mobility -CA,302,610,Bell,Virgin Mobile Canada -CA,302,620,ICE Wireless,ICE Wireless -CA,302,640,Bell,Bell Mobility -CA,302,652,,BC Tel Mobility (Telus) -CA,302,653,Telus,Telus Mobility -CA,302,655,MTS,MTS Mobility -CA,302,656,TBay,Thunder Bay Telephone Mobility -CA,302,657,Telus,Telus Mobility -CA,302,660,MTS,MTS Mobility -CA,302,680,SaskTel,SaskTel Mobility -CA,302,701,,MB Tel Mobility -CA,302,702,,MT&T Mobility (Aliant) -CA,302,703,,New Tel Mobility (Aliant) -CA,302,710,Globalstar, -CA,302,720,Rogers Wireless,Rogers Communications -CA,302,780,SaskTel,SaskTel Mobility -CA,302,880,Bell / Telus / SaskTel,"Shared Telus, Bell, and SaskTel" -CV,625,01,CVMOVEL,"CVMovel, S.A." -CV,625,02,T+,T+ -KY,346,140,LIME,Cable & Wireless (Cayman Islands) Limited -KY,346,50,Digicel,Digicel Cayman Ltd. -CF,623,01,CTP,Centrafrique Telecom Plus -CF,623,02,TC,Telecel Centrafrique -CF,623,03,Orange,Orange RCA -CF,623,04,Nationlink,Nationlink Telecom RCA -TD,622,01,Airtel,Bharti Airtel SA -TD,622,02,,Tchad Mobile -TD,622,03,,TIGO - Millicom -TD,622,04,Salam,Sotel Mobile -CL,730,01,entel,Entel PCS Telecomunicaciones S.A. -CL,730,02,movistar,Telefónica Móvil de Chile -CL,730,03,Claro,Claro Chile S.A. -CL,730,04,Nextel,Centennial Cayman Corp. Chile -CL,730,08,VTR Móvil,VTR S.A. -CL,730,09,Nextel,Centennial Cayman Corp. Chile -CL,730,10,entel,Entel Telefonía Móvil S.A. -CL,730,99,Will,WILL Telefonía -CN,460,00,China Mobile,China Mobile -CN,460,01,China Unicom,China Unicom -CN,460,02,China Mobile,China Mobile -CN,460,03,China Telecom,China Telecom -CN,460,05,China Telecom,China Telecom -CN,460,06,China Unicom,China Unicom -CN,460,07,China Mobile,China Mobile -CN,460,20,China Tietong,China Tietong -CO,732,001,,Colombia Telecomunicaciones S.A. -CO,732,002,Edatel,Edatel S.A. -CO,732,101,Comcel,Comcel Colombia -CO,732,102,movistar,Bellsouth Colombia -CO,732,103,Tigo,Colombia Móvil -CO,732,111,Tigo,Colombia Móvil -CO,732,123,movistar,Telefónica Móviles Colombia -KM,654,01,,HURI - SNPT -CG,629,01,Airtel,Celtel Congo -CG,629,10,Libertis Telecom,MTN CONGO S.A -CG,629,07,,Warid Telecom -CK,548,01,,Telecom Cook -CR,712,01,Kolbi ICE,Instituto Costarricense de Electricidad -CR,712,02,Kolbi ICE,Instituto Costarricense de Electricidad -CR,712,03,Claro,Claro CR Telecomunicaciones -CR,712,04,movistar,Telefonica Móviles Costa Rica -HR,219,01,T-Mobile,T-Mobile Croatia -HR,219,02,Tele2,Tele2 -HR,219,10,Vip,Vipnet -CU,368,01,CUBACEL,"Empresa de Telecomunicaciones de Cuba, SA" -CY,280,01,Cytamobile-Vodafone,Cyprus Telecommunications Auth -CY,280,10,MTN,Areeba Ltd -CZ,230,01,T-Mobile,T-Mobile Czech Republic -CZ,230,02,O2,Telefónica Czech Republic -CZ,230,03,Vodafone,Vodafone Czech Republic -CZ,230,04,U:fon,"MobilKom, a. s." -CZ,230,05,,"TRAVEL TELEKOMMUNIKATION, s.r.o." -CZ,230,06,,"OSNO TELECOMUNICATION, s.r.o." -CZ,230,98,,"Správa železniční dopravní cesty, s.o." -CZ,230,99,Vodafone,Vodafone Czech Republic -CD,630,01,Vodacom,Vodacom Congo RDC sprl -CD,630,02,Zain,Celtel Congo -CD,630,04,,Cellco -CD,630,05,Supercell,Supercell SPRL -CD,630,10,Libertis Telecom, -CD,630,86,CCT,Congo-Chine Telecom s.a.r.l. -CD,630,89,SAIT Telecom,OASIS SPRL -DK,238,01,TDC,TDC A/S -DK,238,02,Telenor,Telenor Denmark -DK,238,03,,MIGway A/S -DK,238,05,,ApS KBUS -DK,238,06,3,Hi3G Denmark ApS -DK,238,07,,Barablu Mobile Ltd. -DK,238,09,,Dansk Beredskabskommunikation A/S -DK,238,10,TDC,TDC A/S -DK,238,11,,Dansk Beredskabskommunikation A/S -DK,238,12,,Lycamobile Denmark Ltd -DK,238,20,Telia, -DK,238,30,Telia,Telia Nättjänster Norden AB -DK,238,40,,Ericsson Danmark A/S -DK,238,77,Telenor,Telenor Denmark -DJ,638,01,Evatis,Djibouti Telecom SA -DM,366,020,Digicel,Digicel Group Limited -DM,366,110,,Cable & Wireless -DO,370,01,Orange,Orange Dominicana -DO,370,02,Claro,"Compañía Dominicana de Teléfonos, C por" -DO,370,03,Tricom,Tricom S.A. -DO,370,04,Viva,"Trilogy Dominicana, S.A." -TL,514,02,,Timor Telecom -EC,740,00,Movistar,Otecel S.A. -EC,740,01,Claro,CONECEL S.A. -EC,740,02,Alegro,Corporación Nacional de Telecomunicaciones CNT EP -EG,602,01,Mobinil,ECMS-Mobinil -EG,602,02,Vodafone,Vodafone Egypt -EG,602,03,Etisalat,Etisalat Egypt -SV,706,01,CTE Telecom Personal,CTE Telecom Personal SA de CV -SV,706,02,digicel,Digicel Group -SV,706,03,Tigo,Telemovil EL Salvador S.A. -SV,706,04,movistar,Telefónica Móviles El Salvador -SV,706,11,Claro,América Móvil -GQ,627,01,Orange GQ,GETESA -GQ,627,03,Hits GQ,HiTs EG.SA -ER,657,01,Eritel,Eritrea Telecommunications Services Corporation -EE,248,01,EMT,Estonian Mobile Telecom -EE,248,02,Elisa,Elisa Eesti -EE,248,03,Tele 2,Tele 2 Eesti -EE,248,04,,OY Top Connect -EE,248,05,,AS Bravocom Mobiil -EE,248,06,,Progroup Holding -ET,636,01,ETH-MTN,Ethio Telecom -FO,288,01,Faroese Telecom,Faroese Telecom -FO,288,02,Vodafone,Vodafone Faroe Islands -FJ,542,01,Vodafone,Vodafone Fiji -FJ,542,02,Digicel,Digicel Fiji -FI,244,03,DNA,DNA Oy -FI,244,05,Elisa,Elisa Oyj -FI,244,07,Nokia,Nokia Test Network -FI,244,08,,Unknown -FI,244,10,,TDC Oy -FI,244,11,VIRVE,Suomen Erillisverkot Oy -FI,244,12,DNA,DNA Oy -FI,244,14,AMT,Ålands Mobiltelefon -FI,244,15,SAMK,Samk student network -FI,244,21,Saunalahti,Elisa Oyj -FI,244,29,,Scnl Truphone -FI,244,91,Sonera,TeliaSonera Finland Oyj -FR,208,00,Orange,France Télécom -FR,208,01,Orange,France Télécom -FR,208,02,Orange,France Télécom -FR,208,05,,Globalstar Europe -FR,208,06,,Globalstar Europe -FR,208,07,,Globalstar Europe -FR,208,10,SFR,Vivendi -FR,208,11,SFR,Vivendi -FR,208,13,SFR,Vivendi -FR,208,14,Free Mobile,Iliad -FR,208,15,Free Mobile,Iliad -FR,208,20,Bouygues,Bouygues Telecom -FR,208,21,Bouygues,Bouygues Telecom -FR,208,22,Transatel Mobile,Transatel -FR,208,88,Bouygues,Bouygues Telecom -PF,547,20,Vini,Tikiphone SA -GA,628,01,Libertis,Gabon Telecom & Libertis S.A. -GA,628,02,Moov,Atlantique Télécom (Etisalat Group) Gabon S.A. -GA,628,03,Airtel,Airtel Gabon S.A. -GA,628,04,Azur,USAN Gabon S.A. -GM,607,01,Gamcel,Gamcel -GM,607,02,Africel,Africel -GM,607,03,Comium,Comium -GM,607,04,QCell,QCell Gambia -GE,282,01,Geocell,Geocell Limited -GE,282,02,MagtiCom,Magticom GSM -GE,282,03,MagtiCom,Magtifix -GE,282,04,Beeline,Mobitel LLC -GE,282,05,Silknet,Silknet CDMA -DE,262,01,T-Mobile,T-Mobile Deutschland GmbH -DE,262,02,Vodafone,Vodafone D2 GmbH -DE,262,03,E-Plus,E-Plus Mobilfunk -DE,262,04,Vodafone, -DE,262,05,E-Plus,E-Plus Mobilfunk -DE,262,06,T-Mobile, -DE,262,07,O2,O2 (Germany) GmbH & Co. OHG -DE,262,08,O2, -DE,262,09,Vodafone, -DE,262,10,,Arcor AG & Co -DE,262,11,O2, -DE,262,12,,Dolphin Telecom -DE,262,13,,Mobilcom Multimedia -DE,262,14,,Group 3G UMTS -DE,262,15,Airdata, -DE,262,16,Vistream, -DE,262,42,27C3,Chaos Computer Club -DE,262,43,LYCA,Lycamobile -DE,262,60,,DB Telematik -DE,262,76,,Siemens AG -DE,262,77,E-Plus, -DE,262,92,Nash Technologies, -DE,262,901,Debitel, -GH,620,01,MTN,MTN Group -GH,620,02,Vodafone,Vodafone Group -GH,620,03,tiGO,Millicom Ghana -GH,620,04,Expresso,Kasapa / Hutchison Telecom -GH,620,06,Airtel,Airtel -GI,266,01,GibTel,Gibraltar Telecoms -GI,266,06,CTS Mobile,CTS Gibraltar -GR,202,01,Cosmote,COSMOTE - Mobile Telecommunications S.A. -GR,202,05,Vodafone,Vodafone Greece -GR,202,09,Wind,Wind Hellas Telecommunications S.A. (Q-Telecom) -GR,202,10,Wind,Wind Hellas Telecommunications S.A. -GL,290,01,,TELE Greenland A/S -GD,352,030,Digicel,Digicel Grenada Ltd. -GD,352,110,Cable & Wireless,Cable & Wireless Grenada Ltd. -GP,340,01,Orange,Orange Caraïbe Mobiles -GP,340,02,Outremer,Outremer Telecom -GP,340,03,Telcell,Saint Martin et Saint Barthelemy Telcell Sarl -GP,340,08,Dauphin,Dauphin Telecom -GP,340,20,Digicel,DIGICEL Antilles Française Guyane -GU,310,032,IT&E Wireless,"IT&E Overseas, Inc" -GU,310,033,,Guam Telephone Authority -GU,310,140,mPulse,GTA Wireless -GU,310,370,docomo,docomo Pacific -GU,311,250,i CAN_GSM,Wave Runner LLC -GU,310,470,docomo,docomo Pacific -GT,704,01,Claro,Servicios de Comunicaciones Personales Inalambricas (SERCOM) -GT,704,02,Comcel / Tigo,Millicom / Local partners -GT,704,03,movistar,Telefonica Móviles Guatemala (Telefónica) -GB,234,55,Sure Mobile,Cable & Wireless Guernsey -GB,234,50,Wave Telecom,Wave Telecom (JT-Wave) -GB,234,03,Airtel Vodafone,Guernsey Airtel Ltd -GN,611,01,Orange S.A.,Orange -GN,611,02,Sotelgui,Sotelgui Lagui -GN,611,03,Telecel Guinee,INTERCEL Guinée -GN,611,04,MTN,Areeba Guinea -GN,611,05,Cellcom,Cellcom -GW,632,02,Areeba,Spacetel Guiné-Bissau S.A. -GW,632,03,Orange, -GY,738,01,Digicel,U-Mobile (Cellular) Inc. -GY,738,02,GT&T Cellink Plus,Guyana Telephone & Telegraph Co. -HT,372,01,Voila,Communication Cellulaire d'Haiti S.A. -HT,372,02,Digicel,Unigestion Holding S.A. -HT,372,03,NATCOM,Telecommunication S.A. -HN,708,01,Claro,Servicios de Comunicaciones de Honduras S.A. de C.V. -HN,708,02,Tigo,Celtel / Tigo -HN,708,30,Hondutel,Empresa Hondureña de Telecomunicaciones -HN,708,40,DIGICEL,Digicel de Honduras -HK,454,00,1O1O / One2Free,CSL Limited merged New World -HK,454,01,,CITIC Telecom 1616 -HK,454,02,,CSL Limited -HK,454,03,3 (3G),Hutchison Telecom -HK,454,04,3 (2G),Hutchison Telecom -HK,454,05,3 (CDMA),Hutchison Telecom -HK,454,06,SmarTone,SmarTone Mobile Communications Limited -HK,454,07,,China Unicom (Hong Kong) Limited -HK,454,08,,Trident Telecom -HK,454,09,,China Motion Telecom -HK,454,10,New World Mobility,CSL Limited -HK,454,11,,China-Hong Kong Telecom -HK,454,12,CMCC HK,China Mobile Hong Kong Company Limited -HK,454,14,,Hutchison Telecom -HK,454,15,,SmarTone Mobile Communications Limited -HK,454,16,PCCW Mobile (2G),PCCW Limited -HK,454,17,,SmarTone Mobile Communications Limited -HK,454,18,,CSL Limited -HK,454,19,PCCW Mobile (3G),PCCW Limited -HK,454,29,PCCW Mobile (CDMA),PCCW Limited -HU,216,01,Telenor,Telenor Magyarország Zrt. -HU,216,30,T-Mobile,Magyar Telekom Plc -HU,216,70,Vodafone,Vodafone Magyarország Zrt. -IS,274,01,Síminn,Iceland Telecom -IS,274,02,Vodafone,Og fjarskipti hf -IS,274,03,Vodafone,Vodafone Iceland -IS,274,04,Viking,IMC Island ehf -IS,274,06,,Núll níu ehf -IS,274,07,IceCell,IceCell ehf -IS,274,08,On-waves,Iceland Telecom -IS,274,11,Nova,Nova ehf -IS,274,12,Tal,Tal hf -IN,404,01,Vodafone IN,Haryana -IN,404,02,AirTel,Punjab -IN,404,03,AirTel,Himachal Pradesh -IN,404,04,IDEA,Delhi & NCR -IN,404,05,Vodafone IN,Gujarat -IN,404,07,IDEA,Andhra Pradesh -IN,404,09,Reliance,Assam -IN,404,10,AirTel,Delhi & NCR -IN,404,11,Vodafone IN,Delhi & NCR -IN,404,12,IDEA,Haryana -IN,404,13,Vodafone IN,Andhra Pradesh -IN,404,14,IDEA,Punjab -IN,404,15,Vodafone IN,Uttar Pradesh (East) -IN,404,17,AIRCEL,West Bengal -IN,404,19,IDEA,Kerala -IN,404,20,Vodafone IN,Mumbai -IN,404,21,Loop Mobile,Mumbai -IN,404,22,IDEA,Maharashtra & Goa -IN,404,24,IDEA,Gujarat -IN,404,25,AIRCEL,Bihar -IN,404,27,Vodafone IN,Maharashtra & Goa -IN,404,28,AIRCEL,Orissa -IN,404,29,AIRCEL,Assam -IN,404,30,Vodafone IN,Kolkata -IN,404,31,AirTel,Kolkata -IN,404,34,CellOne,Haryana -IN,404,36,Reliance,Bihar & Jharkhand -IN,404,37,Aircel,Jammu & Kashmir -IN,404,38,CellOne,Assam -IN,404,41,Aircel,Chennai -IN,404,42,Aircel,Tamil Nadu -IN,404,44,IDEA,Karnataka -IN,404,45,Airtel,Karnataka -IN,404,46,Vodafone IN,Kerala -IN,404,48,Dishnet Wireless,Unknown -IN,404,49,Airtel,Andhra Pradesh -IN,404,51,CellOne,Himachal Pradesh -IN,404,52,Reliance,Orissa -IN,404,53,CellOne,Punjab -IN,404,54,CellOne,Uttar Pradesh (West) -IN,404,55,CellOne,Uttar Pradesh (East) -IN,404,71,CellOne,Karnataka (Bangalore) -IN,404,56,IDEA,Uttar Pradesh (West) -IN,404,57,CellOne,Gujarat -IN,404,58,CellOne,Madhya Pradesh & Chhattisgarh -IN,404,59,CellOne,Rajasthan -IN,404,60,Vodafone IN,Rajasthan -IN,404,62,CellOne,Jammu & Kashmir -IN,404,64,CellOne,Chennai -IN,404,66,CellOne,Maharashtra & Goa -IN,404,67,Reliance GSM,Madhya Pradesh & Chhattisgarh -IN,404,68,DOLPHIN,Delhi & NCR -IN,404,69,DOLPHIN,Mumbai -IN,404,72,CellOne,Kerala -IN,404,74,CellOne,West Bengal -IN,404,76,CellOne,Orissa -IN,404,78,Idea Cellular Ltd,Madhya Pradesh & Chattishgarh -IN,404,80,BSNL MOBILE,Bharat Sanchar Nigam Limited -IN,404,81,CellOne,Kolkata -IN,404,82,Idea,Himachal Pradesh -IN,404,83,Reliance Smart GSM,Kolkata -IN,404,84,Vodafone IN,Chennai -IN,404,85,Reliance,West Bengal -IN,404,86,Vodafone IN,Karnataka -IN,404,87,Idea,Rajisthan -IN,404,88,Vodafone IN,Vodafone Punjab -IN,404,89,Idea,Uttar Pradesh (East) -IN,404,90,AirTel,Maharashtra & Goa -IN,404,91,AIRCEL,Kolkata -IN,404,92,AirTel,Mumbai -IN,404,93,AirTel,Madhya Pradesh -IN,404,96,AirTel,Haryana -IN,405,01,Reliance,Andhra Pradesh -IN,405,03,Reliance,Bihar -IN,405,04,Reliance,Chennai -IN,405,05,Reliance,Delhi & NCR -IN,405,09,Reliance,Jammu & Kashmir -IN,405,10,Reliance,Karnataka -IN,405,13,Reliance,Maharashtra & Goa -IN,405,025,TATA Teleservice,Andhra Pradesh -IN,405,026,TATA Teleservice,Assam -IN,405,027,TATA Teleservice,Bihar/Jharkhand -IN,405,029,TATA Teleservice,Delhi -IN,405,030,TATA Teleservice,Gujarat -IN,405,031,TATA Teleservice,Haryana -IN,405,032,TATA Teleservice,Himachal Pradesh -IN,405,033,TATA Teleservice,Jammu & Kashmir -IN,405,034,TATA Teleservice,Karnataka -IN,405,035,TATA Teleservice,Kerala -IN,405,036,TATA Teleservice,Kolkata -IN,405,037,TATA Teleservice,Maharashtra & Goa -IN,405,038,TATA Teleservice,Madhya Pradesh -IN,405,039,TATA Teleservice,Mumbai -IN,405,041,TATA Teleservice,Orissa -IN,405,042,TATA Teleservice,Punjab -IN,405,043,TATA Teleservice,Rajasthan -IN,405,044,TATA Teleservice,Tamil Nadu including Chennai -IN,405,045,TATA Teleservice,[Uttar Pradesh (E)] -IN,405,046,TATA Teleservice,[Uttar Pradesh (W) & Uttarkhand ] -IN,405,047,TATA Teleservice,[West Bengal] -IN,405,51,AirTel,West Bengal -IN,405,52,AirTel,Bihar & Jharkhand -IN,405,54,AirTel,Uttar Pradesh (East) -IN,405,55,Airtel,Jammu & Kashmir -IN,405,56,AirTel,Assam -IN,405,66,Vodafone IN,Uttar Pradesh (West) -IN,405,70,IDEA,Bihar & Jharkhand -IN,405,750,Vodafone IN,Jammu & Kashmir -IN,405,751,Vodafone IN,Assam -IN,405,752,Vodafone IN,Bihar & Jharkhand -IN,405,753,Vodafone IN,Orissa -IN,405,754,Vodafone IN,Himachal Pradesh -IN,405,755,Vodafone IN,North East -IN,405,756,Vodafone IN,Madhya Pradesh & Chhattisgarh -IN,405,799,IDEA,Mumbai -IN,405,800,AIRCEL,Delhi & NCR -IN,405,801,AIRCEL,Andhra Pradesh -IN,405,802,AIRCEL,Gujarat -IN,405,803,AIRCEL,Karnataka -IN,405,804,AIRCEL,Maharashtra & Goa -IN,405,805,AIRCEL,Mumbai -IN,405,806,AIRCEL,Rajasthan -IN,405,807,AIRCEL,Haryana -IN,405,808,AIRCEL,Madhya Pradesh -IN,405,809,AIRCEL,Kerala -IN,405,810,AIRCEL,Uttar Pradesh (East) -IN,405,811,AIRCEL,Uttar Pradesh (West) -IN,405,812,AIRCEL,Punjab -IN,405,819,Uninor,Andhra Pradesh -IN,405,818,Uninor,Uttar Pradesh (West) -IN,405,820,Uninor,Karnataka -IN,405,821,Uninor,Kerala -IN,405,822,Uninor,Kolkata -IN,405,824,Videocon Datacom,Assam -IN,405,827,Videocon Datacom,Gujarat -IN,405,834,Videocon Datacom,Madhya Pradesh -IN,405,844,Uninor,Delhi & NCR -IN,405,845,IDEA,Assam -IN,405,86,IDEA,Jammu & Kashmir -IN,405,848,IDEA,Kolkata -IN,405,850,IDEA,Orissa -IN,405,855,Loop Mobile,Assam -IN,405,864,Loop Mobile,Kolkata -IN,405,865,Loop Mobile,Madhya Pradesh -IN,405,875,Uninor,Assam -IN,405,880,Uninor,West Bengal -IN,405,881,S Tel,Assam -IN,405,912,Etisalat DB(cheers),Andhra Pradesh -IN,405,913,Etisalat DB(cheers),Delhi & NCR -IN,405,914,Etisalat DB(cheers),Gujarat -IN,405,917,Etisalat DB(cheers),Kerala -IN,404,927,Uninor,Gujarat -IN,405,929,Uninor,Maharashtra -ID,510,00,PSN,PT Pasifik Satelit Nusantara (ACeS) -ID,510,01,INDOSAT,PT Indonesian Satellite Corporation Tbk (INDOSAT) -ID,510,03,StarOne,PT Indosat Tbk -ID,510,07,TelkomFlexi,PT Telkom -ID,510,08,AXIS,PT Natrindo Telepon Seluler -ID,510,09,SMART,PT Smart Telecom -ID,510,10,Telkomsel,PT Telekomunikasi Selular -ID,510,11,XL,PT XL Axiata Tbk -ID,510,20,TELKOMMobile,PT Telkom Indonesia Tbk -ID,510,21,IM3,PT Indonesian Satellite Corporation Tbk (INDOSAT) -ID,510,27,Ceria,PT Sampoerna Telekomunikasi Indonesia -ID,510,28,Fren/Hepi,PT Mobile-8 Telecom -ID,510,89,3,PT Hutchison CP Telecommunications -ID,510,99,Esia,PT Bakrie Telecom -IR,432,11,IR-MCI,Mobile Communications Company of Iran -IR,432,14,TKC,KFZO -IR,432,19,MTCE,Mobile Telecommunications Company of Esfahan -IR,432,32,Taliya,Rafsanjan Industrial Complex -IR,432,35,Irancell,Irancell Telecommunications Services Company -IR,432,70,TCI,Telephone Communications Company of Iran -IR,432,93,Iraphone,Iraphone -IQ,418,05,Asia Cell,Asia Cell Telecommunications Company -IQ,418,08,SanaTel, -IQ,418,20,Zain,Zain Iraq -IQ,418,30,Zain,Zain Iraq -IQ,418,40,Korek,Korek Telecom Ltd -IQ,418,45,Mobitel,Mobitel Co. Ltd. -IQ,418,92,Omnnea,Omnnea Wireless -IE,272,01,Vodafone,Vodafone Ireland -IE,272,02,O2,O2 Ireland -IE,272,03,Meteor,Meteor Mobile Communications -IE,272,04,,Access Telecom -IE,272,05,3,Hutchison 3G Ireland limited -IE,272,07,Eircom,Eircom Mobile -IE,272,09,,Clever Communications -IE,272,11,,Liffey Telecom -IM,234,58,Pronto GSM,Manx Telecom -IM,234,09,Sure Mobile,Cable & Wireless Isle of Man Ltd. -IL,425,01,Orange,Partner Communications Company Ltd -IL,425,02,Cellcom, -IL,425,03,Pelephone, -IL,425,77,Mirs, -IT,222,01,TIM,Telecom Italia SpA -IT,222,02,Elsacom, -IT,222,07,Noverca, -IT,222,10,Vodafone,Vodafone Omnitel N.V. -IT,222,30,RFI,Rete Ferroviaria Italiana -IT,222,77,IPSE 2000, -IT,222,88,Wind,Wind Telecomunicazioni SpA -IT,222,98,Blu, -IT,222,99,3 Italia,Hutchison 3G -CI,612,01,,Cora de Comstar -CI,612,02,Moov, -CI,612,03,Orange, -CI,612,04,KoZ,Comium Ivory Coast Inc -CI,612,05,MTN, -CI,612,06,ORICEL,ORICEL -JM,338,020,LIME,Cable & Wireless -JM,338,050,Digicel,Digicel (Jamaica) Limited -JM,338,070,Claro,Oceanic Digital Jamaica Limited -JM,338,180,LIME,Cable & Wireless -JP,440,00,eMobile,EMOBILE Limited -JP,440,01,NTT docomo,NTT docomo -JP,440,02,NTT docomo,NTT DoCoMo Kansai -JP,440,03,NTT docomo,NTT DoCoMo Hokuriku -JP,440,04,SoftBank,SoftBank Mobile Corp -JP,440,06,SoftBank,SoftBank Mobile Corp -JP,440,07,KDDI,KDDI Corporation -JP,440,08,KDDI,KDDI Corporation -JP,440,09,NTT docomo,NTT DoCoMo Kansai -JP,440,10,NTT docomo,NTT DoCoMo Kansai -JP,440,11,NTT docomo,NTT DoCoMo Tokai -JP,440,12,NTT docomo,NTT DoCoMo -JP,440,13,NTT docomo,NTT DoCoMo -JP,440,14,NTT docomo,NTT DoCoMo Tohoku -JP,440,15,NTT docomo,NTT DoCoMo -JP,440,16,NTT docomo,NTT DoCoMo -JP,440,17,NTT docomo,NTT DoCoMo -JP,440,18,NTT docomo,NTT DoCoMo Tokai -JP,440,19,NTT docomo,NTT DoCoMo Hokkaido -JP,440,20,SoftBank,SoftBank Mobile Corp -JP,440,21,NTT docomo,NTT DoCoMo -JP,440,22,NTT docomo,NTT DoCoMo Kansai -JP,440,23,DoCoMo,NTT DoCoMo Tokai -JP,440,24,DoCoMo,NTT DoCoMo Chugoku -JP,440,25,DoCoMo,NTT DoCoMo Hokkaido -JP,440,26,DoCoMo,NTT DoCoMo Kyushu -JP,440,27,DoCoMo,NTT DoCoMoTohoku -JP,440,28,DoCoMo,NTT DoCoMo Shikoku -JP,440,29,DoCoMo,NTT DoCoMo -JP,440,30,DoCoMo,NTT DoCoMo -JP,440,31,DoCoMo,NTT DoCoMo Kansai -JP,440,32,DoCoMo,NTT DoCoMo -JP,440,33,DoCoMo,NTT DoCoMo Tokai -JP,440,34,DoCoMo,NTT DoCoMo Kyushu -JP,440,35,DoCoMo,NTT DoCoMo Kansai -JP,440,36,DoCoMo,NTT DoCoMo -JP,440,37,DoCoMo,NTT DoCoMo -JP,440,38,DoCoMo,NTT DoCoMo -JP,440,39,DoCoMo,NTT DoCoMo -JP,440,40,SoftBank,SoftBank Mobile Corp -JP,440,41,SoftBank,SoftBank Mobile Corp -JP,440,42,SoftBank,SoftBank Mobile Corp -JP,440,43,SoftBank,SoftBank Mobile Corp -JP,440,44,SoftBank,SoftBank Mobile Corp -JP,440,45,SoftBank,SoftBank Mobile Corp -JP,440,46,SoftBank,SoftBank Mobile Corp -JP,440,47,SoftBank,SoftBank Mobile Corp -JP,440,48,SoftBank,SoftBank Mobile Corp -JP,440,49,DoCoMo,NTT DoCoMo -JP,440,50,KDDI,KDDI Corporation -JP,440,51,KDDI,KDDI Corporation -JP,440,52,KDDI,KDDI Corporation -JP,440,53,KDDI,KDDI Corporation -JP,440,54,KDDI,KDDI Corporation -JP,440,55,KDDI,KDDI Corporation -JP,440,56,KDDI,KDDI Corporation -JP,440,58,DoCoMo,NTT DoCoMo Kansai -JP,440,60,DoCoMo,NTT DoCoMo Kansai -JP,440,61,DoCoMo,NTT DoCoMo Chugoku -JP,440,62,DoCoMo,NTT DoCoMo Kyushu -JP,440,63,DoCoMo,NTT DoCoMo -JP,440,64,DoCoMo,NTT DoCoMo -JP,440,65,DoCoMo,NTT DoCoMo Shikoku -JP,440,66,DoCoMo,NTT DoCoMo -JP,440,67,DoCoMo,NTT DoCoMo Tohoku -JP,440,68,DoCoMo,NTT DoCoMo Kyushu -JP,440,69,DoCoMo,NTT DoCoMo -JP,440,70,au,KDDI Corporation -JP,440,71,KDDI,KDDI Corporation -JP,440,72,KDDI,KDDI Corporation -JP,440,73,KDDI,KDDI Corporation -JP,440,74,KDDI,KDDI Corporation -JP,440,75,KDDI,KDDI Corporation -JP,440,76,KDDI,KDDI Corporation -JP,440,77,KDDI,KDDI Corporation -JP,440,78,,Okinawa Cellular Telephone -JP,440,79,KDDI,KDDI Corporation -JP,440,80,TU-KA,TU-KA Cellular Tokyo -JP,440,81,TU-KA,TU-KA Cellular Tokyo -JP,440,82,TU-KA,TU-KA Phone Kansai -JP,440,83,TU-KA,TU-KA Cellular Tokai -JP,440,84,TU-KA,TU-KA Phone Kansai -JP,440,85,TU-KA,TU-KA Cellular Tokai -JP,440,86,TU-KA,TU-KA Cellular Tokyo -JP,440,87,DoCoMo,NTT DoCoMo Chugoku -JP,440,88,KDDI,KDDI Corporation -JP,440,89,KDDI,KDDI Corporation -JP,440,90,SoftBank,SoftBank Mobile Corp -JP,440,92,SoftBank,SoftBank Mobile Corp -JP,440,93,SoftBank,SoftBank Mobile Corp -JP,440,94,SoftBank,SoftBank Mobile Corp -JP,440,95,SoftBank,SoftBank Mobile Corp -JP,440,96,SoftBank,SoftBank Mobile Corp -JP,440,97,SoftBank,SoftBank Mobile Corp -JP,440,98,SoftBank,SoftBank Mobile Corp -JP,440,99,DoCoMo,NTT DoCoMo -JE,234,50,JT-Wave,Jersey Telecom (JT-Wave) -JE,234,55,Sure Mobile,Cable & Wireless Jersey Limited -JE,234,03,Airtel Vodafone,JERSEY AIRTEL LIMITED -JO,416,01,zain JO,Jordan Mobile Telephone Services -JO,416,02,XPress Telecom, -JO,416,03,Umniah,Umniah Mobile Company -JO,416,77,Orange,Petra Jordanian Mobile Telecommunications Company (MobileCom) -KZ,401,01,Beeline,KaR-Tel LLP -KZ,401,02,Kcell,GSM Kazakhstan Ltd -KZ,401,07,Dalacom, -KZ,401,08,Kazakhtelecom, -KZ,401,77,Mobile Telecom Service,Mobile Telecom Service LLP -KE,639,02,Safaricom,Safaricom Limited -KE,639,03,Airtel,B Airtel -KE,639,07,Orange Kenya,Telkom Kenya -KE,639,05,yu,Econet Wireless Kenya -KI,545,09,Kiribati Frigate,Telecom Services Kiribati Ltd -KP,467,192,Koryolink,Cheo Technology Jv Company -KP,467,193,SunNet,Korea Posts and Telecommunications Corporation -KR,450,02,KT,KT -KR,450,03,Power 017,"Shinsegi Telecom, Inc." -KR,450,04,KT,KT -KR,450,05,SKT,SK Telecom -KR,450,06,LGU+,LG Telecom -KR,450,08,olleh,KT -RKS,212,01,Vala,PTK - Directory of Post of Kosovo -RKS,293,41,IPKO,IPKO -RKS,212,01,Z Mobile,Dardaphone -KW,419,02,zain KW,Zain Kuwait -KW,419,03,Wataniya,National Mobile Telecommunications -KW,419,04,Viva,Kuwait Telecommunication Company -KG,437,01,Beeline,Sky Mobile LLC -KG,437,03,Fonex,Aktel Ltd -KG,437,05,MegaCom,Alfa Telecom CJSC -KG,437,09,O!,NurTelecom LLC -LA,457,01,LaoTel,Lao Shinawatra Telecom -LA,457,02,ETL,Enterprise of Telecommunications Lao -LA,457,03,Unitel,"Star Telecom Co., Ltd" -LA,457,08,Tigo,Millicom Lao Co Ltd -LV,247,01,LMT,Latvian Mobile Telephone -LV,247,02,Tele2,Tele2 -LV,247,03,TRIATEL,Telekom Baltija -LV,247,05,Bite,Bite Latvija -LV,247,06,,Rigatta -LV,247,07,MTS,Master Telecom -LV,247,08,IZZI,IZZI -LV,247,09,Camel Mobile,Camel Mobile -LB,415,01,Alfa,MIC 1 -LB,415,03,mtc touch,MIC 2 -LB,415,05,Ogero Mobile,Ogero Telecom -LS,651,01,Vodacom,Vodacom Lesotho (Pty) Ltd -LS,651,02,,Econet Ezin-cel -LR,618,01,Lonestar Cell,Lonestar Communications Corporation -LR,618,02,Libercell,Atlantic Wireless (Liberia) Inc. -LR,618,04,Comium,Comium Liberia -LR,618,07,Cellcom,"Cellcom Telecommunications, Inc" -LR,618,20,LIBTELCO,Liberia Telecommunications Corporation -LY,606,00,Libyana,Libyana -LY,606,01,Madar,Al-Madar Al-Jadeed -LY,606,02,Al-Jeel Phone,Al-Jeel Al-Jadeed -LY,606,03,Libya Phone,Libya Telecom and Technology (LTT) -LY,606,06,Hatef Libya,Hatef Libya -LI,295,01,Swisscom,Swisscom Schweiz AG -LI,295,02,Orange,Orange Liechtenstein AG -LI,295,05,FL1,Mobilkom Liechtenstein AG -LI,295,77,Alpmobil,Alpcom AG -LI,295,04,Cubic Telecom,Cubic Telecom AG -LT,246,01,Omnitel, -LT,246,02,BITE,UAB Bité Lietuva -LT,246,03,Tele 2, -LT,246,05,LitRail,Lithuanian Railways -LT,246,06,Mediafon,UAB Mediafon -LU,270,01,LuxGSM,P&T Luxembourg -LU,270,77,Tango,Tango SA -LU,270,99,Orange,Orange S.A. -MO,455,00,SmarTone,SmarTone Macao -MO,455,01,CTM,C.T.M. Telemovel+ -MO,455,02,China Telecom,China Telecom -MO,455,03,3,Hutchison Telecom -MO,455,04,CTM,C.T.M. Telemovel+ -MO,455,05,3,Hutchison Telecom -MK,294,01,T-Mobile MK,T-Mobile Macedonia -MK,294,02,ONE,One -MK,294,03,Vip MK,VIP Operator -MG,646,01,Airtel,Bharti Airtel -MG,646,02,Orange,Orange Madagascar S.A. -MG,646,03,Sacel,Sacel Madagascar S.A. -MG,646,04,Telma,Telma Mobile S.A. -MW,650,01,TNM,Telecom Network Malawi -MW,650,10,Airtel,Bharti Airtel Limited -MY,502,01,ATUR 450,Telekom Malaysia Bhd -MY,502,10,,DiGi Telecommunications -MY,502,11,TM Homeline,Telekom Malaysia Bhd [78] -MY,502,12,Maxis,Maxis Mobile Services SDN Berhad -MY,502,13,Celcom,Celcom Axiata Berhad -MY,502,14,,Telekom Malaysia Berhad for PSTN SMS -MY,502,16,DiGi,DiGi Telecommunications -MY,502,17,Hotlink,Maxis Prepaid -MY,502,18,U Mobile,U Mobile Sdn Bhd -MY,502,18,TM Homeline,Telekom Malaysia Bhd -MY,502,19,Celcom,Celcom Axiata Berhad -MY,502,20,,Electcoms Wireless Sdn Bhd -MY,502,150,Tune Talk,Tune Talk Sdn Bhd -MY,502,151,,Baraka Telecom Sdn Bhd (MVNE) -MY,502,152,Yes,YTL Communications Sdn Bhd -MV,472,01,Dhiraagu,Dhivehi Raajjeyge Gulhun -MV,472,02,Wataniya,Wataniya Telecom Maldives -ML,610,01,Malitel,Malitel SA -ML,610,02,Orange,Orange Mali SA -MT,278,01,Vodafone,Vodafone Malta -MT,278,21,GO,Mobisle Communications Limited -MT,278,77,Melita,Melita Plc -MQ,340,01,Orange,Orange Caraïbe Mobiles -MQ,340,02,Outremer,Outremer Telecom -MQ,340,20,Digicel,DIGICEL Antilles Française Guyane -MR,609,01,Mattel,Mattel -MR,609,02,Chinguitel,Chinguitel -MR,609,10,Mauritel,Mauritel Mobiles -MU,617,01,Orange,Cellplus Mobile Communications Ltd. -MU,617,02,MTML,Mahanagar Telephone (Mauritius) Ltd. -MU,617,10,Emtel,Emtel Ltd -MX,334,010,Nextel,Nextel México -MX,334,020,Telcel,América Móvil / Mextel -MX,334,030,movistar,Pegaso Comunicaciones y Sistemas -MX,334,040,Iusacell / Unefon,Iusacell / Unefon -MX,334,050,Iusacell,Iusacell -FM,550,01,,FSM EMMANUEL -MD,259,01,Orange,Orange Moldova -MD,259,02,Moldcell, -MD,259,03,IDC,Interdnestrcom -MD,259,03,Unité,Moldtelecom -MD,259,04,Eventis,Eventis Telecom -MD,259,05,Unité,Moldtelecom -MD,259,99,Unité,Moldtelecom -MC,212,01,Office des Telephones,Monaco Telecom -MN,428,99,MobiCom,Mobicom Corporation -MN,428,88,Unitel,Unitel LLC -MN,428,91,Skytel,Skytel LLC -MN,428,98,G.Mobile,G-Mobile LLC -ME,297,01,Telenor,Telenor Montenegro -ME,297,02,T-Mobile,T-Mobile Montenegro LLC -ME,297,03,m:tel CG,MTEL CG -ME,297,04,T-Mobile,T-Mobile Montenegro -MA,604,00,Méditel,Medi Telecom -MA,604,01,IAM,Ittissalat Al Maghrib (Maroc Telecom) -MA,604,05,INWI,WANA - Groupe ONA -MZ,643,01,mCel,Mocambique Celular S.A. -MZ,643,04,Vodacom,"Vodacom Mozambique, S.A." -MM,414,01,MPT,Myanmar Post and Telecommunication -NA,649,01,MTC,MTC Namibia -NA,649,02,switch,Telecom Namibia -NA,649,03,Leo,Orascom Telecom Holding -NR,536,02,Digicel,Digicel (Nauru) Corporation -NP,429,01,Namaste / NT Mobile,Nepal Telecom -NP,429,02,Ncell,Ncell Pvt. Ltd. Spice Nepal -NP,429,04,SmartCell,Smart Telecom Pvt. Ltd. -NP,429,03,Sky/C-Phone,Nepal Telecom -NL,204,01,,VastMobiel B.V. -NL,204,02,Tele2,Tele2 Nederland B.V. -NL,204,03,,Voiceworks B.V. -NL,204,04,Vodafone,hollandsnieuwe -NL,204,05,,Elephant Talk Communications Premium Rate Services -NL,204,06,,Mundio Mobile (Netherlands) Ltd -NL,204,07,,Teleena (MVNE) -NL,204,08,KPN,KPN Mobile The Netherlands B.V. -NL,204,09,Lycamobile,Lycamobile Netherlands Limited -NL,204,10,KPN,KPN B.V. -NL,204,12,Telfort,KPN Mobile The Netherlands B.V. -NL,204,13,,Unica Installatietechniek B.V. -NL,204,14,6Gmobile,6GMOBILE B.V. -NL,204,15,,Ziggo B.V. -NL,204,16,T-Mobile,T-Mobile Netherlands B.V -NL,204,17,,Intercity Mobile Communications B.V. -NL,204,18,,UPC Nederland B.V. -NL,204,19,,Mixe Communication Solutions B.V. -NL,204,20,T-Mobile,T-Mobile Netherlands B.V -NL,204,21,,ProRail B.V. -NL,204,22,,Ministerie van Defensie -NL,204,23,,ASPIDER Solutions Nederland B.V. -NL,204,24,,Private Mobility Nederland B.V. -NL,204,25,,CapX B.V. -NL,204,26,,SpeakUp B.V. -NL,204,27,,Breezz Nederland B.V. -NL,204,67,,RadioAccess B.V. -NL,204,68,,Unify Group Holding B.V. -NL,204,69,,KPN Mobile The Netherlands B.V. -AN,362,51,Telcell,Telcell N.V. -AN,362,69,Digicel,Curaçao Telecom N.V. -AN,362,91,UTS,Setel N.V. -AN,362,95,MIO,E.O.C.G. Wireless -AN,362,94,Bayòs,Bòbò Frus N.V. -NC,546,01,Mobilis,OPT New Caledonia -NZ,530,00,Telecom,Telecom New Zealand -NZ,530,01,Vodafone,Vodafone New Zealand -NZ,530,02,Telecom,Telecom New Zealand -NZ,530,03,Woosh,Woosh Wireless New Zealand -NZ,530,04,TelstraClear,TelstraClear New Zealand -NZ,530,05,XT Mobile Network,Telecom New Zealand -NZ,530,24,2degrees,2degrees -NI,710,21,Claro,"Empresa Nicaragüense de Telecomunicaciones, S.A." -NI,710,30,movistar,Telefónica Móviles de Nicaragua S.A. -NI,710,73,SERCOM,Servicios de Comunicaciones S.A. -NE,614,01,SahelCom, -NE,614,02,Airtel,Bharti Airtel Limited -NE,614,03,Telecel,Telecel Niger SA -NE,614,04,Orange,Orange Niger -NG,621,20,Airtel,Bharti Airtel Limited -NG,621,30,MTN,MTN Nigeria Communications Limited -NG,621,40,M-Tel,Nigerian Mobile Telecommunications Limited -NG,621,50,Glo,Globacom Ltd -NG,621,60,Etisalat,Emerging Markets Telecommunication Services Ltd (Etisalat) -NG,621,25,Visafone,Visafone Communications Ltd. -NU,555,01,Telecom Niue,Telecom Niue -NF,505,10,Norfolk Telecom,Norfolk Telecom -NO,242,01,Telenor, -NO,242,02,NetCom,NetCom GSM -NO,242,03,Teletopia,Teletopia -NO,242,04,Tele2,Mobile Norway AS -NO,242,05,Network Norway,Mobile Norway AS -NO,242,06,Ice,Nordisk Mobiltelefon -NO,242,07,Ventelo,Ventelo AS -NO,242,08,TDC,TDC Mobil AS -NO,242,09,Com4,Com4 AS [106] -NO,242,11,SystemNet,SystemNet AS [107] -NO,242,20,,Jernbaneverket AS -NO,242,23,Lyca,Lyca Mobile Ltd -OM,422,02,Oman Mobile,Oman Telecommunications Company -OM,422,03,Nawras,Omani Qatari Telecommunications Company SAOC -PK,410,01,Mobilink,Mobilink-PMCL -PK,410,03,Ufone,Pakistan Telecommunication Mobile Ltd -PK,410,04,Zong,China Mobile -PK,410,06,Telenor,Telenor Pakistan -PK,410,07,Warid,WaridTel -PW,552,01,PNCC,Palau National Communications Corp. -PW,552,80,Palau Mobile,Palau Mobile Corporation -PS,425,05,Jawwal,"Palestine Cellular Communications, Ltd." -PS,425,06,Wataniya,Wataniya Palestine Mobile Telecommunications Company -PA,714,01,Cable & Wireless,Cable & Wireless Panama S.A. -PA,714,02,movistar,"Telefonica Moviles Panama S.A, Bell South Corp. (BSC)" -PA,714,04,Digicel,Digicel Group -PA,714,03,Claro,América Móvil -PG,537,01,B-Mobile,Pacific Mobile Communications -PG,537,03,Digicel,Digicel PNG -PY,744,01,VOX,Hola Paraguay S.A -PY,744,02,Claro,AMX Paraguay S.A. -PY,744,04,Tigo,Telefonica Celular Del Paraguay S.A. (Telecel) -PY,744,05,Personal,Núcleo S.A -PY,744,06,Copaco,Copaco S.A. -PE,716,06,Movistar,Telefónica Móviles Perú -PE,716,07,NEXTEL,NII Holdings -PE,716,10,Claro,América Móvil Perú -PH,515,01,Islacom,Globe Telecom via Innove Communications -PH,515,02,Globe,Globe Telecom -PH,515,03,Smart,PLDT via Smart Communications -PH,515,05,Sun,Digital Telecommunications Philippines -PH,515,11,,PLDT via ACeS Philippines -PH,515,18,Cure,PLDT via Smart's Connectivity Unlimited Resources Enterprise -PH,515,88,,Nextel -PL,260,01,Plus,Polkomtel S.A. -PL,260,02,T-Mobile,Polska Telefonia Cyfrowa Sp. z o.o. -PL,260,03,Orange,Polska Telefonia Komórkowa Centertel Sp. z o.o. -PL,260,04,,not in use -PL,260,05,,Polska Telefonia Komórkowa Centertel Sp. z o.o. -PL,260,06,Play,P4 Sp. z o.o. -PL,260,07,Netia,Netia S.A. -PL,260,08,,E-Telko Sp. z o.o. -PL,260,09,,Telekomunikacja Kolejowa Sp. z o.o. -PL,260,10,Sferia,Sferia S.A. -PL,260,11,Nordisk Polska,Nordisk Polska Sp. z o.o. -PL,260,12,Cyfrowy Polsat,Cyfrowy Polsat S.A. -PL,260,15,CenterNet,CenterNet S.A. -PL,260,16,Mobyland,Mobyland Sp. z o.o. -PL,260,17,Aero2,Aero 2 Sp. z o.o. -PT,268,01,Vodafone,Vodafone Portugal -PT,268,03,Optimus,"Sonaecom – Serviços de Comunicações, S.A." -PT,268,06,TMN,Telecomunicações Móveis Nacionais -PT,268,21,Zapp,Zapp Portugal -PR,330,110,Claro,Puerto Rico Telephone Company -PR,330,00,Open Mobile,PR Wireless -QA,427,01,Qtel,Qtel -QA,427,02,Vodafone,Vodafone Qatar -QA,427,05,Ministry of Interior,Ministry of Interior -RE,647,00,Orange,Orange La Réunion -RE,647,02,Outremer,Outremer Telecom -RE,647,10,SFR Reunion,Societe Reunionnaise de Radiotelephone -RO,226,01,Vodafone,Vodafone România -RO,226,02,Romtelecom,Romtelecom -RO,226,03,Cosmote,Cosmote România -RO,226,04,Cosmote,Cosmote România -RO,226,05,Digi.Mobil,RCS&RDS -RO,226,06,Cosmote,Cosmote România -RO,226,10,Orange,Orange România -RO,226,11,Enigma-System,Enigma-System -RU,250,01,MTS,Mobile TeleSystems -RU,250,02,MegaFon,MegaFon OJSC - previously known as North-West GSM -RU,250,03,NCC,Nizhegorodskaya Cellular Communications -RU,250,04,Sibchallenge,Sibchallenge -RU,250,05,ETK,Yeniseytelecom -RU,250,06,Skylink [10],CJSC Saratov System of Cellular Communications -RU,250,07,SMARTS,Zao SMARTS -RU,250,09,Skylink,Khabarovsky Cellular Phone -RU,250,10,DTC,Dontelekom -RU,250,11,,Orensot -RU,250,12,Baykalwestcom,Baykal Westcom / New Telephone Company / Far Eastern Cellular -RU,250,12,Akos, -RU,250,13,KUGSM,Kuban GSM -RU,250,15,SMARTS,"SMARTS Ufa, SMARTS Uljanovsk" -RU,250,16,NTC,New Telephone Company -RU,250,17,Utel,JSC Uralsvyazinform -RU,250,19,INDIGO,INDIGO -RU,250,20,Tele2,Tele2 -RU,250,23,Mobicom - Novosibirsk,Mobicom - Novosibirsk -RU,250,28,Beeline,Beeline -RU,250,35,MOTIV,MOTIV -RU,250,38,Tambov GSM,Central Telecommunication Company -RU,250,39,Utel,Uralsvyazinform -RU,250,44,,Stavtelesot / North Caucasian GSM -RU,250,92,,Primtelefon -RU,250,93,,Telecom XXI -RU,250,99,Beeline,OJSC Vimpel-Communications -RW,635,10,MTN,MTN Rwandacell SARL -RW,635,12,Rwandatel,Rwandatel S.A. -RW,635,13,Tigo,TIGO RWANDA S.A -SKN,356,050,Digicel, -SKN,356,110,,LIME -SKN,356,070,Chippie,UTS -LC,358,050,Digicel[citation needed], -LC,358,110,,Cable & Wireless -PM,308,01,Ameris,St. Pierre-et-Miquelon Télécom -VC,360,070,Digicel, -VC,360,100,Cingular Wireless, -VC,360,110,Cable & Wireless,Cable & Wireless -WS,549,01,Digicel,Digicel Pacific Ltd. -WS,549,27,SamoaTel,SamoaTel Ltd -SM,292,01,PRIMA,San Marino Telecom -ST,626,01,CSTmovel,Companhia Santomese de Telecomunicaçôe -SA,420,01,Al Jawal,Saudi Telecom Company -SA,420,03,Mobily,Etihad Etisalat Company -SA,420,04,Zain SA,Zain Saudi Arabia -SN,608,01,Orange,Sonatel -SN,608,02,Tigo,Millicom International Cellular S.A. -SN,608,03,Expresso,Sudatel -RS,220,01,Telenor,Telenor Serbia -RS,220,02,Telenor,Telenor Montenegro -RS,220,03,mt:s,Telekom Srbija -RS,220,05,VIP,VIP Mobile -SC,633,01,Cable & Wireless,Cable & Wireless Seychelles -SC,633,02,Mediatech International,Mediatech International -SC,633,10,Airtel,Telecom Seychelles Ltd -SL,619,01,Airtel,Bharti Airtel Limited -SL,619,02,Tigo,Millicom (SL) Limited -SL,619,03,Africell,Lintel Sierra Leone Limited -SL,619,04,Comium,Comium Sierra leone INC -SL,619,05,Africell,Lintel Sierra Leone Limited -SL,619,25,Mobitel,Mobitel -SG,525,01,SingTel,Singapore Telecom -SG,525,02,SingTel-G18,Singapore Telecom -SG,525,03,M1,MobileOne Asia -SG,525,05,StarHub,StarHub Mobile -SG,525,12,,Digital Trunked Radio Network -SK,231,01,Orange,Orange Slovensko -SK,231,02,T-Mobile,T-Mobile Slovensko -SK,231,03,,Unient Communications -SK,231,04,T-Mobile,T-Mobile Slovensko -SK,231,06,O2,Telefónica O2 Slovakia -SK,231,99,ŽSR,Železnice Slovenskej Republiky -SI,293,40,Si.mobil,SI.MOBIL d.d. -SI,293,41,Mobitel,Mobitel D.D. -SI,293,64,T-2,T-2 d.o.o. -SI,293,70,TuÅ¡mobil,TuÅ¡mobil d.o.o. -SB,540,01,BREEZE,Solomon Telekom Co Ltd -SO,637,60,Nationlink Telecom,Nationlink Telecom -SO,637,01,Telesom,Telesom -SO,637,04,Somafone,Somafone FZLLC -SO,637,10,Nationlink,NationLink Telecom -SO,637,25,Hormuud,Hormuud Telecom Somalia Inc -SO,637,30,Golis,Golis Telecom Somalia -SO,637,82,Telcom,Telcom Somalia -ZA,655,01,Vodacom,Vodacom -ZA,655,02,Telkom Mobile / 8.ta,Telkom -ZA,655,06,Sentech, -ZA,655,07,Cell C,Cell C -ZA,655,10,MTN,MTN Group -ZA,655,11,,South African Police Service Gauteng -ZA,655,13,Neotel, -ZA,655,21,,Cape Town Metropolitan Council -ZA,655,30,,Bokamoso Consortium -ZA,655,31,,Karabo Telecoms (Pty) Ltd. -ZA,655,32,,Ilizwi Telecommunications -ZA,655,33,,Thinta Thinta Telecommunications -__,250,30,Megafon,Ostelecom -ES,214,01,Vodafone,Vodafone Spain -ES,214,03,Orange,France Telecom España SA -ES,214,04,Yoigo,Xfera Moviles SA -ES,214,05,TME,Telefónica Móviles España -ES,214,06,Vodafone,Vodafone Spain -ES,214,07,movistar,Telefónica Móviles España -ES,214,08,Euskaltel, -ES,214,09,Orange,France Telecom España SA -ES,214,15,BT,BT Group España Compañia de Servicios Globales de Telecomunicaciones S.A.U. -ES,214,16,TeleCable,Telecable de Asturias S.A.U. -ES,214,17,Móbil R,R Cable y Telecomunicaciones Galicia S.A. -ES,214,18,ONO,Cableuropa S.A.U. -ES,214,19,Simyo,E-PLUS Moviles Virtuales España S.L.U. -ES,214,20,Fonyou,Fonyou Telecom S.L. -ES,214,21,Jazztel,Jazz Telecom S.A.U. -ES,214,22,DigiMobil,Best Spain Telecom -ES,214,23,Barablu,Barablu Móvil España -ES,214,24,Eroski,Eroski Móvil España -ES,214,25,LycaMobile,LycaMobile S.L. -LK,413,01,Mobitel,Sri Lanka Telecom Mobitel -LK,413,02,Dialog,Dialog Axiata -LK,413,03,Etisalat,Emirates Telecommunication Corporation -LK,413,05,Airtel,Bharti Airtel -LK,413,08,Hutch,Hutchison Telecommunications Lanka -SD,634,01,Zain SD,Zain Group - Sudan -SD,634,02,MTN,MTN Sudan -SD,634,05,Vivacell,Wawat Securities -SD,634,07,Sudani One,Sudatel Group -SR,746,02,Telesur,Telecommunications Company Suriname (Telesur) -SR,746,03,Digicel,Digicel Group Limited -SR,746,04,Uniqa,Intelsur N.V. / UTS N.V. -SZ,653,10,,Swazi MTN -SE,240,01,Telia,SwedenTeliaSonera -SE,240,02,3,Hutchison 3G -SE,240,03,Ice.net,Nordisk Mobiltelefon -SE,240,04,,3G Infrastructure Services -SE,240,05,Sweden 3G,Svenska UMTS-Nät -SE,240,06,Telenor,Telenor Sweden -SE,240,07,Tele2,Tele2 Sweden -SE,240,08,Telenor,Telenor Sweden -SE,240,09,djuice,Telenor Sweden -SE,240,10,Spring Mobil,Tele2 -SE,240,11,,Lindholmen Science Park -SE,240,12,,Barablu Mobile Scandinavia -SE,240,13,,Ventelo Sverige -SE,240,14,,TDC Mobil -SE,240,15,,Wireless Maingate Nordic -SE,240,16,,42IT -SE,240,17,Gotanet,Götalandsnätet -SE,240,20,,Wireless Maingate Message Services -SE,240,21,MobiSir,Trafikverket (formerly Banverket) -SE,240,24,Sweden 2G,Net4Mobility -SE,240,25,,DigiTelMobile -SE,240,26,,Beepsend -SE,240,33,,Mobile Arts AB -CH,228,01,Swisscom,Swisscom Ltd -CH,228,02,Sunrise,Sunrise Communications AG -CH,228,03,Orange,Orange Communications SA -CH,228,05,,Togewanet AG (Comfone) -CH,228,06,SBB-CFF-FFS,SBB AG -CH,228,07,IN&Phone,IN&Phone SA -CH,228,08,Tele2,Tele2 Telecommunications AG -CH,228,50,,3G Mobile AG -CH,228,51,,BebbiCell AG -SY,417,01,Syriatel,Syriatel Mobile Telecom -SY,417,02,MTN,MTN Syria -TW,466,01,FarEasTone,Far EasTone Telecommunications Co Ltd -TW,466,05,APTG,Asia Pacific Telecom -TW,466,06,Tuntex,Tuntex Telecom -TW,466,11,Chunghwa LDM,LDTA/Chungwa Telecom -TW,466,88,KG Telecom,KG Telecom -TW,466,89,VIBO,VIBO Telecom -TW,466,92,Chungwa,Chunghwa -TW,466,93,MobiTai,Mobitai Communications -TW,466,97,Taiwan Mobile,Taiwan Mobile Co. Ltd -TW,466,99,TransAsia,TransAsia Telecoms -TJ,436,01,Tcell,JV Somoncom -TJ,436,02,Tcell,Indigo Tajikistan -TJ,436,03,MLT,TT Mobile -TJ,436,04,Babilon-M,Babilon-Mobile -TJ,436,05,Beeline,Vimpelcom -TJ,436,12,Tcell,Indigo -TZ,640,02,tiGO,MIC Tanzania Limited -TZ,640,03,Zantel,Zanzibar Telecom Ltd -TZ,640,04,Vodacom,Vodacom Tanzania Limited -TZ,640,05,Airtel,Bharti Airtel -TZ,640,06,Sasatel,Dovetel Limited -TZ,640,07,TTCL Mobile,Tanzania Telecommunication Company LTD (TTCL) -TZ,640,08,Benson Online (BOL),Benson Informatics Limited -TZ,640,09,Hits,ExcellentCom Tanzania Limited -TZ,640,11,SmileCom,Smile Telecoms Holdings Ltd. -TH,520,00,my CAT 3G+,CAT Telecom -TH,520,01,AIS,Advanced Info Service -TH,520,02,CAT CDMA,CAT Telecom -TH,520,10,,WCS IQ -TH,520,15,TOT 3G,Telephone Organization of Thailand (TOT) -TH,520,18,dtac,Total Access Communication -TH,520,23,AIS GSM 1800,Digital Phone (AIS) -TH,520,99,True Move,True Corporation -TG,615,01,Togo Cell,Togo Telecom -TG,615,03,Moov,Moov Togo -TO,539,01,,Tonga Communications Corporation -TO,539,43,,Shoreline Communication -TO,539,88,Digicel, -TT,374,12,bmobile,TSTT -TT,374,130,Digicel,Digicel (Trinidad & Tobago) Limited -TN,605,01,Orange,Orange Tunisie -TN,605,02,Tunicell,Tunisie Telecom -TN,605,03,Tunisiana,Orascom Telecom Tunisie -TR,286,01,Turkcell,Turkcell Iletisim Hizmetleri A.S. -TR,286,02,Vodafone,Vodafone Turkey -TR,286,03,Avea, -TR,286,04,,Aycell -TM,438,01,MTS,Barash Communication Technologies -TM,438,02,TM-Cell,Altyn Asyr -TC,376,350,C&W,Cable & Wireless West Indies Ltd (Turks & Caicos) -TC,376,352,Islandcom,Islandcom Telecommunications -TC,338,05,Digicel,Digicel (Turks & Caicos) Limited -TV,553,01,TTC,Tuvalu Telecom -UG,641,01,Airtel,Bharti Airtel -UG,641,10,MTN,MTN Uganda -UG,641,11,UTL,Uganda Telecom Ltd. -UG,641,14,Orange,Orange Uganda -UG,641,22,Warid Telecom,Warid Telecom -UA,255,01,MTS,Ukrainian Mobile Communications -UA,255,02,Beeline,Ukrainian Radio Systems -UA,255,03,Kyivstar,Kyivstar GSM JSC -UA,255,04,IT,Intertelecom -UA,255,05,Golden Telecom,Golden Telecom -UA,255,06,life:),Astelit -UA,255,07,Ukrtelecom,Ukrtelecom -UA,255,21,PEOPLEnet,Telesystems of Ukraine -UA,255,23,CDMA Ukraine,ITC -AE,424,02,Etisalat,E mirates Telecom Corp -AE,424,03,du,Emirates Integrated Telecommunications Company -UK,234,00,BT,BT Group -UK,234,01,Vectone Mobile,Mundio Mobile Limited -UK,234,02,O2,Telefónica O2 UK Limited -UK,234,03,Airtel-Vodafone,Jersey Airtel Limited -UK,234,04,FMS Solutions Ltd,FMS Solutions Ltd -UK,234,05,,COLT Mobile Telecommunications Limited -UK,234,06,,Internet Computer Bureau Limited -UK,234,07,,Cable & Wireless UK -UK,234,08,,OnePhone (UK) Ltd -UK,234,09,,Tismi BV -UK,234,10,O2,Telefónica O2 UK Limited -UK,234,11,O2,Telefónica Europe -UK,234,12,Railtrack,Network Rail Infrastructure Ltd -UK,234,13,Railtrack,Network Rail Infrastructure Ltd -UK,234,14,Hay Systems Ltd,Hay Systems Ltd -UK,234,15,Vodafone,Vodafone United Kingdom -UK,234,16,Talk Talk,TalkTalk Communications Limited -UK,234,17,,FleXtel Limited -UK,234,18,Cloud9,Cloud9 -UK,234,19,Private Mobile Networks PMN,Teleware plc -UK,234,20,Three,Hutchison 3G UK Ltd -UK,234,22,RoutoMessaging,Routo Telecommunications Limited -UK,234,24,Greenfone,Stour Marine -UK,234,25,Truphone,Software Cellular Network Ltd -UK,234,30,T-Mobile,Everything Everywhere Limited (TM) -UK,234,31,Virgin,Virgin Mobile -UK,234,32,Virgin,Virgin Mobile -UK,234,33,Orange,Everything Everywhere Limited (TM) -UK,234,34,Orange,Everything Everywhere Limited (TM) -UK,234,35,,JSC Ingenium (UK) Limited -UK,234,36,,Cable and Wireless Isle of Man Limited -UK,234,37,,Synectiv Ltd -UK,234,50,JT-Wave,Jersey Telecom -UK,234,55,,Cable & Wireless Guernsey / Sure Mobile (Jersey) -UK,234,58,,Manx Telecom -UK,234,76,BT,BT Group -UK,234,78,Airwave,Airwave (communications network)[citation needed] -UK,235,00,,Mundio Mobile Limited -UK,235,01,,Everything Everywhere Limited (TM) -UK,235,02,,Everything Everywhere Limited (TM) -UK,235,77,BT,BT Group -UK,235,91,,Vodafone United Kingdom -UK,235,92,,Cable & Wireless UK -UK,235,94,,Hutchison 3G UK Ltd -UK,235,95,,Network Rail Infrastructure Limited -US,310,053,,Virgin Mobile US -US,310,054,,Alltel US -US,310,066,,U.S. Cellular -US,310,004,Verizon,Verizon Wireless -US,310,005,Verizon,Verizon Wireless -US,310,010,,MCI -US,310,012,Verizon,Verizon Wireless -US,310,013,MobileTel, -US,310,014,,Testing -US,310,016,,Cricket Communications -US,310,017,,North Sight Communications Inc. -US,310,020,,Union Telephone Company -US,310,026,T-Mobile, -US,310,030,Centennial,Centennial Communications -US,310,034,Airpeak, -US,310,040,Concho,"Concho Cellular Telephone Co., Inc." -US,310,046,SIMMETRY,TMP Corp -US,310,060,,Consolidated Telcom -US,310,070,,Highland Cellular -US,310,080,Corr,Corr Wireless Communications LLC -US,310,090,AT&T,AT&T Mobility -US,310,100,Plateau Wireless,New Mexico RSA 4 East Ltd. Partnership -US,310,110,PTI Pacifica,PTI Pacifica Inc. -US,310,120,Sprint, -US,310,150,AT&T,AT&T Mobility -US,310,160,,T-Mobile -US,310,170,,T-Mobile -US,310,180,West Central,West Central Wireless -US,310,190,Dutch Harbor,"Alaska Wireless Communications, LLC" -US,310,200,,T-Mobile -US,310,210,,T-Mobile -US,310,220,,T-Mobile -US,310,230,,T-Mobile -US,310,240,,T-Mobile -US,310,250,,T-Mobile -US,310,260,,T-Mobile -US,310,270,,T-Mobile -US,310,280,,T-Mobile -US,310,290,,T-Mobile -US,310,300,iSmart Mobile,Smart Call (Truphone) -US,310,310,,T-Mobile -US,310,311,,Farmers Wireless -US,310,320,Cellular One,"Smith Bagley, Inc." -US,310,330,T-Mobile, -US,310,340,Westlink,Westlink Communications -US,310,350,,Carolina Phone -US,310,380,AT&T,AT&T Mobility -US,310,390,Cellular One of East Texas,"TX-11 Acquisition, LLC" -US,310,400,i CAN_GSM,Wave Runner LLC (Guam) -US,310,410,AT&T,AT&T Mobility -US,310,420,Cincinnati Bell,Cincinnati Bell Wireless -US,310,430,,Alaska Digitel -US,310,440,Cellular One, -US,310,450,Viaero,Viaero Wireless -US,310,460,Simmetry,TMP Corporation -US,310,470,nTelos, -US,310,480,,Choice Phone -US,310,490,T-Mobile, -US,310,500,Alltel, -US,310,510,Airtel,Airtel Wireless -US,310,520,VeriSign, -US,310,530,,West Virginia Wireless -US,310,540,Oklahoma Western,Oklahoma Western Telephone Company -US,310,560,AT&T,AT&T Mobility -US,310,570,Cellular One,"MTPCS, LLC" -US,310,580,T-Mobile, -US,310,590,Alltel,Alltel Communications Inc -US,310,610,Epic Touch,Elkhart Telephone Co. -US,310,620,Coleman County Telecom,Coleman County Telecommunications -US,310,630,AmeriLink PCS,Choice Wireless -US,310,640,Airadigm,Airadigm Communications -US,310,650,Jasper,"Jasper Wireless, inc" -US,310,660,T-Mobile, -US,310,670,Northstar, -US,310,680,AT&T,AT&T Mobility -US,310,690,Conestoga,Conestoga Wireless Company -US,310,730,SeaMobile, -US,310,740,Convey,Convey Communications Inc. -US,310,760,Panhandle,Panhandle Telecommunications Systems Inc. -US,310,770,i wireless,Iowa Wireless Services -US,310,780,,Airlink PCS -US,310,790,PinPoint,PinPoint Communications -US,310,800,,T-Mobile -US,310,830,Caprock,Caprock Cellular -US,310,840,telna Mobile,"Telecom North America Mobile, Inc." -US,310,850,Aeris,"Aeris Communications, Inc." -US,310,870,PACE,Kaplan Telephone Company -US,310,880,Advantage,Advantage Cellular Systems -US,310,890,Unicel,Rural Cellular Corporation -US,310,900,Mid-Rivers Wireless,Mid-Rivers Communications -US,310,910,First Cellular,First Cellular of Southern Illinois -US,310,940,,Iris Wireless LLC -US,310,950,XIT Wireless,Texas RSA 1 dba XIT Cellular -US,310,960,Plateau Wireless, -US,310,970,Globalstar, -US,310,980,,AT&T Mobility -US,310,990,,AT&T Mobility -US,311,000,,Mid-Tex Cellular -US,311,010,Chariton Valley,Chariton Valley Communications -US,311,020,,Missouri RSA 5 Partnership -US,311,030,,Indigo Wireless -US,311,040,,Commnet Wireless -US,311,050,,Wikes Cellular -US,311,060,Farmers Cellular,Farmers Cellular Telephone -US,311,070,Easterbrooke,Easterbrooke Cellular Corporation -US,311,080,Pine Cellular,Pine Telephone Company -US,311,090,Long Lines Wireless,Long Lines Wireless LLC -US,311,100,,High Plains Wireless -US,311,110,,High Plains Wireless -US,311,120,,Choice Phone -US,311,130,,Cell One Amarillo -US,311,140,Sprocket,MBO Wireless -US,311,150,,Wilkes Cellular -US,311,160,,Endless Mountains Wireless -US,311,170,PetroCom,Broadpoint Inc -US,311,180,,Cingular Wireless -US,311,190,,Cellular Properties -US,311,210,,Emery Telcom Wireless -US,311,220,,U.S. Cellular -US,311,230,,C Spire Wireless -US,311,330,Bug Tussel Wireless,Bug Tussel Wireless -US,311,480,Verizon,Verizon Wireless -US,311,660,metroPCS,metroPCS -US,316,010,Nextel,Nextel Communications -US,316,011,,Southern Communications Services -UY,748,01,Antel,Compania estatal (ANTEL) -UY,748,07,Movistar,Telefónica Móviles Uruguay -UY,748,10,Claro UY,AM Wireless Uruguay S.A. -UZ,434,01,,Buztel -UZ,434,02,,Uzmacom -UZ,434,04,Beeline,Unitel LLC -UZ,434,05,Ucell,Coscom -UZ,434,06,,Perfectum Mobile -UZ,434,07,MTS,Uzdunrobita -VU,541,01,SMILE,Telecom Vanuatu Ltd -VE,734,01,Digitel,Corporacion Digitel C.A. -VE,734,02,Digitel,Corporacion Digitel C.A. -VE,734,03,Digitel,Corporacion Digitel C.A. -VE,734,04,movistar,Telefónica Móviles Venezuela -VE,734,06,Movilnet,Telecomunicaciones Movilnet -VN,452,01,MobiFone,Vietnam Mobile Telecom Services Company (VMS) -VN,452,02,Vinaphone,Vietnam Telecom Services Company -VN,452,03,S-Fone,S-Telecom -VN,452,04,Viettel Mobile,Viettel Telecom -VN,452,05,Vietnamobile,Hanoi Telecom -VN,452,06,EVNTelecom,EVNTelecom - EVN -VN,452,08,3G EVNTelecom,EVNTelecom - EVN -VN,452,07,Beeline VN,GTEL Mobile JSC -YE,421,01,SabaFon, -YE,421,02,MTN,SpaceTel -YE,421,03,Yemen Mobile,Yemen Mobile -YE,421,04,HiTS-UNITEL,Y -ZM,645,01,Airtel,Bharti Airtel -ZM,645,02,MTN,MTN Group -ZM,645,03,ZAMTEL,Zambia Telecommunications Company Ltd -ZW,648,01,Net*One,Net*One Cellular (Pvt) Ltd -ZW,648,03,Telecel,Telecel Zimbabwe (PVT) Ltd -ZW,648,04,Econet,Econet Wireless (Private) Limited -__,901,01,ICO,ICO Satellite Management -__,901,02,,Sense Communications International -__,901,03,Iridium, -__,901,04,Globalstar, -__,901,05,,Thuraya RMSS Network -__,901,06,,Thuraya Satellite Telecommunications Company -__,901,07,Ellipso, -__,901,08,, -__,901,09,,Tele1 Europe -__,901,10,ACeS, -__,901,11,Inmarsat, -__,901,12,Telenor,Maritime Communications Partner AS -__,901,13,GSM.AQ,Global Networks Switzerland Inc. -__,901,14,,AeroMobile AS -__,901,15,,OnAir Switzerland Sarl -__,901,16,,Jasper Systems -__,901,17,Navitas, -__,901,18,Cellular @Sea,AT&T Mobility -__,901,19,,Vodafone Malta Maritime -__,901,21,Seanet,Seanet Maritime Communications -__,901,23,,Beeline -__,901,24,iNum,Voxbone -__,901,26,TIM,Telecom Italia -__,901,29,Telenor, -__,901,32,Sky High,MegaFon diff --git a/res/wiki_mcc_mnc_oper_list.db b/res/wiki_mcc_mnc_oper_list.db deleted file mode 100644 index fefb8b6b285aca3afac5239df744863fae3ad550..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 43008 zcmeFad3+;TdGD<%!LUwSrIIYG)oRP*aWB*3?yAy0!!XFQ+pV@`dn~y(U}n^|x?5vg z>XGE`b~7xJY^{)lgh_HqLJ|ms2_X;&xw!-g$*_dnkcB`NAS59R1QG~YxLMvexxe!~ zRkC`z?Tg58=v3ey}J`y~7zbI?v#6OCwdnw}R{I5{>XyEAc@iY$Gz2ceN zXa6_*ckSP?f7AY#_CK-zk^T4VpS6G5{;T$1wtvX}KKnEFci4Z-{zLXR+k5t1`|Iu7 z_KJPee%YS0ztX;9U$m#}N&7?gs9m=ovrpJZxyt`*9`%1+=>HGzz|r1WT-A}DhTp?I zCw>ogi};=Bp2qLJT`@S0cVCR(dpZ~KJJxvszk!Y$zoYG|_&wM@gmZ1!*4zi9u2{R8&5+23Tpj&}VB+Oo$k%iof}D1S7VQ9T{cBl{D~FmU$o$v z(pv6PshC%ekm@1TSiD-@s;Gxa@{y!x^Ba|FIj0^n#k117W=t0@7gqBd%7j^1hMQ zNK1+lFK{SuwouM*V7{;k{#;X?B3bbz7Uk<&D7|i=3OtM6hEaH)=Rzbg-|6$P0Y`0dLo^4y}-8&WwSHVSS*&9=L=#VLiPkkFL6j8tV~8B9tn_~AC#5$^*U|dtrMNUEy#($5&(Quq zWP69LXWK%h=)^L7YE#qF?`z>?p}LJmy5U+LP(x_X`D|`uefSYl$0%=b3hi_wCtecA z66tQzjb%LYkwsD_NYQ7@xy^jOc=ZZ8566O;_muQATIfvbOhQeQ;+qnRaWhva2BuD_ z^8=zjl|z$QExG1|sQRWd(nc_@P33T6$Mh#R({e5&mv<88Z2#FJ- z%3v&6&fVM&oGx7{92e`o**m-=L`B_H zRL?A~%m;#`goUC<&JeP4=sY%1F1&aX zz3Rr;eWXRHuF!P;YOY+}%onSH(xt$3{!$)ygxi17X8(Qrv-bDeTcG-j_Ov~2AG5zi z{;vF|@^8t%B)?PsUir1u2b_|R$!_U?Nq;PT8twnBQcK#B9+l>#kQ9(!YWqjqpQ8PL z%=TW}57~BY0+pWg=YB1n(CE~%{CO>!L0c$o;yfKsk?bZJxA$7f^%_$Aq=ac43`{K# z-6T~dHIz-IhqecVpb%~h2nGb_brQT(#2o#GuaP!3byj|(7MjW?%_i;KGV==E;1=Ml z4rqEhSHT&(E2NE1C2U_rKXJ{3m54XQ7)QwU64N(k7qFNt-5k%Mo5vUI2mzyj>pXkXKcS^Xj6&IjO#Ho9~1#P z7a58kCDk_tRSRd)1)`O?UcHx9)0fJn8->lS%J8d%s*X;bm!z;D!VMfKaQck%m6Y2n zbS<<|xRih3sCvPyR%pTL6h`~S*`f0!s+7?HVmi+al+>?@p=a~nvqDoJoSKr(#0)L7 zRlJzbtzLOff8{zuxqKp5bdS$gNOcP}q7k1R$5M6TzE9Hokm$V>@s*SB4=0 zSB(RU_J7#+q|N><`HZuk@;s)h$hm;xtxI)L%j4LQxQfma@3ZE`PBkr)bMhLDPo=VB} zn6Wa6cRnz+Ro*JD6-H{r;mU+a(_*IzSuy(10Y+*><7QHH@Z_B}B67t`rGkq^(FM3_ z1mudJL?dyjEM`8C3Cc}b&s@!|=8=1(MqrNGPs(|8HsY9g8BXRZB}a{*Tyay9aRF@P ztTBjtNfM*%X6d4{W`g+CtaJd4dwy|hW!_U`5+5fqw1R7_tZtMlVELM$alkyK1jX!% zZX@%!hg3a1iMpM&yD6u4YC(4B`gA6nEN!}K4CHWu#m%1Et$*)rb@XgA)`_gY%Z&Ak*G(h z{WxpP=QL~t<2-2^sWF~Uh_NIXN@k~$0lZ0~OC6~(sB=>A)+FY2PBI3Q_SG2N6{=8Q zEI4Y+>@*M>;?9*0)+D+`y2ztPrpmdBKn{L$0szO6nvF70{d#z?e#h%6g=*7vQJdp+ z1BxaT(f$wFF4|!8`yE*N-evz@`&IiHd%`|xAF)4A{yX^#@<-%%VEliL{Fppvw*Rk7 zzbAcMdPeF>Ynb_uNwV#mwolsLXM3BiYpbHNTmFV>Owelbq+HVUWOhldF+2O_&Px~e zy0IGJv+5SA9-`;4ug3JOB+tlCYDV^$S~J0!1U-2MQ^lG2@fwk{8c!yqBxym~J+f^f!R(&E@G^UyIff^yTdW>W-%Yu2e(x13`YJ}J77$xf(hPI2$ zt%qs}aW~b6DMd^%uZu%+zk``h;7DQvkXSuBULykM(~Dw2%^u3$p6fu3xZFGsO;1nV zQk$zre9mVd>7Tu$Mu@Je;v^ywOd2!J8u7X6At@ZC+o044(p5K$k?d4%+fgG%H_L{@ zRF)XsDl58+t;)SM;&JssE^FYuzx6sP*HNWLgl--pL{Gt6BS2RtsHmY~THn93N{tZR z%&${^rAF+1i#A*%`c_9p9bp}>?OMK6EtiVJHG*z4LEB3hsS$gtd?SJp(GzY}lp2A!nGrX;Fqe1Mh{Mf{VeMpU zIg|C&h{pM)2^z#58--Q86bEX=|#hXmaS1pJgsZEeLL81=w3M4USE|*G0ZvT(6{qI-pKa2T) z#r~Lm&K|M{Fa!8|`H$t#$iFE6i2MdQFQ?>5*$MjplJp+wY3cRSWho;)EFG5aw*9m1 zk8B^cy&dhpYyDCU%#}7S76N!L+%*PX*7d$VQe)(u zNTU0J(ZcNdlBLqRx5n6eI5{hCY0*B{h++Fcjp27vr0E)=B+M-0%@xVc8WAw=lPIe5 zWAM}%e8=a~^7m-^sg>naU^0+dSjxI<1iz|3xhQ{GH-ej{bxo-e_u`EZx~>z;*Dld> zVU79TT_g52%WH;JUab)Vt6nOP-m$ca(OIn#2D7SRKCqUn<~Js5gu!ZB!KNh>gXl{URK=4Pr9<{Yk(Z>YD%_{?d+Thc~q1knmtY211==4ejR2ah&VW1QwB z^ZfZ79W{n(cXD3-VmyAfAh3|J+9M=g!z@?u1z|NFGBnK`#)oS}(aIQ!u`}7_K>FDa zUMnCsfwY-B#Dl(4W0a<9%{SOp%g~MWQw{xRsnnK9=BzrMfl_;fwd}N9)Iu3p`8IvE zCDM+OhFR^c>3zX!gB=emeuBAyFqu~_>Dq)@! zW;17Po^w+|kf*czYI7tiBpTVIX#eB3b2j^5+dpUj7~202+N-bt%-J8XkK2djKSSGp zt$aydk{^hzYdGv_u5{AYWjbHIvWzggUx8N&d|9?nRFbcvM%PP`L)V=?qUUqD2%u3ba%wThw6-@D&^O*)5*y?!zk6D z#sAY9M(fO}K~aMiHO+PAqarib-E~IRA<7X6y6Qxyil6=+PF&3d=B8FM!*!xlWsKxt zIyHMew=K?5trM9lK1vXFuzayp9;!2&(wU<_oKB9^O)yPP%hzJ@Od^%F`h=l6gQ-eM z5rFT3I`inHP;T!R-F0TtQIV{LGh0|L7PAXyozc`wdI;Q$*`uS*aOx(JCJ<_!anwhW zF6`fUsa-WjQGfD+?XTi-%PJnJF^}d*j%BWvpZ&>exxgnshAX{UEPUck#b@6eSSwvE z=dOwWTFqCgSnRGGFCD49mR{o-QBaF4W)>C$SR9zagbT|A$wW4_xF9l?kC%?so}#RC zlr@}PP5>Aw^W0)u6W#0sCJ!XHF;hdfe9kJFj~7tN>C{1$G5BI3q5Jw7`3)VIef_#=_+!pOeL@$GE}Q_ zO{bP^UlJU2RjE}-@dyQcjQfVuD3j(Vt$!M>+LJ8Pup6=lAkqGh*q*T2zhVCZ+W*_^ z9s8F3aaaI#`+oaf@^|Df$)AwlD|h9poRd#u_3xnkLaYG%neVz~_Pbz!XKX)UdmSpg?N6x_fhwMpDce6{I+9vGGvllifhu0oL@Nv|ZmV@-P{k)i zEw;i4q|^yQxwsZxD6Na$f{4@9!ZUEH$PLwrI2Dyj2d5VjYMnR}^_`Xv_E!pBbs|m0 zPb$5r!jj;s6Kq0Wlmc3R{l-@()Krd#Ak$K3FH}RCG!XCo-7B=B|~{TBr{xZ0xTSf+|NTLum1Q zAX~Z`NS2Dl{A$%%Clpn@lt|P1fT7fhMHLT;hIu~-MHQ7aeI}iC)(JsTbXk5g&bBN} z#cG|vQ}N9{B3EFlEL1Cj*+<-U;!b6hRGr5V=t`Z?Q}JZZ$iJrR#C5JZlc!&3TK@%e z)R{fqB$KgIt=~(pqK_nFjhAi%^>I?eq+*^3KNv=ffVDj8s^7!!@XV}yK?_>TX0H0! zfZTs(YCXV*q1kr8HtTNo{CaGNTP>C>w4H8}b)t^CkE(G`FG^)BKf&_htncT;krd2g9E3@!?&ZUgXz(&`ePke`d8_?( zj}X<#>9kbTvC#XRRaIAgn9_YB9jm*hQPx>^n{}O*Uxz0Q%WAp?LT%`o%xmJe*dS|nO((t=za`rg^hKwvQlSiWi@22 z_t%+M{ggMD&Rwn+k{HG6%&IIKmaNv9Q@IX(HeV70rc!4_^~|Q_$F$HRV#IXTnNhu@ z1yN;TYg4T=r20s-%z4f_Qz~cGXLDj+;HWd9x@Qw|RSP9I|ry zj}7Z}hEqS~W6L^T3P+v!)V*|49yc(g6br68AinE?DMT~WEJ%bUbob%RSLE>RCgcXQ~n+Kzsqlz>+(800H)*<@`!AgzJ>Px zE7H4R1E^#5|Fm=;TK~V>zK+)a5!;X3uA{oWKea&+ta@ixqzKGMyOrCdUX(5}kl3nT!3t}2dw+x2SUt@7j8yi}o&ia1n0!3DBxU=ZpW0wP_6b#s zP3Lgq3PrWSjLfPSFGVADH5iZml-F3?s+RMxi#Qw1$X=4IzPLeTtWM5OOOM~FFK!Sa zt3Htqrx>#@KGpv;%CNnlN_uTW*1#`=3CC$?}mr!47n=h z6gDSUouF3ri4H%G6~z2SK_31(Q|$?ojRh=e;!W6Fmv`2gajEZ*M!D}Ft~2D0i9*px zrhvy*tOOFXBX!2y36T)drpbt!hi`jf-BG{FEkq=Rg7fE-2}iv&AQ?t9iAh?KBpN=% zT0eXb@;UUtXb>u*smMZjgFdRH=t%iSL55ffZO4N9*g97Nj(GRU)|C+Nc&b z^J|5iul@w(I7T^)>C%RHQ!SX-S1(YiLaF+q;jLd8IGC2e;&~ZY3@58($yL8hX*}rl zCs_OHm-gz=VvEMUdVWBNE*hf!-)p-j`2Tld|Nm)t_g2yVAIAFs3t;{KJ^5GV_sBme z*UL+Lj(e>kmr@r5D)#5Pp9@go^$@{T*zW?0afX`jn1k z`RjqRrSgVp=n%H^2D5KiWYFT4#YosTto!3@FaaN_cs`Y)0Ao& zxY&vnIC2UWu)rLCj#~a_t_D-GpR&^eVphxs8jQ*;hl7D5$?0_BsI$Sa?4{fx$i^&0 zW@Q$G5QDQvJq-rsamr~VGxOFF4>lN=bxP5bsceeO>f+=BdPI--8WZ%W`1&+`QD4Mb z#$qvVh(S?pm<)YtLHW>1~pvg+7_Caqru$l7P4SgI2<&XnLQ*i z@j4p}%-&O3sfzWCL>BXDwZXjXBeCyi*)V~bRLq{>hUafEFrSz`FMm}tX2mLppdQ$w z0)p+-29vXo(k%x9XM>s9J9}2Xp_yhXXTzjs5{(2d_+n0NFg5#T7vxn~A5k^#)lh@E zStT`uerA7zpjkOeN`J+3b_<@Ic%nqiik}jV40_9r%UcCcgNb>ZWNV@$tf;;QWAm}u zDcd(R6R-kS|2xu9>4r~;)Ub9ocdb7u^fa85G)_sdq?9ejaWxcvO0!w{<67UA>}{}} z>oCbil1#y38H*m*5Eb!I8b2ZqbFB8c)mjohE6q=k({~#=SfF{iPKGrzEHZBb2XSZ{X#%NW==09Vp_WnZ#`Fod6TQ}-+EVrnUm!{ z4X6zUPd=)idG@`Vg<{dwc#xim|I~`@52KpZs9cQ)_GB1_Er-@doMfNK%?m*=haPOi zNTq(%h%Y6RXHD2KJL?0DC}o%w9j$(A2I`?BluSLe9vkSPjYgPK&Qn41%MfFNRXf_} zoI@5CkN><*f5V_cC+I{%>}W2G>3DO*aG^GIO7~H^ zkxVC(fm3ti4UN?&7D;(Vf4ToqmA#Q{+)f!qGXb|7W& zltud=M`N}Bsr^&1{{0wc|6=t|N9%tcwf;}bACP}cZp%-i^(W=~;r;vX($~NNKMmjC z%hD`t|1Yq8&Gu>APs8u;);2%b0r+=_B31FOJgo(z*+e!$T~H-oz6SR-{|@n_l^(f0 zo!HV!58s|nY-y#3Zciu5w9BjBp#GY2VetSAmsFkkWo=!|^rW^6w(+Nwh z^gG-i;!`XA4)=#B)k?qZ{e!Q2!jW z`e#q$b)@n!w5iO(d?39zm71UNH(pCACqxy|n5cp#W#kBsb#u}FCv2}2?f>KO{(S@1 z{w&M?|HRt=Ps(qUugkB-%HIjug>nBY*!S~p=}nmVuS#htO1pmk$@V9<&)7a_dj7t$ z-|W>LqEuBpy{BWk!4E~1doLL?b)IqN;d|Pe;RpFW1Np!KjrqI4>I6A>_1@2H&ue9l}j3sZZ&6`9^jK zDy^hGsZ$d1q?I%{^BCD7sI-y>M-s=*33}7`f;5^K?HupFmQP0pFUPqvNh$Phg!|3? z{sGbC0_P4}W;kca>I2v=!(zV=Fs(A;?uE_4+P_0q8M9*y-JxS81C5n_hmMuZG*&hk+$9m>zrXz$4oKVX^=3 z8}`p*{r}ze@3)uj%XY(l0QCP)@c;QN#{VCZpCTWi2jvmzpQO)8@00!;{C}RLwf|$% zi1a+$-`Kun`?&4rY;U#I;Q=Ui{_&qdJW4l}2RbPzIjTn+6oa;l{1sdR8;hbeP{6b*wa(JB*lgBwaWc!7ZqQt!g{WnRFyAo=GQ`vyL6cOgeEbmN=Kncy<^v$3=abSU^Sb zlN3lpV4cad#XG zg=y-wLk1)BtV7u2ARdf=hm1wsqGLgrL*S0QO0I2H;p^nznWF;|>c+tKx22yROuwzX zx|5=G9ySfbx`U?%Rozl&2i5-FJ~^Q3@Sx!rYGzP1Uo+AE@3URCA?n8;VFvK?SpRF= zpR}JxG!M=0x4%gK2l*@Vr-=l1U;%gx7J!5D^QCV}zYh-pu>#nD2f$hB71D8OShCx` zWBVf30H3kF1^s{sJ8;|I&@O?jq9#-Fng*Big`r(SS5pbil`c4U8CJcN$218$b{SRO zB+{C;ZtM$iiFc z8rMm0%tMJdMh!#jXW+AYf*z{G3O5Bs+aOaXE0mGp0gdM)gcnY z!TmeTsB{##HLSwXZ_iPC=P5c0*AT>hv3#k#Z|5~6DpZ5;z1z7-f}eywu{d|O&BBjJ zZ;u;`oA8~=sXI4F^raw%!eX$fib3EysUA|bxl%d5?%26TnpB^I>}>5x21)8p zb+0}xmdO>x&T;onh15||RtqOE@)3BucFLstQ_Ir(0{R-mwL=eMA5WrXA|Nnjv!0X`uKQ9O6{jvoApWnv% z-;dKez^h;bFeJb9Lfb#szJhtcFTew!i{1Z^bJKV35`Zh-(@WAX1tZg?WGP*8?h=2S zV%QQ1zfCb@iA3L~7_>x!Z&Sp&Dc4EtZHl@j5_+4WW{E`JEE;i3B=k1Lm?aW)n_|=w z3AatLe?)bGd3qg1{0XGIUzilK&;JI zp@#+&2(rzD;9vsLwV80sbrV*b2?N(Xyh}W7CTN3I5lC|aeEs{k(6LJdt+>UV(qePd z(<#R;L9;1Eh2+{LPFCoCY7y&xx^_pY&9EG@Wp}?&RrhIZ(AHzTDRI|Jnn!4e@WNh~yCWp}NZi{@x9iy}563_e zw8gnQEHvzI5JPWdaapVwi}ruN@c;WJA^`lV{b%ey01IH=zJTaI0gV1)|Ics01L&vZ zH=_qwm(RflcwF|%&y&85)xb|81^}-HJ`QWZ1F!|U5Iyi)my^lC1!ul6=aE_pCyAOCVrN5A?@2`+*hbB zEw|;|CEDlqk97>Q^CH+c#eVNYtZ$0_-iPSk6#Kmo@w_SadmkcrQ|$LX#O$Wn?@x)@ zO|jpf60)0Ozdt2nH^qK`O03Re*gSd1E>Su+v9NikiOx;Qywe2drexk}lg-5q3!8VE z*xbxz-f2Q}Q=&WV*d;DEB~9FX=Psc*pIOMf*REaSZ*J+KnAN0RyM*1Q9Nm+NyG?nZ zUm)-{j&Mis5r^kZ`r?8N(4mSzj)lpWl^RT>K65c5Xn#}N%b18XD zi_aCx1#B)a1WuL%4}tFp_a z&jV+~95@;ESqqyQ!#-;vQ(LDiWi3b=&;P;yqWyoI#{W0K|NjhD0Zw2C&?VP8{+|MaN(gI5&YM8efp&N6U%3x2(}EK!%Q$rFKN^BK8^t-`QGVG(}j zW}!HVqH2@p13pTnc`*(?(&Wj&#Qc=><63wT0S`*%O0m1i(}7V+3T{?c1J%;jDtc_5 z4Y*0y6C0OuBTb$MOw6CL{V&Y_v7_AD4d7_zp}CVws(p2FN*Z8Gz7#$a|ig&?`}N|S-#L&XizZ5l&OW_>=0KA+AynkMSc zC#274G2u(+Y%=P5NeaR`hVFEz$)K;2Xv}2iolRzZ&Zf`jN;t&6CiA^AH!FQei!Y9; zP3C$Z3E_19at_Z@X)@G%NDZFEGr6HQ3F#3tMijNWU`LanUUAQzmEOTyhFncTdc{vt z@T`b)f;qn0B&0`qk&`3Y&7E~Ohwrkf2%@<>m$7|b(=V9MQE9qKcSDyZLV9XxZc%Bv z`kKgl2IGZj|A%es!v6mU_Fu#P->0z#xM4qw_J7>&#Q6VrX#by*e?k6n>;c@u9>6sD z01Zih4I98OOYf2@(&O*}4oY4Sz?W>lW_uczKM}0-_CHsX;oF}+Bf)=b`bwdk%U#}b zGzq{}HGN+Ct{yhd=PUO$3Bc7^mJpz?oLleja}Q+J5X0}vTHr|f%)-pk;U=NEI?9=~ zECRsbYZrjH5uVoNTTqEB7#jCPh(qHiLh%~ z?DhY_29#KV2KbB4k&V1EH|yY?|DkJ}Y;1v641cQ+aQIY%()Z8Gs6rW|Il z0$hp!uAwGlKbOWH#k8ww5&WyBD4Hci$imE4^JhNH=>?#isOa~Y{}KQ1uMzM2WAOj~LD>H`u>bF2`+e8}^sk5j_Br`u#Q!(3 z11JIiKSlaiSO5k8zgzkNsf7K1)6xm70*WX=pT`d1cftB!yHoT(#4c_Tm@Dq|1-YT= zn|P5OEuwNr3Heo8IJIy#HPm7rS4q-SiL|T52<|6EOF#R}nmBn^i$UC8jNSh9g7mZT*z9qpb7zZ*+e@;Z zS>MKKI9m+dB*w&Y3q-YL5;x_Hi{i=B=2(k~JDN_49(eK6B_KW)EtsXr5?pb%OaM<$ zOZK=}r>Q>sjI+rA?iHdY7SJH7O%uFH49#4_28cq%*<|qMtTeto`^-?2d0VBd!PIop z)nv~0lY#}6jWsk)yiO))lWZ;>j5HavCr+m2Lz;dvlMc+J(}{(ZnR$1UU|aR4&q)gi z8l2j~q6X?Y*d*FkPmmt!>u_jaDdzDuyPL$_X2GCl?MPRf1m3Eb3Q`OR)TcIyyG>PW z84+=el_q1iC%qyUbZv%$Nj90e-9i(=meLr?nYX0zj}To^q4X+n0W1U<;b7$?)wLDuVD>+sc~E-(Hf<({MJQ zpl0b!XQg3G0x`r?bNiYF5)~mDIyPA~uaMvu0!D6gnaSC_Y!;rEFXBMd&8W>wB>K`q z#EGItw3TMwtU-*vhD8;k{ReFLHpe%>|6={`#}NVGvOQye5IcbE^0(#R1^aJf@6U1h z0CxU;2eE&CPWmC~b@2TQNhtGNp|z zv5}_|Ku~4`BozDLrjDOEKHg#~eUP#nY3xOUKIcTW7NhJ6Wr(H_ zYNjk=JDDKxoFy>x)R=YY)b#!y=;77`J(Mx3DSV-D`Etq3&&bR9Ly=jU8RhS5G4rM< zzi8U4xj?Fj$-u@2EEZTB!@jvf9+6LQ9cqhV*hiTKAOk6?LoEhkl~iqRX<@jSX$WMVkSOH3hg1!7jq_v9cwWg&rxC|Ey5mJ(~7_m7+|jO!-k6j z9M4|fVsL(va)&`@R}tJA`?o-D&%J}NHi(_lfn`kQEW1d>)ndk`TLf}8n}n~$n0<`u zg~t;**z2V-LXC@iqO=&dJ(S9m249PLn@fO-D^<~3V=^O3cv_6z;|ojDd*R!$zI`G& zNwY?G3+N4d`Y5G@$ZHP++J@2sdPDb+ZY+r2aI^*Vh884EU&w9ZD0%dS3uYv^yxLMJ zhi_q79_dG^7-~65RTmO+M+?s9OU{-;ikB3la=n1C^FuAiKsIc)Ob)e%SV^a)x1keQ z%Brn>r1)s;rTYb<5$*qwZN-M@KOaWhe~tZB_Aqw-iMSu1p`E{Pq@DjMIV|tTxc}$0 z^7oE@-0vvj{wvt||8>Ov_(j_fgZ(#AnY+bgIJ&TC`+JT#SuI^Hw-_3| zbQBYaoh>Fu@4}3HNeh|1af^}BMmh!_siFgQc3!nW!WvCS+Q6({) zPAv|#q63P)0{cQM!qtg9SZU!fBWf$Wr-sGrCfet*R)|#UyCQLPbyjDdy^!2&z|9xWr|KHeu+x}7T|I>*7|AhTC*8lvl{(Xnm|9(OK3HeQO8GgVgVgGlaANVWu z1OEei0DeGvgH({R(nHb_$%PmI-?05Y)&PDKD*#n93V@@HqCFht7VcWsr^9UN{h+Uvy_m3!;E65 zwirBpq=otwFnRh(?Z>t|&|?0aBw4>L4o!3TE=RUP;mklC;zLa`9rWD14&UVUSH^+^q|gPJ^PZXSM+V zo9I~_t@C?T!Hink3=Or;k)+a)7(-YrwRM&h9weh@D7av0sC8x_UnI4f-``px+gA|+yjZxrnVaOB=WH{LdMV9}sG_!+ zLVZFMjgKQ@w3#-?NDYgZooDoFn<JVemEcPxV!9~?E?1ig z(oePbM>$X1M91YBxuuI}G=b&(RuNMlSDVq%FH#03h;1fEFUjTw1=@^`;YSkEd*Cri z(;|H94c~B}nMVP}iZ-*OpR)8_`5kSBM>om(BRE@6o9S_UX<0h0;jy37{2_aRF zND<*p5Z1cnXfs8+m$K4J4gEsy>eZn(W27o1L~}|nsO`J?-6SQ5Pko5E`L6a$N%fQ3 zzb8ujCHxMG;Xscju<~HI+AlV<3Ju-p#ceSubhlqb@+f7+9!D|H!W+H6{X)`@l5Qlo zFO^Hzw*yNhxKkqW1p|rL2wg^8a>O4%;(E^6zKasQR8q@a5=_mSF6CSz97$ld^^R90_sJQDK~$D{Vge!ScE|IA1&-;J{Ia+cqjbM#V$L zQWc;43v5;L&erQGfiBYuso-k8jzmA@?pwc@|FQq?FJb@tC4A%WO_&4Z@io7Q{T}<> z^1sPnM+}f(K|ipI9f0TL8SMZ2H$?yYpBVkc?%!*O|C7SXpM)I%Ux4r5TM+y2PP+hI zZAN4N*^E44L^HX~l5mn#+a??fx&KWGf1BV~ojjA2uG}Hg&cQZuvU-BjH7$wl=(L}y zA4R!M#EdZTr~sZ)=Gf+JC(ZkkmO?OYBhpWy;%^f%tCRCd>CznzHqj<}Rv!}SdmqJm zB_{lsahHk#1eI9Juf5vc22QK^d{Aa?L0S{;Syu#}7{dzt%g zTaGqEw0rri{2HBt<+$v2 z=O3lbz`1iNPn#K@l&R*f;fVPP-Z0EqVMM@(DRNt@2t|(p zQS4J|Gikd;{$P9snTOkq*<&QdvboKRrE4Ou(q_{3P(nDpm`$Bg+sxB67#J}#3fowl z@i{7T8WcbWeJw)e!kfBODO`kC^t#e!hNjxcR+u-OZDwY#D2GTB3kZ&~=x8%7(<$mv zaf(B224xy-bT~LBoozN)amg@k1j#6EHcQbV^x)hIT`(J=xHcoPUaEN8Y@&T-&F3-$dKx1O&9nGYq3Aj#geex$a$&aAT(5nhPg4F>- zZJWp|ln}8W-UCfov>AiPNiZ_#LbC`lKC8#nHj^+{ zpqnXbn^D-8nU~iM%W2-#W(@WV6;AHvr%0S_Mqw|>rgMX<&HT%GgH~Qg+r(eWORfFBehZ2e-POxQq~jEdAj=Qa+s8Hy(<*KL!Rp*CZ& zx}33n8R1(}OOAGi9)g<`I6*v6QQONT`A8!32Id@U`;h_FvR%2_OQiZU3o;_X^<$^C z7r9oF%`06X$xD*?wAFT+E6pUNpTa~2yAA@GgtI+wW)&)j6WeyR=ScKZR(NFuFvrT_ zjXrJ4S-Fhx!I>-;SFl>rPLb@%q$NbsUs_J3DgNJtu>XAx@xMMw`~OPV{WEPhVj*n51=ED0rjIau24^L&C9fnsrG#o`}WyalM za;4G$$1O1F2F}yfVQBS>(puD733GKAS6S|FpB?Hju+qum>s9z1XNQ55E=dcWF9|P~ z4l^j9fVqjv)nN$b8v9VLb{Ir`k3EL*TN9HpP{92i=F9Yjg#5k1U>33Is&K+E{~ynM z20FBfHdE)rl-)>e6mDL>lZ(NjHiKw_^67Kp!IrEJzJhP3R<~(^;P`0!we-3MDI;Qs zu7esYCG?{hJ!_X>Rf&mnySo`3Iy1mFL8 zF~0lvW$gZa#`Z?@tDn~3FM0x#Nt35+h_(#V9FRNj>M)b~N$tDt?e8#<9?i_y{w~N} zTt1K}BNTOF%GF^e^@~I!0!F-A$rsnW9Y)W?B-6wm_lElwcZV5tl+r?(>j3p)z?fA# zjG#W!2?H{P^6?Hs=p&>e4rf^)Zv}oi7#lIF;H9cma+mw>Lq+W{pHek?bhd<-4d$E< z6RBHNqensrS$c1Wf%GAg!nfBnW+D^#1TXp$KFl!E zVX~c|TpB|1|BTCC#$h zxjPKEbkV>Sen!FBLmlQ@x-2aeoW+oS2`0H}d26*QLg|^U5>J6?m!5(agbnOCp2FQ7 zCf*@Bm=RPu_n0k3oVysP3psaZjI`0r1^G=d&s@*lECeu*QaS-M@3Q<2P3-!8GN*P% zN%LidW?5U+&cOkdprEo<9`3LOYAiD?-vqDYgNnt12;AuE9H8ueN}$h9i?xTL4x6A< zlHsthpmz3~^@`HdC4vu)q5lAlm;_6z`K;6q6D()7R%M+XCRQ(H4PL;)I6S2~ z%&B~mhKRkZbQn}U+0)W5AP}H{z)2dtKjm6KTrWS`gr|2TaNQ%wPTG%ksnWcmYk$~?J zh#IcIY&Jigc6Lrul2;_bUb%%^dBf3}A(86Fyk#jnJKUMxs~av(x$;b|B4YCmb&`~z zX3k4LDg22RT%9RW{G`B=4=W;`&qyah@`M=G!f^1t2$wJ1JQ0<+^NN8a4ZRt^C`eK| z4^xtd#zN{q4Oi#od;rp-sf9!2aNy}YMDjSvk<8T8Wb)+6$&)8D_jF!HDRD{(XYmO; z+;p+*FpDUNrA^RW{;0F_AZ7AWCX)!c{lotMm-f%vKV*M9zW$ZQ+TWP{#n}7%6}0~M zVeH?<8o;B7{vU=9&|T6$!t?*L)oP{=*20 zt{||oUPf=3cXyeQM=42Pnps?$pTP|o?lLKl30;dKHy)fY;XAu_zB!Z-;qSTb?=mhQ zB{2-X5&)6q68pO7^Wf5!xXHNN-G^5 z#@)j!vvSRVgO>S`Ryw=RQ|8$rO*cIYhB^$iswkji#e06JbCa^MLTK7ySoMlL)@RO! zIyX35_KbWKgCPu09TQfwN%1{k(_T8yHNb03^fd0y znyF)a6kYO`Xk*v%Bb`;!C&X|FN4!)6ajevrt(>=xEZD+nrq&vfoZNDdsq@+s7#YWFCexsQrlo54o9jF%Ha z4MsED;)^(iYr?I}=rU!Vr=$oU4{z<>5%Cu1#o}2Sqtbj~6TXpa6J3VThpABbbS4Sf zyqqrzpR*$?bC`~DK4+Jq)JyryX6WoPfU;->uhc6dI!94tj}@!wdV&Eu|NnUB**7YdB_Xl(yF5zV3cH>tj?riYQ3u z(2-jA$=zjArL%;UM7Z>cA6J)Yl`cx}$1wACnOC{8&?$WVj2CzjRkyn4?lQJ=WkKQX z2|uLOb$8cIr@*?=*Y|Z@q|tuA< z5_O)khm(u*eIG1yj2SSmScUxEy9drPbTXY8a9_pk@^#s8MK{xmSKj}y*uE~?uXwCQ z;1q8E3u65LJpBLPiuL~(X8w}=C$RnXu;YIjqy9le|NckmkMZTd_af@&ImG?;lF#4g z%$WZdZ42D?l`fH->R!p| z(NbQQfKClkh6oA)zc&hE<;(hVxw}hXr}`;ND3VE~(=*xS^Jsum~ug7kTf~ zv(6Q_@9z@vsdJP~M+6|TYL>xuK6fDiUCrw8@h(xI8t3ehBsK^Ow~uUkuxU8KDY?3Yg;sv!3@ipWOGQVQKu}dVzlJa{uI>YLANcmb2+lcO z-T0s!GUff<7|DmJf=FcLc;+|_K;qF2ccYZZXA=%3HiU^Yu#)k2Ba|>nrNY?EBl=t7+GRtIXp!HH4+O>rV6V)H&SSL8Mjg&!+@Z~m zciD>bAl1<~iDHw27#RX{xW8+q&3#>6oI79-M~X(Lvd6n@(|JS)*menH%yt!~(aQn) z&+G6P%v()1a3q^Pdc4cl9WJ2%=LN>PZ1#!L5w!Fz?$qWDP`i_KS~NUHV|b}WjQ4$A zw)9XVk4C1lBVE&|gQ^hU2_xSPi(*ClzgO7*{uI0ae-7gUR{@;H10DZ$`fG*Ym zF33~zgnYO3w^;cTYyS=G{1N^?Blz;)mniD@oACwEy~uyuA$Yq4X6l4^<{>oxE5aX} zch;(1f-`QY_1Ey9-6I9Jjd%Ywot%Wjv#1jV)LLTT6tEtB*6`#i~z(`yaOGem$hZ%2|AdP#i z5Z0T}lMQ!?#JHV>w7pL&9PSd2sR>b6Fn-Hf2-Lt#Qhb=?My{fCiO{%Oe12L~>+2Go z@p%Tr_{dusU0pH9cgfwoNUestxnM{;i#9I|x9)CkK;Mg!@9jQLI^A)6dV27V_`8o$ z8nwWnE+)C~f!Ny+>Fz!{P$wcJnj5P2cVA69wf7({oE$36mh0}mYOfH!Xl)g8cV9W6 z#|CsVtndTIC$9JMlR3rIBLg}aQ%pTPpp!Yp)I$S0SyW7Y@5Z>hWK%J9_zIX8=kAhO z#nksM+TA7Fim7Y;{N66vSNN6FU-C%bQh>D8cX#sy((%qO&T=<-C*-<)!UsPII6BKWmB-_t`@MjEa&ge zQ5rpR9q}fyPedSyWrXJT5C7k_3Io|3~5dd)z*ZumAm({BijmpnxrS{!Yu9 z>_O~r5&P>y`1Vg-dIDenj!O4P`)nct@JDQKv%U6~FMpXmK#yRHZ&y65ox{gzt%D!z z5pgjF#IZ*Viv#_{!2EpD*CXWOrV-ciW%e@NP_vQu2)7s#;+mE&tW7Q#&=c=fqV@=} zxQ~g&#b~{XmB`-RbW>=EilG&*VTVx_wtb~X@WjnC7S)#U*;QwckV*B3#*Ltoa9Jx< zyuBCi-SSvSLx+L}%SIhn??seGV`(gi_I$Nm0W^E&{ z_Ux2EZ%z~)WvO^AzdhU|0|)nL(V&*en@h68Ju+@^LIgb;<`|V~>2gl#k&%P%P=q_M z;VxM?%*;`-S)+PIm_FQHGIH>%9oc)e)h?Mj_^Cv~+UZ;cpBZ*{$;e^m4v7nfW5eam z{avzisMPyJ(2onht$FiSjCaZ8!Qd1@cL#U9O>@x?&h8jeg#E%Wp z3K7>p?UF5oPbCauC0cQJ$sWR|65i{(yj`}4Q2P$U$7^7?QMzmtq4pY%PkEgp#dUnE4=ykP(J^4+JKiPx2%mj8$o&O#5&ZwGX5#La>Dken6UJ8>as434qS}3O z@0o@zp9r;kbwJhnS5(@oBed5`i}ruemKEdwr|i$z--xxpG`{@(Jox>5N`4pi{BL6Q z|Bx)h9Yw#h#;4$)H*P!dI-j}P0g zV{fo^GVb0){~<>4Ek&%(p<~Hc5BA6eVV)Uo4_-^L;1o#U`!e{he97A*a|Ct5QH&dd z7&g`;tArY+W9l>)!}q#wIj^xE87a&>+8y%*dStQSJBYa-qLf?)0i)mO-{k#0vR?3G z(%}0q)>5pC^Y+Mu!RHA7NdZmy^2Ktgw4V3($b!MoUyEoKxL9Rp+i;8H9pSe7P}&B~w_`tmMNzvS#q(LoB^C0?m}LSvatq zNd&@T)wGJQc2?l-d7wx34YMNnP+!6Ahow7!NE;jZZGVsK9OilOcm*o#-+}$TVS2pO z(ZzZ8%wvl95@wIg9o!4Xx#R68dU|B@;QlQh75muC&y@OmWc;9GM&cL{?lArzww)9E ze?N?`|9r3ghJBS*07M_~_gDe=b;SSvQLF$I<+Jj`@_m>A{5|}DJ}Uhb`hut6{VSq> z2Ben|1N?^Vm+%#kCsCbkxJPuRj6L?4eOC+ZosiliJX7Fnf&|1rEv&)JcDzS$raVHb z0dEO>U0XaSVX-AMXa)0R(Ph#uNWl)k zi(*&AaE~k~%Gj9&=@VMiTtNt&S@8DAjG`Q-gjjGkFmqz;-$o3W)f$XclXGCqKuLVJ7+OR zW)N48tS5?}baJr}*5&0M@tj$a{fH5j#uqV$dSv}j)Rha;2Q(3g=s=H*AIc;t z5p2!61bZ@Uzsz$=kBlIShmyl9tLRQh_7HO&qqx#T4IwEp0R=6N5LnS` za?4Q;w9$_1(ZcCcB8D(ivxpkFfpjUgK`EB)BK$qVoA^Rf;syghMF`WV7%mH0iP>b2 zjypKi-hx#jDlz+fn4I@;f(VfpZuC-RnaGPl83?(Fabvdi0+L(ixT4n(vJ>}JYz!aS z&hdpWgeKJoVUQ0dtSLk#W`$$f(;jwOi1Jtvk`gy-*pcI=>XML;n01wO_ls;*JbYG& zNX#4`rM{4iRHkw71f^5^!^c#}MNF4MovXX2LGg_1NI1ts0C8#h6GF}WHkGiPeL(0? Sh)ztxu1VeXGRyNiT>J;Umu9B` diff --git a/res/wiki_mcc_mnc_oper_list.sql b/res/wiki_mcc_mnc_oper_list.sql deleted file mode 100644 index b1a9bb9..0000000 --- a/res/wiki_mcc_mnc_oper_list.sql +++ /dev/null @@ -1,1519 +0,0 @@ -create table mcc_mnc_oper_list (id integer primary key, country char(3), mcc integer, mnc char(3), oper char(45) ); -BEGIN; -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 1, "01", "TEST"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GE", 289, "67", "Aquafon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GE", 289, "88", "A-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AF", 412, "01", "AWCC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AF", 412, "20", "Roshan"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AF", 412, "40", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AF", 412, "50", "Etisalat"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AL", 76, "01", "AMC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AL", 276, "02", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AL", 276, "03", "Eagle Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AL", 276, "04", "Plus Communication"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DZ", 603, "01", "Mobilis"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DZ", 603, "02", "Djezzy"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DZ", 603, "03", "Nedjma"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AS", 44, "11", "Bluesky"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AD", 213, "03", "Mobiland"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AO", 631, "02", "UNITEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AO", 631, "04", "MOVICEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AI", 365, "010", "Weblinks Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AI", 365, "840", "Cable & Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AG", 344, "030", "APUA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AG", 344, "920", "LIME"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AG", 338, "050", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "010", "Movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "020", "Nextel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "070", "Movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "310", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "320", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "330", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "34", "Personal"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "341", "Personal"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "350", "Hutchinson (PORT HABLE)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AR", 722, "36", "Personal"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AM", 283, "01", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AM", 283, "05", "VivaCell-MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AM", 283, "10", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AW", 363, "01", "SETAR"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AW", 363, "02", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "01", "Telstra"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "02", "Optus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "03", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "04", "Department of Defence"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "05", "Ozitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "06", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "08", "One.Tel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "09", "Airnet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "12", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "13", "Railcorp"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "14", "AAPT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "15", "3GIS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "16", "Victorian Rail Track"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "21", "SOUL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "24", "Advance Communications Technologies Pty. Ltd."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "38", "Crazy John's"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "71", "Telstra"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "72", "Telstra"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "88", "Localstar Holding Pty. Ltd."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "90", "Optus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AU", 505, "99", "One.Tel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "01", "A1"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "03", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "05", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "07", "tele.ring"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "09", "A1"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "10", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "11", "bob"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "12", "yesss"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "14", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "15", "Barablu"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AT", 232, "91", "GSM-R A"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AZ", 400, "01", "Azercell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AZ", 400, "02", "Bakcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AZ", 400, "03", "FONEX"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AZ", 400, "04", "Nar Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BS", 364, "390", "BaTelCo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BH", 426, "01", "Batelco"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BH", 426, "02", "zain BH"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BH", 426, "04", "VIVA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BD", 470, "01", "Grameenphone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BD", 470, "02", "Robi"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BD", 470, "03", "Banglalink"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BD", 470, "04", "TeleTalk"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BD", 470, "05", "Citycell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BD", 470, "06", "Airtel formerly Warid Telcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BB", 342, "600", "LIME"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BB", 342, "750", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BB", 342, "820", "Sunbeach Communications"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BY", 257, "01", "velcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BY", 257, "02", "MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BY", 257, "03", "DIALLOG"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BY", 257, "04", "life:)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BY", 257, "501", "BelCel JV"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BE", 206, "01", "Proximus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BE", 206, "05", "Telenet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BE", 206, "10", "Mobistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BE", 206, "20", "BASE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BZ", 702, "67", "DigiCell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BZ", 702, "99", "Smart"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BJ", 616, "01", "Libercom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BJ", 616, "02", "Moov"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BJ", 616, "03", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BJ", 616, "04", "BBCOM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BJ", 616, "05", "Glo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BM", 350, "01", "Digicel Bermuda"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BM", 350, "02", "Mobility"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BM", 338, "050", "Digicel Bermuda"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BM", 310, "59", "Cellular One"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BT", 402, "11", "B-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BT", 402, "77", "TashiCell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BO", 736, "01", "Nuevatel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BO", 736, "02", "Entel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BO", 736, "03", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BA", 218, "03", "HT-ERONET"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BA", 218, "05", "m:tel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BA", 218, "90", "BH Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BW", 652, "01", "Mascom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BW", 652, "02", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BW", 652, "04", "BTC Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "00", "Nextel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "02", "TIM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "03", "TIM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "04", "TIM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "05", "Claro BR"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "06", "Vivo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "07", "Sercomtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "10", "Vivo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "11", "Vivo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "15", "CTBC Celular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "16", "Brasil Telecom GSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "23", "Vivo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "31", "Oi"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "32", "CTBC Celular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "33", "CTBC Celular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "34", "CTBC Celular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BR", 724, "39", "Nextel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VG", 348, "170", "LIME"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VG", 348, "570", "CCT Boatphone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VG", 348, "770", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BN", 528, "01", "Jabatan Telekom Brunei"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BN", 528, "02", "B-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BN", 528, "11", "DSTCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BG", 284, "01", "M-Tel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BG", 284, "03", "Vivacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BG", 284, "04", "Undisclosed"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BG", 284, "05", "GLOBUL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BF", 613, "01", "Telmob"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BF", 613, "02", "Zain"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BF", 613, "03", "Telecel Faso"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BI", 642, "01", "Spacetel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BI", 642, "02", "Africell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BI", 642, "03", "Onatel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BI", 642, "07", "Smart Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BI", 642, "08", "HiTs Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("BI", 642, "82", "U-COM Burundi"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "01", "Mobitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "02", "hello"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "03", "S Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "04", "qb"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "05", "Star-Cell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "06", "Smart Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "18", "Mfone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "11", "Excell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "09", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KH", 456, "08", "Metfone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CM", 624, "01", "MTN Cameroon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CM", 624, "02", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "220", "Telus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "221", "Telus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "270", "unknown"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "290", "Airtel Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "320", "Mobilicity"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "350", "FIRST"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "360", "MiKe"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "361", "Telus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "370", "Fido"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "380", "DMTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "490", "WIND Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "500", "Videotron"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "510", "Videotron"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "610", "Bell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "610", "Bell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "620", "ICE Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "640", "Bell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "652", "BC Tel Mobility (Telus)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "653", "Telus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "655", "MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "656", "TBay"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "657", "Telus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "660", "MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "680", "SaskTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "701", "MB Tel Mobility"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "702", "MT&T Mobility (Aliant)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "703", "New Tel Mobility (Aliant)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "710", "Globalstar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "720", "Rogers Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "780", "SaskTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CA", 302, "880", "Bell / Telus / SaskTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CV", 625, "01", "CVMOVEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CV", 625, "02", "T+"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KY", 346, "140", "LIME"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KY", 346, "50", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CF", 623, "01", "CTP"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CF", 623, "02", "TC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CF", 623, "03", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CF", 623, "04", "Nationlink"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TD", 622, "01", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TD", 622, "02", "Tchad Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TD", 622, "03", "TIGO - Millicom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TD", 622, "04", "Salam"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CL", 730, "01", "entel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CL", 730, "02", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CL", 730, "03", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CL", 730, "04", "Nextel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CL", 730, "08", "VTR Móvil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CL", 730, "09", "Nextel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CL", 730, "10", "entel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CL", 730, "99", "Will"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CN", 460, "00", "China Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CN", 460, "01", "China Unicom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CN", 460, "02", "China Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CN", 460, "03", "China Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CN", 460, "05", "China Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CN", 460, "06", "China Unicom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CN", 460, "07", "China Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CN", 460, "20", "China Tietong"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CO", 732, "001", "Colombia Telecomunicaciones S.A."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CO", 732, "002", "Edatel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CO", 732, "101", "Comcel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CO", 732, "102", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CO", 732, "103", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CO", 732, "111", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CO", 732, "123", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KM", 654, "01", "HURI - SNPT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CG", 629, "01", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CG", 629, "10", "Libertis Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CG", 629, "07", "Warid Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CK", 548, "01", "Telecom Cook"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CR", 712, "01", "Kolbi ICE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CR", 712, "02", "Kolbi ICE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CR", 712, "03", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CR", 712, "04", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HR", 219, "01", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HR", 219, "02", "Tele2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HR", 219, "10", "Vip"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CU", 368, "01", "CUBACEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CY", 280, "01", "Cytamobile-Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CY", 280, "10", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CZ", 230, "01", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CZ", 230, "02", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CZ", 230, "03", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CZ", 230, "04", "U:fon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CZ", 230, "05", "TRAVEL TELEKOMMUNIKATION, s.r.o"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CZ", 230, "06", "OSNO TELECOMUNICATION, s.r.o"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CZ", 230, "98", "Správa železniční dopravní cesty, s.o"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CZ", 230, "99", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CD", 630, "01", "Vodacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CD", 630, "02", "Zain"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CD", 630, "04", "Cellco"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CD", 630, "05", "Supercell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CD", 630, "10", "Libertis Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CD", 630, "86", "CCT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CD", 630, "89", "SAIT Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "01", "TDC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "02", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "03", "MIGway A/S"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "05", "ApS KBUS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "06", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "07", "Barablu Mobile Ltd."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "09", "Dansk Beredskabskommunikation A/S"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "10", "TDC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "11", "Dansk Beredskabskommunikation A/S"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "12", "Lycamobile Denmark Ltd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "20", "Telia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "30", "Telia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "40", "Ericsson Danmark A/S"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DK", 238, "77", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DJ", 638, "01", "Evatis"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DM", 366, "020", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DM", 366, "110", "Cable & Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DO", 370, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DO", 370, "02", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DO", 370, "03", "Tricom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DO", 370, "04", "Viva"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TL", 514, "02", "Timor Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EC", 740, "00", "Movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EC", 740, "01", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EC", 740, "02", "Alegro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EG", 602, "01", "Mobinil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EG", 602, "02", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EG", 602, "03", "Etisalat"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SV", 706, "01", "CTE Telecom Personal"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SV", 706, "02", "digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SV", 706, "03", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SV", 706, "04", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SV", 706, "11", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GQ", 627, "01", "Orange GQ"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GQ", 627, "03", "Hits GQ"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ER", 657, "01", "Eritel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EE", 248, "01", "EMT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EE", 248, "02", "Elisa"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EE", 248, "03", "Tele 2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EE", 248, "04", "OY Top Connect"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EE", 248, "05", "AS Bravocom Mobiil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("EE", 248, "06", "Progroup Holding"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ET", 636, "01", "ETH-MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FO", 288, "01", "Faroese Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FO", 288, "02", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FJ", 542, "01", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FJ", 542, "02", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "03", "DNA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "05", "Elisa"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "07", "Nokia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "08", "Unknown"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "10", "TDC Oy"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "11", "VIRVE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "12", "DNA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "14", "AMT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "15", "SAMK"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "21", "Saunalahti"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "29", "Scnl Truphone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FI", 244, "91", "Sonera"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "00", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "02", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "05", "Globalstar Europe"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "06", "Globalstar Europe"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "07", "Globalstar Europe"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "10", "SFR"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "11", "SFR"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "13", "SFR"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "14", "Free Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "15", "Free Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "20", "Bouygues"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "21", "Bouygues"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "22", "Transatel Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FR", 208, "88", "Bouygues"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PF", 547, "20", "Vini"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GA", 628, "01", "Libertis"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GA", 628, "02", "Moov"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GA", 628, "03", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GA", 628, "04", "Azur"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GM", 607, "01", "Gamcel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GM", 607, "02", "Africel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GM", 607, "03", "Comium"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GM", 607, "04", "QCell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GE", 282, "01", "Geocell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GE", 282, "02", "MagtiCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GE", 282, "03", "MagtiCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GE", 282, "04", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GE", 282, "05", "Silknet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "01", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "02", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "03", "E-Plus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "04", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "05", "E-Plus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "06", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "07", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "08", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "09", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "10", "Arcor AG & Co"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "11", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "12", "Dolphin Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "13", "Mobilcom Multimedia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "14", "Group 3G UMTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "15", "Airdata"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "16", "Vistream"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "42", "27C3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "43", "LYCA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "60", "DB Telematik"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "76", "Siemens AG"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "77", "E-Plus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "92", "Nash Technologies"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("DE", 262, "901", "Debitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GH", 620, "01", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GH", 620, "02", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GH", 620, "03", "tiGO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GH", 620, "04", "Expresso"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GH", 620, "06", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GI", 266, "01", "GibTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GI", 266, "06", "CTS Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GR", 202, "01", "Cosmote"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GR", 202, "05", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GR", 202, "09", "Wind"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GR", 202, "10", "Wind"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GL", 290, "01", "TELE Greenland A/S"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GD", 352, "030", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GD", 352, "110", "Cable & Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GP", 340, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GP", 340, "02", "Outremer"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GP", 340, "03", "Telcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GP", 340, "08", "Dauphin"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GP", 340, "20", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GU", 310, "032", "IT&E Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GU", 310, "033", "Guam Telephone Authority"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GU", 310, "140", "mPulse"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GU", 310, "370", "docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GU", 311, "250", "i CAN_GSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GU", 310, "470", "docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GT", 704, "01", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GT", 704, "02", "Comcel / Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GT", 704, "03", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GB", 234, "55", "Sure Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GB", 234, "50", "Wave Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GB", 234, "03", "Airtel Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GN", 611, "01", "Orange S.A."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GN", 611, "02", "Sotelgui"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GN", 611, "03", "Telecel Guinee"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GN", 611, "04", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GN", 611, "05", "Cellcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GW", 632, "02", "Areeba"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GW", 632, "03", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GY", 738, "01", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("GY", 738, "02", "GT&T Cellink Plus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HT", 372, "01", "Voila"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HT", 372, "02", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HT", 372, "03", "NATCOM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HN", 708, "01", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HN", 708, "02", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HN", 708, "30", "Hondutel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HN", 708, "40", "DIGICEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "00", "1O1O / One2Free"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "01", "CITIC Telecom 1616"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "02", "CSL Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "03", "3 (3G)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "04", "3 (2G)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "05", "3 (CDMA)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "06", "SmarTone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "07", "China Unicom (Hong Kong) Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "08", "Trident Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "09", "China Motion Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "10", "New World Mobility"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "11", "China-Hong Kong Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "12", "CMCC HK"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "14", "Hutchison Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "15", "SmarTone Mobile Communications Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "16", "PCCW Mobile (2G)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "17", "SmarTone Mobile Communications Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "18", "CSL Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "19", "PCCW Mobile (3G)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HK", 454, "29", "PCCW Mobile (CDMA)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HU", 216, "01", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HU", 216, "30", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("HU", 216, "70", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "01", "Síminn"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "02", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "03", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "04", "Viking"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "06", "Núll níu ehf"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "07", "IceCell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "08", "On-waves"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "11", "Nova"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IS", 274, "12", "Tal"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "01", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "02", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "03", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "04", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "05", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "07", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "09", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "10", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "11", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "12", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "13", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "14", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "15", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "17", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "19", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "20", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "21", "Loop Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "22", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "24", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "25", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "27", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "28", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "29", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "30", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "31", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "34", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "36", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "37", "Aircel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "38", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "41", "Aircel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "42", "Aircel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "44", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "45", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "46", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "48", "Dishnet Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "49", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "51", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "52", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "53", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "54", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "55", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "71", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "56", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "57", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "58", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "59", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "60", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "62", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "64", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "66", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "67", "Reliance GSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "68", "DOLPHIN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "69", "DOLPHIN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "72", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "74", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "76", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "78", "Idea Cellular Ltd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "80", "BSNL MOBILE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "81", "CellOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "82", "Idea"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "83", "Reliance Smart GSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "84", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "85", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "86", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "87", "Idea"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "88", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "89", "Idea"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "90", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "91", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "92", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "93", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "96", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "01", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "03", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "04", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "05", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "09", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "10", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "13", "Reliance"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "025", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "026", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "027", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "029", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "030", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "031", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "032", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "033", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "034", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "035", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "036", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "037", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "038", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "039", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "041", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "042", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "043", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "044", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "045", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "046", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "047", "TATA Teleservice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "51", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "52", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "54", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "55", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "56", "AirTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "66", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "70", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "750", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "751", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "752", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "753", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "754", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "755", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "756", "Vodafone IN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "799", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "800", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "801", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "802", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "803", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "804", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "805", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "806", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "807", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "808", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "809", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "810", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "811", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "812", "AIRCEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "819", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "818", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "820", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "821", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "822", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "824", "Videocon Datacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "827", "Videocon Datacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "834", "Videocon Datacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "844", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "845", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "86", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "848", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "850", "IDEA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "855", "Loop Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "864", "Loop Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "865", "Loop Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "875", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "880", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "881", "S Tel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "912", "Etisalat DB(cheers)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "913", "Etisalat DB(cheers)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "914", "Etisalat DB(cheers)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "917", "Etisalat DB(cheers)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 404, "927", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IN", 405, "929", "Uninor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "00", "PSN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "01", "INDOSAT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "03", "StarOne"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "07", "TelkomFlexi"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "08", "AXIS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "09", "SMART"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "10", "Telkomsel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "11", "XL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "20", "TELKOMMobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "21", "IM3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "27", "Ceria"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "28", "Fren/Hepi"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "89", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ID", 510, "99", "Esia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IR", 432, "11", "IR-MCI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IR", 432, "14", "TKC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IR", 432, "19", "MTCE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IR", 432, "32", "Taliya"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IR", 432, "35", "Irancell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IR", 432, "70", "TCI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IR", 432, "93", "Iraphone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IQ", 418, "05", "Asia Cell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IQ", 418, "08", "SanaTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IQ", 418, "20", "Zain"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IQ", 418, "30", "Zain"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IQ", 418, "40", "Korek"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IQ", 418, "45", "Mobitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IQ", 418, "92", "Omnnea"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IE", 272, "01", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IE", 272, "02", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IE", 272, "03", "Meteor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IE", 272, "04", "Access Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IE", 272, "05", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IE", 272, "07", "Eircom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IE", 272, "09", "Clever Communications"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IE", 272, "11", "Liffey Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IM", 234, "58", "Pronto GSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IM", 234, "09", "Sure Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IL", 425, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IL", 425, "02", "Cellcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IL", 425, "03", "Pelephone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IL", 425, "77", "Mirs"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "01", "TIM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "02", "Elsacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "07", "Noverca"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "10", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "30", "RFI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "77", "IPSE 2000"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "88", "Wind"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "98", "Blu"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("IT", 222, "99", "3 Italia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CI", 612, "01", "Cora de Comstar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CI", 612, "02", "Moov"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CI", 612, "03", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CI", 612, "04", "KoZ"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CI", 612, "05", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CI", 612, "06", "ORICEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JM", 338, "020", "LIME"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JM", 338, "050", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JM", 338, "070", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JM", 338, "180", "LIME"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "00", "eMobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "01", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "02", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "03", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "04", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "06", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "07", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "08", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "09", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "10", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "11", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "12", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "13", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "14", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "15", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "16", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "17", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "18", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "19", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "20", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "21", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "22", "NTT docomo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "23", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "24", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "25", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "26", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "27", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "28", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "29", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "30", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "31", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "32", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "33", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "34", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "35", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "36", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "37", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "38", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "39", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "40", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "41", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "42", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "43", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "44", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "45", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "46", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "47", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "48", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "49", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "50", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "51", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "52", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "53", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "54", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "55", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "56", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "58", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "60", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "61", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "62", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "63", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "64", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "65", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "66", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "67", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "68", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "69", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "70", "au"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "71", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "72", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "73", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "74", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "75", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "76", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "77", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "78", "Okinawa Cellular Telephone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "79", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "80", "TU-KA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "81", "TU-KA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "82", "TU-KA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "83", "TU-KA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "84", "TU-KA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "85", "TU-KA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "86", "TU-KA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "87", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "88", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "89", "KDDI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "90", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "92", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "93", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "94", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "95", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "96", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "97", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "98", "SoftBank"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JP", 440, "99", "DoCoMo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JE", 234, "50", "JT-Wave"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JE", 234, "55", "Sure Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JE", 234, "03", "Airtel Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JO", 416, "01", "zain JO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JO", 416, "02", "XPress Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JO", 416, "03", "Umniah"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("JO", 416, "77", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KZ", 401, "01", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KZ", 401, "02", "Kcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KZ", 401, "07", "Dalacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KZ", 401, "08", "Kazakhtelecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KZ", 401, "77", "Mobile Telecom Service"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KE", 639, "02", "Safaricom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KE", 639, "03", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KE", 639, "07", "Orange Kenya"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KE", 639, "05", "yu"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KI", 545, "09", "Kiribati Frigate"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KP", 467, "192", "Koryolink"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KP", 467, "193", "SunNet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KR", 450, "02", "KT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KR", 450, "03", "Power 017"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KR", 450, "04", "KT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KR", 450, "05", "SKT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KR", 450, "06", "LGU+"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KR", 450, "08", "olleh"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RKS", 212, "01", "Vala"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RKS", 293, "41", "IPKO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RKS", 212, "01", "Z Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KW", 419, "02", "zain KW"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KW", 419, "03", "Wataniya"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KW", 419, "04", "Viva"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KG", 437, "01", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KG", 437, "03", "Fonex"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KG", 437, "05", "MegaCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("KG", 437, "09", "O!"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LA", 457, "01", "LaoTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LA", 457, "02", "ETL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LA", 457, "03", "Unitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LA", 457, "08", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LV", 247, "01", "LMT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LV", 247, "02", "Tele2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LV", 247, "03", "TRIATEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LV", 247, "05", "Bite"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LV", 247, "06", "Rigatta"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LV", 247, "07", "MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LV", 247, "08", "IZZI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LV", 247, "09", "Camel Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LB", 415, "01", "Alfa"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LB", 415, "03", "mtc touch"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LB", 415, "05", "Ogero Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LS", 651, "01", "Vodacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LS", 651, "02", "Econet Ezin-cel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LR", 618, "01", "Lonestar Cell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LR", 618, "02", "Libercell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LR", 618, "04", "Comium"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LR", 618, "07", "Cellcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LR", 618, "20", "LIBTELCO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LY", 606, "00", "Libyana"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LY", 606, "01", "Madar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LY", 606, "02", "Al-Jeel Phone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LY", 606, "03", "Libya Phone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LY", 606, "06", "Hatef Libya"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LI", 295, "01", "Swisscom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LI", 295, "02", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LI", 295, "05", "FL1"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LI", 295, "77", "Alpmobil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LI", 295, "04", "Cubic Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LT", 246, "01", "Omnitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LT", 246, "02", "BITE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LT", 246, "03", "Tele 2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LT", 246, "05", "LitRail"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LT", 246, "06", "Mediafon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LU", 270, "01", "LuxGSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LU", 270, "77", "Tango"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LU", 270, "99", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MO", 455, "00", "SmarTone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MO", 455, "01", "CTM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MO", 455, "02", "China Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MO", 455, "03", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MO", 455, "04", "CTM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MO", 455, "05", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MK", 294, "01", "T-Mobile MK"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MK", 294, "02", "ONE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MK", 294, "03", "Vip MK"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MG", 646, "01", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MG", 646, "02", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MG", 646, "03", "Sacel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MG", 646, "04", "Telma"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MW", 650, "01", "TNM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MW", 650, "10", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "01", "ATUR 450"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "10", "DiGi Telecommunications"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "11", "TM Homeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "12", "Maxis"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "13", "Celcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "14", "Telekom Malaysia Berhad for PSTN SMS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "16", "DiGi"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "17", "Hotlink"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "18", "U Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "18", "TM Homeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "19", "Celcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "20", "Electcoms Wireless Sdn Bhd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "150", "Tune Talk"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "151", "Baraka Telecom Sdn Bhd (MVNE)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MY", 502, "152", "Yes"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MV", 472, "01", "Dhiraagu"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MV", 472, "02", "Wataniya"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ML", 610, "01", "Malitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ML", 610, "02", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MT", 278, "01", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MT", 278, "21", "GO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MT", 278, "77", "Melita"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MQ", 340, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MQ", 340, "02", "Outremer"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MQ", 340, "20", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MR", 609, "01", "Mattel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MR", 609, "02", "Chinguitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MR", 609, "10", "Mauritel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MU", 617, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MU", 617, "02", "MTML"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MU", 617, "10", "Emtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MX", 334, "010", "Nextel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MX", 334, "020", "Telcel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MX", 334, "030", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MX", 334, "040", "Iusacell / Unefon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MX", 334, "050", "Iusacell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("FM", 550, "01", "FSM EMMANUEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MD", 259, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MD", 259, "02", "Moldcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MD", 259, "03", "IDC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MD", 259, "03", "Unité"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MD", 259, "04", "Eventis"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MD", 259, "05", "Unité"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MD", 259, "99", "Unité"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MC", 212, "01", "Office des Telephones"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MN", 428, "99", "MobiCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MN", 428, "88", "Unitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MN", 428, "91", "Skytel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MN", 428, "98", "G.Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ME", 297, "01", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ME", 297, "02", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ME", 297, "03", "m:tel CG"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ME", 297, "04", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MA", 604, "00", "Méditel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MA", 604, "01", "IAM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MA", 604, "05", "INWI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MZ", 643, "01", "mCel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MZ", 643, "04", "Vodacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("MM", 414, "01", "MPT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NA", 649, "01", "MTC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NA", 649, "02", "switch"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NA", 649, "03", "Leo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NR", 536, "02", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NP", 429, "01", "Namaste / NT Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NP", 429, "02", "Ncell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NP", 429, "04", "SmartCell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NP", 429, "03", "Sky/C-Phone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "01", "VastMobiel B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "02", "Tele2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "03", "Voiceworks B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "04", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "05", "Elephant Talk Communications Premium Rate Services"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "06", "Mundio Mobile (Netherlands) Ltd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "07", "Teleena (MVNE)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "08", "KPN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "09", "Lycamobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "10", "KPN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "12", "Telfort"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "13", "Unica Installatietechniek B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "14", "6Gmobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "15", "Ziggo B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "16", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "17", "Intercity Mobile Communications B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "18", "UPC Nederland B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "19", "Mixe Communication Solutions B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "20", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "21", "ProRail B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "22", "Ministerie van Defensie"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "23", "ASPIDER Solutions Nederland B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "24", "Private Mobility Nederland B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "25", "CapX B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "26", "SpeakUp B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "27", "Breezz Nederland B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "67", "RadioAccess B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "68", "Unify Group Holding B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NL", 204, "69", "KPN Mobile The Netherlands B.V."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AN", 362, "51", "Telcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AN", 362, "69", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AN", 362, "91", "UTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AN", 362, "95", "MIO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AN", 362, "94", "Bayòs"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NC", 546, "01", "Mobilis"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NZ", 530, "00", "Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NZ", 530, "01", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NZ", 530, "02", "Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NZ", 530, "03", "Woosh"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NZ", 530, "04", "TelstraClear"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NZ", 530, "05", "XT Mobile Network"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NZ", 530, "24", "2degrees"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NI", 710, "21", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NI", 710, "30", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NI", 710, "73", "SERCOM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NE", 614, "01", "SahelCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NE", 614, "02", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NE", 614, "03", "Telecel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NE", 614, "04", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NG", 621, "20", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NG", 621, "30", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NG", 621, "40", "M-Tel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NG", 621, "50", "Glo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NG", 621, "60", "Etisalat"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NG", 621, "25", "Visafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NU", 555, "01", "Telecom Niue"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NF", 505, "10", "Norfolk Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "01", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "02", "NetCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "03", "Teletopia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "04", "Tele2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "05", "Network Norway"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "06", "Ice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "07", "Ventelo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "08", "TDC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "09", "Com4"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "11", "SystemNet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "20", "Jernbaneverket AS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("NO", 242, "23", "Lyca"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("OM", 422, "02", "Oman Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("OM", 422, "03", "Nawras"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PK", 410, "01", "Mobilink"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PK", 410, "03", "Ufone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PK", 410, "04", "Zong"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PK", 410, "06", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PK", 410, "07", "Warid"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PW", 552, "01", "PNCC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PW", 552, "80", "Palau Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PS", 425, "05", "Jawwal"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PS", 425, "06", "Wataniya"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PA", 714, "01", "Cable & Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PA", 714, "02", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PA", 714, "04", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PA", 714, "03", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PG", 537, "01", "B-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PG", 537, "03", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PY", 744, "01", "VOX"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PY", 744, "02", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PY", 744, "04", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PY", 744, "05", "Personal"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PY", 744, "06", "Copaco"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PE", 716, "06", "Movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PE", 716, "07", "NEXTEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PE", 716, "10", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PH", 515, "01", "Islacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PH", 515, "02", "Globe"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PH", 515, "03", "Smart"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PH", 515, "05", "Sun"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PH", 515, "11", "PLDT via ACeS Philippines"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PH", 515, "18", "Cure"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PH", 515, "88", "Nextel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "01", "Plus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "02", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "03", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "04", "not in use"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "05", "Polska Telefonia Komórkowa Centertel Sp. z o.o."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "06", "Play"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "07", "Netia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "08", "E-Telko Sp. z o.o."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "09", "Telekomunikacja Kolejowa Sp. z o.o."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "10", "Sferia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "11", "Nordisk Polska"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "12", "Cyfrowy Polsat"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "15", "CenterNet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "16", "Mobyland"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PL", 260, "17", "Aero2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PT", 268, "01", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PT", 268, "03", "Optimus"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PT", 268, "06", "TMN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PT", 268, "21", "Zapp"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PR", 330, "110", "Claro"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PR", 330, "00", "Open Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("QA", 427, "01", "Qtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("QA", 427, "02", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("QA", 427, "05", "Ministry of Interior"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RE", 647, "00", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RE", 647, "02", "Outremer"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RE", 647, "10", "SFR Reunion"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RO", 226, "01", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RO", 226, "02", "Romtelecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RO", 226, "03", "Cosmote"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RO", 226, "04", "Cosmote"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RO", 226, "05", "Digi.Mobil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RO", 226, "06", "Cosmote"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RO", 226, "10", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RO", 226, "11", "Enigma-System"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "01", "MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "02", "MegaFon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "03", "NCC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "04", "Sibchallenge"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "05", "ETK"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "06", "Skylink [10]"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "07", "SMARTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "09", "Skylink"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "10", "DTC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "11", "Orensot"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "12", "Baykalwestcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "12", "Akos"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "13", "KUGSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "15", "SMARTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "16", "NTC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "17", "Utel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "19", "INDIGO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "20", "Tele2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "23", "Mobicom - Novosibirsk"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "28", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "35", "MOTIV"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "38", "Tambov GSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "39", "Utel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "44", "Stavtelesot / North Caucasian GSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "92", "Primtelefon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "93", "Telecom XXI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RU", 250, "99", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RW", 635, "10", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RW", 635, "12", "Rwandatel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RW", 635, "13", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SKN", 356, "050", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SKN", 356, "110", "LIME"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SKN", 356, "070", "Chippie"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LC", 358, "050", "Digicel[citation needed]"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LC", 358, "110", "Cable & Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("PM", 308, "01", "Ameris"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VC", 360, "070", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VC", 360, "100", "Cingular Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VC", 360, "110", "Cable & Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("WS", 549, "01", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("WS", 549, "27", "SamoaTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SM", 292, "01", "PRIMA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ST", 626, "01", "CSTmovel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SA", 420, "01", "Al Jawal"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SA", 420, "03", "Mobily"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SA", 420, "04", "Zain SA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SN", 608, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SN", 608, "02", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SN", 608, "03", "Expresso"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RS", 220, "01", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RS", 220, "02", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RS", 220, "03", "mt:s"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("RS", 220, "05", "VIP"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SC", 633, "01", "Cable & Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SC", 633, "02", "Mediatech International"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SC", 633, "10", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SL", 619, "01", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SL", 619, "02", "Tigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SL", 619, "03", "Africell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SL", 619, "04", "Comium"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SL", 619, "05", "Africell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SL", 619, "25", "Mobitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SG", 525, "01", "SingTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SG", 525, "02", "SingTel-G18"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SG", 525, "03", "M1"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SG", 525, "05", "StarHub"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SG", 525, "12", "Digital Trunked Radio Network"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SK", 231, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SK", 231, "02", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SK", 231, "03", "Unient Communications"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SK", 231, "04", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SK", 231, "06", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SK", 231, "99", "ŽSR"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SI", 293, "40", "Si.mobil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SI", 293, "41", "Mobitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SI", 293, "64", "T-2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SI", 293, "70", "TuÅ¡mobil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SB", 540, "01", "BREEZE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SO", 637, "60", "Nationlink Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SO", 637, "01", "Telesom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SO", 637, "04", "Somafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SO", 637, "10", "Nationlink"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SO", 637, "25", "Hormuud"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SO", 637, "30", "Golis"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SO", 637, "82", "Telcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "01", "Vodacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "02", "Telkom Mobile / 8.ta"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "06", "Sentech"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "07", "Cell C"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "10", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "11", "South African Police Service Gauteng"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "13", "Neotel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "21", "Cape Town Metropolitan Council"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "30", "Bokamoso Consortium"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "31", "Karabo Telecoms (Pty) Ltd."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "32", "Ilizwi Telecommunications"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZA", 655, "33", "Thinta Thinta Telecommunications"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 250, "30", "Megafon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "01", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "03", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "04", "Yoigo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "05", "TME"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "06", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "07", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "08", "Euskaltel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "09", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "15", "BT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "16", "TeleCable"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "17", "Móbil R"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "18", "ONO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "19", "Simyo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "20", "Fonyou"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "21", "Jazztel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "22", "DigiMobil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "23", "Barablu"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "24", "Eroski"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ES", 214, "25", "LycaMobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LK", 413, "01", "Mobitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LK", 413, "02", "Dialog"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LK", 413, "03", "Etisalat"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LK", 413, "05", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("LK", 413, "08", "Hutch"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SD", 634, "01", "Zain SD"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SD", 634, "02", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SD", 634, "05", "Vivacell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SD", 634, "07", "Sudani One"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SR", 746, "02", "Telesur"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SR", 746, "03", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SR", 746, "04", "Uniqa"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SZ", 653, "10", "Swazi MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "01", "Telia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "02", "3"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "03", "Ice.net"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "04", "3G Infrastructure Services"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "05", "Sweden 3G"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "06", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "07", "Tele2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "08", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "09", "djuice"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "10", "Spring Mobil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "11", "Lindholmen Science Park"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "12", "Barablu Mobile Scandinavia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "13", "Ventelo Sverige"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "14", "TDC Mobil"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "15", "Wireless Maingate Nordic"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "16", "42IT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "17", "Gotanet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "20", "Wireless Maingate Message Services"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "21", "MobiSir"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "24", "Sweden 2G"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "25", "DigiTelMobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "26", "Beepsend"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SE", 240, "33", "Mobile Arts AB"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "01", "Swisscom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "02", "Sunrise"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "03", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "05", "Togewanet AG (Comfone)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "06", "SBB-CFF-FFS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "07", "IN&Phone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "08", "Tele2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "50", "3G Mobile AG"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("CH", 228, "51", "BebbiCell AG"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SY", 417, "01", "Syriatel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("SY", 417, "02", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "01", "FarEasTone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "05", "APTG"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "06", "Tuntex"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "11", "Chunghwa LDM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "88", "KG Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "89", "VIBO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "92", "Chungwa"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "93", "MobiTai"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "97", "Taiwan Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TW", 466, "99", "TransAsia"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TJ", 436, "01", "Tcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TJ", 436, "02", "Tcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TJ", 436, "03", "MLT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TJ", 436, "04", "Babilon-M"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TJ", 436, "05", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TJ", 436, "12", "Tcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "02", "tiGO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "03", "Zantel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "04", "Vodacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "05", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "06", "Sasatel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "07", "TTCL Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "08", "Benson Online (BOL)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "09", "Hits"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TZ", 640, "11", "SmileCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TH", 520, "00", "my CAT 3G+"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TH", 520, "01", "AIS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TH", 520, "02", "CAT CDMA"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TH", 520, "10", "WCS IQ"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TH", 520, "15", "TOT 3G"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TH", 520, "18", "dtac"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TH", 520, "23", "AIS GSM 1800"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TH", 520, "99", "True Move"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TG", 615, "01", "Togo Cell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TG", 615, "03", "Moov"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TO", 539, "01", "Tonga Communications Corporation"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TO", 539, "43", "Shoreline Communication"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TO", 539, "88", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TT", 374, "12", "bmobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TT", 374, "130", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TN", 605, "01", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TN", 605, "02", "Tunicell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TN", 605, "03", "Tunisiana"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TR", 286, "01", "Turkcell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TR", 286, "02", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TR", 286, "03", "Avea"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TR", 286, "04", "Aycell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TM", 438, "01", "MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TM", 438, "02", "TM-Cell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TC", 376, "350", "C&W"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TC", 376, "352", "Islandcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TC", 338, "05", "Digicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("TV", 553, "01", "TTC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UG", 641, "01", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UG", 641, "10", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UG", 641, "11", "UTL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UG", 641, "14", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UG", 641, "22", "Warid Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "01", "MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "02", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "03", "Kyivstar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "04", "IT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "05", "Golden Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "06", "life:)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "07", "Ukrtelecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "21", "PEOPLEnet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UA", 255, "23", "CDMA Ukraine"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AE", 424, "02", "Etisalat"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("AE", 424, "03", "du"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "00", "BT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "01", "Vectone Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "02", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "03", "Airtel-Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "04", "FMS Solutions Ltd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "05", "COLT Mobile Telecommunications Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "06", "Internet Computer Bureau Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "07", "Cable & Wireless UK"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "08", "OnePhone (UK) Ltd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "09", "Tismi BV"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "10", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "11", "O2"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "12", "Railtrack"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "13", "Railtrack"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "14", "Hay Systems Ltd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "15", "Vodafone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "16", "Talk Talk"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "17", "FleXtel Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "18", "Cloud9"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "19", "Private Mobile Networks PMN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "20", "Three"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "22", "RoutoMessaging"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "24", "Greenfone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "25", "Truphone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "30", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "31", "Virgin"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "32", "Virgin"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "33", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "34", "Orange"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "35", "JSC Ingenium (UK) Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "36", "Cable and Wireless Isle of Man Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "37", "Synectiv Ltd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "50", "JT-Wave"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "55", "Cable & Wireless Guernsey / Sure Mobile (Jersey)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "58", "Manx Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "76", "BT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 234, "78", "Airwave"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 235, "00", "Mundio Mobile Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 235, "01", "Everything Everywhere Limited (TM)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 235, "02", "Everything Everywhere Limited (TM)"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 235, "77", "BT"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 235, "91", "Vodafone United Kingdom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 235, "92", "Cable & Wireless UK"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 235, "94", "Hutchison 3G UK Ltd"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UK", 235, "95", "Network Rail Infrastructure Limited"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "053", "Virgin Mobile US"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "054", "Alltel US"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "066", "U.S. Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "004", "Verizon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "005", "Verizon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "010", "MCI"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "012", "Verizon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "013", "MobileTel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "014", "Testing"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "016", "Cricket Communications"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "017", "North Sight Communications Inc."); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "020", "Union Telephone Company"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "026", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "030", "Centennial"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "034", "Airpeak"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "040", "Concho"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "046", "SIMMETRY"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "060", "Consolidated Telcom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "070", "Highland Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "080", "Corr"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "090", "AT&T"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "100", "Plateau Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "110", "PTI Pacifica"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "120", "Sprint"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "150", "AT&T"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "160", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "170", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "180", "West Central"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "190", "Dutch Harbor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "200", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "210", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "220", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "230", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "240", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "250", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "260", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "270", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "280", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "290", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "300", "iSmart Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "310", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "311", "Farmers Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "320", "Cellular One"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "330", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "340", "Westlink"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "350", "Carolina Phone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "380", "AT&T"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "390", "Cellular One of East Texas"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "400", "i CAN_GSM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "410", "AT&T"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "420", "Cincinnati Bell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "430", "Alaska Digitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "440", "Cellular One"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "450", "Viaero"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "460", "Simmetry"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "470", "nTelos"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "480", "Choice Phone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "490", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "500", "Alltel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "510", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "520", "VeriSign"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "530", "West Virginia Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "540", "Oklahoma Western"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "560", "AT&T"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "570", "Cellular One"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "580", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "590", "Alltel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "610", "Epic Touch"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "620", "Coleman County Telecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "630", "AmeriLink PCS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "640", "Airadigm"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "650", "Jasper"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "660", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "670", "Northstar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "680", "AT&T"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "690", "Conestoga"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "730", "SeaMobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "740", "Convey"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "760", "Panhandle"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "770", "i wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "780", "Airlink PCS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "790", "PinPoint"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "800", "T-Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "830", "Caprock"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "840", "telna Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "850", "Aeris"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "870", "PACE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "880", "Advantage"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "890", "Unicel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "900", "Mid-Rivers Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "910", "First Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "940", "Iris Wireless LLC"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "950", "XIT Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "960", "Plateau Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "970", "Globalstar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "980", "AT&T Mobility"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 310, "990", "AT&T Mobility"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "000", "Mid-Tex Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "010", "Chariton Valley"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "020", "Missouri RSA 5 Partnership"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "030", "Indigo Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "040", "Commnet Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "050", "Wikes Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "060", "Farmers Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "070", "Easterbrooke"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "080", "Pine Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "090", "Long Lines Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "100", "High Plains Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "110", "High Plains Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "120", "Choice Phone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "130", "Cell One Amarillo"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "140", "Sprocket"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "150", "Wilkes Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "160", "Endless Mountains Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "170", "PetroCom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "180", "Cingular Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "190", "Cellular Properties"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "210", "Emery Telcom Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "220", "U.S. Cellular"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "230", "C Spire Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "330", "Bug Tussel Wireless"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "480", "Verizon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 311, "660", "metroPCS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 316, "010", "Nextel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("US", 316, "011", "Southern Communications Services"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UY", 748, "01", "Antel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UY", 748, "07", "Movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UY", 748, "10", "Claro UY"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UZ", 434, "01", "Buztel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UZ", 434, "02", "Uzmacom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UZ", 434, "04", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UZ", 434, "05", "Ucell"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UZ", 434, "06", "Perfectum Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("UZ", 434, "07", "MTS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VU", 541, "01", "SMILE"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VE", 734, "01", "Digitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VE", 734, "02", "Digitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VE", 734, "03", "Digitel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VE", 734, "04", "movistar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VE", 734, "06", "Movilnet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VN", 452, "01", "MobiFone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VN", 452, "02", "Vinaphone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VN", 452, "03", "S-Fone"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VN", 452, "04", "Viettel Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VN", 452, "05", "Vietnamobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VN", 452, "06", "EVNTelecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VN", 452, "08", "3G EVNTelecom"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("VN", 452, "07", "Beeline VN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("YE", 421, "01", "SabaFon"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("YE", 421, "02", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("YE", 421, "03", "Yemen Mobile"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("YE", 421, "04", "HiTS-UNITEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZM", 645, "01", "Airtel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZM", 645, "02", "MTN"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZM", 645, "03", "ZAMTEL"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZW", 648, "01", "Net*One"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZW", 648, "03", "Telecel"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("ZW", 648, "04", "Econet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "01", "ICO"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "02", "Sense Communications International"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "03", "Iridium"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "04", "Globalstar"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "05", "Thuraya RMSS Network"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "06", "Thuraya Satellite Telecommunications Company"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "07", "Ellipso"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "08", ""); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "09", "Tele1 Europe"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "10", "ACeS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "11", "Inmarsat"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "12", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "13", "GSM.AQ"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "14", "AeroMobile AS"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "15", "OnAir Switzerland Sarl"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "16", "Jasper Systems"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "17", "Navitas"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "18", "Cellular @Sea"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "19", "Vodafone Malta Maritime"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "21", "Seanet"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "23", "Beeline"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "24", "iNum"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "26", "TIM"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "29", "Telenor"); -insert into mcc_mnc_oper_list (country, mcc, mnc, oper) values ("__", 901, "32", "Sky High"); -COMMIT; diff --git a/src/desc_imc.c b/src/desc_imc.c index 90b57d9..bbbf711 100644 --- a/src/desc_imc.c +++ b/src/desc_imc.c @@ -58,11 +58,10 @@ static void on_response_bootup_subscription(TcorePending *p, const TcoreATResponse *resp = data; dbg("Entry"); - if (resp->success > 0) { + if (resp->success > 0) dbg("RESULT - OK"); - } else { + else err("RESULT - ERROR"); - } } static void on_response_last_bootup_subscription(TcorePending *p, @@ -73,11 +72,10 @@ static void on_response_last_bootup_subscription(TcorePending *p, gboolean ret; dbg("Last Subscription - COMPLETED"); - if (resp->success) { + if (resp->success) dbg("RESULT - OK"); - } else { + else err("RESULT - FAIL"); - } dbg("Boot-up configration completed for IMC modem. %s", "Bring CP to ONLINE state based on Flightmode status"); diff --git a/src/imc_call.c b/src/imc_call.c index 99666b1..3b4b909 100644 --- a/src/imc_call.c +++ b/src/imc_call.c @@ -49,12 +49,12 @@ static gboolean setsoundpath = FALSE; static gboolean soundvolume = FALSE; -// End Cause field - Call state end cause +/* End Cause field - Call state end cause */ typedef enum { CALL_END_NO_CAUSE, - // These definitions are taken from GSM 04.08 Table 10.86 + /* These definitions are taken from GSM 04.08 Table 10.86 */ CC_CAUSE_UNASSIGNED_NUMBER, CC_CAUSE_NO_ROUTE_TO_DEST, @@ -106,7 +106,7 @@ typedef enum { CC_CAUSE_INTERWORKING_UNSPECIFIED, CC_CAUSE_END = 128, - // Reject causes + /* Reject causes */ REJECT_CAUSE_IMSI_UNKNOWN_IN_HLR, REJECT_CAUSE_ILLEGAL_MS, REJECT_CAUSE_IMSI_UNKNOWN_IN_VLR, @@ -142,10 +142,10 @@ typedef enum { REJECT_CAUSE_MSG_NOT_COMPATIBLE_PROTOCOL_STATE, - // Connection Management establishment rejection cause + /* Connection Management establishment rejection cause */ REJECT_CAUSE_REJ_UNSPECIFIED, - // AS reject causes + /* AS reject causes */ REJECT_CAUSE_AS_REJ_RR_REL_IND, REJECT_CAUSE_AS_REJ_RR_RANDOM_ACCESS_FAILURE, REJECT_CAUSE_AS_REJ_RRC_REL_IND, @@ -155,18 +155,18 @@ typedef enum { REJECT_CAUSE_AS_REJ_LOW_LEVEL_FAIL_REDIAL_NOT_ALLOWED, REJECT_CAUSE_AS_REJ_LOW_LEVEL_IMMED_RETRY, - // MM reject causes + /* MM reject causes */ REJECT_CAUSE_MM_REJ_INVALID_SIM, REJECT_CAUSE_MM_REJ_NO_SERVICE, REJECT_CAUSE_MM_REJ_TIMER_T3230_EXP, REJECT_CAUSE_MM_REJ_NO_CELL_AVAILABLE, REJECT_CAUSE_MM_REJ_WRONG_STATE, REJECT_CAUSE_MM_REJ_ACCESS_CLASS_BLOCKED, - // Definitions for release ind causes between MM and CNM + /* Definitions for release ind causes between MM and CNM */ REJECT_CAUSE_ABORT_MSG_RECEIVED, REJECT_CAUSE_OTHER_CAUSE, - // CNM reject causes + /* CNM reject causes */ REJECT_CAUSE_CNM_REJ_TIMER_T303_EXP, REJECT_CAUSE_CNM_REJ_NO_RESOURCES, REJECT_CAUSE_CNM_MM_REL_PENDING, @@ -206,10 +206,9 @@ static void _call_status_incoming(TcorePlugin *p, CallObject *co); static void _call_status_waiting(TcorePlugin *p, CallObject *co); static TReturn _call_list_get(CoreObject *o, gboolean *event_flag); /* Todo Need to check whether this api is required */ -//static TReturn _set_dtmf_tone_duration(CoreObject *o, UserRequest *ur); /************************* CONFIRMATION ***************************/ -static void on_confirmation_call_message_send(TcorePending *p, gboolean result, void *user_data); // from Kernel +static void on_confirmation_call_message_send(TcorePending *p, gboolean result, void *user_data); /* from Kernel */ static void on_confirmation_call_hold(TcorePending *p, int data_len, const void *data, void *user_data); static void on_confirmation_call_swap(TcorePending *p, int data_len, const void *data, void *user_data); static void on_confirmation_call_split(TcorePending *p, int data_len, const void *data, void *user_data); @@ -217,7 +216,6 @@ static void on_confirmation_call_hold_and_accept(TcorePending *p, int data_len, static void _on_confirmation_call_release(TcorePending *p, int data_len, const void *data, void *user_data, int type); static void _on_confirmation_call(TcorePending *p, int data_len, const void *data, void *user_data, int type); -//static void _on_confirmation_dtmf_tone_duration(TcorePending *p, int data_len, const void *data, void *user_data); static void _on_confirmation_call_end_cause(TcorePending *p, int data_len, const void *data, void *user_data); /************************* RESPONSES ***************************/ @@ -242,7 +240,7 @@ static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call); * Local Function Definitions **************************************************************************/ -const call_end_cause_info call_end_cause_table[] = // call end cause table to convert Netwotk cause to TAPI cause +const call_end_cause_info call_end_cause_table[] = /* call end cause table to convert Netwotk cause to TAPI cause */ { { 1, CC_CAUSE_UNASSIGNED_NUMBER}, { 3, CC_CAUSE_NO_ROUTE_TO_DEST}, { 6, CC_CAUSE_CHANNEL_UNACCEPTABLE}, { 8, CC_CAUSE_OPERATOR_DETERMINED_BARRING}, @@ -293,7 +291,7 @@ static enum tcore_call_status _call_status(unsigned int status) case 5: return TCORE_CALL_STATUS_WAITING; - case 6: // DISCONNECTED state // FALL THROUGH + case 6: /* DISCONNECTED state - FALL THROUGH */ default: return TCORE_CALL_STATUS_IDLE; } @@ -351,7 +349,7 @@ static gboolean on_notification_call_clip_info(CoreObject *o, const void *data, { dbg("Entry"); - // TODO + /* TODO */ return TRUE; } @@ -403,7 +401,7 @@ static gboolean on_notification_call_info(CoreObject *o, const void *data, void } } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); OUT: @@ -424,20 +422,19 @@ static gboolean _call_request_message(TcorePending *pending, tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); - if (on_resp) { + if (on_resp) tcore_pending_set_response_callback(pending, on_resp, user_data); - } + tcore_pending_set_send_callback(pending, on_confirmation_call_message_send, NULL); - if (ur) { + if (ur) tcore_pending_link_user_request(pending, ur); - } else { + else err("User Request is NULL, is this internal request??"); - } - // HAL + /* HAL */ hal = tcore_object_get_hal(o); - // Send request to HAL + /* Send request to HAL */ ret = tcore_hal_send_request(hal, pending); if (TCORE_RETURN_SUCCESS != ret) { err("Request send failed"); @@ -459,32 +456,38 @@ static void _call_status_idle(TcorePlugin *p, CallObject *co) dbg("Entry"); core_obj = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL); - dbg("Call ID [%d], Call Status [%d]", tcore_call_object_get_id(co), tcore_call_object_get_status(co)); + dbg("Call Handle [%d], Call Status [%d]", tcore_call_object_get_handle(co), tcore_call_object_get_status(co)); if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_IDLE) { - // get call end cause. + /* get call end cause. */ cmd_str = g_strdup_printf("%s", "AT+XCEER"); dbg("Request command string: %s", cmd_str); - // Create new Pending request + /* Create new Pending request */ pending = tcore_pending_new(core_obj, 0); - // Create new AT-Command request + /* Create new AT-Command request */ req = tcore_at_request_new(cmd_str, "+XCEER", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return; + } + dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd)); - // Free command string + /* Free command string */ g_free(cmd_str); - // Set request data (AT command) to Pending request + /* Set request data (AT command) to Pending request */ tcore_pending_set_request_data(pending, 0, req); ur = tcore_user_request_new(NULL, NULL); - // Send request + /* Send request */ ret = _call_request_message(pending, core_obj, ur, _on_confirmation_call_end_cause, co); if (!ret) { err("Failed to send AT-Command request"); - // free only UserRequest. + /* free only UserRequest. */ if (ur) { tcore_user_request_free(ur); ur = NULL; @@ -509,13 +512,13 @@ static void _call_status_dialing(TcorePlugin *p, CallObject *co) data.type = tcore_call_object_get_type(co); dbg("data.type : [%d]", data.type); - data.id = tcore_call_object_get_id(co); - dbg("data.id : [%d]", data.id); + data.handle = tcore_call_object_get_handle(co); + dbg("data.handle = %d", data.handle); - // Set Status + /* Set Status */ tcore_call_object_set_status(co, TCORE_CALL_STATUS_DIALING); - // Send notification to TAPI + /* Send notification to TAPI */ tcore_server_send_notification(tcore_plugin_ref_server(p), tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_DIALING, @@ -533,18 +536,18 @@ static void _call_status_alert(TcorePlugin *p, CallObject *co) dbg("Entry"); - // Alerting has just 1 data 'CALL ID' + /* Alerting has just 1 data 'CALL ID' */ if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_ALERT) { data.type = tcore_call_object_get_type(co); dbg("data.type : [%d]", data.type); - data.id = tcore_call_object_get_id(co); - dbg("data.id : [%d]", data.id); + data.handle = tcore_call_object_get_handle(co); + dbg("data.handle = %d", data.handle); - // Set Status + /* Set Status */ tcore_call_object_set_status(co, TCORE_CALL_STATUS_ALERT); - // Send notification to TAPI + /* Send notification to TAPI */ tcore_server_send_notification(tcore_plugin_ref_server(p), tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_ALERT, @@ -566,13 +569,13 @@ static void _call_status_active(TcorePlugin *p, CallObject *co) data.type = tcore_call_object_get_type(co); dbg("data.type : [%d]", data.type); - data.id = tcore_call_object_get_id(co); - dbg("data.id : [%d]", data.id); + data.handle = tcore_call_object_get_handle(co); + dbg("data.handle = %d", data.handle); - // Set Status + /* Set Status */ tcore_call_object_set_status(co, TCORE_CALL_STATUS_ACTIVE); - // Send notification to TAPI + /* Send notification to TAPI */ tcore_server_send_notification(tcore_plugin_ref_server(p), tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_ACTIVE, @@ -594,13 +597,13 @@ static void _call_status_held(TcorePlugin *p, CallObject *co) data.type = tcore_call_object_get_type(co); dbg("data.type : [%d]", data.type); - data.id = tcore_call_object_get_id(co); - dbg("data.id : [%d]", data.id); + data.handle = tcore_call_object_get_handle(co); + dbg("data.handle = %d", data.handle); - // Set Status + /* Set Status */ tcore_call_object_set_status(co, TCORE_CALL_STATUS_HELD); - // Send notification to TAPI + /* Send notification to TAPI */ tcore_server_send_notification(tcore_plugin_ref_server(p), tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_HELD, @@ -624,8 +627,8 @@ static void _call_status_incoming(TcorePlugin *p, CallObject *co) data.type = tcore_call_object_get_type(co); dbg("data.type : [%d]", data.type); - data.id = tcore_call_object_get_id(co); - dbg("data.id : [%d]", data.id); + data.handle = tcore_call_object_get_handle(co); + dbg("data.handle = %d", data.handle); data.cli.mode = tcore_call_object_get_cli_mode(co); dbg("data.cli.mode : [%d]", data.cli.mode); @@ -639,12 +642,12 @@ static void _call_status_incoming(TcorePlugin *p, CallObject *co) tcore_call_object_get_name(co, data.cna.name); dbg("data.cna.name : [%s]", data.cna.name); - data.forward = FALSE; // this is tmp code + data.forward = FALSE; /* this is tmp code */ data.active_line = tcore_call_object_get_active_line(co); dbg("data.active_line : [%d]", data.active_line); - // Send notification to TAPI + /* Send notification to TAPI */ tcore_server_send_notification(tcore_plugin_ref_server(p), tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_INCOMING, @@ -718,16 +721,24 @@ static TReturn _call_list_get(CoreObject *o, gboolean *event_flag) return TCORE_RETURN_FAILURE; } - // Create new User Request + /* Create new User Request */ ur = tcore_user_request_new(NULL, NULL); - // Command string + /* Command string */ cmd_str = g_strdup("AT+CLCC"); - // Create new Pending Request + /* Create new Pending Request */ pending = tcore_pending_new(o, 0); req = tcore_at_request_new(cmd_str, "+CLCC", TCORE_AT_MULTILINE); - + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + if (ur) { + tcore_user_request_free(ur); + ur = NULL; + } + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -737,7 +748,7 @@ static TReturn _call_list_get(CoreObject *o, gboolean *event_flag) ret = _call_request_message(pending, o, ur, on_response_call_list_get, event_flag); if (!ret) { err("AT request (%s) sending failed", req->cmd); - // free only UserRequest. + /* free only UserRequest. */ if (ur) { tcore_user_request_free(ur); ur = NULL; @@ -749,12 +760,12 @@ static TReturn _call_list_get(CoreObject *o, gboolean *event_flag) return TCORE_RETURN_SUCCESS; } -// CONFIRMATION +/* CONFIRMATION */ static void on_confirmation_call_message_send(TcorePending *p, gboolean result, void *user_data) { dbg("Entry"); - if (result == FALSE) { // Fail + if (result == FALSE) { /* Fail */ dbg("SEND FAIL"); } else { dbg("SEND OK"); @@ -776,9 +787,12 @@ static void call_prepare_and_send_pending_request(CoreObject *co, const char *at pending = tcore_pending_new(co, 0); if (!pending) - dbg("Pending is NULL"); + return; req = tcore_at_request_new(at_cmd, prefix, at_cmd_type); - + if (req == NULL) { + tcore_pending_free(pending); + return; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); @@ -816,15 +830,15 @@ static void on_confirmation_call_outgoing(TcorePending *p, int data_len, const v } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = CALL_ERROR_SERVICE_UNAVAIL; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } - // Send Response to TAPI + /* Send Response to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_DIAL, sizeof(struct tresp_call_dial), &resp); } else { err("User Request is NULL"); @@ -861,17 +875,17 @@ static void on_confirmation_call_accept(TcorePending *p, int data_len, const voi } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = CALL_ERROR_SERVICE_UNAVAIL; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); - // Send Response to TAPI + /* Send Response to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp); } else { err("User Request is NULL"); @@ -909,17 +923,17 @@ static void on_confirmation_call_reject(TcorePending *p, int data_len, const voi } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = CALL_ERROR_SERVICE_UNAVAIL; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); - // Send Response to TAPI + /* Send Response to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp); } else { err("User Request is NULL"); @@ -955,16 +969,16 @@ static void on_confirmation_call_replace(TcorePending *p, int data_len, const vo } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = CALL_ERROR_SERVICE_UNAVAIL; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); - // Send Response to TAPI + /* Send Response to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp); } else { dbg("User Request is NULL"); @@ -988,7 +1002,7 @@ static void on_confirmation_call_hold_and_accept(TcorePending *p, int data_len, o = tcore_pending_ref_core_object(p); ur = tcore_pending_ref_user_request(p); - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); if (ur) { if (response->success > 0) { @@ -1005,21 +1019,21 @@ static void on_confirmation_call_hold_and_accept(TcorePending *p, int data_len, } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = CALL_ERROR_SERVICE_UNAVAIL; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } - // Send response to TAPI + /* Send response to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp); if (!resp.err) { GSList *list = 0; CallObject *co = NULL; - // Active Call + /* Active Call */ list = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_ACTIVE); if (!list) { err("Can't find active Call"); @@ -1032,7 +1046,7 @@ static void on_confirmation_call_hold_and_accept(TcorePending *p, int data_len, return; } - // Set Call Status + /* Set Call Status */ tcore_call_object_set_status(co, TCORE_CALL_STATUS_HELD); dbg("Call status is set to HELD"); } @@ -1071,17 +1085,17 @@ static void _on_confirmation_call_release(TcorePending *p, int data_len, const v } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = CALL_ERROR_SERVICE_UNAVAIL; } tcore_at_tok_free(tokens); } resp.type = type; - resp.id = tcore_call_object_get_id((CallObject *) user_data); - dbg("resp.type = %d resp.id= %d", resp.type, resp.id); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); + dbg("resp.type = %d resp.handle= %d", resp.type, resp.handle); - // Send reponse to TAPI + /* Send reponse to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_END, sizeof(struct tresp_call_end), &resp); } else { err("User Request is NULL"); @@ -1091,19 +1105,18 @@ static void _on_confirmation_call_release(TcorePending *p, int data_len, const v return; } -// RESPONSE +/* RESPONSE */ static void on_confirmation_call_endall(TcorePending *p, int data_len, const void *data, void *user_data) { - // skip response handling - actual result will be handled in on_confirmation_call_release_all + /* skip response handling - actual result will be handled in on_confirmation_call_release_all */ const TcoreATResponse *response = data; dbg("Entry"); - if (response->success > 0) { + if (response->success > 0) dbg("RESPONSE OK"); - } else { + else err("RESPONSE NOT OK"); - } dbg("Exit"); return; @@ -1169,11 +1182,11 @@ static void _on_confirmation_call(TcorePending *p, int data_len, const void *dat } else { error = atoi(g_slist_nth_data(tokens, 0)); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ error = CALL_ERROR_SERVICE_UNAVAIL; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } @@ -1184,9 +1197,9 @@ static void _on_confirmation_call(TcorePending *p, int data_len, const void *dat struct tresp_call_hold resp; resp.err = error; - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); dbg("call hold response"); - // Send reponse to TAPI + /* Send reponse to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_HOLD, sizeof(struct tresp_call_hold), &resp); } break; @@ -1196,9 +1209,9 @@ static void _on_confirmation_call(TcorePending *p, int data_len, const void *dat struct tresp_call_active resp; resp.err = error; - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); dbg("call active response"); - // Send reponse to TAPI + /* Send reponse to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_ACTIVE, sizeof(struct tresp_call_active), &resp); } break; @@ -1208,10 +1221,10 @@ static void _on_confirmation_call(TcorePending *p, int data_len, const void *dat struct tresp_call_join resp; resp.err = error; - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); dbg("call join response"); - // Send reponse to TAPI + /* Send reponse to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_JOIN, sizeof(struct tresp_call_join), &resp); } break; @@ -1221,21 +1234,33 @@ static void _on_confirmation_call(TcorePending *p, int data_len, const void *dat struct tresp_call_split resp; resp.err = error; - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); dbg("call split response"); - // Send reponse to TAPI + /* Send reponse to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_SPLIT, sizeof(struct tresp_call_split), &resp); } break; + case TRESP_CALL_SWAP: + { + struct tresp_call_swap resp; + + resp.err = error; + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); + dbg("call swap response"); + /* Send reponse to TAPI */ + tcore_user_request_send_response(ur, TRESP_CALL_SWAP, sizeof(struct tresp_call_swap), &resp); + } + break; + case TRESP_CALL_DEFLECT: { struct tresp_call_deflect resp; resp.err = error; - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); dbg("call deflect response"); - // Send reponse to TAPI + /* Send reponse to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_DEFLECT, sizeof(struct tresp_call_deflect), &resp); } @@ -1246,9 +1271,9 @@ static void _on_confirmation_call(TcorePending *p, int data_len, const void *dat struct tresp_call_transfer resp; resp.err = error; - resp.id = tcore_call_object_get_id((CallObject *) user_data); + resp.handle = tcore_call_object_get_handle((CallObject *) user_data); dbg("call transfer response"); - // Send reponse to TAPI + /* Send reponse to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_TRANSFER, sizeof(struct tresp_call_transfer), &resp); } break; @@ -1258,8 +1283,19 @@ static void _on_confirmation_call(TcorePending *p, int data_len, const void *dat struct tresp_call_dtmf resp; resp.err = error; - dbg("call dtmf response"); - // Send reponse to TAPI + dbg("call start cont dtmf response"); + /* Send reponse to TAPI */ + tcore_user_request_send_response(ur, TRESP_CALL_START_CONT_DTMF, sizeof(struct tresp_call_dtmf), &resp); + } + break; + + case TRESP_CALL_STOP_CONT_DTMF: + { + struct tresp_call_dtmf resp; + + resp.err = error; + dbg("call stop cont dtmf response"); + /* Send reponse to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_START_CONT_DTMF, sizeof(struct tresp_call_dtmf), &resp); } break; @@ -1272,13 +1308,13 @@ static void _on_confirmation_call(TcorePending *p, int data_len, const void *dat } if ((type == TRESP_CALL_HOLD) || (type == TRESP_CALL_ACTIVE) || (type == TRESP_CALL_JOIN) - || (type == TRESP_CALL_SPLIT)) { + || (type == TRESP_CALL_SPLIT) || (type == TRESP_CALL_SWAP)) { if (!error) { CoreObject *core_obj = NULL; gboolean *eflag = g_new0(gboolean, 1); core_obj = tcore_pending_ref_core_object(p); - *eflag = FALSE; + *eflag = TRUE; dbg("Calling _call_list_get"); _call_list_get(core_obj, eflag); @@ -1337,7 +1373,7 @@ static void on_confirmation_call_transfer(TcorePending *p, int data_len, const v return; } -static void on_confirmation_call_dtmf(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_confirmation_call_start_cont_dtmf(TcorePending *p, int data_len, const void *data, void *user_data) { dbg("Entry"); _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_START_CONT_DTMF); @@ -1345,6 +1381,14 @@ static void on_confirmation_call_dtmf(TcorePending *p, int data_len, const void return; } +static void on_confirmation_call_stop_cont_dtmf(TcorePending *p, int data_len, const void *data, void *user_data) +{ + dbg("Entry"); + _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_STOP_CONT_DTMF); + + return; +} + #if 0 static void _on_confirmation_dtmf_tone_duration(TcorePending *p, int data_len, const void *data, void *user_data) { @@ -1367,10 +1411,10 @@ static void _on_confirmation_dtmf_tone_duration(TcorePending *p, int data_len, c error = CALL_ERROR_SERVICE_UNAVAIL; } else { error = atoi(g_slist_nth_data(tokens, 0)); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } @@ -1381,103 +1425,9 @@ static void _on_confirmation_dtmf_tone_duration(TcorePending *p, int data_len, c static void on_confirmation_call_swap(TcorePending *p, int data_len, const void *data, void *user_data) { - CoreObject *core_obj = NULL; - UserRequest *ur = NULL; - const TcoreATResponse *response = data; - struct tresp_call_swap resp; - GSList *tokens = NULL; - const char *line = NULL; - dbg("Entry"); - core_obj = tcore_pending_ref_core_object(p); - ur = tcore_pending_ref_user_request(p); - - if (ur) { - if (response->success > 0) { - dbg("RESPONSE OK"); - resp.err = CALL_ERROR_NONE; - } else { - err("RESPONSE NOT OK"); - line = (const char *) response->final_response; - tokens = tcore_at_tok_new(line); - if (g_slist_length(tokens) < 1) { - err("err cause not specified or string corrupted"); - resp.err = CALL_ERROR_SERVICE_UNAVAIL; - } else { - resp.err = atoi(g_slist_nth_data(tokens, 0)); - - // TODO: CMEE error mapping is required. - resp.err = CALL_ERROR_SERVICE_UNAVAIL; - } - - // Free tokens - tcore_at_tok_free(tokens); - } - - resp.id = tcore_call_object_get_id((CallObject *) user_data); - dbg("resp.id = %d", resp.id); - - // Send response to TAPI - tcore_user_request_send_response(ur, TRESP_CALL_SWAP, sizeof(struct tresp_call_swap), &resp); - - if (!resp.err) { - GSList *active = NULL; - GSList *held = NULL; - CallObject *co = NULL; - gboolean *eflag = NULL; - - held = tcore_call_object_find_by_status(core_obj, TCORE_CALL_STATUS_HELD); - if (!held) { - err("Can't find held Call"); - return; - } - - active = tcore_call_object_find_by_status(core_obj, TCORE_CALL_STATUS_ACTIVE); - if (!active) { - dbg("Can't find active Call"); - return; - } + _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_SWAP); - while (held) { - co = (CallObject *) held->data; - if (!co) { - err("Can't get held Call object"); - return; - } - - resp.id = tcore_call_object_get_id(co); - - // Send response to TAPI - tcore_user_request_send_response(ur, TRESP_CALL_ACTIVE, sizeof(struct tresp_call_active), &resp); - - held = g_slist_next(held); - } - - while (active) { - co = (CallObject *) active->data; - if (!co) { - err("[ error ] can't get active call object"); - return; - } - - resp.id = tcore_call_object_get_id(co); - - // Send response to TAPI - tcore_user_request_send_response(ur, TRESP_CALL_HOLD, sizeof(struct tresp_call_hold), &resp); - active = g_slist_next(active); - } - - eflag = g_new0(gboolean, 1); - *eflag = FALSE; - - dbg("calling _call_list_get"); - _call_list_get(core_obj, eflag); - } - } else { - err("User Request is NULL"); - } - - dbg("Exit"); return; } @@ -1539,7 +1489,7 @@ static void on_confirmation_call_set_source_sound_path(TcorePending *p, int data dbg("Entry"); ur = tcore_pending_ref_user_request(p); - // +XDRV: ,,[,] + /* +XDRV: , , [, ] */ if (!response) { err("Input data is NULL"); return; @@ -1576,7 +1526,7 @@ static void on_confirmation_call_set_source_sound_path(TcorePending *p, int data } } OUT: - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } else { dbg("RESPONSE NOT OK"); @@ -1590,17 +1540,17 @@ OUT: } else { error = atoi(g_slist_nth_data(tokens, 0)); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = TRUE; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } if (ur) { - if ( resp.err ) { // Send only failed notification . success notification send when destination device is set. - // Send notification to TAPI + if (resp.err) { /* Send only failed notification . success notification send when destination device is set. */ + /* Send notification to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_PATH, sizeof(struct tresp_call_set_sound_path), &resp); setsoundpath = TRUE; } @@ -1625,7 +1575,7 @@ static void on_confirmation_call_set_destination_sound_path(TcorePending *p, int dbg("Entry"); ur = tcore_pending_ref_user_request(p); - // +XDRV: ,,[,] + /* +XDRV: , , [, ] */ if (!response) { err("Input data is NULL"); @@ -1664,7 +1614,7 @@ static void on_confirmation_call_set_destination_sound_path(TcorePending *p, int } OUT: - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } else { dbg("RESPONSE NOT OK"); @@ -1677,18 +1627,18 @@ OUT: resp.err = TRUE; } else { error = atoi(g_slist_nth_data(tokens, 0)); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = TRUE; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } if (setsoundpath == TRUE) { setsoundpath = FALSE; } else { - // Send response to TAPI + /* Send response to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_PATH, sizeof(struct tresp_call_set_sound_path), &resp); } } else { @@ -1711,7 +1661,7 @@ static void on_confirmation_call_set_source_sound_volume_level(TcorePending *p, ur = tcore_pending_ref_user_request(p); dbg("Entry"); - // +XDRV: ,,[,] + /* +XDRV: , , [, ] */ if (!response) { err("Input data is NULL"); return; @@ -1749,7 +1699,7 @@ static void on_confirmation_call_set_source_sound_volume_level(TcorePending *p, } OUT: - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } else { dbg("RESPONSE NOT OK"); @@ -1763,17 +1713,17 @@ OUT: } else { error = atoi(g_slist_nth_data(tokens, 0)); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = TRUE; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } if (ur) { - if (resp.err && soundvolume == FALSE) { // Send only failed notification . success notification send when destination device is set. - // Send reposne to TAPI + if (resp.err && soundvolume == FALSE) { /* Send only failed notification . success notification send when destination device is set. */ + /* Send reposne to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_VOLUME_LEVEL, sizeof(struct tresp_call_set_sound_volume_level), &resp); soundvolume = TRUE; } @@ -1800,7 +1750,7 @@ static void on_confirmation_call_set_destination_sound_volume_level(TcorePending ur = tcore_pending_ref_user_request(p); - // +XDRV: ,,[,] + /* +XDRV: , , [, ] */ if (!response) { err("Input data is NULL"); return; @@ -1839,7 +1789,7 @@ static void on_confirmation_call_set_destination_sound_volume_level(TcorePending } OUT: - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } else { dbg("RESPONSE NOT OK"); @@ -1853,7 +1803,7 @@ OUT: } else { error = atoi(g_slist_nth_data(tokens, 0)); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = TRUE; } @@ -1863,7 +1813,7 @@ OUT: if (soundvolume == TRUE) { soundvolume = FALSE; } else { - // Send reposne to TAPI + /* Send reposne to TAPI */ tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_VOLUME_LEVEL, sizeof(struct tresp_call_set_sound_volume_level), &resp); } } else { @@ -1925,7 +1875,7 @@ static void on_confirmation_call_set_sound_mute_status(TcorePending *p, int data } } OUT: - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } else { dbg("RESPONSE NOT OK"); @@ -1939,25 +1889,24 @@ OUT: } else { error = atoi(g_slist_nth_data(tokens, 0)); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = TRUE; } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_MUTE_STATUS, sizeof(struct tresp_call_set_sound_mute_status), &resp); - } else { + else err("User Request is NULL"); - } dbg("Exit"); return; } -// RESPONSE +/* RESPONSE */ static void on_response_call_list_get(TcorePending *p, int data_len, const void *data, void *user_data) { TcorePlugin *plugin = NULL; @@ -2000,20 +1949,19 @@ static void on_response_call_list_get(TcorePending *p, int data_len, const void line = (char *) (resp_data->data); error = _callFromCLCCLine(line, call_list + countValidCalls); - if (0 != error) { + if (0 != error) continue; - } co = tcore_call_object_find_by_id(core_obj, call_list[cllc_info].info.id); if (!co) { - co = tcore_call_object_new(core_obj, call_list[cllc_info].info.id); + co = tcore_call_object_new(core_obj); if (!co) { - err("error : tcore_call_object_new [ id : %d ]", call_list[cllc_info].info.id); + err("[ error ] co is NULL"); continue; } } - // Call set parameters + /* Call set parameters */ tcore_call_object_set_type(co, call_type(call_list[cllc_info].info.type)); tcore_call_object_set_direction(co, call_list[cllc_info].info.direction); tcore_call_object_set_multiparty_state(co, _call_is_in_mpty(call_list[cllc_info].info.mpty)); @@ -2024,7 +1972,7 @@ static void on_response_call_list_get(TcorePending *p, int data_len, const void dbg("Call status before calling _call_branch_by_status() : (%d)", call_list[cllc_info].info.status); _call_branch_by_status(plugin, co, call_list[cllc_info].info.status); } else { - // Set Status + /* Set Status */ tcore_call_object_set_status(co, call_list[cllc_info].info.status); dbg("Call id : (%d)", call_list[cllc_info].info.id); @@ -2036,11 +1984,11 @@ static void on_response_call_list_get(TcorePending *p, int data_len, const void } } - // Free Call list + /* Free Call list */ g_free(call_list); } - // Free User data + /* Free User data */ if (event_flag) { g_free(event_flag); event_flag = NULL; @@ -2075,55 +2023,55 @@ static void _on_confirmation_call_end_cause(TcorePending *p, int data_len, const err("call end cause - report value missing"); } else { resp_str = g_slist_nth_data(tokens, 1); - if (!resp_str) { + if (!resp_str) err("call end cause value missing"); - } + error = atoi(resp_str); dbg("call end cause - %d", error); call_status.cause = _compare_call_end_cause(error); dbg("TAPI call end cause - %d", call_status.cause); } - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } else { err("RESPONSE NOT OK"); line = (char *) response->final_response; tokens = tcore_at_tok_new(line); - if (g_slist_length(tokens) < 1) { + if (g_slist_length(tokens) < 1) err("err cause not specified or string corrupted"); - } else { + else err(" err cause value: %d", atoi(g_slist_nth_data(tokens, 0))); - } + call_status.cause = CC_CAUSE_NORMAL_CALL_CLEARING; - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); } call_status.type = tcore_call_object_get_type(co); dbg("data.type : [%d]", call_status.type); - call_status.id = tcore_call_object_get_id(co); - dbg("data.id : [%d]", call_status.id); + call_status.handle = tcore_call_object_get_handle(co); + dbg("data.handle : [%d]", call_status.handle); - // Set Status + /* Set Status */ tcore_call_object_set_status(co, TCORE_CALL_STATUS_IDLE); - // Send Notification to TAPI + /* Send Notification to TAPI */ tcore_server_send_notification(tcore_plugin_ref_server(plugin), core_obj, TNOTI_CALL_STATUS_IDLE, sizeof(struct tnoti_call_status_idle), (void *) &call_status); - // Free Call object + /* Free Call object */ tcore_call_object_free(core_obj, co); } static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call) { - // +CLCC: 1,0,2,0,0,"18005551212",145 - // [+CLCC: , , , ,[,,[,[,]]] + /* +CLCC: 1, 0, 2, 0, 0, "18005551212", 145 */ + /* [+CLCC: , , , , [, , [, [, ]]] */ int state; int mode; int isMT; @@ -2135,7 +2083,7 @@ static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call) dbg("Entry"); tokens = tcore_at_tok_new(line); - // parse + /* parse */ resp = g_slist_nth_data(tokens, 0); if (!resp) { err("InValid ID"); @@ -2144,21 +2092,21 @@ static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call) p_call->info.id = atoi(resp); dbg("id : [%d]\n", p_call->info.id); - // parse + /* parse */ resp = g_slist_nth_data(tokens, 1); if (!resp) { err("InValid Dir"); goto ERROR; } isMT = atoi(resp); - if (0 == isMT) { + if (0 == isMT) p_call->info.direction = TCORE_CALL_DIRECTION_OUTGOING; - } else { + else p_call->info.direction = TCORE_CALL_DIRECTION_INCOMING; - } + dbg("Direction : [ %d ]\n", p_call->info.direction); - // parse + /* parse */ resp = g_slist_nth_data(tokens, 2); if (!resp) { err("InValid Stat"); @@ -2167,33 +2115,33 @@ static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call) state = atoi(resp); dbg("Call state : %d", state); switch (state) { - case 0: // active + case 0: /* active */ p_call->info.status = TCORE_CALL_STATUS_ACTIVE; - break; + break; case 1: p_call->info.status = TCORE_CALL_STATUS_HELD; - break; + break; case 2: p_call->info.status = TCORE_CALL_STATUS_DIALING; - break; + break; case 3: p_call->info.status = TCORE_CALL_STATUS_ALERT; - break; + break; case 4: p_call->info.status = TCORE_CALL_STATUS_INCOMING; - break; + break; case 5: p_call->info.status = TCORE_CALL_STATUS_WAITING; - break; + break; } dbg("Status : [%d]\n", p_call->info.status); - // parse + /* parse */ resp = g_slist_nth_data(tokens, 3); if (!resp) { err("InValid Mode"); @@ -2203,19 +2151,19 @@ static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call) switch (mode) { case 0: p_call->info.type = TCORE_CALL_TYPE_VOICE; - break; + break; case 1: p_call->info.type = TCORE_CALL_TYPE_VIDEO; - break; + break; - default: // only Voice/VT call is supported in CS. treat other unknown calls as error + default: /* only Voice/VT call is supported in CS. treat other unknown calls as error */ dbg("invalid type : [%d]\n", mode); goto ERROR; } dbg("Call type : [%d]\n", p_call->info.type); - // parse + /* parse */ resp = g_slist_nth_data(tokens, 4); if (!resp) { err("InValid Mpty"); @@ -2225,23 +2173,26 @@ static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call) p_call->info.mpty = atoi(resp); dbg("Mpty : [ %d ]\n", p_call->info.mpty); - // parse + /* parse */ resp = g_slist_nth_data(tokens, 5); dbg("Incoming number - %s and its len - %d", resp, strlen(resp)); - // tolerate null here + /* tolerate null here */ if (!resp) { err("Number is NULL"); goto ERROR; } - // Strike off double quotes - num = util_removeQuotes(resp); - dbg("num after removing quotes - %s", num); + /* Strike off double quotes */ + num = tcore_at_tok_extract(resp); + if (num == NULL) + err("number after removing quotes is NULL"); + else + dbg("num after removing quotes - %s", num); p_call->info.num_len = strlen(resp); dbg("num_len : [0x%x]\n", p_call->info.num_len); - // parse + /* parse */ resp = g_slist_nth_data(tokens, 6); if (!resp) { dbg("InValid Num type"); @@ -2250,22 +2201,23 @@ static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call) p_call->info.num_type = atoi(resp); dbg("BCD num type: [0x%x]\n", p_call->info.num_type); - // check number is international or national. + /* check number is international or national. */ num_type = ((p_call->info.num_type) >> 4) & 0x07; dbg("called party's type of number : [0x%x]\n", num_type); - if (num_type == 1 && num[0] != '+') { - // international number - p_call->number[0] = '+'; - memcpy(&(p_call->number[1]), num, strlen(num)); - } else { - memcpy(&(p_call->number), num, strlen(num)); + if (num != NULL) { + if (num_type == 1 && num[0] != '+') { + /* international number */ + p_call->number[0] = '+'; + memcpy(&(p_call->number[1]), num, strlen(num)); + } else { + memcpy(&(p_call->number), num, strlen(num)); + } + dbg("incoming number - %s", p_call->number); } - dbg("incoming number - %s", p_call->number); - g_free(num); num = NULL; - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); dbg("Exit"); @@ -2276,13 +2228,13 @@ ERROR: g_free(num); - // Free tokens + /* Free tokens */ tcore_at_tok_free(tokens); err("Exit"); return -1; } -// NOTIFICATION +/* NOTIFICATION */ static void on_notification_call_waiting(CoreObject *o, const void *data, void *user_data) { GSList *tokens = NULL; @@ -2294,14 +2246,14 @@ static void on_notification_call_waiting(CoreObject *o, const void *data, void * CallObject *co = NULL, *dupco = NULL; dbg("function entrance"); - // check call with waiting status already exist + /* check call with waiting status already exist */ pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_WAITING); if (pList != NULL) { dbg("[error]Waiting call already exist. skip"); return; } - // check call with incoming status already exist + /* check call with incoming status already exist */ pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_INCOMING); if (pList != NULL) { @@ -2325,12 +2277,13 @@ static void on_notification_call_waiting(CoreObject *o, const void *data, void * tcore_at_tok_free(tokens); return; } - co = tcore_call_object_new(o, call_id); + co = tcore_call_object_new(o); if (!co) { - dbg("[ error ] co is NULL"); + err("[ error ] co is NULL"); tcore_at_tok_free(tokens); return; } + tcore_call_object_set_id(co, call_id); tcore_at_tok_free(tokens); @@ -2351,7 +2304,7 @@ static void on_notification_call_incoming(CoreObject *o, const void *data, void CallObject *co = NULL, *dupco = NULL; dbg("function entrance"); - // check call with incoming status already exist + /* check call with incoming status already exist */ pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_INCOMING); if (pList != NULL) { @@ -2378,12 +2331,13 @@ static void on_notification_call_incoming(CoreObject *o, const void *data, void return; } - co = tcore_call_object_new(o, call_id); + co = tcore_call_object_new(o); if (!co) { dbg("[ error ] co is NULL"); tcore_at_tok_free(tokens); return; } + tcore_call_object_set_id(co, call_id); dbg("freeing at token"); tcore_at_tok_free(tokens); @@ -2414,7 +2368,7 @@ static void on_notification_call_status(CoreObject *o, const void *data, void *u cmd = (char *) data; tokens = tcore_at_tok_new(cmd); - // parse + /* parse */ pCallId = g_slist_nth_data(tokens, 0); if (!pCallId) { dbg("CallId is missing from %XCALLSTAT indication"); @@ -2423,10 +2377,9 @@ static void on_notification_call_status(CoreObject *o, const void *data, void *u } else { id = atoi(pCallId); dbg("call id = %d", id); - // parse - if ((stat = g_slist_nth_data(tokens, 1))) { + /* parse */ + if ((stat = g_slist_nth_data(tokens, 1))) status = atoi(stat); - } dbg("call status = %d", status); } @@ -2437,30 +2390,58 @@ static void on_notification_call_status(CoreObject *o, const void *data, void *u switch (co_status) { case CALL_STATUS_ACTIVE: { + int prev_status; dbg("call(%d) status : [ ACTIVE ]", id); + co = tcore_call_object_find_by_id(o, id); if (!co) { dbg("co is NULL"); return; } - _call_status_active(plugin, co); + /* + * Activie / Held status notification will be handled in call_list_get(). + * Because of timing issue, we should not notifity this event before updating call info. + * One exception is that we will send this event when active status is receviced during dialing or incoming. + */ + prev_status = tcore_call_object_get_status(co); + if ((prev_status == TCORE_CALL_STATUS_DIALING) + || (prev_status == TCORE_CALL_STATUS_ALERT) + || (prev_status == TCORE_CALL_STATUS_INCOMING) + || (prev_status == TCORE_CALL_STATUS_WAITING)) { + _call_status_active(plugin, co); + } } break; case CALL_STATUS_HELD: + { dbg("call(%d) status : [ held ]", id); - break; + /* + * Activie / Held status notification will be handled in call_list_get(). + * Because of timing issue, we should not notifity this event before updating call info. + */ + /* + co = tcore_call_object_find_by_id(o, id); + if (!co) { + dbg("co is NULL"); + return; + } + _call_status_held(plugin, co); + */ + } + break; case CALL_STATUS_DIALING: { dbg("call(%d) status : [ dialing ]", id); co = tcore_call_object_find_by_id(o, id); if (!co) { - co = tcore_call_object_new(o, id); + co = tcore_call_object_new(o); if (!co) { dbg("error : tcore_call_object_new [ id : %d ]", id); return; } + tcore_call_object_set_id(co, id); } tcore_call_object_set_type(co, call_type(type)); @@ -2477,7 +2458,7 @@ static void on_notification_call_status(CoreObject *o, const void *data, void *u dbg("co is NULL"); return; } - // Store dialed number information into Call object. + /* Store dialed number information into Call object. */ eflag = g_new0(gboolean, 1); *eflag = TRUE; dbg("calling _call_list_get"); @@ -2547,7 +2528,7 @@ static TReturn imc_call_outgoing(CoreObject *o, UserRequest *ur) vconf_get_int("db/ciss/show_my_number", &cli); - if (cli == 2){ + if (cli == 2) { dbg("clir invocation from setting application"); clir = "I"; } else { @@ -2565,6 +2546,11 @@ static TReturn imc_call_outgoing(CoreObject *o, UserRequest *ur) pending = tcore_pending_new(o, 0); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); @@ -2601,13 +2587,18 @@ static TReturn imc_call_answer(CoreObject *o, UserRequest *ur) } data = (struct treq_call_answer *) tcore_user_request_ref_data(ur, 0); - co = tcore_call_object_find_by_id(o, data->id); + co = tcore_call_object_find_by_handle(o, data->handle); if (data->type == CALL_ANSWER_TYPE_ACCEPT) { dbg(" request type CALL_ANSWER_TYPE_ACCEPT"); cmd_str = g_strdup_printf("%s", "ATA"); pending = tcore_pending_new(o, 0); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); @@ -2667,18 +2658,23 @@ static TReturn imc_call_release(CoreObject *o, UserRequest *ur) return TCORE_RETURN_ENOSYS; } data = (struct treq_call_end *) tcore_user_request_ref_data(ur, 0); - co = tcore_call_object_find_by_id(o, data->id); + co = tcore_call_object_find_by_handle(o, data->handle); dbg("type of release call = %d", data->type); if (data->type == CALL_END_TYPE_ALL) { - // releaseAll do not exist on legacy request. send CHLD=0, CHLD=1 in sequence + /* releaseAll do not exist on legacy request. send CHLD=0, CHLD=1 in sequence */ chld0_cmd = g_strdup("AT+CHLD=0"); chld1_cmd = g_strdup("AT+CHLD=1"); pending = tcore_pending_new(o, 0); req = tcore_at_request_new(chld0_cmd, NULL, TCORE_AT_NO_RESULT); - + if (req == NULL) { + tcore_pending_free(pending); + g_free(chld0_cmd); + g_free(chld1_cmd); + return TCORE_RETURN_FAILURE; + } dbg("input command is %s", chld0_cmd); dbg("req-cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -2699,7 +2695,11 @@ static TReturn imc_call_release(CoreObject *o, UserRequest *ur) pending1 = tcore_pending_new(o, 0); req1 = tcore_at_request_new(chld1_cmd, NULL, TCORE_AT_NO_RESULT); - + if (req1 == NULL) { + tcore_pending_free(pending1); + g_free(chld1_cmd); + return TCORE_RETURN_FAILURE; + } dbg("input command is %s", chld1_cmd); dbg("req-cmd : %s, prefix(if any) :%s, cmd_len : %d", req1->cmd, req1->prefix, strlen(req1->cmd)); @@ -2759,9 +2759,9 @@ static TReturn imc_call_hold(CoreObject *o, UserRequest *ur) } hold = (struct treq_call_hold *) tcore_user_request_ref_data(ur, 0); - dbg("call id : [ %d ]", hold->id); + dbg("call handle : [ %d ]", hold->handle); - co = tcore_call_object_find_by_id(o, hold->id); + co = tcore_call_object_find_by_handle(o, hold->handle); tcore_call_control_hold(o, ur, on_confirmation_call_hold, co); return TCORE_RETURN_SUCCESS; @@ -2778,9 +2778,9 @@ static TReturn imc_call_active(CoreObject *o, UserRequest *ur) } active = (struct treq_call_active *) tcore_user_request_ref_data(ur, 0); - dbg("call id : [ %d ]", active->id); + dbg("call handle : [ %d ]", active->handle); - co = tcore_call_object_find_by_id(o, active->id); + co = tcore_call_object_find_by_handle(o, active->handle); tcore_call_control_active(o, ur, on_confirmation_call_active, co); return TCORE_RETURN_SUCCESS; @@ -2797,9 +2797,9 @@ static TReturn imc_call_swap(CoreObject *o, UserRequest *ur) } swap = (struct treq_call_swap *) tcore_user_request_ref_data(ur, 0); - dbg("call id : [ %d ]", swap->id); + dbg("call handle : [ %d ]", swap->handle); - co = tcore_call_object_find_by_id(o, swap->id); + co = tcore_call_object_find_by_handle(o, swap->handle); tcore_call_control_swap(o, ur, on_confirmation_call_swap, co); return TCORE_RETURN_SUCCESS; @@ -2816,9 +2816,9 @@ static TReturn imc_call_join(CoreObject *o, UserRequest *ur) } join = (struct treq_call_join *) tcore_user_request_ref_data(ur, 0); - dbg("call id : [ %d ]", join->id); + dbg("call handle : [ %d ]", join->handle); - co = tcore_call_object_find_by_id(o, join->id); + co = tcore_call_object_find_by_handle(o, join->handle); tcore_call_control_join(o, ur, on_confirmation_call_join, co); return TCORE_RETURN_SUCCESS; @@ -2828,6 +2828,7 @@ static TReturn imc_call_split(CoreObject *o, UserRequest *ur) { struct treq_call_split *split = 0; CallObject *co = NULL; + int id = 0; if (FALSE == tcore_hal_get_power_state(tcore_object_get_hal(o))) { dbg("cp not ready/n"); @@ -2835,10 +2836,12 @@ static TReturn imc_call_split(CoreObject *o, UserRequest *ur) } split = (struct treq_call_split *) tcore_user_request_ref_data(ur, 0); - co = tcore_call_object_find_by_id(o, split->id); - dbg("call id : [ %d ]", split->id); + co = tcore_call_object_find_by_handle(o, split->handle); + + id = tcore_call_object_get_id(co); + dbg("call ID : [ %d ]", id); - tcore_call_control_split(o, ur, split->id, on_confirmation_call_split, co); + tcore_call_control_split(o, ur, id, on_confirmation_call_split, co); return TCORE_RETURN_SUCCESS; } @@ -2873,9 +2876,9 @@ static TReturn imc_call_transfer(CoreObject *o, UserRequest *ur) } transfer = (struct treq_call_transfer *) tcore_user_request_ref_data(ur, 0); - dbg("call id : [ %d ]", transfer->id); + dbg("call handle : [ %d ]", transfer->handle); - co = tcore_call_object_find_by_id(o, transfer->id); + co = tcore_call_object_find_by_handle(o, transfer->handle); tcore_call_control_transfer(o, ur, on_confirmation_call_transfer, co); return TCORE_RETURN_SUCCESS; @@ -2887,9 +2890,7 @@ static TReturn imc_call_start_cont_dtmf(CoreObject *o, UserRequest *ur) gboolean ret = FALSE; TcoreATRequest *req; struct treq_call_start_cont_dtmf *dtmf = 0; - char *dtmfstr = NULL, *tmp_dtmf = NULL; TcorePending *pending = NULL; - //unsigned int dtmf_count; dbg("Function enter"); @@ -2897,44 +2898,62 @@ static TReturn imc_call_start_cont_dtmf(CoreObject *o, UserRequest *ur) dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } - dtmf = (struct treq_call_start_cont_dtmf *) tcore_user_request_ref_data(ur, 0); - dtmfstr = g_malloc0((MAX_CALL_DTMF_DIGITS_LEN * 2) + 1); // DTMF digits + comma for each dtmf digit. - if (dtmfstr == NULL) { - dbg("Memory allocation failed"); + /* Start Command Syntax: AT+XVTS= */ + cmd_str = g_strdup_printf("AT+XVTS=%c", dtmf->dtmf_digit); + + pending = tcore_pending_new(o, 0); + req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); return TCORE_RETURN_FAILURE; } - tmp_dtmf = dtmfstr; + dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); -#if 1 - *tmp_dtmf = dtmf->dtmf_digit; -#else - for (dtmf_count = 0; dtmf_count < (unsigned int)strlen((const char *)dtmf->dtmf_digit); dtmf_count++) { - *tmp_dtmf = dtmf->dtmf_digit; - tmp_dtmf++; + tcore_pending_set_request_data(pending, 0, req); + ret = _call_request_message(pending, o, ur, on_confirmation_call_start_cont_dtmf, NULL); + g_free(cmd_str); - *tmp_dtmf = COMMA; - tmp_dtmf++; + if (!ret) { + dbg("AT request sent failed"); + return TCORE_RETURN_FAILURE; } - // last digit is having COMMA , overwrite it with '\0' . - *(--tmp_dtmf) = '\0'; -#endif - dbg("Input DTMF string(%s)", dtmfstr); + return TCORE_RETURN_SUCCESS; +} - // AT+VTS = ,,,,,, ..... - cmd_str = g_strdup_printf("AT+VTS=%s", dtmfstr); - dbg("request command : %s", cmd_str); +static TReturn imc_call_stop_cont_dtmf(CoreObject *o, UserRequest *ur) +{ + char *cmd_str = NULL; + gboolean ret = FALSE; + TcoreATRequest *req; + TcorePending *pending = NULL; + + dbg("Function enter"); + + if (FALSE == tcore_hal_get_power_state(tcore_object_get_hal(o))) { + dbg("cp not ready/n"); + return TCORE_RETURN_ENOSYS; + } + + /* Stop Command Syntax: AT+XVTS= */ + cmd_str = g_strdup_printf("AT+XVTS="); pending = tcore_pending_new(o, 0); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } + dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); - ret = _call_request_message(pending, o, ur, on_confirmation_call_dtmf, NULL); - g_free(dtmfstr); + ret = _call_request_message(pending, o, ur, on_confirmation_call_stop_cont_dtmf, NULL); g_free(cmd_str); if (!ret) { @@ -3018,29 +3037,32 @@ static TReturn imc_call_set_sound_path(CoreObject *o, UserRequest *ur) /* Configure modem I2S1 to 8khz, mono, PCM if routing to bluetooth */ if (sound_path->path == CALL_SOUND_PATH_BLUETOOTH || sound_path->path == CALL_SOUND_PATH_STEREO_BLUETOOTH) { - call_prepare_and_send_pending_request(o, "AT+XDRV=40,4,3,0,1,0,0,0,0,0,0,0,21", NULL, TCORE_AT_NO_RESULT, NULL); - call_prepare_and_send_pending_request(o, "AT+XDRV=40,5,2,0,1,0,0,0,0,0,0,0,22", NULL, TCORE_AT_NO_RESULT, NULL); - } - else { - call_prepare_and_send_pending_request(o, "AT+XDRV=40,4,3,0,1,0,8,0,1,0,2,0,21", NULL, TCORE_AT_NO_RESULT, NULL); - call_prepare_and_send_pending_request(o, "AT+XDRV=40,5,2,0,1,0,8,0,1,0,2,0,22", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 4, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 21", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 5, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 22", NULL, TCORE_AT_NO_RESULT, NULL); + } else { + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 4, 3, 0, 1, 0, 8, 0, 1, 0, 2, 0, 21", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 5, 2, 0, 1, 0, 8, 0, 1, 0, 2, 0, 22", NULL, TCORE_AT_NO_RESULT, NULL); } /* Configure modem I2S2 and do the modem routing */ - call_prepare_and_send_pending_request(o, "AT+XDRV=40,4,4,0,0,0,8,0,1,0,2,0,21", NULL, TCORE_AT_NO_RESULT, NULL); - call_prepare_and_send_pending_request(o, "AT+XDRV=40,5,3,0,0,0,8,0,1,0,2,0,22", NULL, TCORE_AT_NO_RESULT, NULL); - call_prepare_and_send_pending_request(o, "AT+XDRV=40,6,0,4", NULL, TCORE_AT_NO_RESULT, NULL); - call_prepare_and_send_pending_request(o, "AT+XDRV=40,6,3,0", NULL, TCORE_AT_NO_RESULT, NULL); - call_prepare_and_send_pending_request(o, "AT+XDRV=40,6,4,2", NULL, TCORE_AT_NO_RESULT, NULL); - call_prepare_and_send_pending_request(o, "AT+XDRV=40,6,5,2", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 4, 4, 0, 0, 0, 8, 0, 1, 0, 2, 0, 21", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 5, 3, 0, 0, 0, 8, 0, 1, 0, 2, 0, 22", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 6, 0, 4", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 6, 3, 0", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 6, 4, 2", NULL, TCORE_AT_NO_RESULT, NULL); + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 6, 5, 2", NULL, TCORE_AT_NO_RESULT, NULL); /* amc enable */ - call_prepare_and_send_pending_request(o, "AT+XDRV=40,2,4", NULL, TCORE_AT_NO_RESULT, NULL); //AMC_I2S2_RX - call_prepare_and_send_pending_request(o, "AT+XDRV=40,2,3", NULL, TCORE_AT_NO_RESULT, NULL); //AMC_I2S1_RX + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 2, 4", NULL, TCORE_AT_NO_RESULT, NULL); /* AMC_I2S2_RX */ + call_prepare_and_send_pending_request(o, "AT+XDRV=40, 2, 3", NULL, TCORE_AT_NO_RESULT, NULL); /* AMC_I2S1_RX */ /* amc route: AMC_RADIO_RX => AMC_I2S1_TX */ pending = tcore_pending_new(o, 0); - req = tcore_at_request_new("AT+XDRV=40,6,0,2", "+XDRV", TCORE_AT_SINGLELINE); + req = tcore_at_request_new("AT+XDRV=40, 6, 0, 2", "+XDRV", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + return TCORE_RETURN_FAILURE; + } dbg("XDRV req-cmd for source type : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); ur_dup = tcore_user_request_ref(ur); @@ -3048,9 +3070,14 @@ static TReturn imc_call_set_sound_path(CoreObject *o, UserRequest *ur) } else { - cmd_str = g_strdup_printf("AT+XDRV=40,4,3,0,0,0,0,0,1,0,1,0,%d",device_type); // source type. + cmd_str = g_strdup_printf("AT+XDRV=40, 4, 3, 0, 0, 0, 0, 0, 1, 0, 1, 0, %d", device_type); /* source type. */ pending = tcore_pending_new(o, 0); req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("XDRV req-cmd for source type : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); ur_dup = tcore_user_request_ref(ur); @@ -3062,9 +3089,14 @@ static TReturn imc_call_set_sound_path(CoreObject *o, UserRequest *ur) return TCORE_RETURN_FAILURE; } - cmd_str1 = g_strdup_printf("AT+XDRV=40,5,2,0,0,0,0,0,1,0,1,0,%d",device_type); // destination type + cmd_str1 = g_strdup_printf("AT+XDRV=40, 5, 2, 0, 0, 0, 0, 0, 1, 0, 1, 0, %d", device_type); /* destination type */ pending1 = tcore_pending_new(o, 0); req1 = tcore_at_request_new(cmd_str1, "+XDRV", TCORE_AT_SINGLELINE); + if (req1 == NULL) { + tcore_pending_free(pending1); + g_free(cmd_str1); + return TCORE_RETURN_FAILURE; + } dbg("XDRV req-cmd for destination type : %s, prefix(if any) :%s, cmd_len : %d", req1->cmd, req1->prefix, strlen(req1->cmd)); tcore_pending_set_request_data(pending1, 0, req1); ret = _call_request_message(pending1, o, ur, on_confirmation_call_set_destination_sound_path, NULL); @@ -3100,77 +3132,92 @@ static TReturn imc_call_set_sound_volume_level(CoreObject *o, UserRequest *ur) data = (struct treq_call_set_sound_volume_level *) tcore_user_request_ref_data(ur, 0); - // Hard-coded values for MIC & Speakers - // Source volume + /* Hard-coded values for MIC & Speakers */ + /* Source volume */ dbg("Set Source volume"); - cmd_str = g_strdup_printf("%s", "AT+XDRV=40,7,3,88"); // Source type + cmd_str = g_strdup_printf("%s", "AT+XDRV=40, 7, 3, 88"); /* Source type */ dbg("Request command string: %s", cmd_str); - // Create new Pending request + /* Create new Pending request */ src_pending = tcore_pending_new(o, 0); - // Create new AT-Command request + /* Create new AT-Command request */ src_req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE); + if (src_req == NULL) { + tcore_pending_free(src_pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("Command: %s, prefix(if any): %s, Command length: %d", src_req->cmd, src_req->prefix, strlen(src_req->cmd)); - // Free Command string + /* Free Command string */ g_free(cmd_str); tcore_pending_set_request_data(src_pending, 0, src_req); src_ur = tcore_user_request_ref(ur); - // Send request + /* Send request */ ret = _call_request_message(src_pending, o, src_ur, on_confirmation_call_set_source_sound_volume_level, NULL); if (!ret) { err("Failed to send AT-Command request"); return TCORE_RETURN_FAILURE; } - cmd_str = g_strdup_printf("%s", "AT+XDRV=40,7,0,88"); // Destination type + cmd_str = g_strdup_printf("%s", "AT+XDRV=40, 7, 0, 88"); /* Destination type */ dbg("Request command string: %s", cmd_str); - // Create new Pending request + /* Create new Pending request */ src_pending = tcore_pending_new(o, 0); - // Create new AT-Command request + /* Create new AT-Command request */ src_req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE); + if (src_req == NULL) { + tcore_pending_free(src_pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("Command: %s, prefix(if any): %s, Command length: %d", src_req->cmd, src_req->prefix, strlen(src_req->cmd)); - // Free Command string + /* Free Command string */ g_free(cmd_str); tcore_pending_set_request_data(src_pending, 0, src_req); src_ur = tcore_user_request_ref(ur); - // Send request + /* Send request */ ret = _call_request_message(src_pending, o, src_ur, on_confirmation_call_set_source_sound_volume_level, NULL); if (!ret) { err("Failed to send AT-Command request"); return TCORE_RETURN_FAILURE; } - // Destination volume + /* Destination volume */ dbg("Set Source volume"); - cmd_str = g_strdup_printf("%s", "AT+XDRV=40,8,0,88"); // Source type + cmd_str = g_strdup_printf("%s", "AT+XDRV=40, 8, 0, 88"); /* Source type */ dbg("Request command string: %s", cmd_str); - // Create new Pending request + /* Create new Pending request */ dest_pending = tcore_pending_new(o, 0); - // Create new AT-Command request + /* Create new AT-Command request */ dest_req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE); + if (dest_req == NULL) { + tcore_pending_free(dest_pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("Command: %s, prefix(if any): %s, Command length: %d", dest_req->cmd, dest_req->prefix, strlen(dest_req->cmd)); - // Free Command string + /* Free Command string */ g_free(cmd_str); tcore_pending_set_request_data(dest_pending, 0, dest_req); dest_ur = tcore_user_request_ref(ur); - // Send request + /* Send request */ ret = _call_request_message(dest_pending, o, dest_ur, on_confirmation_call_set_source_sound_volume_level, NULL); if (!ret) { err("Failed to send AT-Command request"); @@ -3220,22 +3267,27 @@ static TReturn imc_call_set_sound_volume_level(CoreObject *o, UserRequest *ur) volume_level = "88"; break; } - cmd_str = g_strdup_printf("%s%s", "AT+XDRV=40,8,2,", volume_level); // Destination type + cmd_str = g_strdup_printf("%s%s", "AT+XDRV=40, 8, 2, ", volume_level); /* Destination type */ dbg("Request command string: %s", cmd_str); - // Create new Pending request + /* Create new Pending request */ dest_pending = tcore_pending_new(o, 0); - // Create new AT-Command request + /* Create new AT-Command request */ dest_req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE); + if (dest_req == NULL) { + tcore_pending_free(dest_pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("Command: %s, prefix(if any): %s, Command length: %d", dest_req->cmd, dest_req->prefix, strlen(dest_req->cmd)); - // Free Command string + /* Free Command string */ g_free(cmd_str); tcore_pending_set_request_data(dest_pending, 0, dest_req); - // Send request + /* Send request */ ret = _call_request_message(dest_pending, o, ur, on_confirmation_call_set_destination_sound_volume_level, NULL); if (!ret) { err("Failed to send AT-Command request"); @@ -3258,23 +3310,28 @@ static TReturn imc_call_set_sound_mute_status(CoreObject *o, UserRequest *ur) data = (struct treq_call_set_sound_mute_status *) tcore_user_request_ref_data(ur, 0); if (data->status == CALL_SOUND_MUTE_STATUS_ON) - cmd_str = g_strdup_printf("%s", "AT+XDRV=40,8,0,0,0"); + cmd_str = g_strdup_printf("%s", "AT+XDRV=40, 8, 0, 0, 0"); else if (data->status == CALL_SOUND_MUTE_STATUS_OFF) - cmd_str = g_strdup_printf("%s", "AT+XDRV=40,8,0,0,88"); + cmd_str = g_strdup_printf("%s", "AT+XDRV=40, 8, 0, 0, 88"); dbg("Request command : [%s]", cmd_str); pending = tcore_pending_new(o, 0); req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd)); g_free(cmd_str); - // Set request data (AT command) to Pending request + /* Set request data (AT command) to Pending request */ tcore_pending_set_request_data(pending, 0, req); - // Send request + /* Send request */ ret = _call_request_message(pending, o, ur, on_confirmation_call_set_sound_mute_status, NULL); if (!ret) { err("Failed to send AT-Command request"); @@ -3351,23 +3408,23 @@ static TReturn _set_dtmf_tone_duration(CoreObject *o, UserRequest *ur) dbg("Entry"); - cmd_str = g_strdup_printf("%s", "AT+VTD=3"); // ~300 mili secs. +VTD= n, where n = (0 - 255) * 1/10 secs. + cmd_str = g_strdup_printf("%s", "AT+VTD=3"); /* ~300 mili secs. +VTD= n, where n = (0 - 255) * 1/10 secs. */ dbg("Request command string: %s", cmd_str); - // Create new Pending request + /* Create new Pending request */ pending = tcore_pending_new(o, 0); - // Create new AT-Command request + /* Create new AT-Command request */ req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd)); - // Free command string */ + /* Free command string */ g_free(cmd_str); - // Set request data (AT command) to Pending request + /* Set request data (AT command) to Pending request */ tcore_pending_set_request_data(pending, 0, req); - // Send request + /* Send request */ ret = _call_request_message(pending, o, ur, _on_confirmation_dtmf_tone_duration, NULL); if (!ret) { err("Failed to send AT-Command request"); @@ -3383,7 +3440,7 @@ static TReturn _set_dtmf_tone_duration(CoreObject *o, UserRequest *ur) } #endif -// Call Operations +/* Call Operations */ static struct tcore_call_operations call_ops = { .dial = imc_call_outgoing, .answer = imc_call_answer, @@ -3396,7 +3453,8 @@ static struct tcore_call_operations call_ops = { .deflect = imc_call_deflect, .transfer = imc_call_transfer, .start_cont_dtmf = imc_call_start_cont_dtmf, - .stop_cont_dtmf = NULL, + .stop_cont_dtmf = imc_call_stop_cont_dtmf, + .send_burst_dtmf = NULL, .set_sound_path = imc_call_set_sound_path, .set_sound_volume_level = imc_call_set_sound_volume_level, .get_sound_volume_level = NULL, @@ -3413,7 +3471,7 @@ gboolean imc_call_init(TcorePlugin *cp, CoreObject *co_call) dbg("Entry"); /* Set operations */ - tcore_call_set_ops(co_call, &call_ops); + tcore_call_set_ops(co_call, &call_ops, TCORE_OPS_TYPE_CP); /* Add Callbacks */ tcore_object_add_callback(co_call, "+XCALLSTAT", on_notification_call_info, NULL); diff --git a/src/imc_common.c b/src/imc_common.c index fb0646a..816f1b4 100644 --- a/src/imc_common.c +++ b/src/imc_common.c @@ -52,39 +52,6 @@ char _util_unpackb(const char *src, int pos, int len); char _util_convert_byte_hexChar(char val); gboolean util_byte_to_hex(const char *byte_pdu, char *hex_pdu, int num_bytes); -void 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); -} - unsigned char util_hexCharToInt(char c) { if (c >= '0' && c <= '9') @@ -108,8 +75,14 @@ char *util_hex_to_string(const char *src, unsigned int src_len) return NULL; dest = g_malloc0(src_len * 2 + 1); + if (dest == NULL) { + err("Memory allocation failed!!"); + return NULL; + } + for (i = 0; i < src_len; i++) { - sprintf(dest + (i * 2), "%02x", (unsigned char)src[i]); + snprintf(dest + (i * 2), (src_len * 2 + 1) - (i * 2), + "%02x", (unsigned char)src[i]); } dest[src_len * 2] = '\0'; @@ -117,7 +90,7 @@ char *util_hex_to_string(const char *src, unsigned int src_len) return dest; } -char* util_hexStringToBytes(char *s) +char *util_hexStringToBytes(char *s) { char *ret; int i; @@ -128,7 +101,11 @@ char* util_hexStringToBytes(char *s) sz = strlen(s); - ret = g_try_malloc0((sz / 2) + 1); + ret = g_malloc0((sz / 2) + 1); + if (ret == NULL) { + err("Memory allocation failed!!"); + return NULL; + } dbg("Convert String to Binary!!"); @@ -157,7 +134,7 @@ char _util_unpackb(const char *src, int pos, int len) src++; len -= 8 - pos; - if (len > 0) result = (result << len) | (*src >> (8 - len)); // if any bits left + if (len > 0) result = (result << len) | (*src >> (8 - len)); /* if any bits left */ } return result; @@ -167,13 +144,12 @@ char _util_convert_byte_hexChar(char val) { char hex_char; - if (val <= 9) { + if (val <= 9) hex_char = (char) (val + '0'); - } else if (val >= 10 && val <= 15) { + else if (val >= 10 && val <= 15) hex_char = (char) (val - 10 + 'A'); - } else { + else hex_char = '0'; - } return (hex_char); } @@ -192,21 +168,3 @@ gboolean util_byte_to_hex(const char *byte_pdu, char *hex_pdu, int num_bytes) return TRUE; } - -char* util_removeQuotes(void *data) -{ - char *tmp = NULL; - int data_len = 0; - - data_len = strlen((const char *) data); - dbg("data_len: %d----%s", data_len, data); - if (data_len <= 0) { - return NULL; - } - - tmp = g_try_malloc0(data_len - 1); - memcpy(tmp, data + 1, data_len - 2); - dbg("tmp: [%s]", tmp); - - return tmp; -} diff --git a/src/imc_gps.c b/src/imc_gps.c index 964ca69..9501c0f 100644 --- a/src/imc_gps.c +++ b/src/imc_gps.c @@ -52,16 +52,18 @@ #define POSITION_NODE_ATTR_XMLNS "xmlns:xsi" #define POSITION_NODE_ATTR_VAL_XMLNS "http://www.w3.org/2001/XMLSchema-instance" -#define MAX_NUM_OF_GPS_REF_TIME_ELEMENT 12 // max number of gps satalite -#define MAX_NUM_OF_GPS_NAV_ELEMENT 16 // max num of navigation gps element. -#define MAX_NUM_OF_GPS_ALMANC_ELEMENTS 64 // Max num of almanc elements. +#define MAX_NUM_OF_GPS_REF_TIME_ELEMENT 12 /* max number of gps satalite */ +#define MAX_NUM_OF_GPS_NAV_ELEMENT 16 /* max num of navigation gps element. */ +#define MAX_NUM_OF_GPS_ALMANC_ELEMENTS 64 /* Max num of almanc elements. */ #define NUM_OF_ELEMENTS(array) (sizeof(array) / sizeof(*(array))) -static char node_name[128]; // max len of xml node -static char node_value[128]; // max len of xml node value. +#define NODE_SIZE 128 -// node type of gps assist data +static char node_name[128]; /* max len of xml node */ +static char node_value[128]; /* max len of xml node value. */ + +/* node type of gps assist data */ enum gps_assist_element_type { REF_TIME = 1, LOCATION_PARM, @@ -73,8 +75,8 @@ enum gps_assist_element_type { ACQU_ASSIST, }; -// Ref_time -typedef struct { +/* Ref_time */ + typedef struct { unsigned char valid; unsigned short bcchCarrier; unsigned short bsic; @@ -97,9 +99,9 @@ typedef struct { unsigned char valid; unsigned long int cellFrames; unsigned char choice_mode; - unsigned long int UtranFdd; // FDD Primary Scrambling Code - unsigned long int UtranTdd; // TDD Cell Parameter ID - unsigned long int sfn; // SFN + unsigned long int UtranFdd; /* FDD Primary Scrambling Code */ + unsigned long int UtranTdd; /* TDD Cell Parameter ID */ + unsigned long int sfn; /* SFN */ } __attribute__((packed)) gps_utran_gps_ref_time_t; typedef struct { @@ -121,7 +123,7 @@ typedef struct { unsigned long int gpsTow; unsigned long int gpsWeek; unsigned char nrOfSats; - union { // Not supported. + union { /* Not supported. */ gps_gsm_time_t gsm_time; gps_utran_time_t UtranTime; } networkTimeInfo; @@ -129,7 +131,7 @@ typedef struct { } __attribute__((packed)) gps_ref_time_t; -// Ref - Location. +/* Ref - Location. */ typedef struct { unsigned char shapeType; unsigned char hemisphere; @@ -144,7 +146,7 @@ typedef struct { unsigned char confidence; } __attribute__((packed)) gps_ref_loc_t; -// DGPS corrections +/* DGPS corrections */ typedef enum { GPS_DGPS_INVALID, GPS_DGPS_UDRE_SCALE_1_0, @@ -157,7 +159,7 @@ typedef enum { } __attribute__((packed)) gps_dgps_status_e_type; typedef struct { - unsigned char satId; // Satellite ID + unsigned char satId; /* Satellite ID */ unsigned short iode; unsigned char udre; signed short pseudoRangeCor; @@ -171,44 +173,44 @@ typedef struct { gps_dgps_sat_list_t seqOfSatElement[16]; } __attribute__((packed)) gps_dgps_correction_t; -// Navi model +/* Navi model */ typedef struct { - unsigned long int rsv1; // 0~838860 - unsigned long int rsv2; // 0~16777215 - unsigned long int rsv3; // 0~16777215 - unsigned long int rsv4; // 0~65535 + unsigned long int rsv1; /* 0~838860 */ + unsigned long int rsv2; /* 0~16777215 */ + unsigned long int rsv3; /* 0~16777215 */ + unsigned long int rsv4; /* 0~65535 */ } __attribute__((packed)) gps_navi_subframe_rsv_t; typedef struct { - unsigned char ephemCodeOnL2; // 0~3 - unsigned char ephemUra; // 0~15 - unsigned char ephemSvHealth; // 0~63 - unsigned short ephemIodc; // 0~1023 - unsigned char ephemL2PFlag; // 0~1 + unsigned char ephemCodeOnL2; /* 0~3 */ + unsigned char ephemUra; /* 0~15 */ + unsigned char ephemSvHealth; /* 0~63 */ + unsigned short ephemIodc; /* 0~1023 */ + unsigned char ephemL2PFlag; /* 0~1 */ gps_navi_subframe_rsv_t NavigationSubFrameRsv; - signed char ephemTgd; // -128~127 - unsigned short ephemToc; // 0~37799 - signed char ephemAf2; // -128~12 - signed short ephemAf1; // -32768~32767 - signed long int ephemAf0; // -2097152~2097151 - signed short ephemCrs; // -32768~32767 - signed short ephemDeltaN; // -32768~32767 - signed long int ephemM0; // -2147483648~2147483647 - signed short ephemCuc; // -32768~32767 - unsigned long int ephemE; // 0~4294967295 - signed short ephemCus; // -32768~32767 - unsigned long int ephemAPowrHalf; // 0~4294967295 - unsigned short ephemToe; // 0~37799 - signed char ephemFitFlag; // 0~1 - unsigned char ephemAoda; // 0~31 - signed short ephemCic; // -32768~32767 - signed long int ephemOmegaA0; // -2147483648~2147483647 - signed short ephemCis; // -32768~32767 - signed long int ephemI0; // -2147483648~2147483647 - signed short ephemCrc; // -32768~32767 - signed long int ephemW; // -2147483648~2147483647 - signed long int ephemOmegaADot; // -8388608~8388607 - signed short ephemIDot; // -8192~8191 + signed char ephemTgd; /* -128~127 */ + unsigned short ephemToc; /* 0~37799 */ + signed char ephemAf2; /* -128~12 */ + signed short ephemAf1; /* -32768~32767 */ + signed long int ephemAf0; /* -2097152~2097151 */ + signed short ephemCrs; /* -32768~32767 */ + signed short ephemDeltaN; /* -32768~32767 */ + signed long int ephemM0; /* -2147483648~2147483647 */ + signed short ephemCuc; /* -32768~32767 */ + unsigned long int ephemE; /* 0~4294967295 */ + signed short ephemCus; /* -32768~32767 */ + unsigned long int ephemAPowrHalf; /* 0~4294967295 */ + unsigned short ephemToe; /* 0~37799 */ + signed char ephemFitFlag; /* 0~1 */ + unsigned char ephemAoda; /* 0~31 */ + signed short ephemCic; /* -32768~32767 */ + signed long int ephemOmegaA0; /* -2147483648~2147483647 */ + signed short ephemCis; /* -32768~32767 */ + signed long int ephemI0; /* -2147483648~2147483647 */ + signed short ephemCrc; /* -32768~32767 */ + signed long int ephemW; /* -2147483648~2147483647 */ + signed long int ephemOmegaADot; /* -8388608~8388607 */ + signed short ephemIDot; /* -8192~8191 */ } __attribute__((packed)) gps_navi_ephe_t; typedef enum { @@ -229,65 +231,65 @@ typedef struct { gps_navi_sat_info_t NavigationSatInfo[16]; } __attribute__((packed)) gps_navi_model_t; -// Iono_model +/* Iono_model */ typedef struct { - signed char alfa0; // -128~127 - signed char alfa1; // -128~127 - signed char alfa2; // -128~127 - signed char alfa3; // -128~127 - signed char beta0; // -128~127 - signed char beta1; // -128~127 - signed char beta2; // -128~127 - signed char beta3; // -128~127 + signed char alfa0; /* -128~127 */ + signed char alfa1; /* -128~127 */ + signed char alfa2; /* -128~127 */ + signed char alfa3; /* -128~127 */ + signed char beta0; /* -128~127 */ + signed char beta1; /* -128~127 */ + signed char beta2; /* -128~127 */ + signed char beta3; /* -128~127 */ } __attribute__((packed)) gps_iono_model_t; -// UTC_model +/* UTC_model */ typedef struct { - signed long int utcA1; // -8388608~8388607 - signed long int utcA0; // -2147483648~2147483647 - unsigned char utcTot; // 0~255 - unsigned char utcWNt; // 0~255 - signed char utcDeltaTls; // -128~127 - unsigned char utcWNlsf; // 0~255 - signed char utcDN; // -128~127 - signed char utcDeltaTlsf; // -128~127 + signed long int utcA1; /* -8388608~8388607 */ + signed long int utcA0; /* -2147483648~2147483647 */ + unsigned char utcTot; /* 0~255 */ + unsigned char utcWNt; /* 0~255 */ + signed char utcDeltaTls; /* -128~127 */ + unsigned char utcWNlsf; /* 0~255 */ + signed char utcDN; /* -128~127 */ + signed char utcDeltaTlsf; /* -128~127 */ } __attribute__((packed)) gps_utc_model_t; -// Almanac-model +/* Almanac-model */ typedef struct { - signed char dataId; // only for 3G, 0~3, if this value is -1, it means this value is invalid + signed char dataId; /* only for 3G, 0~3, if this value is -1, it means this value is invalid */ unsigned char satId; - unsigned short almanacE; // 0~65536 - unsigned char almanacToa; // 0~255 - signed short almanacKsii; // -32768~3276 - signed short almanacOmegaDot; // -32768~3276 - unsigned char almanacSvHealth; // 0~255 - unsigned long int almanacAPowerHalf; // 0~16777215 - signed long int almanacOmega0; // -8388608~8388607 - signed long int almanacW; // -8388608~8388607 - signed long int almanacM0; // -8388608~8388607 - signed short almanacAf0; // -1024~1023 - signed short almanacAf1; // -1024~1023 + unsigned short almanacE; /* 0~65536 */ + unsigned char almanacToa; /* 0~255 */ + signed short almanacKsii; /* -32768~3276 */ + signed short almanacOmegaDot; /* -32768~3276 */ + unsigned char almanacSvHealth; /* 0~255 */ + unsigned long int almanacAPowerHalf; /* 0~16777215 */ + signed long int almanacOmega0; /* -8388608~8388607 */ + signed long int almanacW; /* -8388608~8388607 */ + signed long int almanacM0; /* -8388608~8388607 */ + signed short almanacAf0; /* -1024~1023 */ + signed short almanacAf1; /* -1024~1023 */ } __attribute__((packed)) gps_almanac_sat_info_t; typedef struct { - unsigned char almanacWNa; // 0~255 + unsigned char almanacWNa; /* 0~255 */ unsigned long int numberOfSat; gps_almanac_sat_info_t AlmanacSatInfo[64]; } __attribute__((packed)) gps_almanac_model_t; -// acq_assist +/* acq_assist */ typedef struct { unsigned char satId; - signed short doppler0; // -2048~2047 (real value is from -5120 to 5117.5 by step of 2.5) - unsigned char doppler1; // 0~63 (real value is from -0.966 to 0.483 by step of 0.023) - unsigned char dopplerUncertainty; // 0~7 (12.5, 25, 50, 100, 200) - unsigned short codePhase; // 0~1022 - unsigned char intCodePhase; // 0~19 - unsigned char gpsBitNumber; // 0~3 - unsigned char codePhaseSearchWindow; // 0~15 (1023, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192) - unsigned char azimuth; // 0~31, 11.25 degree resolution - unsigned char elevation; // 0~7, 11.25 degree resolution + signed short doppler0; /* -2048~2047 (real value is from -5120 to 5117.5 by step of 2.5) */ + unsigned char doppler1; /* 0~63 (real value is from -0.966 to 0.483 by step of 0.023) */ + unsigned char dopplerUncertainty; /* 0~7 (12.5, 25, 50, 100, 200) */ + unsigned short codePhase; /* 0~1022 */ + unsigned char intCodePhase; /* 0~19 */ + unsigned char gpsBitNumber; /* 0~3 */ + unsigned char codePhaseSearchWindow; /* 0~15 (1023, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192) */ + unsigned char azimuth; /* 0~31, 11.25 degree resolution */ + unsigned char elevation; /* 0~7, 11.25 degree resolution */ } __attribute__((packed)) gps_acq_sat_info_t; typedef struct { @@ -300,7 +302,7 @@ typedef struct { union { gps_gsm_time_t gsm_time; gps_acq_utran_time_t AcqUtranTime; - } acquisitionTimeInfo; // --- not supported. + } acquisitionTimeInfo; /* --- not supported. */ unsigned long int numberOfSat; gps_acq_sat_info_t lcsAcquisitionSatInfo[16]; } __attribute__((packed)) gps_acq_assist_t; @@ -311,7 +313,7 @@ typedef struct { } __attribute__((packed)) gps_r_time_int_t; -// Assist-data +/* Assist-data */ typedef struct { unsigned long int flag; gps_ref_time_t ref_time; @@ -322,8 +324,8 @@ typedef struct { gps_utc_model_t utc_model; gps_almanac_model_t almanac; gps_acq_assist_t acq_assist; - gps_r_time_int_t r_time_int; // not supported -} __attribute__((packed)) gps_assist_data_noti_t; // APGPS - GPS Assist Data Message - Notification + gps_r_time_int_t r_time_int; /* not supported */ +} __attribute__((packed)) gps_assist_data_noti_t; /* APGPS - GPS Assist Data Message - Notification */ typedef struct { char *psat_status; @@ -345,8 +347,8 @@ const doppler_status_info_t doppler_status_info_table[] = { {"hz200", 200}, }; -// postion measurement data structure. -// gps_method_e_type +/* postion measurement data structure. */ +/* gps_method_e_type */ typedef enum { GPS_METHODTYPE_INVALID, GPS_METHODTYPE_MS_ASSISTED, @@ -355,21 +357,21 @@ typedef enum { GPS_METHODTYPE_MS_ASSISTED_PREF } gps_method_e_type; -// gps_accuracy_t +/* gps_accuracy_t */ typedef struct { unsigned int flag; unsigned char horizontalAccuracy; unsigned char vertcalAccuracy; } __attribute__((packed)) gps_accuracy_t; -// gps_use_multi_sets_e_type +/* gps_use_multi_sets_e_type */ typedef enum { GPS_MULTIPLESETS_INVALID, GPS_MULTIPLESETS_MULTIPLESETS, GPS_MULTIPLESETS_ONESET } gps_use_multi_sets_e_type; -// gps_env_char_e_type +/* gps_env_char_e_type */ typedef enum { GPS_ENVIRONMENT_INVALID, GPS_ENVIRONMENT_BAD_AREA, @@ -377,21 +379,21 @@ typedef enum { GPS_ENVIRONMENT_MIXED_AREA } gps_env_char_e_type; -// gps_cell_timing_wnt_e_type +/* gps_cell_timing_wnt_e_type */ typedef enum { GPS_CELLTIMING_INVALID, GPS_CELLTIMING_WANTED, GPS_CELLTIMING_NOT_WANTED } gps_cell_timing_wnt_e_type; -// gps_add_assit_req_e_type +/* gps_add_assit_req_e_type */ typedef enum { GPS_ADDITIONAL_ASSISREQ_INVALID, GPS_ADDITIONAL_ASSISREQ_REQ, GPS_ADDITIONAL_ASSISREQ_NOT_REQ } gps_add_assit_req_e_type; -// gps measure position. +/* gps measure position. */ typedef struct { gps_method_e_type method_type; gps_accuracy_t accuracy; @@ -403,7 +405,7 @@ typedef struct { } __attribute__((packed)) gps_measure_position_indi_t; -// APGPS - Measure Position message - confirm +/* APGPS - Measure Position message - confirm */ typedef enum { GPS_MSR_POS_RES_LOCATION, GPS_MSR_POS_RES_GPS_MEASUREMENTS, @@ -434,21 +436,21 @@ typedef struct { gps_ext_ephe_chk_t extEphemerisChk; } __attribute__((packed)) gps_assistance_data_t; -// Measure Position message +/* Measure Position message */ typedef struct { - unsigned char satId; // Satellite ID - unsigned char cno; // 0~63, unit of dB-Hz - signed short doppler; // -32768~32767, Hz and scale factor 0.2 - unsigned short wholeChips; // 0~1022 - unsigned short fracChips; // 0~1024 + unsigned char satId; /* Satellite ID */ + unsigned char cno; /* 0~63, unit of dB-Hz */ + signed short doppler; /* -32768~32767, Hz and scale factor 0.2 */ + unsigned short wholeChips; /* 0~1022 */ + unsigned short fracChips; /* 0~1024 */ unsigned char lcsMultiPath; - unsigned char pseuRangeRmsErr; // 0~63 + unsigned char pseuRangeRmsErr; /* 0~63 */ } __attribute__((packed)) gps_measuremet_element_t; typedef struct { - unsigned long int gpsTow; // /< GPS time of week [msec] - unsigned short gpsWeek; // /< GPS week [0 .. 1023] - unsigned char nrOfSats; // /< number of satellites [1 .. 16] + unsigned long int gpsTow; /* /< GPS time of week [msec] */ + unsigned short gpsWeek; /* /< GPS week [0 .. 1023] */ + unsigned char nrOfSats; /* /< number of satellites [1 .. 16] */ gps_measuremet_element_t GpsMeasure[16]; } __attribute__((packed)) gps_measure_t; @@ -513,9 +515,9 @@ typedef struct { typedef struct { - unsigned long int gpsTow; // /< GPS time of week [msec] - unsigned short gpsWeek; // /< GPS week [0 .. 1023] - unsigned char fixType; // /< Fix type. 2D(0x01) or 3D(0x02) + unsigned long int gpsTow; /* /< GPS time of week [msec] */ + unsigned short gpsWeek; /* /< GPS week [0 .. 1023] */ + unsigned char fixType; /* /< Fix type. 2D(0x01) or 3D(0x02) */ gps_loc_info_t measured_loc_info; } __attribute__((packed)) gps_measure_loc_info_t; @@ -523,19 +525,19 @@ typedef struct { unsigned char valid; unsigned long int cellFrames; unsigned char choice_mode; - unsigned long int UtranFdd; // FDD Primary Scrambling Code - unsigned long int UtranTdd; // TDD Cell Parameter ID - unsigned long int sfn; // SFN + unsigned long int UtranFdd; /* FDD Primary Scrambling Code */ + unsigned long int UtranTdd; /* TDD Cell Parameter ID */ + unsigned long int sfn; /* SFN */ } __attribute__((packed)) gps_utrangps_ref_time_t; typedef struct { - unsigned char result; // 0x00 : SUCCESS, 0x01 : Fail - gps_msr_pos_res_e_type response_type; // should be 4 byte + unsigned char result; /* 0x00 : SUCCESS, 0x01 : Fail */ + gps_msr_pos_res_e_type response_type; /* should be 4 byte */ gps_measure_t gps_measure; gps_measure_loc_info_t loc_info; gps_assistance_data_t measured_assit_data; - gps_utrangps_ref_time_t UtranGpsRefTime; // only for 3G -} __attribute__((packed)) gps_measure_position_confirm_t; // APGPS - Measure Position message - confirm + gps_utrangps_ref_time_t UtranGpsRefTime; /* only for 3G */ +} __attribute__((packed)) gps_measure_position_confirm_t; /* APGPS - Measure Position message - confirm */ typedef struct { char *name; @@ -555,7 +557,7 @@ static t_element elements[] = { /************************************************************************** -* Local Function Prototypes +* Local Function Prototypes **************************************************************************/ static inline int _modem_sat_status_info_2_tel_sat_info(char *sat_info); @@ -586,22 +588,22 @@ static void _set_coordinate(xmlNodePtr node, gps_ellipsoid_po_t *point, int isal static void _set_loc_info_ellipse_elements(xmlNodePtr node, void *elliplse, int is_unc_ellipse); -static xmlChar* _generate_confirm_measure_pos_xml_text(gps_measure_position_confirm_t *gps_measure_position_confirm); +static xmlChar *_generate_confirm_measure_pos_xml_text(gps_measure_position_confirm_t *gps_measure_position_confirm); static gboolean on_notification_gps_measure_position_from_modem(CoreObject *o, char *file_name, void *user_data); /************************************************************************** -* Local Function Definitions +* Local Function Definitions **************************************************************************/ static inline int _modem_sat_status_info_2_tel_sat_info(char *sat_info) { int count; - for (count = 0; count < (int) (sizeof(sat_status_info_table) / sizeof(sat_status_info_t)); count++) { + for (count = 0; count < (int) (sizeof(sat_status_info_table) / sizeof(sat_status_info_t)); count++) if (strcmp(sat_status_info_table[count].psat_status, sat_info) == 0) return (sat_status_info_table[count].stat_status); - } + return (-1); } @@ -609,10 +611,10 @@ static inline int _modem_acqa_assit_doppler_2_tel_doppler(char *doppler_info) { int count; - for (count = 0; count < (int) (sizeof(doppler_status_info_table) / sizeof(doppler_status_info_t)); count++) { + for (count = 0; count < (int) (sizeof(doppler_status_info_table) / sizeof(doppler_status_info_t)); count++) if (strcmp(doppler_status_info_table[count].pdoppler_status, doppler_info) == 0) return (doppler_status_info_table[count].doppler_status); - } + return (-1); } @@ -620,10 +622,9 @@ static int _gps_element_compare(char *element[], char *element_str, int nelem) { int count; - for (count = 0; count < nelem; count++) { + for (count = 0; count < nelem; count++) if (strcmp(element[count], element_str) == 0) return count; - } return -1; } @@ -633,10 +634,10 @@ static enum gps_assist_element_type _get_element_type(char *element_str) { unsigned int index; - for (index = 0; index < sizeof(elements) / sizeof(t_element); index++) { + for (index = 0; index < sizeof(elements) / sizeof(t_element); index++) if (strcmp(elements[index].name, element_str) == 0) return elements[index].type; - } + return -1; } @@ -668,54 +669,45 @@ static void _parse_ref_time_gps_elements(char *element_str, char *element_value, if (GPS_TOW_assist) { switch (node_count) { case 2: - { gpsdata_assist->ref_time.GpsTowAssist[count].satID = atoi(element_value); dbg("GpsTowAssist[%d].satID = %d\n", count, gpsdata_assist->ref_time.GpsTowAssist[count].satID); gpsdata_assist->ref_time.nrOfSats = count + 1; - } break; case 3: - { gpsdata_assist->ref_time.GpsTowAssist[count].tlmWord = atoi(element_value); dbg("GpsTowAssist[%d]-tlmWord = %d\n", count, gpsdata_assist->ref_time.GpsTowAssist[count].tlmWord); gpsdata_assist->ref_time.nrOfSats = count + 1; - } break; case 4: - { gpsdata_assist->ref_time.GpsTowAssist[count].antiSpoofFlag = *element_value; dbg("GpsTowAssist[%d]-antiSpoofFlag = 0x%X\n", count, gpsdata_assist->ref_time.GpsTowAssist[count].antiSpoofFlag); gpsdata_assist->ref_time.nrOfSats = count + 1; - } break; case 5: - { gpsdata_assist->ref_time.GpsTowAssist[count].alertFlag = *element_value; dbg("GpsTowAssist[%d]-alertFlag = 0x%X\n", count, gpsdata_assist->ref_time.GpsTowAssist[count].alertFlag); gpsdata_assist->ref_time.nrOfSats = count + 1; - } break; case 6: - { gpsdata_assist->ref_time.GpsTowAssist[count].tmlReservedBits = *element_value; dbg("GpsTowAssist[%d]-tmlReservedBits = 0x%X\n", count, gpsdata_assist->ref_time.GpsTowAssist[count].tmlReservedBits); gpsdata_assist->ref_time.nrOfSats = count + 1; - } break; default: dbg("Invalid gps element"); + break; } } } static void _parse_location_parameters(char *element_str, char *element_value, gps_assist_data_noti_t *gpsdata_assist) { - // unsigned char shapeType; and unsigned char hemisphere not supported. + /* unsigned char shapeType; and unsigned char hemisphere not supported. */ static char *element[] = { "north", "degrees", "height_above_surface", "height", "longitude", "uncert_semi_major", "uncert_semi_minor", @@ -731,77 +723,58 @@ static void _parse_location_parameters(char *element_str, char *element_value, g switch (count) { case 0: - { - // gpsdata_assist.ref_loc.latitude_data.north = atoi(element_str_text); - // dbg("gpsdata_assist.ref_loc.latitude_data.north - %d\n",gpsdata_assist.ref_loc.latitude_data.north); - } + /* gpsdata_assist.ref_loc.latitude_data.north = atoi(element_str_text); */ + /* dbg("gpsdata_assist.ref_loc.latitude_data.north - %d\n",gpsdata_assist.ref_loc.latitude_data.north); */ break; case 1: - { gpsdata_assist->ref_loc.latitude = atoi(element_value); dbg("latitude_data.degrees - %d\n", gpsdata_assist->ref_loc.latitude); - } break; case 2: - { - // gpsdata_assist.ref_loc.altitude_data.height_above_surface = atoi(element_str_text); - // dbg("altitude_data.height_above_surface - %d\n",gpsdata_assist.ref_loc.altitude_data.height_above_surface); - } + /* gpsdata_assist.ref_loc.altitude_data.height_above_surface = atoi(element_str_text); */ + /* dbg("altitude_data.height_above_surface - %d\n",gpsdata_assist.ref_loc.altitude_data.height_above_surface); */ break; case 3: - { - gpsdata_assist->ref_loc.altitude = atoi(element_value); // todo- need to confirm + gpsdata_assist->ref_loc.altitude = atoi(element_value); /* todo- need to confirm */ dbg("altitude_data.height - %d\n", gpsdata_assist->ref_loc.altitude); - } break; case 4: - { gpsdata_assist->ref_loc.longitude = atoi(element_value); dbg("longitude - %d\n", gpsdata_assist->ref_loc.longitude); - } break; case 5: - { gpsdata_assist->ref_loc.semiMajorUncert = *element_value; dbg("semiMajorUncert - 0x%X\n", gpsdata_assist->ref_loc.semiMajorUncert); - } break; case 6: - { gpsdata_assist->ref_loc.semiMinorUncert = *element_value; dbg("uncert_semi_minor - 0x%X\n", gpsdata_assist->ref_loc.semiMinorUncert); - } break; case 7: - { gpsdata_assist->ref_loc.majorAxis = *element_value; dbg("orient_major - 0x%X\n", gpsdata_assist->ref_loc.majorAxis); - } break; case 8: - { gpsdata_assist->ref_loc.confidence = *element_value; dbg("confidence - 0x%X\n", gpsdata_assist->ref_loc.confidence); - } break; case 9: - { gpsdata_assist->ref_loc.altUncert = *element_value; dbg("altUncert - 0x%X\n", gpsdata_assist->ref_loc.altUncert); - } break; default: dbg("invalid element"); + break; } } @@ -811,19 +784,24 @@ static void _parse_dgps_correction_gps_elements(char *element_str, char *element if (strcmp(element_str, "sat_id") == 0) { gpsdata_assist->dgps_corrections.seqOfSatElement[0].satId = *element_value; - dbg("seqOfSatElement[0].satId - %d\n", gpsdata_assist->dgps_corrections.seqOfSatElement[0].satId); + dbg("seqOfSatElement[0].satId - %d\n", + gpsdata_assist->dgps_corrections.seqOfSatElement[0].satId); } else if (strcmp(element_str, "IODE") == 0) { gpsdata_assist->dgps_corrections.seqOfSatElement[0].iode = atoi(element_value); - dbg("seqOfSatElement[0].iode - %d\n", gpsdata_assist->dgps_corrections.seqOfSatElement[0].iode); + dbg("seqOfSatElement[0].iode - %d\n", + gpsdata_assist->dgps_corrections.seqOfSatElement[0].iode); } else if (strcmp(element_str, "UDRE") == 0) { gpsdata_assist->dgps_corrections.seqOfSatElement[0].udre = *element_value; - dbg("seqOfSatElement[0].udre- %d\n", gpsdata_assist->dgps_corrections.seqOfSatElement[0].udre); + dbg("seqOfSatElement[0].udre- %d\n", + gpsdata_assist->dgps_corrections.seqOfSatElement[0].udre); } else if (strcmp(element_str, "PRC") == 0) { gpsdata_assist->dgps_corrections.seqOfSatElement[0].pseudoRangeCor = atoi(element_value); - dbg("seqOfSatElement[0].pseudoRangeCor - %d\n", gpsdata_assist->dgps_corrections.seqOfSatElement[0].pseudoRangeCor); + dbg("seqOfSatElement[0].pseudoRangeCor - %d\n", + gpsdata_assist->dgps_corrections.seqOfSatElement[0].pseudoRangeCor); } else if (strcmp(element_str, "RRC") == 0) { gpsdata_assist->dgps_corrections.seqOfSatElement[0].rangeRateCor = atoi(element_value); - dbg("seqOfSatElement[0].rangeRateCor - %d\n", gpsdata_assist->dgps_corrections.seqOfSatElement[0].rangeRateCor); + dbg("seqOfSatElement[0].rangeRateCor - %d\n", + gpsdata_assist->dgps_corrections.seqOfSatElement[0].rangeRateCor); } } @@ -837,63 +815,48 @@ static void _parse_ionospheric_model_gps_elements(char *element_str, char *eleme dbg("enter"); switch (count) { case 0: - { gpsdata_assist->iono_model.alfa0 = *element_value; dbg("alfa0 - 0x%X\n", gpsdata_assist->iono_model.alfa0); - } break; case 1: - { gpsdata_assist->iono_model.alfa1 = *element_value; dbg("alfa1 - 0x%X\n", gpsdata_assist->iono_model.alfa1); - } break; case 2: - { gpsdata_assist->iono_model.alfa2 = *element_value; dbg("alfa2 - 0x%X\n", gpsdata_assist->iono_model.alfa2); - } break; case 3: - { gpsdata_assist->iono_model.alfa3 = *element_value; dbg("alfa3 - 0x%X\n", gpsdata_assist->iono_model.alfa3); - } break; case 4: - { gpsdata_assist->iono_model.beta0 = *element_value; dbg("beta0 - 0x%X\n", gpsdata_assist->iono_model.beta0); - } break; case 5: - { gpsdata_assist->iono_model.beta1 = *element_value; dbg("beta1 -0x%X\n", gpsdata_assist->iono_model.beta1); - } break; case 6: - { gpsdata_assist->iono_model.beta2 = *element_value; dbg("beta2 - 0x%X\n", gpsdata_assist->iono_model.beta2); - } break; case 7: - { gpsdata_assist->iono_model.beta3 = *element_value; dbg("beta3 - 0x%X\n", gpsdata_assist->iono_model.beta3); - } break; default: dbg("invalid gps element"); + break; } } @@ -908,68 +871,54 @@ void _parse_utc_model_gps_elements(char *element_str, char *element_value, gps_a switch (count) { case 0: - { gpsdata_assist->utc_model.utcA1 = atoi(element_value); dbg("utcA1 - %d\n", gpsdata_assist->utc_model.utcA1); - } break; case 1: - { gpsdata_assist->utc_model.utcA0 = atoi(element_value); dbg("utcA0 - %d\n", gpsdata_assist->utc_model.utcA0); - } break; case 2: - { gpsdata_assist->utc_model.utcTot = *element_value; dbg("utcTot - 0x%X\n", gpsdata_assist->utc_model.utcTot); - } break; case 3: - { gpsdata_assist->utc_model.utcWNt = *element_value; dbg("utcWNt - 0x%X\n", gpsdata_assist->utc_model.utcWNt); - } break; case 4: - { gpsdata_assist->utc_model.utcDeltaTls = *element_value; dbg("utcDeltaTls -0x%X\n", gpsdata_assist->utc_model.utcDeltaTls); - } break; case 5: - { gpsdata_assist->utc_model.utcWNlsf = *element_value; dbg("utcWNlsf - 0x%X\n", gpsdata_assist->utc_model.utcWNlsf); - } break; case 6: - { gpsdata_assist->utc_model.utcDN = *element_value; dbg("utcDN - 0x%X\n", gpsdata_assist->utc_model.utcDN); - } break; case 7: - { gpsdata_assist->utc_model.utcDeltaTlsf = *element_value; dbg("utcDeltaTlsf - 0x%X\n", gpsdata_assist->utc_model.utcDeltaTlsf); - } break; default: dbg("invalid gps element"); + break; } } -static void _parse_almanc_model_gps_elements(char *element_str, char *element_value, gps_assist_data_noti_t *gpsdata_assist, - gboolean alm_elem, int count) +static void _parse_almanc_model_gps_elements(char *element_str, + char *element_value, gps_assist_data_noti_t *gpsdata_assist, + gboolean alm_elem, int count) { int nelem; int node_count; @@ -995,101 +944,75 @@ static void _parse_almanc_model_gps_elements(char *element_str, char *element_va if (alm_elem) { switch (node_count) { case 1: - { gpsdata_assist->almanac.AlmanacSatInfo[count].dataId = *element_value; dbg("AlmanacSatInfo[%d].data_id - 0x%X\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].dataId); - } break; case 2: - { gpsdata_assist->almanac.AlmanacSatInfo[count].satId = *element_value; dbg("AlmanacSatInfo[%d].sat_id - 0x%X\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].satId); - } break; case 3: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacE = atoi(element_value); dbg("AlmanacSatInfo[%d].almanacE - %d\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacE); - } break; case 4: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacToa = *element_value; dbg("AlmanacSatInfo[%d].almanacToa - 0x%X\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacToa); - } break; case 5: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacKsii = *element_value; dbg("AlmanacSatInfo[%d].almanacKsii - 0x%X\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacKsii); - } break; case 6: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacOmegaDot = *element_value; dbg("AlmanacSatInfo[%d].almanacOmegaDot - 0x%X\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacOmegaDot); - } break; case 7: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacSvHealth = *element_value; dbg("AlmanacSatInfo[%d].almanacSvHealth - 0x%X\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacSvHealth); - } break; case 8: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacAPowerHalf = atoi(element_value); dbg("AlmanacSatInfo[%d].almanacAPowerHalf - %d\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacAPowerHalf); - } break; case 9: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacOmega0 = atoi(element_value); dbg("AlmanacSatInfo[%d].almanacOmega0 - %d\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacOmega0); - } break; case 10: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacW = atoi(element_value); dbg("AlmanacSatInfo[%d].almanacW - %d\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacW); - } break; case 11: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacM0 = atoi(element_value); dbg("AlmanacSatInfo[%d].almanacM0 - %d\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacM0); - } break; case 12: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacAf0 = atoi(element_value); dbg("AlmanacSatInfo[%d].almanacAf0 - %d\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacAf0); - } break; case 13: - { gpsdata_assist->almanac.AlmanacSatInfo[count].almanacAf1 = atoi(element_value); dbg("AlmanacSatInfo[%d].almanacAf1 - %d\n", count, gpsdata_assist->almanac.AlmanacSatInfo[count].almanacAf1); - } break; default: dbg("invalid gps element"); + break; } } - return; } static void _parse_acqu_assist_gps_elements(char *element_str, char *element_value, gps_assist_data_noti_t *gpsdata_assist) @@ -1105,60 +1028,61 @@ static void _parse_acqu_assist_gps_elements(char *element_str, char *element_val case 0: gpsdata_assist->acq_assist.gpsTow = atoi(element_value); dbg("acq_assist.gpsTow - %d\n", gpsdata_assist->acq_assist.gpsTow); - break; + break; case 1: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].satId = *element_value; dbg("lcsAcquisitionSatInfo[0].satId - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].satId); - break; + break; case 2: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].doppler0 = atoi(element_value); dbg("lcsAcquisitionSatInfo[0].dopl0 - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].doppler0); - break; + break; case 3: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].doppler1 = *element_value; dbg("lcsAcquisitionSatInfo[0].doppler1 - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].doppler1); - break; + break; case 4: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].codePhase = atoi(element_value); dbg("lcsAcquisitionSatInfo[0].codePhase - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].codePhase); - break; + break; case 5: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].intCodePhase = *element_value; dbg("lcsAcquisitionSatInfo[0].intCodePhase - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].intCodePhase); - break; + break; case 6: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].gpsBitNumber = *element_value; dbg("lcsAcquisitionSatInfo[0].GPS_bitno - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].gpsBitNumber); - break; + break; case 7: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].codePhaseSearchWindow = *element_value; dbg("lcsAcquisitionSatInfo[0].codePhaseSearchWindow - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].codePhaseSearchWindow); - break; + break; case 8: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].azimuth = *element_value; dbg("lcsAcquisitionSatInfo[0].azimuth - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].azimuth); - break; + break; case 9: gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].elevation = *element_value; dbg("lcsAcquisitionSatInfo[0].elevation - 0x%X\n", gpsdata_assist->acq_assist.lcsAcquisitionSatInfo[0].elevation); - break; + break; default: dbg("invalid gps element"); + break; } } -static void _parse_nav_model_gps_elements(char *element_str, char *element_value, gps_assist_data_noti_t - *gpsdata_assist, gboolean ephem_and_clock, int element_count) +static void _parse_nav_model_gps_elements(char *element_str, char *element_value, + gps_assist_data_noti_t *gpsdata_assist, gboolean ephem_and_clock, int element_count) { static char *element[] = { "sat_id", "l2_code", "ura", "sv_health", "iodc", "l2p_flag", "esr1", "esr2", "esr3", "esr4", "tgd", "toc", "af2", "af0", @@ -1185,171 +1109,173 @@ static void _parse_nav_model_gps_elements(char *element_str, char *element_value switch (count) { case 1: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemCodeOnL2 = *element_value; - break; + break; case 2: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemUra = *element_value; - break; + break; case 3: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemSvHealth = *element_value; - break; + break; case 4: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemIodc = atoi(element_value); - break; + break; case 5: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemL2PFlag = *element_value; - break; + break; case 6: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.NavigationSubFrameRsv.rsv1 = atoi(element_value); - break; + break; case 7: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.NavigationSubFrameRsv.rsv2 = atoi(element_value); - break; + break; case 8: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.NavigationSubFrameRsv.rsv3 = atoi(element_value); - break; + break; case 9: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.NavigationSubFrameRsv.rsv4 = atoi(element_value); - break; + break; case 10: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemTgd = *element_value; - break; + break; case 11: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemToc = atoi(element_value); - break; + break; case 12: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemAf2 = *element_value; - break; + break; case 13: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemAf1 = atoi(element_value); - break; + break; case 14: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemAf0 = atoi(element_value); - break; + break; case 15: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemCrs = atoi(element_value); - break; + break; case 16: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemDeltaN = atoi(element_value); - break; + break; case 17: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemM0 = atoi(element_value); - break; + break; case 18: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemCuc = atoi(element_value); - break; + break; case 19: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemE = atoi(element_value); - break; + break; case 20: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemCus = atoi(element_value); - break; + break; case 21: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemAPowrHalf = atoi(element_value); - break; + break; case 22: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemToe = atoi(element_value); - break; + break; case 23: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemFitFlag = *element_value; - break; + break; case 24: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemAoda = *element_value; - break; + break; case 25: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemCic = atoi(element_value); - break; + break; case 26: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemI0 = atoi(element_value); - break; + break; case 27: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemCrc = atoi(element_value); - break; + break; case 28: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemW = atoi(element_value); - break; + break; case 29: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemIDot = atoi(element_value); - break; + break; case 30: gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemOmegaADot = atoi(element_value); - dbg("NavigationSatInfo[%d].NavigationEphemeris.ephemOmegaADot - 0x%X\n", element_count, gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemOmegaADot); - break; + dbg("NavigationSatInfo[%d].NavigationEphemeris.ephemOmegaADot - 0x%X\n", + element_count, gpsdata_assist->navi_model.NavigationSatInfo[element_count].NavigationEphemeris.ephemOmegaADot); + break; default: dbg("invalid gps element"); + break; } } } -// Set coordinate elements : +/* Set coordinate elements : */ static void _set_coordinate(xmlNodePtr node, gps_ellipsoid_po_t *point, int isalt, int altitude) { - // .. .. (xmlNodePtr node) - // 0 0 0 - // 0 0 - // .. .. <\parent_node> + /* .. .. (xmlNodePtr node) */ + /* 0 0 0 */ + /* 0 0 */ + /* .. .. <\parent_node> */ xmlNodePtr coordinate_node = NULL, temp_node = NULL; memset(node_name, 0x00, sizeof(node_name)); memset(node_value, 0x00, sizeof(node_value)); - sprintf(node_name, "%s", "coordinate"); + snprintf(node_name, NODE_SIZE, "%s", "coordinate"); coordinate_node = xmlNewChild(node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "latitude"); + snprintf(node_name, NODE_SIZE, "%s", "latitude"); temp_node = xmlNewChild(coordinate_node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "north"); - sprintf(node_value, "%d", 0); + snprintf(node_name, NODE_SIZE, "%s", "north"); + snprintf(node_value, NODE_SIZE, "%d", 0); xmlNewChild(temp_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "degrees"); - sprintf(node_value, "%d", (int) point->latitude); + snprintf(node_name, NODE_SIZE, "%s", "degrees"); + snprintf(node_value, NODE_SIZE, "%d", (int) point->latitude); xmlNewChild(temp_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "longitude"); - sprintf(node_value, "%d", (int) point->longitude); + snprintf(node_name, NODE_SIZE, "%s", "longitude"); + snprintf(node_value, NODE_SIZE, "%d", (int) point->longitude); xmlNewChild(coordinate_node, NULL, BAD_CAST node_name, BAD_CAST node_value); if (isalt) { - sprintf(node_name, "%s", "altitude"); + snprintf(node_name, NODE_SIZE, "%s", "altitude"); temp_node = xmlNewChild(node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "height_above_surface"); - sprintf(node_value, "%d", 0); + snprintf(node_name, NODE_SIZE, "%s", "height_above_surface"); + snprintf(node_value, NODE_SIZE, "%d", 0); xmlNewChild(temp_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "height"); - sprintf(node_value, "%d", altitude); + snprintf(node_name, NODE_SIZE, "%s", "height"); + snprintf(node_value, NODE_SIZE, "%d", altitude); xmlNewChild(temp_node, NULL, BAD_CAST node_name, BAD_CAST node_value); } return; @@ -1378,24 +1304,24 @@ static void _set_loc_info_ellipse_elements(xmlNodePtr node, void *elliplse, int confidence = p_alt_unc_ellipse->confidence; } - sprintf(node_name, "%s", "uncert_semi_major"); - sprintf(node_value, "%d", semiMajorAxis); + snprintf(node_name, NODE_SIZE, "%s", "uncert_semi_major"); + snprintf(node_value, NODE_SIZE, "%d", semiMajorAxis); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "uncert_semi_minor"); - sprintf(node_value, "%d", semiMinorAxis); + snprintf(node_name, NODE_SIZE, "%s", "uncert_semi_minor"); + snprintf(node_value, NODE_SIZE, "%d", semiMinorAxis); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "orient_major"); - sprintf(node_value, "%d", orientationAngle); + snprintf(node_name, NODE_SIZE, "%s", "orient_major"); + snprintf(node_value, NODE_SIZE, "%d", orientationAngle); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "confidence"); - sprintf(node_value, "%d", confidence); + snprintf(node_name, NODE_SIZE, "%s", "confidence"); + snprintf(node_value, NODE_SIZE, "%d", confidence); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); } -static xmlChar* _generate_confirm_measure_pos_xml_text(gps_measure_position_confirm_t *gps_measure_position_confirm) +static xmlChar *_generate_confirm_measure_pos_xml_text(gps_measure_position_confirm_t *gps_measure_position_confirm) { xmlDocPtr doc = NULL; xmlNodePtr root_node = NULL, node = NULL; @@ -1404,81 +1330,87 @@ static xmlChar* _generate_confirm_measure_pos_xml_text(gps_measure_position_conf int count = 0, altitude, size; /* - Creates a new XML document + Creates a new XML document ================================================================================================================================ - - - - - - - - - - - - - - - < - - - - - - - - - - - <> <\> ... - - - - - <> <\>.. - - - - - - - <> <\>... - - - - - <> <\>.. - - - - - - - - <> <\>.. .. - - - - - - - - - - <> <\> .. - < - - - - - - - - - - - + + + + + + + + + + + + + + < + + + + + + + + + + + + + <> <\> ... + + + + + + <> <\>.. + + + + + + + + <> <\>... + + + + + + <> <\>.. + + + + + + + + + <> <\>.. .. + + + + + + + + + + + <> <\> .. + < + + + + + + + + + + + ================================================================================================================================ */ @@ -1487,174 +1419,174 @@ static xmlChar* _generate_confirm_measure_pos_xml_text(gps_measure_position_conf memset(node_name, 0x00, sizeof(node_name)); memset(node_value, 0x00, sizeof(node_value)); - // root element - sprintf(node_name, "%s", POSITION_NODE); - // Creation of a new node element + /* root element */ + snprintf(node_name, NODE_SIZE, "%s", POSITION_NODE); + /* Creation of a new node element */ root_node = xmlNewNode(NULL, BAD_CAST node_name); - // Set the root element of the document + /* Set the root element of the document */ xmlDocSetRootElement(doc, root_node); - sprintf(node_name, "%s", POSITION_NODE_ATTR_XSI); - sprintf(node_value, "%s", POSITION_NODE_ATTR_VAL_XSI); - // Create a new property carried by a node + snprintf(node_name, NODE_SIZE, "%s", POSITION_NODE_ATTR_XSI); + snprintf(node_value, NODE_SIZE, "%s", POSITION_NODE_ATTR_VAL_XSI); + /* Create a new property carried by a node */ xmlNewProp(root_node, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", POSITION_NODE_ATTR_XMLNS); - sprintf(node_value, "%s", POSITION_NODE_ATTR_VAL_XMLNS); + snprintf(node_name, NODE_SIZE, "%s", POSITION_NODE_ATTR_XMLNS); + snprintf(node_value, NODE_SIZE, "%s", POSITION_NODE_ATTR_VAL_XMLNS); xmlNewProp(root_node, BAD_CAST node_name, BAD_CAST node_value); - // 1.GPS measure. - // Creation of a new child element, added at the end of @parent children list - sprintf(node_name, "%s", "GPS_meas"); + /* 1.GPS measure. */ + /* Creation of a new child element, added at the end of @parent children list */ + snprintf(node_name, NODE_SIZE, "%s", "GPS_meas"); gps_msr_node = xmlNewChild(root_node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "ref_time_only"); + snprintf(node_name, NODE_SIZE, "%s", "ref_time_only"); node = xmlNewChild(gps_msr_node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "tow_msec"); - sprintf(node_value, "%d", (int) gps_measure_position_confirm->gps_measure.gpsTow); + snprintf(node_name, NODE_SIZE, "%s", "tow_msec"); + snprintf(node_value, NODE_SIZE, "%d", (int) gps_measure_position_confirm->gps_measure.gpsTow); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - // creatation of elements. + /* creatation of elements. */ for (count = 0; count < gps_measure_position_confirm->gps_measure.nrOfSats; count++) { xmlNodePtr multipath_node = NULL; - sprintf(node_name, "%s", "meas_params"); + snprintf(node_name, NODE_SIZE, "%s", "meas_params"); node = xmlNewChild(gps_msr_node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "sat_id"); - sprintf(node_value, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].satId); + snprintf(node_name, NODE_SIZE, "%s", "sat_id"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].satId); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "carr2_noise"); - sprintf(node_value, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].cno); + snprintf(node_name, NODE_SIZE, "%s", "carr2_noise"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].cno); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "dopl"); - sprintf(node_value, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].doppler); + snprintf(node_name, NODE_SIZE, "%s", "dopl"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].doppler); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "whole_chips"); - sprintf(node_value, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].wholeChips); + snprintf(node_name, NODE_SIZE, "%s", "whole_chips"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].wholeChips); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "fract_chips"); - sprintf(node_value, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].fracChips); + snprintf(node_name, NODE_SIZE, "%s", "fract_chips"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].fracChips); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "multi_path"); - sprintf(node_value, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].lcsMultiPath); + snprintf(node_name, NODE_SIZE, "%s", "multi_path"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].lcsMultiPath); multipath_node = xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); xmlNewProp(multipath_node, BAD_CAST "literal", BAD_CAST "not_measured"); - sprintf(node_name, "%s", "psr_rms_err"); - sprintf(node_value, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].pseuRangeRmsErr); + snprintf(node_name, NODE_SIZE, "%s", "psr_rms_err"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->gps_measure.GpsMeasure[count].pseuRangeRmsErr); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); } - // 2.Location. - sprintf(node_name, "%s", "location"); + /* 2.Location. */ + snprintf(node_name, NODE_SIZE, "%s", "location"); node = xmlNewChild(root_node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "time_of_fix"); - sprintf(node_value, "%d", gps_measure_position_confirm->loc_info.fixType); + snprintf(node_name, NODE_SIZE, "%s", "time_of_fix"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->loc_info.fixType); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - // location_parameters - sprintf(node_name, "%s", "location_parameters"); + /* location_parameters */ + snprintf(node_name, NODE_SIZE, "%s", "location_parameters"); node = xmlNewChild(node, NULL, BAD_CAST node_name, NULL); - // shape_data - sprintf(node_name, "%s", "shape_data"); + /* shape_data */ + snprintf(node_name, NODE_SIZE, "%s", "shape_data"); shape_data_node = xmlNewChild(node, NULL, BAD_CAST node_name, NULL); - // ellipsoid_point - sprintf(node_name, "%s", "ellipsoid_point"); + /* ellipsoid_point */ + snprintf(node_name, NODE_SIZE, "%s", "ellipsoid_point"); node = xmlNewChild(shape_data_node, NULL, BAD_CAST node_name, NULL); - // set coordinate. + /* set coordinate. */ _set_coordinate(node, &(gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_po), 0, 0); - // ellipsoid_point_uncert_circle - sprintf(node_name, "%s", "ellipsoid_point_uncert_circle"); + /* ellipsoid_point_uncert_circle */ + snprintf(node_name, NODE_SIZE, "%s", "ellipsoid_point_uncert_circle"); node = xmlNewChild(shape_data_node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "uncert_circle"); - sprintf(node_value, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.p_unc_clrcle.uncertainRadius); + snprintf(node_name, NODE_SIZE, "%s", "uncert_circle"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.p_unc_clrcle.uncertainRadius); xmlNewChild(node, NULL, BAD_CAST node_name, BAD_CAST node_value); - // set coordinate parameters. + /* set coordinate parameters. */ _set_coordinate(node, &(gps_measure_position_confirm->loc_info.measured_loc_info.p_unc_clrcle.point), 0, 0); - // ellipsoid_point_uncert_ellipse - sprintf(node_name, "%s", "ellipsoid_point_uncert_ellipse"); + /* ellipsoid_point_uncert_ellipse */ + snprintf(node_name, NODE_SIZE, "%s", "ellipsoid_point_uncert_ellipse"); loc_child_node = xmlNewChild(shape_data_node, NULL, BAD_CAST node_name, NULL); - // set coordinate parameters. + /* set coordinate parameters. */ _set_coordinate(loc_child_node, &(gps_measure_position_confirm->loc_info.measured_loc_info.p_unc_clrcle.point), 0, 0); - sprintf(node_name, "%s", "uncert_ellipse"); + snprintf(node_name, NODE_SIZE, "%s", "uncert_ellipse"); node = xmlNewChild(loc_child_node, NULL, BAD_CAST node_name, NULL); - // set location ellipse parametes. + /* set location ellipse parametes. */ _set_loc_info_ellipse_elements(node, &(gps_measure_position_confirm->loc_info.measured_loc_info.p_unc_ellipse), 1); - sprintf(node_name, "%s", "polygon"); + snprintf(node_name, NODE_SIZE, "%s", "polygon"); loc_child_node = xmlNewChild(shape_data_node, NULL, BAD_CAST node_name, NULL); for (count = 0; count < gps_measure_position_confirm->loc_info.measured_loc_info.polygon.noOfPoints; count++) { - // set coordinate parameters. + /* set coordinate parameters. */ _set_coordinate(loc_child_node, &(gps_measure_position_confirm->loc_info.measured_loc_info.polygon.points[count]), 0, 0); } - // ellipsoid_point_alt - sprintf(node_name, "%s", "ellipsoid_point_alt"); + /* ellipsoid_point_alt */ + snprintf(node_name, NODE_SIZE, "%s", "ellipsoid_point_alt"); loc_child_node = xmlNewChild(shape_data_node, NULL, BAD_CAST node_name, NULL); altitude = gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_alt.altitude; - // set coordinate parameters. + /* set coordinate parameters. */ _set_coordinate(loc_child_node, &(gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_alt.point), 1, altitude); - // ellipsoid_point_alt_uncertellipse - sprintf(node_name, "%s", "ellipsoid_point_alt_uncertellipse"); + /* ellipsoid_point_alt_uncertellipse */ + snprintf(node_name, NODE_SIZE, "%s", "ellipsoid_point_alt_uncertellipse"); loc_child_node = xmlNewChild(shape_data_node, NULL, BAD_CAST node_name, NULL); altitude = gps_measure_position_confirm->loc_info.measured_loc_info.p_alt_unc_ellipse.altitude; - // set coordinate parameters. + /* set coordinate parameters. */ _set_coordinate(loc_child_node, &(gps_measure_position_confirm->loc_info.measured_loc_info.p_alt_unc_ellipse.point), 1, altitude); - // set location ellipse parametes. + /* set location ellipse parametes. */ _set_loc_info_ellipse_elements(loc_child_node, &(gps_measure_position_confirm->loc_info.measured_loc_info.p_alt_unc_ellipse), 0); - sprintf(node_name, "%s", "uncert_alt"); - sprintf(node_value, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.p_alt_unc_ellipse.uncertainAltitude); + snprintf(node_name, NODE_SIZE, "%s", "uncert_alt"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.p_alt_unc_ellipse.uncertainAltitude); xmlNewChild(loc_child_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - // ellipsoid_point_alt_uncertellipse - sprintf(node_name, "%s", "ellips_arc"); + /* ellipsoid_point_alt_uncertellipse */ + snprintf(node_name, NODE_SIZE, "%s", "ellips_arc"); loc_child_node = xmlNewChild(shape_data_node, NULL, BAD_CAST node_name, NULL); _set_coordinate(loc_child_node, &(gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.point), 0, 0); - sprintf(node_name, "%s", "inner_rad"); - sprintf(node_value, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.innerRadius); + snprintf(node_name, NODE_SIZE, "%s", "inner_rad"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.innerRadius); xmlNewChild(loc_child_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "uncert_rad"); - sprintf(node_value, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.uncertainRadius); + snprintf(node_name, NODE_SIZE, "%s", "uncert_rad"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.uncertainRadius); xmlNewChild(loc_child_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "offset_angle"); - sprintf(node_value, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.offsetAngle); + snprintf(node_name, NODE_SIZE, "%s", "offset_angle"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.offsetAngle); xmlNewChild(loc_child_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "included_angle"); - sprintf(node_value, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.includedAngle); + snprintf(node_name, NODE_SIZE, "%s", "included_angle"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.includedAngle); xmlNewChild(loc_child_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - sprintf(node_name, "%s", "confidence"); - sprintf(node_value, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.confidence); + snprintf(node_name, NODE_SIZE, "%s", "confidence"); + snprintf(node_value, NODE_SIZE, "%d", gps_measure_position_confirm->loc_info.measured_loc_info.ellipsoid_arc.confidence); xmlNewChild(loc_child_node, NULL, BAD_CAST node_name, BAD_CAST node_value); - // 3. assist data /msr_assist_data - sprintf(node_name, "%s", "assist_data"); + /* 3. assist data /msr_assist_data */ + snprintf(node_name, NODE_SIZE, "%s", "assist_data"); node = xmlNewChild(root_node, NULL, BAD_CAST node_name, NULL); - sprintf(node_name, "%s", "msr_assist_data"); + snprintf(node_name, NODE_SIZE, "%s", "msr_assist_data"); xmlNewChild(node, NULL, BAD_CAST node_name, NULL); - // Dump an XML document in memory and return the #xmlChar * and it's size in bytes + /* Dump an XML document in memory and return the #xmlChar * and it's size in bytes */ xmlDocDumpMemory(doc, &xml, &size); dbg("xmlcontetnt:\n"); dbg("%s", (char *) xml); - // Free up all the structures used by a document, tree included. + /* Free up all the structures used by a document, tree included. */ xmlFreeDoc(doc); xmlCleanupParser(); return xml; @@ -1667,7 +1599,7 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event char *node = NULL, *node_value = NULL; char *attribute = NULL, *attr_value = NULL; enum gps_assist_element_type node_type = -1, set_element_type = -1; - int nav_model_node_count = -1; + int nav_model_node_count = 0; int alm_node_count = -1; int gps_tow_assist_count = -1; char *line = NULL, *pos = NULL; @@ -1680,49 +1612,49 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event dbg("enter"); /* - Example:GPS assist XML data will be in below format. + Example:GPS assist XML data will be in below format. ================================================================================================================================ - +CPOSR: - - - - - <> <\>..<\GPS_time> <> <\> ..<\GPS_TOW_assist> - - - - <> <\>... <\altitude> - - - - - - - - - - - <> <\> .. .. <\ephem_and_clock> - - - - - - - - - - - 0 <> <\> ...<\alm_elem> - - - - <> <\> ... <\sat_info> - - - - - + +CPOSR: + + + + + <> <\>..<\GPS_time> <> <\> ..<\GPS_TOW_assist> + + + + <> <\>... <\altitude> + + + + + + + + + + + <> <\> .. .. <\ephem_and_clock> + + + + + + + + + + + 0 <> <\> ...<\alm_elem> + + + + <> <\> ... <\sat_info> + + + + + ================================================================================================================================ */ @@ -1736,50 +1668,52 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event pos = (char *) xml_line; } line = g_strdup((char *) pos); - // open file. + + /* open file. */ if ((fd = open(FILE_NAME, O_WRONLY | O_CREAT | O_TRUNC | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, S_IRWXU)) == -1) { dbg("Cannot open file\n"); g_free(line); return FALSE; } - // write gps xml data into file. + + /* write gps xml data into file. */ if (write(fd, (const void *) line, strlen(line)) == -1) { dbg("Cannot write into file\n"); close(fd); g_free(line); return FALSE; } - // free the memory pointed to by line. + + /* free the memory pointed to by line. */ g_free(line); dbg("read xml file"); reader = xmlReaderForFile(FILE_NAME, NULL, 0); while (xmlTextReaderRead(reader)) { - // Get the node type of the current node + /* Get the node type of the current node */ switch (xmlTextReaderNodeType(reader)) { - case XML_READER_TYPE_ELEMENT: - { - // Read the qualified name of the node. + case XML_READER_TYPE_ELEMENT: { + /* Read the qualified name of the node. */ node = (char *) xmlTextReaderConstName(reader); dbg("Element: %s\n ", node); if (node != NULL) { - // check type of sub element of + /* check type of sub element of */ set_element_type = _get_element_type(node); - if ((int) set_element_type != -1) // ignore negative value as excepted element type not set. + if ((int) set_element_type != -1) /* ignore negative value as excepted element type not set. */ node_type = set_element_type; dbg("xml node type : %d", node_type); - // Check for position measurement data. + /* Check for position measurement data. */ if (strcmp(node, "pos_meas") == 0) { - // Deallocate all the resources associated to the reader + /* Deallocate all the resources associated to the reader */ xmlFreeTextReader(reader); xmlCleanupParser(); dbg("gps postion measurement notification "); - // GPS position measurement notification. + /* GPS position measurement notification. */ ret = on_notification_gps_measure_position_from_modem(o, FILE_NAME, user_data); - // remove file. + /* remove file. */ close(fd); if (access(FILE_NAME, F_OK) == 0) { if (remove(FILE_NAME)) @@ -1788,47 +1722,46 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event return ret; } - // Moves the position of the current instance to the next attribute associated with the current node. + /* Moves the position of the current instance to the next attribute associated with the current node. */ while (xmlTextReaderMoveToNextAttribute(reader)) { - // Read the qualified name of the node + /* Read the qualified name of the node */ attribute = (char *) xmlTextReaderConstName(reader); dbg("attribute value - %s\n", attribute); - // Provides the text value of the node if present. + /* Provides the text value of the node if present. */ attr_value = (char *) xmlTextReaderConstValue(reader); dbg("=\"%s\"\n", attr_value); - // Read attribute value of + /* Read attribute value of */ if (node_type == NAV_MODEL_ELEM) { if (strcmp(node, "sat_status") == 0 && strcmp(attribute, "literal") == 0) { gps_data_assist.navi_model.NavigationSatInfo[nav_model_node_count].NavigationSatStatus = _modem_sat_status_info_2_tel_sat_info(attr_value); dbg("navigation sat status of nav model element - %d\n", gps_data_assist.navi_model.NavigationSatInfo[nav_model_node_count].NavigationSatStatus); } } - // Read attribute value of + /* Read attribute value of */ else if (node_type == ACQU_ASSIST) { if (strcmp(node, "dopl1_uncert") == 0 && strcmp(attribute, "literal") == 0) { gps_data_assist.acq_assist.lcsAcquisitionSatInfo[0].dopplerUncertainty = _modem_acqa_assit_doppler_2_tel_doppler(attr_value); dbg("doppler uncertainty of acqu assist data- %d", gps_data_assist.acq_assist.lcsAcquisitionSatInfo[0].dopplerUncertainty); } } - } // end of attribute check. + } /* end of attribute check. */ - // check GPS data is having GPS_assist data. - if (strcmp(node, "GPS_assist") == 0) { + /* check GPS data is having GPS_assist data. */ + if (strcmp(node, "GPS_assist") == 0) _gps_assist_data = TRUE; - } if (_gps_assist_data == TRUE) { - // number of GPS_TOW_assist elements. + /* number of GPS_TOW_assist elements. */ if (strcmp(node, "GPS_TOW_assist") == 0) { gps_tow_assist_count++; gps_tow_assist = TRUE; } else if (strcmp(node, "nav_model_elem") == 0) { - // number of nav_model_elem. + /* number of nav_model_elem. */ nav_model_node_count++; } else if (strcmp(node, "alm_elem") == 0) { - // number of alm_elem elements. + /* number of alm_elem elements. */ alm_node_count++; dbg("alm_elem_count - %d", alm_node_count); if (node_type == ALMANAC) @@ -1839,12 +1772,11 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event } } xmlTextReaderMoveToElement(reader); - } // end of reading node type. + } /* end of reading node type. */ break; - case XML_READER_TYPE_TEXT: - { - // Provides the text value of the node if present + case XML_READER_TYPE_TEXT: { + /* Provides the text value of the node if present */ node_value = (char *) xmlTextReaderConstValue(reader); dbg("node_value: %s\n", node_value); @@ -1886,16 +1818,16 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event dbg("invalid element"); } } - } // end of reading node value. + } /* end of reading node value. */ break; } - } // end of parsing. + } /* end of parsing. */ - // Deallocate all the resources associated to the reader + /* Deallocate all the resources associated to the reader */ xmlFreeTextReader(reader); xmlCleanupParser(); - // remove xml file. + /* remove xml file. */ close(fd); if (access(FILE_NAME, F_OK) == 0) { if (remove(FILE_NAME)) @@ -1903,7 +1835,9 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event } tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), - o, TNOTI_GPS_ASSIST_DATA, sizeof(gps_data_assist), &gps_data_assist); + o, + TNOTI_GPS_ASSIST_DATA, + sizeof(gps_data_assist), &gps_data_assist); return TRUE; } @@ -1921,12 +1855,14 @@ static gboolean on_notification_gps_measure_position_from_modem(CoreObject *o, c while (xmlTextReaderRead(reader)) { switch (xmlTextReaderNodeType(reader)) { - case XML_READER_TYPE_ELEMENT: - { + case XML_READER_TYPE_ELEMENT: { node = (char *) xmlTextReaderConstName(reader); + if (!node) + return FALSE; + dbg("Element: %s", node); if (node != NULL) { - // Read attribute value. + /* Read attribute value. */ while (xmlTextReaderMoveToNextAttribute(reader)) { attribute = (char *) xmlTextReaderConstName(reader); dbg("Attribute value - %s\n", attribute); @@ -1955,37 +1891,35 @@ static gboolean on_notification_gps_measure_position_from_modem(CoreObject *o, c gps_measure_position_indi.cell_timing_wnt = GPS_CELLTIMING_NOT_WANTED; } } - } // end of attribute check + } /* end of attribute check */ - if (strcmp(node, "ms_assisted") == 0) { + if (strcmp(node, "ms_assisted") == 0) gps_measure_position_indi.method_type = GPS_METHODTYPE_MS_ASSISTED; - } else if (strcmp(node, "ms_assisted_no_accuracy") == 0) { + else if (strcmp(node, "ms_assisted_no_accuracy") == 0) gps_measure_position_indi.method_type = GPS_METHODTYPE_MS_ASSISTED; - } else if (strcmp(node, "ms_based") == 0) { + else if (strcmp(node, "ms_based") == 0) gps_measure_position_indi.method_type = GPS_METHODTYPE_MS_BASED; - } else if (strcmp(node, "ms_based_pref") == 0) { + else if (strcmp(node, "ms_based_pref") == 0) gps_measure_position_indi.method_type = GPS_METHODTYPE_MS_BASED_PREF; - } else if (strcmp(node, "ms_assisted_pref") == 0) { + else if (strcmp(node, "ms_assisted_pref") == 0) gps_measure_position_indi.method_type = GPS_METHODTYPE_MS_ASSISTED_PREF; - } } xmlTextReaderMoveToElement(reader); } break; - case XML_READER_TYPE_TEXT: - { + case XML_READER_TYPE_TEXT: { node_value = (char *) xmlTextReaderConstValue(reader); dbg("element-value: %s", node_value); if (node_value != NULL) { - if (strcmp(node, "resp_time_seconds") == 0) { + if (strcmp(node_value, "resp_time_seconds") == 0) { gps_measure_position_indi.rsp_time = *node_value; dbg("gps_measure_position_indi.rsp_time - 0x%x", gps_measure_position_indi.rsp_time); } if (rep_quant == TRUE) { - if (strcmp(node, "hor_acc") == 0) + if (strcmp(node_value, "hor_acc") == 0) gps_measure_position_indi.accuracy.horizontalAccuracy = *node_value; - else if (strcmp(node, "vert_acc") == 0) + else if (strcmp(node_value, "vert_acc") == 0) gps_measure_position_indi.accuracy.vertcalAccuracy = *node_value; } } @@ -2002,19 +1936,17 @@ static gboolean on_notification_gps_measure_position_from_modem(CoreObject *o, c } -// CONFIRMATION +/* CONFIRMATION */ static void on_confirmation_gps_message_send(TcorePending *p, gboolean result, void *user_data) { dbg("Entry"); - if (result == FALSE) { // Fail + if (result == FALSE) /* Fail */ dbg("SEND FAIL"); - } else { + else dbg("SEND OK"); - } dbg("Exit"); - return; } static gboolean on_notification_reset_assist_data(CoreObject *o, const void *event_info, void *user_data) @@ -2027,7 +1959,7 @@ static gboolean on_notification_reset_assist_data(CoreObject *o, const void *eve } static void on_confirmation_gps_measure_position(TcorePending *p, int data_len, const void *data, void *user_data) { - //GPS server does not except confirmation for GPS measure position request. + /* GPS server does not except confirmation for GPS measure position request. */ dbg("enter"); dbg("exit"); @@ -2053,20 +1985,26 @@ static TReturn gps_confirm_measure_pos(CoreObject *o, UserRequest *ur) data = (unsigned char *) tcore_user_request_ref_data(ur, &data_len); memcpy(&gps_measure_pos_confirm, data, data_len); - // make confirm measure postion request in xml format. + /* make confirm measure postion request in xml format. */ xml = _generate_confirm_measure_pos_xml_text(&gps_measure_pos_confirm); if (!xml) { err("xml text generation failed"); return TCORE_RETURN_EINVAL; } - // AT+CPOStext is entered + /* AT+CPOStext is entered */ raw_str = g_strdup_printf("AT+CPOS%s", "\r"); cmd_str = g_strdup_printf("%s%s\x1A", raw_str, xml); dbg("command string : %s", cmd_str); pending = tcore_pending_new(o, 0); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + g_free(raw_str); + return TCORE_RETURN_EINVAL; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, strlen(cmd_str), req); tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); @@ -2074,9 +2012,9 @@ static TReturn gps_confirm_measure_pos(CoreObject *o, UserRequest *ur) tcore_pending_set_response_callback(pending, on_confirmation_gps_measure_position, NULL); tcore_pending_link_user_request(pending, ur); - // HAL + /* HAL */ hal = tcore_object_get_hal(o); - // Send request to HAL + /* Send request to HAL */ ret = tcore_hal_send_request(hal, pending); if (TCORE_RETURN_SUCCESS != ret) { err("Request send failed"); @@ -2099,7 +2037,7 @@ gboolean imc_gps_init(TcorePlugin *cp, CoreObject *co_gps) dbg("Enter"); /* Set operations */ - tcore_gps_set_ops(co_gps, &gps_ops); + tcore_gps_set_ops(co_gps, &gps_ops, TCORE_OPS_TYPE_CP); tcore_object_add_callback(co_gps, "+CPOSR", on_notification_gps_assist_data, NULL); tcore_object_add_callback(co_gps, "+XCPOSR", on_notification_reset_assist_data, NULL); diff --git a/src/imc_modem.c b/src/imc_modem.c index 625e555..1530088 100644 --- a/src/imc_modem.c +++ b/src/imc_modem.c @@ -35,176 +35,119 @@ #include #include #include -#include #include "imc_common.h" #include "imc_modem.h" #include "nvm/nvm.h" - -#define ID_RESERVED_AT 0x0229 - -#define MAX_VERSION_LEN 32 -#define TAPI_MISC_ME_SN_LEN_MAX 32 -#define TAPI_MISC_PRODUCT_CODE_LEN_MAX 32 -#define TAPI_MISC_MODEL_ID_LEN_MAX 17 -#define TAPI_MISC_PRL_ERI_VER_LEN_MAX 17 - -#define CPAS_RES_READY 0 -#define CPAS_RES_UNAVAIL 1 -#define CPAS_RES_UNKNOWN 2 -#define CPAS_RES_RINGING 3 -#define CPAS_RES_CALL_PROGRESS 4 -#define CPAS_RES_ASLEEP 5 -#define AT_VER_LEN 20 - - -enum cp_state { - CP_STATE_OFFLINE, - CP_STATE_CRASH_RESET, - CP_STATE_CRASH_EXIT, - CP_STATE_BOOTING, - CP_STATE_ONLINE, - CP_STATE_NV_REBUILDING, - CP_STATE_LOADER_DONE, -}; - -typedef enum { - TAPI_MISC_ME_IMEI = 0x00, /**< 0x00: IMEI, GSM/UMTS device */ - TAPI_MISC_ME_ESN = 0x01, /**< 0x01: ESN(Electronic Serial Number), It`s essentially run out. CDMA device */ - TAPI_MISC_ME_MEID = 0x02, /**< 0x02: MEID, This value can have hexa decimal digits. CDMA device */ - TAPI_MISC_ME_MAX = 0xff /**< 0xff: reserved */ -} TelMiscSNIndexType_t; - -typedef struct { - TelMiscSNIndexType_t sn_index; /**< serial number index */ - int sn_len; /**< Length */ - unsigned char szNumber[TAPI_MISC_ME_SN_LEN_MAX]; /**< Number */ -} TelMiscSNInformation; - -/** - * Mobile Equipment Version Information +/* + * Modem Private data */ typedef struct { - unsigned char ver_mask; /**< version mask - 0x01:SW_ver, 0x02:HW_ver, 0x04:RF_CAL_date, 0x08:Product_code, 0x10:Model_ID, 0x20:PRL, 0x04:ERI, 0xff:all */ - unsigned char szSwVersion[MAX_VERSION_LEN]; /**< Software version, null termination */ - unsigned char szHwVersion[MAX_VERSION_LEN]; /**< Hardware version, null termination */ - unsigned char szRfCalDate[MAX_VERSION_LEN]; /**< Calculation Date, null termination */ - unsigned char szProductCode[TAPI_MISC_PRODUCT_CODE_LEN_MAX]; /**< product code, null termination */ - unsigned char szModelId[TAPI_MISC_MODEL_ID_LEN_MAX]; /**< model id (only for CDMA), null termination */ - unsigned char prl_nam_num; /**< number of PRL NAM fields */ - unsigned char szPrlVersion[TAPI_MISC_PRL_ERI_VER_LEN_MAX * 3]; /**< prl version (only for CDMA), null termination */ - unsigned char eri_nam_num; /**< number of PRL NAM fields */ - unsigned char szEriVersion[TAPI_MISC_PRL_ERI_VER_LEN_MAX * 3]; /**< eri version (only for CDMA), null termination */ -} TelMiscVersionInformation; - - -static void prepare_and_send_pending_request(CoreObject *co, const char *at_cmd, const char *prefix, enum tcore_at_command_type at_cmd_type, TcorePendingResponseCallback callback); -static void on_confirmation_modem_message_send(TcorePending *p, gboolean result, void *user_data); -static void on_response_network_registration(TcorePending *p, int data_len, const void *data, void *user_data); -static void on_response_enable_proactive_command(TcorePending *p, int data_len, const void *data, void *user_data); + /* IMEI */ + gboolean imei_valid; /**< IMEI validatity flag */ + char imei[MODEM_DEVICE_IMEI_LEN_MAX]; + + /* Version information */ + gboolean version_valid; /**< Version validatity flag */ + char software[33]; + char hardware[33]; + char calibration[33]; + char product_code[33]; +} PrivateData; + +static void on_confirmation_modem_message_send(TcorePending *pending, + gboolean result, void *user_data); +static void on_response_network_registration(TcorePending *pending, + int data_len, const void *data, void *user_data); +static void on_response_enable_proactive_command(TcorePending *pending, + int data_len, const void *data, void *user_data); /* NVM */ -static gboolean on_event_nvm_update(CoreObject *o, const void *event_info, void *user_data); -static void modem_unsuspend_nvm_updates(CoreObject *o); -static void modem_send_nvm_update_ack(CoreObject *o); -static void modem_send_nvm_update_request_ack(CoreObject *o); - -static void on_confirmation_modem_message_send(TcorePending *p, gboolean result, void *user_data) +static gboolean on_event_modem_nvm_update(CoreObject *co_modem, + const void *event_info, void *user_data); +static void modem_unsuspend_nvm_updates(CoreObject *co_modem); +static void modem_send_nvm_update_ack(CoreObject *co_modem); +static void modem_send_nvm_update_request_ack(CoreObject *co_modem); + +static void on_confirmation_modem_message_send(TcorePending *pending, + gboolean result, void *user_data) { - dbg("on_confirmation_modem_message_send - msg out from queue.\n"); - - if (result == FALSE) { - /* Fail */ - dbg("SEND FAIL"); - } else { - dbg("SEND OK"); - } + dbg("Request send: [%s]", (result == TRUE ? "Success" : "Fail")); } -static void on_response_enable_proactive_command(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_enable_proactive_command(TcorePending *pending, + int data_len, const void *data, void *user_data) { - const TcoreATResponse *resp = data; + const TcoreATResponse *at_resp = data; - if (resp->success > 0) { - dbg("RESPONSE OK proactive command enabled"); - } else { - dbg("RESPONSE NOK proactive command disabled"); - } + dbg("[Response] Pro-active command enabling - RESPONSE '%s'", + (at_resp->success > 0 ? "OK" : "NOK")); } -static void on_response_network_registration(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_network_registration(TcorePending *pending, + int data_len, const void *data, void *user_data) { - const TcoreATResponse *resp = data; + const TcoreATResponse *at_resp = data; - if (resp->success > 0) { - dbg("registration attempt OK"); - } else { - dbg("registration attempt failed"); - } + dbg("[Response] Network Registration enable - RESPONSE '%s'", + (at_resp->success > 0 ? "OK" : "NOK")); } -void prepare_and_send_pending_request(CoreObject *co, const char *at_cmd, const char *prefix, enum tcore_at_command_type at_cmd_type, TcorePendingResponseCallback callback) +static void on_response_modem_power_off(TcorePending *pending, + int data_len, const void *data, void *user_data) { - TcoreATRequest *req = NULL; - TcoreHal *hal = NULL; - TcorePending *pending = NULL; - TReturn ret; - - hal = tcore_object_get_hal(co); - dbg("hal: %p", hal); - - pending = tcore_pending_new(co, 0); - if (!pending) - dbg("Pending is NULL"); - req = tcore_at_request_new(at_cmd, prefix, at_cmd_type); - - dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); - - tcore_pending_set_request_data(pending, 0, req); - tcore_pending_set_response_callback(pending, callback, NULL); - tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); - ret = tcore_hal_send_request(hal, pending); - - if (ret != TCORE_RETURN_SUCCESS) - err("Failed to send AT request - ret: [0x%x]", ret); + const TcoreATResponse *at_resp = data; + struct tresp_modem_power_off modem_power_off_resp; + CoreObject *co_modem = 0; + UserRequest *ur; + TcoreHal *h = 0; -} + dbg("[Response] Modem Power OFF - RESPONSE '%s'", + (at_resp->success > 0 ? "OK" : "NOK")); -static void on_response_power_off(TcorePending *p, int data_len, const void *data, void *user_data) -{ - CoreObject *o = 0; - TcoreHal *h = 0; + co_modem = tcore_pending_ref_core_object(pending); + h = tcore_object_get_hal(co_modem); - o = tcore_pending_ref_core_object(p); - h = tcore_object_get_hal(o); + if (at_resp->success > 0) { + modem_power_off_resp.result = TCORE_RETURN_SUCCESS; - dbg("modem power off"); + /* Update HAL state */ + tcore_hal_set_power_state(h, FALSE); + } else { + modem_power_off_resp.result = TCORE_RETURN_FAILURE; + } - tcore_hal_set_power_state(h, FALSE); + /* Send Response */ + ur = tcore_pending_ref_user_request(pending); + tcore_user_request_send_response(ur, + TRESP_MODEM_POWER_OFF, + sizeof(struct tresp_modem_power_off), &modem_power_off_resp); } -static void on_response_set_flight_mode(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_modem_set_flight_mode(TcorePending *pending, + int data_len, const void *data, void *user_data) { - CoreObject *o = NULL; + CoreObject *co_modem = NULL; UserRequest *ur = NULL; - const TcoreATResponse *ATresp = data; - struct tresp_modem_set_flightmode res = {0}; + const TcoreATResponse *at_resp = data; + struct tresp_modem_set_flightmode modem_set_flightmode_resp = {0}; int response = 0; struct tnoti_modem_flight_mode modem_flight_mode = {0}; - o = tcore_pending_ref_core_object(p); - ur = tcore_pending_ref_user_request(p); + co_modem = tcore_pending_ref_core_object(pending); + ur = tcore_pending_ref_user_request(pending); - if (ATresp->success > 0) { - dbg("RESPONSE OK - flight mode operation finished"); - res.result = TCORE_RETURN_SUCCESS; + dbg("[Response] Modem Set Flight mode - RESPONSE '%s'", + (at_resp->success > 0 ? "OK" : "NOK")); + + if (at_resp->success > 0) { + modem_set_flightmode_resp.result = TCORE_RETURN_SUCCESS; } else { GSList *tokens = NULL; const char *line = NULL; - dbg("RESPONSE NOK"); - line = (const char *) ATresp->final_response; + line = (const char *) at_resp->final_response; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) < 1) { @@ -215,249 +158,297 @@ static void on_response_set_flight_mode(TcorePending *p, int data_len, const voi /* TODO: CMEE error mapping is required. */ } tcore_at_tok_free(tokens); - res.result = TCORE_RETURN_3GPP_ERROR; + modem_set_flightmode_resp.result = TCORE_RETURN_3GPP_ERROR; } if (NULL == ur) { - dbg("No user request. Internal request created during boot-up sequence"); + dbg("Internal request created during boot-up sequence"); - if (ATresp->success > 0) { - modem_flight_mode.enable = tcore_modem_get_flight_mode_state(o); - dbg("sucess case - Sending Flight Mode Notification (%d) to Telephony Server", modem_flight_mode.enable); + if (at_resp->success > 0) { + Server *server; - tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_MODEM_FLIGHT_MODE, - sizeof(struct tnoti_modem_flight_mode), &modem_flight_mode); + modem_flight_mode.enable = + tcore_modem_get_flight_mode_state(co_modem); + dbg("Sending Flight Mode Notification (%d) to Telephony Server", + modem_flight_mode.enable); + + server = tcore_plugin_ref_server(tcore_object_ref_plugin(co_modem)); + + /* Send Notification */ + tcore_server_send_notification(server, + co_modem, TNOTI_MODEM_FLIGHT_MODE, + sizeof(struct tnoti_modem_flight_mode), &modem_flight_mode); } } else { + Server *server; const struct treq_modem_set_flightmode *req_data = NULL; dbg("Sending response for Flight mode operation"); req_data = tcore_user_request_ref_data(ur, NULL); - if (TCORE_RETURN_SUCCESS == res.result) { - if (TRUE == req_data->enable){ - tcore_modem_set_flight_mode_state(o, TRUE); - } else { - tcore_modem_set_flight_mode_state(o, FALSE); - } + if (TCORE_RETURN_SUCCESS == modem_set_flightmode_resp.result) { + if (TRUE == req_data->enable) + tcore_modem_set_flight_mode_state(co_modem, TRUE); + else + tcore_modem_set_flight_mode_state(co_modem, FALSE); } - tcore_user_request_send_response(ur, TRESP_MODEM_SET_FLIGHTMODE, sizeof(struct tresp_modem_set_flightmode), &res); - modem_flight_mode.enable = tcore_modem_get_flight_mode_state(o); - tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_MODEM_FLIGHT_MODE, - sizeof(struct tnoti_modem_flight_mode), &modem_flight_mode); + /* Send Response */ + tcore_user_request_send_response(ur, + TRESP_MODEM_SET_FLIGHTMODE, + sizeof(struct tresp_modem_set_flightmode), &modem_set_flightmode_resp); + + modem_flight_mode.enable = tcore_modem_get_flight_mode_state(co_modem); + + + server = tcore_plugin_ref_server(tcore_object_ref_plugin(co_modem)); + + /* Send Notification */ + tcore_server_send_notification(server, + co_modem, TNOTI_MODEM_FLIGHT_MODE, + sizeof(struct tnoti_modem_flight_mode), &modem_flight_mode); if (req_data->enable == 0) { dbg("Flight mode is disabled, trigger COPS to register on network"); + /* Trigger Network registration (for the moment automatic) */ - prepare_and_send_pending_request(o, "AT+COPS=0", NULL, TCORE_AT_NO_RESULT, NULL); + tcore_prepare_and_send_at_request(co_modem, + "AT+COPS=0", NULL, + TCORE_AT_NO_RESULT, NULL, + NULL, NULL, + NULL, NULL, 0, NULL, NULL); } } } -static void on_response_imei(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_modem_get_imei(TcorePending *pending, + int data_len, const void *data, void *user_data) { - const TcoreATResponse *resp = data; - TcorePlugin *plugin = NULL; - struct tresp_modem_get_imei res; - TelMiscSNInformation *imei_property = NULL; + const TcoreATResponse *at_resp = data; + struct tresp_modem_get_imei modem_get_imei_resp; UserRequest *ur = NULL; GSList *tokens = NULL; const char *line; - int response = 0; - memset(&res, 0, sizeof(struct tresp_modem_get_imei)); + memset(&modem_get_imei_resp, 0x0, sizeof(struct tresp_modem_get_imei)); + + if (at_resp->success > 0) { + CoreObject *co = NULL; + PrivateData *priv_data = NULL; - if (resp->success > 0) { dbg("RESPONSE OK"); - if (resp->lines) { - line = (const char *) resp->lines->data; + + if (at_resp->lines) { + line = (const char *) at_resp->lines->data; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) != 1) { msg("invalid message"); goto OUT; } } - res.result = TCORE_RETURN_SUCCESS; - strncpy(res.imei, g_slist_nth_data(tokens, 0), 16); - dbg("imei = [%s]", res.imei); + modem_get_imei_resp.result = TCORE_RETURN_SUCCESS; + strncpy(modem_get_imei_resp.imei, g_slist_nth_data(tokens, 0), MODEM_DEVICE_IMEI_LEN_MAX - 1); + dbg("IMEI: [%s]", modem_get_imei_resp.imei); - plugin = tcore_pending_ref_plugin(p); - imei_property = tcore_plugin_ref_property(plugin, "IMEI"); - if (imei_property) { - imei_property->sn_index = TAPI_MISC_ME_IMEI; - imei_property->sn_len = strlen(res.imei); - memcpy(imei_property->szNumber, res.imei, imei_property->sn_len); - } + /* Cache IMEI */ + co = tcore_pending_ref_core_object(pending); + priv_data = tcore_object_ref_user_data(co); + priv_data->imei_valid = TRUE; + strncpy(priv_data->imei, modem_get_imei_resp.imei, MODEM_DEVICE_IMEI_LEN_MAX - 1); } else { dbg("RESPONSE NOK"); - if (resp->lines) { - line = (const char *) resp->lines->data; + + if (at_resp->lines) { + line = (const char *) at_resp->lines->data; tokens = tcore_at_tok_new(line); } - if (g_slist_length(tokens) < 1) { dbg("err cause not specified or string corrupted"); - res.result = TCORE_RETURN_3GPP_ERROR; + + modem_get_imei_resp.result = TCORE_RETURN_3GPP_ERROR; } else { - response = atoi(g_slist_nth_data(tokens, 0)); + int response = atoi(g_slist_nth_data(tokens, 0)); err("error response: %d", response); + /* TODO: CMEE error mapping is required. */ - res.result = TCORE_RETURN_3GPP_ERROR; + modem_get_imei_resp.result = TCORE_RETURN_3GPP_ERROR; } } - ur = tcore_pending_ref_user_request(p); - tcore_user_request_send_response(ur, TRESP_MODEM_GET_IMEI, - sizeof(struct tresp_modem_get_imei), &res); + /* Send Response */ + ur = tcore_pending_ref_user_request(pending); + tcore_user_request_send_response(ur, + TRESP_MODEM_GET_IMEI, + sizeof(struct tresp_modem_get_imei), &modem_get_imei_resp); OUT: - if (tokens != NULL) - tcore_at_tok_free(tokens); - - return; + tcore_at_tok_free(tokens); } -static void on_response_version(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_modem_get_version(TcorePending *pending, + int data_len, const void *data, void *user_data) { - const TcoreATResponse *resp = data; - TcorePlugin *plugin = NULL; - struct tresp_modem_get_version res = {0}; - TelMiscVersionInformation *vi_property = NULL; - TelMiscVersionInformation *vi = NULL; + const TcoreATResponse *at_resp = data; + struct tresp_modem_get_version modem_get_version_resp; UserRequest *ur = NULL; GSList *tokens = NULL; const char *line = NULL; - char *swver = NULL; - char *hwver = NULL; - char *caldate = NULL; - char *pcode = NULL; - char *id = NULL; - int response = 0; - if (resp->success > 0) { + memset(&modem_get_version_resp, 0, sizeof(struct tresp_modem_get_version)); + + if (at_resp->success > 0) { + CoreObject *co = NULL; + PrivateData *priv_data = NULL; + + char *software_version = NULL; + char *hardware_version = NULL; + char *calibration_date = NULL; + char *product_code = NULL; + char *model_id = NULL; + dbg("RESPONSE OK"); - if (resp->lines) { - line = (const char *) resp->lines->data; + + if (at_resp->lines) { + line = (const char *) at_resp->lines->data; + tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) == 1) { - swver = g_slist_nth_data(tokens, 0); - dbg("version: sw=[%s]", swver); + software_version = g_slist_nth_data(tokens, 0); + dbg("Software version: [%s]", software_version); } else if (g_slist_length(tokens) == 5) { - swver = g_slist_nth_data(tokens, 0); - hwver = g_slist_nth_data(tokens, 1); - caldate = g_slist_nth_data(tokens, 2); - pcode = g_slist_nth_data(tokens, 3); - id = g_slist_nth_data(tokens, 4); - - dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]", - swver, hwver, caldate, pcode, id); + software_version = g_slist_nth_data(tokens, 0); + hardware_version = g_slist_nth_data(tokens, 1); + calibration_date = g_slist_nth_data(tokens, 2); + product_code = g_slist_nth_data(tokens, 3); + model_id = g_slist_nth_data(tokens, 4); + + dbg("Software version: [%s] Hardware version: [%s] " \ + "Calibration: [%s] Product code: [%s] Model ID: [%s]", + software_version, hardware_version, + calibration_date, product_code, model_id); } else { - msg("invalid message"); + err("Invalid message"); goto OUT; } } - vi = g_try_new0(TelMiscVersionInformation, 1); - if (NULL != swver) - memcpy(vi->szSwVersion, swver, strlen(swver)); - if (NULL != hwver) - memcpy(vi->szHwVersion, hwver, strlen(hwver)); - if (NULL != caldate) - memcpy(vi->szRfCalDate, caldate, strlen(caldate)); - if (NULL != pcode) - memcpy(vi->szProductCode, pcode, strlen(pcode)); - if (NULL != id) - memcpy(vi->szModelId, id, strlen(id)); - - memset(&res, 0, sizeof(struct tresp_modem_get_version)); - - if (NULL != swver) { - snprintf(res.software, - (AT_VER_LEN > strlen(swver) ? strlen(swver) : AT_VER_LEN), - "%s", swver); + co = tcore_pending_ref_core_object(pending); + priv_data = tcore_object_ref_user_data(co); + + /* + * Update response structure and Cache data + */ + priv_data->version_valid = TRUE; + + /* Software version */ + if (software_version) { + snprintf(modem_get_version_resp.software, + 33, "%s", software_version); + snprintf(priv_data->software, + 33, "%s", software_version); + } + + /* Hardware version */ + if (hardware_version) { + snprintf(modem_get_version_resp.hardware, + 33, "%s", hardware_version); + snprintf(priv_data->hardware, + 33, "%s", hardware_version); } - if (NULL != hwver) { - snprintf(res.hardware, - (AT_VER_LEN > strlen(hwver) ? strlen(hwver) : AT_VER_LEN), - "%s", hwver); + /* Calibration date */ + if (calibration_date) { + snprintf(modem_get_version_resp.calibration, + 33, "%s", calibration_date); + snprintf(priv_data->calibration, + 33, "%s", calibration_date); } - plugin = tcore_pending_ref_plugin(p); - vi_property = tcore_plugin_ref_property(plugin, "VERSION"); - memcpy(vi_property, vi, sizeof(TelMiscVersionInformation)); - g_free(vi); + /* Product code */ + if (product_code) { + snprintf(modem_get_version_resp.product_code, + 33, "%s", product_code); + snprintf(priv_data->product_code, + 33, "%s", product_code); + } } else { dbg("RESPONSE NOK"); - if (resp->lines) { - line = (const char *) resp->lines->data; + if (at_resp->lines) { + line = (const char *) at_resp->lines->data; tokens = tcore_at_tok_new(line); } - memset(&res, 0, sizeof(struct tresp_modem_get_version)); - - if (g_slist_length(tokens) < 1) { dbg("err cause not specified or string corrupted"); - res.result = TCORE_RETURN_3GPP_ERROR; + + modem_get_version_resp.result = TCORE_RETURN_3GPP_ERROR; } else { - response = atoi(g_slist_nth_data(tokens, 0)); + int response = atoi(g_slist_nth_data(tokens, 0)); err("error response: %d", response); + /* TODO: CMEE error mapping is required. */ - res.result = TCORE_RETURN_3GPP_ERROR; + modem_get_version_resp.result = TCORE_RETURN_3GPP_ERROR; } } - ur = tcore_pending_ref_user_request(p); - tcore_user_request_send_response(ur, TRESP_MODEM_GET_VERSION, - sizeof(struct tresp_modem_get_version), &res); + /* Send Response */ + ur = tcore_pending_ref_user_request(pending); + tcore_user_request_send_response(ur, + TRESP_MODEM_GET_VERSION, + sizeof(struct tresp_modem_get_version), &modem_get_version_resp); OUT: - if (tokens != NULL) - tcore_at_tok_free(tokens); - - return; + tcore_at_tok_free(tokens); } -static enum tcore_hook_return on_hook_sim_status(Server *s, - CoreObject *source, enum tcore_notification_command command, - unsigned int data_len, void *data, void *user_data) +static enum tcore_hook_return on_hook_modem_sim_init_status(Server *s, + CoreObject *source, enum tcore_notification_command command, + unsigned int data_len, void *data, void *user_data) { - TcorePlugin *plugin; const struct tnoti_sim_status *noti_sim_status; - CoreObject *co_sat; - CoreObject *co_network; - plugin = tcore_object_ref_plugin(source); - co_sat = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_SAT); - if (co_sat == NULL) - return TCORE_HOOK_RETURN_CONTINUE; + dbg("SIM INIT Status"); - co_network = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_NETWORK); - if (co_network == NULL) - return TCORE_HOOK_RETURN_CONTINUE; - - dbg("Get SIM status"); noti_sim_status = data; - if (noti_sim_status == NULL) + if (noti_sim_status == NULL) { + err("SIM notification data is NULL"); return TCORE_HOOK_RETURN_CONTINUE; + } /* If SIM is initialized, Enable STK and and attach to Network */ dbg("SIM Status: [%d]", noti_sim_status->sim_status); if (noti_sim_status->sim_status == SIM_STATUS_INIT_COMPLETED) { + TcorePlugin *plugin; + CoreObject *co_network; + CoreObject *co_sat; + dbg("SIM ready for attach!!! Enable STK and attach to Network"); - /* Sending AT+CFUN=6 */ - prepare_and_send_pending_request(co_sat, "AT+CFUN=6", NULL, - TCORE_AT_NO_RESULT, on_response_enable_proactive_command); + plugin = tcore_object_ref_plugin(source); + + co_network = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_NETWORK); + if (co_network) { + /* Sending AT+COPS */ + tcore_prepare_and_send_at_request(co_network, + "AT+COPS=0", NULL, + TCORE_AT_NO_RESULT, NULL, + on_response_network_registration, NULL, + NULL, NULL, 0, NULL, NULL); + } + + co_sat = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_SAT); + if (co_sat) { + /* Sending AT+CFUN=6 */ + tcore_prepare_and_send_at_request(co_sat, + "AT+CFUN=6", NULL, + TCORE_AT_NO_RESULT, NULL, + on_response_enable_proactive_command, NULL, + NULL, NULL, 0, NULL, NULL); + } - /* Sending AT+COPS */ - prepare_and_send_pending_request(co_network, "AT+COPS=0", NULL, - TCORE_AT_NO_RESULT, on_response_network_registration); } return TCORE_HOOK_RETURN_CONTINUE; @@ -465,9 +456,10 @@ static enum tcore_hook_return on_hook_sim_status(Server *s, gboolean modem_power_on(TcorePlugin *plugin) { + Server *server; CoreObject *co_modem = NULL; - struct treq_modem_set_flightmode flight_mode_set = {0}; - struct tnoti_modem_power modem_power = {0}; + struct treq_modem_set_flightmode flight_mode_set; + struct tnoti_modem_power modem_power; Storage *strg = NULL; co_modem = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_MODEM); @@ -479,253 +471,320 @@ gboolean modem_power_on(TcorePlugin *plugin) /* Set Modem Power State to 'ON' */ tcore_modem_set_powered(co_modem, TRUE); + server = tcore_plugin_ref_server(plugin); + /* Get Flight mode from VCONFKEY */ - strg = tcore_server_find_storage(tcore_plugin_ref_server(plugin), "vconf"); + strg = tcore_server_find_storage(server, "vconf"); flight_mode_set.enable = tcore_storage_get_bool(strg, STORAGE_KEY_FLIGHT_MODE_BOOL); - /* Set Flight mode as per AP settings */ + /* + * Set Flight mode as per AP settings + */ if (flight_mode_set.enable) { /* Radio OFF */ - prepare_and_send_pending_request(co_modem, "AT+CFUN=4", NULL, - TCORE_AT_NO_RESULT, on_response_set_flight_mode); + dbg("Enabling Flight mode"); + + tcore_prepare_and_send_at_request(co_modem, + "AT+CFUN=4", NULL, + TCORE_AT_NO_RESULT, NULL, + on_response_modem_set_flight_mode, NULL, + NULL, NULL, 0, NULL, NULL); /* Set Flight mode TRUE */ tcore_modem_set_flight_mode_state(co_modem, TRUE); - } else { /* Radio ON */ - prepare_and_send_pending_request(co_modem, "AT+CFUN=1", NULL, - TCORE_AT_NO_RESULT, on_response_set_flight_mode); + } else { /* Radio ON */ + dbg("Disabling Flight mode"); + + tcore_prepare_and_send_at_request(co_modem, + "AT+CFUN=1", NULL, + TCORE_AT_NO_RESULT, NULL, + on_response_modem_set_flight_mode, NULL, + NULL, NULL, 0, NULL, NULL); /* Set Flight mode FALSE */ tcore_modem_set_flight_mode_state(co_modem, FALSE); } /* Get IMEI */ - prepare_and_send_pending_request(co_modem, "AT+CGSN", NULL, - TCORE_AT_NUMERIC, on_response_imei); + tcore_prepare_and_send_at_request(co_modem, + "AT+CGSN", NULL, + TCORE_AT_NUMERIC, NULL, + on_response_modem_get_imei, NULL, + NULL, NULL, 0, NULL, NULL); /* Get Version Number */ - prepare_and_send_pending_request(co_modem, "AT+CGMR", NULL, - TCORE_AT_SINGLELINE, on_response_version); + tcore_prepare_and_send_at_request(co_modem, + "AT+CGMR", NULL, + TCORE_AT_SINGLELINE, NULL, + on_response_modem_get_version, NULL, + NULL, NULL, 0, NULL, NULL); - /* Send Notification to TAPI - MODEM_POWER */ + /* Send Notification - MODEM_POWER */ modem_power.state = MODEM_STATE_ONLINE; dbg("Sending notification - Modem Power state: [ONLINE]"); - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - co_modem, TNOTI_MODEM_POWER, sizeof(modem_power), &modem_power); + tcore_server_send_notification(server, co_modem, + TNOTI_MODEM_POWER, + sizeof(modem_power), &modem_power); return TRUE; } -static TReturn power_off(CoreObject *o, UserRequest *ur) +static TReturn modem_power_off(CoreObject *co_modem, UserRequest *ur) { - TcoreHal *hal = NULL; - TcoreATRequest *req = NULL; - TcorePending *pending = NULL; + TcoreHal *hal; - hal = tcore_object_get_hal(o); - pending = tcore_pending_new(o, 0); + hal = tcore_object_get_hal(co_modem); + if (FALSE == tcore_hal_get_power_state(hal)) { + struct tresp_modem_power_off modem_power_off_resp; - req = tcore_at_request_new("AT+CFUN=0", NULL, TCORE_AT_NO_RESULT); + err("Modem is in Powered OFF state!"); - dbg("Command: [%s], Prefix(if any): [%s], Command Length: [%d]", - req->cmd, req->prefix, strlen(req->cmd)); + modem_power_off_resp.result = TCORE_RETURN_SUCCESS; - tcore_pending_set_request_data(pending, 0, req); - tcore_pending_set_response_callback(pending, on_response_power_off, hal); - tcore_pending_link_user_request(pending, ur); - tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); + tcore_user_request_send_response(ur, + TRESP_MODEM_POWER_OFF, + sizeof(struct tresp_modem_power_off), &modem_power_off_resp); - tcore_hal_send_request(hal, pending); + return TCORE_RETURN_SUCCESS; + } + + dbg("[Request] Modem Power OFF - Command: [%s]", "AT+CFUN=0"); - return TCORE_RETURN_SUCCESS; + return tcore_prepare_and_send_at_request(co_modem, + "AT+CFUN=0", NULL, + TCORE_AT_NO_RESULT, ur, + on_response_modem_power_off, hal, + on_confirmation_modem_message_send, NULL, + 0, NULL, NULL); } -static TReturn get_imei(CoreObject *o, UserRequest *ur) +static TReturn modem_get_imei(CoreObject *co_modem, UserRequest *ur) { + PrivateData *priv_data = NULL; TcoreHal *hal; - TcoreATRequest *req; - TcorePending *pending = NULL; - hal = tcore_object_get_hal(o); + dbg("Exit"); + + hal = tcore_object_get_hal(co_modem); if (FALSE == tcore_hal_get_power_state(hal)) { - dbg("cp not ready/n"); + err("CP not ready!"); return TCORE_RETURN_ENOSYS; } - pending = tcore_pending_new(o, 0); - - req = tcore_at_request_new("AT+CGSN", NULL, TCORE_AT_NUMERIC); - dbg("Command: [%s], Prefix(if any): [%s], Command Length: [%d]", - req->cmd, req->prefix, strlen(req->cmd)); + /* + * Check if valid IMEI is available in Cache - + * if Yes, then provide form Cache; + * else, fetch from CP + */ + priv_data = tcore_object_ref_user_data(co_modem); + if (priv_data && priv_data->imei_valid) { + struct tresp_modem_get_imei modem_get_imei_resp; + TReturn ret; + + memset(&modem_get_imei_resp, 0x0, sizeof(struct tresp_modem_get_imei)); + + modem_get_imei_resp.result = TCORE_RETURN_SUCCESS; + memcpy(modem_get_imei_resp.imei, + priv_data->imei, MODEM_DEVICE_IMEI_LEN_MAX); + + dbg("Valid IMEI information present in cache - IMEI: [%s]", + modem_get_imei_resp.imei); + + /* Send Response */ + ret = tcore_user_request_send_response(ur, + TRESP_MODEM_GET_IMEI, + sizeof(struct tresp_modem_get_imei), &modem_get_imei_resp); + if (ret == TCORE_RETURN_SUCCESS) + tcore_user_request_unref(ur); + + return ret; + } - tcore_pending_set_request_data(pending, 0, req); - tcore_pending_set_response_callback(pending, on_response_imei, hal); - tcore_pending_link_user_request(pending, ur); - tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); + dbg("[Request] Get IMEI - Command: [%s]", "AT+CGSN"); - return tcore_hal_send_request(hal, pending); + return tcore_prepare_and_send_at_request(co_modem, + "AT+CGSN", NULL, + TCORE_AT_NUMERIC, ur, + on_response_modem_get_imei, hal, + on_confirmation_modem_message_send, NULL, + 0, NULL, NULL); } -static TReturn get_version(CoreObject *o, UserRequest *ur) +static TReturn modem_get_version(CoreObject *co_modem, UserRequest *ur) { + PrivateData *priv_data = NULL; TcoreHal *hal; - TcoreATRequest *req; - TcorePending *pending = NULL; - hal = tcore_object_get_hal(o); + hal = tcore_object_get_hal(co_modem); if (FALSE == tcore_hal_get_power_state(hal)) { - dbg("cp not ready/n"); + err("CP not ready!"); return TCORE_RETURN_ENOSYS; } - pending = tcore_pending_new(o, 0); - - req = tcore_at_request_new("AT+CGMR", NULL, TCORE_AT_SINGLELINE); - dbg("Command: [%s], Prefix(if any): [%s], Command Length: [%d]", - req->cmd, req->prefix, strlen(req->cmd)); + /* + * Check if valid Version information is available in Cache - + * if Yes, then provide form Cache; + * else, fetch from CP + */ + priv_data = tcore_object_ref_user_data(co_modem); + if (priv_data && priv_data->version_valid) { + struct tresp_modem_get_version modem_get_version_resp; + TReturn ret; + + memset(&modem_get_version_resp, 0x0, sizeof(struct tresp_modem_get_version)); + + modem_get_version_resp.result = TCORE_RETURN_SUCCESS; + snprintf(modem_get_version_resp.software, + 33, "%s", priv_data->software); + snprintf(modem_get_version_resp.hardware, + 33, "%s", priv_data->hardware); + snprintf(modem_get_version_resp.calibration, + 33, "%s", priv_data->calibration); + snprintf(modem_get_version_resp.product_code, + 33, "%s", priv_data->product_code); + + dbg("Valid Version information present in cache -" \ + "Software: [%s] Hardware: [%s] Calibration: [%s] Product code: [%s]", + modem_get_version_resp.software, modem_get_version_resp.hardware, + modem_get_version_resp.calibration, modem_get_version_resp.product_code); + + /* Send Response */ + ret = tcore_user_request_send_response(ur, + TRESP_MODEM_GET_VERSION, + sizeof(struct tresp_modem_get_version), &modem_get_version_resp); + if (ret == TCORE_RETURN_SUCCESS) + tcore_user_request_unref(ur); + + return ret; + } - tcore_pending_set_request_data(pending, 0, req); - tcore_pending_set_response_callback(pending, on_response_version, hal); - tcore_pending_link_user_request(pending, ur); - tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); + dbg("[Request] Get VERSION - Command: [%s]", "AT+CGMR"); - return tcore_hal_send_request(hal, pending); + return tcore_prepare_and_send_at_request(co_modem, + "AT+CGMR", NULL, + TCORE_AT_SINGLELINE, ur, + on_response_modem_get_version, hal, + on_confirmation_modem_message_send, NULL, + 0, NULL, NULL); } -static TReturn set_flight_mode(CoreObject *o, UserRequest *ur) +static TReturn modem_set_flight_mode(CoreObject *co_modem, UserRequest *ur) { TcoreHal *hal = NULL; - TcoreATRequest *req = NULL; - TcorePending *pending = NULL; const struct treq_modem_set_flightmode *req_data = NULL; char *cmd_str = NULL; - hal = tcore_object_get_hal(o); + hal = tcore_object_get_hal(co_modem); if (FALSE == tcore_hal_get_power_state(hal)) { - dbg("cp not ready/n"); + err("CP not ready!"); return TCORE_RETURN_ENOSYS; } - pending = tcore_pending_new(o, 0); req_data = tcore_user_request_ref_data(ur, NULL); - - if (req_data->enable) { - dbg("Flight mode on/n"); - cmd_str = g_strdup("AT+CFUN=4"); - } else { - dbg("Flight mode off/n"); - cmd_str = g_strdup("AT+CFUN=1"); - } - - req = tcore_at_request_new((const char *)cmd_str, NULL, TCORE_AT_NO_RESULT); - g_free(cmd_str); - - dbg("Command: [%s], Prefix(if any): [%s], Command Length: [%d]", - req->cmd, req->prefix, strlen(req->cmd)); - - tcore_pending_set_request_data(pending, 0, req); - tcore_pending_set_response_callback(pending, on_response_set_flight_mode, hal); - tcore_pending_link_user_request(pending, ur); - tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); - - return tcore_hal_send_request(hal, pending); + if (req_data->enable) + cmd_str = "AT+CFUN=4"; + else + cmd_str = "AT+CFUN=1"; + + dbg("[Request] Set Modem Flight mode [%s] - Command: [%s]", + (req_data->enable ? "ON" : "OFF"), cmd_str); + + return tcore_prepare_and_send_at_request(co_modem, + (const char *)cmd_str, NULL, + TCORE_AT_NO_RESULT, ur, + on_response_modem_set_flight_mode, hal, + on_confirmation_modem_message_send, NULL, + 0, NULL, NULL); } -static TReturn get_flight_mode(CoreObject *co_modem, UserRequest *ur) +static TReturn modem_get_flight_mode(CoreObject *co_modem, UserRequest *ur) { - struct tresp_modem_get_flightmode resp_data; + struct tresp_modem_get_flightmode modem_get_flightmode_resp; TReturn ret; - memset(&resp_data, 0x0, sizeof(struct tresp_modem_get_flightmode)); + dbg("[Request] Get Modem Flight mode"); + + memset(&modem_get_flightmode_resp, 0x0, sizeof(struct tresp_modem_get_flightmode)); - resp_data.enable = tcore_modem_get_flight_mode_state(co_modem); - resp_data.result = TCORE_RETURN_SUCCESS; - dbg("Get Flight mode: Flight mdoe: [%s]", (resp_data.enable ? "ON" : "OFF")); + modem_get_flightmode_resp.result = TCORE_RETURN_SUCCESS; + modem_get_flightmode_resp.enable = tcore_modem_get_flight_mode_state(co_modem); + dbg("Flight mode: [%s]", (modem_get_flightmode_resp.enable ? "ON" : "OFF")); ret = tcore_user_request_send_response(ur, TRESP_MODEM_GET_FLIGHTMODE, - sizeof(struct tresp_modem_get_flightmode), &resp_data); - dbg("ret: [0x%x]", ret); + sizeof(struct tresp_modem_get_flightmode), &modem_get_flightmode_resp); + if (ret == TCORE_RETURN_SUCCESS) + tcore_user_request_unref(ur); return ret; } +/* Modem operations */ static struct tcore_modem_operations modem_ops = { .power_on = NULL, - .power_off = power_off, + .power_off = modem_power_off, .power_reset = NULL, - .set_flight_mode = set_flight_mode, - .get_flight_mode = get_flight_mode, - .get_imei = get_imei, - .get_version = get_version, + .set_flight_mode = modem_set_flight_mode, + .get_flight_mode = modem_get_flight_mode, + .get_imei = modem_get_imei, + .get_version = modem_get_version, .get_sn = NULL, .dun_pin_ctrl = NULL, }; -gboolean imc_modem_init(TcorePlugin *cp, CoreObject *co_modem) +gboolean imc_modem_init(TcorePlugin *plugin, CoreObject *co_modem) { - TelMiscVersionInformation *vi_property; - TelMiscSNInformation *imei_property; - TelMiscSNInformation *sn_property; + PrivateData *priv_data = NULL; dbg("Enter"); /* Set operations */ - tcore_modem_set_ops(co_modem, &modem_ops); - - vi_property = g_try_new0(TelMiscVersionInformation, 1); - tcore_plugin_link_property(cp, "VERSION", vi_property); + tcore_modem_set_ops(co_modem, &modem_ops, TCORE_OPS_TYPE_CP); - imei_property = g_try_new0(TelMiscSNInformation, 1); - tcore_plugin_link_property(cp, "IMEI", imei_property); + /* Private data */ + priv_data = g_malloc0(sizeof(PrivateData)); + priv_data->imei_valid = FALSE; + priv_data->version_valid = FALSE; + tcore_object_link_user_data(co_modem, priv_data); - sn_property = g_try_new0(TelMiscSNInformation, 1); - tcore_plugin_link_property(cp, "SN", sn_property); + /* Notification hooks */ + tcore_server_add_notification_hook(tcore_plugin_ref_server(plugin), + TNOTI_SIM_STATUS, on_hook_modem_sim_init_status, NULL); - tcore_server_add_notification_hook(tcore_plugin_ref_server(cp), - TNOTI_SIM_STATUS, on_hook_sim_status, NULL); dbg("Registering for +XDRVI event"); - tcore_object_add_callback(co_modem, "+XDRVI", on_event_nvm_update, NULL); + tcore_object_add_callback(co_modem, + "+XDRVI", on_event_modem_nvm_update, NULL); dbg("Exit"); return TRUE; } -void imc_modem_exit(TcorePlugin *cp, CoreObject *co_modem) +void imc_modem_exit(TcorePlugin *plugin, CoreObject *co_modem) { - TelMiscVersionInformation *vi_property; - TelMiscSNInformation *imei_property; - TelMiscSNInformation *sn_property; - TcorePlugin *plugin = tcore_object_ref_plugin(co_modem); - - vi_property = tcore_plugin_ref_property(plugin, "VERSION"); - g_free(vi_property); - - imei_property = tcore_plugin_ref_property(plugin, "IMEI"); - g_free(imei_property); - - sn_property = tcore_plugin_ref_property(plugin, "SN"); - g_free(sn_property); + PrivateData *priv_data = NULL; dbg("Exit"); + + priv_data = tcore_object_ref_user_data(co_modem); + g_free(priv_data); } /* * NV Manager - Support for Remote File System */ /* NVM Hook */ -static gboolean modem_rfs_hook(const char *data) +static gboolean __modem_rfs_hook(const char *data) { - if (data != NULL) - if (data[NVM_FUNCTION_ID_OFFSET] == XDRV_INDICATION) - return TRUE; + if (data && data[NVM_FUNCTION_ID_OFFSET] == XDRV_INDICATION) + return TRUE; return FALSE; } /* NVM event Notification */ -static gboolean on_event_nvm_update(CoreObject *o, const void *event_info, void *user_data) +static gboolean on_event_modem_nvm_update(CoreObject *co_modem, + const void *event_info, void *user_data) { GSList *tokens = NULL; GSList *lines; @@ -753,7 +812,7 @@ static gboolean on_event_nvm_update(CoreObject *o, const void *event_info, void dbg("NV data processed successfully"); /* Acknowledge NV Update */ - modem_send_nvm_update_ack(o); + modem_send_nvm_update_ack(co_modem); return ret; } else { @@ -765,28 +824,28 @@ static gboolean on_event_nvm_update(CoreObject *o, const void *event_info, void if (g_slist_length(tokens) < 3) { err("XDRVI event with less number of tokens, Ignore!!!"); ret = FALSE; - } - else if (IUFP_GROUP_ID != atoi(g_slist_nth_data(tokens, 0))) { + } else if (IUFP_GROUP_ID != atoi(g_slist_nth_data(tokens, 0))) { err("Group ID mismatch, Ignore!!!"); ret = FALSE; - } - else { - switch (atoi(g_slist_nth_data(tokens, 1))) { - case IUFP_UPDATE_REQ: - dbg("NV Update Request"); - - /* Acknowledge the Update Request */ - modem_send_nvm_update_request_ack(o); - break; - - case IUFP_NO_PENDING_UPDATE: - dbg("NO pending NV Update(s)!!!"); - /* Can send FLUSH request to get fresh updates */ - break; - - default: - err("Unspported Function ID [%d], Ignore", atoi(g_slist_nth_data(tokens, 1))); - ret = FALSE; + } else { + int command = atoi(g_slist_nth_data(tokens, 1)); + switch (command) { + case IUFP_UPDATE_REQ: + dbg("NV Update Request"); + + /* Acknowledge the Update Request */ + modem_send_nvm_update_request_ack(co_modem); + break; + + case IUFP_NO_PENDING_UPDATE: + dbg("NO pending NV Update(s)!!!"); + /* Can send FLUSH request to get fresh updates */ + break; + + default: + err("Unspported Function ID [%d], Ignore", command); + ret = FALSE; + break; } } @@ -800,7 +859,7 @@ static gboolean on_event_nvm_update(CoreObject *o, const void *event_info, void /* NVM Responses */ static gboolean __modem_check_nvm_response(const void *data, int command) { - const TcoreATResponse *resp = data; + const TcoreATResponse *at_resp = data; const char *line; char *resp_str; GSList *tokens = NULL; @@ -808,65 +867,62 @@ static gboolean __modem_check_nvm_response(const void *data, int command) dbg("Entered"); /* +XDRV: ,,[,] */ - if (NULL == resp) { + if (NULL == at_resp) { err("Input data is NULL"); return FALSE; } - if (resp->success > 0) { - dbg("RESPONSE OK"); - line = (const char *) (((GSList *) resp->lines)->data); - tokens = tcore_at_tok_new(line); - - /* Group ID */ - resp_str = g_slist_nth_data(tokens, 0); - if (NULL == resp_str) { - err("Group ID is missing "); - goto OUT; - } - else if (IUFP_GROUP_ID != atoi(resp_str)) { - err("Group ID mismatch"); - goto OUT; - } + if (at_resp->success <= 0) { + dbg("Response NOK"); + return FALSE; + } - /* Function ID */ - resp_str = g_slist_nth_data(tokens, 1); - if (NULL == resp_str) { - err("Function ID is missing "); - goto OUT; - } - else if (command != atoi(resp_str)) { - err("Function ID mismatch"); - goto OUT; - } + dbg("RESPONSE OK"); + line = (const char *) (((GSList *) at_resp->lines)->data); + tokens = tcore_at_tok_new(line); + + /* Group ID */ + resp_str = g_slist_nth_data(tokens, 0); + if (NULL == resp_str) { + err("Group ID is missing "); + goto OUT; + } else if (IUFP_GROUP_ID != atoi(resp_str)) { + err("Group ID mismatch"); + goto OUT; + } - /* XDRV Result */ - resp_str = g_slist_nth_data(tokens, 2); - if (NULL == resp_str) { - err("XDRV result is missing "); - goto OUT; - } - else if (XDRV_RESULT_OK != atoi(resp_str)) { - err("XDRV result[%d] ", atoi(resp_str)); - goto OUT; - } + /* Function ID */ + resp_str = g_slist_nth_data(tokens, 1); + if (NULL == resp_str) { + err("Function ID is missing "); + goto OUT; + } else if (command != atoi(resp_str)) { + err("Function ID mismatch"); + goto OUT; + } - /* Result code */ - resp_str = g_slist_nth_data(tokens, 3); - if (NULL == resp_str) { - err("UTA result is missing "); - goto OUT; - } - else if (UTA_SUCCESS != atoi(resp_str)) { - err("uta result[%d] ", atoi(resp_str)); - goto OUT; - } + /* XDRV Result */ + resp_str = g_slist_nth_data(tokens, 2); + if (NULL == resp_str) { + err("XDRV result is missing "); + goto OUT; + } else if (XDRV_RESULT_OK != atoi(resp_str)) { + err("XDRV result[%d] ", atoi(resp_str)); + goto OUT; + } - ret = TRUE; - } else { - dbg("Response NOK"); + /* Result code */ + resp_str = g_slist_nth_data(tokens, 3); + if (NULL == resp_str) { + err("UTA result is missing "); + goto OUT; + } else if (UTA_SUCCESS != atoi(resp_str)) { + err("uta result[%d] ", atoi(resp_str)); + goto OUT; } + ret = TRUE; + OUT: tcore_at_tok_free(tokens); @@ -874,17 +930,16 @@ OUT: return ret; } -static void _on_response_modem_unsuspend_nvm_updates(TcorePending *p, - int data_len, const void *data, void *user_data) +static void on_response_modem_unsuspend_nvm_updates(TcorePending *pending, + int data_len, const void *data, void *user_data) { /* Check NVM response */ if (TRUE == __modem_check_nvm_response(data, IUFP_SUSPEND)) { dbg("Priority level is set to get all updates since Boot-up"); /* Create NV data file */ - if (nvm_create_nvm_data() == FALSE) { + if (nvm_create_nvm_data() == FALSE) err("Failed to Create NV data file"); - } return; } @@ -892,8 +947,8 @@ static void _on_response_modem_unsuspend_nvm_updates(TcorePending *p, err("Response NOT OK"); } -static void _on_response_modem_send_nvm_update_ack(TcorePending *p, - int data_len, const void *data, void *user_data) +static void on_response_modem_send_nvm_update_ack(TcorePending *pending, + int data_len, const void *data, void *user_data) { /* Check NVM response */ if (TRUE == __modem_check_nvm_response(data, IUFP_UPDATE_ACK)) { @@ -904,8 +959,8 @@ static void _on_response_modem_send_nvm_update_ack(TcorePending *p, err("[UPDATE ACK] NOT OK"); } -static void _on_response_modem_send_nvm_update_request_ack(TcorePending *p, - int data_len, const void *data, void *user_data) +static void on_response_modem_send_nvm_update_request_ack(TcorePending *pending, + int data_len, const void *data, void *user_data) { /* Check NVM response */ if (TRUE == __modem_check_nvm_response(data, IUFP_UPDATE_REQ_ACK)) { @@ -916,15 +971,15 @@ static void _on_response_modem_send_nvm_update_request_ack(TcorePending *p, err("[REQUEST ACK] NOT OK"); } -static void _on_response_modem_register_nvm(TcorePending *p, - int data_len, const void *data, void *user_data) +static void on_response_modem_register_nvm(TcorePending *pending, + int data_len, const void *data, void *user_data) { /* Check NVM response */ if (TRUE == __modem_check_nvm_response(data, IUFP_REGISTER)) { - dbg("Registering successful"); + dbg("Registering successful!"); /* Send SUSPEND_UPDATE for all UPDATES */ - modem_unsuspend_nvm_updates(tcore_pending_ref_core_object(p)); + modem_unsuspend_nvm_updates(tcore_pending_ref_core_object(pending)); dbg("Exit"); return; @@ -934,130 +989,106 @@ static void _on_response_modem_register_nvm(TcorePending *p, } /* NVM Requests */ -static void modem_unsuspend_nvm_updates(CoreObject *o) +static void modem_unsuspend_nvm_updates(CoreObject *co_modem) { - TcorePending *pending = NULL; char *cmd_str; + TReturn ret; + dbg("Entered"); /* Prepare AT-Command */ cmd_str = g_strdup_printf("AT+XDRV=%d, %d, %d, %d", - IUFP_GROUP_ID, IUFP_SUSPEND, - 0, UTA_FLASH_PLUGIN_PRIO_UNSUSPEND_ALL); + IUFP_GROUP_ID, IUFP_SUSPEND, + 0, UTA_FLASH_PLUGIN_PRIO_UNSUSPEND_ALL); /* Prepare pending request */ - pending = tcore_at_pending_new(o, - cmd_str, - "+XDRV:", - TCORE_AT_SINGLELINE, - _on_response_modem_unsuspend_nvm_updates, - NULL); - if (pending == NULL) { - err("Failed to form pending request"); - } - else if (tcore_hal_send_request(tcore_object_get_hal(o), pending) - != TCORE_RETURN_SUCCESS) { + ret = tcore_prepare_and_send_at_request(co_modem, + cmd_str, "+XDRV:", + TCORE_AT_SINGLELINE, NULL, + on_response_modem_unsuspend_nvm_updates, NULL, + NULL, NULL, 0, NULL, NULL); + if (ret != TCORE_RETURN_SUCCESS) err("IUFP_SUSPEND - Unable to send AT-Command"); - } - else { + else dbg("IUFP_SUSPEND - Successfully sent AT-Command"); - } g_free(cmd_str); } -static void modem_send_nvm_update_ack(CoreObject *o) +static void modem_send_nvm_update_ack(CoreObject *co_modem) { - TcorePending *pending = NULL; char *cmd_str; + TReturn ret; + dbg("Entered"); /* Prepare AT-Command */ cmd_str = g_strdup_printf("AT+XDRV=%s, %s", IUFP_GROUP, IUFP_UPDATE_ACK_STR); /* Prepare pending request */ - pending = tcore_at_pending_new(o, - cmd_str, - "+XDRV:", - TCORE_AT_SINGLELINE, - _on_response_modem_send_nvm_update_ack, - NULL); - if (pending == NULL) { - err("Failed to form pending request"); - } - else if (tcore_hal_send_request(tcore_object_get_hal(o), pending) - != TCORE_RETURN_SUCCESS) { + ret = tcore_prepare_and_send_at_request(co_modem, + cmd_str, "+XDRV:", + TCORE_AT_SINGLELINE, NULL, + on_response_modem_send_nvm_update_ack, NULL, + NULL, NULL, 0, NULL, NULL); + if (ret != TCORE_RETURN_SUCCESS) err("IUFP_UPDATE_ACK - Unable to send AT-Command"); - } - else { + else dbg("IUFP_UPDATE_ACK - Successfully sent AT-Command"); - } g_free(cmd_str); } -static void modem_send_nvm_update_request_ack(CoreObject *o) +static void modem_send_nvm_update_request_ack(CoreObject *co_modem) { - TcorePending *pending = NULL; char *cmd_str; + TReturn ret; + dbg("Entered"); /* Prepare AT-Command */ cmd_str = g_strdup_printf("AT+XDRV=%s, %s", IUFP_GROUP, IUFP_UPDATE_REQ_ACK_STR); /* Prepare pending request */ - pending = tcore_at_pending_new(o, - cmd_str, - "+XDRV:", - TCORE_AT_SINGLELINE, - _on_response_modem_send_nvm_update_request_ack, - NULL); - - - if (pending == NULL) { - err("Failed to form pending request"); - } - else if (tcore_hal_send_request(tcore_object_get_hal(o), pending) - != TCORE_RETURN_SUCCESS) { + ret = tcore_prepare_and_send_at_request(co_modem, + cmd_str, "+XDRV:", + TCORE_AT_SINGLELINE, NULL, + on_response_modem_send_nvm_update_request_ack, NULL, + NULL, NULL, 0, NULL, NULL); + if (ret != TCORE_RETURN_SUCCESS) err("IUFP_UPDATE_REQ_ACK - Unable to send AT-Ccommand"); - } - else { + else dbg("IUFP_UPDATE_REQ_ACK - Successfully sent AT-Command"); - } g_free(cmd_str); } void modem_register_nvm(CoreObject *co_modem) { - TcorePending *pending = NULL; char *cmd_str; + TReturn ret; + dbg("Entered"); /* Prepare AT-Command */ cmd_str = g_strdup_printf("AT+XDRV=%s, %s, %s", - IUFP_GROUP, IUFP_REGISTER_STR, XDRV_ENABLE); + IUFP_GROUP, IUFP_REGISTER_STR, XDRV_ENABLE); /* Prepare pending request */ - pending = tcore_at_pending_new(co_modem, - cmd_str, - "+XDRV:", - TCORE_AT_SINGLELINE, - _on_response_modem_register_nvm, - NULL); - if (pending == NULL) { - err("Failed to form pending request"); - } - else if (tcore_hal_send_request(tcore_object_get_hal(co_modem), pending) - != TCORE_RETURN_SUCCESS) { + ret = tcore_prepare_and_send_at_request(co_modem, + cmd_str, "+XDRV:", + TCORE_AT_SINGLELINE, NULL, + on_response_modem_register_nvm, NULL, + NULL, NULL, 0, NULL, NULL); + if (ret != TCORE_RETURN_SUCCESS) { err("IUFP_REGISTER (Enable) -Unable to send AT-Command"); - } - else { + } else { dbg("IUFP_REGISTER (Enable) -Successfully sent AT-Command"); /* Add RFS hook */ /* Todo unblock this api */ - tcore_at_add_hook(tcore_object_get_hal(co_modem), modem_rfs_hook); + tcore_at_add_hook(tcore_object_get_hal(co_modem), + __modem_rfs_hook); } g_free(cmd_str); diff --git a/src/imc_network.c b/src/imc_network.c index 0e85fdb..3b5a7b4 100644 --- a/src/imc_network.c +++ b/src/imc_network.c @@ -143,7 +143,10 @@ static void nwk_prepare_and_send_pending_request(CoreObject *co, const char *at_ pending = tcore_pending_new(co, 0); req = tcore_at_request_new(at_cmd, prefix, at_cmd_type); - + if (req == NULL) { + tcore_pending_free(pending); + return; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); @@ -153,68 +156,15 @@ static void nwk_prepare_and_send_pending_request(CoreObject *co, const char *at_ ret = tcore_hal_send_request(hal, pending); - if (ret != TCORE_RETURN_SUCCESS) + if (ret != TCORE_RETURN_SUCCESS) { err("Failed to send AT request - ret: [0x%x]", ret); - - return; -} - - -static void _insert_mcc_mnc_oper_list(TcorePlugin *p, CoreObject *o) -{ - Server *s; - Storage *strg; - void *handle; - char query[255] = { 0, }; - GHashTableIter iter; - gpointer key, value; - GHashTable *result = NULL, *row = NULL; - struct tcore_network_operator_info *noi = NULL; - int count = 0; - - s = tcore_plugin_ref_server(p); - strg = tcore_server_find_storage(s, "database"); - - handle = tcore_storage_create_handle(strg, "/opt/dbspace/.mcc_mnc_oper_list.db"); - if (!handle) { - dbg("fail to create database handle"); - return; - } - - snprintf(query, 255, "select country, mcc, mnc, oper from mcc_mnc_oper_list"); - - result = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - (GDestroyNotify) g_hash_table_destroy); - - tcore_storage_read_query_database(strg, handle, query, NULL, result, 4); - - g_hash_table_iter_init(&iter, result); - while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) { - row = value; - - noi = calloc(sizeof(struct tcore_network_operator_info), 1); - - snprintf(noi->mcc, 4, "%s", (char *) g_hash_table_lookup(row, "1")); - snprintf(noi->mnc, 4, "%s", (char *) g_hash_table_lookup(row, "2")); - snprintf(noi->name, 41, "%s", (char *) g_hash_table_lookup(row, "3")); - snprintf(noi->country, 4, "%s", (char *) g_hash_table_lookup(row, "0")); - - tcore_network_operator_info_add(o, noi); - g_free(noi); - noi = NULL; - - count++; + tcore_pending_free(pending); + tcore_at_request_free(req); } - - dbg("count = %d", count); - - g_hash_table_destroy(result); - - tcore_storage_remove_handle(strg, handle); } static enum telephony_network_service_type _get_service_type(enum telephony_network_service_type prev_type, - int domain, int act, int cs_status, int ps_status) + int domain, int act, int cs_status, int ps_status) { enum telephony_network_service_type ret; @@ -223,39 +173,31 @@ static enum telephony_network_service_type _get_service_type(enum telephony_netw switch (act) { case NETWORK_ACT_UNKNOWN: ret = NETWORK_SERVICE_TYPE_UNKNOWN; - break; + break; case NETWORK_ACT_GSM: if (prev_type == NETWORK_SERVICE_TYPE_2_5G_EDGE && domain == NETWORK_SERVICE_DOMAIN_CS) ret = NETWORK_SERVICE_TYPE_2_5G_EDGE; else ret = NETWORK_SERVICE_TYPE_2G; - break; + break; case NETWORK_ACT_EGPRS: return NETWORK_SERVICE_TYPE_2_5G_EDGE; - break; case NETWORK_ACT_UMTS: ret = NETWORK_SERVICE_TYPE_3G; - break; + break; } - if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_NO && ps_status == NETWORK_SERVICE_DOMAIN_STATUS_NO) { + if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_NO && ps_status == NETWORK_SERVICE_DOMAIN_STATUS_NO) ret = NETWORK_SERVICE_TYPE_NO_SERVICE; - } else if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_SEARCH || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_SEARCH) { - if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) { - /* no change */ - } else { - ret = NETWORK_SERVICE_TYPE_SEARCH; - } - } else if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY) { - if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) { - /* no change */ - } else { - ret = NETWORK_SERVICE_TYPE_EMERGENCY; - } - } + else if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) + dbg("service type [%d]", ret); + else if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_SEARCH || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_SEARCH) + ret = NETWORK_SERVICE_TYPE_SEARCH; + else if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY) + ret = NETWORK_SERVICE_TYPE_EMERGENCY; return ret; } @@ -293,17 +235,14 @@ static void on_timeout_search_network(TcorePending *p, void *user_data) custom_data->search_state = IMC_NETWORK_SEARCH_STATE_NO_SEARCH; ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_SEARCH, sizeof(struct tresp_network_search), &resp); - } } static void on_response_set_plmn_selection_mode(TcorePending *p, int data_len, const void *data, void *user_data) { UserRequest *ur; const TcoreATResponse *atResp = data; - // GSList *tokens = NULL; - // char * line = NULL; struct tresp_network_set_plmn_selection_mode resp = {0}; if (atResp->success > 0) { @@ -315,9 +254,8 @@ static void on_response_set_plmn_selection_mode(TcorePending *p, int data_len, c } ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_SET_PLMN_SELECTION_MODE, sizeof(struct tresp_network_set_plmn_selection_mode), &resp); - } } static void on_response_get_plmn_selection_mode(TcorePending *p, int data_len, const void *data, void *user_data) @@ -371,9 +309,8 @@ static void on_response_get_plmn_selection_mode(TcorePending *p, int data_len, c OUT: ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_GET_PLMN_SELECTION_MODE, sizeof(struct tresp_network_get_plmn_selection_mode), &resp); - } if (tokens != NULL) tcore_at_tok_free(tokens); @@ -447,17 +384,16 @@ static void on_response_search_network(TcorePending *p, int data_len, const void if ((pResp = tcore_at_tok_nth(network_token, 1))) { /* Long Alpha name */ dbg("Long Alpha name : %s", pResp); - if (strlen(pResp) > 0) + if (strlen(pResp) > 0) { /* Strip off starting quote & ending quote */ strncpy(resp.list[i].name, pResp + 1, strlen(pResp) - 2); - } - - if ((pResp = tcore_at_tok_nth(network_token, 2))) { - dbg("Short Aplha name : %s", pResp); - /* Short Aplha name */ - /* Strip off starting quote & ending quote */ - if (strlen(pResp) > 0) - strncpy(resp.list[i].name, pResp + 1, strlen(pResp) - 2); + } else if ((pResp = tcore_at_tok_nth(network_token, 2))) { + dbg("Short Aplha name : %s", pResp); + /* Short Aplha name */ + /* Strip off starting quote & ending quote */ + if (strlen(pResp) > 0) + strncpy(resp.list[i].name, pResp + 1, strlen(pResp) - 2); + } } /* PLMN ID */ @@ -497,11 +433,10 @@ OUT: custom_data->search_state = IMC_NETWORK_SEARCH_STATE_NO_SEARCH; ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_SEARCH, sizeof(struct tresp_network_search), &resp); - } /* Free tokens */ tcore_at_tok_free(tokens); @@ -513,14 +448,12 @@ static void on_response_set_umts_band(TcorePending *p, int data_len, const void dbg("On Response Set UMTS Band"); - if (atResp->success > 0) { + if (atResp->success > 0) dbg("Response OK"); - } else { + else dbg("Response NOK"); - } dbg("Wait for response of XRAT before sending final band setting response to AP"); - return; } @@ -529,14 +462,12 @@ static void on_response_set_gsm_band(TcorePending *p, int data_len, const void * const TcoreATResponse *atResp = data; dbg("On Response Set GSM Band"); - if (atResp->success > 0) { + if (atResp->success > 0) dbg("Response OK"); - } else { + else dbg("Response NOK"); - } dbg("Wait for response of XRAT before sending final band setting response to AP"); - return; } static void on_response_get_umts_band(TcorePending *p, int data_len, const void *data, void *user_data) @@ -566,9 +497,8 @@ static void on_response_get_umts_band(TcorePending *p, int data_len, const void tokens = tcore_at_tok_new(line); total_umts_bands = g_slist_length(tokens); dbg("Total UMTS bands enabled are : %d\n", total_umts_bands); - if (total_umts_bands < 1) { + if (total_umts_bands < 1) goto OUT; - } } } else { dbg("RESPONSE NOK"); @@ -591,37 +521,33 @@ static void on_response_get_umts_band(TcorePending *p, int data_len, const void /* Strip off starting quotes & ending quotes */ strncpy(umts_band, band_token + 1, strlen(band_token) - 2); - if (!strcmp(umts_band, "UMTS_BAND_I")) { + if (!strcmp(umts_band, "UMTS_BAND_I")) umts_band_1 = TRUE; - } else if (!strcmp(umts_band, "UMTS_BAND_II")) { + else if (!strcmp(umts_band, "UMTS_BAND_II")) umts_band_2 = TRUE; - } else if (!strcmp(umts_band, "UMTS_BAND_II")) { + else if (!strcmp(umts_band, "UMTS_BAND_II")) umts_band_5 = TRUE; - } else { - /* Telephony is not interest */ + else /* Telephony is not interest */ dbg("Telephony is not interested in %s band", umts_band); - } } OUT: - if ((umts_band_1) && (umts_band_2) && (umts_band_5)) { + if ((umts_band_1) && (umts_band_2) && (umts_band_5)) resp.band = NETWORK_BAND_TYPE_WCDMA; - } else if (umts_band_1) { + else if (umts_band_1) resp.band = NETWORK_BAND_TYPE_WCDMA2100; - } else if (umts_band_2) { + else if (umts_band_2) resp.band = NETWORK_BAND_TYPE_WCDMA1900; - } else if (umts_band_5) { + else if (umts_band_5) resp.band = NETWORK_BAND_TYPE_WCDMA850; - } else { + else resp.result = TCORE_RETURN_FAILURE; - } dbg("Final resp.band sent to TS = %d", resp.band); ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_GET_BAND, sizeof(struct tresp_network_get_band), &resp); - } if (tokens != NULL) tcore_at_tok_free(tokens); @@ -676,57 +602,54 @@ static void on_response_get_gsm_band(TcorePending *p, int data_len, const void * switch (atoi(band_token)) { case AT_GSM_XBANDSEL_850: gsm_850 = TRUE; - break; + break; case AT_GSM_XBANDSEL_900: gsm_900 = TRUE; - break; + break; case AT_GSM_XBANDSEL_1800: gsm_1800 = TRUE; - break; + break; case AT_GSM_XBANDSEL_1900: gsm_1900 = TRUE; - break; + break; default: - break; + break; } } OUT: - if (gsm_850 && gsm_900 && gsm_1800 && gsm_1900) { + if (gsm_850 && gsm_900 && gsm_1800 && gsm_1900) resp.band = NETWORK_BAND_TYPE_GSM; - } else if (gsm_850 && gsm_1900) { + else if (gsm_850 && gsm_1900) resp.band = NETWORK_BAND_TYPE_GSM_850_1900; - } else if (gsm_900 && gsm_1800) { + else if (gsm_900 && gsm_1800) resp.band = NETWORK_BAND_TYPE_GSM_900_1800; - } else if (gsm_1900) { + else if (gsm_1900) resp.band = NETWORK_BAND_TYPE_GSM1900; - } else if (gsm_850) { + else if (gsm_850) resp.band = NETWORK_BAND_TYPE_GSM850; - } else if (gsm_1800) { + else if (gsm_1800) resp.band = NETWORK_BAND_TYPE_GSM1800; - } else if (gsm_900) { + else if (gsm_900) resp.band = NETWORK_BAND_TYPE_GSM900; - } else { + else resp.result = TCORE_RETURN_FAILURE; - } dbg("Final resp.band sent to TS = %d", resp.band); ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_GET_BAND, sizeof(struct tresp_network_get_band), &resp); - } if (tokens != NULL) tcore_at_tok_free(tokens); dbg("Exit on_response_get_gsm_band"); - return; } @@ -774,15 +697,19 @@ static void on_response_get_xrat(TcorePending *p, int data_len, const void *data resp.band = NETWORK_BAND_TYPE_ANY; ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_GET_BAND, sizeof(struct tresp_network_get_band), &resp); - } + goto OUT; } else if ((cp_xrat == AT_XRAT_UMTS)) { /* Get UMTS Band Information */ dup_ur = tcore_user_request_ref(ur); /* duplicate user request for AT+XUBANDSEL */ cmd_str = g_strdup_printf("AT+XUBANDSEL?"); atreq = tcore_at_request_new(cmd_str, "+XUBANDSEL", TCORE_AT_SINGLELINE); + if (atreq == NULL) { + g_free(cmd_str); + goto OUT; + } pending = tcore_pending_new(o, 0); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_get_umts_band, NULL); @@ -790,7 +717,7 @@ static void on_response_get_xrat(TcorePending *p, int data_len, const void *data tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL); tcore_hal_send_request(h, pending); g_free(cmd_str); - } else if ((cp_xrat == AT_XRAT_UMTS)) { + } else if ((cp_xrat == AT_XRAT_GSM)) { /* Get GSM Band Information */ dup_ur = tcore_user_request_ref(ur); /* duplicate user request for AT+XBANDSEL */ cmd_str = g_strdup_printf("AT+XBANDSEL?"); @@ -811,18 +738,16 @@ static void on_response_get_xrat(TcorePending *p, int data_len, const void *data resp.band = NETWORK_BAND_TYPE_ANY; ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_GET_BAND, sizeof(struct tresp_network_get_band), &resp); - } } + OUT: if (tokens != NULL) tcore_at_tok_free(tokens); dbg("Exit on_response_get_xrat !!"); - - return; } @@ -843,11 +768,8 @@ static void on_response_set_xrat(TcorePending *p, int data_len, const void *data } ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_SET_BAND, sizeof(struct tresp_network_set_band), &resp); - } - - return; } static void on_response_set_preferred_plmn(TcorePending *p, int data_len, const void *data, void *user_data) @@ -867,12 +789,10 @@ static void on_response_set_preferred_plmn(TcorePending *p, int data_len, const } ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_SET_PREFERRED_PLMN, sizeof(struct tresp_network_set_preferred_plmn), &resp); - } dbg("Exit on_response_set_preferred_plmn"); - return; } static void on_response_get_nitz_name(TcorePending *p, int data_len, const void *data, void *user_data) @@ -903,7 +823,7 @@ static void on_response_get_nitz_name(TcorePending *p, int data_len, const void memset(¬i, 0, sizeof(struct tnoti_network_identity)); for (count = 0; count < nol; count++) { - // parse each line + /* parse each line */ line = g_slist_nth_data(atResp->lines, count); tokens = tcore_at_tok_new(line); dbg("line %d start---------------", count); @@ -921,7 +841,7 @@ static void on_response_get_nitz_name(TcorePending *p, int data_len, const void noti.plmn[6] = '\0'; } } - break; + break; case 5: /* Short NITZ name*/ case 3: /* Short Network Name (CPHS) */ @@ -932,7 +852,7 @@ static void on_response_get_nitz_name(TcorePending *p, int data_len, const void noti.short_name[16] = '\0'; } } - break; + break; case 6: /* Full NITZ name */ case 4: /* Long Network Name (CPHS) */ @@ -943,10 +863,10 @@ static void on_response_get_nitz_name(TcorePending *p, int data_len, const void noti.full_name[32] = '\0'; } } - break; + break; default: - break; + break; } g_free(net_name); @@ -1000,9 +920,9 @@ static void on_response_get_preferred_plmn(TcorePending *p, int data_len, const total_lines = MAX_NETWORKS_PREF_PLMN_SUPPORT; /* -+CPOL: ,,[,,,,] [ -+CPOL: ,,[,,,,] -*/ + * +CPOL: ,,[,,,,] [ + * +CPOL: ,,[,,,,] + */ resp.result = TCORE_RETURN_SUCCESS; for (i = 0; i < total_lines; i++) { @@ -1017,6 +937,7 @@ static void on_response_get_preferred_plmn(TcorePending *p, int data_len, const dbg("Index : %s", pResp); resp.list[i].ef_index = atoi(pResp); } + /* Format */ if ((pResp = tcore_at_tok_nth(tokens, 1))) { dbg("format : %s", pResp); @@ -1033,13 +954,13 @@ static void on_response_get_preferred_plmn(TcorePending *p, int data_len, const oper = tcore_at_tok_extract((const char *)pResp); dbg("operator <%s>", oper); - // Get only PLMN ID + /* Get only PLMN ID */ if (plmn_format == 2) { strncpy(resp.list[i].plmn, oper, 6); resp.list[i].plmn[6] = '\0'; } - g_free (oper); + g_free(oper); } } @@ -1072,17 +993,16 @@ static void on_response_get_preferred_plmn(TcorePending *p, int data_len, const } } else { dbg("RESPONSE NOT OK"); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.result = TCORE_RETURN_FAILURE; } OUT: ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_GET_PREFERRED_PLMN, sizeof(struct tresp_network_get_preferred_plmn), &resp); - } + dbg("Exit"); - return; } static void on_response_get_serving_network(TcorePending *p, int data_len, const void *data, void *user_data) @@ -1121,24 +1041,24 @@ static void on_response_get_serving_network(TcorePending *p, int data_len, const dbg("nol : %d", nol); for (count = 0; count < nol; count++) { - // parse each line + /* parse each line */ line = g_slist_nth_data(resp->lines, count); tokens = tcore_at_tok_new(line); dbg("line %d start---------------", count); - // mode + /* mode */ if ((pResp = tcore_at_tok_nth(tokens, 0))) { dbg("mode : %s", pResp); network_mode = atoi(pResp); } - // format (optional) + /* format (optional) */ if ((pResp = tcore_at_tok_nth(tokens, 1))) { dbg("format : %s", pResp); if (strlen(pResp) > 0) plmn_format = atoi(pResp); } - // plmn + /* plmn */ switch (plmn_format) { case AT_COPS_FORMAT_LONG_ALPHANUMERIC: if ((pResp = tcore_at_tok_nth(tokens, 2))) { @@ -1146,11 +1066,11 @@ static void on_response_get_serving_network(TcorePending *p, int data_len, const if (strlen(pResp) > 0) { long_plmn_name = tcore_at_tok_extract((const char *)pResp); - // set network name into po + /* set network name into po */ tcore_network_set_network_name(o, TCORE_NETWORK_NAME_TYPE_FULL, long_plmn_name); } } - break; + break; case AT_COPS_FORMAT_SHORT_ALPHANUMERIC: if ((pResp = tcore_at_tok_nth(tokens, 2))) { @@ -1158,11 +1078,11 @@ static void on_response_get_serving_network(TcorePending *p, int data_len, const if (strlen(pResp) > 0) { short_plmn_name = tcore_at_tok_extract((const char *)pResp); - // set network name into po + /* set network name into po */ tcore_network_set_network_name(o, TCORE_NETWORK_NAME_TYPE_SHORT, short_plmn_name); } } - break; + break; case AT_COPS_FORMAT_NUMERIC: if ((pResp = tcore_at_tok_nth(tokens, 2))) { @@ -1170,17 +1090,17 @@ static void on_response_get_serving_network(TcorePending *p, int data_len, const if (strlen(pResp) > 0) { plmn_id = tcore_at_tok_extract((const char *)pResp); - // set plmn id into po + /* set plmn id into po */ tcore_network_set_plmn(o, plmn_id); } } - break; + break; default: - break; + break; } - // act + /* act */ if ((pResp = tcore_at_tok_nth(tokens, 3))) { dbg("AcT : %s", pResp); if (strlen(pResp) > 0) { @@ -1192,7 +1112,7 @@ static void on_response_get_serving_network(TcorePending *p, int data_len, const tcore_at_tok_free(tokens); } - if(plmn_id) + if (plmn_id) memcpy(Tresp.plmn, plmn_id, strlen(plmn_id)); tcore_network_get_access_technology(o, &(Tresp.act)); tcore_network_get_lac(o, &(Tresp.gsm.lac)); @@ -1206,7 +1126,7 @@ static void on_response_get_serving_network(TcorePending *p, int data_len, const struct tnoti_network_change network_change; memset(&network_change, 0, sizeof(struct tnoti_network_change)); - if(plmn_id) + if (plmn_id) memcpy(network_change.plmn, plmn_id, strlen(plmn_id)); tcore_network_get_access_technology(o, &(network_change.act)); tcore_network_get_lac(o, &(network_change.gsm.lac)); @@ -1223,10 +1143,12 @@ static void on_response_get_serving_network(TcorePending *p, int data_len, const memset(¬i, 0x0, sizeof(struct tnoti_network_identity)); if (long_plmn_name) memcpy(noti.full_name, long_plmn_name, MIN(32, strlen(long_plmn_name))); + if (short_plmn_name) memcpy(noti.short_name, short_plmn_name, MIN(16, strlen(short_plmn_name))); + if (plmn_id) - memcpy(noti.plmn, plmn_id, strlen(plmn_id)); // plmn_id length is necessarily <= 6 + memcpy(noti.plmn, plmn_id, strlen(plmn_id)); /* plmn_id length is necessarily <= 6 */ tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_NETWORK_IDENTITY, sizeof(struct tnoti_network_identity), ¬i); @@ -1240,7 +1162,6 @@ static void on_response_get_serving_network(TcorePending *p, int data_len, const g_free(short_plmn_name); g_free(plmn_id); } - return; } static void on_response_network_set_mode(TcorePending *p, int data_len, const void *data, void *user_data) @@ -1260,11 +1181,10 @@ static void on_response_network_set_mode(TcorePending *p, int data_len, const vo } ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_SET_MODE, sizeof(struct tresp_network_set_mode), &resp); - } } static void on_response_network_get_mode(TcorePending *p, int data_len, const void *data, void *user_data) @@ -1321,11 +1241,10 @@ static void on_response_network_get_mode(TcorePending *p, int data_len, const vo END: ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_GET_MODE, sizeof(struct tresp_network_get_mode), &resp); - } /* Free resource*/ tcore_at_tok_free(tokens); @@ -1352,11 +1271,10 @@ static void on_response_cancel_manual_search(TcorePending *p, int data_len, cons custom_data->search_state = IMC_NETWORK_SEARCH_STATE_NO_SEARCH; ur = tcore_pending_ref_user_request(p); - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_NETWORK_SET_CANCEL_MANUAL_SEARCH, sizeof(struct tresp_network_set_cancel_manual_search), &resp); - } dbg("Exit on_response_cancel_manual_search"); } @@ -1428,15 +1346,19 @@ Note: is supporting from R7 and above Protocol Stack. } else { stat = atoi(pResp); if ((pResp = g_slist_nth_data(tokens, 1))) { - pResp = util_removeQuotes(pResp); + pResp = tcore_at_tok_extract(pResp); + if (pResp) { lac = strtol(pResp, NULL, 16); g_free(pResp); + } } if ((pResp = g_slist_nth_data(tokens, 2))) { - pResp = util_removeQuotes(pResp); + pResp = tcore_at_tok_extract(pResp); + if (pResp) { ci = strtol(pResp, NULL, 16); g_free(pResp); + } } else { dbg("No ci in +CGREG"); } @@ -1447,9 +1369,11 @@ Note: is supporting from R7 and above Protocol Stack. dbg("No AcT in +CGREG"); if ((pResp = g_slist_nth_data(tokens, 4))) { - pResp = util_removeQuotes(pResp); + pResp = tcore_at_tok_extract(pResp); + if (pResp) { rac = strtol(pResp, NULL, 16); g_free(pResp); + } } else { dbg("No rac in +CGREG"); } @@ -1497,46 +1421,43 @@ Note: is supporting from R7 and above Protocol Stack. else noti.status = TELEPHONY_HSDPA_OFF; #else - switch(AcT){ - case AT_COPS_ACT_GSM:/*Fall Through*/ - case AT_COPS_ACT_GSM_COMPACT:/*Fall Through*/ - case AT_COPS_ACT_UTRAN:/*Fall Through*/ - case AT_COPS_ACT_GSM_EGPRS:/*Fall Through*/ - case AT_COPS_ACT_E_UTRAN: - { - dbg("Not required for Protocol Status Notification"); - goto OUT; - } - case AT_COPS_ACT_UTRAN_HSDPA: - { - dbg("HSDPA"); - noti.status = TELEPHONY_HSDPA_ON; - break; - } - case AT_COPS_ACT_UTRAN_HSUPA: - { - dbg("HSUPA"); - noti.status = TELEPHONY_HSUPA_ON; - break; - } - case AT_COPS_ACT_UTRAN_HSDPA_HSUPA: - { - dbg("HSPA"); - noti.status = TELEPHONY_HSPA_ON; - break; - } - default: - { - dbg("Ignore"); - goto OUT; - } + switch (AcT) { + case AT_COPS_ACT_GSM:/*Fall Through*/ + case AT_COPS_ACT_GSM_COMPACT:/*Fall Through*/ + case AT_COPS_ACT_UTRAN:/*Fall Through*/ + case AT_COPS_ACT_GSM_EGPRS:/*Fall Through*/ + case AT_COPS_ACT_E_UTRAN: + { + dbg("Not required for Protocol Status Notification"); + goto OUT; + } + case AT_COPS_ACT_UTRAN_HSDPA: + { + dbg("HSDPA"); + noti.status = TELEPHONY_HSDPA_ON; + break; + } + case AT_COPS_ACT_UTRAN_HSUPA: + { + dbg("HSUPA"); + noti.status = TELEPHONY_HSUPA_ON; + break; + } + case AT_COPS_ACT_UTRAN_HSDPA_HSUPA: + { + dbg("HSPA"); + noti.status = TELEPHONY_HSPA_ON; + break; + } + default: + { + dbg("Ignore"); + goto OUT; + } } #endif tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_PS_PROTOCOL_STATUS, sizeof(struct tnoti_ps_protocol_status), ¬i); - - /* Get PLMN ID needed to application */ - // get_serving_network(o, NULL); } else { dbg("Response NOK"); } @@ -1613,15 +1534,19 @@ Note: is supporting from R7 and above Protocol Stack. } else { stat = atoi(pResp); if ((pResp = g_slist_nth_data(tokens, 1))) { - pResp = util_removeQuotes(pResp); + pResp = tcore_at_tok_extract(pResp); + if (pResp) { lac = strtol(pResp, NULL, 16); g_free(pResp); + } } if ((pResp = g_slist_nth_data(tokens, 2))) { - pResp = util_removeQuotes(pResp); - ci = strtol(pResp, NULL, 16); - g_free(pResp); + pResp = tcore_at_tok_extract(pResp); + if (pResp) { + ci = strtol(pResp, NULL, 16); + g_free(pResp); + } } else { dbg("No ci in +CREG"); } @@ -1638,19 +1563,17 @@ Note: is supporting from R7 and above Protocol Stack. cs_status = lookup_tbl_net_status[stat]; tcore_network_set_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT, cs_status); - // tcore_network_get_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT, &cs_status); tcore_network_get_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_PACKET, &ps_status); act = lookup_tbl_access_technology[AcT]; tcore_network_set_access_technology(o, act); - if (stat == AT_CREG_STAT_REG_ROAM) { + if (stat == AT_CREG_STAT_REG_ROAM) tcore_network_set_roaming_state(o, TRUE); - }else if ((stat == AT_CREG_STAT_REG_DENIED) && (TRUE == tcore_network_get_roaming_state(o))) { + else if ((stat == AT_CREG_STAT_REG_DENIED) && (TRUE == tcore_network_get_roaming_state(o))) dbg("Ignore roaming set with REG_DENIED when previous state is REG_ROAM"); - }else { + else tcore_network_set_roaming_state(o, FALSE); - } tcore_network_get_service_type(o, &service_type); dbg("prev_service_type = 0x%x", service_type); @@ -1784,9 +1707,8 @@ minutes, seconds.*/ goto OUT; } - if ((time_zone = g_slist_nth_data(tokens, 0))) { + if ((time_zone = g_slist_nth_data(tokens, 0))) net_time_info.gmtoff = atoi(time_zone) * 15; /* TZ in minutes */ - } plmn_str = tcore_network_get_plmn(o); if (plmn_str != NULL) { @@ -1852,17 +1774,16 @@ static void on_sim_resp_hook_get_netname(UserRequest *ur, enum tcore_response_co * bit[1]: 0 = display of the service provider name is required when registered PLMN is neither HPLMN nor a PLMN in the service provider PLMN list * 1 = display of the service provider name is not required when registered PLMN is neither HPLMN nor a PLMN in the service provider PLMN list */ - if (resp->data.spn.display_condition & 0x01) { + if (resp->data.spn.display_condition & 0x01) tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_NETWORK); - } - if ((resp->data.spn.display_condition & 0x02) == 0) { + + if ((resp->data.spn.display_condition & 0x02) == 0) tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_SPN); - } - if ((resp->data.spn.display_condition & 0x03) == 0x01) { + + if ((resp->data.spn.display_condition & 0x03) == 0x01) tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_ANY); - } - // fallback in case no SPN name is provided + /* fallback in case no SPN name is provided */ if (resp->data.spn.spn[0] == '\0') tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_NETWORK); } @@ -1905,7 +1826,7 @@ static TReturn search_network(CoreObject *o, UserRequest *ur) } h = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(h)){ + if (FALSE == tcore_hal_get_power_state(h)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -1916,7 +1837,7 @@ static TReturn search_network(CoreObject *o, UserRequest *ur) atreq = tcore_at_request_new(cmd_str, "+COPS", TCORE_AT_SINGLELINE); tcore_pending_set_request_data(pending, 0, atreq); - tcore_pending_set_timeout(pending, 60); + tcore_pending_set_timeout(pending, 150); tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); tcore_pending_set_response_callback(pending, on_response_search_network, NULL); tcore_pending_set_timeout_callback(pending, on_timeout_search_network, NULL); @@ -1953,13 +1874,13 @@ static TReturn set_plmn_selection_mode(CoreObject *o, UserRequest *ur) req_data = tcore_user_request_ref_data(ur, NULL); h = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(h)){ + if (FALSE == tcore_hal_get_power_state(h)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } pending = tcore_pending_new(o, 0); - // Command Format - AT+COPS=[[,[,[,< AcT>]]]] + /* Command Format - AT+COPS=[[,[,[,< AcT>]]]] */ /* oper parameter format - 0 format presentations are set to long alphanumeric. If Network name not available it displays combination of Mcc and MNC in string format. - 1 format presentation is set to short alphanumeric. @@ -2021,7 +1942,7 @@ static TReturn get_plmn_selection_mode(CoreObject *o, UserRequest *ur) return TCORE_RETURN_EINVAL; h = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(h)){ + if (FALSE == tcore_hal_get_power_state(h)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2065,7 +1986,7 @@ static TReturn set_band(CoreObject *o, UserRequest *ur) req_data = tcore_user_request_ref_data(ur, NULL); h = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(h)){ + if (FALSE == tcore_hal_get_power_state(h)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2185,13 +2106,13 @@ AT+XRAT=[,] 1 GSM / UMTS Dual mode 2 UTRAN (UMTS) */ - if ((set_umts_band == TRUE) && (set_gsm_band == TRUE)) { + if ((set_umts_band == TRUE) && (set_gsm_band == TRUE)) cmd_str = g_strdup_printf("AT+XRAT=%d", AT_XRAT_DUAL); - } else if (set_umts_band == TRUE) { + else if (set_umts_band == TRUE) cmd_str = g_strdup_printf("AT+XRAT=%d", AT_XRAT_UMTS); - } else { + else cmd_str = g_strdup_printf("AT+XRAT=%d", AT_XRAT_GSM); - } + atreq = tcore_at_request_new(cmd_str, "+XRAT", TCORE_AT_NO_RESULT); pending = tcore_pending_new(o, 0); @@ -2218,7 +2139,7 @@ static TReturn get_band(CoreObject *o, UserRequest *ur) return TCORE_RETURN_EINVAL; h = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(h)){ + if (FALSE == tcore_hal_get_power_state(h)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2253,7 +2174,7 @@ static TReturn set_preferred_plmn(CoreObject *o, UserRequest *ur) return TCORE_RETURN_EINVAL; h = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(h)){ + if (FALSE == tcore_hal_get_power_state(h)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2278,9 +2199,8 @@ AT+CPOL= if (strlen(req_data->plmn) > 6) { req_data->plmn[6] = '\0'; } else if (strlen(req_data->plmn) == 6) { - if (req_data->plmn[5] == '#') { + if (req_data->plmn[5] == '#') req_data->plmn[5] = '\0'; - } } cmd_str = g_strdup_printf("AT+CPOL=%d,%d,\"%s\",%d,%d,%d", req_data->ef_index + 1, format, req_data->plmn, gsm_act, gsm_compact_act, utran_act); @@ -2315,7 +2235,7 @@ static TReturn get_preferred_plmn(CoreObject *o, UserRequest *ur) return TCORE_RETURN_EINVAL; h = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(h)){ + if (FALSE == tcore_hal_get_power_state(h)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2339,7 +2259,7 @@ static TReturn get_preferred_plmn(CoreObject *o, UserRequest *ur) return TCORE_RETURN_SUCCESS; } -static TReturn cancel_manual_search (CoreObject *o, UserRequest *ur) +static TReturn cancel_manual_search(CoreObject *o, UserRequest *ur) { TcoreHal *h = NULL; TcorePending *pending = NULL; @@ -2370,6 +2290,8 @@ static TReturn cancel_manual_search (CoreObject *o, UserRequest *ur) tcore_pending_link_user_request(pending, ur); tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL); + tcore_hal_send_request(h, pending); + /*Set the Search State to Cancelled*/ custom_data->search_state = IMC_NETWORK_SEARCH_STATE_CANCELLED; dbg("Search State: [CANCELLED]"); @@ -2387,7 +2309,7 @@ static TReturn get_serving_network(CoreObject *o, UserRequest *ur) if (!o) return TCORE_RETURN_EINVAL; - if(FALSE == tcore_hal_get_power_state(tcore_object_get_hal(o))){ + if (FALSE == tcore_hal_get_power_state(tcore_object_get_hal(o))) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2427,7 +2349,7 @@ static TReturn network_set_mode(CoreObject *o, UserRequest *ur) if (act == 1) /* AT-Command */ - at_cmd = g_strdup_printf("AT+XRAT=%d,2", act); //PreferredAct is UMTS + at_cmd = g_strdup_printf("AT+XRAT=%d,2", act); /* PreferredAct is UMTS */ else /* AT-Command */ at_cmd = g_strdup_printf("AT+XRAT=%d", act); @@ -2465,7 +2387,6 @@ static TReturn network_get_mode(CoreObject *o, UserRequest *ur) static TReturn set_default_subscription(CoreObject *co, UserRequest *ur) { - struct treq_network_set_default_subscription *req_data = NULL; Server *server; Storage *strg = NULL; TReturn ret = TCORE_RETURN_FAILURE; @@ -2476,12 +2397,11 @@ static TReturn set_default_subscription(CoreObject *co, UserRequest *ur) server = tcore_plugin_ref_server(plugin); strg = tcore_server_find_storage(server, "vconf"); - req_data = (struct treq_network_set_default_subscription *) tcore_user_request_ref_data(ur, NULL); - dbg("'default' Subscription for CS (Voice): [%d]", req_data->default_subs); + dbg("'default' Subscription for CS (Voice): [%d]", NETWORK_DEFAULT_SUBS_SIM1); /* Update VCONF through Storage - req_data->current_network is aligned to VCONFKEY values */ if (tcore_storage_set_int(strg, - STORAGE_KEY_TELEPHONY_DUALSIM_DEFAULT_SERVICE_INT, req_data->default_subs)) { + STORAGE_KEY_TELEPHONY_DUALSIM_DEFAULT_SERVICE_INT, NETWORK_DEFAULT_SUBS_SIM1)) { struct tresp_network_set_default_subs resp_data = {0, }; struct tnoti_network_default_subs default_subs_noti_data = {0, }; @@ -2495,7 +2415,7 @@ static TReturn set_default_subscription(CoreObject *co, UserRequest *ur) /* * Send Notification */ - default_subs_noti_data.default_subs = req_data->default_subs; + default_subs_noti_data.default_subs = NETWORK_DEFAULT_SUBS_SIM1; tcore_server_send_notification(tcore_plugin_ref_server(plugin), co, TNOTI_NETWORK_DEFAULT_SUBSCRIPTION, sizeof(struct tnoti_network_default_subs), &default_subs_noti_data); @@ -2552,9 +2472,9 @@ static TReturn get_default_data_subscription(CoreObject *co, UserRequest *ur) resp.default_subs = NETWORK_DEFAULT_DATA_SUBS_UNKNOWN; } - if( TCORE_RETURN_SUCCESS == tcore_user_request_send_response(ur, + if (TCORE_RETURN_SUCCESS == tcore_user_request_send_response(ur, TRESP_NETWORK_GET_DEFAULT_DATA_SUBSCRIPTION, - sizeof(struct tresp_network_get_default_data_subs), &resp)){ + sizeof(struct tresp_network_get_default_data_subs), &resp)) { tcore_user_request_unref(ur); } return TCORE_RETURN_SUCCESS; @@ -2581,7 +2501,7 @@ static struct tcore_network_operations network_ops = { .set_default_subscription = set_default_subscription, .get_default_subscription = get_default_subscription, .set_default_data_subscription = NULL, - .get_default_data_subscription =get_default_data_subscription, + .get_default_data_subscription = get_default_data_subscription, }; gboolean imc_network_init(TcorePlugin *cp, CoreObject *co_network) @@ -2590,10 +2510,14 @@ gboolean imc_network_init(TcorePlugin *cp, CoreObject *co_network) dbg("Enter"); /* Set operations */ - tcore_network_set_ops(co_network, &network_ops); + tcore_network_set_ops(co_network, &network_ops, TCORE_OPS_TYPE_CP); /* Custom data */ custom_data = g_malloc0(sizeof(CustomData)); + if (custom_data == NULL) { + err("Memory allocation failed!!"); + return FALSE; + } custom_data->search_state = IMC_NETWORK_SEARCH_STATE_NO_SEARCH; tcore_object_link_user_data(co_network, custom_data); @@ -2607,8 +2531,6 @@ gboolean imc_network_init(TcorePlugin *cp, CoreObject *co_network) tcore_server_add_notification_hook(tcore_plugin_ref_server(cp), TNOTI_SIM_STATUS, on_hook_sim_init, co_network); - _insert_mcc_mnc_oper_list(cp, co_network); - dbg("Exit"); return TRUE; diff --git a/src/imc_phonebook.c b/src/imc_phonebook.c index c5f0358..32db9a4 100644 --- a/src/imc_phonebook.c +++ b/src/imc_phonebook.c @@ -76,8 +76,8 @@ typedef struct { *****************************************************************************/ static gint __phonebook_compare_index(gconstpointer a, gconstpointer b) { - guint index1 = GPOINTER_TO_UINT(a); - guint index2 = GPOINTER_TO_UINT(b); + guint index1 = (guint)a; + guint index2 = (guint)b; return index1 - index2; } @@ -105,12 +105,11 @@ static enum tel_phonebook_ton __phonebook_find_num_plan(int number_plan) enum tel_phonebook_ton result; dbg("number_plan : 0x%04x", number_plan); - if (number_plan & IMC_NUM_PLAN_INTERNATIONAL) { + if (number_plan & IMC_NUM_PLAN_INTERNATIONAL) result = PB_TON_INTERNATIONAL; - } - else { + else result = PB_TON_UNKNOWN; - } + dbg("result : %d", result); return result; @@ -214,7 +213,7 @@ static gboolean __phonebook_update_index_list_by_type(CoreObject *co, * Check if 'index' is already available (UPDATE operation). */ while (list) { - if (GPOINTER_TO_UINT(list->data) == req_index) { + if ((guint)list->data == req_index) { /* * index 'present', no need to update */ @@ -234,7 +233,7 @@ static gboolean __phonebook_update_index_list_by_type(CoreObject *co, case PB_TYPE_FDN: private_info->used_index_fdn = g_slist_insert_sorted( private_info->used_index_fdn, - GUINT_TO_POINTER(req_index), + (gpointer)req_index, __phonebook_compare_index); /* Update Phonebook list valid */ @@ -245,7 +244,7 @@ static gboolean __phonebook_update_index_list_by_type(CoreObject *co, case PB_TYPE_ADN: private_info->used_index_adn = g_slist_insert_sorted( private_info->used_index_adn, - GUINT_TO_POINTER(req_index), + (gpointer)req_index, __phonebook_compare_index); /* Update Phonebook list valid */ @@ -256,7 +255,7 @@ static gboolean __phonebook_update_index_list_by_type(CoreObject *co, case PB_TYPE_SDN: private_info->used_index_sdn = g_slist_insert_sorted( private_info->used_index_sdn, - GUINT_TO_POINTER(req_index), + (gpointer)req_index, __phonebook_compare_index); /* Update Phonebook list valid */ @@ -267,7 +266,7 @@ static gboolean __phonebook_update_index_list_by_type(CoreObject *co, case PB_TYPE_USIM: private_info->used_index_usim = g_slist_insert_sorted( private_info->used_index_usim, - GUINT_TO_POINTER(req_index), + (gpointer)req_index, __phonebook_compare_index); /* Update Phonebook list valid */ @@ -337,9 +336,9 @@ static void __phonebook_check_used_index(CoreObject *co, } /* Use first used_index in case req_index is not used */ - *used_index = GPOINTER_TO_UINT(g_slist_nth_data(list, VAL_ZERO)); + *used_index = (guint)g_slist_nth_data(list, VAL_ZERO); while (list) { - if (GPOINTER_TO_UINT(list->data) == req_index) { + if ((guint)list->data == req_index) { /* * req_index is equal to one of used_index */ @@ -367,6 +366,7 @@ static void __on_resp_phonebook_get_support_list(TcorePending *p, if (resp && resp->success > VAL_ZERO) { const char *line; char *temp = NULL; + char *ptr = NULL; GSList *tokens = NULL; char *pb_type = NULL; @@ -378,7 +378,7 @@ static void __on_resp_phonebook_get_support_list(TcorePending *p, goto EXIT; } - line = (const char*)resp->lines->data; + line = (const char *)resp->lines->data; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) < VAL_ONE) { warn("Invalid notification - 'number' of tokens: [%d]", @@ -390,8 +390,9 @@ static void __on_resp_phonebook_get_support_list(TcorePending *p, goto EXIT; } - temp = (char*)g_slist_nth_data(tokens, VAL_ZERO); - pb_type = strtok(temp, "(,)"); + temp = (char *)g_slist_nth_data(tokens, VAL_ZERO); + pb_type = strtok_r(temp, "(,)", &ptr); + while (pb_type != NULL) { temp = tcore_at_tok_extract(pb_type); dbg("pbtype %s", temp); @@ -399,12 +400,10 @@ static void __on_resp_phonebook_get_support_list(TcorePending *p, if (VAL_ZERO == g_strcmp0(temp, "FD")) { dbg("SIM fixed-dialing Phonebook"); noti_data.support_list.b_fdn = TRUE; - } - else if (VAL_ZERO == g_strcmp0(temp, "SN")) { + } else if (VAL_ZERO == g_strcmp0(temp, "SN")) { dbg("Service Dialing Number"); noti_data.support_list.b_sdn = TRUE; - } - else if (VAL_ZERO == g_strcmp0(temp, "SM")) { + } else if (VAL_ZERO == g_strcmp0(temp, "SM")) { CoreObject *co_sim = NULL; enum tel_sim_type sim_type = SIM_TYPE_UNKNOWN; @@ -425,32 +424,26 @@ static void __on_resp_phonebook_get_support_list(TcorePending *p, if (sim_type == SIM_TYPE_USIM) { /* 3G SIM */ noti_data.support_list.b_usim = TRUE; dbg("3G SIM - USIM Phonebook"); - } - else { /* 2G SIM */ + } else { /* 2G SIM */ noti_data.support_list.b_adn = TRUE; dbg("2G SIM - ADN Phonebook"); } - } - else if (VAL_ZERO == g_strcmp0(temp, "LD")) { + } else if (VAL_ZERO == g_strcmp0(temp, "LD")) { dbg("SIM/UICC - last-dialling-phonebook"); - } - else if (VAL_ZERO == g_strcmp0(temp, "ON")) { + } else if (VAL_ZERO == g_strcmp0(temp, "ON")) { dbg("SIM (or MT) own numbers (MSISDNs) list"); - } - else if (VAL_ZERO == g_strcmp0(temp, "BL")) { + } else if (VAL_ZERO == g_strcmp0(temp, "BL")) { dbg("Blacklist phonebook"); - } - else if (VAL_ZERO == g_strcmp0(temp, "EC")) { + } else if (VAL_ZERO == g_strcmp0(temp, "EC")) { dbg("SIM emergency-call-codes phonebook"); - } - else if (VAL_ZERO == g_strcmp0(temp, "AP")) { + } else if (VAL_ZERO == g_strcmp0(temp, "AP")) { dbg("Selected application phonebook"); - } - else if (VAL_ZERO == g_strcmp0(temp, "BN")) { + } else if (VAL_ZERO == g_strcmp0(temp, "BN")) { dbg("SIM barred-dialling-number"); } - pb_type = strtok (NULL, "(,)"); + pb_type = strtok_r(NULL, "(,)", &ptr); + g_free(temp); } @@ -469,8 +462,7 @@ static void __on_resp_phonebook_get_support_list(TcorePending *p, /* Update states */ tcore_phonebook_set_support_list(co_phonebook, ¬i_data.support_list); tcore_phonebook_set_status(co_phonebook, noti_data.b_init); - } - else { + } else { dbg("RESPONSE NOK"); /* Update state */ @@ -595,7 +587,7 @@ static void __on_resp_phonebook_get_used_index(TcorePending *p, if (temp) { /* Insert used_index in PrivateInfo sorted in ascending */ *list = g_slist_insert_sorted(*list, - GUINT_TO_POINTER(atoi(temp)), + (gpointer)atoi(temp), __phonebook_compare_index); } tcore_at_tok_free(tokens); @@ -607,8 +599,7 @@ static void __on_resp_phonebook_get_used_index(TcorePending *p, dbg("pb_type: [%d], used_index Length: [%d]", req_pb_type, g_slist_length(*list)); } - } - else { + } else { err("Response NOK"); } } @@ -668,7 +659,7 @@ static void on_resp_get_count(TcorePending *p, CoreObject *co = tcore_pending_ref_core_object(p); enum tel_phonebook_type pb_type; - GSList *tokens=NULL; + GSList *tokens = NULL; char *temp = NULL; dbg("RESPONSE OK"); @@ -726,8 +717,7 @@ static void on_resp_get_count(TcorePending *p, /* Cache 'used' index list */ __phonebook_get_used_index(co, pb_type, resp_get_count.total_count); } - } - else { + } else { dbg("RESPONSE NOK"); } EXIT: @@ -856,8 +846,7 @@ static void on_resp_get_info(TcorePending *p, /* Cache 'used' index list */ __phonebook_get_used_index(co, pb_type, resp_get_info.index_max); } - } - else { + } else { dbg("RESPONSE NOK"); } @@ -1081,7 +1070,7 @@ static void on_resp_read_record(TcorePending *p, * +CPBR: ,,,[,][,] * [,][,][,][,]] */ - line = (const char*)resp->lines->data; + line = (const char *)resp->lines->data; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) < VAL_ONE) { err("invalid message"); @@ -1126,7 +1115,7 @@ static void on_resp_read_record(TcorePending *p, if (name) { g_strlcpy((char *)resp_read_record.name, (const gchar *)name, PHONEBOOK_NAME_BYTE_MAX+1); - resp_read_record.name_len = strlen((const char*)resp_read_record.name); + resp_read_record.name_len = strlen((const char *)resp_read_record.name); resp_read_record.dcs = PB_TEXT_ASCII; g_free(name); } @@ -1141,10 +1130,10 @@ static void on_resp_read_record(TcorePending *p, if (__phonebook_get_index_list_by_type(co, req_data->phonebook_type, &list) == TRUE) { while (list) { - if (GPOINTER_TO_UINT(list->data) == resp_read_record.index) { + if ((guint)list->data == resp_read_record.index) { if ((list = g_slist_next(list)) != NULL) { /* If exist, set next_index */ - resp_read_record.next_index = GPOINTER_TO_UINT(list->data); + resp_read_record.next_index = (guint)list->data; dbg("next_index is [%u]", resp_read_record.next_index); } else { /* read_record.index is the end of used_index */ @@ -1162,9 +1151,8 @@ static void on_resp_read_record(TcorePending *p, /* Fetch */ temp = g_slist_nth_data(tokens, VAL_FOUR); - if (temp) { + if (temp) dbg("Phonebook entry is hidden"); - } /* Fetch */ temp = g_slist_nth_data(tokens, VAL_SIX); @@ -1193,7 +1181,7 @@ static void on_resp_read_record(TcorePending *p, if (sne) { g_strlcpy((char *)resp_read_record.sne, (const gchar *)sne, PHONEBOOK_NAME_BYTE_MAX+1); - resp_read_record.sne_len = strlen((const char*)resp_read_record.sne); + resp_read_record.sne_len = strlen((const char *)resp_read_record.sne); resp_read_record.sne_dcs = PB_TEXT_ASCII; g_free(sne); } @@ -1208,15 +1196,14 @@ static void on_resp_read_record(TcorePending *p, if (email) { g_strlcpy((char *)resp_read_record.email1, (const gchar *)email, PHONEBOOK_EMAIL_BYTE_MAX+1); - resp_read_record.email1_len = strlen((const char*)resp_read_record.email1); + resp_read_record.email1_len = strlen((const char *)resp_read_record.email1); g_free(email); } EXIT: /* Free resources */ tcore_at_tok_free(tokens); - } - else { + } else { dbg("RESPONSE NOK"); } @@ -1260,8 +1247,7 @@ static void on_resp_update_record(TcorePending *p, */ __phonebook_update_index_list_by_type(co, req_data->phonebook_type, req_data->index); - } - else { + } else { dbg("RESPONSE NOK"); resp_update_record.result = PB_FAIL; } @@ -1271,8 +1257,7 @@ static void on_resp_update_record(TcorePending *p, tcore_user_request_send_response(ur, TRESP_PHONEBOOK_UPDATERECORD, sizeof(struct tresp_phonebook_update_record), &resp_update_record); - } - else { + } else { err("ur is NULL"); } @@ -1308,26 +1293,22 @@ static void on_resp_delete_record(TcorePending *p, if (__phonebook_get_index_list_by_type(co, req_data->phonebook_type, &list) != TRUE) { err("used_index list is NOT valid"); - } - else { - const guint del_index = GPOINTER_TO_UINT(req_data->index); - list = g_slist_remove(list, (gconstpointer)GUINT_TO_POINTER(del_index)); + } else { + const int del_index = (const int)req_data->index; + list = g_slist_remove(list, (gconstpointer)del_index); dbg("Remove index: [%u] list: [0x%x]", req_data->index, list); } - } - else { + } else { dbg("RESPONSE NOK"); resp_delete_record.result = PB_FAIL; } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_PHONEBOOK_DELETERECORD, sizeof(struct tresp_phonebook_delete_record), &resp_delete_record); - } - else { + else err("ur is NULL"); - } dbg("Exit"); } @@ -1533,7 +1514,7 @@ static TReturn imc_get_usim_info(CoreObject *co, UserRequest *ur) * Type of address octet in integer format * String type field of maximum length * Indicates if the entry is hidden or not – only available, - * if a UICC with an active USIM application is present + * if a UICC with an active USIM application is present * 0 Phonebook entry not hidden * 1 Phonebook entry hidden * String type field of maximum length @@ -1629,7 +1610,7 @@ static TReturn imc_update_record(CoreObject *co, UserRequest *ur) at_cmd = g_strdup_printf("%s+CPBW=%u,\"%s\",%d,\"%s\",,\"%s\",,\"%s\",\"%s\"", set_pb_cmd, req_data->index, req_data->number, - ((PB_TON_INTERNATIONAL == req_data->ton) ? IMC_TON_INTERNATIONAL: IMC_TON_UNKNOWN), + ((PB_TON_INTERNATIONAL == req_data->ton) ? IMC_TON_INTERNATIONAL : IMC_TON_UNKNOWN), req_data->name, req_data->anr1, req_data->sne, req_data->email1); } else { @@ -1742,7 +1723,7 @@ gboolean imc_phonebook_init(TcorePlugin *cp, CoreObject *co_phonebook) dbg("Entry"); /* Set operations */ - tcore_phonebook_set_ops(co_phonebook, &phonebook_ops); + tcore_phonebook_set_ops(co_phonebook, &phonebook_ops, TCORE_OPS_TYPE_CP); /* Set PrivateInfo */ private_info = g_malloc0(sizeof(PrivateInfo)); diff --git a/src/imc_ps.c b/src/imc_ps.c index 5ac017b..4daa181 100644 --- a/src/imc_ps.c +++ b/src/imc_ps.c @@ -221,6 +221,7 @@ static gboolean on_event_dun_call_notification(CoreObject *o, const void *data, tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_PS_EXTERNAL_CALL, sizeof(struct tnoti_ps_external_call), &data); } + break; case 3: { @@ -263,11 +264,10 @@ static void send_undefine_context_cmd(CoreObject *co_ps, CoreObject *ps_context) { TcoreHal *hal = NULL; TcorePending *pending = NULL; - char cmd_str[MAX_AT_CMD_STR_LEN]; + char *cmd_str = NULL; int cid = 0; dbg("Entry"); - memset(cmd_str, 0x0, MAX_AT_CMD_STR_LEN); /* FIXME: Before MUX setup, use PHY HAL directly. */ hal = tcore_object_get_hal(co_ps); @@ -275,7 +275,8 @@ static void send_undefine_context_cmd(CoreObject *co_ps, CoreObject *ps_context) /*Getting Context ID from Core Object*/ cid = tcore_context_get_id(ps_context); - (void) sprintf(cmd_str, "AT+CGDCONT=%d", cid); + cmd_str = g_strdup_printf("AT+CGDCONT=%d", cid); + dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str)); pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT, @@ -285,12 +286,14 @@ static void send_undefine_context_cmd(CoreObject *co_ps, CoreObject *ps_context) goto error; } tcore_hal_send_request(hal, pending); + g_free(cmd_str); dbg("Exit: Successfully"); return; error: { dbg("Exit: With error"); _unable_to_get_pending(co_ps, ps_context); + g_free(cmd_str); return; } } @@ -304,7 +307,7 @@ static void on_setup_pdp(CoreObject *co_ps, int result, dbg("Entry"); - if (!ps_data ) { + if (!ps_data) { err("PS_data unavailable. Exiting."); return; } @@ -326,7 +329,6 @@ static void on_setup_pdp(CoreObject *co_ps, int result, } /* Set Device name */ - //tcore_context_set_ipv4_devname(ps_context, netif_name); g_strlcpy(ps_data->data_call_conf.devname, netif_name, sizeof(ps_data->data_call_conf.devname)); ps_data->data_call_conf.context_id = (int)tcore_context_get_id(ps_data->ps_context); @@ -378,9 +380,8 @@ static void on_response_get_dns_cmnd(TcorePending *p, int data_len, const void * pRespData = (GSList *) resp->lines; no_pdp_active = g_slist_length(pRespData); dbg("Total Number of Active PS Context: [%d]", no_pdp_active); - if (0 == no_pdp_active) { + if (0 == no_pdp_active) goto exit_fail; - } while (pRespData) { line = (const char *) pRespData->data; @@ -406,7 +407,7 @@ static void on_response_get_dns_cmnd(TcorePending *p, int data_len, const void * token_dns = g_slist_nth_data(tokens, 1); /* Strip off starting " and ending " from this token to read actual PDP address */ - dns_prim = util_removeQuotes((void *)token_dns); + dns_prim = tcore_at_tok_extract((void *)token_dns); dbg("Primary DNS: [%s]", dns_prim); } @@ -415,7 +416,7 @@ static void on_response_get_dns_cmnd(TcorePending *p, int data_len, const void * token_dns = g_slist_nth_data(tokens, 2); /* Strip off starting " and ending " from this token to read actual PDP address */ - dns_sec = util_removeQuotes((void *)token_dns); + dns_sec = tcore_at_tok_extract((void *)token_dns); dbg("Secondary DNS: [%s]", dns_sec); } @@ -435,8 +436,8 @@ static void on_response_get_dns_cmnd(TcorePending *p, int data_len, const void * __convert_ipv4_atoi(ps_data->data_call_conf.primary_dns, dns_prim); __convert_ipv4_atoi(ps_data->data_call_conf.secondary_dns, dns_sec); - util_hex_dump(" ", 4, ps_data->data_call_conf.primary_dns); - util_hex_dump(" ", 4, ps_data->data_call_conf.secondary_dns); + tcore_util_hex_dump(" ", 4, ps_data->data_call_conf.primary_dns); + tcore_util_hex_dump(" ", 4, ps_data->data_call_conf.secondary_dns); /* Set DNS Address */ tcore_context_set_dns1(ps_data->ps_context, dns_prim); @@ -478,22 +479,22 @@ static TReturn send_get_dns_cmd(CoreObject *co_ps, struct ps_user_data *ps_data) { TcoreHal *hal = NULL; TcorePending *pending = NULL; - char cmd_str[MAX_AT_CMD_STR_LEN]; - - memset(cmd_str, 0x0, MAX_AT_CMD_STR_LEN); + char *cmd_str = NULL; dbg("Entry"); hal = tcore_object_get_hal(co_ps); - (void) sprintf(cmd_str, "AT+XDNS?"); + cmd_str = g_strdup("AT+XDNS?"); dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str)); pending = tcore_at_pending_new(co_ps, cmd_str, "+XDNS", TCORE_AT_MULTILINE, on_response_get_dns_cmnd, (void *)ps_data); if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) { + g_free(cmd_str); return TCORE_RETURN_SUCCESS; } _unable_to_get_pending(co_ps, ps_data->ps_context); + g_free(cmd_str); return TCORE_RETURN_FAILURE; } @@ -511,7 +512,11 @@ static void on_response_get_pdp_address(TcorePending *p, int data_len, const voi dbg("Enetered"); if (resp->final_response) { - ps_data = g_try_malloc0(sizeof (struct ps_user_data)); + ps_data = g_try_malloc0(sizeof(struct ps_user_data)); + if (ps_data == NULL) { + err("Memory allocation failed!!"); + return; + } ps_data->ps_context = ps_context; dbg("RESPONSE OK"); if (resp->lines != NULL) { @@ -525,12 +530,12 @@ static void on_response_get_pdp_address(TcorePending *p, int data_len, const voi /* CID is already stored in ps_context, skip over & read PDP address */ token_address = g_slist_nth_data(tokens, 1); - token_pdp_address = util_removeQuotes((void *)token_address); + token_pdp_address = tcore_at_tok_extract((void *)token_address); dbg("IP Address: [%s]", token_pdp_address); __convert_ipv4_atoi(ps_data->data_call_conf.ip_address, token_pdp_address); - util_hex_dump(" ", 4, ps_data->data_call_conf.ip_address); + tcore_util_hex_dump(" ", 4, ps_data->data_call_conf.ip_address); /* Strip off starting " and ending " from this token to read actual PDP address */ /* Set IP Address */ @@ -557,21 +562,24 @@ static TReturn send_get_pdp_address_cmd(CoreObject *co_ps, CoreObject *ps_contex TcoreHal *hal = NULL; TcorePending *pending = NULL; unsigned int cid = PS_INVALID_CID; - char cmd_str[MAX_AT_CMD_STR_LEN] = {0}; + char *cmd_str = NULL; dbg("Entry"); hal = tcore_object_get_hal(co_ps); cid = tcore_context_get_id(ps_context); - (void) sprintf(cmd_str, "AT+CGPADDR=%d", cid); + cmd_str = g_strdup_printf("AT+CGPADDR=%d", cid); + dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str)); pending = tcore_at_pending_new(co_ps, cmd_str, "+CGPADDR", TCORE_AT_SINGLELINE, on_response_get_pdp_address, ps_context); if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) { + g_free(cmd_str); return TCORE_RETURN_SUCCESS; } _unable_to_get_pending(co_ps, ps_context); + g_free(cmd_str); return TCORE_RETURN_FAILURE; } @@ -586,9 +594,9 @@ static void on_response_send_pdp_activate_cmd(TcorePending *p, int data_len, con dbg("Entry"); - if (!p) { + if (!p) goto error; - } + co_ps = tcore_pending_ref_core_object(p); if (resp->success) { @@ -616,23 +624,28 @@ static TReturn send_pdp_activate_cmd(CoreObject *co_ps, CoreObject *ps_context) { TcoreHal *hal = NULL; TcorePending *pending = NULL; - char cmd_str[MAX_AT_CMD_STR_LEN] = {0}; + char *cmd_str = NULL; int cid = 0; + dbg("Entry"); + /* FIXME: Before MUX setup, use PHY HAL directly. */ hal = tcore_object_get_hal(co_ps); /*Getting Context ID from Core Object*/ cid = tcore_context_get_id(ps_context); - (void) sprintf(cmd_str, "AT+CGACT=%d,%d", AT_PDP_ACTIVATE, cid); + cmd_str = g_strdup_printf("AT+CGACT=%d,%d", AT_PDP_ACTIVATE, cid); + dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str)); pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT, on_response_send_pdp_activate_cmd, ps_context); if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) { + g_free(cmd_str); return TCORE_RETURN_SUCCESS; } _unable_to_get_pending(co_ps, ps_context); + g_free(cmd_str); return TCORE_RETURN_FAILURE; } @@ -680,25 +693,26 @@ static TReturn send_pdp_deactivate_cmd(CoreObject *co_ps, CoreObject *ps_context { TcoreHal *hal = NULL; TcorePending *pending = NULL; - char cmd_str[MAX_AT_CMD_STR_LEN]; + char *cmd_str = NULL; int cid = 0; dbg("Entry"); - memset(cmd_str, 0x0, MAX_AT_CMD_STR_LEN); hal = tcore_object_get_hal(co_ps); /*Getting Context ID from Core Object*/ cid = tcore_context_get_id(ps_context); + cmd_str = g_strdup_printf("AT+CGACT=%d,%u", AT_PDP_DEACTIVATE, cid); - (void) sprintf(cmd_str, "AT+CGACT=%d,%u", AT_PDP_DEACTIVATE, cid); dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str)); pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT, on_response_send_pdp_deactivate_cmd, ps_context); if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) { + g_free(cmd_str); return TCORE_RETURN_SUCCESS; } + g_free(cmd_str); return TCORE_RETURN_FAILURE; } @@ -741,23 +755,24 @@ static TReturn send_xdns_enable_cmd(CoreObject *co_ps, CoreObject *ps_context) TcoreHal *hal = NULL; TcorePending *pending = NULL; int cid = -1; - char cmd_str[MAX_AT_CMD_STR_LEN]; + char *cmd_str = NULL; dbg("Entry"); - memset(cmd_str, 0x0, MAX_AT_CMD_STR_LEN); hal = tcore_object_get_hal(co_ps); cid = tcore_context_get_id(ps_context); - (void) sprintf(cmd_str, "AT+XDNS=%d,%d", cid, AT_XDNS_ENABLE); + cmd_str = g_strdup_printf("AT+XDNS=%d,%d", cid, AT_XDNS_ENABLE); dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str)); pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT, on_response_xdns_enable_cmd, ps_context); if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) { + g_free(cmd_str); return TCORE_RETURN_SUCCESS; } _unable_to_get_pending(co_ps, ps_context); + g_free(cmd_str); return TCORE_RETURN_FAILURE; } @@ -784,8 +799,8 @@ static TReturn define_ps_context(CoreObject *co_ps, CoreObject *ps_context, void TcoreHal *hal = NULL; TcorePending *pending = NULL; char *apn = NULL; - char cmd_str[MAX_AT_CMD_STR_LEN] = {0}; - char pdp_type_str[10] = {0}; + char *cmd_str = NULL; + char *pdp_type_str = NULL; unsigned int cid = PS_INVALID_CID; enum co_context_type pdp_type; enum co_context_d_comp d_comp; @@ -804,28 +819,29 @@ static TReturn define_ps_context(CoreObject *co_ps, CoreObject *ps_context, void case CONTEXT_TYPE_X25: { dbg("CONTEXT_TYPE_X25"); - strcpy(pdp_type_str, "X.25"); - break; + pdp_type_str = g_strdup_printf("X.25"); } + break; + case CONTEXT_TYPE_IPV4V6: case CONTEXT_TYPE_IP: { dbg("CONTEXT_TYPE_IP"); - strcpy(pdp_type_str, "IP"); + pdp_type_str = g_strdup_printf("IP"); } break; case CONTEXT_TYPE_PPP: { dbg("CONTEXT_TYPE_PPP"); - strcpy(pdp_type_str, "PPP"); + pdp_type_str = g_strdup_printf("PPP"); } break; case CONTEXT_TYPE_IPV6: { dbg("CONTEXT_TYPE_IPV6"); - strcpy(pdp_type_str, "IPV6"); + pdp_type_str = g_strdup_printf("IPV6"); break; } @@ -838,16 +854,22 @@ static TReturn define_ps_context(CoreObject *co_ps, CoreObject *ps_context, void } } dbg("Activating context for CID: %d", cid); - (void) sprintf(cmd_str, "AT+CGDCONT=%d,\"%s\",\"%s\",,%d,%d", cid, pdp_type_str, apn, d_comp, h_comp); + cmd_str = g_strdup_printf("AT+CGDCONT=%d,\"%s\",\"%s\",,%d,%d", + cid, pdp_type_str, apn, d_comp, h_comp); + dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str)); g_free(apn); pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT, on_response_define_pdp_context, ps_context); if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) { + g_free(cmd_str); + g_free(pdp_type_str); return TCORE_RETURN_SUCCESS; } _unable_to_get_pending(co_ps, ps_context); + g_free(cmd_str); + g_free(pdp_type_str); return TCORE_RETURN_FAILURE; } @@ -865,7 +887,7 @@ gboolean imc_ps_init(TcorePlugin *cp, CoreObject *co_ps) dbg("Entry"); /* Set operations */ - tcore_ps_set_ops(co_ps, &ps_ops); + tcore_ps_set_ops(co_ps, &ps_ops, TCORE_OPS_TYPE_CP); tcore_object_add_callback(co_ps, "+CGEV", on_cgev_notification, NULL); tcore_object_add_callback(co_ps, "+XNOTIFYDUNSTATUS", on_event_dun_call_notification, plugin); diff --git a/src/imc_sap.c b/src/imc_sap.c index c15cf8b..d6615fd 100644 --- a/src/imc_sap.c +++ b/src/imc_sap.c @@ -41,12 +41,10 @@ static void on_confirmation_sap_message_send(TcorePending *p, gboolean result, v { dbg("on_confirmation_sap_message_send - msg out from queue.\n"); - if (result == FALSE) { - /* Fail */ + if (result == FALSE) /* Fail */ dbg("SEND FAIL"); - } else { + else dbg("SEND OK"); - } } static gboolean on_event_sap_status(CoreObject *o, const void *event_info, void *user_data) @@ -64,7 +62,7 @@ static gboolean on_event_sap_status(CoreObject *o, const void *event_info, void dbg("unsolicited msg but multiple line"); return FALSE; } - line = (char *) (lines->data); + line = (char *)(lines->data); tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) != 1) { @@ -74,28 +72,34 @@ static gboolean on_event_sap_status(CoreObject *o, const void *event_info, void } status = atoi(g_slist_nth_data(tokens, 0)); - switch(status){ - case 0: - noti.status = SAP_CARD_STATUS_UNKNOWN; - break; - case 1: - noti.status = SAP_CARD_STATUS_RESET; - break; - case 2: - noti.status = SAP_CARD_STATUS_NOT_ACCESSIBLE; - break; - case 3: - noti.status = SAP_CARD_STATUS_REMOVED; - break; - case 4: - noti.status = SAP_CARD_STATUS_INSERTED; - break; - case 5: - noti.status = SAP_CARD_STATUS_RECOVERED; - break; - default: - noti.status = SAP_CARD_STATUS_NOT_ACCESSIBLE; - break; + switch (status) { + case 0: + noti.status = SAP_CARD_STATUS_UNKNOWN; + break; + + case 1: + noti.status = SAP_CARD_STATUS_RESET; + break; + + case 2: + noti.status = SAP_CARD_STATUS_NOT_ACCESSIBLE; + break; + + case 3: + noti.status = SAP_CARD_STATUS_REMOVED; + break; + + case 4: + noti.status = SAP_CARD_STATUS_INSERTED; + break; + + case 5: + noti.status = SAP_CARD_STATUS_RECOVERED; + break; + + default: + noti.status = SAP_CARD_STATUS_NOT_ACCESSIBLE; + break; } tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SAP_STATUS, @@ -103,9 +107,10 @@ static gboolean on_event_sap_status(CoreObject *o, const void *event_info, void return TRUE; } -/*static void on_event_sap_disconnect(CoreObject *o, const void *event_info, void *user_data) +#if 0 +static void on_event_sap_disconnect(CoreObject *o, const void *event_info, void *user_data) { - //ToDo - Indication not present + /* ToDo - Indication not present */ const ipc_sap_disconnect_noti_type *ipc = event_info; struct tnoti_sap_disconnect noti; @@ -115,7 +120,8 @@ static gboolean on_event_sap_status(CoreObject *o, const void *event_info, void noti.type = ipc->disconnect_type; tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SAP_DISCONNECT, sizeof(struct tnoti_sap_disconnect), ¬i); -}*/ +} +#endif static void on_response_connect(TcorePending *p, int data_len, const void *data, void *user_data) { @@ -129,22 +135,21 @@ static void on_response_connect(TcorePending *p, int data_len, const void *data, memset(&res, 0x00, sizeof(struct tresp_sap_req_connect)); ur = tcore_pending_ref_user_request(p); - if(resp->success > 0) - { + if (resp->success > 0) { dbg("RESPONSE OK"); res.status = SAP_CONNECTION_STATUS_OK; res.max_msg_size = *max_msg_size; - }else{ + } else { dbg("RESPONSE NOK"); res.status = SAP_CONNECTION_STATUS_UNABLE_TO_ESTABLISH; res.max_msg_size = 0; } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAP_REQ_CONNECT, sizeof(struct tresp_sap_req_connect), &res); - } + dbg(" Function exit"); } @@ -158,20 +163,19 @@ static void on_response_disconnect(TcorePending *p, int data_len, const void *da memset(&res, 0x00, sizeof(struct tresp_sap_req_disconnect)); ur = tcore_pending_ref_user_request(p); - if(resp->success > 0) - { + if (resp->success > 0) { dbg("RESPONSE OK"); res.result = SAP_RESULT_CODE_OK; - }else{ + } else { dbg("RESPONSE NOK"); - //ToDo - Error mapping + /* ToDo - Error mapping */ } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAP_REQ_DISCONNECT, sizeof(struct tresp_sap_req_disconnect), &res); - } + dbg(" Function exit"); } @@ -185,20 +189,18 @@ static void on_response_req_status(TcorePending *p, int data_len, const void *da ur = tcore_pending_ref_user_request(p); - if(resp->success > 0) - { + if (resp->success > 0) { dbg("RESPONSE OK"); - //ToDo - No AT command present - //res.status = NULL; + /* ToDo - No AT command present */ - }else{ + } else { dbg("RESPONSE NOK"); - //ToDo - Error mapping + /* ToDo - Error mapping */ } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAP_REQ_STATUS, sizeof(struct tresp_sap_req_status), &res); - } + dbg(" Function exit"); } @@ -212,20 +214,18 @@ static void on_response_set_transfort_protocol(TcorePending *p, int data_len, co ur = tcore_pending_ref_user_request(p); - if(resp->success > 0) - { + if (resp->success > 0) { dbg("RESPONSE OK"); - //ToDo - No AT command present - //res.result = NULL; + /* ToDo - No AT command present */ - }else{ + } else { dbg("RESPONSE NOK"); - //ToDo - Error mapping + /* ToDo - Error mapping */ } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAP_SET_PROTOCOL, sizeof(struct tresp_sap_set_protocol), &res); - } + dbg(" Function exit"); } @@ -234,7 +234,7 @@ static void on_response_set_power(TcorePending *p, int data_len, const void *dat const TcoreATResponse *resp = data; UserRequest *ur = NULL; struct tresp_sap_set_power res; - GSList *tokens=NULL; + GSList *tokens = NULL; const char *line; int sap_status = -1; @@ -242,11 +242,10 @@ static void on_response_set_power(TcorePending *p, int data_len, const void *dat ur = tcore_pending_ref_user_request(p); - if(resp->success > 0) - { + if (resp->success > 0) { dbg("RESPONSE OK"); - if(resp->lines) { - line = (const char*)resp->lines->data; + if (resp->lines) { + line = (const char *)resp->lines->data; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) < 1) { msg("invalid message"); @@ -256,44 +255,44 @@ static void on_response_set_power(TcorePending *p, int data_len, const void *dat } sap_status = atoi(g_slist_nth_data(tokens, 0)); - switch(sap_status){ - case 0: - res.result = SAP_RESULT_CODE_OK; - break; - case 1: - res.result = SAP_RESULT_CODE_NO_REASON; - break; - case 2: - res.result = SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE; - break; - case 3: - res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF; - break; - case 4: - res.result = SAP_RESULT_CODE_CARD_REMOVED; - break; - case 5: - res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_ON; - break; - case 6: - res.result = SAP_RESULT_CODE_DATA_NOT_AVAILABLE; - break; - case 7: - res.result = SAP_RESULT_CODE_NOT_SUPPORT; - break; - default: - res.result = SAP_RESULT_CODE_NOT_SUPPORT; - break; + switch (sap_status) { + case 0: + res.result = SAP_RESULT_CODE_OK; + break; + case 1: + res.result = SAP_RESULT_CODE_NO_REASON; + break; + case 2: + res.result = SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE; + break; + case 3: + res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF; + break; + case 4: + res.result = SAP_RESULT_CODE_CARD_REMOVED; + break; + case 5: + res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_ON; + break; + case 6: + res.result = SAP_RESULT_CODE_DATA_NOT_AVAILABLE; + break; + case 7: + res.result = SAP_RESULT_CODE_NOT_SUPPORT; + break; + default: + res.result = SAP_RESULT_CODE_NOT_SUPPORT; + break; } - }else{ + } else { dbg("RESPONSE NOK"); res.result = SAP_RESULT_CODE_NOT_SUPPORT; } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAP_SET_POWER, sizeof(struct tresp_sap_set_power), &res); - } + tcore_at_tok_free(tokens); dbg(" Function exit"); } @@ -303,7 +302,7 @@ static void on_response_get_atr(TcorePending *p, int data_len, const void *data, const TcoreATResponse *resp = data; UserRequest *ur = NULL; struct tresp_sap_req_atr res; - GSList *tokens=NULL; + GSList *tokens = NULL; const char *line; int sap_status = -1; char *atr_data = NULL; @@ -312,12 +311,11 @@ static void on_response_get_atr(TcorePending *p, int data_len, const void *data, ur = tcore_pending_ref_user_request(p); - if(resp->success > 0) - { + if (resp->success > 0) { dbg("RESPONSE OK"); - if(resp->lines) { - line = (const char*)resp->lines->data; + if (resp->lines) { + line = (const char *)resp->lines->data; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) < 1) { msg("invalid message"); @@ -329,50 +327,58 @@ static void on_response_get_atr(TcorePending *p, int data_len, const void *data, atr_data = (char *) g_slist_nth_data(tokens, 1); res.atr_length = strlen(atr_data); - if( res.atr_length > 256 ) { + if (res.atr_length > 256) { dbg(" Memory overflow handling"); return; } memcpy(res.atr, atr_data, res.atr_length); - switch(sap_status){ - case 0: - res.result = SAP_RESULT_CODE_OK; - break; - case 1: - res.result = SAP_RESULT_CODE_NO_REASON; - break; - case 2: - res.result = SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE; - break; - case 3: - res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF; - break; - case 4: - res.result = SAP_RESULT_CODE_CARD_REMOVED; - break; - case 5: - res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_ON; - break; - case 6: - res.result = SAP_RESULT_CODE_DATA_NOT_AVAILABLE; - break; - case 7: - res.result = SAP_RESULT_CODE_NOT_SUPPORT; - break; - default: - res.result = SAP_RESULT_CODE_NOT_SUPPORT; - break; + switch (sap_status) { + case 0: + res.result = SAP_RESULT_CODE_OK; + break; + + case 1: + res.result = SAP_RESULT_CODE_NO_REASON; + break; + + case 2: + res.result = SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE; + break; + + case 3: + res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF; + break; + + case 4: + res.result = SAP_RESULT_CODE_CARD_REMOVED; + break; + + case 5: + res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_ON; + break; + + case 6: + res.result = SAP_RESULT_CODE_DATA_NOT_AVAILABLE; + break; + + case 7: + res.result = SAP_RESULT_CODE_NOT_SUPPORT; + break; + + default: + res.result = SAP_RESULT_CODE_NOT_SUPPORT; + break; } - }else{ + } else { dbg("RESPONSE NOK"); res.result = SAP_RESULT_CODE_NOT_SUPPORT; } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAP_REQ_ATR, sizeof(struct tresp_sap_req_atr), &res); - } + dbg(" Function exit"); } @@ -381,7 +387,7 @@ static void on_response_transfer_apdu(TcorePending *p, int data_len, const void const TcoreATResponse *resp = data; UserRequest *ur = NULL; struct tresp_sap_transfer_apdu res; - GSList *tokens=NULL; + GSList *tokens = NULL; const char *line; int sap_status = -1; char *apdu_data = NULL; @@ -390,12 +396,11 @@ static void on_response_transfer_apdu(TcorePending *p, int data_len, const void ur = tcore_pending_ref_user_request(p); - if(resp->success > 0) - { + if (resp->success > 0) { dbg("RESPONSE OK"); - if(resp->lines) { - line = (const char*)resp->lines->data; + if (resp->lines) { + line = (const char *)resp->lines->data; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) < 1) { msg("invalid message"); @@ -407,50 +412,58 @@ static void on_response_transfer_apdu(TcorePending *p, int data_len, const void apdu_data = (char *) g_slist_nth_data(tokens, 1); res.resp_apdu_length = strlen(apdu_data); - if( res.resp_apdu_length > 256 ) { + if (res.resp_apdu_length > 256) { dbg(" Memory overflow handling"); return; } memcpy(res.resp_adpdu, apdu_data, res.resp_apdu_length); - switch(sap_status){ - case 0: - res.result = SAP_RESULT_CODE_OK; - break; - case 1: - res.result = SAP_RESULT_CODE_NO_REASON; - break; - case 2: - res.result = SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE; - break; - case 3: - res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF; - break; - case 4: - res.result = SAP_RESULT_CODE_CARD_REMOVED; - break; - case 5: - res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_ON; - break; - case 6: - res.result = SAP_RESULT_CODE_DATA_NOT_AVAILABLE; - break; - case 7: - res.result = SAP_RESULT_CODE_NOT_SUPPORT; - break; - default: - res.result = SAP_RESULT_CODE_NOT_SUPPORT; - break; + switch (sap_status) { + case 0: + res.result = SAP_RESULT_CODE_OK; + break; + + case 1: + res.result = SAP_RESULT_CODE_NO_REASON; + break; + + case 2: + res.result = SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE; + break; + + case 3: + res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF; + break; + + case 4: + res.result = SAP_RESULT_CODE_CARD_REMOVED; + break; + + case 5: + res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_ON; + break; + + case 6: + res.result = SAP_RESULT_CODE_DATA_NOT_AVAILABLE; + break; + + case 7: + res.result = SAP_RESULT_CODE_NOT_SUPPORT; + break; + + default: + res.result = SAP_RESULT_CODE_NOT_SUPPORT; + break; } - }else{ + } else { dbg("RESPONSE NOK"); res.result = SAP_RESULT_CODE_NOT_SUPPORT; } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAP_TRANSFER_APDU, sizeof(struct tresp_sap_transfer_apdu), &res); - } + dbg(" Function exit"); } @@ -459,7 +472,7 @@ static void on_response_get_cardreader_status(TcorePending *p, int data_len, con const TcoreATResponse *resp = data; UserRequest *ur = NULL; struct tresp_sap_req_cardreaderstatus res; - GSList *tokens=NULL; + GSList *tokens = NULL; const char *line; int sap_status = -1; char *card_reader_status = NULL; @@ -468,12 +481,11 @@ static void on_response_get_cardreader_status(TcorePending *p, int data_len, con ur = tcore_pending_ref_user_request(p); - if(resp->success > 0) - { + if (resp->success > 0) { dbg("RESPONSE OK"); - if(resp->lines) { - line = (const char*)resp->lines->data; + if (resp->lines) { + line = (const char *)resp->lines->data; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) < 1) { msg("invalid message"); @@ -482,52 +494,60 @@ static void on_response_get_cardreader_status(TcorePending *p, int data_len, con } } sap_status = atoi(g_slist_nth_data(tokens, 0)); - card_reader_status = (char *) g_slist_nth_data(tokens, 1); + card_reader_status = (char *)g_slist_nth_data(tokens, 1); res.reader_status = *card_reader_status; - switch(sap_status){ - case 0: - res.result = SAP_RESULT_CODE_OK; - break; - case 1: - res.result = SAP_RESULT_CODE_NO_REASON; - break; - case 2: - res.result = SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE; - break; - case 3: - res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF; - break; - case 4: - res.result = SAP_RESULT_CODE_CARD_REMOVED; - break; - case 5: - res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_ON; - break; - case 6: - res.result = SAP_RESULT_CODE_DATA_NOT_AVAILABLE; - break; - case 7: - res.result = SAP_RESULT_CODE_NOT_SUPPORT; - break; - default: - res.result = SAP_RESULT_CODE_NOT_SUPPORT; - break; + switch (sap_status) { + case 0: + res.result = SAP_RESULT_CODE_OK; + break; + + case 1: + res.result = SAP_RESULT_CODE_NO_REASON; + break; + + case 2: + res.result = SAP_RESULT_CODE_CARD_NOT_ACCESSIBLE; + break; + + case 3: + res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_OFF; + break; + + case 4: + res.result = SAP_RESULT_CODE_CARD_REMOVED; + break; + + case 5: + res.result = SAP_RESULT_CODE_CARD_ALREADY_POWER_ON; + break; + + case 6: + res.result = SAP_RESULT_CODE_DATA_NOT_AVAILABLE; + break; + + case 7: + res.result = SAP_RESULT_CODE_NOT_SUPPORT; + break; + + default: + res.result = SAP_RESULT_CODE_NOT_SUPPORT; + break; } - }else{ + } else { dbg("RESPONSE NOK"); res.result = SAP_RESULT_CODE_NOT_SUPPORT; } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAP_REQ_CARDREADERSTATUS, sizeof(struct tresp_sap_req_cardreaderstatus), &res); - } + dbg(" Function exit"); } -static TReturn imc_connect(CoreObject *o, UserRequest *ur) +static TReturn imc_connect(CoreObject *o, UserRequest *ur) { TcoreHal *hal; TcoreATRequest *req; @@ -539,17 +559,27 @@ static TReturn imc_connect(CoreObject *o, UserRequest *ur) dbg(" Function entry"); if (!o || !ur) return TCORE_RETURN_EINVAL; + hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } + req_data = tcore_user_request_ref_data(ur, NULL); - usr_data = (int*)malloc(sizeof(int)); + usr_data = (int *)malloc(sizeof(int)); + if (!usr_data) + return TCORE_RETURN_ENOMEM; + *usr_data = req_data->max_msg_size; - cmd_str = g_strdup_printf("AT+XBCON=0,0,0"); + cmd_str = g_strdup_printf("AT+XBCON=0, 0, 0"); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); + if (req == NULL) { + g_free(cmd_str); + g_free(usr_data); + return TCORE_RETURN_FAILURE; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -560,33 +590,34 @@ static TReturn imc_connect(CoreObject *o, UserRequest *ur) tcore_hal_send_request(hal, pending); - free(cmd_str); + g_free(cmd_str); dbg(" Function exit"); return TCORE_RETURN_SUCCESS; } -static TReturn imc_disconnect(CoreObject *o, UserRequest *ur) +static TReturn imc_disconnect(CoreObject *o, UserRequest *ur) { TcoreHal *hal; TcoreATRequest *req; TcorePending *pending = NULL; char *cmd_str = NULL; - //const struct treq_sap_req_disconnect *req_data; dbg(" Function entry"); if (!o || !ur) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } - //req_data = tcore_user_request_ref_data(ur, NULL); - cmd_str = g_strdup_printf("AT+ XBDISC"); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); + if (req == NULL) { + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -597,7 +628,7 @@ static TReturn imc_disconnect(CoreObject *o, UserRequest *ur) tcore_hal_send_request(hal, pending); - free(cmd_str); + g_free(cmd_str); dbg(" Function exit"); return TCORE_RETURN_SUCCESS; } @@ -608,22 +639,20 @@ static TReturn imc_req_status(CoreObject *o, UserRequest *ur) TcoreATRequest *req; TcorePending *pending = NULL; char *cmd_str = NULL; - //const struct treq_sap_req_status *req_data; dbg(" Function entry"); if (!o || !ur) return TCORE_RETURN_EINVAL; + hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } - //req_data = tcore_user_request_ref_data(ur, NULL); - - //cmd_str = g_strdup_printf("");//ToDo - No AT command present. - req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); + if (req == NULL) + return TCORE_RETURN_FAILURE; dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -645,22 +674,19 @@ static TReturn imc_set_transport_protocol(CoreObject *o, UserRequest *ur) TcoreATRequest *req; TcorePending *pending = NULL; char *cmd_str = NULL; - //const struct treq_sap_set_protocol *req_data; dbg(" Function entry"); if (!o || !ur) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } - //req_data = tcore_user_request_ref_data(ur, NULL); - - //cmd_str = g_strdup_printf("");//ToDo - No AT command present. - req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); + if (req == NULL) + return TCORE_RETURN_FAILURE; dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -676,7 +702,7 @@ static TReturn imc_set_transport_protocol(CoreObject *o, UserRequest *ur) return TCORE_RETURN_SUCCESS; } -static TReturn imc_set_power(CoreObject *o, UserRequest *ur) +static TReturn imc_set_power(CoreObject *o, UserRequest *ur) { TcoreHal *hal; TcoreATRequest *req; @@ -689,26 +715,29 @@ static TReturn imc_set_power(CoreObject *o, UserRequest *ur) if (!o || !ur) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } req_data = tcore_user_request_ref_data(ur, NULL); - if(req_data->mode == SAP_POWER_ON) { + if (req_data->mode == SAP_POWER_ON) action = 0; - } else if ( req_data->mode == SAP_POWER_OFF ) { + else if (req_data->mode == SAP_POWER_OFF) action = 1; - } else if ( req_data->mode == SAP_POWER_RESET ) { + else if (req_data->mode == SAP_POWER_RESET) action = 2; - } else { + else action = -1;; - } cmd_str = g_strdup_printf("AT+ XBPWR=%d", action); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); + if (req == NULL) { + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -719,33 +748,34 @@ static TReturn imc_set_power(CoreObject *o, UserRequest *ur) tcore_hal_send_request(hal, pending); - free(cmd_str); + g_free(cmd_str); dbg(" Function exit"); return TCORE_RETURN_SUCCESS; } -static TReturn imc_get_atr(CoreObject *o, UserRequest *ur) +static TReturn imc_get_atr(CoreObject *o, UserRequest *ur) { TcoreHal *hal; TcoreATRequest *req; TcorePending *pending = NULL; char *cmd_str = NULL; - //const struct treq_sap_req_atr *req_data; dbg(" Function entry"); if (!o || !ur) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } - //req_data = tcore_user_request_ref_data(ur, NULL); - cmd_str = g_strdup_printf("AT+ XBATR"); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); + if (req == NULL) { + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -756,12 +786,12 @@ static TReturn imc_get_atr(CoreObject *o, UserRequest *ur) tcore_hal_send_request(hal, pending); - free(cmd_str); + g_free(cmd_str); dbg(" Function exit"); return TCORE_RETURN_SUCCESS; } -static TReturn imc_transfer_apdu(CoreObject *o, UserRequest *ur) +static TReturn imc_transfer_apdu(CoreObject *o, UserRequest *ur) { TcoreHal *hal; TcoreATRequest *req; @@ -773,16 +803,20 @@ static TReturn imc_transfer_apdu(CoreObject *o, UserRequest *ur) if (!o || !ur) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } req_data = tcore_user_request_ref_data(ur, NULL); - cmd_str = g_strdup_printf("AT+ XBAPDU=\"%s\"", req_data->apdu_data); //ToDo - Need to check passing input as a string. + cmd_str = g_strdup_printf("AT+ XBAPDU=\"%s\"", req_data->apdu_data); /* ToDo - Need to check passing input as a string. */ req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); + if (req == NULL) { + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -793,33 +827,34 @@ static TReturn imc_transfer_apdu(CoreObject *o, UserRequest *ur) tcore_hal_send_request(hal, pending); - free(cmd_str); + g_free(cmd_str); dbg(" Function exit"); return TCORE_RETURN_SUCCESS; } -static TReturn imc_get_cardreader_status(CoreObject *o, UserRequest *ur) +static TReturn imc_get_cardreader_status(CoreObject *o, UserRequest *ur) { TcoreHal *hal; TcoreATRequest *req; TcorePending *pending = NULL; char *cmd_str = NULL; - //const struct treq_sap_req_cardreaderstatus *req_data; dbg(" Function entry"); if (!o || !ur) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } - //req_data = tcore_user_request_ref_data(ur, NULL); - cmd_str = g_strdup_printf("AT+ XBCRDSTAT"); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); + if (req == NULL) { + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -830,13 +865,12 @@ static TReturn imc_get_cardreader_status(CoreObject *o, UserRequest *ur) tcore_hal_send_request(hal, pending); - free(cmd_str); + g_free(cmd_str); dbg(" Function exit"); return TCORE_RETURN_SUCCESS; } -static struct tcore_sap_operations sap_ops = -{ +static struct tcore_sap_operations sap_ops = { .connect = imc_connect, .disconnect = imc_disconnect, .req_status = imc_req_status, @@ -853,9 +887,9 @@ gboolean imc_sap_init(TcorePlugin *cp, CoreObject *co_sap) dbg("Entry"); /* Set operations */ - tcore_sap_set_ops(co_sap, &sap_ops); + tcore_sap_set_ops(co_sap, &sap_ops, TCORE_OPS_TYPE_CP); - tcore_object_add_callback(co_sap,"+XBCSTAT", on_event_sap_status, NULL); + tcore_object_add_callback(co_sap, "+XBCSTAT", on_event_sap_status, NULL); dbg("Exit"); diff --git a/src/imc_sat.c b/src/imc_sat.c index 9c29dec..163f0fc 100644 --- a/src/imc_sat.c +++ b/src/imc_sat.c @@ -37,7 +37,7 @@ #define ENVELOPE_CMD_LEN 256 static TReturn imc_terminal_response(CoreObject *o, UserRequest *ur); -static void on_confirmation_sat_message_send(TcorePending *p, gboolean result, void *user_data); // from Kernel +static void on_confirmation_sat_message_send(TcorePending *p, gboolean result, void *user_data); /* from Kernel */ static void on_confirmation_sat_message_send(TcorePending *p, gboolean result, void *user_data) { @@ -86,11 +86,16 @@ static gboolean on_event_sat_proactive_command(CoreObject *o, const void *event_ hexData = (char *)g_slist_nth_data(tokens, 0); dbg("SAT data: [%s] SAT data length: [%d]", hexData, strlen(hexData)); - tmp = util_removeQuotes(hexData); + tmp = tcore_at_tok_extract(hexData); recordData = util_hexStringToBytes(tmp); + if (!recordData) { + err("util_hexStringToBytes Failed!!"); + tcore_at_tok_free(tokens); + return FALSE; + } dbg("recordData: %x", recordData); g_free(tmp); - util_hex_dump(" ", strlen(hexData) / 2, recordData); + tcore_util_hex_dump(" ", strlen(hexData) / 2, recordData); len_proactive_cmd = strlen(recordData); dbg("len_proactive_cmd = %d", len_proactive_cmd); tcore_sat_decode_proactive_command((unsigned char *) recordData, (strlen(hexData) / 2) - 1, &decoded_data); @@ -168,7 +173,6 @@ static gboolean on_event_sat_proactive_command(CoreObject *o, const void *event_ case SAT_PROATV_CMD_SETUP_EVENT_LIST: dbg("decoded command is setup event list!!"); memcpy(&proactive_noti.proactive_ind_data.setup_event_list, &decoded_data.data.setup_event_list, sizeof(struct tel_sat_setup_event_list_tlv)); - // setup_event_rsp_get(o, &decoded_data.data.setup_event_list); break; case SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT: @@ -241,7 +245,6 @@ static void on_response_envelop_cmd(TcorePending *p, int data_len, const void *d GSList *tokens = NULL; struct tresp_sat_envelop_data res; const char *line = NULL; - //const char *env_res = NULL; int sw2 = -1; ur = tcore_pending_ref_user_request(p); @@ -267,7 +270,6 @@ static void on_response_envelop_cmd(TcorePending *p, int data_len, const void *d return; } } - //env_res = g_slist_nth_data(tokens, 0); res.result = 0x8000; res.envelop_resp = ENVELOPE_SUCCESS; dbg("RESPONSE OK 3"); @@ -285,9 +287,9 @@ static void on_response_envelop_cmd(TcorePending *p, int data_len, const void *d res.envelop_resp = ENVELOPE_FAILED; } - if (ur) { + if (ur) tcore_user_request_send_response(ur, TRESP_SAT_REQ_ENVELOPE, sizeof(struct tresp_sat_envelop_data), &res); - } + tcore_at_tok_free(tokens); dbg(" Function exit"); } @@ -338,7 +340,7 @@ static TReturn imc_envelope(CoreObject *o, UserRequest *ur) pbuffer = envelope_cmdhex; hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -350,17 +352,23 @@ static TReturn imc_envelope(CoreObject *o, UserRequest *ur) envelope_cmd_len = tcore_sat_encode_envelop_cmd(req_data, (char *) envelope_cmd); dbg("envelope_cmd_len %d", envelope_cmd_len); - if (envelope_cmd_len == 0) { + if (envelope_cmd_len == 0) return TCORE_RETURN_EINVAL; - } + for (count = 0; count < envelope_cmd_len; count++) { dbg("envelope_cmd %02x", (unsigned char)envelope_cmd[count]); - sprintf(pbuffer, "%02x", (unsigned char)envelope_cmd[count]); + snprintf(pbuffer, 256, "%02x", (unsigned char)envelope_cmd[count]); pbuffer += 2; } dbg("pbuffer %s", envelope_cmdhex); cmd_str = g_strdup_printf("AT+SATE=\"%s\"", envelope_cmdhex); req = tcore_at_request_new(cmd_str, "+SATE:", TCORE_AT_SINGLELINE); + if (req == NULL) { + g_free(cmd_str); + tcore_pending_free(pending); + return TCORE_RETURN_FAILURE; + } + dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); @@ -390,7 +398,7 @@ static TReturn imc_terminal_response(CoreObject *o, UserRequest *ur) dbg("Function Entry"); memset(&proactive_resphex, 0x00, sizeof(proactive_resphex)); hal = tcore_object_get_hal(o); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -406,6 +414,10 @@ static TReturn imc_terminal_response(CoreObject *o, UserRequest *ur) return TCORE_RETURN_EINVAL; } hexString = calloc((proactive_resp_len * 2) + 1, 1); + if (hexString == NULL) { + tcore_pending_free(pending); + return TCORE_RETURN_FAILURE; + } for (i = 0; i < proactive_resp_len * 2; i += 2) { char value = 0; @@ -426,6 +438,13 @@ static TReturn imc_terminal_response(CoreObject *o, UserRequest *ur) cmd_str = g_strdup_printf("AT+SATR=\"%s\"", hexString); req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + g_free(cmd_str); + g_free(hexString); + tcore_pending_free(pending); + return TCORE_RETURN_FAILURE; + } + dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); @@ -450,7 +469,7 @@ gboolean imc_sat_init(TcorePlugin *cp, CoreObject *co_sat) dbg("Entry"); /* Set operations */ - tcore_sat_set_ops(co_sat, &sat_ops); + tcore_sat_set_ops(co_sat, &sat_ops, TCORE_OPS_TYPE_CP); tcore_object_add_callback(co_sat, "+SATI", on_event_sat_proactive_command, NULL); tcore_object_add_callback(co_sat, "+SATN", on_event_sat_proactive_command, NULL); diff --git a/src/imc_sim.c b/src/imc_sim.c old mode 100755 new mode 100644 index 6060fa9..b057b9e --- a/src/imc_sim.c +++ b/src/imc_sim.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "imc_common.h" #include "imc_sms.h" @@ -42,6 +43,9 @@ #define SIM_PIN_MAX_RETRY_COUNT 3 #define SMS_STATE_READY 1 +#define SIM_SSM_GROUP_ID "secure-storage::telephony_sim" +#define SIM_SSM_FILE_IMSI1 "imsi1" + #define SWAPBYTES16(x) \ { \ unsigned short int data = *(unsigned short int *)&(x); \ @@ -50,14 +54,6 @@ *(unsigned short int *)&(x) = data; \ } -enum imc_sim_file_type_e { - SIM_FTYPE_DEDICATED = 0x00, /**< Dedicated */ - SIM_FTYPE_TRANSPARENT = 0x01, /**< Transparent -binary type*/ - SIM_FTYPE_LINEAR_FIXED = 0x02, /**< Linear fixed - record type*/ - SIM_FTYPE_CYCLIC = 0x04, /**< Cyclic - record type*/ - SIM_FTYPE_INVALID_TYPE = 0xFF /**< Invalid type */ -}; - enum imc_sim_sec_op_e { SEC_PIN1_VERIFY, SEC_PIN2_VERIFY, @@ -70,7 +66,7 @@ enum imc_sim_sec_op_e { SEC_PIN1_ENABLE, SEC_PIN1_DISABLE, SEC_PIN2_ENABLE, - SEC_PIN2_DISABLE, // 10 + SEC_PIN2_DISABLE, /* 10 */ SEC_SIM_ENABLE, SEC_SIM_DISABLE, SEC_NET_ENABLE, @@ -80,7 +76,7 @@ enum imc_sim_sec_op_e { SEC_SP_ENABLE, SEC_SP_DISABLE, SEC_CP_ENABLE, - SEC_CP_DISABLE, // 20 + SEC_CP_DISABLE, /* 20 */ SEC_FDN_ENABLE, SEC_FDN_DISABLE, SEC_PIN1_STATUS, @@ -97,7 +93,7 @@ enum imc_sim_sec_op_e { struct imc_sim_property { gboolean b_valid; /**< Valid or not */ enum tel_sim_file_id file_id; /**< File identifier */ - enum imc_sim_file_type_e file_type; /**< File type and structure */ + enum tcore_sim_file_type_e file_type; /**< File type and structure */ int rec_length; /**< Length of one record in file */ int rec_count; /**< Number of records in file */ int data_size; /**< File size */ @@ -105,12 +101,11 @@ struct imc_sim_property { enum imc_sim_sec_op_e current_sec_op; /**< current index to read */ int mb_count; /**< Number of MB records in file */ struct tel_sim_mbi_list mbi_list; -// struct tel_sim_mb_number mb_list[SIM_MSP_CNT_MAX*5]; struct tel_sim_mailbox mb_data; struct tresp_sim_read files; }; -void on_response_update_file (TcorePending *p, int data_len, const void *data, void *user_data); +void on_response_update_file(TcorePending *p, int data_len, const void *data, void *user_data); static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_sim_file_id ef, enum tel_sim_access_result rt); static void _next_from_get_file_data(CoreObject *o, UserRequest *ur, enum tel_sim_access_result rt, int decode_ret); static gboolean _get_sim_type(CoreObject *o); @@ -132,15 +127,21 @@ static void sim_prepare_and_send_pending_request(CoreObject *co, const char *at_ dbg("hal: %p", hal); pending = tcore_pending_new(co, 0); - if (!pending) + if (!pending) { dbg("Pending is NULL"); + return; + } req = tcore_at_request_new(at_cmd, prefix, at_cmd_type); + if (req == NULL) { + tcore_pending_free(pending); + return; + } dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); tcore_pending_set_request_data(pending, 0, req); tcore_pending_set_response_callback(pending, callback, NULL); - tcore_pending_link_user_request(pending, NULL); // set user request to NULL - this is internal request + tcore_pending_link_user_request(pending, NULL); /* set user request to NULL - this is internal request */ ret = tcore_hal_send_request(hal, pending); if (ret != TCORE_RETURN_SUCCESS) { err("error: [0x%x]", ret); @@ -436,10 +437,10 @@ static enum tel_sim_access_result _decode_status_word(unsigned short status_word rst = SIM_ACCESS_FAILED; dbg("error -Incorrect parameters [%x][%x]", status_word1, status_word2); } else if (status_word1 == 0x6A && status_word2 == 0x82) { - rst = SIM_ACCESS_FILE_NOT_FOUND; // not sure of the SW1 and SW2 meaning here + rst = SIM_ACCESS_FILE_NOT_FOUND; /* not sure of the SW1 and SW2 meaning here */ dbg("error -File Not found [%x][%x]", status_word1, status_word2); } else if (status_word1 == 0x6A && status_word2 == 0x83) { - rst = SIM_ACCESS_FILE_NOT_FOUND; // not sure of the SW1 and SW2 meaning here + rst = SIM_ACCESS_FILE_NOT_FOUND; /* not sure of the SW1 and SW2 meaning here */ dbg("error -Record Not found [%x][%x]", status_word1, status_word2); } else { rst = SIM_ACCESS_CARD_ERROR; @@ -449,49 +450,42 @@ static enum tel_sim_access_result _decode_status_word(unsigned short status_word } #if 0 -static gboolean _sim_check_identity(CoreObject *o, struct tel_sim_imsi *imsi) +static gboolean _sim_check_identity(CoreObject *co_sim, struct tel_sim_imsi *imsi) { - Server *s = NULL; - Storage *strg = NULL; - char *old_imsi = NULL; - char new_imsi[15 + 1] = {0, }; - - s = tcore_plugin_ref_server(tcore_object_ref_plugin(o)); - if (!s) { - dbg("there is no valid server at this point"); + gboolean is_changed = TRUE; + char new_imsi[16 + 1]; /* IMSI is 15 digit, but for distingushing between plmn and msin, define as 16 bytes. */ + char *imsi_buf = NULL; + int ret_val = 0; + + dbg("Entry"); + if (NULL == imsi) { + err("imsi is NULL"); return FALSE; } - strg = (Storage *)tcore_server_find_storage(s, "vconf"); - if (!strg) { - dbg("there is no valid storage plugin"); - return FALSE; + + memset(new_imsi, 0x5F, 16); + memcpy(new_imsi, imsi->plmn, strlen(imsi->plmn)); + memcpy(&new_imsi[6], imsi->msin, strlen(imsi->msin)); + new_imsi[6 + strlen(imsi->msin)] = '\0'; + + ret_val = ssa_get(SIM_SSM_FILE_IMSI1, &imsi_buf, SIM_SSM_GROUP_ID, NULL); + if (ret_val >= 0 && imsi_buf != NULL) { + if (strncmp(imsi_buf, new_imsi, 16) == 0) + is_changed = FALSE; + free(imsi_buf); } - memcpy(&new_imsi, imsi->plmn, strlen(imsi->plmn)); - memcpy(&new_imsi[strlen(imsi->plmn)], imsi->msin, strlen(imsi->msin)); - new_imsi[strlen(imsi->plmn) + strlen(imsi->msin)] = '\0'; - - old_imsi = tcore_storage_get_string(strg, STORAGE_KEY_TELEPHONY_IMSI); - dbg("old_imsi[%s],newImsi[%s]", old_imsi, new_imsi); - - if (old_imsi != NULL) { - if (strncmp(old_imsi, new_imsi, 15) != 0) { - dbg("NEW SIM"); - if (tcore_storage_set_string(strg, STORAGE_KEY_TELEPHONY_IMSI, (const char *)&new_imsi) == FALSE) { - dbg("[FAIL] UPDATE STORAGE_KEY_TELEPHONY_IMSI"); - } - tcore_sim_set_identification(o, TRUE); - } else { - dbg("SAME SIM"); - tcore_sim_set_identification(o, FALSE); - } - } else { - dbg("OLD SIM VALUE IS NULL. NEW SIM"); - if (tcore_storage_set_string(strg, STORAGE_KEY_TELEPHONY_IMSI, (const char *)&new_imsi) == FALSE) { - dbg("[FAIL] UPDATE STORAGE_KEY_TELEPHONY_IMSI"); - } - tcore_sim_set_identification(o, TRUE); + + if (is_changed) { + dbg("NEW SIM"); + /* Update file */ + ret_val = ssa_put(SIM_SSM_FILE_IMSI1, new_imsi, strlen(new_imsi) + 1, SIM_SSM_GROUP_ID, NULL); + if (ret_val < 0) + err("ssa_put failed. ret_val=[%d]", ret_val); } - return 1; + + /* Update sim identification */ + tcore_sim_set_identification(co_sim, is_changed); + return TRUE; } #endif @@ -512,42 +506,51 @@ static TReturn __sim_update_file(CoreObject *o, UserRequest *ur, enum tel_sim_fi hal = tcore_object_get_hal(o); pending = tcore_pending_new(o, 0); - + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } meta_info = (struct imc_sim_property *)tcore_user_request_ref_metainfo(ur, NULL); meta_info->file_id = ef; dbg("File ID: [0x%x]", meta_info->file_id); - switch (ef) - { - case SIM_EF_CPHS_CALL_FORWARD_FLAGS: - case SIM_EF_ELP: - case SIM_EF_LP: - case SIM_EF_CPHS_VOICE_MSG_WAITING: - p1 = 0; - p2 = 0; - p3 = encoded_len; - cmd = 214; - break; + switch (ef) { + case SIM_EF_CPHS_CALL_FORWARD_FLAGS: + case SIM_EF_ELP: + case SIM_EF_LP: + case SIM_EF_CPHS_VOICE_MSG_WAITING: + p1 = 0; + p2 = 0; + p3 = encoded_len; + cmd = 214; + break; - case SIM_EF_USIM_CFIS: - case SIM_EF_USIM_MWIS: - case SIM_EF_CPHS_MAILBOX_NUMBERS: - case SIM_EF_MBDN: - case SIM_EF_USIM_MBI: - p1 = rec_index; - p2 = 0x04; - p3 = encoded_len; - cmd = 220; - break; - default: - err("Unhandled File ID[0x%04x]", ef); - return TCORE_RETURN_EINVAL; + case SIM_EF_USIM_CFIS: + case SIM_EF_USIM_MWIS: + case SIM_EF_CPHS_MAILBOX_NUMBERS: + case SIM_EF_MBDN: + case SIM_EF_USIM_MBI: + p1 = rec_index; + p2 = 0x04; + p3 = encoded_len; + cmd = 220; + break; + + default: + err("Unhandled File ID[0x%04x]", ef); + tcore_pending_free(pending); + return TCORE_RETURN_EINVAL; } - cmd_str = g_strdup_printf("AT+CRSM=%d,%d,%d,%d,%d,\"%s\"", cmd, ef, p1, p2, p3, encoded_data); + cmd_str = g_strdup_printf("AT+CRSM=%d, %d, %d, %d, %d, \"%s\"", cmd, ef, p1, p2, p3, encoded_data); req = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -583,189 +586,196 @@ static TReturn __set_file_data(CoreObject *o, UserRequest *ur, const enum tel_si meta_info = (struct imc_sim_property *)tcore_user_request_ref_metainfo(ur, NULL); switch (command) { + case TREQ_SIM_SET_LANGUAGE: { + const struct treq_sim_set_language *lang = NULL; + struct tel_sim_language language = {0, }; + + lang = tcore_user_request_ref_data(ur, NULL); + language.language_count = 1; + language.language[0] = lang->language; + if (tcore_sim_get_type(o) == SIM_TYPE_GSM && ef == SIM_EF_LP) { + dbg("Encoding EF-LP, language[%d]", lang->language); + tmp = tcore_sim_encode_lp(&encoded_len, &language); + } else { + dbg("Encoding EF-ELP, language[%d]", lang->language); + tmp = tcore_sim_encode_li(&encoded_len, &language); + } + } + break; - case TREQ_SIM_SET_LANGUAGE: - { - const struct treq_sim_set_language *lang = NULL; - struct tel_sim_language language = {0,}; - - lang = tcore_user_request_ref_data(ur, NULL); - language.language_count = 1; - language.language[0] = lang->language; - if (tcore_sim_get_type(o) == SIM_TYPE_GSM && ef == SIM_EF_LP){ - dbg("Encoding EF-LP, language[%d]", lang->language); - tmp = tcore_sim_encode_lp(&encoded_len, &language); + case TREQ_SIM_SET_CALLFORWARDING: { + const struct treq_sim_set_callforwarding *cf = NULL; + + cf = tcore_user_request_ref_data(ur, NULL); + if (ef == SIM_EF_CPHS_CALL_FORWARD_FLAGS) { + if (cf->b_cphs) { + tmp = tcore_sim_encode_cff((const struct tel_sim_cphs_cf *)&cf->cphs_cf, meta_info->data_size); } else { - dbg("Encoding EF-ELP, language[%d]", lang->language); - tmp = tcore_sim_encode_li(&encoded_len, &language); - } - } - break; + /* Convert 3GPP data to CPHS data */ + struct tel_sim_cphs_cf cphs_cf; - case TREQ_SIM_SET_CALLFORWARDING: - { - const struct treq_sim_set_callforwarding *cf = NULL; + dbg("Convert 3GPP data to CPHS data"); + memset(&cphs_cf, 0x00, sizeof(struct tel_sim_cphs_cf)); + if (cf->cf.cfu_status & 0x01) + cphs_cf.b_line1 = TRUE; - cf = tcore_user_request_ref_data(ur, NULL); - if(ef == SIM_EF_CPHS_CALL_FORWARD_FLAGS ) { - if (cf->b_cphs) { - tmp = tcore_sim_encode_cff((const struct tel_sim_cphs_cf*)&cf->cphs_cf, meta_info->data_size); - } else { - /* Convert 3GPP data to CPHS data */ - struct tel_sim_cphs_cf cphs_cf; + if (cf->cf.cfu_status & 0x02) + cphs_cf.b_fax = TRUE; - dbg("Convert 3GPP data to CPHS data"); - memset(&cphs_cf, 0x00, sizeof(struct tel_sim_cphs_cf)); - if (cf->cf.cfu_status & 0x01) { - cphs_cf.b_line1 = TRUE; - } - if (cf->cf.cfu_status & 0x02) { - cphs_cf.b_fax = TRUE; - } - if (cf->cf.cfu_status & 0x04) { - cphs_cf.b_data = TRUE; - } - tmp = tcore_sim_encode_cff((const struct tel_sim_cphs_cf*)&cphs_cf, meta_info->data_size); - } - if (tmp) { - encoded_len = strlen(tmp); - } else { - err("NULL Encoding Data[%p].. No Updating EF", tmp); - goto EXIT; - } - } else if (ef == SIM_EF_USIM_CFIS){ - tmp = tcore_sim_encode_cfis(&encoded_len, (const struct tel_sim_cfis*)&cf->cf); - rec_index = cf->cf.rec_index; + if (cf->cf.cfu_status & 0x04) + cphs_cf.b_data = TRUE; + + tmp = tcore_sim_encode_cff((const struct tel_sim_cphs_cf *)&cphs_cf, meta_info->data_size); + } + + if (tmp) { + encoded_len = strlen(tmp); } else { - err("Invalid File ID[0x%04x]", ef); + err("NULL Encoding Data[%p].. No Updating EF", tmp); goto EXIT; } + } else if (ef == SIM_EF_USIM_CFIS) { + tmp = tcore_sim_encode_cfis(&encoded_len, (const struct tel_sim_cfis *)&cf->cf); + rec_index = cf->cf.rec_index; + } else { + err("Invalid File ID[0x%04x]", ef); + goto EXIT; } - break; + } + break; - case TREQ_SIM_SET_MESSAGEWAITING: - { - const struct treq_sim_set_messagewaiting *mw = NULL; + case TREQ_SIM_SET_MESSAGEWAITING: { + const struct treq_sim_set_messagewaiting *mw = NULL; - mw = tcore_user_request_ref_data(ur, NULL); - if(ef == SIM_EF_CPHS_VOICE_MSG_WAITING ) { - if (mw->b_cphs) { - tmp = tcore_sim_encode_vmwf(&encoded_len, (const struct tel_sim_cphs_mw*)&mw->cphs_mw, meta_info->data_size); - } else { - /* Convert 3GPP data to CPHS data */ - struct tel_sim_cphs_mw cphs_mw; + mw = tcore_user_request_ref_data(ur, NULL); + if (ef == SIM_EF_CPHS_VOICE_MSG_WAITING) { + if (mw->b_cphs) { + tmp = tcore_sim_encode_vmwf(&encoded_len, (const struct tel_sim_cphs_mw *)&mw->cphs_mw, meta_info->data_size); + } else { + /* Convert 3GPP data to CPHS data */ + struct tel_sim_cphs_mw cphs_mw; + + dbg("Convert 3GPP data to CPHS data"); + memset(&cphs_mw, 0x00, sizeof(struct tel_sim_cphs_mw)); + + if (mw->mw.indicator_status & 0x01) + cphs_mw.b_voice1 = TRUE; + + if (mw->mw.indicator_status & 0x02) + cphs_mw.b_fax = TRUE; - dbg("Convert 3GPP data to CPHS data"); - memset(&cphs_mw, 0x00, sizeof(struct tel_sim_cphs_mw)); + if (mw->mw.indicator_status & 0x04) + cphs_mw.b_data = TRUE; - if (mw->mw.indicator_status & 0x01) { - cphs_mw.b_voice1 = TRUE; + tmp = tcore_sim_encode_vmwf(&encoded_len, (const struct tel_sim_cphs_mw *)&cphs_mw, meta_info->data_size); + } + } else if (ef == SIM_EF_USIM_MWIS) { + tmp = tcore_sim_encode_mwis(&encoded_len, (const struct tel_sim_mw *)&mw->mw, meta_info->rec_length); + rec_index = mw->mw.rec_index; + if (tmp) + encoded_len = meta_info->rec_length; + } else { + err("Invalid File ID[0x%04x]", ef); + goto EXIT; + } + } + break; + + case TREQ_SIM_SET_MAILBOX: { + const struct treq_sim_set_mailbox *mb = NULL; + + mb = tcore_user_request_ref_data(ur, NULL); + if (ef == SIM_EF_USIM_MBI) { + gboolean mbi_changed = FALSE; + struct tel_sim_mbi mbi; + + do { + meta_info->current_index++; + memcpy(&mbi, &meta_info->mbi_list.mbi[meta_info->current_index - 1], sizeof(struct tel_sim_mbi)); + + switch (mb->mb_info.mb_type) { + case SIM_MAILBOX_VOICE: + if (mbi.voice_index != mb->mb_info.rec_index) { + mbi_changed = TRUE; + mbi.voice_index = mb->mb_info.rec_index; } - if (mw->mw.indicator_status & 0x02) { - cphs_mw.b_fax = TRUE; + break; + + case SIM_MAILBOX_FAX: + if (mbi.fax_index != mb->mb_info.rec_index) { + mbi_changed = TRUE; + mbi.fax_index = mb->mb_info.rec_index; } - if (mw->mw.indicator_status & 0x04) { - cphs_mw.b_data = TRUE; + break; + + case SIM_MAILBOX_EMAIL: + if (mbi.email_index != mb->mb_info.rec_index) { + mbi_changed = TRUE; + mbi.email_index = mb->mb_info.rec_index; } - tmp = tcore_sim_encode_vmwf(&encoded_len, (const struct tel_sim_cphs_mw*)&cphs_mw, meta_info->data_size); - } - } else if (ef == SIM_EF_USIM_MWIS){ - tmp = tcore_sim_encode_mwis(&encoded_len, (const struct tel_sim_mw*)&mw->mw, meta_info->rec_length); - rec_index = mw->mw.rec_index; - if (tmp) - encoded_len = meta_info->rec_length; - } else { - err("Invalid File ID[0x%04x]", ef); - goto EXIT; - } - } - break; + break; - case TREQ_SIM_SET_MAILBOX: - { - const struct treq_sim_set_mailbox *mb = NULL; - - mb = tcore_user_request_ref_data(ur, NULL); - if (ef == SIM_EF_USIM_MBI){ - gboolean mbi_changed = FALSE; - struct tel_sim_mbi mbi; - - do { - meta_info->current_index++; - memcpy(&mbi, &meta_info->mbi_list.mbi[meta_info->current_index - 1], sizeof(struct tel_sim_mbi)); - - switch(mb->mb_info.mb_type) { - case SIM_MAILBOX_VOICE: - if (mbi.voice_index != mb->mb_info.rec_index) { - mbi_changed = TRUE; - mbi.voice_index = mb->mb_info.rec_index; - } - break; - case SIM_MAILBOX_FAX: - if (mbi.fax_index != mb->mb_info.rec_index) { - mbi_changed = TRUE; - mbi.fax_index = mb->mb_info.rec_index; - } - break; - case SIM_MAILBOX_EMAIL: - if (mbi.email_index != mb->mb_info.rec_index) { - mbi_changed = TRUE; - mbi.email_index = mb->mb_info.rec_index; - } - break; - case SIM_MAILBOX_OTHER: - if (mbi.other_index != mb->mb_info.rec_index) { - mbi_changed = TRUE; - mbi.other_index = mb->mb_info.rec_index; - } - break; - case SIM_MAILBOX_VIDEO: - if (mbi.video_index != mb->mb_info.rec_index) { - mbi_changed = TRUE; - mbi.video_index = mb->mb_info.rec_index; - } - break; - case SIM_MAILBOX_DATA: - default: - break; + case SIM_MAILBOX_OTHER: + if (mbi.other_index != mb->mb_info.rec_index) { + mbi_changed = TRUE; + mbi.other_index = mb->mb_info.rec_index; } + break; - dbg("mbi_changed[%d], profile_count[%d], index (voice[%d], fax[%d], email[%d], other[%d], video[%d])", - mbi_changed, meta_info->mbi_list.profile_count, - mbi.voice_index, mbi.fax_index, mbi.email_index, mbi.other_index, mbi.video_index); - } while (mbi_changed == FALSE && meta_info->current_index < meta_info->mbi_list.profile_count); + case SIM_MAILBOX_VIDEO: + if (mbi.video_index != mb->mb_info.rec_index) { + mbi_changed = TRUE; + mbi.video_index = mb->mb_info.rec_index; + } + break; - if (mbi_changed == TRUE) { - rec_index = meta_info->current_index; - tmp = tcore_sim_encode_mbi(&mbi, meta_info->rec_length); - if (tmp) - encoded_len = meta_info->rec_length; + case SIM_MAILBOX_DATA: + default: + break; } - } else if (ef == SIM_EF_CPHS_MAILBOX_NUMBERS) { - tmp = tcore_sim_encode_xdn(meta_info->rec_length, (struct tel_sim_dialing_number*)&mb->mb_info.number_info); - rec_index = mb->mb_info.rec_index; - if (tmp) - encoded_len = meta_info->rec_length; - } else if (ef == SIM_EF_MBDN){ - tmp = tcore_sim_encode_xdn(meta_info->rec_length, (struct tel_sim_dialing_number*)&mb->mb_info.number_info); - rec_index = mb->mb_info.rec_index; + + dbg("mbi_changed[%d], profile_count[%d], index (voice[%d], fax[%d], email[%d], other[%d], video[%d])", + mbi_changed, meta_info->mbi_list.profile_count, + mbi.voice_index, mbi.fax_index, mbi.email_index, mbi.other_index, mbi.video_index); + } while (mbi_changed == FALSE && meta_info->current_index < meta_info->mbi_list.profile_count); + + if (mbi_changed == TRUE) { + rec_index = meta_info->current_index; + tmp = tcore_sim_encode_mbi(&mbi, meta_info->rec_length); if (tmp) encoded_len = meta_info->rec_length; - } else { - err("Invalid File ID[0x%04x]", ef); - goto EXIT; } + } else if (ef == SIM_EF_CPHS_MAILBOX_NUMBERS) { + tmp = tcore_sim_encode_xdn(meta_info->rec_length, (struct tel_sim_dialing_number *)&mb->mb_info.number_info); + rec_index = mb->mb_info.rec_index; + if (tmp) + encoded_len = meta_info->rec_length; + } else if (ef == SIM_EF_MBDN) { + tmp = tcore_sim_encode_xdn(meta_info->rec_length, (struct tel_sim_dialing_number *)&mb->mb_info.number_info); + rec_index = mb->mb_info.rec_index; + if (tmp) + encoded_len = meta_info->rec_length; + } else { + err("Invalid File ID[0x%04x]", ef); + goto EXIT; } - break; + } + break; - default: - err("Unhandled update REQUEST command[%d]", command); - ret_code = TCORE_RETURN_EINVAL; - goto EXIT; + default: + err("Unhandled update REQUEST command[%d]", command); + ret_code = TCORE_RETURN_EINVAL; + goto EXIT; } - if(tmp) { + if (tmp) { encoded_data = (char *) g_malloc0(2 * (encoded_len) + 1); + if (encoded_data == NULL) { + err("Memory allocation failed!!"); + free(tmp); + return ret_code; + } + memset(encoded_data, 0x00, (2 * encoded_len) + 1); util_byte_to_hex(tmp, encoded_data, encoded_len); free(tmp); @@ -777,38 +787,40 @@ static TReturn __set_file_data(CoreObject *o, UserRequest *ur, const enum tel_si dbg("Encoded Data length =[%d]", encoded_len); tcore_util_hex_dump("[Encoded Data] ", encoded_len, encoded_data); - switch (ef) - { - case SIM_EF_CPHS_CALL_FORWARD_FLAGS: - case SIM_EF_ELP: - case SIM_EF_LP: - case SIM_EF_CPHS_VOICE_MSG_WAITING: - ret_code = __sim_update_file(o, ur, ef, encoded_data, encoded_len, 0); - break; + switch (ef) { + case SIM_EF_CPHS_CALL_FORWARD_FLAGS: + case SIM_EF_ELP: + case SIM_EF_LP: + case SIM_EF_CPHS_VOICE_MSG_WAITING: + ret_code = __sim_update_file(o, ur, ef, encoded_data, encoded_len, 0); + break; - case SIM_EF_USIM_CFIS: - case SIM_EF_USIM_MWIS: - case SIM_EF_CPHS_MAILBOX_NUMBERS: - case SIM_EF_MBDN: + case SIM_EF_USIM_CFIS: + case SIM_EF_USIM_MWIS: + case SIM_EF_CPHS_MAILBOX_NUMBERS: + case SIM_EF_MBDN: + ret_code = __sim_update_file(o, ur, ef, encoded_data, encoded_len, rec_index); + break; + + case SIM_EF_USIM_MBI: + if (rec_index > 0) ret_code = __sim_update_file(o, ur, ef, encoded_data, encoded_len, rec_index); - break; - case SIM_EF_USIM_MBI: - if (rec_index > 0) { - ret_code = __sim_update_file(o, ur, ef, encoded_data, encoded_len, rec_index); - } else { - memset(meta_info, 0x00, sizeof(struct imc_sim_property)); - } - break; - default: - err("Unhandled File ID[0x%04x]", ef); - ret_code = TCORE_RETURN_EINVAL; - break; + else + memset(meta_info, 0x00, sizeof(struct imc_sim_property)); + break; + + default: + err("Unhandled File ID[0x%04x]", ef); + ret_code = TCORE_RETURN_EINVAL; + break; } + EXIT: - if(encoded_data) { + if (encoded_data) { free(encoded_data); encoded_data = NULL; } + return ret_code; } @@ -837,11 +849,10 @@ static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_si case SIM_EF_ELP: if (rt == SIM_ACCESS_SUCCESS) { dbg("[SIM DATA] exist EFELP/PL(0x2F05)"); - if (command == TREQ_SIM_SET_LANGUAGE) { + if (command == TREQ_SIM_SET_LANGUAGE) __set_file_data(o, ur, ef); - } else { + else _get_file_data(o, ur, ef, 0, meta_info->data_size); - } } else { if (sim_type == SIM_TYPE_GSM) { dbg("[SIM DATA]SIM_EF_ELP(2F05) access fail. Request SIM_EF_LP(0x6F05) info"); @@ -849,30 +860,29 @@ static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_si _get_file_info(o, ur, SIM_EF_LP); } else if (sim_type == SIM_TYPE_USIM) { dbg( - " [SIM DATA]fail to get Language information in USIM(EF-LI(6F05),EF-PL(2F05)). Request SIM_EF_ECC(0x6FB7) info"); + " [SIM DATA]fail to get Language information in USIM(EF-LI(6F05), EF-PL(2F05)). Request SIM_EF_ECC(0x6FB7) info"); /* EFELPand EFLI not present at this point. */ /* po->language.lang_cnt = 0;*/ tcore_user_request_send_response(ur, _find_resp_command(ur), - sizeof(struct tresp_sim_read), &resp); + sizeof(struct tresp_sim_read), &resp); return; } } break; - case SIM_EF_LP: // same with SIM_EF_USIM_LI + case SIM_EF_LP: /* same with SIM_EF_USIM_LI */ if (rt == SIM_ACCESS_SUCCESS) { dbg("[SIM DATA] exist EFLP/LI(0x6F05)"); - if (command == TREQ_SIM_SET_LANGUAGE) { + if (command == TREQ_SIM_SET_LANGUAGE) __set_file_data(o, ur, ef); - } else { + else _get_file_data(o, ur, ef, 0, meta_info->data_size); - } } else { dbg("[SIM DATA]SIM_EF_LP/LI(6F05) access fail. Current CardType[%d]", sim_type); if (sim_type == SIM_TYPE_GSM) { tcore_user_request_send_response(ur, _find_resp_command(ur), - sizeof(struct tresp_sim_read), &resp); + sizeof(struct tresp_sim_read), &resp); return; } /* if EFLI is not present, then the language selection shall be as defined in EFPL at the MF level */ @@ -886,11 +896,10 @@ static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_si case SIM_EF_USIM_PL: if (rt == SIM_ACCESS_SUCCESS) { dbg("[SIM DATA] exist EFELP/PL(0x2F05)"); - if (command == TREQ_SIM_SET_LANGUAGE) { + if (command == TREQ_SIM_SET_LANGUAGE) __set_file_data(o, ur, ef); - } else { + else _get_file_data(o, ur, SIM_EF_ELP, 0, meta_info->data_size); - } } else { /* EFELIand EFPL not present, so set language count as zero and select ECC */ dbg(" [SIM DATA]SIM_EF_USIM_PL(2A05) access fail. Request SIM_EF_ECC(0x6FB7) info"); @@ -904,9 +913,8 @@ static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_si if (sim_type == SIM_TYPE_GSM) { _get_file_data(o, ur, ef, 0, meta_info->data_size); } else if (sim_type == SIM_TYPE_USIM) { - if (meta_info->rec_count > SIM_ECC_RECORD_CNT_MAX) { + if (meta_info->rec_count > SIM_ECC_RECORD_CNT_MAX) meta_info->rec_count = SIM_ECC_RECORD_CNT_MAX; - } meta_info->current_index++; _get_file_record(o, ur, ef, meta_info->current_index, meta_info->rec_length); @@ -930,11 +938,11 @@ static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_si break; case SIM_EF_CPHS_CALL_FORWARD_FLAGS: - if (command == TREQ_SIM_SET_CALLFORWARDING) { + if (command == TREQ_SIM_SET_CALLFORWARDING) __set_file_data(o, ur, ef); - } else { + else _get_file_data(o, ur, ef, 0, meta_info->data_size); - } + break; case SIM_EF_CPHS_CPHS_INFO: if (rt == SIM_ACCESS_SUCCESS) { @@ -963,9 +971,9 @@ static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_si if (command == TREQ_SIM_SET_CALLFORWARDING) { __set_file_data(o, ur, ef); } else { - if (meta_info->rec_count > SIM_CF_RECORD_CNT_MAX) { + if (meta_info->rec_count > SIM_CF_RECORD_CNT_MAX) meta_info->rec_count = SIM_CF_RECORD_CNT_MAX; - } + meta_info->current_index++; _get_file_record(o, ur, ef, meta_info->current_index, meta_info->rec_length); } @@ -1031,7 +1039,6 @@ static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_si dbg("error - File id for get file info [0x%x]", ef); break; } - return; } static void _next_from_get_file_data(CoreObject *o, UserRequest *ur, enum tel_sim_access_result rt, int decode_ret) @@ -1048,11 +1055,12 @@ static void _next_from_get_file_data(CoreObject *o, UserRequest *ur, enum tel_si case SIM_EF_LP: case SIM_EF_USIM_LI: if (decode_ret == TRUE) { - if (meta_info->file_id == SIM_EF_LP || meta_info->file_id == SIM_EF_USIM_LI) { -/* po->language_file = SIM_EF_LP;*/ - } else if (meta_info->file_id == SIM_EF_ELP || meta_info->file_id == SIM_EF_USIM_PL) { -/* po->language_file = SIM_EF_ELP;*/ - } +#if 0 + if (meta_info->file_id == SIM_EF_LP || meta_info->file_id == SIM_EF_USIM_LI) + /* po->language_file = SIM_EF_LP;*/ + else if (meta_info->file_id == SIM_EF_ELP || meta_info->file_id == SIM_EF_USIM_PL) + /* po->language_file = SIM_EF_ELP;*/ +#endif tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &meta_info->files); } else { /* 2G */ @@ -1067,17 +1075,15 @@ static void _next_from_get_file_data(CoreObject *o, UserRequest *ur, enum tel_si - if the ME does not support any of the language codes indicated in EFLI , or if EFLI is not present */ if (tcore_sim_get_type(o) == SIM_TYPE_GSM) { - if (meta_info->file_id == SIM_EF_LP) { + if (meta_info->file_id == SIM_EF_LP) tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &meta_info->files); - } else { + else _get_file_info(o, ur, SIM_EF_LP); - } } else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) { - if (meta_info->file_id == SIM_EF_LP || meta_info->file_id == SIM_EF_USIM_LI) { + if (meta_info->file_id == SIM_EF_LP || meta_info->file_id == SIM_EF_USIM_LI) _get_file_info(o, ur, SIM_EF_ELP); - } else { + else tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &meta_info->files); - } } } break; @@ -1098,7 +1104,7 @@ static void _next_from_get_file_data(CoreObject *o, UserRequest *ur, enum tel_si break; case SIM_EF_IMSI: - ur = tcore_user_request_new(NULL, NULL); // this is for using ur metainfo set/ref functionality. + ur = tcore_user_request_new(NULL, NULL); /* this is for using ur metainfo set/ref functionality. */ _get_file_info(o, ur, SIM_EF_CPHS_CPHS_INFO); break; @@ -1175,9 +1181,9 @@ static void _next_from_get_file_data(CoreObject *o, UserRequest *ur, enum tel_si break; case SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING: - if (rt == SIM_ACCESS_SUCCESS) { + if (rt == SIM_ACCESS_SUCCESS) meta_info->files.result = SIM_ACCESS_SUCCESS; - } + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &meta_info->files); break; @@ -1251,8 +1257,10 @@ static void _response_get_sim_type(TcorePending *p, int data_len, const void *da if (state == 0) { sim_type = SIM_TYPE_GSM; + tcore_sim_set_app_list(o, SIM_APP_TYPE_SIM); } else if (state == 1) { sim_type = SIM_TYPE_USIM; + tcore_sim_set_app_list(o, SIM_APP_TYPE_USIM); } else { sim_type = SIM_TYPE_UNKNOWN; } @@ -1327,9 +1335,14 @@ static void _response_get_file_info(TcorePending *p, int data_len, const void *d dbg("hexData: %s", hexData); dbg("hexData: %s", hexData + 1); - tmp = util_removeQuotes(hexData); + tmp = tcore_at_tok_extract(hexData); recordData = util_hexStringToBytes(tmp); - util_hex_dump(" ", strlen(hexData) / 2, recordData); + if (!recordData) { + err("util_hexStringToBytes Failed!!"); + tcore_at_tok_free(tokens); + return; + } + tcore_util_hex_dump(" ", strlen(hexData) / 2, recordData); g_free(tmp); ptr_data = (unsigned char *)recordData; @@ -1374,7 +1387,6 @@ static void _response_get_file_info(TcorePending *p, int data_len, const void *d switch (file_type_tag) { /* increment to next byte */ - // ptr_data++; case 0x1: dbg("Getting FileType: [Transparent file type]"); file_type = SIM_FTYPE_TRANSPARENT; @@ -1427,7 +1439,11 @@ static void _response_get_file_info(TcorePending *p, int data_len, const void *d return; } - /*File identifier - file id?? */ // 0x84,0x85,0x86 etc are currently ignored and not handled + /* + * File identifier - file id?? + * + * 0x84, 0x85, 0x86 etc are currently ignored and not handled + */ if (*ptr_data == 0x83) { /* increment to next byte */ ptr_data++; @@ -1521,7 +1537,6 @@ static void _response_get_file_info(TcorePending *p, int data_len, const void *d } else { /* if tag length is not 3 */ /* ignoring bytes */ - // ptr_data = ptr_data + 4; dbg("Useless security attributes, so jump to next tag"); ptr_data = ptr_data + (*ptr_data + 1); } @@ -1585,7 +1600,6 @@ static void _response_get_file_info(TcorePending *p, int data_len, const void *d ptr_data++; ptr_data++; /* file size */ - // file_size = p_info->response_len; memcpy(&file_size, ptr_data, 2); /* swap bytes */ SWAPBYTES16(file_size); @@ -1672,7 +1686,7 @@ static void _response_get_file_info(TcorePending *p, int data_len, const void *d meta_info->data_size = file_size; meta_info->rec_length = record_len; meta_info->rec_count = num_of_records; - meta_info->current_index = 0; // reset for new record type EF + meta_info->current_index = 0; /* reset for new record type EF */ rt = SIM_ACCESS_SUCCESS; g_free(recordData); } else { @@ -1735,7 +1749,9 @@ static void _response_get_file_data(TcorePending *p, int data_len, const void *d sw2 = atoi(g_slist_nth_data(tokens, 1)); res = g_slist_nth_data(tokens, 2); - tmp = util_removeQuotes(res); + tmp = tcore_at_tok_extract(res); + if (!tmp) + return; res = util_hexStringToBytes(tmp); res_len = strlen(tmp) / 2; dbg("Response: [%s] Response length: [%d]", res, res_len); @@ -1801,21 +1817,21 @@ static void _response_get_file_data(TcorePending *p, int data_len, const void *d (unsigned char *)res, res_len); break; - case SIM_EF_SST: //EF UST has same address + case SIM_EF_SST: /* EF UST has same address */ { if (tcore_sim_get_type(o) == SIM_TYPE_GSM) { dr = tcore_sim_decode_sst(&meta_info->files.data.svct.table.sst , (unsigned char *)res, res_len); - if(dr == FALSE){ + if (dr == FALSE) { dbg("SST decoding failed"); tcore_sim_set_service_table(o, NULL); - }else{ + } else { int i = 0, size = sizeof(struct tel_sim_sst); char *temp = NULL; meta_info->files.data.svct.sim_type = SIM_TYPE_GSM; - if ((temp=g_try_malloc0(size + 1)) != NULL ) { + if ((temp = g_try_malloc0(size + 1)) != NULL) { memcpy(temp, &meta_info->files.data.svct.table.sst, size); - for(i=0; ifiles.data.svct.table.ust , (unsigned char *)res, res_len); - if(dr == FALSE){ + if (dr == FALSE) { dbg("SST decoding failed"); tcore_sim_set_service_table(o, NULL); - }else{ + } else { int i = 0, size = sizeof(struct tel_sim_ust); char *temp = NULL; meta_info->files.data.svct.sim_type = SIM_TYPE_USIM; - if ((temp=g_try_malloc0(size + 1)) != NULL ) { + if ((temp = g_try_malloc0(size + 1)) != NULL) { memcpy(temp, &meta_info->files.data.svct.table.ust, size); - for(i=0; ifiles.data.svct); } } else { - dbg("err not handled tcore_sim_get_type(o)[%d] in here",tcore_sim_get_type(o)); + dbg("err not handled tcore_sim_get_type(o)[%d] in here", tcore_sim_get_type(o)); } } break; @@ -1941,11 +1957,10 @@ static void _response_get_file_data(TcorePending *p, int data_len, const void *d break; case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE: - /*dr = tcore_sim_decode_csp(&po->p_cphs->csp, - p_data->response, p_data->response_len);*/ + /*dr = tcore_sim_decode_csp(&po->p_cphs->csp, p_data->response, p_data->response_len);*/ break; - case SIM_EF_USIM_MBI: //linear type + case SIM_EF_USIM_MBI: /* linear type */ { struct tel_sim_mbi *mbi = NULL; @@ -1957,11 +1972,11 @@ static void _response_get_file_data(TcorePending *p, int data_len, const void *d meta_info->mbi_list.profile_count++; dbg("mbi count[%d]", meta_info->mbi_list.profile_count); - dbg("voice_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count -1].voice_index); - dbg("fax_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count -1].fax_index); - dbg("email_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count -1].email_index); - dbg("other_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count -1].other_index); - dbg("video_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count -1].video_index); + dbg("voice_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count - 1].voice_index); + dbg("fax_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count - 1].fax_index); + dbg("email_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count - 1].email_index); + dbg("other_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count - 1].other_index); + dbg("video_index[%d]", meta_info->mbi_list.mbi[meta_info->mbi_list.profile_count - 1].video_index); } /* Free memory */ @@ -1969,19 +1984,19 @@ static void _response_get_file_data(TcorePending *p, int data_len, const void *d } break; - case SIM_EF_CPHS_MAILBOX_NUMBERS: // linear type - case SIM_EF_MBDN: //linear type + case SIM_EF_CPHS_MAILBOX_NUMBERS: /* linear type */ + case SIM_EF_MBDN: /* linear type */ dr = tcore_sim_decode_xdn(&meta_info->mb_data.mb[meta_info->mb_count].number_info, (unsigned char *)res, res_len); meta_info->mb_count++; break; - case SIM_EF_CPHS_VOICE_MSG_WAITING: // transparent type + case SIM_EF_CPHS_VOICE_MSG_WAITING: /* transparent type */ dr = tcore_sim_decode_vmwf(&meta_info->files.data.mw.cphs_mw, (unsigned char *)res, res_len); break; - case SIM_EF_USIM_MWIS: //linear type + case SIM_EF_USIM_MWIS: /* linear type */ { struct tel_sim_mw *mw = NULL; @@ -1999,12 +2014,12 @@ static void _response_get_file_data(TcorePending *p, int data_len, const void *d } break; - case SIM_EF_CPHS_CALL_FORWARD_FLAGS: //transparent type + case SIM_EF_CPHS_CALL_FORWARD_FLAGS: /* transparent type */ dr = tcore_sim_decode_cff(&meta_info->files.data.cf.cphs_cf, (unsigned char *)res, res_len); break; - case SIM_EF_USIM_CFIS: //linear type + case SIM_EF_USIM_CFIS: /* linear type */ { struct tel_sim_cfis *cf = NULL; @@ -2028,9 +2043,9 @@ static void _response_get_file_data(TcorePending *p, int data_len, const void *d break; case SIM_EF_CPHS_OPERATOR_NAME_STRING: - dr = tcore_sim_decode_ons((unsigned char*)&meta_info->files.data.cphs_net.full_name, + dr = tcore_sim_decode_ons((unsigned char *)&meta_info->files.data.cphs_net.full_name, (unsigned char *)res, res_len); - dbg("meta_info->files.result[%d],meta_info->files.data.cphs_net.full_name[%s]", + dbg("meta_info->files.result[%d], meta_info->files.data.cphs_net.full_name[%s]", meta_info->files.result, meta_info->files.data.cphs_net.full_name); break; @@ -2050,7 +2065,7 @@ static void _response_get_file_data(TcorePending *p, int data_len, const void *d break; case SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING: - dr = tcore_sim_decode_short_ons((unsigned char*)&meta_info->files.data.cphs_net.short_name, + dr = tcore_sim_decode_short_ons((unsigned char *)&meta_info->files.data.cphs_net.short_name, (unsigned char *)res, res_len); break; @@ -2105,6 +2120,10 @@ static void _on_response_get_retry_count(TcorePending *p, int data_len, const vo o = tcore_pending_ref_core_object(p); sp = tcore_sim_ref_userdata(o); + if (!sp) { + err("user data is null"); + return; + } ur = tcore_pending_ref_user_request(p); if (resp->success > 0) { @@ -2229,9 +2248,17 @@ static gboolean _get_sim_type(CoreObject *o) hal = tcore_object_get_hal(o); pending = tcore_pending_new(o, 0); - + if (!pending) { + err("Pending is NULL"); + return FALSE; + } cmd_str = g_strdup_printf("AT+XUICC?"); req = tcore_at_request_new(cmd_str, "+XUICC:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return FALSE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s] Command length: [%d]", @@ -2270,9 +2297,8 @@ static TReturn _get_file_info(CoreObject *o, UserRequest *ur, const enum tel_sim pending = tcore_at_pending_new(o, cmd_str, "+CRSM:", TCORE_AT_SINGLELINE, _response_get_file_info, NULL); tcore_pending_link_user_request(pending, ur); ret = tcore_hal_send_request(hal, pending); - if (TCORE_RETURN_SUCCESS != ret) { + if (TCORE_RETURN_SUCCESS != ret) tcore_user_request_free(ur); - } g_free(cmd_str); dbg("Exit"); @@ -2292,16 +2318,25 @@ static gboolean _get_file_data(CoreObject *o, UserRequest *ur, const enum tel_si dbg("Entry"); hal = tcore_object_get_hal(o); pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return FALSE; + } dbg("file_id: %x", ef); p1 = (unsigned char) (offset & 0xFF00) >> 8; - p2 = (unsigned char) offset & 0x00FF; // offset low + p2 = (unsigned char) offset & 0x00FF; /* offset low */ p3 = (unsigned char) length; cmd_str = g_strdup_printf("AT+CRSM=176, %d, %d, %d, %d", ef, p1, p2, p3); /*command - 176 : READ BINARY*/ req = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return FALSE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -2330,6 +2365,10 @@ static gboolean _get_file_record(CoreObject *o, UserRequest *ur, const enum tel_ hal = tcore_object_get_hal(o); pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return FALSE; + } p1 = (unsigned char) index; p2 = (unsigned char) 0x04; /* 0x4 for absolute mode */ @@ -2338,6 +2377,11 @@ static gboolean _get_file_record(CoreObject *o, UserRequest *ur, const enum tel_ cmd_str = g_strdup_printf("AT+CRSM=178, %d, %d, %d, %d", ef, p1, p2, p3); /*command - 178 : READ RECORD*/ req = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return FALSE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -2365,7 +2409,16 @@ static TReturn _get_retry_count(CoreObject *o, UserRequest *ur) hal = tcore_object_get_hal(o); pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } sp = tcore_sim_ref_userdata(o); + if (!sp) { + err("user data is null"); + tcore_pending_free(pending); + return TCORE_RETURN_FAILURE; + } switch (sp->current_sec_op) { case SEC_PIN1_VERIFY: @@ -2422,6 +2475,11 @@ static TReturn _get_retry_count(CoreObject *o, UserRequest *ur) cmd_str = g_strdup_printf("AT+XPINCNT=%d", lock_type); req = tcore_at_request_new(cmd_str, "+XPINCNT:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -2443,7 +2501,6 @@ static gboolean on_event_facility_lock_status(CoreObject *o, const void *event_i GSList *lines = NULL; dbg("Function entry"); - return TRUE; lines = (GSList *)event_info; if (1 != g_slist_length(lines)) { @@ -2688,6 +2745,11 @@ static void on_response_verify_pins(TcorePending *p, int data_len, const void *d co_sim = tcore_pending_ref_core_object(p); sp = tcore_sim_ref_userdata(co_sim); + if (!sp) { + err("user data is null"); + return; + } + ur = tcore_pending_ref_user_request(p); memset(&res, 0, sizeof(struct tresp_sim_verify_pins)); @@ -2752,6 +2814,11 @@ static void on_response_verify_puks(TcorePending *p, int data_len, const void *d co_sim = tcore_pending_ref_core_object(p); sp = tcore_sim_ref_userdata(co_sim); + if (!sp) { + err("user data is null"); + return; + } + ur = tcore_pending_ref_user_request(p); memset(&res, 0, sizeof(struct tresp_sim_verify_pins)); @@ -2802,6 +2869,11 @@ static void on_response_change_pins(TcorePending *p, int data_len, const void *d co_sim = tcore_pending_ref_core_object(p); sp = tcore_sim_ref_userdata(co_sim); + if (!sp) { + err("user data is null"); + return; + } + ur = tcore_pending_ref_user_request(p); memset(&res, 0, sizeof(struct tresp_sim_change_pins)); @@ -2894,6 +2966,11 @@ static void on_response_enable_facility(TcorePending *p, int data_len, const voi co_sim = tcore_pending_ref_core_object(p); sp = tcore_sim_ref_userdata(co_sim); + if (!sp) { + err("user data is null"); + return; + } + ur = tcore_pending_ref_user_request(p); memset(&res, 0, sizeof(struct tresp_sim_enable_facility)); @@ -2949,6 +3026,11 @@ static void on_response_disable_facility(TcorePending *p, int data_len, const vo co_sim = tcore_pending_ref_core_object(p); sp = tcore_sim_ref_userdata(co_sim); + if (!sp) { + err("user data is null"); + return; + } + ur = tcore_pending_ref_user_request(p); memset(&res, 0, sizeof(struct tresp_sim_disable_facility)); @@ -2974,10 +3056,9 @@ static void on_response_disable_facility(TcorePending *p, int data_len, const vo res.result = SIM_PIN_OPERATION_SUCCESS; /* Send Response */ - if (ur) { + if (ur) tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_disable_facility), &res); - } /* Free tokens */ tcore_at_tok_free(tokens); @@ -3028,24 +3109,25 @@ static void on_response_get_lock_info(TcorePending *p, int data_len, const void line = (const char *)response->lines->data; tokens = tcore_at_tok_new(line); length_tokens = g_slist_length(tokens); - dbg("No of Tokens [%d]",length_tokens); + dbg("No of Tokens [%d]", length_tokens); switch (length_tokens) { - case 4: - puk2_attempts_left = atoi(g_slist_nth_data(tokens, 3)); - case 3: - puk1_attempts_left = atoi(g_slist_nth_data(tokens, 2)); - case 2: - pin2_attempts_left = atoi(g_slist_nth_data(tokens, 1)); - case 1: - pin1_attempts_left = atoi(g_slist_nth_data(tokens, 0)); - break; - default : - err("Invalid response"); - tcore_at_tok_free(tokens); - resp.result = SIM_CARD_ERROR; - tcore_user_request_send_response(ur, _find_resp_command(ur), - sizeof(struct tresp_sim_get_lock_info), &resp); - return; + case 4: + puk2_attempts_left = atoi(g_slist_nth_data(tokens, 3)); + case 3: + puk1_attempts_left = atoi(g_slist_nth_data(tokens, 2)); + case 2: + pin2_attempts_left = atoi(g_slist_nth_data(tokens, 1)); + case 1: + pin1_attempts_left = atoi(g_slist_nth_data(tokens, 0)); + break; + + default: + err("Invalid response"); + tcore_at_tok_free(tokens); + resp.result = SIM_CARD_ERROR; + tcore_user_request_send_response(ur, _find_resp_command(ur), + sizeof(struct tresp_sim_get_lock_info), &resp); + return; } @@ -3056,38 +3138,38 @@ static void on_response_get_lock_info(TcorePending *p, int data_len, const void resp.lock_status = SIM_LOCK_STATUS_UNLOCKED; - switch(resp.type) - { - case SIM_FACILITY_SC : - resp.retry_count = pin1_attempts_left; - if (pin1_attempts_left > 0 && pin1_attempts_left < SIM_PIN_MAX_RETRY_COUNT) { - resp.lock_status = SIM_LOCK_STATUS_PIN; - } else if (pin1_attempts_left == 0){ - if (puk1_attempts_left) { - resp.lock_status = SIM_LOCK_STATUS_PUK; - resp.retry_count = puk1_attempts_left; - } - else { - resp.lock_status = SIM_LOCK_STATUS_PERM_BLOCKED; - } + switch (resp.type) { + case SIM_FACILITY_SC: + resp.retry_count = pin1_attempts_left; + if (pin1_attempts_left > 0 && pin1_attempts_left < SIM_PIN_MAX_RETRY_COUNT) { + resp.lock_status = SIM_LOCK_STATUS_PIN; + } else if (pin1_attempts_left == 0) { + if (puk1_attempts_left) { + resp.lock_status = SIM_LOCK_STATUS_PUK; + resp.retry_count = puk1_attempts_left; + } else { + resp.lock_status = SIM_LOCK_STATUS_PERM_BLOCKED; } - break; - case SIM_FACILITY_FD : - resp.retry_count = pin2_attempts_left; - if (pin2_attempts_left > 0 && pin2_attempts_left < SIM_PIN_MAX_RETRY_COUNT) { - resp.lock_status = SIM_LOCK_STATUS_PIN2; - } else if (pin2_attempts_left == 0){ - if (puk2_attempts_left) { - resp.lock_status = SIM_LOCK_STATUS_PUK2; - resp.retry_count = puk2_attempts_left; - } - else { - resp.lock_status = SIM_LOCK_STATUS_PERM_BLOCKED; - } + } + break; + + case SIM_FACILITY_FD: + resp.retry_count = pin2_attempts_left; + if (pin2_attempts_left > 0 && pin2_attempts_left < SIM_PIN_MAX_RETRY_COUNT) { + resp.lock_status = SIM_LOCK_STATUS_PIN2; + } else if (pin2_attempts_left == 0) { + if (puk2_attempts_left) { + resp.lock_status = SIM_LOCK_STATUS_PUK2; + resp.retry_count = puk2_attempts_left; + } else { + resp.lock_status = SIM_LOCK_STATUS_PERM_BLOCKED; } - break; - default : - err("Unhandled facility type : [%d]", resp.type); + } + break; + + default: + err("Unhandled facility type : [%d]", resp.type); + break; } dbg("Lock type : [%d], Lock status : [%d]", resp.type, resp.lock_status); tcore_at_tok_free(tokens); @@ -3102,7 +3184,7 @@ static void on_response_get_lock_info(TcorePending *p, int data_len, const void sizeof(struct tresp_sim_get_lock_info), &resp); } -void on_response_update_file (TcorePending *p, int data_len, const void *data, void *user_data) +void on_response_update_file(TcorePending *p, int data_len, const void *data, void *user_data) { UserRequest *ur = NULL; GSList *tokens = NULL; @@ -3142,11 +3224,10 @@ void on_response_update_file (TcorePending *p, int data_len, const void *data, v sw1 = atoi(g_slist_nth_data(tokens, 0)); sw2 = atoi(g_slist_nth_data(tokens, 1)); - if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) { + if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) resp.result = SIM_ACCESS_SUCCESS; - } else { + else resp.result = _decode_status_word(sw1, sw2); - } } tcore_at_tok_free(tokens); } @@ -3156,7 +3237,7 @@ void on_response_update_file (TcorePending *p, int data_len, const void *data, v } } - if (cphs_sim == FALSE){ + if (cphs_sim == FALSE) { switch (command) { case TREQ_SIM_SET_MAILBOX: if (meta_info->file_id == SIM_EF_USIM_MBI) { @@ -3177,32 +3258,29 @@ void on_response_update_file (TcorePending *p, int data_len, const void *data, v } } else { switch (command) { - case TREQ_SIM_SET_MAILBOX: - { - if (meta_info->file_id != SIM_EF_CPHS_MAILBOX_NUMBERS) { - _get_file_info(co_sim, ur, SIM_EF_CPHS_MAILBOX_NUMBERS); - return; - } + case TREQ_SIM_SET_MAILBOX: + if (meta_info->file_id != SIM_EF_CPHS_MAILBOX_NUMBERS) { + _get_file_info(co_sim, ur, SIM_EF_CPHS_MAILBOX_NUMBERS); + return; } - break; - case TREQ_SIM_SET_CALLFORWARDING: - { - if (meta_info->file_id != SIM_EF_CPHS_CALL_FORWARD_FLAGS) { - _get_file_info(co_sim, ur, SIM_EF_CPHS_CALL_FORWARD_FLAGS); - return; - } + break; + + case TREQ_SIM_SET_CALLFORWARDING: + if (meta_info->file_id != SIM_EF_CPHS_CALL_FORWARD_FLAGS) { + _get_file_info(co_sim, ur, SIM_EF_CPHS_CALL_FORWARD_FLAGS); + return; } - break; - case TREQ_SIM_SET_MESSAGEWAITING: - { - if (meta_info->file_id != SIM_EF_CPHS_VOICE_MSG_WAITING) { - _get_file_info(co_sim, ur, SIM_EF_CPHS_VOICE_MSG_WAITING); - return; - } + break; + + case TREQ_SIM_SET_MESSAGEWAITING: + if (meta_info->file_id != SIM_EF_CPHS_VOICE_MSG_WAITING) { + _get_file_info(co_sim, ur, SIM_EF_CPHS_VOICE_MSG_WAITING); + return; } - break; - default: - break; + break; + + default: + break; } } @@ -3242,15 +3320,28 @@ static void on_response_transmit_apdu(TcorePending *p, int data_len, const void } tmp = tcore_at_tok_extract(g_slist_nth_data(tokens, 1)); - decoded_data = util_hexStringToBytes(tmp); - res.apdu_resp_length = strlen(tmp) / 2; - res.apdu_resp = g_malloc0(res.apdu_resp_length + 1); - - memcpy((char *)res.apdu_resp, decoded_data, res.apdu_resp_length); - g_free(tmp); - g_free(decoded_data); - res.result = SIM_ACCESS_SUCCESS; - tcore_at_tok_free(tokens); + if (tmp) { + decoded_data = util_hexStringToBytes(tmp); + if (decoded_data) { + res.apdu_resp_length = strlen(tmp) / 2; + res.apdu_resp = g_malloc0(res.apdu_resp_length + 1); + if (res.apdu_resp == NULL) { + err("Memory allocation failed!!"); + tcore_at_tok_free(tokens); + g_free(tmp); + g_free(decoded_data); + goto OUT; + } + memcpy((char *)res.apdu_resp, decoded_data, res.apdu_resp_length); + g_free(tmp); + g_free(decoded_data); + res.result = SIM_ACCESS_SUCCESS; + tcore_at_tok_free(tokens); + } else { + err("util_hexStringToBytes Failed!!"); + g_free(tmp); + } + } } } else { dbg("RESPONSE NOK"); @@ -3291,14 +3382,20 @@ static void on_response_get_atr(TcorePending *p, int data_len, const void *data, goto OUT; } - tmp = util_removeQuotes(g_slist_nth_data(tokens, 0)); - decoded_data = util_hexStringToBytes(tmp); + tmp = tcore_at_tok_extract(g_slist_nth_data(tokens, 0)); + if (tmp) { + decoded_data = util_hexStringToBytes(tmp); + if (!decoded_data) { + err("util_hexStringToBytes Failed!!"); + goto OUT; + } - res.atr_length = strlen(tmp) / 2; - memcpy((char *)res.atr, decoded_data, res.atr_length); - g_free(tmp); - g_free(decoded_data); - res.result = SIM_ACCESS_SUCCESS; + res.atr_length = strlen(tmp) / 2; + memcpy((char *)res.atr, decoded_data, res.atr_length); + g_free(tmp); + g_free(decoded_data); + res.result = SIM_ACCESS_SUCCESS; + } } } else { dbg("RESPONSE NOK"); @@ -3454,7 +3551,7 @@ static TReturn imc_verify_pins(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) + if ((o == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); @@ -3464,7 +3561,17 @@ static TReturn imc_verify_pins(CoreObject *o, UserRequest *ur) } sp = tcore_sim_ref_userdata(o); + if (!sp) { + err("user data is null"); + return TCORE_RETURN_FAILURE; + } + pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } + req_data = tcore_user_request_ref_data(ur, NULL); if (req_data->pin_type == SIM_PTYPE_PIN1) { @@ -3485,6 +3592,11 @@ static TReturn imc_verify_pins(CoreObject *o, UserRequest *ur) } req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -3511,7 +3623,7 @@ static TReturn imc_verify_puks(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) + if ((o == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); @@ -3521,7 +3633,17 @@ static TReturn imc_verify_puks(CoreObject *o, UserRequest *ur) } sp = tcore_sim_ref_userdata(o); + if (!sp) { + err("user data is null"); + return TCORE_RETURN_FAILURE; + } + pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } + req_data = tcore_user_request_ref_data(ur, NULL); if (req_data->puk_type == SIM_PTYPE_PUK1) { @@ -3536,6 +3658,11 @@ static TReturn imc_verify_puks(CoreObject *o, UserRequest *ur) } req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -3564,7 +3691,7 @@ static TReturn imc_change_pins(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) + if ((o == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); @@ -3574,20 +3701,35 @@ static TReturn imc_change_pins(CoreObject *o, UserRequest *ur) } sp = tcore_sim_ref_userdata(o); + if (!sp) { + err("user data is null"); + return TCORE_RETURN_FAILURE; + } + pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } + req_data = tcore_user_request_ref_data(ur, NULL); if (req_data->type == SIM_PTYPE_PIN1) { sp->current_sec_op = SEC_PIN1_CHANGE; - cmd_str = g_strdup_printf("AT+CPWD=\"%s\",\"%s\",\"%s\"", pin1, req_data->old_pin, req_data->new_pin); + cmd_str = g_strdup_printf("AT+CPWD=\"%s\", \"%s\", \"%s\"", pin1, req_data->old_pin, req_data->new_pin); } else if (req_data->type == SIM_PTYPE_PIN2) { sp->current_sec_op = SEC_PIN2_CHANGE; - cmd_str = g_strdup_printf("AT+CPWD=\"%s\",\"%s\",\"%s\"", pin2, req_data->old_pin, req_data->new_pin); + cmd_str = g_strdup_printf("AT+CPWD=\"%s\", \"%s\", \"%s\"", pin2, req_data->old_pin, req_data->new_pin); } else { tcore_pending_free(pending); return TCORE_RETURN_EINVAL; } req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -3616,7 +3758,7 @@ static TReturn imc_get_facility_status(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) + if ((o == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); @@ -3626,6 +3768,11 @@ static TReturn imc_get_facility_status(CoreObject *o, UserRequest *ur) } pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } + req_data = tcore_user_request_ref_data(ur, NULL); res = g_try_new0(struct tresp_sim_get_facility_status, 1); @@ -3636,25 +3783,30 @@ static TReturn imc_get_facility_status(CoreObject *o, UserRequest *ur) res->type = req_data->type; - if (req_data->type == SIM_FACILITY_PS) { + if (req_data->type == SIM_FACILITY_PS) fac = "PS"; /*PH-SIM, Lock PHone to SIM/UICC card*/ - } else if (req_data->type == SIM_FACILITY_SC) { + else if (req_data->type == SIM_FACILITY_SC) fac = "SC"; /*Lock SIM/UICC card, simply PIN1*/ - } else if (req_data->type == SIM_FACILITY_FD) { + else if (req_data->type == SIM_FACILITY_FD) fac = "FD"; /*Fixed Dialing Number feature, need PIN2*/ - } else if (req_data->type == SIM_FACILITY_PN) { + else if (req_data->type == SIM_FACILITY_PN) fac = "PN"; /*Network Personalization*/ - } else if (req_data->type == SIM_FACILITY_PU) { + else if (req_data->type == SIM_FACILITY_PU) fac = "PU"; /*network sUbset Personalization*/ - } else if (req_data->type == SIM_FACILITY_PP) { + else if (req_data->type == SIM_FACILITY_PP) fac = "PP"; /*service Provider Personalization*/ - } else if (req_data->type == SIM_FACILITY_PC) { + else if (req_data->type == SIM_FACILITY_PC) fac = "PC"; /*Corporate Personalization*/ - } else { + else return TCORE_RETURN_EINVAL; - } + cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d", fac, mode); req = tcore_at_request_new(cmd_str, "+CLCK:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -3683,7 +3835,7 @@ static TReturn imc_enable_facility(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) + if ((o == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); @@ -3693,7 +3845,17 @@ static TReturn imc_enable_facility(CoreObject *o, UserRequest *ur) } sp = tcore_sim_ref_userdata(o); + if (!sp) { + err("user data is null"); + return TCORE_RETURN_FAILURE; + } + pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } + req_data = tcore_user_request_ref_data(ur, NULL); if (req_data->type == SIM_FACILITY_PS) { @@ -3722,6 +3884,11 @@ static TReturn imc_enable_facility(CoreObject *o, UserRequest *ur) } cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d, \"%s\"", fac, mode, req_data->password); req = tcore_at_request_new(cmd_str, "+CLCK:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -3750,7 +3917,7 @@ static TReturn imc_disable_facility(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) + if ((o == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); @@ -3760,7 +3927,17 @@ static TReturn imc_disable_facility(CoreObject *o, UserRequest *ur) } sp = tcore_sim_ref_userdata(o); + if (!sp) { + err("user data is null"); + return TCORE_RETURN_FAILURE; + } + pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } + req_data = tcore_user_request_ref_data(ur, NULL); if (req_data->type == SIM_FACILITY_PS) { @@ -3789,6 +3966,11 @@ static TReturn imc_disable_facility(CoreObject *o, UserRequest *ur) } cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d, \"%s\"", fac, mode, req_data->password); req = tcore_at_request_new(cmd_str, "+CLCK:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + g_free(cmd_str); + return TCORE_RETURN_FAILURE; + } g_free(cmd_str); dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", @@ -3813,13 +3995,22 @@ static TReturn imc_get_lock_info(CoreObject *o, UserRequest *ur) hal = tcore_object_get_hal(o); pending = tcore_pending_new(o, 0); + if (!pending) { + err("Pending is NULL"); + return TCORE_RETURN_FAILURE; + } - if ((o == NULL )|| (ur == NULL)) { + if ((o == NULL) || (ur == NULL)) { tcore_pending_free(pending); return TCORE_RETURN_EINVAL; } req = tcore_at_request_new("AT+XPINCNT", "+XPINCNT:", TCORE_AT_SINGLELINE); + if (req == NULL) { + tcore_pending_free(pending); + return TCORE_RETURN_FAILURE; + } + dbg("Command: [%s] Prefix(if any): [%s], Command length: [%d]", req->cmd, req->prefix, strlen(req->cmd)); @@ -3839,7 +4030,7 @@ static TReturn imc_read_file(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) + if ((o == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; command = tcore_user_request_get_command(ur); @@ -3948,109 +4139,104 @@ static TReturn imc_update_file(CoreObject *co_sim, UserRequest *ur) cphs_sim = tcore_sim_get_cphs_status(co_sim); sim_type = tcore_sim_get_type(co_sim); - if ((co_sim == NULL )|| (ur == NULL)) { + if ((co_sim == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; - } switch (command) { - case TREQ_SIM_SET_LANGUAGE: - if (sim_type == SIM_TYPE_GSM) - ret_code = _get_file_info(co_sim, ur, SIM_EF_ELP); - else if (sim_type == SIM_TYPE_USIM) - ret_code = _get_file_info(co_sim, ur, SIM_EF_LP); - else - ret_code = TCORE_RETURN_ENOSYS; - break; + case TREQ_SIM_SET_LANGUAGE: + if (sim_type == SIM_TYPE_GSM) + ret_code = _get_file_info(co_sim, ur, SIM_EF_ELP); + else if (sim_type == SIM_TYPE_USIM) + ret_code = _get_file_info(co_sim, ur, SIM_EF_LP); + else + ret_code = TCORE_RETURN_ENOSYS; + break; - case TREQ_SIM_SET_MAILBOX: - { + case TREQ_SIM_SET_MAILBOX: + if (cphs_sim) { + struct tel_sim_service_table *svct = tcore_sim_get_service_table(co_sim); + + if (!svct) + break; + if ((sim_type == SIM_TYPE_GSM && svct->table.sst.service[SIM_SST_MBDN]) || (sim_type == SIM_TYPE_USIM && svct->table.ust.service[SIM_UST_MBDN])) { + tcore_user_request_set_metainfo(ur, sizeof(struct imc_sim_property), &meta_info); + ret_code = _get_file_info(co_sim, ur, SIM_EF_USIM_MBI); + } else { + dbg("Service not available in SST/UST - Updating CPHS file : Fild ID[0x%x]", SIM_EF_CPHS_MAILBOX_NUMBERS); + ret_code = _get_file_info(co_sim, ur, SIM_EF_CPHS_MAILBOX_NUMBERS); + } + free(svct); + } else { + ret_code = _get_file_info(co_sim, ur, SIM_EF_USIM_MBI); + } + break; + + case TREQ_SIM_SET_CALLFORWARDING: + { + const struct treq_sim_set_callforwarding *cf = NULL; + cf = (struct treq_sim_set_callforwarding *) tcore_user_request_ref_data(ur, NULL); + + if (cf) { if (cphs_sim) { struct tel_sim_service_table *svct = tcore_sim_get_service_table(co_sim); - - if(!svct) + if (!svct) break; - if ((sim_type == SIM_TYPE_GSM && svct->table.sst.service[SIM_SST_MBDN]) || (sim_type == SIM_TYPE_USIM && svct->table.ust.service[SIM_UST_MBDN])) { + if ((sim_type == SIM_TYPE_GSM && svct->table.sst.service[SIM_SST_CFIS]) || (sim_type == SIM_TYPE_USIM && svct->table.ust.service[SIM_UST_CFIS])) { + if (cf->b_cphs == FALSE) + ef = SIM_EF_USIM_CFIS; + else + ef = SIM_EF_CPHS_CALL_FORWARD_FLAGS; + tcore_user_request_set_metainfo(ur, sizeof(struct imc_sim_property), &meta_info); - ret_code = _get_file_info(co_sim, ur, SIM_EF_USIM_MBI); + ret_code = _get_file_info(co_sim, ur, ef); } else { - dbg("Service not available in SST/UST - Updating CPHS file : Fild ID[0x%x]", SIM_EF_CPHS_MAILBOX_NUMBERS); - ret_code = _get_file_info(co_sim, ur, SIM_EF_CPHS_MAILBOX_NUMBERS); + dbg("Service not available in SST/UST - Updating CPHS file : File ID[0x%x]", SIM_EF_CPHS_CALL_FORWARD_FLAGS); + ret_code = _get_file_info(co_sim, ur, SIM_EF_CPHS_CALL_FORWARD_FLAGS); } free(svct); } else { - ret_code = _get_file_info(co_sim, ur, SIM_EF_USIM_MBI); + ret_code = _get_file_info(co_sim, ur, SIM_EF_USIM_CFIS); } + } else { + ret_code = TCORE_RETURN_EINVAL; } - break; + } + break; - case TREQ_SIM_SET_CALLFORWARDING: - { - const struct treq_sim_set_callforwarding *cf = NULL; - cf = (struct treq_sim_set_callforwarding *) tcore_user_request_ref_data(ur, NULL); - - if (cf){ - if (cphs_sim) { - struct tel_sim_service_table *svct = tcore_sim_get_service_table(co_sim); - if(!svct) - break; - if ((sim_type == SIM_TYPE_GSM && svct->table.sst.service[SIM_SST_CFIS]) || (sim_type == SIM_TYPE_USIM && svct->table.ust.service[SIM_UST_CFIS])) { - if (cf->b_cphs == FALSE) { - ef = SIM_EF_USIM_CFIS; - } else { - ef = SIM_EF_CPHS_CALL_FORWARD_FLAGS; - } - tcore_user_request_set_metainfo(ur, sizeof(struct imc_sim_property), &meta_info); - ret_code = _get_file_info(co_sim, ur, ef); - } else { - dbg("Service not available in SST/UST - Updating CPHS file : File ID[0x%x]", SIM_EF_CPHS_CALL_FORWARD_FLAGS); - ret_code = _get_file_info(co_sim, ur, SIM_EF_CPHS_CALL_FORWARD_FLAGS); - } - free(svct); - } else { - ret_code = _get_file_info(co_sim, ur, SIM_EF_USIM_CFIS); - } - } else { - ret_code = TCORE_RETURN_EINVAL; - } - } - break; + case TREQ_SIM_SET_MESSAGEWAITING: + { + const struct treq_sim_set_messagewaiting *mw = NULL; + mw = (struct treq_sim_set_messagewaiting *) tcore_user_request_ref_data(ur, NULL); + if (mw) { + if (cphs_sim) { + struct tel_sim_service_table *svct = tcore_sim_get_service_table(co_sim); + if (!svct) + break; + if ((sim_type == SIM_TYPE_GSM && svct->table.sst.service[SIM_SST_MWIS]) || (sim_type == SIM_TYPE_USIM && svct->table.ust.service[SIM_UST_MWIS])) { + if (mw->b_cphs == FALSE) + ef = SIM_EF_USIM_MWIS; + else + ef = SIM_EF_CPHS_VOICE_MSG_WAITING; - case TREQ_SIM_SET_MESSAGEWAITING: - { - const struct treq_sim_set_messagewaiting *mw = NULL; - mw = (struct treq_sim_set_messagewaiting *) tcore_user_request_ref_data(ur, NULL); - if (mw) { - if(cphs_sim) { - struct tel_sim_service_table *svct = tcore_sim_get_service_table(co_sim); - if(!svct) - break; - if (( sim_type == SIM_TYPE_GSM && svct->table.sst.service[SIM_SST_MWIS] ) || ( sim_type == SIM_TYPE_USIM && svct->table.ust.service[SIM_UST_MWIS] )) { - if (mw->b_cphs == FALSE) { - ef = SIM_EF_USIM_MWIS; - } else { - ef = SIM_EF_CPHS_VOICE_MSG_WAITING; - } - tcore_user_request_set_metainfo(ur, sizeof(struct imc_sim_property), &meta_info); - ret_code = _get_file_info(co_sim, ur, ef); - } else { - dbg("Service not available in SST/UST - Updating CPHS file : File ID[0x%x]", SIM_EF_CPHS_VOICE_MSG_WAITING); - ret_code = _get_file_info(co_sim, ur, SIM_EF_CPHS_VOICE_MSG_WAITING); - } - free(svct); - } else { - ret_code = _get_file_info(co_sim, ur, SIM_EF_USIM_MWIS); + tcore_user_request_set_metainfo(ur, sizeof(struct imc_sim_property), &meta_info); + ret_code = _get_file_info(co_sim, ur, ef); + } else { + dbg("Service not available in SST/UST - Updating CPHS file : File ID[0x%x]", SIM_EF_CPHS_VOICE_MSG_WAITING); + ret_code = _get_file_info(co_sim, ur, SIM_EF_CPHS_VOICE_MSG_WAITING); } - } else{ - ret_code = TCORE_RETURN_EINVAL; + free(svct); + } else { + ret_code = _get_file_info(co_sim, ur, SIM_EF_USIM_MWIS); } + } else{ + ret_code = TCORE_RETURN_EINVAL; } - break; + } + break; - default: - { - err("Unhandled UPDATE command[%d]", command); - return TCORE_RETURN_EINVAL; - } + default: + err("Unhandled UPDATE command[%d]", command); + return TCORE_RETURN_EINVAL; } return ret_code; @@ -4067,7 +4253,7 @@ static TReturn imc_transmit_apdu(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) + if ((o == NULL) || (ur == NULL)) return TCORE_RETURN_EINVAL; hal = tcore_object_get_hal(o); @@ -4079,10 +4265,14 @@ static TReturn imc_transmit_apdu(CoreObject *o, UserRequest *ur) req_data = tcore_user_request_ref_data(ur, NULL); apdu = (char *)g_try_malloc0((2 * req_data->apdu_length) + 1); + if (apdu == NULL) { + err("Memory allocation failed!!"); + return TCORE_RETURN_ENOMEM; + } result = util_byte_to_hex((const char *)req_data->apdu, apdu, req_data->apdu_length); dbg("result %d", result); - cmd_str = g_strdup_printf("AT+CSIM=%d,\"%s\"", (unsigned int)strlen(apdu), apdu); + cmd_str = g_strdup_printf("AT+CSIM=%d, \"%s\"", strlen(apdu), apdu); ret = tcore_prepare_and_send_at_request(o, cmd_str, "+CSIM:", TCORE_AT_SINGLELINE, ur, @@ -4101,7 +4291,7 @@ static TReturn imc_get_atr(CoreObject *o, UserRequest *ur) dbg("Entry"); - if ((o == NULL )|| (ur == NULL)) { + if ((o == NULL) || (ur == NULL)) { err("Invalid parameters"); return TCORE_RETURN_EINVAL; } @@ -4137,14 +4327,8 @@ static TReturn imc_req_authentication(CoreObject *co, UserRequest *ur) return ret; } - if (req_data->rand_data != NULL) { - convert_rand = util_hex_to_string(req_data->rand_data, - strlen(req_data->rand_data)); - dbg("Convert RAND hex to string: [%s]", convert_rand); - } else { - err("rand_data is NULL"); - return ret; - } + convert_rand = util_hex_to_string(req_data->rand_data, strlen(req_data->rand_data)); + dbg("Convert RAND hex to string: [%s]", convert_rand); sim_type = tcore_sim_get_type(co); switch (sim_type) { @@ -4161,20 +4345,15 @@ static TReturn imc_req_authentication(CoreObject *co, UserRequest *ur) switch (req_data->auth_type) { case SIM_AUTH_TYPE_GSM: context_type = 2; - cmd_str = g_strdup_printf("AT+XAUTH=%d,%d,\"%s\"", session_id, + cmd_str = g_strdup_printf("AT+XAUTH=%d, %d, \"%s\"", session_id, context_type, convert_rand); break; case SIM_AUTH_TYPE_3G: context_type = 1; - if (req_data->autn_data != NULL) { - convert_autn = util_hex_to_string(req_data->autn_data, - strlen(req_data->autn_data)); - dbg("Convert AUTN hex to string: [%s]", convert_autn); - } else { - err("autn_data is NULL"); - goto out; - } - cmd_str = g_strdup_printf("AT+XAUTH=%d,%d,\"%s\",\"%s\"", + convert_autn = util_hex_to_string(req_data->autn_data, strlen(req_data->autn_data)); + dbg("Convert AUTN hex to string: [%s]", convert_autn); + + cmd_str = g_strdup_printf("AT+XAUTH=%d, %d, \"%s\", \"%s\"", session_id, context_type, convert_rand, convert_autn); break; @@ -4220,7 +4399,7 @@ gboolean imc_sim_init(TcorePlugin *cp, CoreObject *co_sim) dbg("Entry"); /* Set operations */ - tcore_sim_set_ops(co_sim, &sim_ops); + tcore_sim_set_ops(co_sim, &sim_ops, TCORE_OPS_TYPE_CP); meta_info = g_try_new0(struct imc_sim_property, 1); if (meta_info == NULL) diff --git a/src/imc_sms.c b/src/imc_sms.c index b88d3df..3b6a9e2 100644 --- a/src/imc_sms.c +++ b/src/imc_sms.c @@ -45,64 +45,64 @@ #include "imc_sms.h" /*============================================================= - GSM-SMS Size + GSM-SMS Size ==============================================================*/ -#define MAX_GSM_SMS_TPDU_SIZE 244 -#define MAX_GSM_SMS_MSG_NUM 255 -#define MAX_GSM_SMS_SERVICE_CENTER_ADDR 12 /* Maximum number of bytes of service center address */ -#define MAX_GSM_SMS_CBMI_LIST_SIZE 100 /* Maximum number of CBMI list size for CBS 30*2=60 */ -#define MAX_GSM_SMS_PARAM_RECORD_SIZE 156 /* Maximum number of bytes SMSP Record size (Y + 28), y : 0 ~ 128 */ -#define MAX_GSM_SMS_STATUS_FILE_SIZE 2 /* Last Used TP-MR + SMS "Memory Cap. Exceeded" Noti Flag */ -#define TAPI_SIM_SMSP_ADDRESS_LEN 20 +#define MAX_GSM_SMS_TPDU_SIZE 244 +#define MAX_GSM_SMS_MSG_NUM 255 +#define MAX_GSM_SMS_SERVICE_CENTER_ADDR 12 /* Maximum number of bytes of service center address */ +#define MAX_GSM_SMS_CBMI_LIST_SIZE 100 /* Maximum number of CBMI list size for CBS 30*2=60 */ +#define MAX_GSM_SMS_PARAM_RECORD_SIZE 156 /* Maximum number of bytes SMSP Record size (Y + 28), y : 0 ~ 128 */ +#define MAX_GSM_SMS_STATUS_FILE_SIZE 2 /* Last Used TP-MR + SMS "Memory Cap. Exceeded" Noti Flag */ +#define TAPI_SIM_SMSP_ADDRESS_LEN 20 /*============================================================= - Device Ready + Device Ready ==============================================================*/ -#define SMS_DEVICE_READY 1 /* Telephony device ready */ -#define SMS_DEVICE_NOT_READY 0 /* Telephony device not ready */ +#define SMS_DEVICE_READY 1 /* Telephony device ready */ +#define SMS_DEVICE_NOT_READY 0 /* Telephony device not ready */ /*============================================================= CBMI Selection ==============================================================*/ #define SMS_CBMI_SELECTED_SOME 0x02 /* Some CBMIs are selected */ -#define SMS_CBMI_SELECTED_ALL 0x01 /* All CBMIs are selected */ +#define SMS_CBMI_SELECTED_ALL 0x01 /* All CBMIs are selected */ /*============================================================= - Message Status + Message Status ==============================================================*/ -#define AT_REC_UNREAD 0 /* Received and Unread */ -#define AT_REC_READ 1 /* Received and Read */ -#define AT_STO_UNSENT 2 /* Unsent */ -#define AT_STO_SENT 3 /* Sent */ -#define AT_ALL 4 /* Unknown */ +#define AT_REC_UNREAD 0 /* Received and Unread */ +#define AT_REC_READ 1 /* Received and Read */ +#define AT_STO_UNSENT 2 /* Unsent */ +#define AT_STO_SENT 3 /* Sent */ +#define AT_ALL 4 /* Unknown */ /*============================================================= Memory Status ==============================================================*/ -#define AT_MEMORY_AVAILABLE 0 /* Memory Available */ -#define AT_MEMORY_FULL 1 /* Memory Full */ +#define AT_MEMORY_AVAILABLE 0 /* Memory Available */ +#define AT_MEMORY_FULL 1 /* Memory Full */ /*============================================================= SIM CRSM SW1 and Sw2 Error definitions */ -#define AT_SW1_SUCCESS 0x90 -#define AT_SW2_SUCCESS 0 -#define AT_SW1_LEN_RESP 0x9F +#define AT_SW1_SUCCESS 0x90 +#define AT_SW2_SUCCESS 0 +#define AT_SW1_LEN_RESP 0x9F -#define AT_MAX_RECORD_LEN 256 +#define AT_MAX_RECORD_LEN 256 /* SCA 12 bytes long and TDPU is 164 bytes long */ -#define PDU_LEN_MAX 176 +#define PDU_LEN_MAX 176 #define HEX_PDU_LEN_MAX ((PDU_LEN_MAX * 2) + 1) /*============================================================= - String Preprocessor + String Preprocessor ==============================================================*/ #define CR '\r' /* Carriage Return */ /*============================================================= Developer ==============================================================*/ -#define SMS_SWAPBYTES16(x) (((x) & 0xffff0000) | (((x) & 0x0000ff00) >> 8) | (((x) & 0x000000ff) << 8)) +#define SMS_SWAPBYTES16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8)) #define SMS_ENCODED_SCA_LEN_MAX 12 #define CONVERT_TO_HEX(in, out) (in <= 9) ? \ (out = '0' + in) : (out = 'A' + in - 10) @@ -169,8 +169,7 @@ static guint __util_sms_encode_pdu(const guchar *sca, if (sca[0] == 0) { converted_sca[0] = 0; sca_len = 0; - } - else { + } else { unsigned int i; /* * For PDU, the SC Address length is the number of packed BCD bytes @@ -210,7 +209,8 @@ static long __util_sms_encode_hex(const guchar *src, long num_bytes, gchar *buf) return j; } -static int util_sms_decode_smsParameters(unsigned char *incoming, unsigned int length, struct telephony_sms_Params *params) +static int util_sms_decode_smsParameters(unsigned char *incoming, + unsigned int length, struct telephony_sms_Params *params) { int alpha_id_len = 0; int i = 0; @@ -218,15 +218,14 @@ static int util_sms_decode_smsParameters(unsigned char *incoming, unsigned int l dbg(" RecordLen = %d", length); - if(incoming == NULL || params == NULL) + if (incoming == NULL || params == NULL) return FALSE; - alpha_id_len = length -SMS_SMSP_PARAMS_MAX_LEN; + alpha_id_len = length - SMS_SMSP_PARAMS_MAX_LEN; if (alpha_id_len > 0) { - if (alpha_id_len > SMS_SMSP_ALPHA_ID_LEN_MAX) { + if (alpha_id_len > SMS_SMSP_ALPHA_ID_LEN_MAX) alpha_id_len = SMS_SMSP_ALPHA_ID_LEN_MAX; - } for (i = 0; i < alpha_id_len; i++) { if (0xff == incoming[i]) { @@ -345,37 +344,38 @@ static int util_sms_decode_smsParameters(unsigned char *incoming, unsigned int l params->tpSvcCntrAddr.dialNumLen = 0; } - if ((params->paramIndicator & SMSPValidPID) == 0 && (alpha_id_len + nPIDOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE) { + if ((params->paramIndicator & SMSPValidPID) == 0 + && (alpha_id_len + nPIDOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE) params->tpProtocolId = incoming[alpha_id_len + nPIDOffset]; - } - if ((params->paramIndicator & SMSPValidDCS) == 0 && (alpha_id_len + nDCSOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE) { + + if ((params->paramIndicator & SMSPValidDCS) == 0 + && (alpha_id_len + nDCSOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE) params->tpDataCodingScheme = incoming[alpha_id_len + nDCSOffset]; - } - if ((params->paramIndicator & SMSPValidVP) == 0 && (alpha_id_len + nVPOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE) { + + if ((params->paramIndicator & SMSPValidVP) == 0 + && (alpha_id_len + nVPOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE) params->tpValidityPeriod = incoming[alpha_id_len + nVPOffset]; - } dbg(" Alpha Id(Len) = %d", (int) params->alphaIdLen); - for (i = 0; i < (int) params->alphaIdLen; i++) { + for (i = 0; i < (int) params->alphaIdLen; i++) dbg(" Alpha Id = [%d] [%c]", i, params->szAlphaId[i]); - } - dbg(" PID = %d",params->tpProtocolId); - dbg(" DCS = %d",params->tpDataCodingScheme); - dbg(" VP = %d",params->tpValidityPeriod); + + dbg(" PID = %d", params->tpProtocolId); + dbg(" DCS = %d", params->tpDataCodingScheme); + dbg(" VP = %d", params->tpValidityPeriod); return TRUE; } -/*============================================================= - Notifications -==============================================================*/ +/* + * Notifications + */ static gboolean on_event_class2_sms_incom_msg(CoreObject *obj, - const void *event_info, void *user_data) + const void *event_info, void *user_data) { - //+CMTI: , - - GSList *tokens = NULL , *lines = NULL; + /* +CMTI: , */ + GSList *tokens = NULL, *lines = NULL; char *line = NULL, *cmd_str = NULL; int index = 0, mem_type = 0; TcoreHal *hal = NULL; @@ -395,11 +395,11 @@ static gboolean on_event_class2_sms_incom_msg(CoreObject *obj, } tokens = tcore_at_tok_new(line); /* Split Line 1 into tokens */ - mem_type = atoi(g_slist_nth_data(tokens, 0)); // Type of Memory stored + mem_type = atoi(g_slist_nth_data(tokens, 0)); /* Type of Memory stored */ if (mem_type == 0) err("Token 0 not present"); - index = atoi((char *) g_slist_nth_data(tokens, 1)); + index = atoi((char *)g_slist_nth_data(tokens, 1)); hal = tcore_object_get_hal(obj); if (NULL == hal) { @@ -413,14 +413,13 @@ static gboolean on_event_class2_sms_incom_msg(CoreObject *obj, dbg("index: [%d]", index); cmd_str = g_strdup_printf("AT+CMGR=%d", index); - atreq = tcore_at_request_new((const char *)cmd_str, "+CMGR", TCORE_AT_PDU); + atreq = tcore_at_request_new((const char *)cmd_str, "+CMGR", TCORE_AT_PDU); pending = tcore_pending_new(obj, 0); if (NULL == cmd_str || NULL == atreq || NULL == pending) { err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -429,16 +428,16 @@ static gboolean on_event_class2_sms_incom_msg(CoreObject *obj, return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); - tcore_pending_set_response_callback(pending, on_response_class2_read_msg, (void *)(uintptr_t)index); //storing index as user data for response + tcore_pending_set_response_callback(pending, on_response_class2_read_msg, (void *)(uintptr_t)index); /* storing index as user data for response */ tcore_pending_link_user_request(pending, NULL); tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); tcore_hal_send_request(hal, pending); g_free(cmd_str); - if(tokens) + if (tokens) tcore_at_tok_free(tokens); return TRUE; @@ -446,8 +445,7 @@ static gboolean on_event_class2_sms_incom_msg(CoreObject *obj, static gboolean on_event_sms_incom_msg(CoreObject *o, const void *event_info, void *user_data) { - //+CMT: [], (PDU mode enabled); - + /* +CMT: [], (PDU mode enabled); */ TReturn ret; GSList *tokens = NULL; GSList *lines = NULL; @@ -480,11 +478,11 @@ static gboolean on_event_sms_incom_msg(CoreObject *o, const void *event_info, vo no_of_tokens = g_slist_length(tokens); - if (no_of_tokens == 2) { // in case of incoming SMS +CMT + if (no_of_tokens == 2) { /* in case of incoming SMS +CMT */ dbg("Alpha ID: [%02x]", g_slist_nth_data(tokens, 0)); /* 0: Alpha ID */ pdu_len = atoi((char *)g_slist_nth_data(tokens, 1)); dbg("pdu_len: [%d]", pdu_len); /* 1: PDU Length */ - } else if (no_of_tokens == 1) { // in case of incoming status report +CDS + } else if (no_of_tokens == 1) { /* in case of incoming status report +CDS */ pdu_len = atoi((char *)g_slist_nth_data(tokens, 0)); dbg("pdu_len: [%d]", pdu_len); /* 1: PDU Length */ } @@ -500,7 +498,11 @@ static gboolean on_event_sms_incom_msg(CoreObject *o, const void *event_info, vo /* Convert to Bytes */ bytePDU = (unsigned char *)util_hexStringToBytes(line); - + if (!bytePDU) { + err("NULL data received[%p]", bytePDU); + tcore_at_tok_free(tokens); + return FALSE; + } sca_length = bytePDU[0]; dbg("SCA length = %d", sca_length); @@ -513,17 +515,20 @@ static gboolean on_event_sms_incom_msg(CoreObject *o, const void *event_info, vo } else { gsmMsgInfo.msgInfo.sca[0] = sca_length; memcpy(&(gsmMsgInfo.msgInfo.sca[1]), &bytePDU[1], sca_length); - memcpy(gsmMsgInfo.msgInfo.tpduData, &bytePDU[sca_length+1], gsmMsgInfo.msgInfo.msgLength); + memcpy(gsmMsgInfo.msgInfo.tpduData, &bytePDU[sca_length + 1], gsmMsgInfo.msgInfo.msgLength); } - util_hex_dump(" ", strlen(line)/2, bytePDU); - util_hex_dump(" ", sca_length, gsmMsgInfo.msgInfo.sca); - util_hex_dump(" ", gsmMsgInfo.msgInfo.msgLength,gsmMsgInfo.msgInfo.tpduData); + tcore_util_hex_dump(" ", strlen(line) / 2, bytePDU); + tcore_util_hex_dump(" ", sca_length, gsmMsgInfo.msgInfo.sca); + tcore_util_hex_dump(" ", gsmMsgInfo.msgInfo.msgLength, gsmMsgInfo.msgInfo.tpduData); - ret = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_INCOM_MSG, sizeof(struct tnoti_sms_incoming_msg), &gsmMsgInfo); + ret = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), + o, + TNOTI_SMS_INCOM_MSG, + sizeof(struct tnoti_sms_incoming_msg), &gsmMsgInfo); dbg("ret: %x", ret); - if(tokens) + if (tokens) tcore_at_tok_free(tokens); g_free(bytePDU); @@ -535,22 +540,21 @@ static gboolean on_event_sms_incom_msg(CoreObject *o, const void *event_info, vo static gboolean on_event_sms_memory_status(CoreObject *o, const void *event_info, void *user_data) { - struct tnoti_sms_memory_status memStatusInfo = {0,}; + struct tnoti_sms_memory_status memStatusInfo = {0, }; int memoryStatus = -1; - GSList *tokens=NULL; - GSList *lines=NULL; - char *line = NULL , *pResp = NULL; + GSList *tokens = NULL; + GSList *lines = NULL; + char *line = NULL, *pResp = NULL; TReturn ret; dbg(" Entry"); lines = (GSList *)event_info; - if (1 != g_slist_length(lines)) { - dbg("unsolicited msg but multiple line"); - } + if (1 != g_slist_length(lines)) + dbg("unsolicited msg but multiple line"); - line = (char*)(lines->data); + line = (char *)(lines->data); if (line) { dbg("Response OK"); @@ -559,15 +563,18 @@ static gboolean on_event_sms_memory_status(CoreObject *o, const void *event_info if (pResp) { memoryStatus = atoi(pResp); - dbg("memoryStatus is %d",memoryStatus); - if (memoryStatus == 0) {//SIM Full condition + dbg("memoryStatus is %d", memoryStatus); + if (memoryStatus == 0) /* SIM Full condition */ memStatusInfo.status = SMS_PHONE_MEMORY_STATUS_FULL; - } - ret = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_MEMORY_STATUS, sizeof(struct tnoti_sms_memory_status), &memStatusInfo); + + ret = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), + o, + TNOTI_SMS_MEMORY_STATUS, + sizeof(struct tnoti_sms_memory_status), &memStatusInfo); dbg("ret: %x", ret); } tcore_at_tok_free(tokens); - }else { + } else { dbg("Response NOK"); } @@ -577,12 +584,11 @@ static gboolean on_event_sms_memory_status(CoreObject *o, const void *event_info static gboolean on_event_sms_cb_incom_msg(CoreObject *o, const void *event_info, void *user_data) { - //+CBM: - + /* +CBM: */ struct tnoti_sms_cellBroadcast_msg cbMsgInfo; - int rtn = -1 , length = 0; - char * line = NULL, *pdu = NULL, *pResp = NULL; + int rtn = -1, length = 0; + char *line = NULL, *pdu = NULL, *pResp = NULL; GSList *tokens = NULL; GSList *lines = NULL; @@ -596,15 +602,14 @@ static gboolean on_event_sms_cb_incom_msg(CoreObject *o, const void *event_info, if (line != NULL) { dbg("Response OK"); - dbg("Noti line is %s",line); + dbg("Noti line is %s", line); tokens = tcore_at_tok_new(line); /* Split Line 1 into tokens */ pResp = g_slist_nth_data(tokens, 0); - if (pResp) { + if (pResp) length = atoi(pResp); - } else { + else dbg("token 0 is null"); - } pdu = g_slist_nth_data(lines, 1); if (pdu != NULL) { @@ -613,14 +618,21 @@ static gboolean on_event_sms_cb_incom_msg(CoreObject *o, const void *event_info, dbg("CB Msg LENGTH [%2x]", length); - if ((cbMsgInfo.cbMsg.length >0) && (SMS_CB_SIZE_MAX >= cbMsgInfo.cbMsg.length)) { + if ((cbMsgInfo.cbMsg.length > 0) + && (SMS_CB_SIZE_MAX >= cbMsgInfo.cbMsg.length)) { unsigned char *byte_pdu = NULL; byte_pdu = (unsigned char *)util_hexStringToBytes(pdu); - - memcpy(cbMsgInfo.cbMsg.msgData, (char*)byte_pdu, cbMsgInfo.cbMsg.length); - rtn = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_CB_INCOM_MSG, sizeof(struct tnoti_sms_cellBroadcast_msg), &cbMsgInfo); - g_free(byte_pdu); + if (byte_pdu) { + memcpy(cbMsgInfo.cbMsg.msgData, (char *)byte_pdu, cbMsgInfo.cbMsg.length); + rtn = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), + o, + TNOTI_SMS_CB_INCOM_MSG, + sizeof(struct tnoti_sms_cellBroadcast_msg), &cbMsgInfo); + g_free(byte_pdu); + } else { + err("util_hexStringToBytes Failed!!"); + } } else { dbg("Invalid Message Length"); } @@ -631,24 +643,25 @@ static gboolean on_event_sms_cb_incom_msg(CoreObject *o, const void *event_info, dbg("Response NOK"); } - dbg(" Return value [%d]",rtn); + dbg(" Return value [%d]", rtn); - if(tokens) + if (tokens) tcore_at_tok_free(tokens); return TRUE; } -/*============================================================= - Responses -==============================================================*/ -static void on_response_sms_delete_msg(TcorePending *p, int data_len, const void *data, void *user_data) +/* + * Responses + */ +static void on_response_sms_delete_msg(TcorePending *p, +int data_len, const void *data, void *user_data) { - struct tresp_sms_delete_msg delMsgInfo = {0,}; + struct tresp_sms_delete_msg delMsgInfo = {0, }; UserRequest *ur = NULL; const TcoreATResponse *atResp = data; - int index = GPOINTER_TO_INT(user_data); + int index = (int) user_data; dbg(" Func Entrance"); @@ -663,14 +676,17 @@ static void on_response_sms_delete_msg(TcorePending *p, int data_len, const void delMsgInfo.result = SMS_DEVICE_FAILURE; } - tcore_user_request_send_response(ur, TRESP_SMS_DELETE_MSG, sizeof(struct tresp_sms_delete_msg), &delMsgInfo); + tcore_user_request_send_response(ur, + TRESP_SMS_DELETE_MSG, + sizeof(struct tresp_sms_delete_msg), &delMsgInfo); return; } -static void on_response_sms_save_msg(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_sms_save_msg(TcorePending *p, + int data_len, const void *data, void *user_data) { - struct tresp_sms_save_msg saveMsgInfo = {0,}; + struct tresp_sms_save_msg saveMsgInfo = {0, }; UserRequest *ur = NULL; const TcoreATResponse *atResp = data; GSList *tokens = NULL; @@ -687,7 +703,7 @@ static void on_response_sms_save_msg(TcorePending *p, int data_len, const void * pResp = g_slist_nth_data(tokens, 0); if (pResp) { dbg("0: %s", pResp); - saveMsgInfo.index = (atoi(pResp) - 1); /* IMC index starts from 1 */ + saveMsgInfo.index = (atoi(pResp) - 1); /* IMC index starts from 1 */ saveMsgInfo.result = SMS_SENDSMS_SUCCESS; } else { dbg("No Tokens"); @@ -702,12 +718,15 @@ static void on_response_sms_save_msg(TcorePending *p, int data_len, const void * saveMsgInfo.result = SMS_DEVICE_FAILURE; } - rtn = tcore_user_request_send_response(ur, TRESP_SMS_SAVE_MSG, sizeof(struct tresp_sms_save_msg), &saveMsgInfo); + rtn = tcore_user_request_send_response(ur, + TRESP_SMS_SAVE_MSG, + sizeof(struct tresp_sms_save_msg), &saveMsgInfo); dbg("Return value [%d]", rtn); return; } -static void on_response_send_umts_msg(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_send_umts_msg(TcorePending *pending, + int data_len, const void *data, void *user_data) { const TcoreATResponse *at_response = data; struct tresp_sms_send_msg resp_umts; @@ -733,11 +752,11 @@ static void on_response_send_umts_msg(TcorePending *pending, int data_len, const if (at_response->success > 0) { /* SUCCESS */ dbg("Response OK"); - if (at_response->lines) { // lines present in at_response + if (at_response->lines) { /* lines present in at_response */ gslist_line = (char *)at_response->lines->data; dbg("gslist_line: [%s]", gslist_line); - tokens = tcore_at_tok_new(gslist_line); //extract tokens + tokens = tcore_at_tok_new(gslist_line); /* extract tokens */ line_token = g_slist_nth_data(tokens, 0); if (line_token != NULL) { @@ -749,66 +768,69 @@ static void on_response_send_umts_msg(TcorePending *pending, int data_len, const dbg("No Message Reference received"); } tcore_at_tok_free(tokens); - } else { // no lines in at_response + } else { /* no lines in at_response */ dbg("No lines"); } - } else { // failure + } else { /* failure */ dbg("Response NOK"); } - tcore_user_request_send_response(user_req, TRESP_SMS_SEND_UMTS_MSG, sizeof(resp_umts), &resp_umts); + tcore_user_request_send_response(user_req, + TRESP_SMS_SEND_UMTS_MSG, + sizeof(resp_umts), &resp_umts); dbg("Exit"); return; } -static void on_response_class2_read_msg(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_class2_read_msg(TcorePending *pending, + int data_len, const void *data, void *user_data) { const TcoreATResponse *at_response = data; - GSList *tokens=NULL; + GSList *tokens = NULL; char *gslist_line = NULL, *line_token = NULL, *hex_pdu = NULL; int pdu_len = 0, rtn = 0; unsigned char *bytePDU = NULL; struct tnoti_sms_incoming_msg gsmMsgInfo; - int sca_length= 0; + int sca_length = 0; dbg("Entry"); dbg("lines: [%p]", at_response->lines); - g_slist_foreach(at_response->lines, print_glib_list_elem, NULL); //for debug log + g_slist_foreach(at_response->lines, print_glib_list_elem, NULL); if (at_response->success > 0) { dbg("Response OK"); if (at_response->lines) { - //fetch first line + /* fetch first line */ gslist_line = (char *)at_response->lines->data; dbg("gslist_line: [%s]", gslist_line); tokens = tcore_at_tok_new(gslist_line); dbg("Number of tokens: [%d]", g_slist_length(tokens)); - g_slist_foreach(tokens, print_glib_list_elem, NULL); //for debug log + g_slist_foreach(tokens, print_glib_list_elem, NULL); - line_token = g_slist_nth_data(tokens, 2); //Third Token: Length + line_token = g_slist_nth_data(tokens, 2); /* Third Token: Length */ if (line_token != NULL) { pdu_len = atoi(line_token); dbg("Length: [%d]", pdu_len); } - //fetch second line + /* fetch second line */ gslist_line = (char *)at_response->lines->next->data; dbg("gslist_line: [%s]", gslist_line); - //free the consumed token + /* free the consumed token */ tcore_at_tok_free(tokens); tokens = tcore_at_tok_new(gslist_line); dbg("Number of tokens: [%d]", g_slist_length(tokens)); - g_slist_foreach(tokens, print_glib_list_elem, NULL); //for debug log + g_slist_foreach(tokens, print_glib_list_elem, NULL); - hex_pdu = g_slist_nth_data(tokens, 0); //Fetch SMS PDU + hex_pdu = g_slist_nth_data(tokens, 0); /* Fetch SMS PDU */ - //free the consumed token + /* free the consumed token */ tcore_at_tok_free(tokens); } else { dbg("No lines"); @@ -819,7 +841,10 @@ static void on_response_class2_read_msg(TcorePending *pending, int data_len, con /* Convert to Bytes */ bytePDU = (unsigned char *)util_hexStringToBytes(hex_pdu); - + if (!bytePDU) { + err("util_hexStringToBytes Failed!!"); + return; + } sca_length = bytePDU[0]; dbg("SCA length = %d", sca_length); @@ -833,12 +858,14 @@ static void on_response_class2_read_msg(TcorePending *pending, int data_len, con memcpy(gsmMsgInfo.msgInfo.tpduData, &bytePDU[sca_length+1], gsmMsgInfo.msgInfo.msgLength); } - util_hex_dump(" ", strlen(hex_pdu)/2, bytePDU); - util_hex_dump(" ", sca_length, gsmMsgInfo.msgInfo.sca); - util_hex_dump(" ", gsmMsgInfo.msgInfo.msgLength,gsmMsgInfo.msgInfo.tpduData); + tcore_util_hex_dump(" ", strlen(hex_pdu)/2, bytePDU); + tcore_util_hex_dump(" ", sca_length, gsmMsgInfo.msgInfo.sca); + tcore_util_hex_dump(" ", gsmMsgInfo.msgInfo.msgLength, gsmMsgInfo.msgInfo.tpduData); rtn = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(tcore_pending_ref_core_object(pending))), - tcore_pending_ref_core_object(pending), TNOTI_SMS_INCOM_MSG, sizeof(struct tnoti_sms_incoming_msg), &gsmMsgInfo); + tcore_pending_ref_core_object(pending), + TNOTI_SMS_INCOM_MSG, + sizeof(struct tnoti_sms_incoming_msg), &gsmMsgInfo); dbg("rtn: [%d]", rtn); g_free(bytePDU); @@ -847,13 +874,14 @@ static void on_response_class2_read_msg(TcorePending *pending, int data_len, con return; } -static void on_response_read_msg(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_read_msg(TcorePending *pending, + int data_len, const void *data, void *user_data) { const TcoreATResponse *at_response = data; struct tresp_sms_read_msg resp_read_msg; UserRequest *user_req = NULL; - GSList *tokens=NULL; + GSList *tokens = NULL; char *gslist_line = NULL, *line_token = NULL, *byte_pdu = NULL, *hex_pdu = NULL; int sca_length = 0; int msg_status = 0, alpha_id = 0, pdu_len = 0; @@ -861,7 +889,7 @@ static void on_response_read_msg(TcorePending *pending, int data_len, const void dbg("Entry"); dbg("index: [%d]", index); - g_slist_foreach(at_response->lines, print_glib_list_elem, NULL); //for debug log + g_slist_foreach(at_response->lines, print_glib_list_elem, NULL); user_req = tcore_pending_ref_user_request(pending); if (NULL == user_req) { @@ -881,80 +909,83 @@ static void on_response_read_msg(TcorePending *pending, int data_len, const void err("2 lines are required"); goto OUT; } - //fetch first line + /* fetch first line */ gslist_line = (char *)at_response->lines->data; dbg("gslist_line: [%s]", gslist_line); tokens = tcore_at_tok_new(gslist_line); dbg("Number of tokens: [%d]", g_slist_length(tokens)); - g_slist_foreach(tokens, print_glib_list_elem, NULL); //for debug log + g_slist_foreach(tokens, print_glib_list_elem, NULL); - line_token = g_slist_nth_data(tokens, 0); //First Token: Message Status + line_token = g_slist_nth_data(tokens, 0); /* First Token: Message Status */ if (line_token != NULL) { msg_status = atoi(line_token); - dbg("msg_status is %d",msg_status); + dbg("msg_status is %d", msg_status); switch (msg_status) { - case AT_REC_UNREAD: - resp_read_msg.dataInfo.msgStatus = SMS_STATUS_UNREAD; - break; + case AT_REC_UNREAD: + resp_read_msg.dataInfo.msgStatus = SMS_STATUS_UNREAD; + break; - case AT_REC_READ: - resp_read_msg.dataInfo.msgStatus = SMS_STATUS_READ; - break; + case AT_REC_READ: + resp_read_msg.dataInfo.msgStatus = SMS_STATUS_READ; + break; - case AT_STO_UNSENT: - resp_read_msg.dataInfo.msgStatus = SMS_STATUS_UNSENT; - break; + case AT_STO_UNSENT: + resp_read_msg.dataInfo.msgStatus = SMS_STATUS_UNSENT; + break; - case AT_STO_SENT: - resp_read_msg.dataInfo.msgStatus = SMS_STATUS_SENT; - break; + case AT_STO_SENT: + resp_read_msg.dataInfo.msgStatus = SMS_STATUS_SENT; + break; - case AT_ALL: //Fall Through - default: //Fall Through - resp_read_msg.dataInfo.msgStatus = SMS_STATUS_RESERVED; - break; + case AT_ALL: /* Fall Through */ + default: /* Fall Through */ + resp_read_msg.dataInfo.msgStatus = SMS_STATUS_RESERVED; + break; } } - line_token = g_slist_nth_data(tokens, 1); //Second Token: AlphaID + line_token = g_slist_nth_data(tokens, 1); /* Second Token: AlphaID */ if (line_token != NULL) { alpha_id = atoi(line_token); dbg("AlphaID: [%d]", alpha_id); } - line_token = g_slist_nth_data(tokens, 2); //Third Token: Length + line_token = g_slist_nth_data(tokens, 2); /* Third Token: Length */ if (line_token != NULL) { pdu_len = atoi(line_token); dbg("Length: [%d]", pdu_len); } - //fetch second line - hex_pdu = (char *) at_response->lines->next->data; + /* fetch second line */ + hex_pdu = (char *)at_response->lines->next->data; dbg("EF-SMS PDU: [%s]", hex_pdu); - //free the consumed token + /* free the consumed token */ tcore_at_tok_free(tokens); if (NULL != hex_pdu) { - util_hex_dump(" ", strlen(hex_pdu), (void *)hex_pdu); + tcore_util_hex_dump(" ", strlen(hex_pdu), (void *)hex_pdu); byte_pdu = util_hexStringToBytes(hex_pdu); - + if (!byte_pdu) { + err("util_hexStringToBytes Failed!!"); + goto OUT; + } sca_length = (int)byte_pdu[0]; - resp_read_msg.dataInfo.simIndex = index; //Retrieving index stored as user_data + resp_read_msg.dataInfo.simIndex = index; /* Retrieving index stored as user_data */ dbg("SCA Length : %d", sca_length); resp_read_msg.dataInfo.smsData.msgLength = pdu_len; dbg("msgLength: [%d]", resp_read_msg.dataInfo.smsData.msgLength); - if(0 == sca_length) { + if (0 == sca_length) { if ((resp_read_msg.dataInfo.smsData.msgLength > 0) - && (resp_read_msg.dataInfo.smsData.msgLength <= SMS_SMDATA_SIZE_MAX)) { + && (resp_read_msg.dataInfo.smsData.msgLength <= SMS_SMDATA_SIZE_MAX)) { memset(resp_read_msg.dataInfo.smsData.sca, 0, TAPI_SIM_SMSP_ADDRESS_LEN); memcpy(resp_read_msg.dataInfo.smsData.tpduData, &byte_pdu[1], resp_read_msg.dataInfo.smsData.msgLength); @@ -972,9 +1003,9 @@ static void on_response_read_msg(TcorePending *pending, int data_len, const void memcpy(resp_read_msg.dataInfo.smsData.sca, (char *)byte_pdu, (sca_length+1)); memcpy(resp_read_msg.dataInfo.smsData.tpduData, &byte_pdu[sca_length+1], resp_read_msg.dataInfo.smsData.msgLength); - util_hex_dump(" ", SMS_SMSP_ADDRESS_LEN, (void *)resp_read_msg.dataInfo.smsData.sca); - util_hex_dump(" ", (SMS_SMDATA_SIZE_MAX + 1), (void *)resp_read_msg.dataInfo.smsData.tpduData); - util_hex_dump(" ", strlen(hex_pdu) / 2 + 1, (void *)byte_pdu); + tcore_util_hex_dump(" ", SMS_SMSP_ADDRESS_LEN, (void *)resp_read_msg.dataInfo.smsData.sca); + tcore_util_hex_dump(" ", (SMS_SMDATA_SIZE_MAX + 1), (void *)resp_read_msg.dataInfo.smsData.tpduData); + tcore_util_hex_dump(" ", strlen(hex_pdu) / 2 + 1, (void *)byte_pdu); resp_read_msg.result = SMS_SUCCESS; } else { @@ -983,10 +1014,10 @@ static void on_response_read_msg(TcorePending *pending, int data_len, const void } } g_free(byte_pdu); - }else { + } else { dbg("NULL PDU"); } - }else { + } else { dbg("No lines"); } } else { @@ -994,13 +1025,16 @@ static void on_response_read_msg(TcorePending *pending, int data_len, const void } OUT: - tcore_user_request_send_response(user_req, TRESP_SMS_READ_MSG, sizeof(resp_read_msg), &resp_read_msg); + tcore_user_request_send_response(user_req, + TRESP_SMS_READ_MSG, + sizeof(resp_read_msg), &resp_read_msg); dbg("Exit"); return; } -static void on_response_get_msg_indices(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_get_msg_indices(TcorePending *pending, + int data_len, const void *data, void *user_data) { const TcoreATResponse *at_response = data; struct tresp_sms_get_storedMsgCnt resp_stored_msg_cnt; @@ -1028,7 +1062,7 @@ static void on_response_get_msg_indices(TcorePending *pending, int data_len, con gslist_line_count = SMS_GSM_SMS_MSG_NUM_MAX; dbg("Number of lines: [%d]", gslist_line_count); - g_slist_foreach(at_response->lines, print_glib_list_elem, NULL); //for debug log + g_slist_foreach(at_response->lines, print_glib_list_elem, NULL); for (ctr_loop = 0; ctr_loop < gslist_line_count; ctr_loop++) { gslist_line = (char *)g_slist_nth_data(at_response->lines, ctr_loop); /* Fetch Line i */ @@ -1038,7 +1072,7 @@ static void on_response_get_msg_indices(TcorePending *pending, int data_len, con if (NULL != gslist_line) { tokens = tcore_at_tok_new(gslist_line); - g_slist_foreach(tokens, print_glib_list_elem, NULL); //for debug log + g_slist_foreach(tokens, print_glib_list_elem, NULL); line_token = g_slist_nth_data(tokens, 0); if (NULL != line_token) { @@ -1053,12 +1087,11 @@ static void on_response_get_msg_indices(TcorePending *pending, int data_len, con dbg("gslist_line [%d] is NULL", ctr_loop); continue; } - } + } } else { dbg("No lines."); - if (resp_stored_msg_cnt_prev->storedMsgCnt.usedCount == 0) { // Check if used count is zero + if (resp_stored_msg_cnt_prev->storedMsgCnt.usedCount == 0) /* Check if used count is zero */ resp_stored_msg_cnt.result = SMS_SENDSMS_SUCCESS; - } } } else { dbg("Respnose NOK"); @@ -1069,24 +1102,29 @@ static void on_response_get_msg_indices(TcorePending *pending, int data_len, con util_sms_free_memory(resp_stored_msg_cnt_prev); - dbg("total: [%d], used: [%d], result: [%d]", resp_stored_msg_cnt.storedMsgCnt.totalCount, resp_stored_msg_cnt.storedMsgCnt.usedCount, resp_stored_msg_cnt.result); - for (ctr_loop = 0; ctr_loop < gslist_line_count; ctr_loop++) { + dbg("total: [%d], used: [%d], result: [%d]", + resp_stored_msg_cnt.storedMsgCnt.totalCount, + resp_stored_msg_cnt.storedMsgCnt.usedCount, + resp_stored_msg_cnt.result); + for (ctr_loop = 0; ctr_loop < gslist_line_count; ctr_loop++) dbg("index: [%d]", resp_stored_msg_cnt.storedMsgCnt.indexList[ctr_loop]); - } - tcore_user_request_send_response(user_req, TRESP_SMS_GET_STORED_MSG_COUNT, sizeof(resp_stored_msg_cnt), &resp_stored_msg_cnt); + tcore_user_request_send_response(user_req, + TRESP_SMS_GET_STORED_MSG_COUNT, + sizeof(resp_stored_msg_cnt), &resp_stored_msg_cnt); dbg("Exit"); return; } -static void on_response_get_stored_msg_cnt(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_get_stored_msg_cnt(TcorePending *pending, + int data_len, const void *data, void *user_data) { UserRequest *ur = NULL, *ur_dup = NULL; struct tresp_sms_get_storedMsgCnt *respStoredMsgCnt = NULL; const TcoreATResponse *atResp = data; - GSList *tokens=NULL; - char *line = NULL , *pResp = NULL , *cmd_str = NULL; + GSList *tokens = NULL; + char *line = NULL, *pResp = NULL, *cmd_str = NULL; TcoreATRequest *atReq = NULL; int usedCnt = 0, totalCnt = 0, result = 0; @@ -1096,6 +1134,9 @@ static void on_response_get_stored_msg_cnt(TcorePending *pending, int data_len, dbg("Entered"); respStoredMsgCnt = malloc(sizeof(struct tresp_sms_get_storedMsgCnt)); + if (!respStoredMsgCnt) + return; + result = SMS_DEVICE_FAILURE; ur = tcore_pending_ref_user_request(pending); @@ -1106,41 +1147,41 @@ static void on_response_get_stored_msg_cnt(TcorePending *pending, int data_len, dbg("Response OK"); if (NULL != atResp->lines) { line = (char *)atResp->lines->data; - dbg("line is %s",line); + dbg("line is %s", line); tokens = tcore_at_tok_new(line); pResp = g_slist_nth_data(tokens, 0); if (pResp) { - usedCnt =atoi(pResp); - dbg("used cnt is %d",usedCnt); + usedCnt = atoi(pResp); + dbg("used cnt is %d", usedCnt); } pResp = g_slist_nth_data(tokens, 1); if (pResp) { - totalCnt =atoi(pResp); + totalCnt = atoi(pResp); result = SMS_SENDSMS_SUCCESS; respStoredMsgCnt->storedMsgCnt.usedCount = usedCnt; respStoredMsgCnt->storedMsgCnt.totalCount = totalCnt; respStoredMsgCnt->result = result; - dbg("used %d, total %d, result %d",usedCnt, totalCnt,result); + dbg("used %d, total %d, result %d", usedCnt, totalCnt, result); pending_new = tcore_pending_new(o, 0); - //Get all messages information + /* Get all messages information */ cmd_str = g_strdup_printf("AT+CMGL=4"); atReq = tcore_at_request_new((const char *)cmd_str, "+CMGL", TCORE_AT_MULTILINE); - dbg("cmd str is %s",cmd_str); + dbg("cmd str is %s", cmd_str); - tcore_pending_set_request_data(pending_new, 0,atReq); + tcore_pending_set_request_data(pending_new, 0, atReq); tcore_pending_set_response_callback(pending_new, on_response_get_msg_indices, (void *)respStoredMsgCnt); tcore_pending_link_user_request(pending_new, ur_dup); tcore_pending_set_send_callback(pending_new, on_confirmation_sms_message_send, NULL); tcore_hal_send_request(tcore_object_get_hal(o), pending_new); - //free the consumed token + /* free the consumed token */ tcore_at_tok_free(tokens); g_free(cmd_str); @@ -1148,7 +1189,7 @@ static void on_response_get_stored_msg_cnt(TcorePending *pending, int data_len, dbg("Exit"); return; } - //free the consumed token + /* free the consumed token */ if (tokens) tcore_at_tok_free(tokens); } else { @@ -1157,15 +1198,19 @@ static void on_response_get_stored_msg_cnt(TcorePending *pending, int data_len, } else { err("Response NOK"); } + respStoredMsgCnt->result = result; - tcore_user_request_send_response(ur, TRESP_SMS_GET_STORED_MSG_COUNT, sizeof(struct tresp_sms_get_storedMsgCnt), &respStoredMsgCnt); + tcore_user_request_send_response(ur, + TRESP_SMS_GET_STORED_MSG_COUNT, + sizeof(struct tresp_sms_get_storedMsgCnt), &respStoredMsgCnt); dbg("Exit"); return; } -static void on_response_get_sca(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_get_sca(TcorePending *pending, + int data_len, const void *data, void *user_data) { const TcoreATResponse *at_response = data; struct tresp_sms_get_sca respGetSca; @@ -1198,17 +1243,20 @@ static void on_response_get_sca(TcorePending *pending, int data_len, const void respGetSca.scaAddress.dialNumLen = strlen(sca_addr); - if (145 == atoi(sca_toa)) { + if (145 == atoi(sca_toa)) respGetSca.scaAddress.typeOfNum = SIM_TON_INTERNATIONAL; - } else { + else respGetSca.scaAddress.typeOfNum = SIM_TON_NATIONAL; - } respGetSca.scaAddress.numPlanId = 0; memcpy(respGetSca.scaAddress.diallingNum, sca_addr, strlen(sca_addr)); - dbg("len [%d], sca_addr [%s], TON [%d], NPI [%d]", respGetSca.scaAddress.dialNumLen, respGetSca.scaAddress.diallingNum, respGetSca.scaAddress.typeOfNum, respGetSca.scaAddress.numPlanId); + dbg("len [%d], sca_addr [%s], TON [%d], NPI [%d]", + respGetSca.scaAddress.dialNumLen, + respGetSca.scaAddress.diallingNum, + respGetSca.scaAddress.typeOfNum, + respGetSca.scaAddress.numPlanId); respGetSca.result = SMS_SENDSMS_SUCCESS; } else { @@ -1221,25 +1269,26 @@ static void on_response_get_sca(TcorePending *pending, int data_len, const void dbg("Response NOK"); } - tcore_user_request_send_response(user_req, TRESP_SMS_GET_SCA, sizeof(respGetSca), &respGetSca); + tcore_user_request_send_response(user_req, + TRESP_SMS_GET_SCA, + sizeof(respGetSca), &respGetSca); tcore_at_tok_free(tokens); g_free(sca_addr); dbg("Exit"); - return; } -static void on_response_set_sca(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_set_sca(TcorePending *pending, + int data_len, const void *data, void *user_data) { /* - Response is expected in this format - OK - or - +CMS ERROR: - */ + * Response is expected in this format + * OK + * or + * +CMS ERROR: + */ UserRequest *ur; - //copies the AT response data to resp const TcoreATResponse *atResp = data; struct tresp_sms_set_sca respSetSca; @@ -1259,20 +1308,20 @@ static void on_response_set_sca(TcorePending *pending, int data_len, const void respSetSca.result = SMS_DEVICE_FAILURE; } - tcore_user_request_send_response(ur, TRESP_SMS_SET_SCA, sizeof(struct tresp_sms_set_sca), &respSetSca); - - return; + tcore_user_request_send_response(ur, + TRESP_SMS_SET_SCA, + sizeof(struct tresp_sms_set_sca), &respSetSca); } -static void on_response_get_cb_config(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_get_cb_config(TcorePending *p, + int data_len, const void *data, void *user_data) { UserRequest *ur; struct tresp_sms_get_cb_config respGetCbConfig; const TcoreATResponse *atResp = data; - GSList *tokens=NULL; - int i = 0, mode =0; + GSList *tokens = NULL; + int i = 0, mode = 0; char *pResp = NULL, *line = NULL; - char delim[] = "-"; memset(&respGetCbConfig, 0, sizeof(struct tresp_sms_get_cb_config)); respGetCbConfig.result = SMS_DEVICE_FAILURE; @@ -1284,13 +1333,14 @@ static void on_response_get_cb_config(TcorePending *p, int data_len, const void } respGetCbConfig.cbConfig.net3gppType = SMS_NETTYPE_3GPP; + respGetCbConfig.cbConfig.msgIdMaxCount = SMS_GSM_SMS_CBMI_LIST_SIZE_MAX; if (atResp->success) { dbg("Response OK"); if (atResp->lines) { - line = (char*)atResp->lines->data; + line = (char *)atResp->lines->data; if (line != NULL) { - dbg("line is %s",line); + dbg("line is %s", line); tokens = tcore_at_tok_new(line); pResp = g_slist_nth_data(tokens, 0); if (pResp) { @@ -1304,10 +1354,11 @@ static void on_response_get_cb_config(TcorePending *p, int data_len, const void int num_cb_tokens = 0; char *mid_tok = NULL; char *first_tok = NULL, *second_tok = NULL; + char *ptr = NULL; - // 0,1,5,320-478,922 - cb_mid_str = util_removeQuotes(pResp); - cb_tokens = tcore_at_tok_new((const char *) cb_mid_str); + /* 0, 1, 5, 320-478, 922 */ + cb_mid_str = tcore_at_tok_extract(pResp); + cb_tokens = tcore_at_tok_new((const char *)cb_mid_str); g_free(cb_mid_str); @@ -1315,13 +1366,13 @@ static void on_response_get_cb_config(TcorePending *p, int data_len, const void dbg("num_cb_tokens = %d", num_cb_tokens); if (num_cb_tokens == 0) { - if (mode == 1) { // Enable all CBs + if (mode == 1) { /* Enable all CBs */ respGetCbConfig.cbConfig.msgIdRangeCount = 1; respGetCbConfig.cbConfig.msgIDs[0].net3gpp.fromMsgId = 0x0000; respGetCbConfig.cbConfig.msgIDs[0].net3gpp.toMsgId = SMS_GSM_SMS_CBMI_LIST_SIZE_MAX + 1; respGetCbConfig.cbConfig.msgIDs[0].net3gpp.selected = TRUE; respGetCbConfig.result = SMS_SENDSMS_SUCCESS; - } else { // all CBs disabled + } else { /* all CBs disabled */ respGetCbConfig.cbConfig.msgIdRangeCount = 0; respGetCbConfig.cbConfig.msgIDs[0].net3gpp.selected = FALSE; respGetCbConfig.result = SMS_SENDSMS_SUCCESS; @@ -1337,35 +1388,24 @@ static void on_response_get_cb_config(TcorePending *p, int data_len, const void respGetCbConfig.cbConfig.msgIdRangeCount++; mid_tok = tcore_at_tok_nth(cb_tokens, i); - first_tok = strtok(mid_tok, delim); - second_tok = strtok(NULL, delim); + first_tok = strtok_r(mid_tok, "-", &ptr); + second_tok = strtok_r(NULL, "-", &ptr); - if ((first_tok != NULL) && (second_tok != NULL)) { // mids in range (320-478) + if ((first_tok != NULL) && (second_tok != NULL)) { + /* mids in range (320-478) */ dbg("inside if mid_range"); respGetCbConfig.cbConfig.msgIDs[i].net3gpp.fromMsgId = atoi(first_tok); respGetCbConfig.cbConfig.msgIDs[i].net3gpp.toMsgId = atoi(second_tok); - } // single mid value (0,1,5, 922) - else { + } else { + /* single mid value (0, 1, 5, 922) */ respGetCbConfig.cbConfig.msgIDs[i].net3gpp.fromMsgId = atoi(mid_tok); respGetCbConfig.cbConfig.msgIDs[i].net3gpp.toMsgId = atoi(mid_tok); } } } - }else { - if (mode == 1) { - respGetCbConfig.cbConfig.msgIdRangeCount = 1; - respGetCbConfig.cbConfig.msgIDs[0].net3gpp.fromMsgId = 0x0000; - respGetCbConfig.cbConfig.msgIDs[0].net3gpp.toMsgId = SMS_GSM_SMS_CBMI_LIST_SIZE_MAX + 1; - respGetCbConfig.cbConfig.msgIDs[0].net3gpp.selected = TRUE; - respGetCbConfig.result = SMS_SENDSMS_SUCCESS; - } else { - respGetCbConfig.cbConfig.msgIdRangeCount = 0; - respGetCbConfig.cbConfig.msgIDs[0].net3gpp.selected = FALSE; - respGetCbConfig.result = SMS_SENDSMS_SUCCESS; - } } } else { - dbg("line is NULL"); + dbg("line is NULL"); } } else { dbg("atresp->lines is NULL"); @@ -1374,30 +1414,30 @@ static void on_response_get_cb_config(TcorePending *p, int data_len, const void dbg("RESPONSE NOK"); } - tcore_user_request_send_response(ur, TRESP_SMS_GET_CB_CONFIG, sizeof(struct tresp_sms_get_cb_config), &respGetCbConfig); + tcore_user_request_send_response(ur, + TRESP_SMS_GET_CB_CONFIG, + sizeof(struct tresp_sms_get_cb_config), &respGetCbConfig); - if(tokens) + if (tokens) tcore_at_tok_free(tokens); - - return; } -static void on_response_set_cb_config(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_set_cb_config(TcorePending *pending, + int data_len, const void *data, void *user_data) { /* - Response is expected in this format - OK - or - +CMS ERROR: - */ - + * Response is expected in this format + * OK + * or + * +CMS ERROR: + */ UserRequest *ur; const TcoreATResponse *resp = data; int response = 0; const char *line = NULL; - GSList *tokens=NULL; + GSList *tokens = NULL; - struct tresp_sms_set_cb_config respSetCbConfig = {0,}; + struct tresp_sms_set_cb_config respSetCbConfig = {0, }; memset(&respSetCbConfig, 0, sizeof(struct tresp_sms_set_cb_config)); @@ -1408,36 +1448,38 @@ static void on_response_set_cb_config(TcorePending *pending, int data_len, const dbg("RESPONSE OK"); } else { dbg("RESPONSE NOK"); - line = (const char*)resp->final_response; + line = (const char *)resp->final_response; tokens = tcore_at_tok_new(line); if (g_slist_length(tokens) < 1) { - dbg("err cause not specified or string corrupted"); - respSetCbConfig.result = SMS_DEVICE_FAILURE; + dbg("err cause not specified or string corrupted"); + respSetCbConfig.result = SMS_DEVICE_FAILURE; } else { response = atoi(g_slist_nth_data(tokens, 0)); dbg("response is %d", response); /* TODO: CMEE error mapping is required. */ - respSetCbConfig.result = SMS_DEVICE_FAILURE; + respSetCbConfig.result = SMS_DEVICE_FAILURE; } } + if (!ur) { dbg("no user_request"); return; } - tcore_user_request_send_response(ur, TRESP_SMS_SET_CB_CONFIG, sizeof(struct tresp_sms_set_cb_config), &respSetCbConfig); + tcore_user_request_send_response(ur, + TRESP_SMS_SET_CB_CONFIG, + sizeof(struct tresp_sms_set_cb_config), &respSetCbConfig); - if(tokens) + if (tokens) tcore_at_tok_free(tokens); - - return; } -static void on_response_set_mem_status(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_set_mem_status(TcorePending *p, + int data_len, const void *data, void *user_data) { UserRequest *ur; - struct tresp_sms_set_mem_status respSetMemStatus = {0,}; + struct tresp_sms_set_mem_status respSetMemStatus = {0, }; const TcoreATResponse *resp = data; memset(&respSetMemStatus, 0, sizeof(struct tresp_sms_set_mem_status)); @@ -1456,12 +1498,13 @@ static void on_response_set_mem_status(TcorePending *p, int data_len, const void return; } - tcore_user_request_send_response(ur, TRESP_SMS_SET_MEM_STATUS, sizeof(struct tresp_sms_set_mem_status), &respSetMemStatus); - - return; + tcore_user_request_send_response(ur, + TRESP_SMS_SET_MEM_STATUS, + sizeof(struct tresp_sms_set_mem_status), &respSetMemStatus); } -static void on_response_set_msg_status(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_set_msg_status(TcorePending *pending, + int data_len, const void *data, void *user_data) { UserRequest *ur; struct tresp_sms_set_msg_status respMsgStatus = {0, }; @@ -1482,20 +1525,19 @@ static void on_response_set_msg_status(TcorePending *pending, int data_len, cons dbg("RESPONSE OK"); if (atResp->lines) { - line = (const char *) atResp->lines->data; + line = (const char *)atResp->lines->data; tokens = tcore_at_tok_new(line); pResp = g_slist_nth_data(tokens, 0); - if (pResp != NULL) { + if (pResp != NULL) sw1 = atoi(pResp); - } else { + else dbg("sw1 is NULL"); - } + pResp = g_slist_nth_data(tokens, 1); if (pResp != NULL) { sw2 = atoi(pResp); - if ((sw1 == AT_SW1_SUCCESS) && (sw2 == 0)) { + if ((sw1 == AT_SW1_SUCCESS) && (sw2 == 0)) respMsgStatus.result = SMS_SENDSMS_SUCCESS; - } } else { dbg("sw2 is NULL"); } @@ -1512,16 +1554,18 @@ static void on_response_set_msg_status(TcorePending *pending, int data_len, cons dbg("RESPONSE NOK"); } - tcore_user_request_send_response(ur, TRESP_SMS_SET_MSG_STATUS , sizeof(struct tresp_sms_set_msg_status), &respMsgStatus); + tcore_user_request_send_response(ur, + TRESP_SMS_SET_MSG_STATUS, + sizeof(struct tresp_sms_set_msg_status), &respMsgStatus); - if(tokens) + if (tokens) tcore_at_tok_free(tokens); dbg("Exit"); - return; } -static void on_response_get_sms_params(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_get_sms_params(TcorePending *pending, + int data_len, const void *data, void *user_data) { UserRequest *ur; struct tresp_sms_get_params respGetParams ; @@ -1529,10 +1573,10 @@ static void on_response_get_sms_params(TcorePending *pending, int data_len, cons int sw1 = 0, sw2 = 0; const char *line = NULL; char *pResp = NULL; - GSList *tokens=NULL; - char *hexData = NULL; - char *recordData = NULL; - int i = 0; + GSList *tokens = NULL; + char *hexData = NULL; + char *recordData = NULL; + int i = 0; memset(&respGetParams, 0, sizeof(struct tresp_sms_get_params)); respGetParams.result = SMS_DEVICE_FAILURE; @@ -1543,7 +1587,7 @@ static void on_response_get_sms_params(TcorePending *pending, int data_len, cons dbg("RESPONSE OK"); if (atResp->lines) { - line = (const char *) atResp->lines->data; + line = (const char *)atResp->lines->data; tokens = tcore_at_tok_new(line); pResp = g_slist_nth_data(tokens, 0); if (pResp != NULL) { @@ -1556,29 +1600,29 @@ static void on_response_get_sms_params(TcorePending *pending, int data_len, cons if (pResp != NULL) { sw2 = atoi(pResp); dbg("sw2 is %d", sw2); - if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) { + if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) respGetParams.result = SMS_SENDSMS_SUCCESS; - } } else { dbg("sw2 is NULL"); } pResp = g_slist_nth_data(tokens, 2); if (pResp != NULL) { - hexData = util_removeQuotes(pResp); - - recordData = util_hexStringToBytes(hexData); - util_hex_dump(" ", strlen(hexData) / 2, recordData); + hexData = tcore_at_tok_extract(pResp); + if (hexData) { + recordData = util_hexStringToBytes(hexData); + tcore_util_hex_dump(" ", strlen(hexData) / 2, recordData); - respGetParams.paramsInfo.recordLen = strlen(hexData) / 2; + respGetParams.paramsInfo.recordLen = strlen(hexData) / 2; - util_sms_decode_smsParameters((unsigned char *) recordData, strlen(hexData) / 2, &(respGetParams.paramsInfo)); - respGetParams.result = SMS_SENDSMS_SUCCESS; + util_sms_decode_smsParameters((unsigned char *)recordData, strlen(hexData) / 2, &(respGetParams.paramsInfo)); + respGetParams.result = SMS_SENDSMS_SUCCESS; - for (i = 0; i < (int) respGetParams.paramsInfo.tpSvcCntrAddr.dialNumLen; i++) - dbg("SCAddr = %d [%02x]", i, respGetParams.paramsInfo.tpSvcCntrAddr.diallingNum[i]); + for (i = 0; i < (int) respGetParams.paramsInfo.tpSvcCntrAddr.dialNumLen; i++) + dbg("SCAddr = %d [%02x]", i, respGetParams.paramsInfo.tpSvcCntrAddr.diallingNum[i]); - g_free(recordData); - g_free(hexData); + g_free(recordData); + g_free(hexData); + } } else { dbg("No response"); } @@ -1588,21 +1632,23 @@ static void on_response_get_sms_params(TcorePending *pending, int data_len, cons dbg("RESPONSE NOK"); } - tcore_user_request_send_response(ur, TRESP_SMS_GET_PARAMS, sizeof(struct tresp_sms_get_params), &respGetParams); + tcore_user_request_send_response(ur, + TRESP_SMS_GET_PARAMS, + sizeof(struct tresp_sms_get_params), &respGetParams); dbg("Exit"); - return; } -static void on_response_set_sms_params(TcorePending *pending, int data_len, const void *data, void *user_data) +static void on_response_set_sms_params(TcorePending *pending, + int data_len, const void *data, void *user_data) { UserRequest *ur; struct tresp_sms_set_params respSetParams = {0, }; const TcoreATResponse *atResp = data; - int sw1 =0 , sw2 = 0; + int sw1 = 0, sw2 = 0; const char *line = NULL; char *pResp = NULL; - GSList *tokens=NULL; + GSList *tokens = NULL; memset(&respSetParams, 0, sizeof(struct tresp_sms_set_params)); @@ -1614,21 +1660,19 @@ static void on_response_set_sms_params(TcorePending *pending, int data_len, cons dbg("RESPONSE OK"); if (atResp->lines) { - line = (const char *) atResp->lines->data; + line = (const char *)atResp->lines->data; tokens = tcore_at_tok_new(line); pResp = g_slist_nth_data(tokens, 0); - if (pResp != NULL) { + if (pResp != NULL) sw1 = atoi(pResp); - } else { + else dbg("sw1 is NULL"); - } pResp = g_slist_nth_data(tokens, 1); if (pResp != NULL) { sw2 = atoi(pResp); - if (((sw1 == AT_SW1_SUCCESS) && (sw2 == AT_SW2_SUCCESS)) || (sw1 == 0x91)) { + if (((sw1 == AT_SW1_SUCCESS) && (sw2 == AT_SW2_SUCCESS)) || (sw1 == 0x91)) respSetParams.result = SMS_SENDSMS_SUCCESS; - } } else { dbg("sw2 is NULL"); } @@ -1639,25 +1683,27 @@ static void on_response_set_sms_params(TcorePending *pending, int data_len, cons dbg("RESPONSE NOK"); } - tcore_user_request_send_response(ur, TRESP_SMS_SET_PARAMS , sizeof(struct tresp_sms_set_params), &respSetParams); + tcore_user_request_send_response(ur, + TRESP_SMS_SET_PARAMS, + sizeof(struct tresp_sms_set_params), &respSetParams); - if(tokens) + if (tokens) tcore_at_tok_free(tokens); dbg("Exit"); - return; } -static void on_response_get_paramcnt(TcorePending *p, int data_len, const void *data, void *user_data) +static void on_response_get_paramcnt(TcorePending *p, + int data_len, const void *data, void *user_data) { UserRequest *ur = NULL; struct tresp_sms_get_paramcnt respGetParamCnt = {0, }; const TcoreATResponse *atResp = data; - char *line = NULL , *pResp = NULL; - int sw1 = 0 , sw2 = 0, *smsp_record_len = NULL; + char *line = NULL, *pResp = NULL; + int sw1 = 0, sw2 = 0, *smsp_record_len = NULL; int sim_type = 0; - GSList *tokens=NULL; - CoreObject *co_sim = NULL; //need this to get the sim type GSM/USIM + GSList *tokens = NULL; + CoreObject *co_sim = NULL; /* need this to get the sim type GSM/USIM */ TcorePlugin *plugin = NULL; dbg("Entry"); @@ -1669,23 +1715,22 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * dbg("RESPONSE OK"); if (atResp->lines) { - line = (char *) atResp->lines->data; + line = (char *)atResp->lines->data; dbg("line is %s", line); tokens = tcore_at_tok_new(line); pResp = g_slist_nth_data(tokens, 0); - if (pResp != NULL) { + if (pResp != NULL) sw1 = atoi(pResp); - } else { + else dbg("sw1 is NULL"); - } + pResp = g_slist_nth_data(tokens, 1); if (pResp != NULL) { sw2 = atoi(pResp); - if ((sw1 == 144) && (sw2 == 0)) { + if ((sw1 == 144) && (sw2 == 0)) respGetParamCnt.result = SMS_SENDSMS_SUCCESS; - } } else { dbg("sw2 is NULL"); } @@ -1693,11 +1738,11 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * if (pResp != NULL) { char *hexData = NULL; char *recordData = NULL; - hexData = util_removeQuotes(pResp); + hexData = tcore_at_tok_extract(pResp); /*1. SIM access success case*/ if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) { - unsigned char tag_len = 0; /* 1 or 2 bytes ??? */ + unsigned char tag_len = 0; /* 1 or 2 bytes ??? */ int record_len = 0; char num_of_records = 0; unsigned char file_id_len = 0; @@ -1707,34 +1752,39 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * unsigned short arr_file_id = 0; int arr_file_id_rec_num = 0; - /* handling only last 3 bits */ + /* handling only last 3 bits */ unsigned char file_type_tag = 0x07; unsigned char *ptr_data; recordData = util_hexStringToBytes(hexData); - util_hex_dump(" ", strlen(hexData)/2, recordData); + if (!recordData) { + err("util_hexStringToBytes Failed!!"); + tcore_at_tok_free(tokens); + return; + } + tcore_util_hex_dump(" ", strlen(hexData)/2, recordData); ptr_data = (unsigned char *)recordData; co_sim = tcore_plugin_ref_core_object(tcore_pending_ref_plugin(p), CORE_OBJECT_TYPE_SIM); sim_type = tcore_sim_get_type(co_sim); - dbg("sim type is %d",sim_type); + dbg("sim type is %d", sim_type); if (sim_type == SIM_TYPE_USIM) { /* - ETSI TS 102 221 v7.9.0 - - Response Data - '62' FCP template tag - - Response for an EF - '82' M File Descriptor - '83' M File Identifier - 'A5' O Proprietary information - '8A' M Life Cycle Status Integer - '8B', '8C' or 'AB' C1 Security attributes - '80' M File size - '81' O Total file size - '88' O Short File Identifier (SFI) - */ + * ETSI TS 102 221 v7.9.0 + * - Response Data + * '62' FCP template tag + * - Response for an EF + * '82' M File Descriptor + * '83' M File Identifier + * 'A5' O Proprietary information + * '8A' M Life Cycle Status Integer + * '8B', '8C' or 'AB' C1 Security attributes + * '80' M File size + * '81' O Total file size + * '88' O Short File Identifier (SFI) + */ /* rsim.res_len has complete data length received */ @@ -1745,19 +1795,22 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * ptr_data++; tag_len = *ptr_data++; dbg("tag_len: [%d]", tag_len); + /* FCP file descriptor - file type, accessibility, DF, ADF etc*/ if (*ptr_data == 0x82) { - /* increment to next byte */ - ptr_data++; - /*2 or 5 value*/ - ptr_data++; - /* unsigned char file_desc_len = *ptr_data++;*/ - /* dbg("file descriptor length: [%d]", file_desc_len);*/ - /* TBD: currently capture only file type : ignore sharable, non sharable, working, internal etc*/ - /* consider only last 3 bits*/ - file_type_tag = file_type_tag & (*ptr_data); + /* increment to next byte */ + ptr_data++; - switch (file_type_tag) { + /*2 or 5 value*/ + ptr_data++; + + /* unsigned char file_desc_len = *ptr_data++;*/ + /* dbg("file descriptor length: [%d]", file_desc_len);*/ + /* TBD: currently capture only file type : ignore sharable, non sharable, working, internal etc*/ + /* consider only last 3 bits*/ + file_type_tag = file_type_tag & (*ptr_data); + + switch (file_type_tag) { /* increment to next byte */ ptr_data++; @@ -1765,45 +1818,53 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * dbg("Getting FileType: [Transparent file type]"); /* increment to next byte */ ptr_data++; - file_type = 0x01; //SIM_FTYPE_TRANSPARENT - /* data coding byte - value 21 */ + file_type = 0x01; /* SIM_FTYPE_TRANSPARENT */ + + /* data coding byte - value 21 */ ptr_data++; - break; + break; case 0x2: dbg("Getting FileType: [Linear fixed file type]"); /* increment to next byte */ ptr_data++; - /* data coding byte - value 21 */ + + /* data coding byte - value 21 */ ptr_data++; - /* 2bytes */ + + /* 2bytes */ memcpy(&record_len, ptr_data, 2); + /* swap bytes */ record_len = SMS_SWAPBYTES16(record_len); ptr_data = ptr_data + 2; num_of_records = *ptr_data++; + /* Data lossy conversation from enum (int) to unsigned char */ - file_type = 0x02; // SIM_FTYPE_LINEAR_FIXED - break; + file_type = 0x02; /* SIM_FTYPE_LINEAR_FIXED */ + break; case 0x6: dbg(" Cyclic fixed file type"); /* increment to next byte */ ptr_data++; - /* data coding byte - value 21 */ + + /* data coding byte - value 21 */ ptr_data++; - /* 2bytes */ + + /* 2bytes */ memcpy(&record_len, ptr_data, 2); + /* swap bytes */ record_len = SMS_SWAPBYTES16(record_len); ptr_data = ptr_data + 2; num_of_records = *ptr_data++; - file_type = 0x04; //SIM_FTYPE_CYCLIC - break; + file_type = 0x04; /* SIM_FTYPE_CYCLIC */ + break; default: dbg("not handled file type [0x%x]", *ptr_data); - break; + break; } } else { dbg("INVALID FCP received - DEbug!"); @@ -1813,13 +1874,18 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * return; } - /*File identifier - file id?? */ // 0x84,0x85,0x86 etc are currently ignored and not handled + /* + * File identifier - file id?? + * + * 0x84, 0x85, 0x86 etc are currently ignored and not handled + */ if (*ptr_data == 0x83) { /* increment to next byte */ ptr_data++; file_id_len = *ptr_data++; memcpy(&file_id, ptr_data, file_id_len); - /* swap bytes */ + + /* swap bytes */ file_id = SMS_SWAPBYTES16(file_id); ptr_data = ptr_data + 2; dbg("Getting FileID=[0x%x]", file_id); @@ -1831,13 +1897,15 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * return; } - /* proprietary information */ + /* proprietary information */ if (*ptr_data == 0xA5) { unsigned short prop_len; /* increment to next byte */ ptr_data++; + /* length */ prop_len = *ptr_data; + /* skip data */ ptr_data = ptr_data + prop_len + 1; } else { @@ -1846,15 +1914,15 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * /* life cycle status integer [8A][length:0x01][status]*/ /* - status info b8~b1 - 00000000 : No information given - 00000001 : creation state - 00000011 : initialization state - 000001-1 : operation state -activated - 000001-0 : operation state -deactivated - 000011-- : Termination state - b8~b5 !=0, b4~b1=X : Proprietary - Any other value : RFU + * status info b8~b1 + * 00000000 : No information given + * 00000001 : creation state + * 00000011 : initialization state + * 000001-1 : operation state -activated + * 000001-0 : operation state -deactivated + * 000011-- : Termination state + * b8~b5 !=0, b4~b1=X : Proprietary + * Any other value : RFU */ if (*ptr_data == 0x8A) { /* increment to next byte */ @@ -1863,22 +1931,22 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * ptr_data++; switch (*ptr_data) { - case 0x04: - case 0x06: - dbg("[RX] Operation State: DEACTIVATED"); - ptr_data++; - break; - - case 0x05: - case 0x07: - dbg("[RX] Operation State: ACTIVATED"); - ptr_data++; - break; - - default: - dbg("[RX] DEBUG! LIFE CYCLE STATUS: [0x%x]",*ptr_data); - ptr_data++; - break; + case 0x04: + case 0x06: + dbg("[RX] Operation State: DEACTIVATED"); + ptr_data++; + break; + + case 0x05: + case 0x07: + dbg("[RX] Operation State: ACTIVATED"); + ptr_data++; + break; + + default: + dbg("[RX] DEBUG! LIFE CYCLE STATUS: [0x%x]", *ptr_data); + ptr_data++; + break; } } @@ -1886,12 +1954,15 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * if (*ptr_data == 0x86 || *ptr_data == 0x8B || *ptr_data == 0x8C || *ptr_data == 0xAB) { /* increment to next byte */ ptr_data++; + /* if tag length is 3 */ if (*ptr_data == 0x03) { /* increment to next byte */ ptr_data++; + /* EFARR file id */ memcpy(&arr_file_id, ptr_data, 2); + /* swap byes */ arr_file_id = SMS_SWAPBYTES16(arr_file_id); ptr_data = ptr_data + 2; @@ -1900,7 +1971,6 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * } else { /* if tag length is not 3 */ /* ignoring bytes */ - // ptr_data = ptr_data + 4; dbg("Useless security attributes, so jump to next tag"); ptr_data = ptr_data + (*ptr_data + 1); } @@ -1916,14 +1986,17 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * /* file size excluding structural info*/ if (*ptr_data == 0x80) { - /* for EF file size is body of file and for Linear or cyclic it is + /* + * for EF file size is body of file and for Linear or cyclic it is * number of recXsizeof(one record) */ /* increment to next byte */ ptr_data++; + /* length is 1 byte - value is 2 bytes or more */ ptr_data++; memcpy(&file_size, ptr_data, 2); + /* swap bytes */ file_size = SMS_SWAPBYTES16(file_size); ptr_data = ptr_data + 2; @@ -1940,9 +2013,11 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * int len; /* increment to next byte */ ptr_data++; + /* length */ len = *ptr_data; dbg("len: [%d]", len); + /* ignored bytes */ ptr_data = ptr_data + 3; } else { @@ -1964,96 +2039,108 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * } } else if (sim_type == SIM_TYPE_GSM) { unsigned char gsm_specific_file_data_len = 0; - /* ignore RFU byte1 and byte2 */ + /* ignore RFU byte1 and byte2 */ ptr_data++; ptr_data++; - /* file size */ - //file_size = p_info->response_len; + + /* file size */ memcpy(&file_size, ptr_data, 2); + /* swap bytes */ file_size = SMS_SWAPBYTES16(file_size); - /* parsed file size */ + + /* parsed file size */ ptr_data = ptr_data + 2; + /* file id */ memcpy(&file_id, ptr_data, 2); file_id = SMS_SWAPBYTES16(file_id); dbg(" FILE id --> [%x]", file_id); ptr_data = ptr_data + 2; + /* save file type - transparent, linear fixed or cyclic */ file_type_tag = (*(ptr_data + 7)); switch (*ptr_data) { - case 0x0: - /* RFU file type */ - dbg(" RFU file type- not handled - Debug!"); - break; + case 0x0: + /* RFU file type */ + dbg(" RFU file type- not handled - Debug!"); + break; - case 0x1: - /* MF file type */ - dbg(" MF file type - not handled - Debug!"); - break; + case 0x1: + /* MF file type */ + dbg(" MF file type - not handled - Debug!"); + break; - case 0x2: - /* DF file type */ - dbg(" DF file type - not handled - Debug!"); - break; + case 0x2: + /* DF file type */ + dbg(" DF file type - not handled - Debug!"); + break; - case 0x4: - /* EF file type */ - dbg(" EF file type [%d] ", file_type_tag); - /* increment to next byte */ - ptr_data++; + case 0x4: + /* EF file type */ + dbg(" EF file type [%d] ", file_type_tag); + /* increment to next byte */ + ptr_data++; - if (file_type_tag == 0x00 || file_type_tag == 0x01) { - /* increament to next byte as this byte is RFU */ - ptr_data++; - file_type = - (file_type_tag == 0x00) ? 0x01 : 0x02; // SIM_FTYPE_TRANSPARENT:SIM_FTYPE_LINEAR_FIXED; - } else { - /* increment to next byte */ - ptr_data++; - /* For a cyclic EF all bits except bit 7 are RFU; b7=1 indicates that */ - /* the INCREASE command is allowed on the selected cyclic file. */ - file_type = 0x04; // SIM_FTYPE_CYCLIC; - } - /* bytes 9 to 11 give SIM file access conditions */ - ptr_data++; - /* byte 10 has one nibble that is RF U and another for INCREASE which is not used currently */ - ptr_data++; - /* byte 11 is invalidate and rehabilate nibbles */ - ptr_data++; - /* byte 12 - file status */ + if (file_type_tag == 0x00 || file_type_tag == 0x01) { + /* increament to next byte as this byte is RFU */ ptr_data++; - /* byte 13 - GSM specific data */ - gsm_specific_file_data_len = *ptr_data; - dbg("gsm_specific_file_data_len: [%d]", gsm_specific_file_data_len); - ptr_data++; - /* byte 14 - structure of EF - transparent or linear or cyclic , already saved above */ + file_type = (file_type_tag == 0x00) ? 0x01 : 0x02; /* SIM_FTYPE_TRANSPARENT:SIM_FTYPE_LINEAR_FIXED; */ + } else { + /* increment to next byte */ ptr_data++; - /* byte 15 - length of record for linear and cyclic , for transparent it is set to 0x00. */ - record_len = *ptr_data; - dbg("record length[%d], file size[%d]", record_len, file_size); - if (record_len != 0) - num_of_records = (file_size / record_len); + /* For a cyclic EF all bits except bit 7 are RFU; b7=1 indicates that */ + /* the INCREASE command is allowed on the selected cyclic file. */ + file_type = 0x04; /* SIM_FTYPE_CYCLIC; */ + } + + /* bytes 9 to 11 give SIM file access conditions */ + ptr_data++; - dbg("Number of records [%d]", num_of_records); - break; + /* byte 10 has one nibble that is RF U and another for INCREASE which is not used currently */ + ptr_data++; - default: - dbg(" not handled file type"); - break; + /* byte 11 is invalidate and rehabilate nibbles */ + ptr_data++; + + /* byte 12 - file status */ + ptr_data++; + + /* byte 13 - GSM specific data */ + gsm_specific_file_data_len = *ptr_data; + dbg("gsm_specific_file_data_len: [%d]", gsm_specific_file_data_len); + ptr_data++; + + /* byte 14 - structure of EF - transparent or linear or cyclic, already saved above */ + ptr_data++; + + /* byte 15 - length of record for linear and cyclic, for transparent it is set to 0x00. */ + record_len = *ptr_data; + dbg("record length[%d], file size[%d]", record_len, file_size); + + if (record_len != 0) + num_of_records = (file_size / record_len); + + dbg("Number of records [%d]", num_of_records); + break; + + default: + dbg(" not handled file type"); + break; } } else { dbg(" Card Type - UNKNOWN [%d]", sim_type); } - dbg("EF[0x%x] size[%ld] Type[0x%x] NumOfRecords[%ld] RecordLen[%ld]", file_id, file_size, file_type, num_of_records, record_len); + dbg("EF[0x%x] size[%ld] Type[0x%x] NumOfRecords[%ld] RecordLen[%ld]", + file_id, file_size, file_type, num_of_records, record_len); respGetParamCnt.recordCount = num_of_records; respGetParamCnt.result = SMS_SUCCESS; - //TO Store smsp record length in the property + /* TO Store smsp record length in the property */ plugin = tcore_pending_ref_plugin(p); smsp_record_len = tcore_plugin_ref_property(plugin, "SMSPRECORDLEN"); memcpy(smsp_record_len, &record_len, sizeof(int)); @@ -2075,9 +2162,11 @@ static void on_response_get_paramcnt(TcorePending *p, int data_len, const void * dbg("RESPONSE NOK"); } - tcore_user_request_send_response(ur, TRESP_SMS_GET_PARAMCNT, sizeof(struct tresp_sms_get_paramcnt), &respGetParamCnt); + tcore_user_request_send_response(ur, + TRESP_SMS_GET_PARAMCNT, + sizeof(struct tresp_sms_get_paramcnt), &respGetParamCnt); - if(tokens) + if (tokens) tcore_at_tok_free(tokens); dbg("Exit"); @@ -2088,14 +2177,14 @@ static void _response_get_efsms_data(TcorePending *p, int data_len, const void * { UserRequest *ur = NULL; UserRequest *dup_ur = NULL; - struct tresp_sms_set_msg_status resp_msg_status = {0,}; + struct tresp_sms_set_msg_status resp_msg_status = {0, }; const struct treq_sms_set_msg_status *req_msg_status = NULL ; const TcoreATResponse *resp = data; char *encoded_data = NULL; char msg_status = 0; char *pResp = NULL; - GSList *tokens=NULL; + GSList *tokens = NULL; const char *line = NULL; int sw1 = 0; int sw2 = 0; @@ -2114,110 +2203,112 @@ static void _response_get_efsms_data(TcorePending *p, int data_len, const void * hal = tcore_object_get_hal(tcore_pending_ref_core_object(pending)); dbg("msgStatus: [%x], index [%x]", req_msg_status->msgStatus, req_msg_status->index); - if (resp->success <= 0) { + if (resp->success <= 0) goto OUT; - } - { - dbg("RESPONSE OK"); - if (resp->lines) { - line = (const char *) resp->lines->data; - tokens = tcore_at_tok_new(line); - if (g_slist_length(tokens) != 3) { - msg("invalid message"); - goto OUT; - } + dbg("RESPONSE OK"); + if (resp->lines) { + line = (const char *)resp->lines->data; + tokens = tcore_at_tok_new(line); + if (g_slist_length(tokens) != 3) { + msg("invalid message"); + goto OUT; } - sw1 = atoi(g_slist_nth_data(tokens, 0)); - sw2 = atoi(g_slist_nth_data(tokens, 1)); - pResp = g_slist_nth_data(tokens, 2); - - if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) { - switch (req_msg_status->msgStatus) { - case SMS_STATUS_READ: - msg_status = 0x01; - break; - - case SMS_STATUS_UNREAD: - msg_status = 0x03; - break; - - case SMS_STATUS_UNSENT: - msg_status = 0x07; - break; - - case SMS_STATUS_SENT: - msg_status = 0x05; - break; - - case SMS_STATUS_DELIVERED: - msg_status = 0x1D; - break; - - case SMS_STATUS_DELIVERY_UNCONFIRMED: - msg_status = 0xD; - break; - - case SMS_STATUS_MESSAGE_REPLACED: - case SMS_STATUS_RESERVED: - default: - msg_status = 0x03; - break; - } + } + sw1 = atoi(g_slist_nth_data(tokens, 0)); + sw2 = atoi(g_slist_nth_data(tokens, 1)); + pResp = g_slist_nth_data(tokens, 2); - encoded_data = util_removeQuotes(pResp); + if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) { + switch (req_msg_status->msgStatus) { + case SMS_STATUS_READ: + msg_status = 0x01; + break; - //overwrite Status byte information - util_byte_to_hex((const char *)&msg_status, (char *)encoded_data, 1); + case SMS_STATUS_UNREAD: + msg_status = 0x03; + break; - //Update EF-SMS with just status byte overwritten, rest 175 bytes are same as received in read information - cmd_str = g_strdup_printf("AT+CRSM=220,28476,%d, 4, %d, \"%s\"", (req_msg_status->index+1), PDU_LEN_MAX, encoded_data); - atreq = tcore_at_request_new((const char *)cmd_str, "+CRSM", TCORE_AT_SINGLELINE); - pending = tcore_pending_new(tcore_pending_ref_core_object(pending), 0); - if (NULL == cmd_str || NULL == atreq || NULL == pending) { - err("Out of memory. Unable to proceed"); - dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); + case SMS_STATUS_UNSENT: + msg_status = 0x07; + break; - //free memory we own - g_free(cmd_str); - g_free(encoded_data); - util_sms_free_memory(atreq); - util_sms_free_memory(pending); + case SMS_STATUS_SENT: + msg_status = 0x05; + break; - goto OUT; - } + case SMS_STATUS_DELIVERED: + msg_status = 0x1D; + break; - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + case SMS_STATUS_DELIVERY_UNCONFIRMED: + msg_status = 0xD; + break; - dup_ur = tcore_user_request_ref(ur); + case SMS_STATUS_MESSAGE_REPLACED: + case SMS_STATUS_RESERVED: + default: + msg_status = 0x03; + break; + } - tcore_pending_set_request_data(pending, 0, atreq); - tcore_pending_set_response_callback(pending, on_response_set_msg_status, NULL); - tcore_pending_link_user_request(pending, dup_ur); - tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); - tcore_hal_send_request(hal, pending); + encoded_data = tcore_at_tok_extract(pResp); + if (!encoded_data) { + err("Encoded data is NULL"); + goto OUT; + } + + /* Overwrite Status byte information */ + util_byte_to_hex((const char *)&msg_status, (char *)encoded_data, 1); + + /* Update EF-SMS with just status byte overwritten, rest 175 bytes are same as received in read information */ + cmd_str = g_strdup_printf("AT+CRSM=220, 28476, %d, 4, %d, \"%s\"", (req_msg_status->index+1), PDU_LEN_MAX, encoded_data); + atreq = tcore_at_request_new((const char *)cmd_str, "+CRSM", TCORE_AT_SINGLELINE); + pending = tcore_pending_new(tcore_pending_ref_core_object(pending), 0); + if (NULL == cmd_str || NULL == atreq || NULL == pending) { + err("Out of memory. Unable to proceed"); + dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); g_free(cmd_str); g_free(encoded_data); + util_sms_free_memory(atreq); + util_sms_free_memory(pending); - resp_msg_status.result = SMS_SENDSMS_SUCCESS; + goto OUT; } + + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + + dup_ur = tcore_user_request_ref(ur); + + tcore_pending_set_request_data(pending, 0, atreq); + tcore_pending_set_response_callback(pending, on_response_set_msg_status, NULL); + tcore_pending_link_user_request(pending, dup_ur); + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + tcore_hal_send_request(hal, pending); + + g_free(cmd_str); + g_free(encoded_data); + + resp_msg_status.result = SMS_SENDSMS_SUCCESS; } OUT: - if(tokens) + if (tokens) tcore_at_tok_free(tokens); - tcore_user_request_send_response(ur, TRESP_SMS_SET_MSG_STATUS , sizeof(struct tresp_sms_set_msg_status), &resp_msg_status); + tcore_user_request_send_response(ur, + TRESP_SMS_SET_MSG_STATUS, + sizeof(struct tresp_sms_set_msg_status), &resp_msg_status); dbg("Exit"); return; } -/*============================================================= - Requests -==============================================================*/ +/* + * Requests + */ static TReturn send_umts_msg(CoreObject *co_sms, UserRequest *ur) { const struct treq_sms_send_msg *send_msg; @@ -2260,7 +2351,7 @@ static TReturn send_umts_msg(CoreObject *co_sms, UserRequest *ur) pdu_byte_len = __util_sms_encode_pdu(sca_byte_data, tpdu_byte_data, tpdu_byte_len, pdu); - pdu_hex_len = (int) __util_sms_encode_hex((unsigned char *) pdu, + pdu_hex_len = (int) __util_sms_encode_hex((unsigned char *)pdu, pdu_byte_len, buf); dbg("PDU hexadecimal length: [%d]", pdu_hex_len); @@ -2318,13 +2409,13 @@ static TReturn read_msg(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } dbg("index: [%d]", readMsg->index); - cmd_str = g_strdup_printf("AT+CMGR=%d", readMsg->index); //IMC index is one ahead of TAPI + cmd_str = g_strdup_printf("AT+CMGR=%d", readMsg->index); atreq = tcore_at_request_new((const char *)cmd_str, "+CMGR", TCORE_AT_PDU); pending = tcore_pending_new(obj, 0); @@ -2332,7 +2423,6 @@ static TReturn read_msg(CoreObject *obj, UserRequest *ur) err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2341,10 +2431,10 @@ static TReturn read_msg(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); - tcore_pending_set_response_callback(pending, on_response_read_msg, (void *)(uintptr_t)(readMsg->index)); //storing index as user data for response + tcore_pending_set_response_callback(pending, on_response_read_msg, (void *)(uintptr_t)(readMsg->index)); /* storing index as user data for response */ tcore_pending_link_user_request(pending, ur); tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); tcore_hal_send_request(hal, pending); @@ -2363,7 +2453,7 @@ static TReturn save_msg(CoreObject *obj, UserRequest *ur) TcorePending *pending = NULL; const struct treq_sms_save_msg *saveMsg = NULL; int ScLength = 0, pdu_len = 0, stat = 0; - char buf[2*(SMS_SMSP_ADDRESS_LEN+SMS_SMDATA_SIZE_MAX)+1] = {0}; + char buf[2 * (SMS_SMSP_ADDRESS_LEN + SMS_SMDATA_SIZE_MAX) + 1] = {0}; char *hex_pdu = NULL; dbg("Entry"); @@ -2377,36 +2467,36 @@ static TReturn save_msg(CoreObject *obj, UserRequest *ur) dbg("Exit"); return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } dbg("msgStatus: %x, msgLength: [%d]", saveMsg->msgStatus, saveMsg->msgDataPackage.msgLength); - util_hex_dump(" ", (SMS_SMDATA_SIZE_MAX+1), (void *)saveMsg->msgDataPackage.tpduData); - util_hex_dump(" ", SMS_SMSP_ADDRESS_LEN, (void *)saveMsg->msgDataPackage.sca); + tcore_util_hex_dump(" ", (SMS_SMDATA_SIZE_MAX+1), (void *)saveMsg->msgDataPackage.tpduData); + tcore_util_hex_dump(" ", SMS_SMSP_ADDRESS_LEN, (void *)saveMsg->msgDataPackage.sca); switch (saveMsg->msgStatus) { - case SMS_STATUS_READ: - stat = AT_REC_READ; - break; + case SMS_STATUS_READ: + stat = AT_REC_READ; + break; - case SMS_STATUS_UNREAD: - stat = AT_REC_UNREAD; - break; + case SMS_STATUS_UNREAD: + stat = AT_REC_UNREAD; + break; - case SMS_STATUS_SENT: - stat = AT_STO_SENT; - break; + case SMS_STATUS_SENT: + stat = AT_STO_SENT; + break; - case SMS_STATUS_UNSENT: - stat = AT_STO_UNSENT; - break; + case SMS_STATUS_UNSENT: + stat = AT_STO_UNSENT; + break; - default: - err("Invalid msgStatus"); - dbg("Exit"); - return TCORE_RETURN_EINVAL; + default: + err("Invalid msgStatus"); + dbg("Exit"); + return TCORE_RETURN_EINVAL; } if ((saveMsg->msgDataPackage.msgLength > 0) @@ -2416,34 +2506,32 @@ static TReturn save_msg(CoreObject *obj, UserRequest *ur) buf[0] = ScLength; dbg("ScLength = %d", ScLength); - if(ScLength == 0) { + if (ScLength == 0) buf[0] = 0; - } else { + else memcpy(&buf[1], saveMsg->msgDataPackage.sca, ScLength); - } - memcpy(&buf[ScLength+1], saveMsg->msgDataPackage.tpduData, saveMsg->msgDataPackage.msgLength); + memcpy(&buf[ScLength + 1], saveMsg->msgDataPackage.tpduData, saveMsg->msgDataPackage.msgLength); - pdu_len= saveMsg->msgDataPackage.msgLength + ScLength + 1; + pdu_len = saveMsg->msgDataPackage.msgLength + ScLength + 1; dbg("pdu_len: [%d]", pdu_len); - hex_pdu = malloc(pdu_len * 2 + 1); - util_hex_dump(" ", sizeof(buf), (void *)buf); + hex_pdu = g_malloc0(pdu_len * 2 + 1); + tcore_util_hex_dump(" ", sizeof(buf), (void *)buf); - memset (hex_pdu, 0x00, pdu_len * 2 + 1); + memset(hex_pdu, 0x00, pdu_len * 2 + 1); util_byte_to_hex((const char *)buf, (char *)hex_pdu, pdu_len); - //AT+CMGW=[,]PDU is given - cmd_str = g_strdup_printf("AT+CMGW=%d,%d%s%s\x1A", saveMsg->msgDataPackage.msgLength, stat, "\r", hex_pdu); + /* AT+CMGW=[, ]PDU is given */ + cmd_str = g_strdup_printf("AT+CMGW=%d, %d%s%s\x1A", saveMsg->msgDataPackage.msgLength, stat, "\r", hex_pdu); pending = tcore_pending_new(obj, 0); atreq = tcore_at_request_new((const char *)cmd_str, "+CMGW", TCORE_AT_SINGLELINE); - if(NULL == cmd_str || NULL == atreq || NULL == pending) { + if (NULL == cmd_str || NULL == atreq || NULL == pending) { err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2453,7 +2541,7 @@ static TReturn save_msg(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_sms_save_msg, NULL); @@ -2493,18 +2581,17 @@ static TReturn delete_msg(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } dbg("index: %d", delete_msg->index); - if (delete_msg->index == -1) { - cmd_str = g_strdup_printf("AT+CMGD=0,4"); // Delete All Messages - } else { - cmd_str = g_strdup_printf("AT+CMGD=%d,0", delete_msg->index + 1); // Delete specified index - } + if (delete_msg->index == -1) + cmd_str = g_strdup_printf("AT+CMGD=0, 4"); /* Delete All Messages */ + else + cmd_str = g_strdup_printf("AT+CMGD=%d, 0", delete_msg->index + 1); /* Delete specified index */ pending = tcore_pending_new(obj, 0); atreq = tcore_at_request_new((const char *)cmd_str, NULL, TCORE_AT_NO_RESULT); @@ -2512,7 +2599,6 @@ static TReturn delete_msg(CoreObject *obj, UserRequest *ur) err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2521,10 +2607,10 @@ static TReturn delete_msg(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); - tcore_pending_set_response_callback(pending, on_response_sms_delete_msg, (void *) (uintptr_t) (delete_msg->index)); // storing index as user data for response + tcore_pending_set_response_callback(pending, on_response_sms_delete_msg, (void *) (uintptr_t) (delete_msg->index)); /* storing index as user data for response */ tcore_pending_link_user_request(pending, ur); tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); tcore_hal_send_request(hal, pending); @@ -2552,7 +2638,7 @@ static TReturn get_stored_msg_cnt(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2565,7 +2651,6 @@ static TReturn get_stored_msg_cnt(CoreObject *obj, UserRequest *ur) err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2574,7 +2659,7 @@ static TReturn get_stored_msg_cnt(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_get_stored_msg_cnt, NULL); @@ -2590,7 +2675,7 @@ static TReturn get_stored_msg_cnt(CoreObject *obj, UserRequest *ur) static TReturn get_sca(CoreObject *obj, UserRequest *ur) { - gchar * cmd_str = NULL; + gchar *cmd_str = NULL; TcoreHal *hal = NULL; TcoreATRequest *atreq = NULL; TcorePending *pending = NULL; @@ -2604,7 +2689,7 @@ static TReturn get_sca(CoreObject *obj, UserRequest *ur) dbg("Exit"); return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2617,7 +2702,6 @@ static TReturn get_sca(CoreObject *obj, UserRequest *ur) err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2626,7 +2710,7 @@ static TReturn get_sca(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_get_sca, NULL); @@ -2660,18 +2744,18 @@ static TReturn set_sca(CoreObject *obj, UserRequest *ur) dbg("Exit"); return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } dbg("dialNumLen: %u, typeOfNum: %d, numPlanId: %d, ", setSca->scaInfo.dialNumLen, setSca->scaInfo.typeOfNum, setSca->scaInfo.numPlanId); - util_hex_dump(" ", (SMS_SMSP_ADDRESS_LEN+1), (void *)setSca->scaInfo.diallingNum); + tcore_util_hex_dump(" ", (SMS_SMSP_ADDRESS_LEN+1), (void *)setSca->scaInfo.diallingNum); addrType = ((setSca->scaInfo.typeOfNum << 4) | setSca->scaInfo.numPlanId) | 0x80; - cmd_str = g_strdup_printf("AT+CSCA=\"%s\",%d", setSca->scaInfo.diallingNum, addrType); + cmd_str = g_strdup_printf("AT+CSCA=\"%s\", %d", setSca->scaInfo.diallingNum, addrType); pending = tcore_pending_new(obj, 0); atreq = tcore_at_request_new((const char *)cmd_str, NULL, TCORE_AT_NO_RESULT); @@ -2679,7 +2763,6 @@ static TReturn set_sca(CoreObject *obj, UserRequest *ur) err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2688,7 +2771,7 @@ static TReturn set_sca(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_set_sca, NULL); @@ -2718,7 +2801,8 @@ static TReturn get_cb_config(CoreObject *obj, UserRequest *ur) dbg("Exit"); return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2730,7 +2814,6 @@ static TReturn get_cb_config(CoreObject *obj, UserRequest *ur) err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2739,7 +2822,7 @@ static TReturn get_cb_config(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_get_cb_config, NULL); @@ -2763,7 +2846,7 @@ static TReturn set_cb_config(CoreObject *obj, UserRequest *ur) TcoreATRequest *atreq = NULL; TcorePending *pending = NULL; const struct treq_sms_set_cb_config *setCbConfig = NULL; - int ctr1= 0, ctr2 =0; + int ctr1 = 0, ctr2 = 0; unsigned short appendMsgId = 0; dbg("Entry"); @@ -2777,27 +2860,28 @@ static TReturn set_cb_config(CoreObject *obj, UserRequest *ur) dbg("Exit"); return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } dbg("bCBEnabled: %d, msgIdCount: %d", setCbConfig->cbEnabled, setCbConfig->msgIdRangeCount); - if (setCbConfig->cbEnabled == 2) { //Enable all CBS + if (setCbConfig->cbEnabled == 2) { /* Enable all CBS */ cmd_str = g_strdup_printf("AT+CSCB=1"); - } else if ((setCbConfig->cbEnabled == 1) && (setCbConfig->msgIdRangeCount == 0)) { // Special case: Enable all CBS + } else if ((setCbConfig->cbEnabled == 1) && (setCbConfig->msgIdRangeCount == 0)) { /* Special case: Enable all CBS */ cmd_str = g_strdup_printf("AT+CSCB=1"); - } else if (setCbConfig->cbEnabled == 0) {//AT+CSCB=0: Disable CBS + } else if (setCbConfig->cbEnabled == 0) {/* AT+CSCB=0: Disable CBS */ cmd_str = g_strdup_printf("AT+CSCB=0"); } else { - mids_GString = g_string_new("AT+CSCB=0,\""); + mids_GString = g_string_new("AT+CSCB=0, \""); - for(ctr1 = 0; ctr1 < setCbConfig->msgIdRangeCount; ctr1++ ) { - if( setCbConfig->msgIDs[ctr1].net3gpp.selected == FALSE ) + for (ctr1 = 0; ctr1 < setCbConfig->msgIdRangeCount; ctr1++) { + if (setCbConfig->msgIDs[ctr1].net3gpp.selected == FALSE) continue; - if( SMS_GSM_SMS_CBMI_LIST_SIZE_MAX <= (setCbConfig->msgIDs[ctr1].net3gpp.toMsgId - setCbConfig->msgIDs[ctr1].net3gpp.fromMsgId) ) { + if (SMS_GSM_SMS_CBMI_LIST_SIZE_MAX <= (setCbConfig->msgIDs[ctr1].net3gpp.toMsgId - setCbConfig->msgIDs[ctr1].net3gpp.fromMsgId)) { g_string_free(mids_GString, TRUE); mids_GString = g_string_new("AT+CSCB=1"); break; @@ -2805,34 +2889,32 @@ static TReturn set_cb_config(CoreObject *obj, UserRequest *ur) appendMsgId = setCbConfig->msgIDs[ctr1].net3gpp.fromMsgId; - for( ctr2 = 0; (ctr2 <= ((setCbConfig->msgIDs[ctr1].net3gpp.toMsgId) - (setCbConfig->msgIDs[ctr1].net3gpp.fromMsgId))); ctr2++ ) { + for (ctr2 = 0; (ctr2 <= ((setCbConfig->msgIDs[ctr1].net3gpp.toMsgId) - (setCbConfig->msgIDs[ctr1].net3gpp.fromMsgId))); ctr2++) { gchar *append_str = NULL; - dbg( "%x", appendMsgId); + dbg("%x", appendMsgId); append_str = g_strdup_printf("%d", appendMsgId); g_string_append(mids_GString, append_str); g_free(append_str); - if (ctr2 == ((setCbConfig->msgIDs[ctr1].net3gpp.toMsgId) - (setCbConfig->msgIDs[ctr1].net3gpp.fromMsgId))) { - g_string_append(mids_GString, "\""); //Mids string termination - } else { - g_string_append(mids_GString, ","); - } + if (ctr2 == ((setCbConfig->msgIDs[ctr1].net3gpp.toMsgId) - (setCbConfig->msgIDs[ctr1].net3gpp.fromMsgId))) + g_string_append(mids_GString, "\""); /* Mids string termination */ + else + g_string_append(mids_GString, ", "); appendMsgId++; } - } + } mids_str = g_string_free(mids_GString, FALSE); - cmd_str = g_strdup_printf("%s", mids_str); + cmd_str = g_strdup_printf("%s", mids_str); g_free(mids_str); } pending = tcore_pending_new(obj, 0); atreq = tcore_at_request_new((const char *)cmd_str, NULL, TCORE_AT_NO_RESULT); - if(NULL == cmd_str || NULL == atreq || NULL == pending) { + if (NULL == cmd_str || NULL == atreq || NULL == pending) { err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2841,7 +2923,7 @@ static TReturn set_cb_config(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_set_cb_config, NULL); @@ -2875,15 +2957,15 @@ static TReturn set_mem_status(CoreObject *obj, UserRequest *ur) dbg("Exit"); return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } dbg("memory_status: %d", setMemStatus->memory_status); - if(setMemStatus->memory_status < SMS_PDA_MEMORY_STATUS_AVAILABLE - || setMemStatus->memory_status > SMS_PDA_MEMORY_STATUS_FULL) { + if (setMemStatus->memory_status < SMS_PDA_MEMORY_STATUS_AVAILABLE + || setMemStatus->memory_status > SMS_PDA_MEMORY_STATUS_FULL) { err("Invalid memory_status"); dbg("Exit"); @@ -2891,18 +2973,18 @@ static TReturn set_mem_status(CoreObject *obj, UserRequest *ur) } switch (setMemStatus->memory_status) { - case SMS_PDA_MEMORY_STATUS_AVAILABLE: - memoryStatus = AT_MEMORY_AVAILABLE; - break; + case SMS_PDA_MEMORY_STATUS_AVAILABLE: + memoryStatus = AT_MEMORY_AVAILABLE; + break; - case SMS_PDA_MEMORY_STATUS_FULL: - memoryStatus = AT_MEMORY_FULL; - break; + case SMS_PDA_MEMORY_STATUS_FULL: + memoryStatus = AT_MEMORY_FULL; + break; - default: - err("Invalid memory_status"); - dbg("Exit"); - return TCORE_RETURN_EINVAL; + default: + err("Invalid memory_status"); + dbg("Exit"); + return TCORE_RETURN_EINVAL; } cmd_str = g_strdup_printf("AT+XTESM=%d", memoryStatus); @@ -2913,7 +2995,6 @@ static TReturn set_mem_status(CoreObject *obj, UserRequest *ur) err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2922,7 +3003,7 @@ static TReturn set_mem_status(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_set_mem_status, NULL); @@ -2938,12 +3019,12 @@ static TReturn set_mem_status(CoreObject *obj, UserRequest *ur) static TReturn set_delivery_report(CoreObject *obj, UserRequest *ur) { - struct tresp_sms_set_delivery_report respSetDeliveryReport = {0,}; + struct tresp_sms_set_delivery_report respSetDeliveryReport = {0, }; respSetDeliveryReport.result = SMS_SUCCESS; dbg("Entry"); - if(FALSE == tcore_hal_get_power_state(tcore_object_get_hal(obj))){ + if (FALSE == tcore_hal_get_power_state(tcore_object_get_hal(obj))) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -2966,20 +3047,19 @@ static TReturn set_msg_status(CoreObject *obj, UserRequest *ur) dbg("Entry"); hal = tcore_object_get_hal(obj); - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } msg_status = tcore_user_request_ref_data(ur, NULL); - cmd_str = g_strdup_printf("AT+CRSM=178,28476,%d,4,%d", (msg_status->index+1), PDU_LEN_MAX); + cmd_str = g_strdup_printf("AT+CRSM=178, 28476, %d, 4, %d", (msg_status->index+1), PDU_LEN_MAX); atreq = tcore_at_request_new((const char *)cmd_str, "+CRSM", TCORE_AT_SINGLELINE); pending = tcore_pending_new(obj, 0); if (NULL == cmd_str || NULL == atreq || NULL == pending) { err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -2988,7 +3068,7 @@ static TReturn set_msg_status(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, _response_get_efsms_data, NULL); @@ -3009,7 +3089,7 @@ static TReturn get_sms_params(CoreObject *obj, UserRequest *ur) TcoreATRequest *atreq = NULL; TcorePending *pending = NULL; const struct treq_sms_get_params *getSmsParams = NULL; - int record_len = 0 , *smsp_record_len = NULL; + int record_len = 0, *smsp_record_len = NULL; dbg("Entry"); @@ -3022,7 +3102,8 @@ static TReturn get_sms_params(CoreObject *obj, UserRequest *ur) dbg("Exit"); return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } @@ -3031,10 +3112,10 @@ static TReturn get_sms_params(CoreObject *obj, UserRequest *ur) record_len = *smsp_record_len; dbg("record len from property %d", record_len); - //AT+CRSM=command>[,[,,,[,[,]]]] - cmd_str = g_strdup_printf("AT+CRSM=178,28482,%d,4,%d", (getSmsParams->index + 1), record_len); + /* AT+CRSM=command>[, [, , , [, [, ]]]] */ + cmd_str = g_strdup_printf("AT+CRSM=178, 28482, %d, 4, %d", (getSmsParams->index + 1), record_len); - dbg("cmd_str is %s",cmd_str); + dbg("cmd_str is %s", cmd_str); atreq = tcore_at_request_new((const char *)cmd_str, "+CRSM", TCORE_AT_SINGLELINE); pending = tcore_pending_new(obj, 0); @@ -3042,7 +3123,6 @@ static TReturn get_sms_params(CoreObject *obj, UserRequest *ur) err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -3051,7 +3131,7 @@ static TReturn get_sms_params(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_get_sms_params, NULL); @@ -3088,40 +3168,43 @@ static TReturn set_sms_params(CoreObject *obj, UserRequest *ur) dbg("setSmsParams: [%p], hal: [%p]", setSmsParams, hal); return FALSE; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } - //EFsmsp file size is 28 +Y bytes (Y is alpha id size) + /* EFsmsp file size is 28 +Y bytes (Y is alpha id size) */ smsp_record_len = tcore_plugin_ref_property(tcore_object_ref_plugin(obj), "SMSPRECORDLEN"); + if (NULL == smsp_record_len) { + err("SMSP record is NULL"); + return TCORE_RETURN_FAILURE; + } SMSPRecordLen = *smsp_record_len; if (SMSPRecordLen < nDefaultSMSPWithoutAlphaId) return FALSE; - temp_data = calloc(SMSPRecordLen,1); - encoded_data = calloc(SMSPRecordLen*2 + 1,1); + temp_data = g_malloc0(SMSPRecordLen); + encoded_data = g_malloc0(SMSPRecordLen*2 + 1); _tcore_util_sms_encode_smsParameters(&(setSmsParams->params), temp_data, SMSPRecordLen); - util_byte_to_hex((const char *)temp_data, (char *)encoded_data,SMSPRecordLen); + util_byte_to_hex((const char *)temp_data, (char *)encoded_data, SMSPRecordLen); encoded_data_len = ((SMSPRecordLen) * 2); hal = tcore_object_get_hal(obj); pending = tcore_pending_new(obj, 0); - dbg("alpha id len %d encoded data %s. Encoded data len %d",setSmsParams->params.alphaIdLen,encoded_data, encoded_data_len); - cmd_str = g_strdup_printf("AT+CRSM=220,28482,%d,4,%d,\"%s\"",(setSmsParams->params.recordIndex+1),SMSPRecordLen,encoded_data); + dbg("alpha id len %d encoded data %s. Encoded data len %d", setSmsParams->params.alphaIdLen, encoded_data, encoded_data_len); + cmd_str = g_strdup_printf("AT+CRSM=220, 28482, %d, 4, %d, \"%s\"", (setSmsParams->params.recordIndex+1), SMSPRecordLen, encoded_data); - dbg("cmd str is %s",cmd_str); - atreq = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE); + dbg("cmd str is %s", cmd_str); + atreq = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE); if (NULL == cmd_str || NULL == atreq || NULL == pending) { err("Out of memory. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -3133,9 +3216,9 @@ static TReturn set_sms_params(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_ENOMEM; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); - tcore_pending_set_request_data(pending, 0,atreq); + tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_set_sms_params, NULL); tcore_pending_link_user_request(pending, ur); tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); @@ -3164,13 +3247,13 @@ static TReturn get_paramcnt(CoreObject *obj, UserRequest *ur) dbg("Exit"); return TCORE_RETURN_EINVAL; } - if(FALSE == tcore_hal_get_power_state(hal)){ + if (FALSE == tcore_hal_get_power_state(hal)) { dbg("cp not ready/n"); return TCORE_RETURN_ENOSYS; } - //AT+CRSM=command>[,[,,,[,[,]]]] - cmd_str = g_strdup_printf("AT+CRSM=192,28482"); + /* AT+CRSM=command>[, [, , , [, [, ]]]] */ + cmd_str = g_strdup_printf("AT+CRSM=192, 28482"); atreq = tcore_at_request_new((const char *)cmd_str, "+CRSM", TCORE_AT_SINGLELINE); pending = tcore_pending_new(obj, 0); @@ -3178,7 +3261,6 @@ static TReturn get_paramcnt(CoreObject *obj, UserRequest *ur) err("NULL pointer. Unable to proceed"); dbg("cmd_str: [%p], atreq: [%p], pending: [%p]", cmd_str, atreq, pending); - //free memory we own g_free(cmd_str); util_sms_free_memory(atreq); util_sms_free_memory(pending); @@ -3187,7 +3269,7 @@ static TReturn get_paramcnt(CoreObject *obj, UserRequest *ur) return TCORE_RETURN_FAILURE; } - util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); + tcore_util_hex_dump(" ", strlen(cmd_str), (void *)cmd_str); tcore_pending_set_request_data(pending, 0, atreq); tcore_pending_set_response_callback(pending, on_response_get_paramcnt, NULL); @@ -3227,7 +3309,7 @@ gboolean imc_sms_init(TcorePlugin *cp, CoreObject *co_sms) dbg("Entry"); /* Set operations */ - tcore_sms_set_ops(co_sms, &sms_ops); + tcore_sms_set_ops(co_sms, &sms_ops, TCORE_OPS_TYPE_CP); /* Registering for SMS notifications */ tcore_object_add_callback(co_sms, "+CMTI:", on_event_class2_sms_incom_msg, NULL); diff --git a/src/imc_ss.c b/src/imc_ss.c old mode 100755 new mode 100644 index 8164c3b..59ef8c9 --- a/src/imc_ss.c +++ b/src/imc_ss.c @@ -42,7 +42,7 @@ #define NUM_TYPE_INTERNATIONAL 0x01 #define NUM_PLAN_ISDN 0x01 -// To avoid sending multiple response to application +/* To avoid sending multiple response to application */ static gboolean UssdResp = FALSE; enum telephony_ss_opcode { @@ -107,33 +107,30 @@ static void on_confirmation_ss_message_send(TcorePending *p, gboolean result, vo static void _ss_ussd_response(UserRequest *ur, const char *ussd_str, enum telephony_ss_ussd_type type, enum telephony_ss_ussd_status status); static void _ss_ussd_notification(TcorePlugin *p, const char *ussd_str, enum telephony_ss_ussd_status status); -static gboolean on_notification_ss_info(CoreObject *o, const void *data, void *user_data); static gboolean on_notification_ss_ussd(CoreObject *o, const void *data, void *user_data); static gboolean _ss_request_message(TcorePending *pending, - CoreObject *o, - UserRequest *ur, - void *on_resp, - void *user_data) + CoreObject *o, UserRequest *ur, + void *on_resp, void *user_data) { TcoreHal *hal = NULL; TReturn ret; dbg("Entry"); - if (on_resp) { + if (on_resp) tcore_pending_set_response_callback(pending, on_resp, user_data); - } + tcore_pending_set_send_callback(pending, on_confirmation_ss_message_send, NULL); - if (ur) { + + if (ur) tcore_pending_link_user_request(pending, ur); - } else { + else err("User Request is NULL, is this internal request??"); - } hal = tcore_object_get_hal(o); - // Send request to HAL + /* Send request to HAL */ ret = tcore_hal_send_request(hal, pending); if (TCORE_RETURN_SUCCESS != ret) { err("Request send failed"); @@ -144,7 +141,9 @@ static gboolean _ss_request_message(TcorePending *pending, return TRUE; } -static void _ss_ussd_response(UserRequest *ur, const char *ussd_str, enum telephony_ss_ussd_type type, enum telephony_ss_ussd_status status) +static void _ss_ussd_response(UserRequest *ur, + const char *ussd_str, enum telephony_ss_ussd_type type, + enum telephony_ss_ussd_status status) { struct tresp_ss_ussd resp; dbg("Entry"); @@ -171,7 +170,8 @@ static void _ss_ussd_response(UserRequest *ur, const char *ussd_str, enum teleph memset(resp.str, '\0', MAX_SS_USSD_LEN); } UssdResp = TRUE; - // Send response to TAPI + + /* Send response to TAPI */ tcore_user_request_send_response(ur, TRESP_SS_SEND_USSD, sizeof(struct tresp_ss_ussd), &resp); } else { err("User request is NULL"); @@ -236,18 +236,21 @@ static gboolean on_notification_ss_ussd(CoreObject *o, const void *data, void *u dbg("unsolicited msg but multiple line"); return TRUE; } - cmd = (char *) (lines->data); - // parse ussd status + + cmd = (char *)(lines->data); + + /* parse ussd status */ tokens = tcore_at_tok_new(cmd); - // parse + /* parse */ ussdnoti = g_slist_nth_data(tokens, 0); if (!ussdnoti) { dbg("+CUSD is missing from %CUSD Notification"); } else { m = atoi(ussdnoti); dbg("USSD status %d", m); - // parse [ , ] + + /* parse [ , ] */ ussd_string = g_slist_nth_data(tokens, 1); if (ussd_string) { /* Strike off starting & ending quotes. 1 extra character for NULL termination */ @@ -257,17 +260,19 @@ static gboolean on_notification_ss_ussd(CoreObject *o, const void *data, void *u memset(str, 0x00, strlen(ussd_string) - 1); } else { dbg("malloc failed"); - if (NULL != tokens) { + if (NULL != tokens) tcore_at_tok_free(tokens); - } + return FALSE; } + len = strlen(ussd_string) - 1; ++ussd_string; strncpy(str, ussd_string, len); dbg("USSD String - %s len = %d", str, strlen(str)); } + if ((dcs_str = g_slist_nth_data(tokens, 2))) { dcs = atoi(dcs_str); dbg("USSD dcs %d", dcs); @@ -277,39 +282,39 @@ static gboolean on_notification_ss_ussd(CoreObject *o, const void *data, void *u switch (m) { case 0: status = SS_USSD_NO_ACTION_REQUIRE; - break; + break; case 1: status = SS_USSD_ACTION_REQUIRE; - break; + break; case 2: status = SS_USSD_TERMINATED_BY_NET; - break; + break; case 3: status = SS_USSD_OTHER_CLIENT; - break; + break; case 4: status = SS_USSD_NOT_SUPPORT; - break; + break; case 5: status = SS_USSD_TIME_OUT; - break; + break; default: dbg("unsupported m : %d", m); status = SS_USSD_MAX; - break; + break; } switch (tcore_util_get_cbs_coding_scheme(dcs)) { case TCORE_DCS_TYPE_7_BIT: case TCORE_DCS_TYPE_UNSPECIFIED: - // ussd_str = tcore_util_unpack_gsm7bit(str, strlen(str)); - // break; + /* ussd_str = tcore_util_unpack_gsm7bit(str, strlen(str)); */ + /* break; */ case TCORE_DCS_TYPE_UCS2: case TCORE_DCS_TYPE_8_BIT: @@ -320,7 +325,7 @@ static gboolean on_notification_ss_ussd(CoreObject *o, const void *data, void *u ussd_str[strlen(str)] = '\0'; } } - break; + break; default: dbg("[ error ] unknown dcs type. ussd_session : %x", ussd_session); @@ -334,20 +339,19 @@ static gboolean on_notification_ss_ussd(CoreObject *o, const void *data, void *u goto CATCH; } - type = (enum telephony_ss_ussd_type) tcore_ss_ussd_get_session_type(ussd_session); + type = (enum telephony_ss_ussd_type)tcore_ss_ussd_get_session_type(ussd_session); dbg("ussd type - %d", type); _ss_ussd_response(ur, ussd_str, type, status); } CATCH: - if (NULL != tokens) { + if (NULL != tokens) tcore_at_tok_free(tokens); - } - if (NULL != str) { + if (NULL != str) free(str); - } + return FALSE; } @@ -357,247 +361,263 @@ CATCH: case SS_USSD_OTHER_CLIENT: case SS_USSD_NOT_SUPPORT: case SS_USSD_TIME_OUT: - { if (ussd_session) { UserRequest *ur = 0; enum telephony_ss_ussd_type type; - tcore_ss_ussd_get_session_data(ussd_session, (void **) &ur); + tcore_ss_ussd_get_session_data(ussd_session, (void **)&ur); if (!ur) { dbg("[ error ] ur : (0)"); - if (NULL != tokens) { + if (NULL != tokens) tcore_at_tok_free(tokens); - } - if (NULL != str) { + if (NULL != str) free(str); - } - if (ussd_str) { + if (ussd_str) g_free(ussd_str); - } + return FALSE; } - type = (enum telephony_ss_ussd_type) tcore_ss_ussd_get_session_type(ussd_session); + type = (enum telephony_ss_ussd_type)tcore_ss_ussd_get_session_type(ussd_session); dbg("ussd type - %d", type); - _ss_ussd_response(ur, (const char *) ussd_str, type, status); + + _ss_ussd_response(ur, (const char *)ussd_str, type, status); + if (ussd_str) g_free(ussd_str); } else { tcore_ss_ussd_create_session(o, TCORE_SS_USSD_TYPE_NETWORK_INITIATED, 0, 0); - _ss_ussd_notification(plugin, (const char *) ussd_str, status); + _ss_ussd_notification(plugin, (const char *)ussd_str, status); if (ussd_str) g_free(ussd_str); } - } break; case SS_USSD_TERMINATED_BY_NET: - { if (ussd_session) { UserRequest *ur = 0; - tcore_ss_ussd_get_session_data(ussd_session, (void **) &ur); - if (ur) { + tcore_ss_ussd_get_session_data(ussd_session, (void **)&ur); + if (ur) tcore_user_request_unref(ur); - } + tcore_ss_ussd_destroy_session(ussd_session); } - } break; default: - break; + break; } - if (NULL != tokens) { + if (NULL != tokens) tcore_at_tok_free(tokens); - } - if (NULL != str) { + if (NULL != str) free(str); - } dbg("Exit"); return TRUE; } -static gboolean on_notification_ss_info(CoreObject *o, const void *data, void *user_data) +static gboolean on_notification_ss_cssu_info(CoreObject *co, + const void *event_data, void *user_data) { - TcorePlugin *plugin = 0; - CoreObject *co = 0; - char *cmd = 0, *number = 0, *pos; - int code1 = -1, code2 = -1, index = 0, ton = 0; - char *str_code1, *str_code2, *str_ton, *str_index; + TcorePlugin *p = NULL; + CoreObject *o = NULL; GSList *tokens = NULL; - char *buf; - gboolean cssu = FALSE, cssi = FALSE; - GSList *lines = NULL; + enum tcore_notification_command command = TNOTI_UNKNOWN; char *resp = NULL; - dbg("function enter"); - - plugin = tcore_object_ref_plugin(o); - co = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_CALL); - if (!co) { - dbg("[ error ] plugin_ref_core_object : call"); + char *cmd = 0; + int index = 0; + int code2 = -1; + char *number = NULL; + int id = 1; /* TODO: Need to check how to fetch Call id */ + + dbg("entry"); + + p = tcore_object_ref_plugin(co); + o = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL); + if (!o) { + err(" Call CoreObject not found "); return FALSE; } - lines = (GSList *) data; - if (1 != g_slist_length(lines)) { - dbg("unsolicited msg but multiple line"); - goto OUT; + if (1 != g_slist_length((GSList *) event_data)) { + err("unsolicited msg but multiple line"); + return TRUE; } + cmd = (char *) ((GSList *) event_data)->data; + info("ss notification message[%s]", cmd); - cmd = (char *) (lines->data); - pos = strchr(cmd, ':'); - if (!pos) { - dbg("[ error ] not valid SS- notification "); + tokens = tcore_at_tok_new(cmd); + + /* parse */ + resp = g_slist_nth_data(tokens, 0); + if (NULL == resp) { + err("Code2 is missing from +CSSU indication"); + tcore_at_tok_free(tokens); return TRUE; } - buf = calloc(pos - cmd + 2, 1); - memcpy(buf, cmd, pos - cmd); - dbg("buf is %s", buf); - - if (!strcmp(buf, "+CSSU")) { - dbg("SS - +CSSU indication"); - cssu = TRUE; - } else if (!strcmp(buf, "+CSSI")) { - dbg("SS - +CSSI indication"); - cssi = TRUE; - } - free(buf); - - // handle %CSSU notification - if (cssu) { - tokens = tcore_at_tok_new(cmd); - // parse - str_code2 = g_slist_nth_data(tokens, 0); - if (!str_code2) { - dbg("Code2 is missing from %CSSU indiaction"); - } else { - code2 = atoi(str_code2); - // parse [ , ] - if ((str_index = g_slist_nth_data(tokens, 1))) { - index = atoi(str_index); - } + code2 = atoi(resp); - if ((resp = g_slist_nth_data(tokens, 2))) { - // Strike off double quotes - number = util_removeQuotes(resp); - str_ton = g_slist_nth_data(tokens, 3); + /* parse [ , ] */ + if ((resp = g_slist_nth_data(tokens, 1))) + index = atoi(resp); - if (str_ton) { - ton = atoi(str_ton); - } - } - } + if ((resp = g_slist_nth_data(tokens, 2))) { + /* Strike off double quotes */ + number = tcore_at_tok_extract(resp); + } - dbg("CSSU - code2 = %d index = %d number = %s type = %d", code2, index, number, ton); - switch (code2) { - case 0: // this is a forwarded call (MT call setup) - tcore_call_information_mt_forwarded_call(co, number); - break; + info("+CSSU: = %d = %d ", code2, index); - case 2: // call has been put on hold (during a voice call) - tcore_call_information_held(co, number); - break; + /* - other values will be ignored */ + switch (code2) { + case 0: + command = TNOTI_CALL_INFO_FORWARDED_CALL; + break; - case 3: // call has been retrieved (during a voice call) - tcore_call_information_active(co, number); - break; + case 2: + command = TNOTI_CALL_INFO_HELD; + break; - case 4: // multiparty call entered (during a voice call) - tcore_call_information_joined(co, number); - break; + case 3: + command = TNOTI_CALL_INFO_ACTIVE; + break; - case 5: // call on hold has been released - tcore_call_information_released_on_hold(co, number); - break; + case 4: + command = TNOTI_CALL_INFO_JOINED; + break; - case 6: // forward check SS message received (can be received whenever) - tcore_call_information_cf_check_ss_message(co, number); - break; + case 5: + command = TNOTI_CALL_INFO_RELEASED_ON_HOLD; + break; - case 7: // call is being connected (alerting) with the remote party in alerting state in explicit call transfer operation (during a voice call) - tcore_call_information_transfer_alert(co, number); - break; + case 6: + command = TNOTI_CALL_INFO_CF_CHECK_MESSAGE; + break; - case 8: // call has been connected with the other remote party in explicit call transfer operation (also number and subaddress parameters may be present) (during a voice call or MT call setup) - tcore_call_information_transfered(co, number); - break; + case 7: + command = TNOTI_CALL_INFO_TRANSFER_ALERT; + break; - case 9: // this is a deflected call (MT call setup): - tcore_call_information_mt_deflected_call(co, number); - break; + case 8: + command = TNOTI_CALL_INFO_TRANSFERED_CALL; + break; - default: - dbg("CSSU - unsupported code2 : %d", code2); - break; - } + case 9: + command = TNOTI_CALL_INFO_DEFLECTED_CALL; + break; + + default: + err("Unsupported +CSSU notification : %d", code2); + break; } - // handle %CSSI notification - if (cssi) { - tokens = tcore_at_tok_new(cmd); - // parse - str_code1 = g_slist_nth_data(tokens, 0); - if (!str_code1) { - dbg("Code1 is missing from %CSSI indiaction"); - } else { - code1 = atoi(str_code1); - // parse [ ] - if ((str_index = g_slist_nth_data(tokens, 1))) { - index = atoi(str_index); - } - } + /* Send notification */ + if (command != TNOTI_UNKNOWN) { + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), + o, command, sizeof(unsigned int), (void *)&id); + } + tcore_at_tok_free(tokens); + g_free(number); - dbg("CSSI - code1 - %d index - %d ", code1, index); + return TRUE; +} - switch (code1) { - case 0: // Unconditional CF is active - tcore_call_information_mo_cfu(co); - break; +static gboolean on_notification_ss_cssi_info(CoreObject *co, + const void *event_data, void *user_data) +{ + TcorePlugin *p = NULL; + CoreObject *o = NULL; + GSList *tokens = NULL; + enum tcore_notification_command command = TNOTI_UNKNOWN; + char *resp = NULL; + char *cmd = 0; + int index = 0; + int code1 = -1; + int id = 1; /* TODO: Need to check how to fetch Call id */ - case 1: // some of the conditional call forwarding are active - tcore_call_information_mo_cfc(co); - break; + dbg("entry"); - case 2: // outgoing call is forwarded - tcore_call_information_mo_forwarded(co); - break; + p = tcore_object_ref_plugin(co); + o = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL); + if (!o) { + err(" Call CoreObject not found "); + return FALSE; + } - case 3: // this call is waiting - tcore_call_information_mo_waiting(co); - break; + if (1 != g_slist_length((GSList *) event_data)) { + err("unsolicited msg but multiple line"); + return TRUE; + } + cmd = (char *) ((GSList *) event_data)->data; + info("ss notification message[%s]", cmd); - case 5: // outgoing call is barred - tcore_call_information_mo_barred_outgoing(co); - break; + tokens = tcore_at_tok_new(cmd); - case 6: // incoming call is barred - tcore_call_information_mo_barred_incoming(co); - break; + /* parse */ + resp = g_slist_nth_data(tokens, 0); + if (NULL == resp) { + err(" is missing from %CSSI indication"); + tcore_at_tok_free(tokens); + return TRUE; + } + code1 = atoi(resp); - case 7: // CLIR suppression rejected - tcore_call_information_mo_clir_suppression_reject(co); - break; + /* parse [ ] */ + if ((resp = g_slist_nth_data(tokens, 1))) + index = atoi(resp); - case 8: // outgoing call is deflected - tcore_call_information_mo_deflected(co); - break; + info("+CSSI: = %d = %d ", code1, index); - default: - dbg("unsupported cmd : %d", code1); - break; - } + /* - other values will be ignored */ + switch (code1) { + case 0: + command = TNOTI_CALL_INFO_FORWARD_UNCONDITIONAL; + break; + + case 1: + command = TNOTI_CALL_INFO_FORWARD_CONDITIONAL; + break; + + case 2: + command = TNOTI_CALL_INFO_FORWARDED; + break; + + case 3: + command = TNOTI_CALL_INFO_WAITING; + break; + + case 5: + command = TNOTI_CALL_INFO_BARRED_OUTGOING; + break; + + case 6: + command = TNOTI_CALL_INFO_BARRED_INCOMING; + break; + + case 7: + command = TNOTI_CALL_INFO_CLIR_SUPPRESSION_REJECT; + break; + + case 8: + command = TNOTI_CALL_INFO_DEFLECTED; + break; + + default: + dbg("Unsupported +CSSI notification : %d", code1); + break; } -OUT: - if (NULL != tokens) { - tcore_at_tok_free(tokens); + + /* Send notification */ + if (command != TNOTI_UNKNOWN) { + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), + o, command, sizeof(unsigned int), (void *)&id); } + tcore_at_tok_free(tokens); - g_free(number); return TRUE; } @@ -606,7 +626,7 @@ static void on_confirmation_ss_message_send(TcorePending *p, gboolean result, vo dbg(""); if (result == FALSE) { - // Fail + /* Fail */ dbg("FAIL"); } else { dbg("SEND OK"); @@ -658,25 +678,22 @@ static void on_response_ss_barring_set(TcorePending *p, int data_len, const void dbg("[ check ] class : 0x%x", info->class); if (response->success > 0) { - if (info->class == SS_CLASS_VOICE) { + if (info->class == SS_CLASS_VOICE) class = SS_CLASS_ALL_TELE_BEARER; - } ur_dup = tcore_user_request_ref(ur); - if (info->flavor_type == SS_BARR_MODE_AB || info->flavor_type == SS_BARR_MODE_AOB) { + if (info->flavor_type == SS_BARR_MODE_AB || info->flavor_type == SS_BARR_MODE_AOB) _ss_barring_get(o, ur_dup, class, SS_BARR_MODE_BAOC, info->resp); - } else if (info->flavor_type == SS_BARR_MODE_AIB) { + else if (info->flavor_type == SS_BARR_MODE_AIB) _ss_barring_get(o, ur_dup, class, SS_BARR_MODE_BAIC, info->resp); - } else { + else _ss_barring_get(o, ur_dup, class, info->flavor_type, info->resp); - } } else { - if (ur) { + if (ur) tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_barring), &resp); - } else { + else dbg("[ error ] ur is 0"); - } } g_free(user_data); } @@ -710,18 +727,17 @@ static void on_response_ss_barring_change_pwd(TcorePending *p, int data_len, con } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = SS_ERROR_SYSTEMFAILURE; } tcore_at_tok_free(tokens); } dbg("on_response_ss_barring_change_pwd: rsp.err : %d, usr : %x", resp.err, ur); - if (ur) { + if (ur) tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp); - } else { + else dbg("[ error ] ur is 0"); - } g_free(user_data); } @@ -761,7 +777,7 @@ static void on_response_ss_forwarding_set(TcorePending *p, int data_len, const v } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // / TODO: CMEE error mapping is required. + /* / TODO: CMEE error mapping is required. */ resp.err = SS_ERROR_SYSTEMFAILURE; } @@ -775,22 +791,20 @@ static void on_response_ss_forwarding_set(TcorePending *p, int data_len, const v if (response->success > 0) { if (info->flavor_type == SS_CF_MODE_CF_ALL || - info->flavor_type == SS_CF_MODE_CFC) { - if (ur) { + info->flavor_type == SS_CF_MODE_CFC) { + if (ur) tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_forwarding), &resp); - } else { + else dbg("[ error ] ur is 0"); - } } else { dup_ur = tcore_user_request_ref(ur); _ss_forwarding_get(o, dup_ur, info->class, info->flavor_type, info->resp); } } else { - if (ur) { + if (ur) tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_forwarding), &resp); - } else { + else dbg("[ error ] ur is 0"); - } } g_free(user_data); } @@ -845,11 +859,10 @@ static void on_response_ss_waiting_set(TcorePending *p, int data_len, const void dbg("Get Call Waiting status"); _ss_waiting_get(core_obj, ur_dup, info->class, info->resp); } else { - if (ur) { + if (ur) tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_waiting), &resp); - } else { + else err("User request is NULL"); - } } g_free(user_data); } @@ -884,7 +897,7 @@ static void on_confirmation_ss_ussd(TcorePending *p, int data_len, const void *d dbg("[ error ] ussd_s : (0)"); resp.type = (enum telephony_ss_ussd_type) type; - resp.status = SS_USSD_MAX; // hardcoded value. + resp.status = SS_USSD_MAX; /* hardcoded value. */ if (response->success > 0) { dbg("RESPONSE OK"); @@ -901,7 +914,7 @@ static void on_confirmation_ss_ussd(TcorePending *p, int data_len, const void *d } else { error = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", error); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = SS_ERROR_SYSTEMFAILURE; } tcore_at_tok_free(tokens); @@ -925,7 +938,7 @@ static void on_confirmation_ss_ussd(TcorePending *p, int data_len, const void *d tcore_ss_ussd_destroy_session(ussd_s); if (ur) { - if (UssdResp == FALSE) { // to avoid sending multiple response to application. + if (UssdResp == FALSE) { /* to avoid sending multiple response to application. */ tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_ussd), &resp); } UssdResp = FALSE; @@ -971,7 +984,7 @@ static void on_response_ss_barring_get(TcorePending *p, int data_len, const void line = (const char *) (respdata->data); tokens = tcore_at_tok_new(line); - // parse + /* parse */ stat = g_slist_nth_data(tokens, 0); if (!stat) { dbg("Stat is missing"); @@ -979,14 +992,14 @@ static void on_response_ss_barring_get(TcorePending *p, int data_len, const void } status = atoi(stat); - if (status == 1) { + if (status == 1) resp.record[countValidRecords].status = SS_STATUS_ACTIVATE; - } else { + else resp.record[countValidRecords].status = SS_STATUS_DEACTIVATE; - } + dbg("call barring status - %d", status); - // Parse + /* Parse */ classx_str = g_slist_nth_data(tokens, 1); if (!classx_str) { @@ -994,32 +1007,32 @@ static void on_response_ss_barring_get(TcorePending *p, int data_len, const void switch (info->class) { case SS_CLASS_ALL_TELE: classx = 7; - break; + break; case SS_CLASS_VOICE: classx = 1; - break; + break; case SS_CLASS_ALL_DATA_TELE: classx = 2; - break; + break; case SS_CLASS_FAX: classx = 4; - break; + break; case SS_CLASS_SMS: classx = 8; - break; + break; case SS_CLASS_ALL_CS_SYNC: classx = 16; - break; + break; default: classx = 7; dbg("unsupported class %d. set to default : 7", info->class); - break; + break; } } else { classx = atoi(classx_str); @@ -1029,36 +1042,35 @@ static void on_response_ss_barring_get(TcorePending *p, int data_len, const void switch (classx) { case 1: resp.record[countValidRecords].class = SS_CLASS_VOICE; - break; + break; case 2: resp.record[countValidRecords].class = SS_CLASS_ALL_DATA_TELE; - break; + break; case 4: resp.record[countValidRecords].class = SS_CLASS_FAX; - break; + break; case 7: resp.record[countValidRecords].class = SS_CLASS_ALL_TELE; - break; + break; case 8: resp.record[countValidRecords].class = SS_CLASS_SMS; - break; + break; case 16: resp.record[countValidRecords].class = SS_CLASS_ALL_CS_SYNC; - break; + break; case 32: resp.record[countValidRecords].class = SS_CLASS_ALL_CS_ASYNC; - break; + break; default: dbg("unspoorted class : [%d]\n", classx); goto error; - break; } resp.record[countValidRecords].mode = (enum telephony_ss_barring_mode) (info->flavor_type); countValidRecords++; @@ -1096,7 +1108,7 @@ error: } else { ss_err = atoi(g_slist_nth_data(tokens, 0)); err("Error: [%d]", ss_err); - // TODO: CMEE error mapping is required. + /* TODO: CMEE error mapping is required. */ resp.err = SS_ERROR_SYSTEMFAILURE; } tcore_at_tok_free(tokens); @@ -1153,20 +1165,19 @@ static void on_response_ss_forwarding_get(TcorePending *p, int data_len, const v line = (const char *) (respdata->data); tokens = tcore_at_tok_new(line); - // parse + /* parse */ status = g_slist_nth_data(tokens, 0); if (!status) { dbg("start line error. skip this line"); goto error; } else { - if (atoi(status) == 1) { + if (atoi(status) == 1) resp.record[countValidRecords].status = SS_STATUS_ACTIVATE; - } else { + else resp.record[countValidRecords].status = SS_STATUS_DEACTIVATE; - } } - // Parse + /* Parse */ classx_str = g_slist_nth_data(tokens, 1); if (!classx_str) { dbg("class error. skip this line"); @@ -1175,40 +1186,39 @@ static void on_response_ss_forwarding_get(TcorePending *p, int data_len, const v switch (atoi(classx_str)) { case 1: resp.record[countValidRecords].class = SS_CLASS_VOICE; - break; + break; case 2: resp.record[countValidRecords].class = SS_CLASS_ALL_DATA_TELE; - break; + break; case 4: resp.record[countValidRecords].class = SS_CLASS_FAX; - break; + break; case 7: resp.record[countValidRecords].class = SS_CLASS_ALL_TELE; - break; + break; case 8: resp.record[countValidRecords].class = SS_CLASS_SMS; - break; + break; case 16: resp.record[countValidRecords].class = SS_CLASS_ALL_CS_SYNC; - break; + break; case 32: resp.record[countValidRecords].class = SS_CLASS_ALL_CS_ASYNC; - break; + break; default: dbg("unspoorted class : [%d]\n", classx); goto error; - break; } } - // parse + /* parse */ num = g_slist_nth_data(tokens, 2); if (num) { dbg("number - %s", num); @@ -1222,8 +1232,8 @@ static void on_response_ss_forwarding_get(TcorePending *p, int data_len, const v } } - // skip - // parse