From edb2f01feed81217597f3d089d559e065542da1e Mon Sep 17 00:00:00 2001 From: Kim Kibum Date: Sun, 29 Apr 2012 17:02:01 +0900 Subject: [PATCH] upload tizen1.0 source --- AUTHORS | 10 + CMakeLists.txt | 54 + LICENSE | 204 ++ README | 1 + debian/changelog | 39 + debian/compat | 1 + debian/control | 19 + debian/copyright | 7 + debian/dirs | 2 + debian/docs | 0 debian/rules | 118 ++ debian/tel-plugin-atmodem.install.in | 2 + debian/tel-plugin-atmodem.postinst | 21 + include/at_tok.h | 31 + include/atchannel.h | 167 ++ include/s_call.h | 28 + include/s_common.h | 105 + include/s_modem.h | 28 + include/s_network.h | 28 + include/s_ps.h | 28 + include/s_sim.h | 28 + include/s_sms.h | 28 + include/s_ss.h | 30 + packaging/tel-plugin-atmodem.spec | 58 + res/convert_to_sql.c | 123 ++ res/wiki_mcc_mnc_oper_list.csv | 1517 ++++++++++++++ res/wiki_mcc_mnc_oper_list.db | Bin 0 -> 43008 bytes res/wiki_mcc_mnc_oper_list.sql | 1519 ++++++++++++++ src/at_tok.c | 199 ++ src/atchannel.c | 236 +++ src/desc_at.c | 607 ++++++ src/s_call.c | 2189 ++++++++++++++++++++ src/s_common.c | 200 ++ src/s_modem.c | 758 +++++++ src/s_network.c | 1008 ++++++++++ src/s_ps.c | 572 ++++++ src/s_sim.c | 2765 ++++++++++++++++++++++++++ src/s_sms.c | 1924 ++++++++++++++++++ src/s_ss.c | 2536 +++++++++++++++++++++++ 39 files changed, 17190 insertions(+) create mode 100644 AUTHORS create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 README create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100755 debian/rules create mode 100644 debian/tel-plugin-atmodem.install.in create mode 100644 debian/tel-plugin-atmodem.postinst create mode 100644 include/at_tok.h create mode 100644 include/atchannel.h create mode 100644 include/s_call.h create mode 100644 include/s_common.h create mode 100644 include/s_modem.h create mode 100644 include/s_network.h create mode 100644 include/s_ps.h create mode 100644 include/s_sim.h create mode 100644 include/s_sms.h create mode 100644 include/s_ss.h create mode 100644 packaging/tel-plugin-atmodem.spec create mode 100644 res/convert_to_sql.c create mode 100644 res/wiki_mcc_mnc_oper_list.csv create mode 100644 res/wiki_mcc_mnc_oper_list.db create mode 100644 res/wiki_mcc_mnc_oper_list.sql create mode 100644 src/at_tok.c create mode 100644 src/atchannel.c create mode 100644 src/desc_at.c create mode 100644 src/s_call.c create mode 100644 src/s_common.c create mode 100644 src/s_modem.c create mode 100644 src/s_network.c create mode 100755 src/s_ps.c create mode 100644 src/s_sim.c create mode 100644 src/s_sms.c create mode 100644 src/s_ss.c diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..19aadbb --- /dev/null +++ b/AUTHORS @@ -0,0 +1,10 @@ +Jongman Park +Ja-young Gu +Kyeongchul Kim +DongHoo Park +Youngman Park +Inho Oh +Hayoon Ko +Junhwan An +Kyoungyoup Park +Jinyup Kim diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8b063c3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,54 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(atmodem-plugin C) + +### Global setting ### +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "\${prefix}") +SET(LIBDIR "\${prefix}/lib") +SET(INCLUDEDIR "\${prefix}/include") + +# Set required packages +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED glib-2.0 tcore dlog) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align") + +ADD_DEFINITIONS("-DFEATURE_DLOG_DEBUG") +ADD_DEFINITIONS("-DTCORE_LOG_TAG=\"ATMODEM\"") + +MESSAGE(${CMAKE_C_FLAGS}) +MESSAGE(${CMAKE_EXE_LINKER_FLAGS}) + +SET(SRCS + src/desc_at.c + src/s_modem.c + src/s_common.c + src/s_network.c + src/s_sim.c + src/s_call.c + src/s_ps.c + src/s_sms.c + src/at_tok.c + src/atchannel.c + src/s_ss.c +) + + + +# library build +ADD_LIBRARY(atmodem-plugin SHARED ${SRCS}) +TARGET_LINK_LIBRARIES(atmodem-plugin ${pkgs_LDFLAGS}) +SET_TARGET_PROPERTIES(atmodem-plugin PROPERTIES PREFIX "" OUTPUT_NAME atmodem-plugin) + + +# install +INSTALL(TARGETS atmodem-plugin + LIBRARY DESTINATION lib/telephony/plugins) + +INSTALL(FILES ${CMAKE_SOURCE_DIR}/res/wiki_mcc_mnc_oper_list.sql DESTINATION /tmp RENAME mcc_mnc_oper_list.sql) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bae7f54 --- /dev/null +++ b/LICENSE @@ -0,0 +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. + diff --git a/README b/README new file mode 100644 index 0000000..74c53d9 --- /dev/null +++ b/README @@ -0,0 +1 @@ +AT based modem plugin diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9532c9f --- /dev/null +++ b/debian/changelog @@ -0,0 +1,39 @@ +tel-plugin-atmodem (0.1.4) unstable; urgency=low + + * version up for code sync with public binary + * Git: slp/pkgs/t/tel-plugin-atmodem + * Tag: tel-plugin-atmodem_0.1.4 + + -- Kyeongchul Kim Tue, 03 Apr 2012 11:17:07 +0900 + +tel-plugin-atmodem (0.1.3) unstable; urgency=low + + * Fix prefix (TAPI_ to TCORE_) + * Git: pkgs/t/tel-plugin-atmodem + * Tag: tel-plugin-atmodem_0.1.3 + + -- Inho Oh Tue, 27 Mar 2012 22:11:38 +0900 + +tel-plugin-atmodem (0.1.2) unstable; urgency=low + + * Fix build break and Add .spec file for OBS + * Git: pkgs/t/tel-plugin-atmodem + * tel-plugin-atmodem_0.1.2 + + -- DongHoo Park Sat, 17 Mar 2012 02:30:20 +0900 + +tel-plugin-atmodem (0.1.1) unstable; urgency=low + + * Remove unused header + * Git: pkgs/t/tel-plugin-atmodem + * Tag: tel-plugin-atmodem_0.1.1 + + -- Inho Oh Fri, 16 Mar 2012 02:39:47 +0900 + +tel-plugin-atmodem (0.1.0) unstable; urgency=low + + * Initial + * Git: pkgs/t/tel-plugin-atmodem + * Tag: tel-plugin-atmodem_0.1.0 + + -- Inho Oh Thu, 15 Mar 2012 22:37:29 +0900 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..06e1f27 --- /dev/null +++ b/debian/control @@ -0,0 +1,19 @@ +Source: tel-plugin-atmodem +Section: libs +Priority: extra +Maintainer: Jongman Park +Uploaders: Jayoung Gu , Kyeongchul Kim , Youngman Park , Inho Oh , DongHoo Park +Build-Depends: debhelper (>= 5), libglib2.0-dev, libtcore-dev, dlog-dev, libslp-db-util-dev +Standards-Version: 0.0.0 + +Package: tel-plugin-atmodem +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, +Description: telephony client API library (Shared Object) + +Package: tel-plugin-atmodem-dbg +Section: debug +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, tel-plugin-atmodem (= ${Source-Version}) +Description: telephony client API library (dbg package) diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..d5a0cca --- /dev/null +++ b/debian/copyright @@ -0,0 +1,7 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License version 2.1. + +The full text of the LGPL 2.1 can be found in +/usr/share/common-licenses. diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..ca882bb --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e69de29 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..7426fbb --- /dev/null +++ b/debian/rules @@ -0,0 +1,118 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS ?= -Wall -g +CXXFLAGS ?= -Wall -g +LDFLAGS ?= +PREFIX ?= /usr +DATADIR ?= /opt + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CXXFLAGS += -O0 +else + CFLAGS += -O2 + CXXFLAGS += -O2 +endif + +#CFLAGS += -fvisibility=hidden -fPIC +CFLAGS += -fvisibility=default -fPIC +LDFLAGS += -rdynamic -fPIC -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed +#LDFLAGS += -Wl,--unresolved-symbols=ignore-in-shared-libs,--as-needed + +CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + mkdir -p $(CMAKE_TMP_DIR); + cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX) + + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + cd $(CMAKE_TMP_DIR) && $(MAKE) all + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ + done + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + rm -rf $(CMAKE_TMP_DIR) + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/wavplayer. + cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip --dbg-package=tel-plugin-atmodem-dbg + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps --dpkg-shlibdeps-params="-v" + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/debian/tel-plugin-atmodem.install.in b/debian/tel-plugin-atmodem.install.in new file mode 100644 index 0000000..18ca293 --- /dev/null +++ b/debian/tel-plugin-atmodem.install.in @@ -0,0 +1,2 @@ +@PREFIX@/lib/* +/tmp/mcc_mnc_oper_list.sql diff --git a/debian/tel-plugin-atmodem.postinst b/debian/tel-plugin-atmodem.postinst new file mode 100644 index 0000000..38d4e67 --- /dev/null +++ b/debian/tel-plugin-atmodem.postinst @@ -0,0 +1,21 @@ +#!/bin/sh + +#create db +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 diff --git a/include/at_tok.h b/include/at_tok.h new file mode 100644 index 0000000..12fb573 --- /dev/null +++ b/include/at_tok.h @@ -0,0 +1,31 @@ +/* //device/system/reference-ril/at_tok.h +** +** Copyright 2006, The Android Open Source Project +** +** 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 AT_TOK_H +#define AT_TOK_H 1 + +int at_tok_start(char **p_cur); +int at_tok_nextint(char **p_cur, int *p_out); +int at_tok_nexthexint(char **p_cur, int *p_out); + +int at_tok_nextbool(char **p_cur, char *p_out); +int at_tok_nextstr(char **p_cur, char **out); + +int at_tok_hasmore(char **p_cur); +void at_tok_skip_bracket(char **p_cur); + +#endif /*AT_TOK_H */ diff --git a/include/atchannel.h b/include/atchannel.h new file mode 100644 index 0000000..c1649e7 --- /dev/null +++ b/include/atchannel.h @@ -0,0 +1,167 @@ +#ifndef __ATCHANNEL_H__ +#define __ATCHANNEL_H__ + +/* //device/system/reference-ril/atchannel.c +** +** Copyright 2006, The Android Open Source Project +** +** 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. +*/ +//code from atchannel.c - android +#include "type/common.h" + +#define AT_ERROR_GENERIC -1 +#define AT_ERROR_COMMAND_PENDING -2 +#define AT_ERROR_CHANNEL_CLOSED -3 +#define AT_ERROR_TIMEOUT -4 +#define AT_ERROR_INVALID_THREAD -5 /* AT commands may not be issued from + reader thread (or unsolicited response + callback */ +#define AT_ERROR_INVALID_RESPONSE -6 /* eg an at_send_command_singleline that + did not get back an intermediate + response */ + +#define MAX_AT_RESPONSE (8 * 1024) +#define MAX_AT_RESP_PREFIX 10 + +#define NUM_ELEMS(x) (sizeof(x)/sizeof(x[0])) + +#define ID_RESERVED_AT 0x0229 + + +enum ATCommandType{ + NO_RESULT, /* no intermediate response expected */ + NUMERIC, /* a single intermediate response starting with a 0-9 */ + SINGLELINE, /* a single intermediate response starting with a prefix */ + MULTILINE /* multiple line intermediate response + starting with a prefix */ +}; + +enum ATCMEError{ + AT_ERROR_MOBILE_FAILRURE =0, + AT_ERROR_NOT_CONNECTED_TO_PHONE =1, + AT_ERROR_LINK_RESERVED =2, + AT_ERROR_OPER_NOT_ALLOWED =3, + AT_ERROR_OPER_NOT_SUPPORTED =4, + AT_ERROR_PH_SIM_PIN_REQUIRED =5, + AT_ERROR_PH_FSIM_PIN_REQUIRED =6, + AT_ERROR_PH_FSIM_PUK_REQUIRED =7, + + AT_ERROR_SIM_NOT_INSERTED =10, + AT_ERROR_SIM_PIN_REQUIRED =11, + AT_ERROR_SIM_PUK_REQUIRED =12, + AT_ERROR_SIM_FAILURE =13, + AT_ERROR_SIM_BUSY =14, + AT_ERROR_SIM_WRONG =15, + AT_ERROR_INCORRECT_PWD =16, + AT_ERROR_SIM_PIN2_REQUIRED =17, + AT_ERROR_SIM_PUK2_REQUIRED =18, + + AT_ERROR_MEMORY_FULL =20, + AT_ERROR_INVALID_INDEX =21, + AT_ERROR_NOT_FOUND =22, + AT_ERROR_MEMORY_FAILURE =23, + AT_ERROR_TEXT_TOO_LONG =24, + AT_ERROR_INVALID_CHAR_IN_STR =25, + AT_ERROR_DIAL_TOO_LONG =26, + AT_ERROR_INVALID_CHAR_IN_DIAL =27, + + AT_ERROR_NO_NETWORK_SVC =30, + AT_ERROR_NETWORK_TIMEOUT =31, + AT_ERROR_EMERGENCY_CALL_ONLY =32, + + AT_ERROR_NET_PERSONAL_PIN_REQ =40, + AT_ERROR_NET_PERSONAL_PUN_REQ =41, + AT_ERROR_NET_SUB_PERSONAL_PIN_REQ =42, + AT_ERROR_NET_SUB_PERSONAL_PUK_REQ =43, + AT_ERROR_PROVIDER_PERSONAL_PIN_REQ =44, + AT_ERROR_PROVIDER_PERSONAL_PUK_REQ =45, + AT_ERROR_CORP_PERSONAL_PIN_REQ =46, + AT_ERROR_CORP_PERSONAL_PUK_REQ =47, + AT_ERROR_HIDDEN_KEY_REQUIRED =48, + AT_ERROR_EAP_METHOD_NOT_SUPPORTED =49, + AT_ERROR_INCORRECT_PARAM =50, + + AT_ERROR_UNKNOWN =100 +}; + + + +/** a singly-lined list of intermediate responses */ +struct ATLine { + struct ATLine *p_next; + char *line; +} ; + +/** Free this with at_response_free() */ +struct ATResponse{ + int success; /* true if final response indicates + success (eg "OK") */ + char *finalResponse; /* eg OK, ERROR */ + struct ATLine *p_intermediates; /* any intermediate responses */ +} ; + +struct ATReqMetaInfo{ + enum ATCommandType type; + char responsePrefix[MAX_AT_RESP_PREFIX]; +}; + +struct smsDeliveryPDU{ +char* cmdLine; +char* pdu; +int len; +}; + +//utility API for at command response parsing +/** + * Returns a pointer to the end of the next line + * special-cases the "> " SMS prompt + * + * returns NULL if there is no complete line + */ +char * findNextEOL(char *cur); +struct ATResponse * at_response_new(); +void at_response_free(struct ATResponse *p_response); +int strStartsWith(const char *line, const char *prefix); + /* SMS prompt character...not \r terminated */ +int isFinalResponseError(const char *line); +int isFinalResponseSuccess(const char *line); + +int isFinalResponse(const char *line); +void addIntermediate(const char *line); +void ReleaseResponse(void); +void reverseIntermediates(struct ATResponse *p_response); +void printResponse(void); +TReturn convertCMEError(enum ATCMEError error); + +#include /* err */ +#include /* __file__, __line__ */ + +#define AT_TOK_ERROR(token) AT_TOK_ERROR_INTERNEL(token, __FILE__, __LINE__) +#define AT_TOK_ERROR_INTERNEL(token, file, line) \ +{\ + ReleaseResponse();\ + err("AT_TOK_ERROR %s:%d %s",file,line,token?token:"");\ + return;\ +}\ + +#define AT_NOTI_TOK_ERROR(token) AT_NOTI_TOK_ERROR_INTERNEL(token, __FILE__, __LINE__) +#define AT_NOTI_TOK_ERROR_INTERNEL(token, file, line) \ +{\ + err("AT_NOTI_TOK_ERROR_INTERNEL %s:%d %s",file,line,token?token:"");\ + return;\ +}\ + +#endif /* __ATCHANNEL_H__ */ +/*EOF*/ + diff --git a/include/s_call.h b/include/s_call.h new file mode 100644 index 0000000..d65ca92 --- /dev/null +++ b/include/s_call.h @@ -0,0 +1,28 @@ +/* + * tel-plugin-atmodem + * + * 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. + */ + +#ifndef __S_CALL_H__ +#define __S_CALL_H__ + +gboolean s_call_init( TcorePlugin *p ); +void s_call_exit( TcorePlugin *p ); + +#endif + diff --git a/include/s_common.h b/include/s_common.h new file mode 100644 index 0000000..bc8ed69 --- /dev/null +++ b/include/s_common.h @@ -0,0 +1,105 @@ +/* + * tel-plugin-atmodem + * + * 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. + */ + +#ifndef __S_COMMON_H__ +#define __S_COMMON_H__ + +#include +#include +#include + +#define EVENT_SYS_NOTI_MODEM_POWER "system_power" +#define EVENT_MODEM_POWER "modem_power" +#define EVENT_MODEM_PHONE_STATE "modem_phone_state" + +#define EVENT_CALL_STATUS "call_status" +#define EVENT_CALL_INCOMING "call_incoming" +#define EVENT_CALL_WAITING "call_waiting" + +#define EVENT_SS_INFO "ss_info" +#define EVENT_SS_USSD "ss_ussd" + +#define EVENT_PS_CALL_STATUS "ps_call_status" +#define EVENT_PS_DATA_COUNTER "ps_data_counter" +#define EVENT_PS_IPCONFIGURATION "ps_ipconfiguration" +#define EVENT_PS_PIN_CTRL "ps_pin_control" +#define EVENT_PS_HSDPA_STATUS "ps_hsdpa_status" +#define EVENT_PS_ATTACH_DETACH "ps_attach_detach" +#define EVENT_PS_EXTERNAL_CALL "ps_external_call" + +#define EVENT_SAP_STATUS "sap_status" +#define EVENT_SAP_DISCONNECT "sap_disconnect" + +#define EVENT_SIM_PIN_STATUS "sim_pin_status" + +#define EVENT_SAT_ENVELOPE_RESP "sat_envelope_response" +#define EVENT_SAT_REFRESH_STATUS "sat_refresh_status" +#define EVENT_SAT_PROACTIVE_COMMAND "sat_proactive_command" +#define EVENT_SAT_CONTROL_RESULT "sat_control_result" + + +#define EVENT_CALL_STATUS "call_status" +#define EVENT_CALL_INCOMING "call_incoming" + +#define EVENT_NETWORK_REGISTRATION "network_regist" +#define EVENT_NETWORK_ICON_INFO "network_icon_info" +#define EVENT_NETWORK_TIME_INFO "network_time_info" +#define EVENT_NETWORK_IDENTITY "network_identity" + +#define EVENT_SMS_INCOM_MSG "sms_incom_msg" +#define EVENT_SMS_SEND_ACK "sms_send_ack" +#define EVENT_SMS_MEMORY_STATUS "sms_memory_status" +#define EVENT_SMS_CB_INCOM_MSG "sms_cb_incom_msg" +#define EVENT_SMS_DELETE_MSG_CNF "sms_delete_msg_cnf" +#define EVENT_SMS_WRITE_MSG_CNF "sms_write_msg_cnf" +#define EVENT_SMS_DELIVERY_RPT_CNF "sms_deliver_rpt_cnf" +#define EVENT_SMS_DEVICE_READY "sms_device_ready" + +#define EVENT_PHONEBOOK_STATUS "phonebook_status" +#define EVENT_PHONEBOOK_FIRST_INDEX "phonebook_first_index" + +enum direction_e { + RX, + TX +}; + +struct global_data { + unsigned int msg_auto_id_current; + unsigned int msg_auto_id_start; + unsigned int msg_auto_id_end; +}; + +struct work_queue_data { + unsigned int id; + UserRequest *ur; +}; + +#define UTIL_ID(hdr) ((hdr).main_cmd << 8 | (hdr).sub_cmd) +#define UTIL_IDP(hdr) ((hdr)->main_cmd << 8 | (hdr)->sub_cmd) + +void hook_hex_dump(enum direction_e d, int size, const void *data); +unsigned int util_assign_message_sequence_id(TcorePlugin *p); +gboolean util_add_waiting_job(GQueue *queue, unsigned int id, UserRequest *ur); +UserRequest* util_pop_waiting_job(GQueue *queue, unsigned int id); +void util_hex_dump(char *pad, int size, const void *data); +unsigned char util_hexCharToInt(char c); +char* util_hexStringToBytes(char * s); + +#endif diff --git a/include/s_modem.h b/include/s_modem.h new file mode 100644 index 0000000..063bafe --- /dev/null +++ b/include/s_modem.h @@ -0,0 +1,28 @@ +/* + * tel-plugin-atmodem + * + * 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. + */ + +#ifndef __S_MODEM_H__ +#define __S_MODEM_H__ + +gboolean s_modem_init(TcorePlugin *p); +void s_modem_exit(TcorePlugin *p); + +gboolean s_modem_send_poweron(TcorePlugin *p); +#endif diff --git a/include/s_network.h b/include/s_network.h new file mode 100644 index 0000000..2432da1 --- /dev/null +++ b/include/s_network.h @@ -0,0 +1,28 @@ +/* + * tel-plugin-atmodem + * + * 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. + */ + +#ifndef __S_NETWORK_H__ +#define __S_NETWORK_H__ + + +gboolean s_network_init(TcorePlugin *p); +void s_network_exit(TcorePlugin *p); + +#endif diff --git a/include/s_ps.h b/include/s_ps.h new file mode 100644 index 0000000..4a2d38d --- /dev/null +++ b/include/s_ps.h @@ -0,0 +1,28 @@ +/* + * tel-plugin-atmodem + * + * 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. + */ + +#ifndef __S_PS_H__ +#define __S_PS_H__ + + +gboolean s_ps_init(TcorePlugin *p); +void s_ps_exit(TcorePlugin *p); + +#endif diff --git a/include/s_sim.h b/include/s_sim.h new file mode 100644 index 0000000..f42de62 --- /dev/null +++ b/include/s_sim.h @@ -0,0 +1,28 @@ +/* + * tel-plugin-atmodem + * + * 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. + */ + +#ifndef __S_SIM_H__ +#define __S_SIM_H__ + + +gboolean s_sim_init(TcorePlugin *p); +void s_sim_exit(TcorePlugin *p); + +#endif diff --git a/include/s_sms.h b/include/s_sms.h new file mode 100644 index 0000000..a0e5b92 --- /dev/null +++ b/include/s_sms.h @@ -0,0 +1,28 @@ +/* + * tel-plugin-atmodem + * + * 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. + */ + +#ifndef __S_SMS_H__ +#define __S_SMS_H__ + + +gboolean s_sms_init(TcorePlugin *p); +void s_sms_exit(TcorePlugin *p); + +#endif diff --git a/include/s_ss.h b/include/s_ss.h new file mode 100644 index 0000000..a80b73f --- /dev/null +++ b/include/s_ss.h @@ -0,0 +1,30 @@ +/* + * tel-plugin-atmodem + * + * 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. + */ + +#ifndef __S_SS_H__ +#define __S_SS_H__ + + +gboolean s_ss_init( TcorePlugin *p ); +void s_ss_exit( TcorePlugin *p ); + + + +#endif diff --git a/packaging/tel-plugin-atmodem.spec b/packaging/tel-plugin-atmodem.spec new file mode 100644 index 0000000..944d965 --- /dev/null +++ b/packaging/tel-plugin-atmodem.spec @@ -0,0 +1,58 @@ +#sbs-git:slp/pkgs/t/tel-plugin-atmodem +Name: tel-plugin-atmodem +Summary: Telephony AT Modem library +Version: 0.1.4 +Release: 1 +Group: System/Libraries +License: Apache +Source0: tel-plugin-atmodem-%{version}.tar.gz +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: cmake +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(tcore) + +%description +Telephony AT Modem library + +%prep +%setup -q + +%build +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} +make %{?jobs:-j%jobs} + +%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 + +%install +rm -rf %{buildroot} +%make_install + +%files +%defattr(-,root,root,-) +#%doc COPYING +%{_libdir}/telephony/plugins/atmodem-plugin* +/tmp/mcc_mnc_oper_list.sql diff --git a/res/convert_to_sql.c b/res/convert_to_sql.c new file mode 100644 index 0000000..2039c65 --- /dev/null +++ b/res/convert_to_sql.c @@ -0,0 +1,123 @@ +/* + * tel-plugin-atmodem + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ja-young Gu + * + * 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 new file mode 100644 index 0000000..6c6edf6 --- /dev/null +++ b/res/wiki_mcc_mnc_oper_list.csv @@ -0,0 +1,1517 @@ +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 new file mode 100644 index 0000000000000000000000000000000000000000..fefb8b6b285aca3afac5239df744863fae3ad550 GIT binary patch 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` literal 0 HcmV?d00001 diff --git a/res/wiki_mcc_mnc_oper_list.sql b/res/wiki_mcc_mnc_oper_list.sql new file mode 100644 index 0000000..b1a9bb9 --- /dev/null +++ b/res/wiki_mcc_mnc_oper_list.sql @@ -0,0 +1,1519 @@ +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/at_tok.c b/src/at_tok.c new file mode 100644 index 0000000..44ab22c --- /dev/null +++ b/src/at_tok.c @@ -0,0 +1,199 @@ +/* //device/system/reference-ril/at_tok.c +** +** Copyright 2006, The Android Open Source Project +** +** 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 "at_tok.h" +#include +#include +#include + +/** + * Starts tokenizing an AT response string + * returns -1 if this is not a valid response string, 0 on success. + * updates *p_cur with current position + */ +int at_tok_start(char **p_cur) +{ + if (*p_cur == NULL) { + return -1; + } + + // skip prefix + // consume "^[^:]:" + + *p_cur = strchr(*p_cur, ':'); + + if (*p_cur == NULL) { + return -1; + } + + (*p_cur)++; + + return 0; +} + +static void skipWhiteSpace(char **p_cur) +{ + if (*p_cur == NULL) return; + + while (**p_cur != '\0' && isspace(**p_cur)) { + (*p_cur)++; + } +} + +static void skipNextComma(char **p_cur) +{ + if (*p_cur == NULL) return; + + while (**p_cur != '\0' && **p_cur != ',') { + (*p_cur)++; + } + + if (**p_cur == ',') { + (*p_cur)++; + } +} + +static char * nextTok(char **p_cur) +{ + char *ret = NULL; + + skipWhiteSpace(p_cur); + + if (*p_cur == NULL) { + ret = NULL; + } else if (**p_cur == '"') { + (*p_cur)++; + ret = strsep(p_cur, "\""); + skipNextComma(p_cur); + } else { + ret = strsep(p_cur, ","); + } + + return ret; +} + + +/** + * Parses the next integer in the AT response line and places it in *p_out + * returns 0 on success and -1 on fail + * updates *p_cur + * "base" is the same as the base param in strtol + */ + +static int at_tok_nextint_base(char **p_cur, int *p_out, int base, int uns) +{ + char *ret; + + if (*p_cur == NULL) { + return -1; + } + + ret = nextTok(p_cur); + + if (ret == NULL) { + return -1; + } else { + long l; + char *end; + + if (uns) + l = strtoul(ret, &end, base); + else + l = strtol(ret, &end, base); + + *p_out = (int)l; + + if (end == ret) { + return -1; + } + } + + return 0; +} + +/** + * Parses the next base 10 integer in the AT response line + * and places it in *p_out + * returns 0 on success and -1 on fail + * updates *p_cur + */ +int at_tok_nextint(char **p_cur, int *p_out) +{ + return at_tok_nextint_base(p_cur, p_out, 10, 0); +} + +/** + * Parses the next base 16 integer in the AT response line + * and places it in *p_out + * returns 0 on success and -1 on fail + * updates *p_cur + */ +int at_tok_nexthexint(char **p_cur, int *p_out) +{ + return at_tok_nextint_base(p_cur, p_out, 16, 1); +} + +int at_tok_nextbool(char **p_cur, char *p_out) +{ + int ret; + int result; + + ret = at_tok_nextint(p_cur, &result); + + if (ret < 0) { + return -1; + } + + // booleans should be 0 or 1 + if (!(result == 0 || result == 1)) { + return -1; + } + + if (p_out != NULL) { + *p_out = (char)result; + } + + return ret; +} + +int at_tok_nextstr(char **p_cur, char **p_out) +{ + if (*p_cur == NULL) { + return -1; + } + + *p_out = nextTok(p_cur); + + return 0; +} + +/** returns 1 on "has more tokens" and 0 if no */ +int at_tok_hasmore(char **p_cur) +{ + return ! (*p_cur == NULL || **p_cur == '\0'); +} + +void at_tok_skip_bracket(char **p_cur) +{ + if (*p_cur == NULL) return; + + while (**p_cur != '\0' && **p_cur == '(') { + (*p_cur)++; + } +} + + diff --git a/src/atchannel.c b/src/atchannel.c new file mode 100644 index 0000000..282918a --- /dev/null +++ b/src/atchannel.c @@ -0,0 +1,236 @@ +/* //device/system/reference-ril/atchannel.c +** +** Copyright 2006, The Android Open Source Project +** +** 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 "atchannel.h" +#include "at_tok.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern enum ATCommandType s_type; +extern char *s_responsePrefix; +extern struct ATResponse *sp_response; + +/** + * returns 1 if line is a final response indicating success + * See 27.007 annex B + */ +static const char * s_finalResponsesSuccess[] = { + "OK", +}; +/** + * returns 1 if line is a final response indicating error + * See 27.007 annex B + */ +static const char * s_finalResponsesError[] = { + "ERROR", + "+CMS ERROR:", + "+CME ERROR:", + "NO ANSWER", + "NO DIALTONE", +}; + + +struct ATResponse * at_response_new() +{ + return (struct ATResponse *) calloc(1, sizeof(struct ATResponse)); +} + +void at_response_free(struct ATResponse *p_response) +{ + struct ATLine *p_line; + + if (p_response == NULL) return; + + p_line = p_response->p_intermediates; + + while (p_line != NULL) { + struct ATLine *p_toFree; + + p_toFree = p_line; + p_line = p_line->p_next; + + free(p_toFree->line); + free(p_toFree); + } + + free (p_response->finalResponse); + free (p_response); +} + +char * findNextEOL(char *cur) +{ + if (cur[0] == '>' && cur[1] == ' ' && cur[2] == '\0') { + /* SMS prompt character...not \r terminated */ + return cur+2; + } + + // Find next newline + while (*cur != '\0' && *cur != '\r' && *cur != '\n') cur++; + + return *cur == '\0' ? NULL : cur; +} + +/** returns 1 if line starts with prefix, 0 if it does not */ +int strStartsWith(const char *line, const char *prefix) +{ + for ( ; *line != '\0' && *prefix != '\0' ; line++, prefix++) { + if (*line != *prefix) { + return 0; + } + } + + return *prefix == '\0'; +} + +int isFinalResponseError(const char *line) +{ + unsigned int i; + + for (i = 0 ; i < NUM_ELEMS(s_finalResponsesError) ; i++) { + if (strStartsWith(line, s_finalResponsesError[i])) { + return 1; + } + } + + return 0; +} + +int isFinalResponseSuccess(const char *line) +{ + unsigned int i; + + for (i = 0 ; i < NUM_ELEMS(s_finalResponsesSuccess) ; i++) { + if (strStartsWith(line, s_finalResponsesSuccess[i])) { + return 1; + } + } + + return 0; +} + +/** + * returns 1 if line is a final response, either error or success + * See 27.007 annex B + */ +int isFinalResponse(const char *line) +{ + return isFinalResponseSuccess(line) || isFinalResponseError(line); +} + +/** add an intermediate response to sp_response*/ +void addIntermediate(const char *line) +{ + struct ATLine *p_new; + + printf("addIntermediate line arrived : %s", line); + + p_new = (struct ATLine*) malloc(sizeof(struct ATLine)); + + p_new->line = strdup(line); + + /* note: this adds to the head of the list, so the list + will be in reverse order of lines received. the order is flipped + again before passing on to the command issuer */ + p_new->p_next = sp_response->p_intermediates; + sp_response->p_intermediates = p_new; +} + + +//** release sp_response & s_responsePrefix +void ReleaseResponse(void) +{ + if(sp_response!=NULL) + { + at_response_free(sp_response); + sp_response = NULL; + } + + if(s_responsePrefix!= NULL) + { + free(s_responsePrefix); + s_responsePrefix = NULL; + } + + s_type = NO_RESULT; +} + +void reverseIntermediates(struct ATResponse *p_response) +{ + struct ATLine *pcur,*pnext; + + pcur = p_response->p_intermediates; + p_response->p_intermediates = NULL; + + while (pcur != NULL) { + pnext = pcur->p_next; + pcur->p_next = p_response->p_intermediates; + p_response->p_intermediates = pcur; + pcur = pnext; + } +} + +void printResponse(void) +{ + struct ATLine *pcur= NULL; + struct ATLine *pnext= NULL; + int count =0; + + printf("sp_response.success : %d\n", sp_response->success); + + if(sp_response->finalResponse ==NULL) + { + printf("sp_response.finalResponse : NULL\n"); + } + else + { + printf("sp_response.finalResponse : %s\n",sp_response->finalResponse); + } + + + pcur = sp_response->p_intermediates; + + if(pcur ==NULL) + { + printf("sp_response.p_intermediates : NULL\n"); + } + + while(pcur != NULL) + { + printf("sp_response.p_intermediates[%d] : %s\n",count,pcur->line); + pnext = pcur->p_next; + pcur = pnext; + count++; + } +} + +TReturn convertCMEError(enum ATCMEError error) +{ + printf("CMEerror : %d", error); + + //mapping will be done later + return TCORE_RETURN_3GPP_ERROR; + +} diff --git a/src/desc_at.c b/src/desc_at.c new file mode 100644 index 0000000..702a46c --- /dev/null +++ b/src/desc_at.c @@ -0,0 +1,607 @@ +/* + * tel-plugin-atmodem + * + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "s_common.h" +#include "s_sim.h" +#include "s_ps.h" +#include "s_call.h" +#include "s_ss.h" +#include "s_sms.h" +#include "s_network.h" +#include "s_modem.h" +#include "atchannel.h" +#include "at_tok.h" + +static char s_ATBuffer[MAX_AT_RESPONSE+1]; +static char *s_ATBufferCur = s_ATBuffer; + +struct sms_pdu_control +{ + gboolean sms_pdu_mode; + + int sms_pdu_len; + int cum_pdu_len; + char* line1 ; + char* ppdu ; + char* ppdu_marker; +}; + +static struct sms_pdu_control spc; + +static int s_readCount = 0; + +enum ATCommandType s_type; +char *s_responsePrefix= NULL; +struct ATResponse *sp_response= NULL; + + +static const char * s_smsUnsoliciteds[] = { + "+CMT:" +}; + +static int isSMSUnsolicited(const char *line) +{ + unsigned int i; + + for (i = 0 ; i < NUM_ELEMS(s_smsUnsoliciteds) ; i++) { + if (strStartsWith(line, s_smsUnsoliciteds[i])) { + return 1; + } + } + + return 0; +} + +static void startSMSBuffering(char* line) +{ + char* temp_line = NULL; + int sms_pdu_len; + + spc.line1 = strdup(line); + + temp_line = line; + + at_tok_start(&temp_line); + at_tok_nextint(&temp_line, &sms_pdu_len); + + dbg("total pdu length : %d", sms_pdu_len); + spc.sms_pdu_len = sms_pdu_len; + + //allocate pdu buffer + spc.ppdu = malloc(sizeof(char) *sms_pdu_len); + spc.sms_pdu_mode = TRUE; + spc.cum_pdu_len = 0; +} + +static void stopSMSBuffering() +{ + if(spc.line1 != NULL) + free(spc.line1); + spc.line1 = NULL; + + spc.sms_pdu_len = 0; + spc.cum_pdu_len =0; + + spc.sms_pdu_mode = FALSE; + + if(spc.ppdu !=NULL) + free(spc.ppdu); + spc.ppdu = NULL; + + spc.ppdu_marker = NULL; + + dbg("sms pdu data buffering ended!"); +} + +static void handleFinalResponse(TcoreHal* hal, const char *line) +{ + dbg("Final response arrived. call response callback"); + + // 1. add final rsp string into sp_response + sp_response->finalResponse = strdup(line); + + // 1.1 reverse intermediates + reverseIntermediates(sp_response); + + // 2. pop head pending from queue -> call callback hung pending(on_response) -> + // release sp_response/s_responsePrefix -> release userRequest/pending -> send next pending from queue + // warning) length have no meaning. data always pointer sp_response + tcore_hal_dispatch_response_data(hal, ID_RESERVED_AT, strlen(line), sp_response); +} + +static void onUnsolicited (const char *s, TcorePlugin* plugin, char* sms_pdu, int pdu_len) +{ + char *line = NULL, *p= NULL; + char *cmd = NULL; + struct smsDeliveryPDU smsPdu; + + int id; + int status, direction; + +#define STATUS_INCOMING 4 +#define STATUS_WAITING 5 + + + if(strStartsWith(s,"+CMT:")){ + //SMS incoming + cmd = EVENT_SMS_INCOM_MSG; + + smsPdu.cmdLine = strdup(s); + smsPdu.pdu = malloc(pdu_len); + memcpy(smsPdu.pdu, sms_pdu, pdu_len); + smsPdu.len = pdu_len; + + tcore_plugin_core_object_event_emit(plugin, cmd, &smsPdu); + free(smsPdu.cmdLine); + free(smsPdu.pdu); + + return; + } + /* Ignore unsolicited responses until we're initialized. + * This is OK because the RIL library will poll for initial state + */ + else if (strStartsWith(s,"%SCFUN:")){ + /* SS specific -- modem power status notification */ + cmd = EVENT_MODEM_PHONE_STATE; + } + else if(strStartsWith(s,"%SCSIM:")){ + cmd = EVENT_SIM_PIN_STATUS; + } + else if(strStartsWith(s,"%SCLCC:")){ + line = strdup(s); + p = line; + + at_tok_start(&p); + at_tok_nextint(&p, &id); + at_tok_nextint(&p, &direction); + at_tok_nextint(&p, &status); + + switch(status){ + case STATUS_INCOMING: + cmd = EVENT_CALL_INCOMING; + break; + case STATUS_WAITING: + cmd = EVENT_CALL_WAITING; + break; + default: + cmd = EVENT_CALL_STATUS; + break; + } + + free(line); + + dbg("%SCLCC cmd : %d",cmd); + } + else if (strStartsWith(s,"+CRING:") + || strStartsWith(s,"RING")){ + dbg("incoming call notification - wait for SCLCC with status 4"); + return; + } + else if (strStartsWith(s,"CONNECT")){ + dbg("call connect notification - wait for SCLCC with status 0"); + return; + } + else if (strStartsWith(s,"NO CARRIER")){ + dbg("call release notification - wait for SCLCC with status 7"); + return ; + } + else if(strStartsWith(s,"+CCWA:")){ + dbg("call waiting notification - wait for SCLCC with status 5"); + return; + } + else if (strStartsWith(s,"+CREG:") + || strStartsWith(s,"+CGREG:")){ + cmd = EVENT_NETWORK_REGISTRATION; + } + else if (strStartsWith(s,"+CMGS:")) { + cmd = EVENT_SMS_SEND_ACK; + } + else if (strStartsWith(s,"%SCDEV:")) { + cmd = EVENT_SMS_DEVICE_READY; + } + else if(strStartsWith(s,"+CIEV:")){ + cmd = EVENT_NETWORK_ICON_INFO; + } + else if (strStartsWith(s,"+CSSU:")){ + cmd = EVENT_SS_INFO; + } + else if (strStartsWith(s,"+CUSD:")){ + cmd = EVENT_SS_USSD; + } + + /* Send Event */ + if(cmd) + { + line = strdup(s); + tcore_plugin_core_object_event_emit(plugin, cmd, line); + free(line); + } + +} + +static void processLine(TcoreHal *hal, char *line, TcorePlugin* p) +{ + TcoreQueue* pPendingQueue = NULL; + TcorePending* pPending =NULL; + gboolean result_status = FALSE; + pPendingQueue =(TcoreQueue*)tcore_hal_ref_queue(hal); + pPending = (TcorePending*)tcore_queue_ref_head(pPendingQueue); //topmost request + + dbg("processLine -------start"); + + if(TCORE_RETURN_SUCCESS == tcore_pending_get_send_status(pPending, &result_status) + && (result_status == FALSE))//request not sent but data comes - Unsolicited msg! + { + /* no command pending */ + dbg("no command pending. call onUnsolicited()"); + onUnsolicited(line, p, NULL, 0); + } else if (isFinalResponseSuccess(line)) { + dbg("final response -success. call handleFinalResponse()"); + sp_response->success = 1; + handleFinalResponse(hal, line); + } else if (isFinalResponseError(line)) { + dbg("final response -ERROR. call handleFinalResponse()"); + sp_response->success = 0; + handleFinalResponse(hal, line); + } else switch (s_type) { + case NO_RESULT: + { + dbg("[NO_RESULT]:call onUnsolicited()"); + onUnsolicited(line, p, NULL, 0); + } + break; + case NUMERIC: + { + if (sp_response->p_intermediates == NULL + && isdigit(line[0]) + ) { + dbg("[NUMERIC]:line[0] is digit. call addIntermediate()"); + addIntermediate(line); + } else { + /* either we already have an intermediate response or + the line doesn't begin with a digit */ + dbg("[NUMERIC]:either we already have an intermediate response or the line doesn't begin with a digit. call onUnsolicited()"); + onUnsolicited(line,p,NULL, 0); + } + } + break; + case SINGLELINE: + { + if (sp_response->p_intermediates == NULL + && strStartsWith (line, s_responsePrefix) + ) { + dbg("[SINGLELINE]:line starts with s_responsePrefix. call addIntermediate()"); + addIntermediate(line); + } else { + /* we already have an intermediate response */ + dbg("[SINGLELINE]:we already have an intermediate response. call onUnsolicited()"); + onUnsolicited(line,p, NULL, 0); + } + } + break; + case MULTILINE: + if (strStartsWith (line, s_responsePrefix)) { + dbg("[MULTILINE]:line starts with s_responsePrefix. call addIntermediate()"); + addIntermediate(line); + } else { + dbg("[MULTILINE]:line don't starts with s_responsePrefix. call onUnsolicited()"); + onUnsolicited(line,p, NULL, 0); + } + break; + + default: /* this should never be reached */ + err("Unsupported AT command type %d\n", s_type); + onUnsolicited(line,p, NULL, 0); + break; + } +} + +static gboolean readline(TcoreHal *hal, unsigned int data_len, const void *data, TcorePlugin* p) +{ + char *ret; + char *p_read = NULL; + char *p_eol = NULL; + char *p_marker = NULL; + int len, leftover_len; + + char* act_data; + int act_len; + + act_data = (char*)data; + act_len = data_len; + + dbg("recv string = %s, length : %d", (char*)act_data, act_len); + /* this is a little odd. I use *s_ATBufferCur == 0 to + * mean "buffer consumed completely". If it points to a character, than + * the buffer continues until a \0 + */ + +/*check sms pdu cumulating process - data hijacking*/ + if(spc.sms_pdu_mode == TRUE) + { //continue sms pdu buffering + dbg("resume pdu buffering. pdu size : %d, gathered size : %d",spc.sms_pdu_len,spc.cum_pdu_len); + len = spc.sms_pdu_len - spc.cum_pdu_len; //length needed + + if(act_len > len){ + dbg("whole pdu received - data surplus"); + memcpy(spc.ppdu_marker, act_data,len);//data fully copied + spc.cum_pdu_len = spc.cum_pdu_len + len; + + //change data & datalen + act_data = act_data + len; + act_len = act_len - len; + dbg("recv string changed to = %s, length changed to : %d", (char*)act_data, act_len); + + onUnsolicited(spc.line1, p, spc.ppdu, spc.sms_pdu_len); + stopSMSBuffering(); + dbg("incoming sms handled. back to normal mode & continue"); + } + else if(act_len == len){ + dbg("exactly whole pdu received"); + + memcpy(spc.ppdu_marker, act_data,len);//data fully copied + spc.cum_pdu_len = spc.cum_pdu_len + len; + + onUnsolicited(spc.line1, p, spc.ppdu, spc.sms_pdu_len); + stopSMSBuffering(); + dbg("all incoming data consumed. return"); + return TRUE; + } + else { + dbg("data received but not sufficient"); + memcpy(spc.ppdu_marker, act_data,act_len); + spc.ppdu_marker = spc.ppdu_marker +act_len; + spc.cum_pdu_len = spc.cum_pdu_len + act_len; + dbg("data buffered. wait for more data"); + return TRUE; + } + } + + + if (*s_ATBufferCur == '\0') + { + /* empty buffer */ + s_ATBufferCur = s_ATBuffer; + *s_ATBufferCur = '\0'; + p_read = s_ATBuffer; + } + else + { + /* *s_ATBufferCur != '\0' */ + /* there's data in the buffer from the last read */ + + // skip over leading newlines + while (*s_ATBufferCur == '\r' || *s_ATBufferCur == '\n') + s_ATBufferCur++; + + p_eol = findNextEOL(s_ATBufferCur); + + if (p_eol == NULL) + { + /* a partial line. move it up and prepare to read more */ + unsigned int len; + len = strlen(s_ATBufferCur); + + memmove(s_ATBuffer, s_ATBufferCur, len + 1); + p_read = s_ATBuffer + len; + s_ATBufferCur = s_ATBuffer; + } + /* Otherwise, (p_eol !- NULL) there is a complete line */ + else + { + err("this should not be happening - complete data pending??"); + } + + } + + if (0 > MAX_AT_RESPONSE - ((p_read - s_ATBuffer)+(int)act_len)) + { + dbg("ERROR: Input line exceeded buffer\n"); + /* ditch buffer and start over again */ + s_ATBufferCur = s_ATBuffer; + *s_ATBufferCur = '\0'; + p_read = s_ATBuffer; + } + + //copy data into buffer + memcpy(p_read, act_data, act_len); + + if (act_len <= 0) + { + /* read error encountered or EOF reached */ + if(act_len == 0) { + err("atchannel: EOF reached"); + } + else { + err("invalid data coming"); + } + return FALSE; + } + else + { + s_readCount += act_len; + p_read[act_len] = '\0'; + + p_marker = p_read + act_len; //pin the last position of data copy + } + + + do + { + // skip over leading newlines + while (*s_ATBufferCur == '\r' || *s_ATBufferCur == '\n') + s_ATBufferCur++; + + p_eol = findNextEOL(s_ATBufferCur); + + if(p_eol !=NULL) /*end of line found!*/ + { + /* a full line in the buffer. Place a \0 over the \r and return */ + ret = s_ATBufferCur; + *p_eol = '\0'; + s_ATBufferCur = p_eol + 1; /* this will always be <= p_read, */ + /* and there will be a \0 at *p_read */ + + dbg("complete line found. process it/n"); + dbg("rsp line : %s/n",ret); + if(1 == isSMSUnsolicited(ret)) + { + dbg("start of incoming sms found!!! - next data is PDU"); + startSMSBuffering(ret); + s_ATBufferCur++; //move starting point by 1 - it goes to the very starting point of PDU + leftover_len = p_marker - s_ATBufferCur; + + dbg("count leftover : %d", leftover_len); + if(leftover_len <0){ + dbg("pointer address error -serious!"); + return FALSE; + } + else if(leftover_len ==0){ + dbg("no pdu received - wait for incoming data"); + spc.cum_pdu_len =0; + spc.ppdu_marker = spc.ppdu; + } + else if(leftover_len >= spc.sms_pdu_len){ + dbg("whole pdu already received!"); + memcpy(spc.ppdu, s_ATBufferCur, spc.sms_pdu_len); + spc.cum_pdu_len = spc.sms_pdu_len; + onUnsolicited(spc.line1, p, spc.ppdu, spc.sms_pdu_len); + s_ATBufferCur = s_ATBufferCur+spc.sms_pdu_len; + dbg("move buffercur to point the very end of pdu!"); + stopSMSBuffering(); + } + else { + dbg("staring part of pdu received!"); + memcpy(spc.ppdu, s_ATBufferCur,leftover_len); + spc.ppdu_marker = spc.ppdu + leftover_len; + spc.cum_pdu_len = leftover_len; + s_ATBufferCur = s_ATBufferCur + leftover_len; + } + + } + else + { + processLine(hal, ret,p); + } + } + else + { + dbg("complete responses all handled/n"); + } + }while(p_eol != NULL); + + dbg("all the pending rsp's handled. wait for next incoming data/n"); + return TRUE; +} + +static enum tcore_hook_return on_hal_send(TcoreHal *hal, unsigned int data_len, void *data, void *user_data) +{ + hook_hex_dump(TX, data_len, data); + return TCORE_HOOK_RETURN_CONTINUE; +} + +static void on_hal_recv(TcoreHal *hal, unsigned int data_len, const void *data, void *user_data) +{ + gboolean ret = FALSE; + TcorePlugin *plugin = user_data; + + ret = readline(hal,data_len, data,plugin); +} + +static gboolean on_load() +{ + dbg("i'm load!"); + + return TRUE; +} + +static gboolean on_init(TcorePlugin *p) +{ + TcoreHal *h; + + if (!p) + return FALSE; + + dbg("i'm init!"); + + h = tcore_server_find_hal(tcore_plugin_ref_server(p), "vmodem"); + if (!h) { + return FALSE; + } + + tcore_plugin_set_hal(p, h); + + tcore_hal_add_send_hook(h, on_hal_send, p); + tcore_hal_add_recv_callback(h, on_hal_recv, p); + + s_modem_init(p); + s_network_init(p); + s_sim_init(p); +// s_sap_init(p); + s_ps_init(p); + s_call_init(p); + s_ss_init(p); + s_sms_init(p); +// s_phonebook_init(p); +#ifndef TEST_AT_SOCKET + tcore_hal_set_power(h, TRUE); +#endif +//send "CPAS" command to invoke POWER UP NOTI + s_modem_send_poweron(p); + + return TRUE; +} + +static void on_unload(TcorePlugin *p) +{ + struct global_data *gd; + + if (!p) + return; + + dbg("i'm unload"); + + gd = tcore_plugin_ref_user_data(p); + if (gd) { + free(gd); + } +} + +struct tcore_plugin_define_desc plugin_define_desc = +{ + .name = "ATMODEM", + .priority = TCORE_PLUGIN_PRIORITY_MID, + .version = 1, + .load = on_load, + .init = on_init, + .unload = on_unload +}; diff --git a/src/s_call.c b/src/s_call.c new file mode 100644 index 0000000..e69ad9d --- /dev/null +++ b/src/s_call.c @@ -0,0 +1,2189 @@ +/* + * tel-plugin-atmodem + * + * 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 +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "s_common.h" +#include "s_call.h" + +#include "atchannel.h" +#include "at_tok.h" + + +extern struct ATResponse *sp_response; +extern char *s_responsePrefix; +extern enum ATCommandType s_type; + +struct call_confirm_info_t { + CallObject *co; + enum tcore_response_command resp; +}; + +struct CLCC_call_t { + struct CLCC_call_info_t { + int id; + enum tcore_call_direction direction; + enum tcore_call_status status; + enum tcore_call_type type; + int mpty; + int num_len; + int num_type; + } info; + char number[90]; +}; + + +static gboolean _call_request_message( CoreObject *o, UserRequest* ur, char* cmd_string, + unsigned int cmd_length, void* on_resp, void* user_data); + +static void _call_status_idle( TcorePlugin *p, CallObject *co ); +static void _call_status_active( TcorePlugin *p, CallObject *co ); +static void _call_status_dialing( TcorePlugin *p, CallObject *co ); +static void _call_status_alert( TcorePlugin *p, CallObject *co ); +static void _call_status_incoming( TcorePlugin *p, CallObject *co ); +static void _call_status_waiting( TcorePlugin *p, CallObject *co ); + +static void _call_branch_by_status( TcorePlugin *p, CallObject *co, unsigned int status ); +static enum tcore_call_type _call_type( int type ); +static enum tcore_call_status _call_status(unsigned int status); +static gboolean _call_is_in_mpty(int mpty); + +static TReturn _call_list_get( CoreObject *o, CallObject *co ); + +static void on_confirmation_call_message_send( TcorePending *p, gboolean result, void *user_data ); // from Kernel +static void on_confirmation_call_request( TcorePending *p, int data_len, const void *data, void *user_data ); // from Modem +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 ); +static void on_confirmation_call_hold_and_accept( TcorePending *p, int data_len, const void *data, void *user_data ); +static void on_confirmation_call_endall( TcorePending *p, int data_len, const void *data, void *user_data ); // from Modem + + +static void on_response_call_list_get(TcorePending *p, int data_len, const void *data, void *user_data); +static void on_notification_call_waiting( CoreObject *o, const void *data, void *user_data ); +static void on_notification_call_incoming( CoreObject *o, const void *data, void *user_data ); +static void on_notification_call_status( CoreObject *o, const void *data, void *user_data); + + +static int _callFromCLCCLine(char *line, struct CLCC_call_t *p_call); + + +static enum tcore_call_cli_mode _get_clir_status( char *num ) +{ + enum tcore_call_cli_mode clir = CALL_CLI_MODE_DEFAULT; + + if( !strncmp( num, "*31#", 4 ) ) + return TCORE_CALL_CLI_MODE_RESTRICT; + + if( !strncmp( num, "#31#", 4 ) ) + return TCORE_CALL_CLI_MODE_PRESENT; + + return clir; +} + + +static enum tcore_call_status _call_status(unsigned int status) +{ + switch(status) + { + case 0: + return TCORE_CALL_STATUS_ACTIVE; + case 1: + return TCORE_CALL_STATUS_HELD; + case 2: + return TCORE_CALL_STATUS_DIALING; + case 3: + return TCORE_CALL_STATUS_ALERT; + case 4: + return TCORE_CALL_STATUS_INCOMING; + case 5: + return TCORE_CALL_STATUS_WAITING; + case 6: + return TCORE_CALL_STATUS_DIALING; //connecting not exist. set to dialing + case 7: + return TCORE_CALL_STATUS_IDLE; + + default: + return TCORE_CALL_STATUS_IDLE; + break; + } + + return TCORE_CALL_STATUS_IDLE; +} + +static gboolean _call_is_in_mpty(int mpty) +{ + switch(mpty){ + case 0: + return FALSE; + break; + + case 1: + return TRUE; + + default: + break; + } + return FALSE; +} + +static enum tcore_call_type _call_type(int type ) +{ + switch (type) { + case 0: + return TCORE_CALL_TYPE_VOICE; + case 1: + return TCORE_CALL_TYPE_VIDEO; + default: + break; + } + + return TCORE_CALL_TYPE_VOICE; +} + +static gboolean _call_request_message( CoreObject *o, + UserRequest *ur, + char *cmd_string, + unsigned int cmd_len, + void* on_resp, + void* user_data) +{ + TcorePending *pending = NULL; + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + + unsigned int info_len = 0; + info_len = sizeof(struct ATReqMetaInfo); + + dbg("_call_request_message - cmd : %s, cmdlen :%d (including '\r')",cmd_string, cmd_len); + + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, cmd_len, cmd_string); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + 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 ) { + dbg("[ check ] ur is NULL, is this internal request??"); + } else { + tcore_pending_link_user_request(pending, ur); + } + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + tcore_hal_send_request(h, pending); + + return TRUE; +} + +static void _call_status_idle( TcorePlugin *p, CallObject *co ) +{ + struct tnoti_call_status_idle data; + + dbg("call id [%d], call status [%d]", tcore_call_object_get_id(co), tcore_call_object_get_status(co)); + + if ( tcore_call_object_get_status( co ) != TCORE_CALL_STATUS_IDLE ) { + + CoreObject *o = 0; + //int id = 0; + + o = tcore_plugin_ref_core_object(p, "call"); + + 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 ); + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_IDLE ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + o, + TNOTI_CALL_STATUS_IDLE, + sizeof(struct tnoti_call_status_idle), + (void*)&data ); + + tcore_call_object_free( o, co ); + } else { + + dbg("[ error ] call object was not free"); + } +} + +static void _call_status_dialing( TcorePlugin *p, CallObject *co ) +{ + CoreObject* o = 0; + + struct tnoti_call_status_dialing data; + + o = tcore_plugin_ref_core_object( p, "call"); + + if ( tcore_call_object_get_status( co ) != TCORE_CALL_STATUS_DIALING ) { + + 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 ); + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_DIALING ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_STATUS_DIALING, + sizeof(struct tnoti_call_status_dialing), + (void*)&data ); + + } + +#if 0 + _call_list_get( o, co ); +#endif +} + +static void _call_status_alert( TcorePlugin *p, CallObject *co ) +{ + CoreObject* o = 0; + struct tnoti_call_status_alert data; + + o = tcore_plugin_ref_core_object( p, "call"); + + 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 ); + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_ALERT ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_STATUS_ALERT, + sizeof(struct tnoti_call_status_alert), + (void*)&data ); + + } + +#if 0 + _call_list_get( o, co ); +#endif +} + +static void _call_status_active( TcorePlugin *p, CallObject *co ) +{ + struct tnoti_call_status_active data; + + if ( tcore_call_object_get_status( co ) != TCORE_CALL_STATUS_ACTIVE ) { + + 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 ); + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_ACTIVE ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_STATUS_ACTIVE, + sizeof(struct tnoti_call_status_active), + (void*)&data ); + + } +} + +static void _call_status_held( TcorePlugin *p, CallObject *co ) +{ + struct tnoti_call_status_held data; + + if ( tcore_call_object_get_status( co ) != TCORE_CALL_STATUS_HELD ) { + + 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 ); + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_HELD ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_STATUS_HELD, + sizeof(struct tnoti_call_status_held), + (void*)&data ); + + } +} + +static void _call_status_incoming( TcorePlugin *p, CallObject *co ) +{ + struct tnoti_call_status_incoming data; + CoreObject* o = 0; + o = tcore_plugin_ref_core_object( p, "call"); + + if ( tcore_call_object_get_status( co ) != TCORE_CALL_STATUS_INCOMING ) { + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_INCOMING ); + + 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.cli.mode = tcore_call_object_get_cli_mode( co ); + dbg("data.cli.mode : [%d]", data.cli.mode ); + + tcore_call_object_get_number( co, data.cli.number ); + dbg("data.cli.number : [%s]", data.cli.number ); + + data.cna.mode = tcore_call_object_get_cna_mode( co ); + dbg("data.cna.mode : [%d]", data.cna.mode ); + + 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.active_line = tcore_call_object_get_active_line( co ); + dbg("data.active_line : [%d]", data.active_line ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_STATUS_INCOMING, + sizeof(struct tnoti_call_status_incoming), + (void*)&data ); + } + +#if 0 + _call_list_get( o, co ); +#endif + +} + +static void _call_status_waiting( TcorePlugin *p, CallObject *co ) +{ + _call_status_incoming( p, co ); +} + +static void _call_branch_by_status( TcorePlugin *p, CallObject *co, unsigned int status ) +{ + switch ( status ) { + case TCORE_CALL_STATUS_IDLE: + _call_status_idle( p, co ); + break; + + case TCORE_CALL_STATUS_ACTIVE: + _call_status_active( p, co ); + break; + + case TCORE_CALL_STATUS_HELD: + _call_status_held( p, co ); + break; + + case TCORE_CALL_STATUS_DIALING: + _call_status_dialing( p, co ); + break; + + case TCORE_CALL_STATUS_ALERT: + _call_status_alert( p, co ); + break; + + case TCORE_CALL_STATUS_INCOMING: + _call_status_incoming( p, co ); + break; + + case TCORE_CALL_STATUS_WAITING: + _call_status_waiting( p, co ); + break; + } +} + + +static TReturn _call_list_get( CoreObject *o, CallObject *co ) +{ + gboolean ret = FALSE; + UserRequest* ur = NULL; + + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + if ( !o ) + return TCORE_RETURN_FAILURE; + + ur = tcore_user_request_new(NULL, NULL); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + + metainfo.type = MULTILINE; + memcpy(metainfo.responsePrefix,"+CLCC:",strlen("+CLCC:")); + info_len = sizeof(struct ATReqMetaInfo); + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup("AT+CLCC\r"); + + ret = _call_request_message ( o, ur, cmd_str, strlen(cmd_str), on_response_call_list_get, NULL); + + if ( !ret ) + return TCORE_RETURN_FAILURE; + + return TCORE_RETURN_SUCCESS; +} + + + + +// CONFIRMATION + +static void on_confirmation_call_message_send( TcorePending *p, gboolean result, void *user_data ) +{ + UserRequest* ur = NULL; + struct ATReqMetaInfo* metainfo = NULL; + unsigned int info_len =0; + dbg("on_confirmation_call_message_send - msg out from queue. alloc ATRsp buffer & write rspPrefix if needed\n"); + + ReleaseResponse(); //release leftover +//alloc new sp_response + + sp_response = at_response_new(); + + ur = tcore_pending_ref_user_request(p); + metainfo = (struct ATReqMetaInfo*)tcore_user_request_ref_metainfo(ur,&info_len); + + if((metainfo->type == SINGLELINE)|| + (metainfo->type == MULTILINE)) + { + //cp rsp prefix + s_responsePrefix = strdup(metainfo->responsePrefix); + dbg("duplicating responsePrefix : %s\n", s_responsePrefix); + } + else + { + s_responsePrefix = NULL; + } + +//set atcmd type into s_type + s_type = metainfo->type; + + if (result == FALSE) { + /* Fail */ + dbg("SEND FAIL"); + } + else { + dbg("SEND OK"); + } +} + +static void _confirmation_call( CoreObject *o, UserRequest *ur, TReturn err, struct call_confirm_info_t *ci ) +{ + struct tresp_call_general resp; + + if ( !ci->co ) + dbg("call object is NULL, is it general requst??"); + + resp.type = (enum telephony_call_type )tcore_call_object_get_type( ci->co ); + resp.id = tcore_call_object_get_id( ci->co ); + resp.err = err; + + if (ur) { + tcore_user_request_send_response(ur, ci->resp, sizeof(struct tresp_call_general), &resp); + + } else { + dbg("[ error ] ur is NULL"); + return ; + } + + dbg("resp.err : [ 0x%x ]", resp.err); + +#if 0 + _call_list_get( o, ci->co ); +#endif + +} + + +static void on_confirmation_call_request( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + TReturn err = TCORE_RETURN_SUCCESS; + + struct call_confirm_info_t* ci = 0; + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + + ci = (struct call_confirm_info_t *)user_data; + if ( !ci ) { + dbg("[ error ] user_data is NULL"); + return ; + } + + if(sp_response->success >0) + err = TCORE_RETURN_SUCCESS; + else + err = TCORE_RETURN_FAILURE; + + ReleaseResponse(); + + _confirmation_call( o, ur, err, ci ); + + g_free( ci ); +} + +static void on_confirmation_call_split( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + + struct tresp_call_general resp; + struct call_confirm_info_t *ci = 0; + + dbg("ok, function entrance"); + printResponse(); + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + ci = (struct call_confirm_info_t *)user_data; + if ( !ci ) { + dbg("[ error ] user_data is NULL"); + goto out; + } + + resp.type = (enum telephony_call_type )tcore_call_object_get_type( ci->co ); + resp.id = tcore_call_object_get_id( ci->co ); + if(sp_response->success >0){ + resp.err = FALSE; + }else{ + resp.err = TRUE; + } + + ReleaseResponse(); + + if ( ur ) { + tcore_user_request_send_response(ur, ci->resp, sizeof(struct tresp_call_general), &resp); + + } else { + dbg("[ error ] ur is NULL"); + goto out; + } + + if ( !resp.err ) { + + GSList *active = 0; + CallObject *co = 0; + + active = tcore_call_object_find_by_status( o, TCORE_CALL_STATUS_ACTIVE ); + if ( !active ) { + dbg("[ error ] can't find active call"); + goto out; + } + + co = (CallObject*)active->data; + if ( !co ) { + dbg("[ error ] can't get active call object"); + goto out; + } + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_HELD ); + tcore_call_object_set_status( ci->co, TCORE_CALL_STATUS_ACTIVE ); + } + +out: + g_free( ci ); + +} + + +static void on_confirmation_call_hold( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + + struct tresp_call_general resp; + struct call_confirm_info_t *ci = 0; + + dbg("ok, function entrance"); + printResponse(); + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + ci = (struct call_confirm_info_t *)user_data; + if ( !ci ) { + dbg("[ error ] user_data is NULL"); + goto out; + } + + resp.type = (enum telephony_call_type )tcore_call_object_get_type( ci->co ); + resp.id = tcore_call_object_get_id( ci->co ); + + if(sp_response->success >0){ + resp.err = FALSE; + }else{ + resp.err = TRUE; + } + + ReleaseResponse(); + + + if ( ur ) { + tcore_user_request_send_response(ur, ci->resp, sizeof(struct tresp_call_general), &resp); + + } else { + dbg("[ error ] ur is NULL"); + goto out; + } + + if ( !resp.err ) { + + GSList *active = 0; + CallObject *co = 0; + + active = tcore_call_object_find_by_status( o, TCORE_CALL_STATUS_ACTIVE ); + if ( !active ) { + dbg("[ error ] can't find active call"); + goto out; + } + + co = (CallObject*)active->data; + if ( !co ) { + dbg("[ error ] can't get active call object"); + goto out; + } + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_HELD ); + } + +out: + g_free( ci ); + +} + +static void on_confirmation_call_swap( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + + struct tresp_call_general resp; + struct call_confirm_info_t *ci = 0; + + dbg("ok, function entrance"); + printResponse(); + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + ci = (struct call_confirm_info_t *)user_data; + if ( !ci ) { + dbg("[ error ] user_data is NULL"); + goto out; + } + + + resp.type = (enum telephony_call_type )tcore_call_object_get_type( ci->co ); + resp.id = tcore_call_object_get_id( ci->co ); + if(sp_response->success >0){ + resp.err = FALSE; + }else{ + resp.err = TRUE; + } + + ReleaseResponse(); + + if ( ur ) { + tcore_user_request_send_response(ur, ci->resp, sizeof(struct tresp_call_general), &resp); + + } else { + dbg("[ error ] ur is NULL"); + goto out; + } + + if ( !resp.err ) { + + GSList *active = 0, *held = 0; + CallObject *co = 0; + + held = tcore_call_object_find_by_status( o, TCORE_CALL_STATUS_HELD ); + if ( !held ) { + dbg("[ error ] can't find held call"); + goto out; + } + + active = tcore_call_object_find_by_status( o, TCORE_CALL_STATUS_ACTIVE ); + if ( !active ) { + dbg("[ error ] can't find active call"); + goto out; + } + + co = (CallObject*)held->data; + if ( !co ) { + dbg("[ error ] can't get held call object"); + goto out; + } + + resp.id = tcore_call_object_get_id( co ); + tcore_call_object_set_status( co, TCORE_CALL_STATUS_ACTIVE ); + + tcore_user_request_send_response(ur, TRESP_CALL_ACTIVE, sizeof(struct tresp_call_general), &resp); + + co = (CallObject*)active->data; + if ( !co ) { + dbg("[ error ] can't get active call object"); + goto out; + } + + resp.id = tcore_call_object_get_id( co ); + tcore_call_object_set_status( co, TCORE_CALL_STATUS_HELD ); + + tcore_user_request_send_response(ur, TRESP_CALL_HOLD, sizeof(struct tresp_call_general), &resp); + } + +out: + g_free( ci ); +} + +static void on_confirmation_call_hold_and_accept( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + + struct tresp_call_general resp; + struct call_confirm_info_t *ci = 0; + + dbg("ok, function entrance"); + printResponse(); + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + ci = (struct call_confirm_info_t *)user_data; + if ( !ci ) { + dbg("[ error ] user_data is NULL"); + goto out; + } + + + resp.type = (enum telephony_call_type )tcore_call_object_get_type( ci->co ); + resp.id = tcore_call_object_get_id( ci->co ); + + if(sp_response->success >0){ + resp.err = FALSE; + }else{ + resp.err = TRUE; + } + + ReleaseResponse(); + + if ( ur ) { + tcore_user_request_send_response(ur, ci->resp, sizeof(struct tresp_call_general), &resp); + + } else { + dbg("[ error ] ur is NULL"); + goto out; + } + + if ( !resp.err ) { + + GSList *l = 0; + CallObject *co = 0; + + l = tcore_call_object_find_by_status( o, TCORE_CALL_STATUS_ACTIVE ); + if ( !l ) { + dbg("[ error ] can't find active call"); + goto out; + } + + co = (CallObject*)l->data; + if ( !co ) { + dbg("[ error ] can't get active call object"); + goto out; + } + + tcore_call_object_set_status( co, TCORE_CALL_STATUS_HELD ); + } + +out: + g_free( ci ); +} + +// RESPONSE +static void on_confirmation_call_endall( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + //TReturn err = TCORE_RETURN_SUCCESS; + struct call_confirm_info_t* ci = 0; + + dbg("on_confirmation_call_endall - 1st result. wait for final result"); + + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + +//skip response handling - actual result will be handled in on_confirmation_call_request + ReleaseResponse(); + + ci = (struct call_confirm_info_t *)user_data; + if ( !ci ) { + dbg("[ error ] user_data is NULL"); + return ; + } +} + +// RESPONSE + +static void on_response_call_list_get(TcorePending *p, int data_len, const void *data, void *user_data) +{ + TcorePlugin* plugin = 0; + CoreObject* o = 0; + CallObject* co = 0; + struct ATLine *p_cur; + + char* cmd= 0; + struct CLCC_call_t* call_list = 0; + + int i = 0, countCalls =0, countValidCalls =0, err =0; + + + plugin = tcore_pending_ref_plugin( p ); + o = tcore_pending_ref_core_object( p ); + + cmd = (char*)data; + + + if(sp_response->success > 0) + { + + /* count the calls */ + for (countCalls = 0, p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next + ) { + countCalls++; + } + dbg("total calls : %d",countCalls); + + if(countCalls ==0) + return; + + call_list = g_new0( struct CLCC_call_t, countCalls); + + + for (countValidCalls = 0, p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next) + { + + err = _callFromCLCCLine( p_cur->line, call_list + countValidCalls ); + + if (err != 0) { + continue; + } + + co = tcore_call_object_find_by_id( o, call_list[i].info.id ); + if ( !co ) { + co = tcore_call_object_new( o, call_list[i].info.id ); + if ( !co ) { + dbg("error : tcore_call_object_new [ id : %d ]", call_list[i].info.id); + continue ; + } + } + + tcore_call_object_set_type( co, _call_type( call_list[i].info.type ) ); + tcore_call_object_set_direction( co, call_list[i].info.direction ); + tcore_call_object_set_multiparty_state( co, _call_is_in_mpty(call_list[i].info.mpty) ); + tcore_call_object_set_cli_info( co, CALL_CLI_MODE_DEFAULT, call_list[i].number ); + + _call_branch_by_status( plugin, co, call_list[i].info.status ); + + } + } + + ReleaseResponse(); +} + +static int _callFromCLCCLine(char *line, struct CLCC_call_t*p_call) +{ + //+CLCC: 1,0,2,0,0,\"+18005551212\",145 + // index,isMT,state,mode,isMpty(,number,TOA)? + + int err; + int state; + int mode; + int isMT; + char* num; + + err = at_tok_start(&line); + if (err < 0) goto error; + +//id + err = at_tok_nextint(&line, &(p_call->info.id)); + if (err < 0) goto error; + dbg("id : [%d]\n", p_call->info.id ); +//MO/MTcall + err = at_tok_nextint(&line, &isMT); + if (err < 0) goto error; + + if(isMT ==0) + p_call->info.direction = TCORE_CALL_DIRECTION_OUTGOING; + else + p_call->info.direction = TCORE_CALL_DIRECTION_INCOMING; + + dbg("direction : [ %d ]\n", p_call->info.direction); + +//state + err = at_tok_nextint(&line, &state); + if (err < 0) goto error; + + switch(state){ + case 0: //active + p_call->info.status = TCORE_CALL_STATUS_ACTIVE; + break; + case 1: + p_call->info.status = TCORE_CALL_STATUS_HELD; + break; + case 2: + p_call->info.status = TCORE_CALL_STATUS_DIALING; + break; + case 3: + p_call->info.status = TCORE_CALL_STATUS_ALERT; + break; + case 4: + p_call->info.status = TCORE_CALL_STATUS_INCOMING; + break; + case 5: + p_call->info.status = TCORE_CALL_STATUS_WAITING; + break; + } + dbg("status : [%d]\n", p_call->info.status ); + +//mode + err = at_tok_nextint(&line, &mode); + if (err < 0) goto error; + + switch(mode) + { + case 0: + p_call->info.type = TCORE_CALL_TYPE_VOICE; + break; + + case 1: + p_call->info.type = TCORE_CALL_TYPE_VIDEO; + break; + + default: // only Voice/VT call is supported in CS. treat other unknown calls as error + dbg("invalid type : [%d]\n", mode ); + goto error; + break; + } + dbg("type : [%d]\n", p_call->info.type ); + + + err = at_tok_nextint(&line, &(p_call->info.mpty)); + if (err < 0) goto error; + dbg("mpty : [%d]\n", p_call->info.mpty ); + + if (at_tok_hasmore(&line)) { + err = at_tok_nextstr(&line, &num); + + /* tolerate null here */ + if (err < 0) return 0; + + memcpy(p_call->number, num, strlen(num)); + dbg("number : [ %s ]\n", p_call->number ); + + p_call->info.num_len = strlen(num); + dbg("num_len : [0x%x]\n", p_call->info.num_len ); + + err = at_tok_nextint(&line, &(p_call->info.num_type)); + if (err < 0) goto error; + dbg("num_type : [0x%x]\n", p_call->info.num_type ); + + } + + return 0; + +error: + err("invalid CLCC line\n"); + return -1; +} + +// NOTIFICATION + +static void on_notification_call_waiting( CoreObject *o, const void *data, void *user_data ) +{ + TcorePlugin* plugin = NULL; + char* cmd = NULL, *num = NULL; + CallObject *co, *dupco = 0; + int id, status, err, type, mpty,direction; + GSList* pList = NULL; +#define LINE_DEFAULT 0 + + dbg("call waiting noti : %s", cmd); + plugin = tcore_object_ref_plugin(o); + + cmd = (char*)data; + + at_tok_start(&cmd); + + err = at_tok_nextint(&cmd,&id); + err = at_tok_nextint(&cmd,&direction); + err = at_tok_nextint(&cmd,&status); + err = at_tok_nextint(&cmd,&type); + err = at_tok_nextint(&cmd,&mpty); + + if(at_tok_hasmore(&cmd)){ + err = at_tok_nextstr(&cmd,&num); + dbg("id: %d, direction : %d, status : %d, type :%d, mpty : %d, num : %s", id,direction,status, type, mpty, num); + } + else { + dbg("id: %d, direction : %d, status : %d, type :%d, mpty : %d, num : NULL", id,direction,status, type, mpty); + } +// check call with incoming status already exist + pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_WAITING); + if(pList != NULL){ + dbg("waiting call already exist. skip"); + return; + } + + pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_INCOMING); + if(pList != NULL){ + dbg("incoming call already exist. skip"); + return; + } + + dupco = tcore_call_object_find_by_id(o, id); + if(dupco!= NULL){ + dbg("co with same id already exist. skip"); + return; + } + +// make new co, add to list + co = tcore_call_object_new( o, id); + if ( !co ) { + dbg("[ error ] co is NULL"); + return ; + } + + tcore_call_object_set_type(co, _call_type(type)); + tcore_call_object_set_multiparty_state(co,_call_is_in_mpty(mpty)); + tcore_call_object_set_direction(co, TCORE_CALL_DIRECTION_INCOMING); + tcore_call_object_set_cli_info(co, TCORE_CALL_CLI_MODE_DEFAULT, num); + tcore_call_object_set_active_line(co, LINE_DEFAULT); + + _call_list_get( o, co ); +} + +static void on_notification_call_incoming( CoreObject *o, const void *data, void *user_data ) +{ + TcorePlugin* plugin = NULL; + char* cmd = NULL, *num = NULL; + CallObject *co, *dupco = 0; + int id, status, err, type, mpty,direction; + GSList* pList = NULL; +#define LINE_DEFAULT 0 + + dbg("call incoming noti : %s", cmd); + plugin = tcore_object_ref_plugin(o); + + cmd = (char*)data; + + at_tok_start(&cmd); + + err = at_tok_nextint(&cmd,&id); + err = at_tok_nextint(&cmd,&direction); + err = at_tok_nextint(&cmd,&status); + err = at_tok_nextint(&cmd,&type); + err = at_tok_nextint(&cmd,&mpty); + + if(at_tok_hasmore(&cmd)) { + err = at_tok_nextstr(&cmd,&num); + dbg("id: %d, direction : %d, status : %d, type :%d, mpty : %d, num : %s", id,direction,status, type, mpty, num); + } + else { + dbg("id: %d, direction : %d, status : %d, type :%d, mpty : %d, num : NULL", id,direction,status, type, mpty); + } +// check call with incoming status already exist + pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_INCOMING); + if(pList != NULL){ + dbg("incoming call already exist. skip"); + return; + } + + dupco = tcore_call_object_find_by_id(o, id); + if(dupco!= NULL){ + dbg("co with same id already exist. skip"); + return; + } + +// make new co, add to list + co = tcore_call_object_new( o, id); + if ( !co ) { + dbg("[ error ] co is NULL"); + return ; + } + + tcore_call_object_set_type(co, _call_type(type)); + tcore_call_object_set_multiparty_state(co,_call_is_in_mpty(mpty)); + tcore_call_object_set_direction(co, TCORE_CALL_DIRECTION_INCOMING); + tcore_call_object_set_cli_info(co, TCORE_CALL_CLI_MODE_DEFAULT, num); + tcore_call_object_set_active_line(co, LINE_DEFAULT); + + _call_list_get( o, co ); + +} + +static void on_notification_call_status( CoreObject *o, const void *data, void *user_data) +{ + char* cmd = NULL, *num = NULL; + TcorePlugin* p = 0; + CallObject* co = 0; + int id, status, type, mpty,direction; + int err; + + enum tcore_call_status co_status; + + p = tcore_object_ref_plugin( o ); + cmd = (char*)data; + + at_tok_start(&cmd); + + err = at_tok_nextint(&cmd,&id); + err = at_tok_nextint(&cmd,&direction); + err = at_tok_nextint(&cmd,&status); + err = at_tok_nextint(&cmd,&type); + err = at_tok_nextint(&cmd,&mpty); + + if(at_tok_hasmore(&cmd)) { + err = at_tok_nextstr(&cmd,&num); + dbg("id: %d, direction : %d, status : %d, type :%d, mpty : %d, num : %s", id,direction,status, type, mpty, num); + } + else { + dbg("id: %d, direction : %d, status : %d, type :%d, mpty : %d, num : NULL", id,direction,status, type, mpty); + } + + co_status = _call_status(status); + + switch (co_status) { + case CALL_STATUS_ACTIVE:{ + + 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( p, co ); + + } break; + case CALL_STATUS_HELD: + 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 ); + if ( !co ) { + dbg("error : tcore_call_object_new [ id : %d ]", id); + return ; + } + } + + tcore_call_object_set_type( co, _call_type(type) ); + tcore_call_object_set_direction( co, TCORE_CALL_DIRECTION_OUTGOING ); + + _call_status_dialing( p, co ); + } + break; + case CALL_STATUS_ALERT: + { + + dbg("call(%d) status : [ alert ]", id); + co = tcore_call_object_find_by_id(o, id); + if ( !co ) { + dbg("co is NULL"); + return ; + } + + _call_list_get( o, co ); + + } break; + case CALL_STATUS_INCOMING: + case CALL_STATUS_WAITING: + break; + case CALL_STATUS_IDLE: { + + dbg("call(%d) status : [ release ]", id); + + co = tcore_call_object_find_by_id( o, id ); + if ( !co ) + dbg("co is NULL"); + + p = tcore_object_ref_plugin( o ); + if ( !p ) + dbg("plugin is NULL"); + + _call_status_idle( p, co ); + + } break; + + default: + break; + } +} + +static TReturn s_call_outgoing( CoreObject *o, UserRequest *ur ) +{ + TcorePlugin* p = NULL; + CallObject* co = 0; + struct treq_call_dial* data = 0; + char* raw_str= NULL; + char* cmd_str = NULL; + const char *cclir; + struct call_confirm_info_t* ci = 0; + struct ATReqMetaInfo metainfo; + int info_len =0; + enum tcore_call_cli_mode clir = CALL_CLI_MODE_DEFAULT; + + gboolean ret = FALSE; + + data = (struct treq_call_dial*)tcore_user_request_ref_data( ur, 0 ); + p = tcore_object_ref_plugin( o ); + + ci = g_new0( struct call_confirm_info_t, 1 ); + ci->co = NULL; + ci->resp = TRESP_CALL_DIAL; + + clir = _get_clir_status( data->number ); + +//Compose ATCmd string + switch (clir) + { + case TCORE_CALL_CLI_MODE_PRESENT: + cclir = "I"; + break; /*invocation*/ + case TCORE_CALL_CLI_MODE_RESTRICT: + cclir = "i"; + break; /*suppression*/ + case TCORE_CALL_CLI_MODE_DEFAULT: + default: + cclir = ""; + break; /*subscription default*/ + } + + raw_str = g_strdup_printf("ATD%s%s;", data->number, cclir); + cmd_str = g_strdup_printf("%s%s",raw_str,"\r"); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + +//set metainfo + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + ret = _call_request_message ( o, ur, cmd_str, strlen(cmd_str), on_confirmation_call_request, ci); + + free(raw_str); + free(cmd_str); + + if ( !ret ) { + tcore_call_object_free( o, co ); + return TCORE_RETURN_FAILURE; + } + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_answer( CoreObject *o, UserRequest *ur ) +{ + CallObject* co = 0; + struct treq_call_answer* data = 0; +// unsigned int ipc_size = 0; + gboolean ret = FALSE; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo ; + unsigned int info_len =0; + + struct call_confirm_info_t* ci = 0; + + + data = (struct treq_call_answer*)tcore_user_request_ref_data( ur, 0 ); + + co = tcore_call_object_find_by_id( o, data->id ); + + ci = g_new0( struct call_confirm_info_t, 1 ); + ci->co = co; + ci->resp = TRESP_CALL_ANSWER; + + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + +//set metainfo + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] = '\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + if ( data->type == CALL_ANSWER_TYPE_ACCEPT ) { + + cmd_str = g_strdup_printf("%s%s","ATA","\r"); + ret = _call_request_message ( o, ur, (void*)cmd_str, strlen(cmd_str), on_confirmation_call_request, ci); + free(cmd_str); + if ( !ret ) + return TCORE_RETURN_FAILURE; + + } else { + + switch ( data->type ) { + case CALL_ANSWER_TYPE_REJECT: { + dbg("call answer reject"); + tcore_call_control_answer_reject( o, ur, on_confirmation_call_request, ci ); + } break; + + case CALL_ANSWER_TYPE_REPLACE: { + dbg("call answer replace"); + tcore_call_control_answer_replace( o, ur, on_confirmation_call_request, ci ); + } break; + + case CALL_ANSWER_TYPE_HOLD_ACCEPT: { + dbg("call answer hold and accept"); + tcore_call_control_answer_hold_and_accept( o, ur, on_confirmation_call_hold_and_accept, ci ); + } break; + + default : + dbg("[ error ] wrong answer type [ %d ]", data->type); + return TCORE_RETURN_FAILURE; + } + } + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_release( CoreObject *o, UserRequest *ur ) +{ + CallObject* co = 0; + + struct treq_call_end* data = 0; + struct call_confirm_info_t* ci = 0; + gboolean ret = FALSE; + UserRequest* ur_dup = 0; + + char* chld0_cmd = NULL; + char* chld1_cmd = NULL; + struct ATReqMetaInfo metainfo1 ; + struct ATReqMetaInfo metainfo2 ; + unsigned int info_len1, info_len2 =0; + + data = (struct treq_call_end*)tcore_user_request_ref_data( ur, 0 ); + + co = tcore_call_object_find_by_id( o, data->id ); + + ci = g_new0( struct call_confirm_info_t, 1 ); + ci->co = co; + + if ( data->type == CALL_END_TYPE_ALL ) { + + ci->resp = TRESP_CALL_END_ALL; + + //releaseAll do not exist on legacy request. send CHLD=0, CHLD=1 in sequence + chld0_cmd = g_strdup("AT+CHLD=0\r"); + chld1_cmd = g_strdup("AT+CHLD=1\r"); + + memset(&metainfo1, 0, sizeof(struct ATReqMetaInfo)); + memset(&metainfo2, 0, sizeof(struct ATReqMetaInfo)); + + +//set metainfo + metainfo1.type = NO_RESULT; + metainfo1.responsePrefix[0] = '\0'; + info_len1 = sizeof(struct ATReqMetaInfo); + +//set metainfo + metainfo2.type = NO_RESULT; + metainfo2.responsePrefix[0] = '\0'; + info_len2 = sizeof(struct ATReqMetaInfo); + + ur_dup = tcore_user_request_new(NULL, NULL); + + tcore_user_request_set_metainfo(ur_dup, info_len1, &metainfo1); + tcore_user_request_set_metainfo(ur, info_len2, &metainfo2); + + ret = _call_request_message(o, ur_dup, chld0_cmd, strlen(chld0_cmd), on_confirmation_call_endall, NULL); + free(chld0_cmd); + if ( !ret ) + return TCORE_RETURN_FAILURE; + + ret = _call_request_message(o, ur, chld1_cmd, strlen(chld1_cmd), on_confirmation_call_request, ci); + free(chld1_cmd); + if ( !ret ) + return TCORE_RETURN_FAILURE; + + } else { + + switch ( data->type ) { + case CALL_END_TYPE_DEFAULT: { + int id = 0; + id = tcore_call_object_get_id( co ); + + ci->resp = TRESP_CALL_END; + + dbg("call end call id [%d]", id); + tcore_call_control_end_specific( o, ur, id, on_confirmation_call_request, ci ); + } break; + + case CALL_END_TYPE_ACTIVE_ALL: { + + ci->resp = TRESP_CALL_END_ALL_ACTIVE; + + dbg("call end all active"); + tcore_call_control_end_all_active( o, ur, on_confirmation_call_request, ci ); + } break; + + case TCORE_CALL_END_ALL_HELD: { + + ci->resp = TRESP_CALL_END_ALL_HELD; + + dbg("call end all held"); + tcore_call_control_end_all_held( o, ur, on_confirmation_call_request, ci ); + } break; + + default : + dbg("[ error ] wrong end type [ %d ]", data->type); + return TCORE_RETURN_FAILURE; + } + + } + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_hold( CoreObject *o, UserRequest *ur ) +{ + struct call_confirm_info_t* ci = 0; + unsigned int *id = 0; + id = (unsigned int*)tcore_user_request_ref_data( ur, 0 ); + + ci = g_new0( struct call_confirm_info_t, 1 ); + + dbg("call id : [ %d ]", *id); + + ci->co = tcore_call_object_find_by_id( o, *id ); + ci->resp = TRESP_CALL_HOLD; + + tcore_call_control_hold( o, ur, on_confirmation_call_hold, ci ); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_active( CoreObject *o, UserRequest *ur ) +{ + struct call_confirm_info_t* ci = 0; + unsigned int *id = 0; + id = (unsigned int*)tcore_user_request_ref_data( ur, 0 ); + + ci = g_new0( struct call_confirm_info_t, 1 ); + + dbg("call id : [ %d ]", *id); + + ci->co = tcore_call_object_find_by_id( o, *id ); + ci->resp = TRESP_CALL_ACTIVE; + + tcore_call_control_active( o, ur, on_confirmation_call_request, ci ); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_swap( CoreObject *o, UserRequest *ur ) +{ + struct call_confirm_info_t* ci = 0; + unsigned int *id = 0; + id = (unsigned int*)tcore_user_request_ref_data( ur, 0 ); + + ci = g_new0( struct call_confirm_info_t, 1 ); + + dbg("call id : [ %d ]", *id); + + ci->co = tcore_call_object_find_by_id( o, *id ); + ci->resp = TRESP_CALL_SWAP; + + tcore_call_control_swap( o, ur, on_confirmation_call_swap, ci ); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_join( CoreObject *o, UserRequest *ur ) +{ + struct call_confirm_info_t* ci = 0; + unsigned int *id = 0; + id = (unsigned int*)tcore_user_request_ref_data( ur, 0 ); + + ci = g_new0( struct call_confirm_info_t, 1 ); + + dbg("call id : [ %d ]", *id); + + ci->co = tcore_call_object_find_by_id( o, *id ); + ci->resp = TRESP_CALL_JOIN; + + tcore_call_control_join( o, ur, on_confirmation_call_request, ci ); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_split( CoreObject *o, UserRequest *ur ) +{ + struct call_confirm_info_t* ci = 0; + unsigned int *id = 0; + + ci = g_new0( struct call_confirm_info_t, 1 ); + + id = (unsigned int *)tcore_user_request_ref_data( ur, 0 ); + ci->co = tcore_call_object_find_by_id ( o, *id ); + ci->resp = TRESP_CALL_SPLIT; + + tcore_call_control_split( o, ur, *id, on_confirmation_call_split, ci ); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_deflect( CoreObject *o, UserRequest *ur ) +{ + struct call_confirm_info_t* ci = 0; + char *number = 0; + + ci = g_new0( struct call_confirm_info_t, 1 ); + number = (char*)tcore_user_request_ref_data( ur, 0 ); + + ci->co = tcore_call_object_find_by_number( o, number ); + ci->resp = TRESP_CALL_DEFLECT; + + tcore_call_control_deflect( o, ur, number, on_confirmation_call_request, ci ); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_transfer( CoreObject *o, UserRequest *ur ) +{ + struct call_confirm_info_t* ci = 0; + unsigned int *id = 0; + id = (unsigned int*)tcore_user_request_ref_data( ur, 0 ); + + ci = g_new0( struct call_confirm_info_t, 1 ); + + dbg("call id : [ %d ]", *id); + + ci->co = tcore_call_object_find_by_id( o, *id ); + ci->resp = TRESP_CALL_TRANSFER; + + tcore_call_control_transfer( o, ur, on_confirmation_call_request, ci ); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_send_dtmf( CoreObject *o, UserRequest *ur ) +{ + struct call_confirm_info_t* ci = 0; + ci = g_new0( struct call_confirm_info_t, 1 ); + + ci->co = 0; + ci->resp = TRESP_CALL_SEND_DTMF; + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_set_sound_path( CoreObject *o, UserRequest *ur ) +{ + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_set_sound_volume_level( CoreObject *o, UserRequest *ur ) +{ + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_get_sound_volume_level( CoreObject *o, UserRequest *ur ) +{ + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_mute( CoreObject *o, UserRequest *ur ) +{ + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_unmute( CoreObject *o, UserRequest *ur ) +{ + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_call_get_mute_status( CoreObject *o, UserRequest *ur ) +{ + + return TCORE_RETURN_SUCCESS; +} + + +static struct tcore_call_operations call_ops = { + .dial = s_call_outgoing, + .answer = s_call_answer, + .end = s_call_release, + .hold = s_call_hold, + .active = s_call_active, + .swap = s_call_swap, + .join = s_call_join, + .split = s_call_split, + .deflect = s_call_deflect, + .transfer = s_call_transfer, + .send_dtmf = s_call_send_dtmf, + .set_sound_path = s_call_set_sound_path, + .set_sound_volume_level = s_call_set_sound_volume_level, + .get_sound_volume_level = s_call_get_sound_volume_level, + .mute = s_call_mute, + .unmute = s_call_unmute, + .get_mute_status = s_call_get_mute_status, +}; + + +static void s_call_info_mo_waiting( CoreObject *o ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mo_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_WAITING, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mo_forwarded( CoreObject *o ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mo_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_FORWARDED, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mo_barred_incoming( CoreObject *o ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mo_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_BARRED_INCOMING, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mo_barred_outgoing( CoreObject *o ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mo_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_BARRED_OUTGOING, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mo_deflected( CoreObject *o ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mo_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_DEFLECTED, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mo_clir_suppression_reject( CoreObject *o ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mo_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_CLIR_SUPPRESSION_REJECT, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mo_cfu( CoreObject *o ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mo_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_FORWARD_UNCONDITIONAL, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mo_cfc( CoreObject *o ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mo_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_FORWARD_CONDITIONAL, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mt_cli( CoreObject *o, enum tcore_call_cli_mode mode, char* number ) +{ + CallObject *co = 0; + + co = tcore_call_object_current_on_mt_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + tcore_call_object_set_cli_info( co, mode, number ); +} + +static void s_call_info_mt_cna( CoreObject *o, enum tcore_call_cna_mode mode, char* name, int dcs ) +{ + CallObject *co = 0; + + co = tcore_call_object_current_on_mt_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + tcore_call_object_set_cna_info( co, mode, name, dcs ); +} + +static void s_call_info_mt_forwarded_call( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mt_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_FORWARDED_CALL, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mt_deflected_call( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mt_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_DEFLECTED_CALL, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_mt_transfered( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_current_on_mt_processing( o ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_TRANSFERED_CALL, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_held( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_find_by_number( o, number ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_HELD, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_active( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_find_by_number( o, number ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_ACTIVE, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_joined( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_find_by_number( o, number ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_JOINED, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_released_on_hold( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_find_by_number( o, number ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_RELEASED_ON_HOLD, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_transfer_alert( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_find_by_number( o, number ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_TRANSFER_ALERT, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_transfered( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_find_by_number( o, number ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_TRANSFERED, + sizeof(unsigned int), + (void*)&id ); +} + +static void s_call_info_cf_check_message( CoreObject *o, char* number ) +{ + CallObject *co = 0; + int id = 0; + + TcorePlugin *p = 0; + p = tcore_object_ref_plugin(o); + + co = tcore_call_object_find_by_number( o, number ); + if ( !co ) { + dbg("[ error ] can't find call object!"); + return ; + } + + id = tcore_call_object_get_id( co ); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + tcore_plugin_ref_core_object(p, "call"), + TNOTI_CALL_INFO_CF_CHECK_MESSAGE, + sizeof(unsigned int), + (void*)&id ); +} + + +static struct tcore_call_information_operations call_information_ops = { + .mo_call_col = 0, + .mo_call_waiting = s_call_info_mo_waiting, + .mo_call_cug = 0, + .mo_call_forwarded = s_call_info_mo_forwarded, + .mo_call_barred_incoming = s_call_info_mo_barred_incoming, + .mo_call_barred_outgoing = s_call_info_mo_barred_outgoing, + .mo_call_deflected = s_call_info_mo_deflected, + .mo_call_clir_suppression_reject = s_call_info_mo_clir_suppression_reject, + .mo_call_cfu = s_call_info_mo_cfu, + .mo_call_cfc = s_call_info_mo_cfc, + .mt_call_cli = s_call_info_mt_cli, + .mt_call_cna = s_call_info_mt_cna, + .mt_call_forwarded_call = s_call_info_mt_forwarded_call, + .mt_call_cug_call = 0, + .mt_call_deflected_call = s_call_info_mt_deflected_call, + .mt_call_transfered = s_call_info_mt_transfered, + .call_held = s_call_info_held, + .call_active = s_call_info_active, + .call_joined = s_call_info_joined, + .call_released_on_hold = s_call_info_released_on_hold, + .call_transfer_alert = s_call_info_transfer_alert, + .call_transfered = s_call_info_transfered, + .call_cf_check_message = s_call_info_cf_check_message, +}; + +gboolean s_call_init( TcorePlugin *p ) +{ + CoreObject *o = NULL; +// TcoreHal *h = NULL; + struct property_call_info *data = NULL; + + o = tcore_call_new( p, "call", &call_ops ); + if (!o) + return FALSE; + + tcore_call_information_set_operations( o, &call_information_ops ); + + tcore_object_add_callback( o, EVENT_CALL_STATUS, on_notification_call_status, NULL ); + tcore_object_add_callback( o, EVENT_CALL_INCOMING, on_notification_call_incoming, NULL ); + tcore_object_add_callback( o, EVENT_CALL_WAITING, on_notification_call_waiting, NULL ); + + data = calloc( sizeof(struct property_call_info *), 1); + tcore_plugin_link_property(p, "CALL", data); + + return TRUE; +} + +void s_call_exit( TcorePlugin *p ) +{ + CoreObject *o; +// TcoreHal *h; + struct property_network_info *data; + + o = tcore_plugin_ref_core_object(p, "call"); + + data = tcore_plugin_ref_property(p, "CALL"); + if (data) + free(data); + + tcore_call_free(o); +} diff --git a/src/s_common.c b/src/s_common.c new file mode 100644 index 0000000..6acedd4 --- /dev/null +++ b/src/s_common.c @@ -0,0 +1,200 @@ +/* + * tel-plugin-atmodem + * + * 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 +#include + +#include + + +#include "s_common.h" + +#include + + +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; imsg_auto_id_current == 0) { + gd->msg_auto_id_current = gd->msg_auto_id_start; + dbg("pending_auto_id_current is 0, reset to start"); + } + else if (gd->msg_auto_id_current >= gd->msg_auto_id_end) { + gd->msg_auto_id_current = gd->msg_auto_id_start; + dbg("pending_auto_id_current is over, reset to start"); + } + else { + gd->msg_auto_id_current++; + } + + dbg("message_sequence_id = %d", gd->msg_auto_id_current); + + return gd->msg_auto_id_current; +} + +gboolean util_add_waiting_job(GQueue *queue, unsigned int id, UserRequest *ur) +{ + struct work_queue_data *wqd; + + if (!queue) + return FALSE; + + wqd = calloc(sizeof(struct work_queue_data), 1); + if (!wqd) + return FALSE; + + wqd->id = id; + wqd->ur = tcore_user_request_dup(ur); + g_queue_push_tail(queue, wqd); + + dbg("id = %d, ur = 0x%x", wqd->id, wqd->ur); + return TRUE; +} + +UserRequest *util_pop_waiting_job(GQueue *queue, unsigned int id) +{ + int i = 0; + UserRequest *ur; + struct work_queue_data *wqd; + + if (!queue) + return NULL; + + + dbg("before waiting job count: %d", g_queue_get_length(queue)); + + do { + wqd = g_queue_peek_nth(queue, i); + if (!wqd) + return NULL; + + if (wqd->id == id) { + wqd = g_queue_pop_nth(queue, i); + break; + } + + i++; + } while (wqd != NULL); + + dbg("after waiting job count: %d", g_queue_get_length(queue)); + + if (!wqd) + return NULL; + + ur = wqd->ur; + free(wqd); + + return ur; +} + +unsigned char util_hexCharToInt(char c) +{ + if (c >= '0' && c <= '9') + return (c - '0'); + else if (c >= 'A' && c <= 'F') + return (c - 'A' + 10); + else if (c >= 'a' && c <= 'f') + return (c - 'a' + 10); + else + { + dbg("invalid charater!!"); + return -1; + } +} + +char * util_hexStringToBytes(char * s) +{ + char * ret; + int i; + int sz; + + if(s == NULL) + return NULL; + + sz = strlen(s); + + ret = malloc(sz /2); + + dbg("Convert String to Binary!!"); + + for(i = 0; i < sz; i += 2) + { + ret[i/2] = (char)((util_hexCharToInt(s[i]) << 4) | util_hexCharToInt(s[i + 1])); + dbg("[%02x]", ret[i/2]); + } + + return ret; +} + diff --git a/src/s_modem.c b/src/s_modem.c new file mode 100644 index 0000000..341892a --- /dev/null +++ b/src/s_modem.c @@ -0,0 +1,758 @@ +/* + * tel-plugin-atmodem + * + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "s_common.h" +#include "s_modem.h" + +#include "atchannel.h" +#include "at_tok.h" + +#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 + +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, +}; + + +enum TelMiscSNIndexType_t{ + 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 */ +}; + +struct TelMiscSNInformation{ + enum TelMiscSNIndexType_t sn_index; /**< serial number index */ + int sn_len; /**< Length */ + unsigned char szNumber[TAPI_MISC_ME_SN_LEN_MAX]; /**< Number */ +}; + +/** + * Mobile Equipment Version Information + */ +struct TelMiscVersionInformation{ + 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 */ +}; + +extern struct ATResponse *sp_response; +extern char *s_responsePrefix; +extern enum ATCommandType s_type; + +static void on_confirmation_modem_message_send(TcorePending *p, gboolean result, void *user_data ); // from Kernel + +static void on_confirmation_modem_message_send( TcorePending *p, gboolean result, void *user_data ) +{ + UserRequest* ur = NULL; + struct ATReqMetaInfo* metainfo = NULL; + unsigned int info_len =0; + dbg("on_confirmation_modem_message_send - msg out from queue. alloc ATRsp buffer & write rspPrefix if needed\n"); + + ReleaseResponse(); // release leftover +//alloc new sp_response + sp_response = at_response_new(); + + + ur = tcore_pending_ref_user_request(p); + metainfo = (struct ATReqMetaInfo*)tcore_user_request_ref_metainfo(ur,&info_len); + + if((metainfo->type == SINGLELINE)|| + (metainfo->type == MULTILINE)) + { + //cp rsp prefix + s_responsePrefix = strdup(metainfo->responsePrefix); + dbg("duplicating responsePrefix : %s\n", s_responsePrefix); + } + else + { + s_responsePrefix = NULL; + } + +//set atcmd type into s_type + s_type = metainfo->type; + + if (result == FALSE) { + /* Fail */ + dbg("SEND FAIL"); + } + else { + dbg("SEND OK"); + } +} +static void on_sys_event_modem_power(CoreObject *o, const void *event_info, void *user_data) +{ + struct tnoti_modem_power modem_power; + enum cp_state *state; + + state = (enum cp_state*)event_info; + dbg("state : (0x%x)", *state); + + if ( *state == CP_STATE_OFFLINE || *state == CP_STATE_CRASH_RESET ) { + + tcore_modem_set_powered(o, FALSE); + + if ( *state == CP_STATE_OFFLINE ) + modem_power.state = MODEM_STATE_OFFLINE; + else + modem_power.state = MODEM_STATE_ERROR; + + } else { + dbg("useless state : (0x%x)", *state); + return ; + } + + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_MODEM_POWER, + sizeof(struct tnoti_modem_power), &modem_power); +} +static void on_event_modem_power(CoreObject *o, const void *event_info, void *user_data) +{ + struct treq_modem_set_flightmode flight_mode_set; + struct tnoti_modem_power modem_power; + UserRequest *ur; + TcoreHal *h; + Storage *strg; + + strg = tcore_server_find_storage(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), "vconf"); + flight_mode_set.enable = tcore_storage_get_bool(strg, STORAGE_KEY_SETAPPL_FLIGHT_MODE_BOOL); + + h = tcore_plugin_ref_hal(tcore_object_ref_plugin(o)); + + tcore_hal_set_power_state(h, TRUE); + + ur = tcore_user_request_new(NULL, NULL); + tcore_user_request_set_data(ur, sizeof(struct treq_modem_set_flightmode), &flight_mode_set); + tcore_user_request_set_command(ur, TREQ_MODEM_SET_FLIGHTMODE); + tcore_object_dispatch_request(o, ur); + + ur = tcore_user_request_new(NULL, NULL); + tcore_user_request_set_command(ur, TREQ_MODEM_GET_IMEI); + tcore_object_dispatch_request(o, ur); + + ur = tcore_user_request_new(NULL, NULL); + tcore_user_request_set_command(ur, TREQ_MODEM_GET_VERSION); + tcore_object_dispatch_request(o, ur); + + tcore_modem_set_powered(o, TRUE); + + modem_power.state = MODEM_STATE_ONLINE; + + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_MODEM_POWER, + sizeof(struct tnoti_modem_power), &modem_power); +} + +static void on_event_modem_phone_state(CoreObject *o, const void *event_info, void *user_data) +{ + char* line = (char*)event_info; + GQueue *queue; + UserRequest *ur; + int err, status; + struct tresp_modem_set_flightmode res; + struct tnoti_modem_flight_mode modem_flight_mode; +#define SCFUN_MIN_FUNC 0 +#define SCFUN_FULL_FUNC 1 + + dbg("received notification : %s", line); + + at_tok_start(&line); + + err = at_tok_nextint(&line, &status); + + switch (status) { + case SCFUN_MIN_FUNC: + res.result = 0x01; + tcore_modem_set_flight_mode_state(o, TRUE); + break; + + case SCFUN_FULL_FUNC: + res.result = 0x02; + tcore_modem_set_flight_mode_state(o, FALSE); + break; + } + + queue = tcore_object_ref_user_data(o); + if (queue) { + ur = util_pop_waiting_job(queue, ID_RESERVED_AT); + if (ur) { + 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); +} +static void on_response_poweron(TcorePending *p, int data_len, const void *data, void *user_data) +{ + char *line; + gboolean bpoweron = FALSE; + int response = 0; + int err; + +#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 + +//print sp_response - for debug + printResponse(); + + if(sp_response->success > 0){ + dbg("RESPONSE OK"); + //parse response + line = sp_response->p_intermediates->line; + + err = at_tok_start(&line); + if (err < 0) { + bpoweron = FALSE; + goto error; + } + + err = at_tok_nextint(&line, &response); + if (err < 0) { + bpoweron =FALSE; + goto error; + } + + dbg("response %d",response); + + switch(response) + { + case CPAS_RES_READY: + case CPAS_RES_RINGING: + case CPAS_RES_CALL_PROGRESS: + case CPAS_RES_ASLEEP: + bpoweron = TRUE; + break; + + case CPAS_RES_UNAVAIL: + case CPAS_RES_UNKNOWN: + default: + bpoweron = FALSE; + break; + } + }else{ + dbg("RESPONSE NOK"); + bpoweron = FALSE; + } + +error: +//5. release sp_response & s_responsePrefix - before sending user callback, because user callback can request additional request +// and if queue is empty, that req can be directly sent to mdm - can cause sp_response, s_responsePrefix dangling + ReleaseResponse(); + + if(bpoweron == TRUE){ + dbg("Power on NOTI received"); + //procees power up noti process + on_event_modem_power(tcore_pending_ref_core_object(p), NULL, NULL); + } + else{ //poweron not complete - proceed same process again + + dbg("CPAS once again"); + s_modem_send_poweron(tcore_object_ref_plugin(tcore_pending_ref_core_object(p))); + } +} + +static void on_response_set_flight_mode(TcorePending *p, int data_len, const void *data, void *user_data) +{ + CoreObject *o = user_data; + UserRequest *ur; + char *line; + struct tresp_modem_set_flightmode res; + GQueue *queue; + int err; + int response; + +//print sp_response - for debug + printResponse(); + ur = tcore_pending_ref_user_request(p); + + if(sp_response->success > 0) + { + dbg("RESPONSE OK"); + //parse response + queue = tcore_object_ref_user_data(o); + if (queue) + { + ur = tcore_user_request_dup(ur); + util_add_waiting_job(queue, ID_RESERVED_AT, ur); + } + + ReleaseResponse(); + } + else + { + dbg("RESPONSE NOK"); + line = sp_response->finalResponse; + err = at_tok_start(&line); + if (err < 0) + { + dbg("err cause not specified or string corrupted"); + res.result = TCORE_RETURN_3GPP_ERROR; + } + else + { + err = at_tok_nextint(&line, &response); + if (err < 0) + { + dbg("err not specified or string not contail error"); + res.result = TCORE_RETURN_3GPP_ERROR; + } + else + { + res.result = convertCMEError((enum ATCMEError)response); + } + + ReleaseResponse(); + + tcore_user_request_send_response(ur, TRESP_MODEM_SET_FLIGHTMODE, sizeof(struct tresp_modem_set_flightmode), &res); + } + } +} +static void on_response_imei(TcorePending *p, int data_len, const void *data, void *user_data) +{ + TcorePlugin *plugin; + struct tresp_modem_get_imei res; + UserRequest *ur; + struct TelMiscSNInformation *imei_property; + char *line; + int response; + int err; + + printResponse(); + + memset(&res, 0, sizeof(struct tresp_modem_get_imei)); + + if(sp_response->success > 0) + { + dbg("RESPONSE OK"); + + line = sp_response->p_intermediates->line; + + res.result = TCORE_RETURN_SUCCESS; + strncpy(res.imei, line, 16); + + dbg("imei = [%s]", res.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); + } + } + else + { + dbg("RESPONSE NOK"); + line = sp_response->finalResponse; + + err = at_tok_start(&line); + if (err < 0) + { + dbg("err cause not specified or string corrupted"); + res.result = TCORE_RETURN_3GPP_ERROR; + } + else + { + err = at_tok_nextint(&line, &response); + if (err < 0) + { + dbg("err not specified or string not contail error"); + res.result = TCORE_RETURN_3GPP_ERROR; + } + else + { + res.result = convertCMEError((enum ATCMEError)response); + } + } + } + + ReleaseResponse(); + + ur = tcore_pending_ref_user_request(p); + tcore_user_request_send_response(ur, TRESP_MODEM_GET_IMEI, sizeof(struct tresp_modem_get_imei), &res); + +} + +static void on_response_version(TcorePending *p, int data_len, const void *data, void *user_data) +{ + TcorePlugin *plugin; + struct TelMiscVersionInformation *vi; + struct TelMiscVersionInformation *vi_property; + struct tresp_modem_get_version res; + UserRequest *ur; + char* line=NULL; + char *swver= NULL,*hwver=NULL, *caldate=NULL,*pcode=NULL,*id=NULL; + + int response, err; + + printResponse(); + +#define AT_VER_LEN 20 + if(sp_response->success > 0) + { + dbg("RESPONSE OK"); + + line = sp_response->p_intermediates->line; + err = at_tok_start(&line); + + err = at_tok_nextstr(&line,&swver); + if(swver!=NULL) + err = at_tok_nextstr(&line,&hwver); + if(hwver!=NULL) + err = at_tok_nextstr(&line,&caldate); + if(caldate !=NULL) + err = at_tok_nextstr(&line,&pcode); + if(pcode !=NULL) + err = at_tok_nextstr(&line,&id); + + dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]", swver, hwver, caldate, pcode, id); + + vi = calloc(sizeof(struct TelMiscVersionInformation), 1); + memcpy(vi->szSwVersion, swver, strlen(swver)); + memcpy(vi->szHwVersion, hwver, strlen(hwver)); + memcpy(vi->szRfCalDate, caldate, strlen(caldate)); + memcpy(vi->szProductCode, pcode,strlen(pcode)); + memcpy(vi->szModelId, id, strlen(id)); + + memset(&res, 0, sizeof(struct tresp_modem_get_imei)); + snprintf(res.software, (AT_VER_LEN >strlen(swver) ?strlen(swver):AT_VER_LEN), "%s", swver); + snprintf(res.hardware, (AT_VER_LEN >strlen(hwver) ?strlen(hwver):AT_VER_LEN), "%s", hwver); + + plugin = tcore_pending_ref_plugin(p); + vi_property = tcore_plugin_ref_property(plugin, "VERSION"); + memcpy(vi_property, vi, sizeof(struct TelMiscVersionInformation)); + } + else + { + dbg("RESPONSE NOK"); + line = sp_response->finalResponse; + + memset(&res, 0, sizeof(struct tresp_modem_get_version)); + + err = at_tok_start(&line); + if (err < 0) + { + dbg("err cause not specified or string corrupted"); + res.result = TCORE_RETURN_3GPP_ERROR; + } + else + { + err = at_tok_nextint(&line, &response); + if (err < 0) + { + dbg("err not specified or string not contail error"); + res.result = TCORE_RETURN_3GPP_ERROR; + } + else + { + res.result = convertCMEError((enum ATCMEError)response); + } + } + } + + ReleaseResponse(); + + ur = tcore_pending_ref_user_request(p); + tcore_user_request_send_response(ur, TRESP_MODEM_GET_VERSION, sizeof(struct tresp_modem_get_version), &res); + +} + +static TReturn power_on(CoreObject *o, UserRequest *ur) +{ + + return TCORE_RETURN_SUCCESS; +} + +static TReturn power_off(CoreObject *o, UserRequest *ur) +{ + return TCORE_RETURN_SUCCESS; +} +static TReturn power_reset(CoreObject *o, UserRequest *ur) +{ + + return TCORE_RETURN_SUCCESS; +} +static TReturn get_imei(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NUMERIC; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup("AT+CGSN\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_imei, NULL); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn get_version(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"+CGMR:",strlen("+CGMR:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup("AT+CGMR\r"); + + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_version, NULL); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn set_flight_mode(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_modem_set_flightmode *req_data; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + req_data = tcore_user_request_ref_data(ur, NULL); + + + if (req_data->enable) { + dbg("Flight mode on/n"); + cmd_str = g_strdup("AT+CFUN=0\r"); + } + else { + dbg("Flight mode off/n"); + cmd_str = g_strdup("AT+CFUN=1\r"); + } + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_set_flight_mode, o); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static struct tcore_modem_operations modem_ops = +{ + .power_on = power_on, + .power_off = power_off, + .power_reset = power_reset, + .set_flight_mode = set_flight_mode, + .get_imei = get_imei, + .get_version = get_version, +}; + +gboolean s_modem_init(TcorePlugin *p) +{ + CoreObject *o; + GQueue *work_queue; + struct TelMiscVersionInformation *vi_property; + struct TelMiscSNInformation *imei_property; + + o = tcore_modem_new(p, "modem", &modem_ops); + if (!o) + return FALSE; + + work_queue = g_queue_new(); + tcore_object_link_user_data(o, work_queue); + + tcore_object_add_callback(o, EVENT_SYS_NOTI_MODEM_POWER, on_sys_event_modem_power, NULL); + + tcore_object_add_callback(o, EVENT_MODEM_POWER, on_event_modem_power, NULL); + tcore_object_add_callback(o, EVENT_MODEM_PHONE_STATE, on_event_modem_phone_state, NULL); + + vi_property = calloc(sizeof(struct TelMiscVersionInformation), 1); + tcore_plugin_link_property(p, "VERSION", vi_property); + + imei_property = calloc(sizeof(struct TelMiscSNInformation), 1); + tcore_plugin_link_property(p, "IMEI", imei_property); + + return TRUE; +} + +void s_modem_exit(TcorePlugin *p) +{ + CoreObject *o; + GQueue *work_queue; + struct TelMiscVersionInformation *vi_property; + struct TelMiscSNInformation *imei_property; + + if (!p) + return; + + o = tcore_plugin_ref_core_object(p, "modem"); + + work_queue = tcore_object_ref_user_data(o); + g_queue_free(work_queue); + + vi_property = tcore_plugin_ref_property(p, "VERSION"); + if (vi_property) + free(vi_property); + + imei_property = tcore_plugin_ref_property(p, "IMEI"); + if (imei_property) + free(imei_property); + + tcore_modem_free(o); +} + +gboolean s_modem_send_poweron(TcorePlugin *p) +{ + UserRequest* ur; + TcoreHal* hal; + TcorePending *pending = NULL; + CoreObject *o; + + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + ur = tcore_user_request_new(NULL, NULL); + hal = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"+CPAS:",strlen("+CPAS:")); + info_len = sizeof(struct ATReqMetaInfo); + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup("AT+CPAS\r"); + + dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d",cmd_str, metainfo.responsePrefix, strlen(cmd_str)); + + o = tcore_plugin_ref_core_object(p, "modem"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_poweron, NULL); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL); + + tcore_hal_send_request(hal, pending); + + return TRUE; + +} diff --git a/src/s_network.c b/src/s_network.c new file mode 100644 index 0000000..71952cf --- /dev/null +++ b/src/s_network.c @@ -0,0 +1,1008 @@ +/* + * tel-plugin-atmodem + * + * 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 +#include +#include + +#define FEATURE_SAMSUNG_ONEDRAM + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "s_common.h" +#include "s_network.h" +#include "atchannel.h" +#include "at_tok.h" + +extern struct ATResponse *sp_response; +extern char *s_responsePrefix; +extern enum ATCommandType s_type; + +#define AT_CREG_STAT_NOT_REG 0 /* not registered, MT is not currently searching a new operator to register to */ +#define AT_CREG_STAT_REG_HOME 1 /* registered, home network */ +#define AT_CREG_STAT_SEARCHING 2 /* not registered, but MT is currently searching a new operator to register to */ +#define AT_CREG_STAT_REG_DENIED 3 /* registration denied */ +#define AT_CREG_STAT_UNKNOWN 4 /* unknown */ +#define AT_CREG_STAT_REG_ROAM 5 /* registered, roaming */ + +static unsigned int lookup_tbl_net_status[] = { + [AT_CREG_STAT_NOT_REG] = NETWORK_SERVICE_DOMAIN_STATUS_NO, + [AT_CREG_STAT_REG_HOME] = NETWORK_SERVICE_DOMAIN_STATUS_FULL, + [AT_CREG_STAT_SEARCHING] = NETWORK_SERVICE_DOMAIN_STATUS_SEARCH, + [AT_CREG_STAT_REG_DENIED] = NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY, + [AT_CREG_STAT_UNKNOWN] = NETWORK_SERVICE_DOMAIN_STATUS_NO, + [AT_CREG_STAT_REG_ROAM] = NETWORK_SERVICE_DOMAIN_STATUS_FULL, +}; + +#define AT_COPS_MODE_AUTOMATIC 0 /* automatic ( field is ignored) */ +#define AT_COPS_MODE_MANUAL 1 /* manual ( field shall be present, and optionally) */ +#define AT_COPS_MODE_DEREGISTER 2 /* deregister from network */ +#define AT_COPS_MODE_SET_ONLY 3 /* set only */ + +#define AT_COPS_FORMAT_LONG_ALPHANUMERIC 0 /* long format alphanumeric */ +#define AT_COPS_FORMAT_SHORT_ALPHANUMERIC 1 /* short format alphanumeric */ +#define AT_COPS_FORMAT_NUMERIC 2 /* numeric */ + +#define AT_COPS_ACT_GSM 0 /* GSM */ +#define AT_COPS_ACT_GSM_COMPACT 1 /* GSM Compact */ +#define AT_COPS_ACT_UTRAN 2 /* UTRAN */ +#define AT_COPS_ACT_GSM_EGPRS 3 /* GSM w/EGPRS */ +#define AT_COPS_ACT_UTRAN_HSDPA 4 /* UTRAN w/HSDPA */ +#define AT_COPS_ACT_UTRAN_HSUPA 5 /* UTRAN w/HSUPA */ +#define AT_COPS_ACT_UTRAN_HSDPA_HSUPA 6 /* UTRAN w/HSDPA and HSUPA */ +#define AT_COPS_ACT_E_UTRAN 7 /* E-UTRAN */ + +static unsigned int lookup_tbl_access_technology[] = { + [AT_COPS_ACT_GSM] = NETWORK_ACT_GSM, + [AT_COPS_ACT_GSM_COMPACT] = NETWORK_ACT_GSM, + [AT_COPS_ACT_UTRAN] = NETWORK_ACT_UTRAN, + [AT_COPS_ACT_GSM_EGPRS] = NETWORK_ACT_EGPRS, + [AT_COPS_ACT_UTRAN_HSDPA] = NETWORK_ACT_UTRAN, + [AT_COPS_ACT_UTRAN_HSUPA] = NETWORK_ACT_UTRAN, + [AT_COPS_ACT_UTRAN_HSDPA_HSUPA] = NETWORK_ACT_UTRAN, + [AT_COPS_ACT_E_UTRAN] = NETWORK_ACT_GSM_UTRAN, +}; +static unsigned int current_lac=0; +static gboolean get_serving_network(CoreObject *o, UserRequest *ur); +static void on_confirmation_network_message_send( TcorePending *pending, gboolean result, void *user_data ); + +static void __set_metainfo(UserRequest *ur, struct ATReqMetaInfo *info, enum ATCommandType type, char *prefix) +{ + if (!info || !ur) + return; + memset(info, 0, sizeof(struct ATReqMetaInfo)); + info->type = type; + if (!prefix) + info->responsePrefix[0] ='\0'; + else + memcpy(info->responsePrefix, prefix, strlen(prefix)); + tcore_user_request_set_metainfo(ur, sizeof(struct ATReqMetaInfo), info); +} +static void __send_at_request(CoreObject *o, char* atcmd, UserRequest *ur, TcorePendingResponseCallback func) +{ + TcorePlugin *plugin = NULL; + TcoreHal *hal = NULL; + TcorePending *pending = NULL; + + plugin = tcore_object_ref_plugin(o); + hal = tcore_plugin_ref_hal(plugin); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(atcmd), atcmd); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_response_callback(pending, func, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL); + + tcore_hal_send_request(hal, pending); +} + +static void _insert_mcc_mnc_oper_list(TcorePlugin *plugin, 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(plugin); + 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",(const gchar *)(g_hash_table_lookup(row, "1"))); + snprintf(noi->mnc, 4, "%s",(const gchar *)(g_hash_table_lookup(row, "2"))); + snprintf(noi->name, 41, "%s",(const gchar *)(g_hash_table_lookup(row, "3"))); + snprintf(noi->country, 4, "%s",(const gchar *)(g_hash_table_lookup(row, "0"))); + + tcore_network_operator_info_add(o, noi); + + count++; + } + + dbg("count = %d", count); + + g_hash_table_destroy(result); + + tcore_storage_remove_handle(strg, handle); +} + + +static gboolean _is_cdma(int act) +{ + switch (act) { + case NETWORK_ACT_IS95A: + case NETWORK_ACT_IS95B: + case NETWORK_ACT_CDMA_1X: + case NETWORK_ACT_EVDO_REV0: + case NETWORK_ACT_CDMA_1X_EVDO_REV0: + case NETWORK_ACT_EVDO_REVA: + case NETWORK_ACT_CDMA_1X_EVDO_REVA: + case NETWORK_ACT_EVDV: + return TRUE; + break; + } + + return FALSE; +} + +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) +{ + enum telephony_network_service_type ret; + + ret = prev_type; + + switch (act) { + case NETWORK_ACT_NOT_SPECIFIED: + ret = NETWORK_SERVICE_TYPE_UNKNOWN; + 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; + + case NETWORK_ACT_IS95A: + case NETWORK_ACT_IS95B: + ret = NETWORK_SERVICE_TYPE_2G; + break; + + case NETWORK_ACT_CDMA_1X: + case NETWORK_ACT_GPRS: + ret = NETWORK_SERVICE_TYPE_2_5G; + break; + + case NETWORK_ACT_EGPRS: + return NETWORK_SERVICE_TYPE_2_5G_EDGE; + break; + + case NETWORK_ACT_UMTS: + ret = NETWORK_SERVICE_TYPE_3G; + break; + + case NETWORK_ACT_EVDO_REV0: + case NETWORK_ACT_CDMA_1X_EVDO_REV0: + case NETWORK_ACT_EVDO_REVA: + case NETWORK_ACT_CDMA_1X_EVDO_REVA: + case NETWORK_ACT_EVDV: + ret = NETWORK_SERVICE_TYPE_3G; + break; + } + + 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; + } + } + + return ret; +} + +static void _ps_set(TcorePlugin *plugin, int status) +{ + GSList *co_list = NULL; + + co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_PS); + do { + CoreObject *o = NULL; + o = (CoreObject *) co_list->data; + if (!o) + break; + + if (status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) { + tcore_ps_set_online(o, TRUE); + } + else { + tcore_ps_set_online(o, FALSE); + } + } while ((co_list = g_slist_next(co_list))); + + g_slist_free(co_list); +} + +static TReturn _network_general_response_result(void) +{ + if (sp_response->success > 0) { + ReleaseResponse(); + return TCORE_RETURN_SUCCESS; + } + else { + int ret, error; + char* line=NULL; + line = sp_response->finalResponse; + ret = at_tok_start(&line); + if (ret < 0) { + err("err cause not specified or string corrupted"); + ReleaseResponse(); + return TCORE_RETURN_3GPP_ERROR; + } + else { + ret = at_tok_nextint(&line, &error); + if (ret < 0) { + err("err not specified or string not contail error"); + ReleaseResponse(); + return TCORE_RETURN_3GPP_ERROR; + + } + else { + ReleaseResponse(); + return convertCMEError((enum ATCMEError)error); + } + } + } +} + +static void on_confirmation_network_message_send( TcorePending *pending, gboolean result, void *user_data ) +{ + UserRequest* ur = NULL; + struct ATReqMetaInfo* metainfo = NULL; + unsigned int info_len =0; + dbg("AT msg goes out from queue. Allocate ATRsp buffer and write rspPrefix\n"); + + ReleaseResponse(); + sp_response = at_response_new(); + + ur = tcore_pending_ref_user_request(pending); + metainfo = (struct ATReqMetaInfo*)tcore_user_request_ref_metainfo(ur,&info_len); + + if ((metainfo->type == SINGLELINE) || (metainfo->type == MULTILINE)) { + s_responsePrefix = strdup(metainfo->responsePrefix); + dbg("duplicating responsePrefix : %s\n", s_responsePrefix); + } + else { + s_responsePrefix = NULL; + } + + s_type = metainfo->type; + + if (result == FALSE) { + dbg("SEND FAIL"); + } + else { + dbg("SEND OK"); + } +} + +static void on_response_set_plmn_selection_mode(TcorePending *pending, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_network_set_plmn_selection_mode resp; + + dbg("RESPONSE OK"); + + resp.result = _network_general_response_result(); + + ur = tcore_pending_ref_user_request(pending); + 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 *pending, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_network_get_plmn_selection_mode resp = {0}; + char* line=NULL; + int mode=0; + int ret; + + printResponse(); + + if (sp_response->success > 0) { + dbg("RESPONSE OK"); + line = sp_response->p_intermediates->line; + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&mode); + if (ret < 0) + AT_TOK_ERROR(line); + + dbg("mode = %d", mode); + switch(mode) { + case AT_COPS_MODE_AUTOMATIC: + resp.mode = NETWORK_SELECT_MODE_GLOBAL_AUTOMATIC; + break; + case AT_COPS_MODE_MANUAL: + resp.mode = NETWORK_SELECT_MODE_GSM_MANUAL; + break; + } + } + else { + err("RESPONSE NOK"); + } + ReleaseResponse(); + + dbg("resp.mode = %d", resp.mode); + ur = tcore_pending_ref_user_request(pending); + if (ur) { + tcore_user_request_send_response(ur, TRESP_NETWORK_GET_PLMN_SELECTION_MODE, sizeof(struct tresp_network_get_plmn_selection_mode), &resp); + } +} + +static void on_response_search_network(TcorePending *pending, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_network_search resp; + int i = 0, ret=0; + char* line=NULL; + + memset(&resp, 0, sizeof(struct tresp_network_search)); + + if (sp_response->success > 0) { + dbg("RESPONSE OK"); + line = sp_response->p_intermediates->line; + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + while(at_tok_hasmore(&line)) + { + /* + * +COPS: [list of supported (,long alphanumeric ,short alphanumeric ,numeric [,])s] + * [,,(list of supported s),(list of supported s)] + */ + int stat=0, AcT=0; + char* oper=NULL, *p; + int commas = 0; + + dbg("line0 %s", line); + at_tok_skip_bracket(&line); + for (p = line ; *p != ')' ;p++) { + if (*p == ',') + commas++; + } + + /* : integer type */ + ret = at_tok_nextint(&line,&stat); + if (ret < 0) + AT_TOK_ERROR(line); + + /* long alphanumeric */ + ret = at_tok_nextstr(&line,&oper); + if (ret < 0) + AT_TOK_ERROR(line); + + /* short alphanumeric */ + ret = at_tok_nextstr(&line,&oper); + if (ret < 0) + AT_TOK_ERROR(line); + + /* numeric */ + /* [NOTICE] struct "tresp_network_search" only supports numeric type */ + ret = at_tok_nextstr(&line,&oper); + if (ret < 0) + AT_TOK_ERROR(line); + + if (commas == 4) { + /* [,]: integer type; access technology selected */ + ret = at_tok_nextint(&line,&AcT); + if (ret < 0) + AT_TOK_ERROR(line); + } + + dbg("mode = %d, oper=%s, AcT=%d", stat, oper?oper:"null", AcT); + resp.list[i].status = stat; + resp.list[i].act = lookup_tbl_access_technology[AcT]; + memcpy(resp.list[i].plmn, oper, 6); + if (resp.list[i].plmn[5] == '#') + resp.list[i].plmn[5] = '\0'; + + dbg("resp.list[%d].act = 0x%x, resp.list[%d].plmn=%s", i, resp.list[i].act, i, resp.list[i].plmn); + i++; + } + resp.list_count = i; + dbg("resp.list_count=%d", resp.list_count); + ur = tcore_pending_ref_user_request(pending); + if (ur) { + tcore_user_request_send_response(ur, TRESP_NETWORK_SEARCH, sizeof(struct tresp_network_search), &resp); + } + + } + else { + err("RESPONSE NOK"); + } + ReleaseResponse(); +} + +static void on_response_get_serving_network(TcorePending *pending, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_network_get_serving_network resp; + CoreObject *o; + char plmn[7]; + enum telephony_network_access_technology act = NETWORK_ACT_UNKNOWN; + int ret; + + /* AT parsing variable */ + char* line=NULL; + int mode=0, format=0, AcT=0; + char* oper=NULL; + + if (sp_response->success > 0) { + dbg("RESPONSE OK"); + line = sp_response->p_intermediates->line; + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&mode); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&format); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextstr(&line,&oper); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&AcT); + if (ret < 0) + AT_TOK_ERROR(line); + + dbg("mode = %d, format=%d, oper=%s, AcT=%d\n", mode, format, oper, AcT); + + memset(plmn, 0, 7); + memcpy(plmn, oper, 6); + if (plmn[5] == '#') + plmn[5] = '\0'; + + o = tcore_pending_ref_core_object(pending); + + tcore_network_set_plmn(o, plmn); + tcore_network_get_access_technology(o, &act); + dbg("prev_act = 0x%x, new_act = 0x%x", act,lookup_tbl_access_technology[AcT]); + act = lookup_tbl_access_technology[AcT]; + tcore_network_set_access_technology(o, act); + + if (_is_cdma(act) == FALSE) { + tcore_network_set_lac(o, current_lac); + } + + memcpy(resp.plmn, plmn, 6); + resp.act = act; + resp.gsm.lac = current_lac; + ur = tcore_pending_ref_user_request(pending); + if (ur) { + tcore_user_request_send_response(ur, TRESP_NETWORK_GET_SERVING_NETWORK, sizeof(struct tresp_network_get_serving_network), &resp); + } + else { + struct tnoti_network_change network_change; + + memset(&network_change, 0, sizeof(struct tnoti_network_change)); + memcpy(network_change.plmn, plmn, 6); + + network_change.act = act; + network_change.gsm.lac = current_lac; + + tcore_server_send_notification(tcore_plugin_ref_server(tcore_pending_ref_plugin(pending)), tcore_pending_ref_core_object(pending), + TNOTI_NETWORK_CHANGE, sizeof(struct tnoti_network_change), &network_change); + } + } + else { + err("RESPONSE NOK"); + } + ReleaseResponse(); + return; +} + +static void on_event_network_regist(CoreObject *o, const void *event_info, void *user_data) +{ + struct tnoti_network_registration_status regist_status; + enum telephony_network_service_domain_status cs_status; + enum telephony_network_service_domain_status ps_status; + enum telephony_network_service_type service_type; + enum telephony_network_access_technology act = NETWORK_ACT_UNKNOWN; + + char *line = (char *)event_info; + int ret; + unsigned char svc_domain; + int stat=0, AcT=0; + unsigned int lac=0, ci=0, rac=0; + + dbg("NOTI RECEIVED"); + + /* CS domain */ + if (strStartsWith(line,"+CREG:")) + svc_domain = NETWORK_SERVICE_DOMAIN_CS; + /* PS domain */ + else if (strStartsWith(line,"+CGREG:")) + svc_domain = NETWORK_SERVICE_DOMAIN_PS; + else + return; + + dbg("svc_domain = 0x%x", svc_domain); + + ret = at_tok_start(&line); + if (ret < 0) + AT_NOTI_TOK_ERROR(line); + + ret = at_tok_nextint(&line, &stat); + if (ret < 0) + goto process; + + ret = at_tok_nexthexint(&line, (int *)&lac); + if (ret < 0) + goto process; + else { + dbg("Found lac=0x%x",lac); + /* 1 : registered, home network */ + /* 5 : registered, roaming */ + if ( stat==1 || stat==5 ) + current_lac = lac; + } + + ret = at_tok_nexthexint(&line, (int *)&ci); + if (ret < 0) + goto process; + else + dbg("Found ci=0x%x", ci); + + ret = at_tok_nextint(&line, (int *)&AcT); + if (ret < 0) + goto process; + + if (svc_domain == NETWORK_SERVICE_DOMAIN_PS) { + ret = at_tok_nexthexint(&line, (int *)&rac); + if (ret < 0) + goto process; + else + dbg("Found rac=0x%x", rac); + } + /* + * : string type; two byte location area code or tracking area code in hexadecimal format + * : string type; two byte tracking area code in hexadecimal format (for +CEREG:) + * : string type; four byte GERAN/UTRAN/E-UTRAN cell ID in hexadecimal format + * : string type; one byte routing area code in hexadecimal format + */ + +process: + dbg("stat=%d, lac=0x%lx, ci=0x%lx, Act=%d, rac=0x%lx", stat, lac, ci, AcT, rac); + + switch (svc_domain) { + case NETWORK_SERVICE_DOMAIN_CS: + cs_status = lookup_tbl_net_status[stat]; + tcore_network_set_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT, cs_status); + break; + + case NETWORK_SERVICE_DOMAIN_PS: + ps_status = lookup_tbl_net_status[stat]; + tcore_network_set_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_PACKET, ps_status); + + _ps_set(tcore_object_ref_plugin(o), ps_status); + break; + } + + 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) + tcore_network_set_roaming_state(o, TRUE); + else + tcore_network_set_roaming_state(o, FALSE); + + tcore_network_get_service_type(o, &service_type); + dbg("prev_service_type = 0x%x", service_type); + service_type = _get_service_type(service_type, svc_domain, act, cs_status, ps_status); + dbg("new_service_type = 0x%x", service_type); + tcore_network_set_service_type(o, service_type); + + tcore_network_set_lac(o, lac); + tcore_network_set_rac(o, rac); + tcore_network_set_cell_id(o, ci); + + if (_is_cdma(act) == FALSE) { + struct tnoti_network_location_cellinfo net_lac_cell_info; + net_lac_cell_info.lac = lac; + net_lac_cell_info.cell_id = ci; + + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_NETWORK_LOCATION_CELLINFO, + sizeof(struct tnoti_network_location_cellinfo), &net_lac_cell_info); + } + + regist_status.cs_domain_status = cs_status; + regist_status.ps_domain_status = ps_status; + regist_status.service_type = service_type; + regist_status.roaming_status = tcore_network_get_roaming_state(o); + + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, + TNOTI_NETWORK_REGISTRATION_STATUS, sizeof(struct tnoti_network_registration_status), ®ist_status); + + get_serving_network(o, NULL); +} + +static void on_event_network_icon_info(CoreObject *o, const void *event_info, void *user_data) +{ + char *line = (char *)event_info; + static struct tnoti_network_icon_info net_icon_info = {0xff,0,0,0}; + int ret; + int descr=0, ind=0; + +#define CIND_NOTI_RSSI 10 +#define CIND_NOTI_BATTERY 15 + + ret = at_tok_start(&line); + if (ret < 0) + AT_NOTI_TOK_ERROR(line); + + ret = at_tok_nextint(&line, &descr); + if (ret < 0) + AT_NOTI_TOK_ERROR(line); + + ret = at_tok_nextint(&line, &ind); + if (ret < 0) + AT_NOTI_TOK_ERROR(line); + + switch(descr) { + case CIND_NOTI_RSSI: + dbg("CIND_NOTI_RSSI. ind=%d",ind); + net_icon_info.rssi = ind; + break; + case CIND_NOTI_BATTERY: + dbg("CIND_NOTI_BATTERY. ind=%d",ind); + net_icon_info.battery = ind; + break; + + default: + err("This event is not handled val=%d",descr); + return; + } + dbg("type=%d, rssi=%d, battery=%d, hdr_rssi=%d", + net_icon_info.type, net_icon_info.rssi, net_icon_info.battery, net_icon_info.hdr_rssi); + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_NETWORK_ICON_INFO, + sizeof(struct tnoti_network_icon_info), &net_icon_info); +} + +static void on_sim_resp_hook_get_netname(UserRequest *ur, enum tcore_response_command command, unsigned int data_len, + const void *data, void *user_data) +{ + const struct tresp_sim_read *resp = data; + CoreObject *o = user_data; + + if (command == TRESP_SIM_GET_SPN) { + dbg("OK SPN GETTING!!"); + dbg("resp->result = 0x%x", resp->result); + dbg("resp->data.spn.display_condition = 0x%x", resp->data.spn.display_condition); + dbg("resp->data.spn.spn = [%s]", resp->data.spn.spn); + + tcore_network_set_network_name(o, TCORE_NETWORK_NAME_TYPE_SPN, (const char *)resp->data.spn.spn); + + /** + * display condition + * bit[0]: 0 = display of registered PLMN name not required when registered PLMN is either HPLMN or a PLMN in the service provider PLMN list + * 1 = display of registered PLMN name required when registered PLMN is either HPLMN or a PLMN in the service provider PLMN list + * 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) { + tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_NETWORK); + } + 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) { + tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_ANY); + } + } +} + +static enum tcore_hook_return on_hook_sim_init(Server *s, CoreObject *source, enum tcore_notification_command command, + unsigned int data_len, void *data, void *user_data) +{ + const struct tnoti_sim_status *sim = data; + UserRequest *ur = NULL; + + if (sim->sim_status == SIM_STATUS_INIT_COMPLETED) { + ur = tcore_user_request_new(NULL, NULL); + tcore_user_request_set_command(ur, TREQ_SIM_GET_SPN); + tcore_user_request_set_response_hook(ur, on_sim_resp_hook_get_netname, user_data); + tcore_object_dispatch_request(source, ur); + } + + return TCORE_HOOK_RETURN_CONTINUE; +} + +static TReturn search_network(CoreObject *o, UserRequest *ur) +{ + /* AT command variable*/ + struct ATReqMetaInfo metainfo; + char* atcmd = NULL; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + __set_metainfo(ur, &metainfo, SINGLELINE,"+COPS:"); + + atcmd = g_strdup("AT+COPS=?\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",atcmd, "N/A", strlen(atcmd)); + + __send_at_request(o, atcmd, ur, on_response_search_network); + free(atcmd); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn set_plmn_selection_mode(CoreObject *o, UserRequest *ur) +{ + const struct treq_network_set_plmn_selection_mode *req_data; + + /* AT command variable*/ + struct ATReqMetaInfo metainfo; + char* atcmd = NULL; + char plmn[7]; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + req_data = tcore_user_request_ref_data(ur, NULL); + __set_metainfo(ur, &metainfo, NO_RESULT, NULL); + + if (req_data->mode != NETWORK_SELECT_MODE_GSM_MANUAL) { + /* AT_COPS_MODE_AUTOMATIC 0*/ + atcmd = g_strdup("AT+COPS=0\r"); + } + else { + memset(plmn, 0, 7); + memcpy(plmn, req_data->plmn, 6); + + if (strlen(req_data->plmn) == 5) { + plmn[5] = '#'; + } + /* AT_COPS_MODE_MANUAL 1*/ + /* AT_COPS_FORMAT_NUMERIC 2*/ + atcmd = g_strdup_printf("AT+COPS=0%s\r", plmn); + } + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",atcmd, "N/A", strlen(atcmd)); + + __send_at_request(o, atcmd, ur, on_response_set_plmn_selection_mode); + free(atcmd); + + return TCORE_RETURN_SUCCESS; +} + + +static TReturn get_plmn_selection_mode(CoreObject *o, UserRequest *ur) +{ + /* AT command variable*/ + struct ATReqMetaInfo metainfo; + char* atcmd = NULL; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + __set_metainfo(ur, &metainfo, SINGLELINE,"+COPS:"); + + atcmd = g_strdup("AT+COPS?\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",atcmd, "N/A", strlen(atcmd)); + + __send_at_request(o, atcmd, ur, on_response_get_plmn_selection_mode); + free(atcmd); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn set_service_domain(CoreObject *o, UserRequest *ur) +{ + dbg("set_service_domain is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn get_service_domain(CoreObject *o, UserRequest *ur) +{ + dbg("get_service_domain is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn set_band(CoreObject *o, UserRequest *ur) +{ + dbg("set_band is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn get_band(CoreObject *o, UserRequest *ur) +{ + dbg("get_band is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn set_preferred_plmn(CoreObject *o, UserRequest *ur) +{ + dbg("set_preferred_plmn is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn get_preferred_plmn(CoreObject *o, UserRequest *ur) +{ + dbg("get_preferred_plmn is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn set_order(CoreObject *o, UserRequest *ur) +{ + dbg("set_order is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn get_order(CoreObject *o, UserRequest *ur) +{ + dbg("get_order is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn set_power_on_attach(CoreObject *o, UserRequest *ur) +{ + dbg("set_power_on_attach is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn get_power_on_attach(CoreObject *o, UserRequest *ur) +{ + dbg("get_power_on_attach is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn set_cancel_manual_search(CoreObject *o, UserRequest *ur) +{ + dbg("set_cancel_manual_search is not supported!"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn get_serving_network(CoreObject *o, UserRequest *ur) +{ + /* AT command variable*/ + struct ATReqMetaInfo metainfo; + char* atcmd = NULL; + + if (!o) + return TCORE_RETURN_EINVAL; + + if (!ur) + ur = tcore_user_request_new(NULL, NULL); + + __set_metainfo(ur, &metainfo, SINGLELINE,"+COPS:"); + + atcmd = g_strdup("AT+COPS?\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",atcmd, "N/A", strlen(atcmd)); + + __send_at_request(o, atcmd, ur, on_response_get_serving_network); + free(atcmd); + return TCORE_RETURN_SUCCESS; +} + + + +static struct tcore_network_operations network_ops = { + .search = search_network, + .set_plmn_selection_mode = set_plmn_selection_mode, + .get_plmn_selection_mode = get_plmn_selection_mode, + .set_service_domain = set_service_domain, + .get_service_domain = get_service_domain, + .set_band = set_band, + .get_band = get_band, + .set_preferred_plmn = set_preferred_plmn, + .get_preferred_plmn = get_preferred_plmn, + .set_order = set_order, + .get_order = get_order, + .set_power_on_attach = set_power_on_attach, + .get_power_on_attach = get_power_on_attach, + .set_cancel_manual_search = set_cancel_manual_search, + .get_serving_network = get_serving_network, +}; + +gboolean s_network_init(TcorePlugin *plugin) +{ + CoreObject *o; + + o = tcore_network_new(plugin, "umts_network", &network_ops); + if (!o) + return FALSE; + + tcore_object_add_callback(o, EVENT_NETWORK_REGISTRATION, on_event_network_regist, NULL); + tcore_object_add_callback(o, EVENT_NETWORK_ICON_INFO, on_event_network_icon_info, NULL); + + tcore_server_add_notification_hook(tcore_plugin_ref_server(plugin), TNOTI_SIM_STATUS, on_hook_sim_init, o); + + _insert_mcc_mnc_oper_list(plugin, o); + + return TRUE; +} + +void s_network_exit(TcorePlugin *plugin) +{ + CoreObject *o; + + o = tcore_plugin_ref_core_object(plugin, "umts_network"); + + tcore_network_free(o); +} diff --git a/src/s_ps.c b/src/s_ps.c new file mode 100755 index 0000000..dfef543 --- /dev/null +++ b/src/s_ps.c @@ -0,0 +1,572 @@ +/** + * tel-plugin-atmodem + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Kyoungyoup Park + * 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 +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "s_common.h" +#include "s_ps.h" + +#include "atchannel.h" +#include "at_tok.h" + +extern struct ATResponse *sp_response; +extern char *s_responsePrefix; +extern enum ATCommandType s_type; + +static void on_confirmation_ps_message_send( TcorePending *p, gboolean result, void *user_data ) +{ + UserRequest* ur = NULL; + struct ATReqMetaInfo* metainfo = NULL; + unsigned int info_len =0; + dbg("on_confirmation_ps_message_send - msg out from queue. alloc ATRsp buffer & write rspPrefix if needed\n"); + + ReleaseResponse(); // release leftover + //alloc new sp_response + sp_response = at_response_new(); + + ur = tcore_pending_ref_user_request(p); + metainfo = (struct ATReqMetaInfo*)tcore_user_request_ref_metainfo(ur,&info_len); + + if ((metainfo->type == SINGLELINE)||(metainfo->type == MULTILINE)) { + //cp rsp prefix + s_responsePrefix = strdup(metainfo->responsePrefix); + dbg("duplicating responsePrefix : %s\n", s_responsePrefix); + } + else { + s_responsePrefix = NULL; + } + + //set atcmd type into s_type + s_type = metainfo->type; + + if (result == FALSE) { + /* Fail */ + dbg("SEND FAIL"); + } + else { + dbg("SEND OK"); + } +} + + +static TReturn _pdp_device_control(gboolean flag, unsigned int context_id) +{ + int size = 0; + int fd = 0; + char buf[32]; + char *control = NULL; + + if (context_id > 3) + return TCORE_RETURN_EINVAL; + + if (flag) + control = "/sys/class/net/svnet0/pdp/activate"; + else + control = "/sys/class/net/svnet0/pdp/deactivate"; + + fd = open(control, O_WRONLY); + if (fd < 0) { + return TCORE_RETURN_FAILURE; + } + + snprintf(buf, sizeof(buf), "%d", context_id); + size = write(fd, buf, strlen(buf)); + + close(fd); + return TCORE_RETURN_SUCCESS; +} + +static void on_event_ps_ipconfiguration(CoreObject *o, const void *event_info, void *user_data) +{ + /* Parsing the response line and map into noti. */ + CoreObject *ps_context = (CoreObject *)user_data; + unsigned int pdpContextCnt, cid = tcore_context_get_id(ps_context); + struct ATLine *p_cur = NULL; + const struct ATResponse *p_response = event_info; + int err, ret, p_cid=0, d_comp = -1, h_comp = -1; + struct tnoti_ps_pdp_ipconfiguration noti; + char devname[10] = {0,}; + char addr_buf[5][20]; + char *pdp_type = NULL, *apn = NULL; + char *line = NULL, *ip = NULL, *gateway = NULL;//, *netmask = NULL; + + /* count the PDP contexts */ + for (pdpContextCnt = 0, p_cur = p_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next) { + pdpContextCnt++; + } + + dbg("Total number of PDP contexts : %d",pdpContextCnt); + + if(pdpContextCnt == 0) + return; + + for (p_cur = p_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next) { + line = p_response->p_intermediates->line; + + err = at_tok_start(&line); + err = at_tok_nextint(&line,&p_cid); + dbg("cid: %d", p_cid); + + /* Send IP Configuration noti only on the requested CID. */ + if (p_cid && (cid == (unsigned int)p_cid)) { + err = at_tok_nextstr(&line,&pdp_type); + dbg("PDP type: %s", pdp_type); + + if (pdp_type!=NULL) { + err = at_tok_nextstr(&line,&apn); + dbg("APN: %s", apn); + } + if (apn !=NULL) { + err = at_tok_nextstr(&line,&ip); + dbg("IP address: %s", ip); + } + if (ip !=NULL) { + err = at_tok_nextint(&line,&d_comp); + dbg("d_comp: %d", d_comp); + } + if (d_comp != -1) { + err = at_tok_nextint(&line,&h_comp); + dbg("h_comp: %d", h_comp); + } + + memset(¬i, 0, sizeof(struct tnoti_ps_pdp_ipconfiguration)); + + noti.context_id = cid; + noti.err = 0; + + /* Just use AF_INET here. */ + ret = inet_pton(AF_INET, ip, ¬i.ip_address); + if (ret < 1) { + dbg("inet_pton() failed."); + return; + } + + snprintf(addr_buf[0], 20, "%d.%d.%d.%d", noti.ip_address[0], noti.ip_address[1], + noti.ip_address[2], noti.ip_address[3]); + ip = addr_buf[0]; + dbg("ip = [%s]", ip); + + noti.primary_dns[0] = 8; + noti.primary_dns[1] = 8; + noti.primary_dns[2] = 8; + noti.primary_dns[3] = 8; + dbg("primary_dns = [8.8.8.8] Public DNS server."); + + noti.secondary_dns[0] = 8; + noti.secondary_dns[1] = 8; + noti.secondary_dns[2] = 4; + noti.secondary_dns[3] = 4; + dbg("secondary_dns = [8.8.4.4] Public DNS server."); + + memcpy(¬i.gateway, ¬i.ip_address, 4); + noti.gateway[3] = 1; + snprintf(addr_buf[3], 20, "%d.%d.%d.%d", noti.gateway[0], noti.gateway[1], noti.gateway[2], + noti.gateway[3]); + gateway = addr_buf[3]; + dbg("gateway = [%s]", gateway); + + /* FIX ME: use static netmask. */ + noti.subnet_mask[0] = 255; + noti.subnet_mask[1] = 255; + noti.subnet_mask[2] = 255; + noti.subnet_mask[3] = 0; + dbg("subnet_mask = [255.255.255.0]"); + + if (_pdp_device_control(TRUE, cid) != TCORE_RETURN_SUCCESS) { + dbg("_pdp_device_control() failed. errno=%d", errno); + } + + snprintf(devname, 10, "pdp%d", cid - 1); + memcpy(noti.devname, devname, 10); + dbg("devname = [%s]", devname); + + if (tcore_util_netif_up(devname) != TCORE_RETURN_SUCCESS) { + dbg("util_netif_up() failed. errno=%d", errno); + } + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_PS_PDP_IPCONFIGURATION, + sizeof(struct tnoti_ps_pdp_ipconfiguration), ¬i); + } + else + dbg("No matched response with CID: %d",cid); + } +} + +static void on_response_get_ipconfiguration(TcorePending *pending, int data_len, const void *data, void *user_data) +{ + struct ATLine *p_cur; + CoreObject *ps_context = (CoreObject *)user_data; + char *line = NULL; + + printResponse(); + + if (sp_response->success > 0) { + dbg("RESPONSE OK"); + + for (p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next) { + line = sp_response->p_intermediates->line; + dbg("%s\n", line); + } + + dbg("Call on_ipc_event_ps_ipconfiguration"); + on_event_ps_ipconfiguration(tcore_pending_ref_core_object(pending), sp_response, ps_context); + } + else { + dbg("RESPONSE NOK"); + } + + ReleaseResponse(); +} + +static void on_response_ps_attached(TcorePending *p, int data_len, const void *data, void *user_data) +{ + TcorePlugin *pl = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + CoreObject *o = tcore_pending_ref_core_object(p); + CoreObject *ps_context = (CoreObject *)user_data; + UserRequest *ur; + + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + char* line = NULL; + + printResponse(); + + if (sp_response->success > 0) { + dbg("RESPONSE OK"); + line = sp_response->p_intermediates->line; + dbg("on_response_ps_attached: %s", line); + + ur = tcore_user_request_new(NULL, NULL); + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + memcpy(metainfo.responsePrefix,"+CGDCONT:",strlen("+CGDCONT:")); + metainfo.type = MULTILINE; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + dbg(" Send: AT+CGDCONT?\r "); + cmd_str = g_strdup("AT+CGDCONT?\r"); + + pl = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(pl); + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_get_ipconfiguration, ps_context); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_send_callback(pending, on_confirmation_ps_message_send, NULL); + tcore_hal_send_request(h, pending); + } + else { + dbg("RESPONSE NOK"); + } + + ReleaseResponse(); +} + +static void on_response_active_set(TcorePending *p, int data_len, const void *data, void *user_data) +{ + TcorePlugin *pl = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + CoreObject *o = tcore_pending_ref_core_object(p); + CoreObject *ps_context = (CoreObject *)user_data; + UserRequest *ur; + + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + printResponse(); + + if (sp_response->success > 0) { + dbg("RESPONSE OK"); + + ur = tcore_user_request_new(NULL, NULL); + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + dbg(" Send: ATD*99***1#\r "); + cmd_str = g_strdup("ATD*99***1#\r"); + + pl = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(pl); + pending = tcore_pending_new(o, ID_RESERVED_AT); + + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_ps_attached, ps_context); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_send_callback(pending, on_confirmation_ps_message_send, NULL); + tcore_hal_send_request(h, pending); + } + else { + dbg("RESPONSE NOK"); + tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATED); + } + + ReleaseResponse(); +} + +static void on_response_deactive_set(TcorePending *p, int data_len, const void *data, void *user_data) +{ + printResponse(); + + if (sp_response->success > 0) { + dbg("RESPONSE OK"); + } + else { + dbg("RESPONSE NOK"); + } + + ReleaseResponse(); +} + +static gboolean pdp_active_set(CoreObject *o, CoreObject *ps_context) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + UserRequest *ur; + + unsigned int cid; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + if ( !o ) + return TCORE_RETURN_FAILURE; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + + ur = tcore_user_request_new(NULL, NULL); + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cid = tcore_context_get_id(ps_context); + + dbg("Example: AT+CGACT=1,0"); + cmd_str = g_strdup_printf("%s=%d,%d%s","AT+CGACT", 1, cid, "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_active_set, ps_context); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_send_callback(pending, on_confirmation_ps_message_send, NULL); + tcore_hal_send_request(h, pending); + + return TRUE; +} + +static void on_response_define_pdp(TcorePending *p, int data_len, const void *data, void *user_data) +{ + CoreObject *ps_context = user_data; + + printResponse(); + + if (sp_response->success > 0) { + dbg("RESPONSE OK"); + pdp_active_set(tcore_pending_ref_core_object(p), ps_context); + } + else { + dbg("RESPONSE NOK"); + tcore_context_set_state(tcore_pending_ref_core_object(p), CONTEXT_STATE_DEACTIVATED); + } + + ReleaseResponse(); +} + +static TReturn activate_ps_context(CoreObject *o, CoreObject *ps_context, void *user_data) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + UserRequest *ur; + + char *apn=NULL, *addr=NULL; + + unsigned int cid; + enum co_context_type pdp_type; + enum co_context_d_comp d_comp; + enum co_context_h_comp h_comp; + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + if ( !o ) + return TCORE_RETURN_FAILURE; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + ur = tcore_user_request_new(NULL, NULL); + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cid = tcore_context_get_id(ps_context); + pdp_type = tcore_context_get_type(ps_context); + d_comp = tcore_context_get_data_compression(ps_context); + h_comp = tcore_context_get_header_compression(ps_context); + + dbg("Example: AT+CGDCONT=1,\"IP\",\"www.example.co.kr\",,0,0"); + cmd_str = g_strdup_printf("AT+CGDCONT=%d,\"%d\",\"%s\",%s,%d,%d%s", + cid, pdp_type, apn, addr, d_comp, h_comp, "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_define_pdp, ps_context); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_send_callback(pending, on_confirmation_ps_message_send, NULL); + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn deactivate_ps_context(CoreObject *o, CoreObject *ps_context, void *user_data) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + UserRequest *ur; + + unsigned int cid; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + if ( !o ) + return TCORE_RETURN_FAILURE; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + ur = tcore_user_request_new(NULL, NULL); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + info_len = sizeof(struct ATReqMetaInfo); + + cid = tcore_context_get_id(ps_context); + + dbg("Example: AT+CGACT=0,1"); + cmd_str = g_strdup_printf("%s=%d,%d%s","AT+CGACT", 0, cid, "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + free(cmd_str); + + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_deactive_set, ps_context); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_send_callback(pending, on_confirmation_ps_message_send, NULL); + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static struct tcore_ps_operations ps_ops = +{ + .pin_ctrl = NULL, + .activate_context = activate_ps_context, + .deactivate_context = deactivate_ps_context +}; + +gboolean s_ps_init(TcorePlugin *p) +{ + CoreObject *o; + GQueue *work_queue; + + o = tcore_ps_new(p, "umts_ps", &ps_ops); + if (!o) + return FALSE; + + work_queue = g_queue_new(); + tcore_object_link_user_data(o, work_queue); + + return TRUE; +} + +void s_ps_exit(TcorePlugin *p) +{ + CoreObject *o; + GQueue *work_queue; + + o = tcore_plugin_ref_core_object(p, "umts_ps"); + if (!o) + return; + + work_queue = tcore_object_ref_user_data(o); + if (work_queue) + g_queue_free(work_queue); + + tcore_ps_free(o); +} diff --git a/src/s_sim.c b/src/s_sim.c new file mode 100644 index 0000000..a3d89e3 --- /dev/null +++ b/src/s_sim.c @@ -0,0 +1,2765 @@ +/* + * tel-plugin-samsung-atmodem + * + * 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 +#include + +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "s_common.h" +#include "s_sim.h" + +#include "atchannel.h" +#include "at_tok.h" + +extern struct ATResponse *sp_response; +extern char *s_responsePrefix; +extern enum ATCommandType s_type; + +#define SWAPBYTES16(x) \ +{ \ + unsigned short int data = *(unsigned short int*)&(x); \ + data = ((data & 0xff00) >> 8) | \ + ((data & 0x00ff) << 8); \ + *(unsigned short int*)&(x) = data ; \ +} + +enum s_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 s_sim_sec_op_e { + SEC_PIN1_VERIFY, + SEC_PIN2_VERIFY, + SEC_PUK1_VERIFY, + SEC_PUK2_VERIFY, + SEC_SIM_VERIFY, + SEC_ADM_VERIFY, + SEC_PIN1_CHANGE, + SEC_PIN2_CHANGE, + SEC_PIN1_ENABLE, + SEC_PIN1_DISABLE, + SEC_PIN2_ENABLE, + SEC_PIN2_DISABLE, //10 + SEC_SIM_ENABLE, + SEC_SIM_DISABLE, + SEC_NET_ENABLE, + SEC_NET_DISABLE, + SEC_NS_ENABLE, + SEC_NS_DISABLE, + SEC_SP_ENABLE, + SEC_SP_DISABLE, + SEC_CP_ENABLE, + SEC_CP_DISABLE, //20 + SEC_FDN_ENABLE, + SEC_FDN_DISABLE, + SEC_PIN1_STATUS, + SEC_PIN2_STATUS, + SEC_FDN_STATUS, + SEC_NET_STATUS, + SEC_NS_STATUS, + SEC_SP_STATUS, + SEC_CP_STATUS, + SEC_SIM_STATUS +}; + +struct s_sim_property { + gboolean b_valid; /**< Valid or not */ + enum tel_sim_file_id file_id; /**< File identifier */ + enum s_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 */ + int current_index; /**< current index to read */ + enum tel_sim_status first_recv_status; + enum s_sim_sec_op_e current_sec_op; /**< current index to read */ + struct tresp_sim_read files; + struct ATReqMetaInfo metainfo; +}; + +enum s_sim_sec_locktype_e{ + SEC_LOCK_TYPE_NONE =0, + SEC_LOCK_TYPE_READY, /* ME is not locked */ + SEC_LOCK_TYPE_PS, /* PH-SIM, Lock Phone to SIM/UICC card(MT asks password when other than current SIM/UICC card inserted; MT may remember certain amount of + previously used cards thus not requiring password when they are inserted ) */ + SEC_LOCK_TYPE_PF, /* PH-FSIM, Lock Phone to the very First inserted SIM/UICC card ( MT asks password when other than the first SIM/UICC card is inserted ) */ + SEC_LOCK_TYPE_SC, /*Lock SIM/UICC card ( SIM asks password in ME power-up and when this command is issued ) */ + SEC_LOCK_TYPE_FD, /* SIM card or active application in the UICC(GSM or USIM) fixed dialing memory feature */ + SEC_LOCK_TYPE_PN, /* Network Personalization */ + SEC_LOCK_TYPE_PU, /* Network subset Personalization */ + SEC_LOCK_TYPE_PP, /* Service Provider Personalization */ + SEC_LOCK_TYPE_PC, /* Corporate Personalization */ + SEC_LOCK_TYPE_SC2, /* Lock PIN2 ( ... ) */ + SEC_LOCL_TYPE_PUK2, /* Lock PUK2 (... ) */ + SEC_LOCK_TYPE_ACL, /* ACL */ + + SEC_LOCK_TYPE_NO_SIM, /* SIM is not inserted */ + SEC_LOCK_TYPE_UNAVAIL, /* SIM is inserted but can not communicate with SIM ( SIM interface error ) */ + SEC_SIM_INIT_COMPLETED, /* SIM Initialize Completed */ + SEC_PB_INIT_COMPLETED, /* Phonebook Initialize Completed*/ + SEC_SIM_INIT_CRASH, /* SIM Crash request from SMC lab*/ + + SEC_LOCK_TYPE_MAX +}; + +enum s_sim_sec_lockkey_e{ + SEC_LOCK_KEY_NONE, + SEC_LOCK_KEY_UNLOCKED, /* Not necessary */ + SEC_LOCK_KEY_PIN, /* PIN required as a password */ + SEC_LOCK_KEY_PUK, /* 0PUK required as a password */ + SEC_LOCK_KEY_PIN2, /* PIN2 required as a password */ + SEC_LOCK_KEY_PUK2, /* PUK2 required as a password */ + SEC_LOCK_KEY_PERM_BLOCKED, /* PIN Permanent Blocked */ + SEC_LOCK_KEY_PIN2_DISABLE, /* PIN2 Lock Disabled*/ + SEC_LOCK_KEY_MAX +}; + + + +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); +static TReturn _get_file_info(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef); +static gboolean _get_file_data(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef, const int offset, const int length); +static gboolean _get_file_record(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef, const int index, const int length); +static void _sim_status_update(CoreObject *o, enum tel_sim_status sim_status); + +static gboolean _convert_SCPIN_noti(char* line, enum s_sim_sec_locktype_e* lock_type, enum s_sim_sec_lockkey_e* lock_key); + +static gboolean _convert_SCPIN_noti(char* line, enum s_sim_sec_locktype_e* lock_type, enum s_sim_sec_lockkey_e* lock_key) +{ + char *type =NULL, *key = NULL; + int err; + if(line == NULL) + return FALSE; + + dbg("incoming string : %s\n", line); + + //rip off %SCPIN: + at_tok_start(&line); + + // 1. find type string + err = at_tok_nextstr(&line, &type); + if(err<0){ + // no type string found. + type = NULL; + } + if(type !=NULL){ + // 2. find key string + err = at_tok_nextstr(&line, &key); + } + if(err<0){ + // no key found + key = NULL; + } + + dbg("type : %s, key : %s\n", type, key); + +// 3. convert string into enum + if(type!=NULL) + { + if(strStartsWith (type, "NO_SIM")) + *lock_type = SEC_LOCK_TYPE_NO_SIM; + else if(strStartsWith (type, "UNAVAIL")) + *lock_type = SEC_LOCK_TYPE_UNAVAIL; + else if(strStartsWith (type, "NO_LOCK")) + *lock_type = SEC_LOCK_TYPE_READY; + else if(strStartsWith (type, "LOCK_PS")) + *lock_type = SEC_LOCK_TYPE_PS; + else if(strStartsWith (type, "LOCK_PF")) + *lock_type = SEC_LOCK_TYPE_PF ; + else if(strStartsWith (type, "LOCK_SC")) + *lock_type = SEC_LOCK_TYPE_SC; + else if(strStartsWith (type, "LOCK_FD")) + *lock_type = SEC_LOCK_TYPE_FD; + else if(strStartsWith (type, "LOCK_PN")) + *lock_type = SEC_LOCK_TYPE_PN ; + else if(strStartsWith (type, "LOCK_PU")) + *lock_type = SEC_LOCK_TYPE_PU ; + else if(strStartsWith (type, "LOCK_PP")) + *lock_type = SEC_LOCK_TYPE_PP; + else if(strStartsWith (type, "LOCK_PC")) + *lock_type = SEC_LOCK_TYPE_PC; + else if(strStartsWith (type, "LOCK_SC2")) + *lock_type = SEC_LOCK_TYPE_SC2 ; + else if(strStartsWith (type, "LOCK_ACL")) + *lock_type = SEC_LOCK_TYPE_ACL; + else if(strStartsWith (type, "LOCK_PUK2")) + *lock_type = SEC_LOCL_TYPE_PUK2; + else if(strStartsWith (type, "INIT_COMP")) + *lock_type = SEC_SIM_INIT_COMPLETED; + else if(strStartsWith (type, "INIT_ERROR")) + *lock_type = SEC_SIM_INIT_CRASH; + else + *lock_type = SEC_LOCK_TYPE_NONE; + } + else + type = SEC_LOCK_TYPE_NONE; + + if(key!=NULL) + { + if(strStartsWith (type, "PIN")) + *lock_key = SEC_LOCK_KEY_PIN; + else if(strStartsWith (type, "PUK")) + *lock_key = SEC_LOCK_KEY_PUK; + else if(strStartsWith (type, "PIN2")) + *lock_key = SEC_LOCK_KEY_PIN2; + else if(strStartsWith (type, "PUK2")) + *lock_key = SEC_LOCK_KEY_PUK2; + else if(strStartsWith (type, "BLOCKED")) + *lock_key = SEC_LOCK_KEY_PERM_BLOCKED ; + else if(strStartsWith (type, "UNLOCKED")) + *lock_key = SEC_LOCK_KEY_UNLOCKED ; + else if(strStartsWith (type, "PIN2_DISABLE")) + *lock_key = SEC_LOCK_KEY_PIN2_DISABLE; + else + *lock_key = SEC_LOCK_KEY_NONE; + } + else + *lock_key = SEC_LOCK_KEY_NONE; + + +// 4. apply exceptional case. + //if type is READY, key has no meanig + if(*lock_type == SEC_LOCK_TYPE_READY) + *lock_key = SEC_LOCK_KEY_UNLOCKED; + + // no sim, unvail, init_comp, init_error have no key info + if((*lock_type == SEC_LOCK_TYPE_NO_SIM)||(*lock_type == SEC_LOCK_TYPE_UNAVAIL)|| + (*lock_type == SEC_SIM_INIT_COMPLETED)||(*lock_type == SEC_SIM_INIT_CRASH)) + *lock_key = SEC_LOCK_KEY_NONE; + + dbg("type : %d, key : %d\n", *lock_type, *lock_key); + + return TRUE; +} + +static enum tcore_response_command _find_resp_command(UserRequest *ur) +{ + enum tcore_request_command command; + command = tcore_user_request_get_command(ur); + switch(command){ + case TREQ_SIM_VERIFY_PINS: + return TRESP_SIM_VERIFY_PINS; + break; + case TREQ_SIM_VERIFY_PUKS: + return TRESP_SIM_VERIFY_PUKS; + break; + case TREQ_SIM_CHANGE_PINS: + return TRESP_SIM_CHANGE_PINS; + break; + case TREQ_SIM_GET_FACILITY_STATUS: + return TRESP_SIM_GET_FACILITY_STATUS; + break; + case TREQ_SIM_DISABLE_FACILITY: + return TRESP_SIM_DISABLE_FACILITY; + break; + case TREQ_SIM_ENABLE_FACILITY: + return TRESP_SIM_ENABLE_FACILITY; + break; + case TREQ_SIM_TRANSMIT_APDU: + return TRESP_SIM_TRANSMIT_APDU; + break; + case TREQ_SIM_GET_ATR: + return TRESP_SIM_GET_ATR; + break; + case TREQ_SIM_GET_ECC: + return TRESP_SIM_GET_ECC; + break; + case TREQ_SIM_GET_LANGUAGE: + return TRESP_SIM_GET_LANGUAGE; + break; + case TREQ_SIM_SET_LANGUAGE: + return TRESP_SIM_SET_LANGUAGE; + break; + case TREQ_SIM_GET_ICCID: + return TRESP_SIM_GET_ICCID; + break; + case TREQ_SIM_GET_MAILBOX: + return TRESP_SIM_GET_MAILBOX; + break; + case TREQ_SIM_GET_CALLFORWARDING: + return TRESP_SIM_GET_CALLFORWARDING; + break; + case TREQ_SIM_GET_MESSAGEWAITING: + return TRESP_SIM_GET_MESSAGEWAITING; + break; + case TREQ_SIM_GET_CPHS_INFO: + return TRESP_SIM_GET_CPHS_INFO; + break; + case TREQ_SIM_GET_MSISDN: + return TRESP_SIM_GET_MSISDN; + break; + case TREQ_SIM_GET_SPN: + return TRESP_SIM_GET_SPN; + break; + case TREQ_SIM_GET_SPDI: + return TRESP_SIM_GET_SPDI; + break; + case TREQ_SIM_GET_OPL: + return TRESP_SIM_GET_OPL; + break; + case TREQ_SIM_GET_PNN: + return TRESP_SIM_GET_PNN; + break; + case TREQ_SIM_GET_CPHS_SHORTNETNAME: + return TRESP_SIM_GET_CPHS_SHORTNETNAME; + break; + case TREQ_SIM_GET_CPHS_FULLNETNAME: + return TRESP_SIM_GET_CPHS_FULLNETNAME; + break; + case TREQ_SIM_GET_OPLMNWACT: + return TRESP_SIM_GET_OPLMNWACT; + break; + case TREQ_SIM_REQ_AUTHENTICATION: + return TRESP_SIM_REQ_AUTHENTICATION; + break; + default: + break; + } + return TRESP_UNKNOWN; +} + +static int _sim_get_current_pin_facility(struct s_sim_property *sp) +{ + int ret_type = 0; + dbg("current sp->current_sec_op[%d]", sp->current_sec_op); + switch(sp->current_sec_op){ + case SEC_PIN1_VERIFY : + case SEC_PIN1_CHANGE : + ret_type = SIM_PTYPE_PIN1; + break; + case SEC_PIN2_VERIFY : + case SEC_PIN2_CHANGE : + ret_type = SIM_PTYPE_PIN2; + break; + case SEC_PUK1_VERIFY : + ret_type = SIM_PTYPE_PUK1; + break; + case SEC_PUK2_VERIFY : + ret_type = SIM_PTYPE_PUK2; + break; + case SEC_SIM_VERIFY : + ret_type = SIM_PTYPE_SIM; + break; + case SEC_ADM_VERIFY : + ret_type = SIM_PTYPE_ADM; + break; + + case SEC_PIN1_ENABLE : + case SEC_PIN1_DISABLE : + case SEC_PIN1_STATUS : + ret_type = SIM_FACILITY_SC; + break; + case SEC_SIM_ENABLE : + case SEC_SIM_DISABLE : + case SEC_SIM_STATUS : + ret_type = SIM_FACILITY_PS; + break; + case SEC_NET_ENABLE : + case SEC_NET_DISABLE : + case SEC_NET_STATUS : + ret_type = SIM_FACILITY_PN; + break; + case SEC_NS_ENABLE : + case SEC_NS_DISABLE : + case SEC_NS_STATUS : + ret_type = SIM_FACILITY_PU; + break; + case SEC_SP_ENABLE : + case SEC_SP_DISABLE : + case SEC_SP_STATUS : + ret_type = SIM_FACILITY_PP; + break; + case SEC_CP_ENABLE : + case SEC_CP_DISABLE : + case SEC_CP_STATUS : + ret_type = SIM_FACILITY_PC; + break; + case SEC_FDN_ENABLE : + case SEC_FDN_DISABLE : + case SEC_FDN_STATUS : + ret_type = SIM_FACILITY_FD; + break; + + default: + dbg("not handled current op[%d]",sp->current_sec_op ) + break; + } + return ret_type; +} + +static enum tel_sim_access_result _decode_status_word(unsigned short status_word1, unsigned short status_word2) +{ + enum tel_sim_access_result rst = SIM_ACCESS_FAILED; + + if (status_word1 == 0x93 && status_word2 == 0x00) { + rst = SIM_ACCESS_FAILED; + /*Failed SIM request command*/ + dbg(" error - SIM application toolkit busy [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x94 && status_word2 == 0x00) { + rst = SIM_ACCESS_FAILED; + /*Failed SIM request command*/ + dbg(" error - No EF Selected [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x94 && status_word2 == 0x02) { + rst = SIM_ACCESS_FAILED; + /*Failed SIM request command*/ + dbg("error - Out of Range - Invalid address or record number[%x][%x]", + status_word1, status_word2); + } + else if (status_word1 == 0x94 && status_word2 == 0x04) { + rst = SIM_ACCESS_FILE_NOT_FOUND; + /*Failed SIM request command*/ + dbg(" error - File ID not found [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x94 && status_word2 == 0x08) { + rst = SIM_ACCESS_FAILED; /* MOdem not support */ + /*Failed SIM request command*/ + dbg(" error - File is inconsistent with command - Modem not support or USE IPC [%x][%x]", + status_word1, status_word2); + } + else if (status_word1 == 0x98 && status_word2 == 0x02) { + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + /*Failed SIM request command*/ + dbg(" error - CHV not initialized [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x98 && status_word2 == 0x04) { + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + /*Failed SIM request command*/ + dbg(" error - Access condition not fullfilled [%x][%x]", status_word1, status_word2); + dbg(" error -Unsuccessful CHV verification - at least one attempt left [%x][%x]", + status_word1, status_word2); + dbg(" error - Unsuccessful Unblock CHV - at least one attempt left [%x][%x]", + status_word1, status_word2); + dbg(" error - Authentication failure [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x98 && status_word2 == 0x08) { + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + /*Failed SIM request command*/ + dbg(" error - Contradiction with CHV status [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x98 && status_word2 == 0x10) { + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + /*Failed SIM request command*/ + dbg(" error - Contradiction with invalidation status [%x][%x]", + status_word1, status_word2); + } + else if (status_word1 == 0x98 && status_word2 == 0x40) { + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + /*Failed SIM request command*/ + dbg(" error -Unsuccessful CHV verification - no attempt left [%x][%x]", + status_word1, status_word2); + dbg(" error - Unsuccessful Unblock CHV - no attempt left [%x][%x]", + status_word1, status_word2); + dbg(" error - CHV blocked [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x67 && status_word2 == 0x00) { + rst = SIM_ACCESS_FAILED; + dbg(" error -Incorrect Parameter 3 [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x6B && status_word2 == 0x00) { + rst = SIM_ACCESS_FAILED; + dbg(" error -Incorrect Parameter 1 or 2 [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x6D && status_word2 == 0x00) { + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + dbg(" error -Unknown instruction given as command [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x6E && status_word2 == 0x00) { + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + dbg(" error -Unknown instruction given as command [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x69 && status_word2 == 0x82) { + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + dbg(" error -Access denied [%x][%x]", status_word1, status_word2); + } + else if (status_word1 == 0x6A && status_word2 == 0x87) { + 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_FAILED; // 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_FAILED; // 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; + dbg(" error -Unknown state [%x][%x]", status_word1, status_word2); + } + return rst; +} + +static gboolean _sim_check_identity(CoreObject *o, 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"); + return FALSE; + } + + strg = (Storage*)tcore_server_find_storage(s, "vconf"); + if(!strg){ + dbg("there is no valid storage plugin"); + return FALSE; + } + + 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); + } + return 1; +} + +static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_sim_file_id ef, enum tel_sim_access_result rt ) +{ + struct tresp_sim_read resp = {0,}; + struct s_sim_property *file_meta = NULL; + + dbg("EF[0x%x] access Result[%d]", ef, rt); + + resp.result = rt; + memset(&resp.data, 0x00, sizeof(resp.data)); + + if ((ef != SIM_EF_ELP || ef != SIM_EF_LP || ef != SIM_EF_USIM_PL) + && (rt != SIM_ACCESS_SUCCESS)) { + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), + &resp); + return; + } + + file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL); + + switch (ef) { + case SIM_EF_ELP: + if (rt == SIM_ACCESS_SUCCESS) { + dbg("[SIM DATA] exist EFELP/PL(0x2F05)"); + /* if (po->language_file == 0x00) + po->language_file = SIM_EF_ELP;*/ + _get_file_data(o, ur, ef, 0, file_meta->data_size); + } + else { + if (tcore_sim_get_type(o) == SIM_TYPE_GSM) { + dbg(" [SIM DATA]SIM_EF_ELP(2F05) access fail. Request SIM_EF_LP(0x6F05) info"); + /* The ME requests the Language Preference (EFLP) if EFELP is not available */ + _get_file_info(o, ur, SIM_EF_LP); + } + else if (tcore_sim_get_type(o) == 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"); + /* 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); + return; + } + } + break; + + case SIM_EF_LP: //same with SIM_EF_USIM_LI + if (rt == SIM_ACCESS_SUCCESS) { + dbg("[SIM DATA] exist EFLP/LI(0x6F05)"); + /* if (po->language_file == 0x00) + po->language_file = SIM_EF_LP;*/ + _get_file_data(o, ur, ef, 0, file_meta->data_size); + } + else { + dbg("[SIM DATA]SIM_EF_LP/LI(6F05) access fail. Current CardType[%d]", + tcore_sim_get_type(o)); + if (tcore_sim_get_type(o) == SIM_TYPE_GSM) { + /* EFELPand EFLP 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); + return; + } + /* if EFLI is not present, then the language selection shall be as defined in EFPL at the MF level */ + else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) { + dbg("[SIM DATA] try USIM EFPL(0x2F05)"); + _get_file_info(o, ur, SIM_EF_ELP); + } + } + break; + + case SIM_EF_USIM_PL: + if (rt == SIM_ACCESS_SUCCESS) { + dbg("[SIM DATA] exist EFELP/PL(0x2F05)"); + /* if (po->language_file == 0x00) + po->language_file = SIM_EF_ELP;*/ + _get_file_data(o, ur, SIM_EF_ELP, 0, file_meta->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"); + /* po->language.lang_cnt = 0;*/ + tcore_user_request_send_response(ur, _find_resp_command(ur), + sizeof(struct tresp_sim_read), &resp); + return; + } + break; + + case SIM_EF_ECC: + if (tcore_sim_get_type(o) == SIM_TYPE_GSM) { + _get_file_data(o, ur, ef, 0, file_meta->data_size); + } + else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) { + if (file_meta->rec_count > SIM_ECC_RECORD_CNT_MAX) + file_meta->rec_count = SIM_ECC_RECORD_CNT_MAX; + + file_meta->current_index++; + _get_file_record(o, ur, ef, file_meta->current_index, file_meta->rec_length); + } + break; + + case SIM_EF_ICCID: + case SIM_EF_IMSI: + case SIM_EF_SST: + case SIM_EF_SPN: + case SIM_EF_SPDI: + case SIM_EF_CPHS_CPHS_INFO: + case SIM_EF_CPHS_CALL_FORWARD_FLAGS: + case SIM_EF_CPHS_VOICE_MSG_WAITING: + case SIM_EF_CPHS_OPERATOR_NAME_STRING: + case SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING: + case SIM_EF_CPHS_DYNAMICFLAGS: + case SIM_EF_CPHS_DYNAMIC2FLAG: + case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE: + case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE_LINE2: + _get_file_data(o, ur, ef, 0, file_meta->data_size); + break; + + case SIM_EF_USIM_CFIS: + if (file_meta->rec_count > SIM_CF_RECORD_CNT_MAX) + file_meta->rec_count = SIM_CF_RECORD_CNT_MAX; + file_meta->current_index++; + _get_file_record(o, ur, ef, file_meta->current_index, file_meta->rec_length); + break; + + case SIM_EF_OPL: + case SIM_EF_PNN: + case SIM_EF_USIM_MWIS: + case SIM_EF_USIM_MBI: + case SIM_EF_MBDN: + case SIM_EF_CPHS_MAILBOX_NUMBERS: + case SIM_EF_CPHS_INFORMATION_NUMBERS: + file_meta->current_index++; + _get_file_record(o, ur, ef, file_meta->current_index, file_meta->rec_length); + break; + + default: + 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) +{ + struct s_sim_property *file_meta = NULL; + file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL); + + dbg("[SIM]EF[0x%x] read rt[%d] Decode rt[%d]", file_meta->file_id, rt, decode_ret); + + switch (file_meta->file_id) { + case SIM_EF_ELP: + case SIM_EF_USIM_PL: + case SIM_EF_LP: + case SIM_EF_USIM_LI: + if (decode_ret == TRUE) { + if (file_meta->file_id == SIM_EF_LP || file_meta->file_id == SIM_EF_USIM_LI) { +/* po->language_file = SIM_EF_LP;*/ + } else if (file_meta->file_id == SIM_EF_ELP || file_meta->file_id == SIM_EF_USIM_PL) { +/* po->language_file = SIM_EF_ELP;*/ + } + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + } else { + /* 2G */ + /* The ME requests the Extended Language Preference. The ME only requests the Language Preference (EFLP) if at least one of the following conditions holds: + - EFELP is not available; + - EFELP does not contain an entry corresponding to a language specified in ISO 639[30]; + - the ME does not support any of the languages in EFELP. + */ + /* 3G */ + /* The ME only requests the Language Preference (EFPL) if at least one of the following conditions holds: + - if the EFLI has the value 'FFFF' in its highest priority position + - 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 (file_meta->file_id == SIM_EF_LP) + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + else + _get_file_info(o, ur, SIM_EF_LP); + } else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) { + if (file_meta->file_id == SIM_EF_LP || file_meta->file_id == SIM_EF_USIM_LI) + _get_file_info(o, ur, SIM_EF_ELP); + else + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + } + } + break; + + case SIM_EF_ECC: + if (tcore_sim_get_type(o) == SIM_TYPE_USIM) { + file_meta->files.data.ecc.ecc_count++; + if (file_meta->current_index == file_meta->rec_count) { + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + } else { + file_meta->current_index++; + _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length ); + } + } else if (tcore_sim_get_type(o) == SIM_TYPE_GSM) { + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + } else { + dbg("[SIM DATA]Invalid CardType[%d] Unable to handle", tcore_sim_get_type(o)); + } + break; + + case SIM_EF_IMSI: + _sim_status_update(o, SIM_STATUS_INIT_COMPLETED); + break; + + case SIM_EF_OPL: + file_meta->files.data.opl.opl_count++; + dbg("file_meta->files.data.opl.opl_count[%d], current index[%d], rec_cnt[%d]", + file_meta->files.data.opl.opl_count, file_meta->current_index,file_meta->rec_count); + if (file_meta->current_index == file_meta->rec_count) { + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + } else { + file_meta->current_index++; + _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length ); + } + break; + case SIM_EF_PNN: + file_meta->files.data.pnn.pnn_count++; + if (file_meta->current_index == file_meta->rec_count) { + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + } else { + file_meta->current_index++; + _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length ); + } + break; + case SIM_EF_USIM_CFIS: + case SIM_EF_USIM_MWIS: + case SIM_EF_USIM_MBI: + case SIM_EF_MBDN: + case SIM_EF_CPHS_MAILBOX_NUMBERS: + case SIM_EF_CPHS_INFORMATION_NUMBERS: + if (file_meta->current_index == file_meta->rec_count) { + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + } else { + file_meta->current_index++; + _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length ); + } + break; + + case SIM_EF_ICCID: + case SIM_EF_SST: + case SIM_EF_SPN: + case SIM_EF_SPDI: + case SIM_EF_CPHS_CPHS_INFO: + case SIM_EF_CPHS_CALL_FORWARD_FLAGS: + case SIM_EF_CPHS_VOICE_MSG_WAITING: + case SIM_EF_CPHS_OPERATOR_NAME_STRING: + case SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING: + case SIM_EF_CPHS_DYNAMICFLAGS: + case SIM_EF_CPHS_DYNAMIC2FLAG: + case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE: + case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE_LINE2: + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read), &file_meta->files); + break; + + default: + dbg("File id not handled [0x%x]", file_meta->file_id); + break; + } +} + +static void _sim_status_update(CoreObject *o, enum tel_sim_status sim_status) +{ + struct tnoti_sim_status noti_data = {0,}; + + dbg("tcore_sim_set_status and send noti w/ [%d]", sim_status); + tcore_sim_set_status(o, sim_status); + noti_data.sim_status = sim_status; + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SIM_STATUS, + sizeof(struct tnoti_sim_status), ¬i_data); +} + +static void on_confirmation_sim_message_send( TcorePending *p, gboolean result, void *user_data ) +{ + UserRequest* ur = NULL; + struct ATReqMetaInfo* metainfo = NULL; + unsigned int info_len =0; + struct s_sim_property *file_meta = NULL; + dbg("on_confirmation_sim_message_send - msg out from queue. alloc ATRsp buffer & write rspPrefix if needed\n"); + +//alloc new sp_response + ReleaseResponse(); //release leftover +//alloc new sp_response + + sp_response = at_response_new(); + + ur = tcore_pending_ref_user_request(p); + + dbg("********************************tcore_user_request_get_command[0x%x]", tcore_user_request_get_command(ur)); + + if(tcore_user_request_get_command(ur) == TREQ_CUSTOM) + { + file_meta = (struct s_sim_property *)tcore_user_request_ref_metainfo(ur,&info_len); + metainfo = &(file_meta->metainfo); + + dbg("file_meta->type[%d]", file_meta->metainfo.type); + dbg("metainfo->type[%d]", metainfo->type); + } + else + { + metainfo = (struct ATReqMetaInfo*)tcore_user_request_ref_metainfo(ur,&info_len); + } + + if((metainfo->type == SINGLELINE)|| + (metainfo->type == MULTILINE)) + { + //cp rsp prefix + s_responsePrefix = strdup(metainfo->responsePrefix); + dbg("duplicating responsePrefix : %s\n", s_responsePrefix); + } + else + { + s_responsePrefix = NULL; + } + + //set atcmd type into s_type + s_type = metainfo->type; + + if (result == FALSE) { + /* Fail */ + dbg("SEND FAIL"); + } + else { + dbg("SEND OK"); + } +} + +static void _response_get_sim_type(TcorePending *p, int data_len, const void *data, void *user_data) +{ + struct s_sim_property *sp = NULL; + CoreObject *co_sim = NULL; + enum tel_sim_type sim_type = SIM_TYPE_UNKNOWN; + char* line=NULL; + int ret = 0; + + if(sp_response->success > 0) + { + line = sp_response->p_intermediates->line; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,(int *)&sim_type); + if (ret < 0) + AT_TOK_ERROR(line); + } + else + { + sim_type = SIM_TYPE_UNKNOWN; + } + + dbg("resp sim type[%d]", sim_type); + + ReleaseResponse(); + + co_sim = tcore_pending_ref_core_object(p); + tcore_sim_set_type(co_sim, sim_type); + sp = tcore_sim_ref_userdata(co_sim); + _sim_status_update(co_sim, sp->first_recv_status); +} + +static void _response_get_file_info(TcorePending *p, int data_len, const void *data, void *user_data) +{ + CoreObject *co_sim = NULL; + UserRequest *ur = NULL; + struct s_sim_property *file_meta = NULL; + enum tel_sim_access_result rt; + + char *line = NULL; + int ret = 0; + int sw1 = 0; + int sw2 = 0; + //char *hexData; + //char *recordData; + + co_sim = tcore_pending_ref_core_object(p); + if(!co_sim){ + dbg("error - core object is null"); + return; + } + ur = tcore_pending_ref_user_request(p); + file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL); + + if(sp_response->success > 0) + { + line = sp_response->p_intermediates->line; + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&sw1); + if (ret < 0) + AT_TOK_ERROR(line); + ret = at_tok_nextint(&line,&sw2); + if (ret < 0) + AT_TOK_ERROR(line); + + /*1. SIM access success case*/ + if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) { + unsigned char tag_len = 0; /* 1 or 2 bytes ??? */ + unsigned short record_len = 0; + char num_of_records = 0; + unsigned char file_id_len = 0; + unsigned short file_id = 0; + unsigned short file_size = 0; + unsigned short file_type = 0; + unsigned short arr_file_id = 0; + int arr_file_id_rec_num = 0; + + /* handling only last 3 bits */ + unsigned char file_type_tag = 0x07; + unsigned char *ptr_data; + + char *hexData; + char *recordData; + ret = at_tok_nextstr(&line,&hexData); + if (ret < 0) + AT_TOK_ERROR(line); + + recordData = util_hexStringToBytes(hexData); + util_hex_dump(" ", strlen(hexData)/2, recordData); + + ptr_data = (unsigned char *)recordData; + if (tcore_sim_get_type(co_sim) == 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) + */ + + /* rsim.res_len has complete data length received */ + + /* FCP template tag - File Control Parameters tag*/ + if (*ptr_data == 0x62) { + /* parse complete FCP tag*/ + /* increment to next byte */ + ptr_data++; + tag_len = *ptr_data++; + /* 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); + + switch (file_type_tag) { + /* increment to next byte */ + ptr_data++; + case 0x1: + dbg("Getting FileType: [Transparent file type]"); + /* increment to next byte */ + ptr_data++; + file_type = SIM_FTYPE_TRANSPARENT; + /* data coding byte - value 21 */ + ptr_data++; + break; + + case 0x2: + dbg("Getting FileType: [Linear fixed file type]"); + /* increment to next byte */ + ptr_data++; + /* data coding byte - value 21 */ + ptr_data++; + /* 2bytes */ + memcpy(&record_len, ptr_data, 2); + /* swap bytes */ + SWAPBYTES16(record_len); + ptr_data = ptr_data + 2; + num_of_records = *ptr_data++; + /* Data lossy conversation from enum (int) to unsigned char */ + file_type = SIM_FTYPE_LINEAR_FIXED; + break; + + case 0x6: + dbg(" Cyclic fixed file type"); + /* increment to next byte */ + ptr_data++; + /* data coding byte - value 21 */ + ptr_data++; + /* 2bytes */ + memcpy(&record_len, ptr_data, 2); + /* swap bytes */ + SWAPBYTES16(record_len); + ptr_data = ptr_data + 2; + num_of_records = *ptr_data++; + file_type = SIM_FTYPE_CYCLIC; + break; + + default: + dbg("not handled file type [0x%x]", *ptr_data); + break; + } + } else { + dbg("INVALID FCP received - DEbug!"); + return; + } + + /*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 */ + SWAPBYTES16(file_id); + ptr_data = ptr_data + 2; + dbg("Getting FileID=[0x%x]", file_id); + } else { + dbg("INVALID FCP received - DEbug!"); + free(recordData); + ReleaseResponse(); + return; + } + + /* 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 { + dbg("INVALID FCP received - DEbug!"); + } + + /* 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 + */ + if (*ptr_data == 0x8A) { + /* increment to next byte */ + ptr_data++; + /* length - value 1 */ + ptr_data++; + + switch (*ptr_data) { + case 0x04: + case 0x06: + dbg(" operation state -deactivated"); + ptr_data++; + break; + case 0x05: + case 0x07: + dbg(" operation state -activated"); + ptr_data++; + break; + default: + dbg(" DEBUG! LIFE CYCLE STATUS =[0x%x]",*ptr_data); + ptr_data++; + break; + } + } + + /* related to security attributes : currently not handled*/ + 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 */ + SWAPBYTES16(arr_file_id); + ptr_data = ptr_data + 2; + arr_file_id_rec_num = *ptr_data++; + } 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); + } + } else { + dbg("INVALID FCP received[0x%x] - DEbug!", *ptr_data); + free(recordData); + ReleaseResponse(); + return; + } + + dbg("Current ptr_data value is [%x]", *ptr_data); + + /* file size excluding structural info*/ + if (*ptr_data == 0x80) { + /* 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 */ + SWAPBYTES16(file_size); + ptr_data = ptr_data + 2; + } else { + dbg("INVALID FCP received - DEbug!"); + free(recordData); + ReleaseResponse(); + return; + } + + /* total file size including structural info*/ + if (*ptr_data == 0x81) { + int len; + /* increment to next byte */ + ptr_data++; + /* length */ + len = *ptr_data; + /* ignored bytes */ + ptr_data = ptr_data + 3; + } else { + dbg("INVALID FCP received - DEbug!"); + /* 0x81 is optional tag?? check out! so do not return -1 from here! */ + /* return -1; */ + } + /*short file identifier ignored*/ + if (*ptr_data == 0x88) { + dbg("0x88: Do Nothing"); + /*DO NOTHING*/ + } + } else { + dbg("INVALID FCP received - DEbug!"); + free(recordData); + ReleaseResponse(); + return; + } + } else if (tcore_sim_get_type(co_sim) == SIM_TYPE_GSM) { + unsigned char gsm_specific_file_data_len = 0; + /* ignore RFU byte1 and byte2 */ + ptr_data++; + ptr_data++; + /* file size */ + //file_size = p_info->response_len; + memcpy(&file_size, ptr_data, 2); + /* swap bytes */ + SWAPBYTES16(file_size); + /* parsed file size */ + ptr_data = ptr_data + 2; + /* file id */ + memcpy(&file_id, ptr_data, 2); + 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 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 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) ? 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 = 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 */ + ptr_data++; + /* byte 13 - GSM specific data */ + gsm_specific_file_data_len = *ptr_data; + 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]", tcore_sim_get_type(co_sim)); + } + + dbg("req ef[0x%x] resp ef[0x%x] size[%ld] Type[0x%x] NumOfRecords[%ld] RecordLen[%ld]", + file_meta->file_id, file_id, file_size, file_type, num_of_records, record_len); + + file_meta->file_type = file_type; + file_meta->data_size = file_size; + file_meta->rec_length = record_len; + file_meta->rec_count = num_of_records; + file_meta->current_index = 0; //reset for new record type EF + rt = SIM_ACCESS_SUCCESS; + free(recordData); + } + else + { + /*2. SIM access fail case*/ + dbg("error to get ef[0x%x]", file_meta->file_id); + rt = _decode_status_word(sw1, sw2); + } + + ReleaseResponse(); + + ur = tcore_user_request_dup(ur); + _next_from_get_file_info(co_sim, ur, file_meta->file_id, rt); + } + else + { + ReleaseResponse(); + dbg("error to get ef[0x%x]", file_meta->file_id); + rt = SIM_ACCESS_FAILED;; + + ur = tcore_user_request_dup(ur); + _next_from_get_file_info(co_sim, ur, file_meta->file_id, rt); + } +} + +static void _response_get_file_data(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur = NULL; + CoreObject *co_sim = NULL; + enum tel_sim_access_result rt; + struct tel_sim_imsi imsi; + struct s_sim_property *file_meta = NULL; + gboolean dr = FALSE; + + char *line = NULL; + int ret = 0; + int sw1 = 0; + int sw2 = 0; + + dbg("[SIM_READ_BINARY] or [SIM_READ_RECORD]"); + + dbg("sizeof struct tresp_sim_read = [%d]", sizeof(struct tresp_sim_read)); + + co_sim = tcore_pending_ref_core_object(p); + if(!co_sim){ + dbg("error - core object is null"); + return; + } + ur = tcore_pending_ref_user_request(p); + file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL); + + if(sp_response->success > 0) + { + line = sp_response->p_intermediates->line; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&sw1); + if (ret < 0) + AT_TOK_ERROR(line); + ret = at_tok_nextint(&line,&sw2); + if (ret < 0) + AT_TOK_ERROR(line); + + if((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) { + char *hexStr; + char *fileData; + + ret = at_tok_nextstr(&line,&hexStr); + if (ret < 0) + AT_TOK_ERROR(line); + + fileData = util_hexStringToBytes(hexStr); + util_hex_dump(" ", strlen(hexStr)/2, fileData); + + rt = SIM_ACCESS_SUCCESS; + file_meta->files.result = rt; + + switch (file_meta->file_id) + { + case SIM_EF_IMSI: + dr = tcore_sim_decode_imsi(&imsi, (unsigned char *)fileData, strlen(fileData)); + if (dr == FALSE) { + dbg("imsi decoding failed"); + } else { + _sim_check_identity(co_sim,&imsi); + tcore_sim_set_imsi(co_sim,&imsi); + } + break; + + case SIM_EF_ICCID: + dr = tcore_sim_decode_iccid(&file_meta->files.data.iccid, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_ELP:/* 2G EF - 2 bytes decoding*/ + case SIM_EF_USIM_LI: /* 3G EF - 2 bytes decoding*/ + case SIM_EF_USIM_PL:/* 3G EF - same as EFELP, so 2 byte decoding*/ + case SIM_EF_LP:/* 1 byte encoding*/ + if (tcore_sim_get_type(co_sim) == SIM_TYPE_GSM && file_meta->file_id == SIM_EF_LP) { + /*2G LP(0x6F05) has 1 byte for each language*/ + dr = tcore_sim_decode_lp(&file_meta->files.data.language, (unsigned char *)fileData, strlen(fileData)); + } else { + /*3G LI(0x6F05)/PL(0x2F05), 2G ELP(0x2F05) has 2 bytes for each language*/ + dr = tcore_sim_decode_li(file_meta->file_id, &file_meta->files.data.language, (unsigned char *)fileData, strlen(fileData)); + } + break; + + case SIM_EF_SPN: + dr = tcore_sim_decode_spn(&file_meta->files.data.spn, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_SPDI: + dr = tcore_sim_decode_spdi(&file_meta->files.data.spdi, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_SST: +/* if(tcore_sim_get_type(o) == SIM_TYPE_GSM) + dr = tcore_sim_decode_sst(&file_meta->files.data , fileData, response_len); + else if(tcore_sim_get_type(o) == SIM_TYPE_USIM) + dr = tcore_sim_decode_ust(&po->st_u.ust, fileData, response_len); + else { + dbg("err not handled tcore_sim_get_type(o)[%d] in here",tcore_sim_get_type(o)); + }*/ + break; + + case SIM_EF_MBDN: +/* dr = tcore_sim_decode_xdn(&file_meta->files.data.mailbox, fileData, strlen(fileData));*/ + break; + + case SIM_EF_ECC: + if(tcore_sim_get_type(co_sim) == SIM_TYPE_GSM) { + dr = tcore_sim_decode_ecc(&file_meta->files.data.ecc, (unsigned char *)fileData, strlen(fileData)); + } else if(tcore_sim_get_type(co_sim) == SIM_TYPE_USIM){ + dr = tcore_sim_decode_uecc(&file_meta->files.data.ecc.ecc[file_meta->current_index-1], (unsigned char *)fileData, strlen(fileData)); + } else { + dbg("err not handled tcore_sim_get_type(o)[%d] in here",tcore_sim_get_type(co_sim)); + } + break; + + case SIM_EF_USIM_MBI: +/* dr = tcore_sim_decode_mbi(&po->mb_u.mailbox.mbi, fileData, strlen(fileData));*/ + break; + + case SIM_EF_OPL: + dr = tcore_sim_decode_opl(&file_meta->files.data.opl.opl[file_meta->current_index-1], (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_PNN: + dr = tcore_sim_decode_pnn(&file_meta->files.data.pnn.pnn[file_meta->current_index-1], (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_OPLMN_ACT: + dr = tcore_sim_decode_oplmnwact(&file_meta->files.data.opwa, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_CPHS_CALL_FORWARD_FLAGS: + dr = tcore_sim_decode_cff(&file_meta->files.data.cf, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE: +/* dr = tcore_sim_decode_csp(&po->p_cphs->csp, fileData, strlen(fileData));*/ + break; + + case SIM_EF_CPHS_VOICE_MSG_WAITING: + dr = tcore_sim_decode_vmwf(&file_meta->files.data.mw.mw_data_u.cphs_mw, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_CPHS_MAILBOX_NUMBERS: +/* dbg("[CPHS]decoding SIM_EF_CPHS_MAILBOX_NUMBERS"); + if (file_meta->current_index == 1) + dr = tcore_sim_decode_xdn(&po->mb_u.mbn.voice_line1, fileData, strlen(fileData)); + else if (file_meta->current_index == 2) + dr = tcore_sim_decode_xdn(&po->mb_u.mbn.voice_line2, fileData, strlen(fileData)); + else if (file_meta->current_index == 3) + dr = tcore_sim_decode_xdn(&po->mb_u.mbn.video, fileData, strlen(fileData)); + else if (file_meta->current_index == 4) + dr = tcore_sim_decode_xdn(&po->mb_u.mbn.fax, fileData, strlen(fileData)); + else { + dbg("[CPHS]wrong EF record index[%d] in here", file_meta->current_index); + }*/ + break; + + case SIM_EF_USIM_MWIS: + dr = tcore_sim_decode_mwis(&file_meta->files.data.mw.mw_data_u.mw, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_USIM_CFIS: + dr = tcore_sim_decode_cfis(&file_meta->files.data.cf, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_CPHS_SERVICE_STRING_TABLE: + dbg(" not handled -SIM_EF_CPHS_SERVICE_STRING_TABLE "); + break; + + case SIM_EF_CPHS_OPERATOR_NAME_STRING: + dr = tcore_sim_decode_ons(&file_meta->files.data.cphs_f_name, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_CPHS_DYNAMICFLAGS: +/* dr = tcore_sim_decode_dynamic_flag(&po->p_cphs->dflagsinfo, fileData, strlen(fileData));*/ + break; + + case SIM_EF_CPHS_DYNAMIC2FLAG: +/* dr = tcore_sim_decode_dynamic2_flag(&po->p_cphs->d2flagsinfo, fileData, strlen(fileData));*/ + break; + + case SIM_EF_CPHS_CPHS_INFO: + dr = tcore_sim_decode_cphs_info(&file_meta->files.data.cphs, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING: + dr = tcore_sim_decode_short_ons(&file_meta->files.data.cphs_s_name, (unsigned char *)fileData, strlen(fileData)); + break; + + case SIM_EF_CPHS_INFORMATION_NUMBERS: +/* dr = tcore_sim_decode_information_number(&po->p_cphs->infn, fileData, strlen(fileData));*/ + break; + + default: + dbg("File Decoding Failed - not handled File[0x%x]", file_meta->file_id); + dr = 0; + break; + } + + free(fileData); + } + else + { + rt = _decode_status_word(sw1, sw2); + file_meta->files.result = rt; + } + + ReleaseResponse(); + } + else + { + ReleaseResponse(); + rt = SIM_ACCESS_FAILED;; + file_meta->files.result = rt; + } + + ur = tcore_user_request_dup(ur); + _next_from_get_file_data(tcore_pending_ref_core_object(p), ur, rt, dr); +} + +static gboolean _get_sim_type(CoreObject *o) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + UserRequest *ur = NULL; + + if (!o) + return FALSE; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"%SCCT:",strlen("%SCCT:")); + info_len = sizeof(struct ATReqMetaInfo); + + ur = tcore_user_request_new(NULL, NULL); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CPIN=[,] + cmd_str = g_strdup("AT%SCCT\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, _response_get_sim_type, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + + free(cmd_str); + + return TRUE; +} + +static TReturn _get_file_info(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + //size_t size = 0; + struct s_sim_property file_meta={0,}; + TReturn trt = 0; + + char *cmd_str = NULL; + int info_len =0; + + if (!o) + return TCORE_RETURN_EINVAL; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + file_meta.file_id = ef; + file_meta.metainfo.type = SINGLELINE; + memcpy(file_meta.metainfo.responsePrefix,"+CRSM:",strlen("+CRSM:")); + info_len = sizeof(struct s_sim_property); + + tcore_user_request_set_command(ur, TREQ_CUSTOM); + + trt = tcore_user_request_set_metainfo(ur, sizeof(struct s_sim_property), &file_meta); + dbg("trt[%d]",trt); + + // AT+CRSM=,,, + cmd_str = g_strdup_printf("AT+CRSM=192, %d%s", ef, "\r"); + + dbg("new pending(IPC_SEC_RSIM_ACCESS GET - SELECT EF[0x%x])",ef); + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, _response_get_file_info, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + free(cmd_str); + + return TCORE_RETURN_SUCCESS; +} + +static gboolean _get_file_data(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef, const int offset, const int length) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + //size_t size = 0; + + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + int p1; + int p2; + int p3; + + if (!o) + return FALSE; + + dbg("new pending(IPC_SEC_RSIM_ACCESS GET - READ BIN)"); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + +// offset for reading the TRANSPARENT data + p1 = (unsigned char)(offset & 0xFF00) >> 8; + p2 = (unsigned char)offset & 0x00FF; //offset low + p3 = (unsigned char)length; + dbg("EF[0x%x]", ef); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"+CRSM:",strlen("+CRSM:")); + info_len = sizeof(struct ATReqMetaInfo); + + // AT+CRSM=,,, + cmd_str = g_strdup_printf("AT+CRSM=176, %d%s", ef, "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, _response_get_file_data, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + free(cmd_str); + return TRUE; +} + +static gboolean _get_file_record(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef, const int index, const int length) +{ + dbg("need to be implemented to use ATCMD"); + + return TRUE; +} + +static void on_event_pin_status(CoreObject *o, const void *event_info, void *user_data) +{ + UserRequest *ur; + char *line = (char *) event_info; + //struct tnoti_sim_status noti_data; + struct s_sim_property *sp = NULL; + enum tel_sim_status sim_status = SIM_STATUS_INITIALIZING; + enum s_sim_sec_locktype_e locktype = SEC_LOCK_TYPE_NONE; + enum s_sim_sec_lockkey_e lockkey = SEC_LOCK_KEY_NONE; + + dbg("PIN_STATUS NOTI : %s", line); + + _convert_SCPIN_noti(line,&locktype, &lockkey); + + sp = tcore_sim_ref_userdata(o); + + + switch (locktype) { + case SEC_LOCK_TYPE_READY: + if (lockkey == SEC_LOCK_KEY_UNLOCKED) { + sim_status = SIM_STATUS_INITIALIZING; + dbg(" Inside PIN disabled at BOOT UP"); + } + else { + dbg(" not handled case p_status->lock_key[%d]", lockkey); + } + break; + + case SEC_LOCK_TYPE_PS: + sim_status = SIM_STATUS_LOCK_REQUIRED; + dbg( " SIM LOCK required"); + break; + + case SEC_LOCK_TYPE_PF: + sim_status = SIM_STATUS_CARD_ERROR; + dbg( "PF required "); + break; + + case SEC_LOCK_TYPE_SC: + switch (lockkey) { + case SEC_LOCK_KEY_UNLOCKED: + break; + case SEC_LOCK_KEY_PIN: + sim_status = SIM_STATUS_PIN_REQUIRED; + dbg( " PIN1 required"); + break; + case SEC_LOCK_KEY_PUK: + sim_status = SIM_STATUS_PUK_REQUIRED; + dbg( " PUK required"); + break; + case SEC_LOCK_KEY_PERM_BLOCKED: + sim_status = SIM_STATUS_CARD_BLOCKED; + dbg( " Card permanently blocked"); + break; + default: + dbg(" SEC_SIM_LOCK_SC -not handled SEC Lock key "); + break; + } + break; + + case SEC_LOCK_TYPE_FD: + dbg(" SEC_LOCK_TYPE_FD -not handled Notification"); + break; + + case SEC_LOCK_TYPE_PN: + switch (lockkey) { + case SEC_LOCK_KEY_PIN: + dbg(" ADMIN-NCK required"); + sim_status = SIM_STATUS_NCK_REQUIRED; + break; + default: + dbg(" SIM_LOCK_PN/PU/PP/PC -not handled SEC Lock key =[%d]", + lockkey); + break; + } + break; + + case SEC_LOCK_TYPE_PU: + dbg("Lock Personalization p_status->lock_key =[%d]", lockkey); + switch (lockkey) { + case SEC_LOCK_KEY_PIN: + dbg(" ADMIN-NSCK required"); + sim_status = SIM_STATUS_NSCK_REQUIRED; + break; + default: + dbg(" SIM_LOCK_PN/PU/PP/PC -not handled SEC Lock key =[%d]", + lockkey); + break; + } + break; + + case SEC_LOCK_TYPE_PP: + switch (lockkey) { + dbg("Lock Personalization p_status->lock_key =[%d]", lockkey); + case SEC_LOCK_KEY_PIN: + dbg(" ADMIN-SPCK required"); + sim_status = SIM_STATUS_SPCK_REQUIRED; + break; + default: + dbg(" SIM_LOCK_PN/PU/PP/PC -not handled SEC Lock key =[%d]", + lockkey); + break; + } + break; + + case SEC_LOCK_TYPE_PC: + switch (lockkey) { + dbg("Lock Personalization p_status->lock_key =[%d]", lockkey); + case SEC_LOCK_KEY_PIN: + dbg(" ADMIN-CCK required"); + sim_status = SIM_STATUS_CCK_REQUIRED; + break; + default: + dbg(" SIM_LOCK_PN/PU/PP/PC -not handled SEC Lock key =[%d]", + lockkey); + break; + } + break; + + case SEC_LOCK_TYPE_SC2: + dbg("SEC_LOCK_TYPE_SC2: NOT Handled - Debug"); + break; + + case SEC_LOCL_TYPE_PUK2: + dbg("SEC_LOCL_TYPE_PUK2: NOT Handled - Debug"); + break; + + case SEC_LOCK_TYPE_NO_SIM: + sim_status = SIM_STATUS_CARD_NOT_PRESENT; + dbg( "NO SIM"); + break; + + case SEC_LOCK_TYPE_UNAVAIL: + case SEC_SIM_INIT_CRASH: //SMC Lab requirement + sim_status = SIM_STATUS_CARD_ERROR; + dbg( "SIM unavailable"); + break; + + case SEC_SIM_INIT_COMPLETED: + dbg( "[SIM DATA] MODEM SIM INIT COMPLETED"); + sim_status = SIM_STATUS_INIT_COMPLETED; + break; + + case SEC_PB_INIT_COMPLETED: + dbg("[SIM DATA] MODEM SIM PB INIT COMPLETED. not handled here! s_phonebook should handle!"); + return; + break; + + default: + dbg(" not handled SEC lock type "); + break; + } + + dbg("[SIM]Current co->sim_status[%d] and from modem[0x%x]",tcore_sim_get_status(o), sim_status); + + switch (sim_status) { + case SIM_STATUS_INIT_COMPLETED: + ur = tcore_user_request_new(NULL, NULL); //this is for using ur metainfo set/ref functionality. + _get_file_info(o, ur, SIM_EF_IMSI); + break; + + case SIM_STATUS_INITIALIZING: + case SIM_STATUS_PIN_REQUIRED: + case SIM_STATUS_PUK_REQUIRED: + case SIM_STATUS_CARD_BLOCKED: + case SIM_STATUS_NCK_REQUIRED: + case SIM_STATUS_NSCK_REQUIRED: + case SIM_STATUS_SPCK_REQUIRED: + case SIM_STATUS_CCK_REQUIRED: + case SIM_STATUS_LOCK_REQUIRED: + if( sp->first_recv_status == SIM_STATUS_UNKNOWN ) { + dbg("first received sim status[%d]",sim_status); + sp->first_recv_status = sim_status; + _get_sim_type(o); + } + break; + + case SIM_STATUS_CARD_REMOVED: + case SIM_STATUS_CARD_NOT_PRESENT: + case SIM_STATUS_CARD_ERROR: + if (sim_status == SIM_STATUS_CARD_NOT_PRESENT && tcore_sim_get_status(o) != SIM_STATUS_UNKNOWN) { + dbg("[SIM]SIM CARD REMOVED!!"); + sim_status = SIM_STATUS_CARD_REMOVED; + } + _sim_status_update(o,sim_status); + break; + + default: + dbg("not handled status[%d]", sim_status); + break; + } + +} + +static void on_response_verify_pins(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur = NULL; + CoreObject *co_sim = NULL; + struct s_sim_property *sp = NULL; + struct tresp_sim_verify_pins resp = {0,}; + + char* line=NULL; + int ret; + int error; + + co_sim = tcore_pending_ref_core_object(p); + sp = tcore_sim_ref_userdata(co_sim); + + ur = tcore_pending_ref_user_request(p); + if(!ur) + dbg("error - current ur is NULL"); + + printResponse(); + + if(sp_response->success > 0) + { + ReleaseResponse(); + + resp.result = SIM_PIN_OPERATION_SUCCESS; + resp.pin_type = _sim_get_current_pin_facility(sp); + tcore_user_request_send_response(ur, TRESP_SIM_VERIFY_PINS, sizeof(struct tresp_sim_verify_pins), &resp); + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + ReleaseResponse(); + + // ur = user_request_dup(ur); + // _get_retry_count(co_sim, ur); + + resp.result = SIM_INCORRECT_PASSWORD; + resp.pin_type = _sim_get_current_pin_facility(sp); + resp.retry_count = 3; + tcore_user_request_send_response(ur, TRESP_SIM_VERIFY_PINS, sizeof(struct tresp_sim_verify_pins), &resp); + + } +} + +static void on_response_verify_puks(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur = NULL; + CoreObject *co_sim = NULL; + struct s_sim_property *sp = NULL; + struct tresp_sim_verify_puks resp = {0,}; + + char* line=NULL; + int ret; + int error; + + co_sim = tcore_pending_ref_core_object(p); + sp = tcore_sim_ref_userdata(co_sim); + + ur = tcore_pending_ref_user_request(p); + if(!ur) + dbg("error - current ur is NULL"); + + printResponse(); + + if(sp_response->success > 0) + { + ReleaseResponse(); + + resp.result = SIM_PIN_OPERATION_SUCCESS; + resp.pin_type = _sim_get_current_pin_facility(sp); + tcore_user_request_send_response(ur, TRESP_SIM_VERIFY_PINS, sizeof(struct tresp_sim_verify_pins), &resp); + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + ReleaseResponse(); + + // ur = user_request_dup(ur); + // _get_retry_count(co_sim, ur); + + resp.result = SIM_INCORRECT_PASSWORD; + resp.pin_type = _sim_get_current_pin_facility(sp); + tcore_user_request_send_response(ur, TRESP_SIM_VERIFY_PUKS, sizeof(struct tresp_sim_verify_puks), &resp); + + } +} + +static void on_response_change_pins(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur = NULL; + CoreObject *co_sim = NULL; + struct s_sim_property *sp = NULL; + struct tresp_sim_change_pins resp = {0,}; + + char* line=NULL; + int ret; + int error; + + co_sim = tcore_pending_ref_core_object(p); + sp = tcore_sim_ref_userdata(co_sim); + + ur = tcore_pending_ref_user_request(p); + if(!ur) + dbg("error - current ur is NULL"); + + printResponse(); + + if(sp_response->success > 0) + { + ReleaseResponse(); + + resp.result = SIM_PIN_OPERATION_SUCCESS; + resp.pin_type = _sim_get_current_pin_facility(sp); + tcore_user_request_send_response(ur, TRESP_SIM_VERIFY_PINS, sizeof(struct tresp_sim_verify_pins), &resp); + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + ReleaseResponse(); + + // ur = user_request_dup(ur); + // _get_retry_count(co_sim, ur); + + resp.result = SIM_INCORRECT_PASSWORD; + resp.pin_type = _sim_get_current_pin_facility(sp); + tcore_user_request_send_response(ur, TRESP_SIM_CHANGE_PINS, sizeof(struct tresp_sim_change_pins), &resp); + } +} + +static void on_response_get_facility_status(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur = NULL; + CoreObject *co_sim = NULL; + struct s_sim_property *sec_meta = NULL; + struct tresp_sim_get_facility_status resp = {0,}; + + char *line = NULL; + int ret; + + co_sim = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + sec_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL); + + resp.result = SIM_PIN_OPERATION_SUCCESS; + resp.type = _sim_get_current_pin_facility(sec_meta); + + printResponse(); + + if(sp_response->success > 0) + { + line = sp_response->p_intermediates->line; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,(int *)&resp.b_enable); + if (ret < 0) + AT_TOK_ERROR(line); + } + else + { + resp.result = SIM_INCOMPATIBLE_PIN_OPERATION; + } + + ReleaseResponse(); + + if (ur) { + tcore_user_request_send_response(ur, TRESP_SIM_GET_FACILITY_STATUS, + sizeof(struct tresp_sim_get_facility_status), &resp); + } +} + +static void on_response_enable_facility(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur = NULL; + CoreObject *co_sim = NULL; + struct s_sim_property *sec_meta = NULL; + struct tresp_sim_enable_facility resp = {0,}; + struct s_sim_property *sp = NULL; + + char *line = NULL; + int ret; + + co_sim = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + sp = tcore_sim_ref_userdata(co_sim); + sec_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL); + + resp.result = SIM_PIN_OPERATION_SUCCESS; + resp.type = _sim_get_current_pin_facility(sec_meta); + + printResponse(); + + if(sp_response->success > 0) + { + line = sp_response->p_intermediates->line; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,(int *)&resp.result); + if (ret < 0) + AT_TOK_ERROR(line); + } + else + { + resp.result = SIM_INCOMPATIBLE_PIN_OPERATION; + } + + ReleaseResponse(); + + if (ur) { + resp.type = _sim_get_current_pin_facility(sp); + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_enable_facility), &resp); + } +} + +static void on_response_disable_facility(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur = NULL; + CoreObject *co_sim = NULL; + struct s_sim_property *sec_meta = NULL; + struct tresp_sim_disable_facility resp = {0,}; + struct s_sim_property *sp = NULL; + + char *line = NULL; + int ret; + + co_sim = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + sp = tcore_sim_ref_userdata(co_sim); + sec_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL); + + resp.result = SIM_PIN_OPERATION_SUCCESS; + resp.type = _sim_get_current_pin_facility(sec_meta); + + printResponse(); + + if(sp_response->success > 0) + { + line = sp_response->p_intermediates->line; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,(int *)&resp.result); + if (ret < 0) + AT_TOK_ERROR(line); + } + else + { + resp.result = SIM_INCOMPATIBLE_PIN_OPERATION; + } + + ReleaseResponse(); + + if (ur) { + resp.type = _sim_get_current_pin_facility(sp); + tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_disable_facility), &resp); + } +} + +static TReturn s_verify_pins(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + + struct s_sim_property *sp = NULL; + const struct treq_sim_verify_pins *req_data; + + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + req_data = tcore_user_request_ref_data(ur, NULL); + sp = tcore_sim_ref_userdata(o); + + if (req_data->pin_type == SIM_PTYPE_PIN1) { + sp->current_sec_op = SEC_PIN1_VERIFY; + } + else if (req_data->pin_type == SIM_PTYPE_PIN2) { + sp->current_sec_op = SEC_PIN2_VERIFY; + } + else if (req_data->pin_type == SIM_PTYPE_SIM) { + sp->current_sec_op = SEC_SIM_VERIFY; + } + else if (req_data->pin_type == SIM_PTYPE_ADM) { + sp->current_sec_op = SEC_ADM_VERIFY; + } + else { + return TCORE_RETURN_EINVAL; + } + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CPIN=[,] + cmd_str = g_strdup_printf("AT+CPIN=\"%s\"%s", req_data->pin, "\r"); + dbg("new pending(verify - pins), %s", cmd_str); + + pending = tcore_pending_new(o,ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_response_callback(pending, on_response_verify_pins, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + + free(cmd_str); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_verify_puks(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + + const struct treq_sim_verify_puks *req_data; + struct s_sim_property *sp = NULL; + + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + req_data = tcore_user_request_ref_data(ur, NULL); + sp = tcore_sim_ref_userdata(o); + + + if(req_data->puk_type == SIM_PTYPE_PUK1){ + sp->current_sec_op = SEC_PUK1_VERIFY; + } + else if(req_data->puk_type == SIM_PTYPE_PUK2){ + sp->current_sec_op = SEC_PUK2_VERIFY; + } + else { + return TCORE_RETURN_EINVAL; + } + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CPIN=[,] + cmd_str = g_strdup_printf("AT+CPIN=\"%s\", \"%s\"%s", req_data->puk, req_data->pin, "\r"); + + dbg("new pending(IPC_SEC_PIN_STATUS SET - verify puks)"); + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_response_callback(pending, on_response_verify_puks, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + + free(cmd_str); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_change_pins(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + + const struct treq_sim_change_pins *req_data; + struct s_sim_property *sp = NULL; + + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + req_data = tcore_user_request_ref_data(ur, NULL); + sp = tcore_sim_ref_userdata(o); + + if(req_data->type == SIM_PTYPE_PIN1) { + sp->current_sec_op = SEC_PIN1_CHANGE; + } + else if(req_data->type == SIM_PTYPE_PIN2) { + sp->current_sec_op = SEC_PIN2_CHANGE; + } + else { + return TCORE_RETURN_EINVAL; + } + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CPIN=[,] + cmd_str = g_strdup_printf("AT+CPIN=\"%s\", \"%s\"%s", req_data->old_pin, req_data->new_pin, "\r"); + + dbg("new pending(IPC_SEC_CHANGE_LOCKING_PW SET)"); + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_response_callback(pending, on_response_change_pins, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + + free(cmd_str); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_get_facility_status(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + struct s_sim_property sec_meta = {0,}; + TReturn trt = 0; + + const struct treq_sim_get_facility_status *req_data; + char *fac = "SC"; + int mode = 2; // 2:query, 0: unlock, 1:lock + + char *cmd_str = NULL; +// struct ATReqMetaInfo metainfo; + int info_len =0; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + req_data = tcore_user_request_ref_data(ur, NULL); + + if(req_data->type == SIM_FACILITY_PS) + fac = "PS"; + else if(req_data->type == SIM_FACILITY_SC) + fac = "SC"; + else if(req_data->type == SIM_FACILITY_FD) + fac = "FD"; + else if(req_data->type == SIM_FACILITY_PN) + fac = "PN"; + else if(req_data->type == SIM_FACILITY_PU) + fac = "PU"; + else if(req_data->type == SIM_FACILITY_PP) + fac = "PP"; + else if(req_data->type == SIM_FACILITY_PC) + fac = "PC"; + else + return TCORE_RETURN_EINVAL; + + sec_meta.current_sec_op = req_data->type; + sec_meta.metainfo.type = SINGLELINE; + memcpy(sec_meta.metainfo.responsePrefix,"+CLCK:",strlen("+CLCK:")); + info_len = sizeof(struct s_sim_property); + tcore_user_request_set_command(ur, TREQ_CUSTOM); + trt = tcore_user_request_set_metainfo(ur, sizeof(struct s_sim_property), &sec_meta); + dbg("trt[%d]",trt); + + // AT+CLCK=,, + cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d%s", fac, mode, "\r"); + + dbg("new pending(IPC_SEC_PHONE_LOCK GET)"); + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_response_callback(pending, on_response_get_facility_status, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + + free(cmd_str); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_enable_facility(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + struct s_sim_property sec_meta = {0,}; + const struct treq_sim_enable_facility *req_data; + struct s_sim_property *sp = NULL; + char *fac = "SC"; + int mode = 1; // 2:query, 0: unlock, 1:lock + + char *cmd_str = NULL; +// struct ATReqMetaInfo metainfo; + int info_len =0; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + req_data = tcore_user_request_ref_data(ur, NULL); + sp = tcore_sim_ref_userdata(o); + + if (req_data->type == SIM_FACILITY_PS) + fac = "PS"; + else if (req_data->type == SIM_FACILITY_SC) + fac = "SC"; + else if (req_data->type == SIM_FACILITY_FD) + fac = "FD"; + else if (req_data->type == SIM_FACILITY_PN) + fac = "PN"; + else if (req_data->type == SIM_FACILITY_PU) + fac = "PU"; + else if (req_data->type == SIM_FACILITY_PP) + fac = "PP"; + else if (req_data->type == SIM_FACILITY_PC) + fac = "PC"; + else + return TCORE_RETURN_EINVAL; + + sp->current_sec_op = SEC_SIM_ENABLE; + + sec_meta.current_sec_op = req_data->type; + sec_meta.metainfo.type = SINGLELINE; + memcpy(sec_meta.metainfo.responsePrefix,"+CLCK:",strlen("+CLCK:")); + info_len = sizeof(struct s_sim_property); + tcore_user_request_set_command(ur, TREQ_CUSTOM); + tcore_user_request_set_metainfo(ur, sizeof(struct s_sim_property), &sec_meta); + + // AT+CLCK=,, + cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d, %s%s", fac, mode, req_data->password,"\r"); + dbg("new pending(enable_facility), %s", cmd_str); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_response_callback(pending, on_response_enable_facility, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + + free(cmd_str); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_disable_facility(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + struct s_sim_property sec_meta = {0,}; + const struct treq_sim_enable_facility *req_data; + struct s_sim_property *sp = NULL; + char *fac = "SC"; + int mode = 0; // 2:query, 0: unlock, 1:lock + + char *cmd_str = NULL; +// struct ATReqMetaInfo metainfo; + int info_len =0; + + if (!o || !ur) + return TCORE_RETURN_EINVAL; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + req_data = tcore_user_request_ref_data(ur, NULL); + sp = tcore_sim_ref_userdata(o); + + if (req_data->type == SIM_FACILITY_PS) + fac = "PS"; + else if (req_data->type == SIM_FACILITY_SC) + fac = "SC"; + else if (req_data->type == SIM_FACILITY_FD) + fac = "FD"; + else if (req_data->type == SIM_FACILITY_PN) + fac = "PN"; + else if (req_data->type == SIM_FACILITY_PU) + fac = "PU"; + else if (req_data->type == SIM_FACILITY_PP) + fac = "PP"; + else if (req_data->type == SIM_FACILITY_PC) + fac = "PC"; + else + return TCORE_RETURN_EINVAL; + + sp->current_sec_op = SEC_SIM_ENABLE; + + sec_meta.current_sec_op = req_data->type; + sec_meta.metainfo.type = SINGLELINE; + memcpy(sec_meta.metainfo.responsePrefix,"+CLCK:",strlen("+CLCK:")); + info_len = sizeof(struct s_sim_property); + tcore_user_request_set_command(ur, TREQ_CUSTOM); + tcore_user_request_set_metainfo(ur, sizeof(struct s_sim_property), &sec_meta); + + // AT+CLCK=,, + cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d, %s%s", fac, mode, req_data->password,"\r"); + dbg("new pending(enable_facility), %s", cmd_str); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + tcore_pending_set_response_callback(pending, on_response_disable_facility, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL); + + tcore_hal_send_request(h, pending); + + free(cmd_str); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_read_file(CoreObject *o, UserRequest *ur) +{ + TReturn api_ret = TCORE_RETURN_SUCCESS; + enum tcore_request_command command; + command = tcore_user_request_get_command(ur); + + dbg("enter"); + + switch (command) { + case TREQ_SIM_GET_ECC: + api_ret = _get_file_info(o, ur, SIM_EF_ECC); + break; + + case TREQ_SIM_GET_LANGUAGE: + if (tcore_sim_get_type(o) == SIM_TYPE_GSM) + api_ret = _get_file_info(o, ur, SIM_EF_ELP); + else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) + api_ret = _get_file_info(o, ur, SIM_EF_LP); + else + api_ret = TCORE_RETURN_ENOSYS; + break; + + case TREQ_SIM_GET_ICCID: + api_ret = _get_file_info(o, ur, SIM_EF_ICCID); + break; + + case TREQ_SIM_GET_MAILBOX: + if(tcore_sim_get_cphs_status(o)) + api_ret = _get_file_info(o, ur, SIM_EF_CPHS_MAILBOX_NUMBERS); + else + api_ret = _get_file_info(o, ur, SIM_EF_MBDN); + break; + + case TREQ_SIM_GET_CALLFORWARDING: + if(tcore_sim_get_cphs_status(o)) + api_ret = _get_file_info(o, ur, SIM_EF_CPHS_CALL_FORWARD_FLAGS); + else + api_ret = _get_file_info(o, ur, SIM_EF_USIM_CFIS); + break; + + case TREQ_SIM_GET_MESSAGEWAITING: + if(tcore_sim_get_cphs_status(o)) + api_ret = _get_file_info(o, ur, SIM_EF_CPHS_VOICE_MSG_WAITING); + else + api_ret = _get_file_info(o, ur, SIM_EF_USIM_MWIS); + break; + + case TREQ_SIM_GET_CPHS_INFO: + if(tcore_sim_get_cphs_status(o)) + api_ret = _get_file_info(o, ur, SIM_EF_CPHS_CPHS_INFO); + else + api_ret = TCORE_RETURN_ENOSYS; + break; + + case TREQ_SIM_GET_MSISDN: + api_ret = _get_file_info(o, ur, SIM_EF_MSISDN); + break; + + case TREQ_SIM_GET_SPN: + dbg("enter case SPN"); + api_ret = _get_file_info(o, ur, SIM_EF_SPN); + break; + + case TREQ_SIM_GET_SPDI: + api_ret = _get_file_info(o, ur, SIM_EF_SPDI); + break; + + case TREQ_SIM_GET_OPL: + api_ret = _get_file_info(o, ur, SIM_EF_OPL); + break; + + case TREQ_SIM_GET_PNN: + api_ret = _get_file_info(o, ur, SIM_EF_PNN); + break; + + case TREQ_SIM_GET_CPHS_SHORTNETNAME: + if(tcore_sim_get_cphs_status(o)) + api_ret = _get_file_info(o, ur, SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING); + else + api_ret = TCORE_RETURN_ENOSYS; + break; + + case TREQ_SIM_GET_CPHS_FULLNETNAME: + if(tcore_sim_get_cphs_status(o)) + api_ret = _get_file_info(o, ur, SIM_EF_CPHS_OPERATOR_NAME_STRING); + else + api_ret = TCORE_RETURN_ENOSYS; + break; + + case TREQ_SIM_GET_OPLMNWACT: + api_ret = _get_file_info(o, ur, SIM_EF_OPLMN_ACT); + break; + + default: + dbg("error - not handled read treq command[%d]", command); + api_ret = TCORE_RETURN_EINVAL; + break; + } + return api_ret; +} + +static TReturn s_update_file(CoreObject *o, UserRequest *ur) +{ + TReturn api_ret = TCORE_RETURN_ENOSYS; + return api_ret; +} + +static TReturn s_transmit_apdu(CoreObject *o, UserRequest *ur) +{ + dbg("need to be implemented to use ATCMD"); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_get_atr(CoreObject *o, UserRequest *ur) +{ + dbg("need to be implemented to use ATCMD"); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_req_authentication(CoreObject *o, UserRequest *ur) +{ + return TCORE_RETURN_SUCCESS; +} + +static struct tcore_sim_operations sim_ops = +{ + .verify_pins = s_verify_pins, + .verify_puks = s_verify_puks, + .change_pins = s_change_pins, + .get_facility_status = s_get_facility_status, + .enable_facility = s_enable_facility, + .disable_facility = s_disable_facility, + .read_file = s_read_file, + .update_file = s_update_file, + .transmit_apdu = s_transmit_apdu, + .get_atr = s_get_atr, + .req_authentication = s_req_authentication +}; + +gboolean s_sim_init(TcorePlugin *p) +{ + CoreObject *o; + struct s_sim_property *sp = NULL; + + o = tcore_sim_new(p, "sim", &sim_ops); + if (!o) + return FALSE; + + sp = calloc(sizeof(struct s_sim_property),1); + if (!sp) + return FALSE; + + sp->first_recv_status = SIM_STATUS_UNKNOWN; + tcore_sim_link_userdata(o, sp); + + tcore_object_add_callback(o, EVENT_SIM_PIN_STATUS, on_event_pin_status, NULL); + return TRUE; +} + + +void s_sim_exit(TcorePlugin *p) +{ + CoreObject *o; + + o = tcore_plugin_ref_core_object(p, "sim"); + if (!o) + return; + tcore_sim_free(o); +} diff --git a/src/s_sms.c b/src/s_sms.c new file mode 100644 index 0000000..834eba1 --- /dev/null +++ b/src/s_sms.c @@ -0,0 +1,1924 @@ +/* + * tel-plugin-samsung-atmodem + * + * 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 +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "s_common.h" +#include "s_sms.h" + +#include "atchannel.h" +#include "at_tok.h" + +#define MAX_GSM_SMS_TPDU_SIZE 244 +#define MAX_GSM_SMS_PARAM_RECORD_SIZE 156 /* Maximum number of bytes SMSP Record size (Y + 28), y : 0 ~ 128 */ +#define SWAPBYTES16(x) \ +{ \ + unsigned short int data = *(unsigned short int*)&(x); \ + data = ((data & 0xff00) >> 8) | \ + ((data & 0x00ff) << 8); \ + *(unsigned short int*)&(x) = data ; \ +} + +extern struct ATResponse *sp_response; +extern char *s_responsePrefix; +extern enum ATCommandType s_type; + +static TReturn Send_SmsSubmitTpdu(CoreObject *o, UserRequest *ur); + +/************************************************************/ +/********************* Utility for SMS *************************/ +/************************************************************/ +static void util_sms_get_length_of_sca(int* nScLength) { + if (*nScLength % 2) { + *nScLength = (*nScLength / 2) + 1; + } else { + *nScLength = *nScLength / 2; + } + + return; +} + +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; + int nOffset = 0; + + dbg(" RecordLen = %d", length); + + if(incoming == NULL || params == NULL) + return FALSE; + + alpha_id_len = length -SMS_SMSP_PARAMS_MAX_LEN; + + if ( alpha_id_len > 0 ) + { + if(alpha_id_len > SMS_SMSP_ALPHA_ID_LEN_MAX) + { + alpha_id_len = SMS_SMSP_ALPHA_ID_LEN_MAX; + } + + for( i=0 ; i < alpha_id_len ; i++) + { + if( 0xff == incoming[i]) + { + dbg(" found"); + break; + } + } + + memcpy(params->szAlphaId, incoming, i); + + params->alphaIdLen = i; + + dbg(" Alpha id length = %d", i); + + } + else + { + params->alphaIdLen = 0; + dbg(" Alpha id length is zero"); + } + + // start parse from here. + params->paramIndicator = incoming[alpha_id_len]; + + dbg(" Param Indicator = %02x", params->paramIndicator); + + // DestAddr + if( (params->paramIndicator & SMSPValidDestAddr) == 0) + { + nOffset = nDestAddrOffset; + + if( 0x00 == incoming[alpha_id_len + nOffset] || 0xff == incoming[alpha_id_len + nOffset]) + { + params->tpDestAddr.dialNumLen = 0; + + dbg("DestAddr Length is 0"); + } + else + { + if ( 0 < (int)incoming[alpha_id_len + nOffset] ) + { + params->tpDestAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1 ); + + if(params->tpDestAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN) + params->tpDestAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN; + } + else + { + params->tpDestAddr.dialNumLen = 0; + } + + params->tpDestAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ; + params->tpDestAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70 )>>4 ; + + memcpy( params->tpDestAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)], (params->tpDestAddr.dialNumLen)) ; + + dbg("Dest TON is %d",params->tpDestAddr.typeOfNum); + dbg("Dest NPI is %d",params->tpDestAddr.numPlanId); + dbg("Dest Length = %d",params->tpDestAddr.dialNumLen); + dbg("Dest Addr = %s",params->tpDestAddr.diallingNum); + + } + } + + // SvcAddr + if( (params->paramIndicator & SMSPValidSvcAddr) == 0) + { + nOffset = nSCAAddrOffset; + + if( 0x00 == (int)incoming[alpha_id_len + nOffset] || 0xff == (int)incoming[alpha_id_len + nOffset] ) + { + params->tpSvcCntrAddr.dialNumLen = 0; + + dbg(" SCAddr Length is 0"); + } + else + { + if ( 0 < (int)incoming[alpha_id_len + nOffset] ) + { + params->tpSvcCntrAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1); + + if(params->tpSvcCntrAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN) + params->tpSvcCntrAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN; + + params->tpSvcCntrAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ; + params->tpSvcCntrAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70) >>4 ; + + memcpy( params->tpSvcCntrAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)], (params->tpSvcCntrAddr.dialNumLen)); + + dbg("SCAddr Length = %d ",params->tpSvcCntrAddr.dialNumLen); + dbg("SCAddr TON is %d",params->tpSvcCntrAddr.typeOfNum); + dbg("SCAddr NPI is %d",params->tpSvcCntrAddr.numPlanId); + + for( i = 0 ; i < (int)params->tpSvcCntrAddr.dialNumLen ; i ++) + dbg("SCAddr = %d [%02x]",i,params->tpSvcCntrAddr.diallingNum[i]); + } + else + { + params->tpSvcCntrAddr.dialNumLen = 0; + } + } + } + else if ( (0x00 < (int)incoming[alpha_id_len +nSCAAddrOffset] && (int)incoming[alpha_id_len +nSCAAddrOffset] <= 12 ) + || 0xff != (int)incoming[alpha_id_len +nSCAAddrOffset]) + { + nOffset = nSCAAddrOffset; + + if( 0x00 == (int)incoming[alpha_id_len + nOffset] || 0xff == (int)incoming[alpha_id_len + nOffset] ) + { + params->tpSvcCntrAddr.dialNumLen = 0; + dbg("SCAddr Length is 0"); + } + else + { + + if ( 0 < (int)incoming[alpha_id_len + nOffset] ) + { + params->tpSvcCntrAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1); + + params->tpSvcCntrAddr.dialNumLen = incoming[alpha_id_len + nOffset] -1; + + if(params->tpSvcCntrAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN) + params->tpSvcCntrAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN; + + params->tpSvcCntrAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ; + params->tpSvcCntrAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70) >>4 ; + + memcpy( params->tpSvcCntrAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)], + (params->tpSvcCntrAddr.dialNumLen)) ; + + dbg("SCAddr Length = %d ",params->tpSvcCntrAddr.dialNumLen); + dbg("SCAddr TON is %d",params->tpSvcCntrAddr.typeOfNum); + dbg("SCAddr NPI is %d",params->tpSvcCntrAddr.numPlanId); + + for( i = 0 ; i < (int)params->tpSvcCntrAddr.dialNumLen ; i ++) + dbg("SCAddr = %d [%02x]",i,params->tpSvcCntrAddr.diallingNum[i]); + } + else + { + params->tpSvcCntrAddr.dialNumLen = 0; + } + } + + } + + if( (params->paramIndicator & SMSPValidPID) == 0 && (alpha_id_len + nPIDOffset) < 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) + { + params->tpDataCodingScheme = incoming[alpha_id_len + nDCSOffset]; + } + 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++) + { + dbg(" Alpha Id = [%d] [%c]",i,params->szAlphaId[i]); + } + dbg(" PID = %d",params->tpProtocolId); + dbg(" DCS = %d",params->tpDataCodingScheme); + dbg(" VP = %d",params->tpValidityPeriod); + + return TRUE; +} + +static int util_sms_ipcError2SmsError(int err) +{ + int returnStatus=0; + + switch(err) + { + case 300: //ME Failure; + returnStatus = SMS_PHONE_FAILURE; + break; + case 302: //Operation not allowed; + case 303: //Operation not supported; + returnStatus = SMS_OPERATION_NOT_SUPPORTED; + break; + case 304: //Invalid PDU mode parameter; + case 305: //Invalid text mode parameter; + returnStatus = SMS_INVALID_PARAMETER_FORMAT; + break; + case 320: //memory failure; + case 321: //invalid memory index; + case 322: //memory full; + returnStatus = SMS_MEMORY_FAILURE; + break; + case 330: //SCA unknown; + case 500: //Unknown error; + default: + returnStatus = SMS_UNKNOWN; + break; + } + + return returnStatus; +} + +/************************************************************/ +/************************ Events Cb *************************/ +/************************************************************/ + +static void on_event_sms_incom_msg(CoreObject *o, const void *event_info, void *user_data) +{ + struct smsDeliveryPDU *smsPdu = (struct smsDeliveryPDU *)event_info; + struct property_sms_info *property; + struct tnoti_sms_umts_msg gsmMsgInfo; + + int ScLength = 0, i = 0; + unsigned char LastSemiOctect; + + memset(&gsmMsgInfo, 0, sizeof(struct tnoti_sms_umts_msg)); + // +CMT: + ScLength = smsPdu->pdu[0]; + + dbg(" ScLength is %d",ScLength); + + LastSemiOctect = smsPdu->pdu[ScLength + 1] & 0xf0; + if( LastSemiOctect == 0xf0 ) + { + smsPdu->pdu[0] = (ScLength-1)*2 - 1; + } + else + { + smsPdu->pdu[0] = (ScLength-1)*2; + } + + gsmMsgInfo.msgInfo.msgLength = smsPdu->len - ScLength; + dbg(" MSG LENGTH [%d]", gsmMsgInfo.msgInfo.msgLength); + + if ( (gsmMsgInfo.msgInfo.msgLength >0) && (0xff >= gsmMsgInfo.msgInfo.msgLength)) + { + property = tcore_plugin_ref_property(tcore_object_ref_plugin(o), "SMS"); + if(!property) { + dbg("property is NULL"); + return; + } + + memcpy(gsmMsgInfo.msgInfo.sca, &smsPdu->pdu[0], (ScLength+1)); + + for(i=0;i<(ScLength+1);i++) + { + dbg("SCA is [%02x] ",gsmMsgInfo.msgInfo.sca[i]); + } + + if(gsmMsgInfo.msgInfo.msgLength > SMS_SMDATA_SIZE_MAX) + { + gsmMsgInfo.msgInfo.msgLength = SMS_SMDATA_SIZE_MAX; + } + + memcpy(gsmMsgInfo.msgInfo.tpduData, &smsPdu->pdu[ScLength +1], gsmMsgInfo.msgInfo.msgLength); + + tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_INCOM_MSG, sizeof(struct tnoti_sms_umts_msg), &gsmMsgInfo); + + } + else + { + dbg("Invalid Message Length"); + } + + return; +} + +static void on_event_sms_device_ready(CoreObject *o, const void *event_info, void *user_data) +{ + struct tnoti_sms_device_ready_status deviceStatusInfo = {0,}; + struct property_sms_info *property = NULL; + + int rtn = -1; + + dbg(" Func Entrance"); + + property = tcore_plugin_ref_property(tcore_object_ref_plugin(o), "SMS"); + if(!property) { + dbg("property is NULL"); + return; + } + + property->bDevice_Ready = 1; // TRUE + deviceStatusInfo.status = 1; + + dbg("bDevice_Ready = [0x%02x]", property->bDevice_Ready); + + rtn = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_DEVICE_READY, sizeof(struct tnoti_sms_device_ready_status), &deviceStatusInfo); + + dbg(" Return value [%d]",rtn); + + return; +} + +/*************************************************************/ +/*********************** Responses Cb ************************/ +/************************************************************/ +static void on_confirmation_sms_message_send( TcorePending *p, gboolean result, void *user_data ) +{ + UserRequest* ur = NULL; + struct ATReqMetaInfo* metainfo = NULL; + unsigned int info_len =0; + dbg("on_confirmation_call_message_send - msg out from queue. alloc ATRsp buffer & write rspPrefix if needed\n"); + + ReleaseResponse(); //release leftover + + sp_response = at_response_new(); + + ur = tcore_pending_ref_user_request(p); + metainfo = (struct ATReqMetaInfo*)tcore_user_request_ref_metainfo(ur,&info_len); + + if((metainfo->type == SINGLELINE)|| + (metainfo->type == MULTILINE)) + { + //cp rsp prefix + s_responsePrefix = strdup(metainfo->responsePrefix); + dbg("duplicating responsePrefix : %s\n", s_responsePrefix); + } + else + { + s_responsePrefix = NULL; + } + + //set atcmd type into s_type + s_type = metainfo->type; + + if (result == FALSE) { + /* Fail */ + dbg("SEND FAIL"); + } + else { + dbg("SEND OK"); + } +} + +static void on_response_send_umts_msg(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_sms_send_umts_msg respSendMsg; + + int error; + char *line = NULL; + int ret; + + memset(&respSendMsg, 0, sizeof(struct tresp_sms_send_umts_msg)); + ur = tcore_pending_ref_user_request(p); + if (!ur) + { + dbg("no user_request"); + return; + } + + printResponse(); + + if(sp_response->success == TRUE) + { + ReleaseResponse(); + ur = tcore_user_request_dup(ur); + ret = (int) Send_SmsSubmitTpdu(tcore_pending_ref_core_object(p), ur); + + if(ret != (int)TCORE_RETURN_SUCCESS) + { + respSendMsg.result = SMS_INVALID_PARAMETER; + tcore_user_request_send_response(ur, TRESP_SMS_SEND_UMTS_MSG, sizeof(struct tresp_sms_send_umts_msg), &respSendMsg); + } + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + respSendMsg.result = util_sms_ipcError2SmsError(error); + + tcore_user_request_send_response(ur, TRESP_SMS_SEND_UMTS_MSG, sizeof(struct tresp_sms_send_umts_msg), &respSendMsg); + } + + return; +} + +static void on_response_send_smsSubmitTpdu(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur = NULL; + struct tresp_sms_send_umts_msg respUmtsInfo; + + char *line = NULL; + char *ackpdu = NULL; + int ret; + int mr; + int error; + char *hexData; + + char cSCA = '\0'; + + printResponse(); + + if(sp_response->success > 0) + { + line = sp_response->p_intermediates->line; + + memset(&respUmtsInfo, 0 , sizeof(struct tresp_sms_send_umts_msg)); + // +CMGS: [, ] + // SMS_SMDATA_SIZE_MAX + 1 + ret = at_tok_start(&line); + if (ret < 0) + AT_NOTI_TOK_ERROR(line); + + ret = at_tok_nextint(&line, &mr); + if (ret < 0) + return; + + ret = at_tok_nextstr(&line, &hexData); + if (ret < 0) + { + dbg(" ackpdu is NULL "); + } + + ackpdu = util_hexStringToBytes(hexData); + util_hex_dump(" ", strlen(hexData)/2, ackpdu); + + dbg(" Func Entrance "); + + ur = tcore_pending_ref_user_request(p); + if(ur) + { + memcpy(respUmtsInfo.dataInfo.sca, &cSCA, sizeof(char)); + + respUmtsInfo.dataInfo.msgLength = strlen(ackpdu); + + if ( (respUmtsInfo.dataInfo.msgLength >= 0) && (0xff >= respUmtsInfo.dataInfo.msgLength)) + { + if(respUmtsInfo.dataInfo.msgLength > SMS_SMDATA_SIZE_MAX) + { + respUmtsInfo.dataInfo.msgLength = SMS_SMDATA_SIZE_MAX; + } + + memcpy(respUmtsInfo.dataInfo.tpduData, ackpdu, respUmtsInfo.dataInfo.msgLength); + + dbg(" MR : %d", mr); + dbg(" msg length : %d", respUmtsInfo.dataInfo.msgLength); + dbg(" TRESP_SMS_SEND_UMTS_MSG : 0x%x", TRESP_SMS_SEND_UMTS_MSG); + + respUmtsInfo.result = SMS_SENDSMS_SUCCESS; + + tcore_user_request_send_response(ur, TRESP_SMS_SEND_UMTS_MSG, sizeof(struct tresp_sms_send_umts_msg), &respUmtsInfo); + + } + else + { + respUmtsInfo.result = SMS_INVALID_PARAMETER_FORMAT; + + tcore_user_request_send_response(ur, TRESP_SMS_SEND_UMTS_MSG, sizeof(struct tresp_sms_send_umts_msg), &respUmtsInfo); + + } + } + else + { + dbg("no user_request"); + } + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + + //5. release sp_response & s_responsePrefix - before sending user callback, because user callback can request additional request + // and if queue is empty, that req can be directly sent to mdm - can cause sp_response, s_responsePrefix dangling + ReleaseResponse(); + + ur = tcore_pending_ref_user_request(p); + if (ur) { + struct tresp_sms_send_umts_msg respSendMsg; + + memset(&respSendMsg, 0, sizeof(struct tresp_sms_send_umts_msg)); + respSendMsg.result = SMS_INVALID_MANDATORY_INFO; + + respSendMsg.result = util_sms_ipcError2SmsError(error); + + tcore_user_request_send_response(ur, TRESP_SMS_SEND_UMTS_MSG, sizeof(struct tresp_sms_send_umts_msg), &respSendMsg); + } + else { + dbg("no user_request"); + } + } +} + +static void on_response_get_storedMsgCnt(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_sms_get_storedMsgCnt respStoredMsgCnt; + + int error; + char *line = NULL; + int ret; + int usedCount = 0; + int totalCount = 0; + + memset(&respStoredMsgCnt, 0, sizeof(struct tresp_sms_get_storedMsgCnt)); + ur = tcore_pending_ref_user_request(p); + if (!ur) + { + dbg("no user_request"); + return; + } + + printResponse(); + + if(sp_response->success > 0) + { + //failure case - consider this later + line = sp_response->p_intermediates->line; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&usedCount); + if (ret < 0) + AT_TOK_ERROR(line); + ret = at_tok_nextint(&line,&totalCount); + if (ret < 0) + AT_TOK_ERROR(line) + + respStoredMsgCnt.storedMsgCnt.totalCount = totalCount; + respStoredMsgCnt.storedMsgCnt.usedCount = usedCount; + + dbg(" totalCount:%d, usedCount:%d",respStoredMsgCnt.storedMsgCnt.totalCount , respStoredMsgCnt.storedMsgCnt.usedCount ); + + respStoredMsgCnt.result = SMS_SUCCESS; + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + respStoredMsgCnt.result = util_sms_ipcError2SmsError(error); + } + + ReleaseResponse(); + + + tcore_user_request_send_response(ur, TRESP_SMS_GET_STORED_MSG_COUNT, sizeof(struct tresp_sms_get_storedMsgCnt), &respStoredMsgCnt); + + return; + +} + +static void on_response_get_sca(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_sms_get_sca respGetSca; + + char* line=NULL; + int ret = 0; + char *scaStr = NULL; + int scaType = 0; + int error; + + ur = tcore_pending_ref_user_request(p); + if (!ur) + { + dbg("no user_request"); + return; + } + + printResponse(); + + // +CSCA: , + if(sp_response->success > 0) + { + respGetSca.result = SMS_SUCCESS; + + line = sp_response->p_intermediates->line; + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextstr(&line, &scaStr); + if (ret < 0) + AT_TOK_ERROR(line); + memcpy(respGetSca.scaAddress.diallingNum, scaStr, strlen(scaStr)); + + + line = sp_response->p_intermediates->line; + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextstr(&line,&scaStr); + if(scaStr!=NULL) + ret = at_tok_nextint(&line,&scaType); + + respGetSca.scaAddress.dialNumLen = strlen(scaStr); + if(scaType == 145) + respGetSca.scaAddress.typeOfNum = SIM_TON_INTERNATIONAL; + else respGetSca.scaAddress.typeOfNum = SIM_TON_NATIONAL; + respGetSca.scaAddress.numPlanId = 0; + + memcpy(respGetSca.scaAddress.diallingNum, scaStr, strlen(scaStr)); + + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + respGetSca.result = util_sms_ipcError2SmsError(error); + + } + + ReleaseResponse(); + + tcore_user_request_send_response(ur, TRESP_SMS_GET_SCA, sizeof(struct tresp_sms_get_sca), &respGetSca); + + return; +} + +static void on_response_set_sca(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_sms_set_sca respSetSca; + int ret; + int error; + char *line = NULL; + + ur = tcore_pending_ref_user_request(p); + if (!ur) + { + dbg("no user_request"); + return; + } + + printResponse(); + + if(sp_response->success > 0) + { + respSetSca.result = SMS_SUCCESS; + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + respSetSca.result = util_sms_ipcError2SmsError(error); + } + + ReleaseResponse(); + + tcore_user_request_send_response(ur, TRESP_SMS_SET_SCA, sizeof(struct tresp_sms_get_sca), &respSetSca); + + return; +} + +static void on_response_set_delivery_report(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_sms_set_delivery_report respSetDeliveryReport = {0,}; + + int error; + char *line = NULL; + int ret; + + ur = tcore_pending_ref_user_request(p); + if (!ur) + { + dbg("no user_request"); + return; + } + + printResponse(); + + if(sp_response->success > 0) + { + respSetDeliveryReport.result = SMS_SUCCESS; + } + else + { + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + respSetDeliveryReport.result = util_sms_ipcError2SmsError(error); + } + + ReleaseResponse(); + + + tcore_user_request_send_response(ur, TRESP_SMS_SET_DELIVERY_REPORT, sizeof(struct tresp_sms_set_delivery_report), &respSetDeliveryReport); + + return; +} + +static void on_response_get_sms_params(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_sms_get_params respGetSmsParams; + struct property_sms_info *property = NULL; + + char *line = NULL; + int error; + int ret = 0; + int sw1 = 0; + int sw2 = 0; + char *recordData; + + memset(&respGetSmsParams, 0, sizeof(struct tresp_sms_get_params)); + printResponse(); + + + ur = tcore_pending_ref_user_request(p); + if (!ur) + { + dbg("no user_request"); + return; + } + + if(sp_response->success > 0) + { + line = sp_response->p_intermediates->line; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&sw1); + if (ret < 0) + AT_TOK_ERROR(line); + ret = at_tok_nextint(&line,&sw2); + if (ret < 0) + AT_TOK_ERROR(line); + + if(sw1 != 144 || sw2 != 0) + respGetSmsParams.result = SMS_UNKNOWN; + else + { + char *hexData; + + ret = at_tok_nextstr(&line,&hexData); + if (ret < 0) + AT_TOK_ERROR(line); + + recordData = util_hexStringToBytes(hexData); + util_hex_dump(" ", strlen(hexData)/2, recordData); + + // respGetSmsParams.paramsInfo.recordIndex = 0; + respGetSmsParams.paramsInfo.recordLen = strlen(hexData)/2; + + property = tcore_plugin_ref_property(tcore_object_ref_plugin(tcore_pending_ref_core_object(p)), "SMS"); + + if(!property) { + dbg("property is NULL"); + free(recordData); + return; + } + + util_sms_decode_smsParameters((unsigned char *)recordData, strlen(hexData)/2, &respGetSmsParams.paramsInfo); + property->SMSPRecordLen = respGetSmsParams.paramsInfo.recordLen; + + respGetSmsParams.result = SMS_SUCCESS; + + free(recordData); + } + } + else + { + respGetSmsParams.result = SMS_UNKNOWN; + //failure case - consider this later + line = sp_response->finalResponse; + + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&error); + if (ret < 0) + AT_TOK_ERROR(line); + + respGetSmsParams.result = util_sms_ipcError2SmsError(error); + } + + ReleaseResponse(); + + tcore_user_request_send_response(ur, TRESP_SMS_GET_PARAMS, sizeof(struct tresp_sms_get_params), &respGetSmsParams); + + return; +} + +static void on_response_get_paramcnt(TcorePending *p, int data_len, const void *data, void *user_data) +{ + UserRequest *ur; + struct tresp_sms_get_paramcnt respGetParamCnt = {0,}; + CoreObject *co_sim = NULL; + char *line = NULL; + int ret = 0; + int sw1 = 0; + int sw2 = 0; + + ur = tcore_pending_ref_user_request(p); + + if(sp_response->success == TRUE) + { + line = sp_response->p_intermediates->line; + ret = at_tok_start(&line); + if (ret < 0) + AT_TOK_ERROR(line); + + ret = at_tok_nextint(&line,&sw1); + if (ret < 0) + AT_TOK_ERROR(line); + ret = at_tok_nextint(&line,&sw2); + if (ret < 0) + AT_TOK_ERROR(line); + + /*1. SIM access success case*/ + if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) { + unsigned char tag_len = 0; /* 1 or 2 bytes ??? */ + unsigned short record_len = 0; + char num_of_records = 0; + unsigned char file_id_len = 0; + unsigned short file_id = 0; + unsigned short file_size = 0; + unsigned short file_type = 0; + unsigned short arr_file_id = 0; + int arr_file_id_rec_num = 0; + + /* handling only last 3 bits */ + unsigned char file_type_tag = 0x07; + unsigned char *ptr_data; + + char *hexData; + char *recordData; + ret = at_tok_nextstr(&line,&hexData); + if (ret < 0) + AT_TOK_ERROR(line); + + recordData = util_hexStringToBytes(hexData); + util_hex_dump(" ", strlen(hexData)/2, recordData); + + ptr_data = (unsigned char *)recordData; + + co_sim = tcore_plugin_ref_core_object(tcore_pending_ref_plugin(p), "sim"); + if (tcore_sim_get_type(co_sim) == 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) + */ + + /* rsim.res_len has complete data length received */ + + /* FCP template tag - File Control Parameters tag*/ + if (*ptr_data == 0x62) { + /* parse complete FCP tag*/ + /* increment to next byte */ + ptr_data++; + tag_len = *ptr_data++; + /* 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); + + switch (file_type_tag) { + /* increment to next byte */ + ptr_data++; + case 0x1: + dbg("Getting FileType: [Transparent file type]"); + /* increment to next byte */ + ptr_data++; + file_type = 0x01; //SIM_FTYPE_TRANSPARENT + /* data coding byte - value 21 */ + ptr_data++; + break; + + case 0x2: + dbg("Getting FileType: [Linear fixed file type]"); + /* increment to next byte */ + ptr_data++; + /* data coding byte - value 21 */ + ptr_data++; + /* 2bytes */ + memcpy(&record_len, ptr_data, 2); + /* swap bytes */ + 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; + + case 0x6: + dbg(" Cyclic fixed file type"); + /* increment to next byte */ + ptr_data++; + /* data coding byte - value 21 */ + ptr_data++; + /* 2bytes */ + memcpy(&record_len, ptr_data, 2); + /* swap bytes */ + SWAPBYTES16(record_len); + ptr_data = ptr_data + 2; + num_of_records = *ptr_data++; + file_type = 0x04; //SIM_FTYPE_CYCLIC + break; + + default: + dbg("not handled file type [0x%x]", *ptr_data); + break; + } + } else { + dbg("INVALID FCP received - DEbug!"); + return; + } + + /*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 */ + SWAPBYTES16(file_id); + ptr_data = ptr_data + 2; + dbg("Getting FileID=[0x%x]", file_id); + } else { + dbg("INVALID FCP received - DEbug!"); + free(recordData); + ReleaseResponse(); + return; + } + + /* 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 { + dbg("INVALID FCP received - DEbug!"); + } + + /* 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 + */ + if (*ptr_data == 0x8A) { + /* increment to next byte */ + ptr_data++; + /* length - value 1 */ + ptr_data++; + + switch (*ptr_data) { + case 0x04: + case 0x06: + dbg(" operation state -deactivated"); + ptr_data++; + break; + case 0x05: + case 0x07: + dbg(" operation state -activated"); + ptr_data++; + break; + default: + dbg(" DEBUG! LIFE CYCLE STATUS =[0x%x]",*ptr_data); + ptr_data++; + break; + } + } + + /* related to security attributes : currently not handled*/ + 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 */ + SWAPBYTES16(arr_file_id); + ptr_data = ptr_data + 2; + arr_file_id_rec_num = *ptr_data++; + } 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); + } + } else { + dbg("INVALID FCP received[0x%x] - DEbug!", *ptr_data); + free(recordData); + ReleaseResponse(); + return; + } + + dbg("Current ptr_data value is [%x]", *ptr_data); + + /* file size excluding structural info*/ + if (*ptr_data == 0x80) { + /* 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 */ + SWAPBYTES16(file_size); + ptr_data = ptr_data + 2; + } else { + dbg("INVALID FCP received - DEbug!"); + free(recordData); + ReleaseResponse(); + return; + } + + /* total file size including structural info*/ + if (*ptr_data == 0x81) { + int len; + /* increment to next byte */ + ptr_data++; + /* length */ + len = *ptr_data; + /* ignored bytes */ + ptr_data = ptr_data + 3; + } else { + dbg("INVALID FCP received - DEbug!"); + /* 0x81 is optional tag?? check out! so do not return -1 from here! */ + /* return -1; */ + } + /*short file identifier ignored*/ + if (*ptr_data == 0x88) { + dbg("0x88: Do Nothing"); + /*DO NOTHING*/ + } + } else { + dbg("INVALID FCP received - DEbug!"); + free(recordData); + ReleaseResponse(); + return; + } + } + else if (tcore_sim_get_type(co_sim) == SIM_TYPE_GSM) + { + unsigned char gsm_specific_file_data_len = 0; + /* ignore RFU byte1 and byte2 */ + ptr_data++; + ptr_data++; + /* file size */ + //file_size = p_info->response_len; + memcpy(&file_size, ptr_data, 2); + /* swap bytes */ + SWAPBYTES16(file_size); + /* parsed file size */ + ptr_data = ptr_data + 2; + /* file id */ + memcpy(&file_id, ptr_data, 2); + 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 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 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 */ + ptr_data++; + /* byte 13 - GSM specific data */ + gsm_specific_file_data_len = *ptr_data; + 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]", tcore_sim_get_type(co_sim)); + } + + 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; + + free(recordData); + } + else + { + /*2. SIM access fail case*/ + dbg("SIM access fail"); + respGetParamCnt.result = SMS_UNKNOWN; + } + } + else + { + dbg("response error!!!"); + respGetParamCnt.result = SMS_UNKNOWN; + } + + ReleaseResponse(); + + tcore_user_request_send_response(ur, TRESP_SMS_GET_PARAMCNT, sizeof(struct tresp_sms_get_paramcnt), &respGetParamCnt); + + return; + +} + +/********************************************************/ +/*********************** Requests ************************/ +/********************************************************/ +static TReturn send_umts_msg(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_sms_send_umts_msg *sendUmtsMsg = NULL; + GQueue *queue = NULL; + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + dbg("new pending(IPC_SMS_SEND_MSG)"); + + sendUmtsMsg = tcore_user_request_ref_data(ur, NULL); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + if (!sendUmtsMsg || !h) + return TCORE_RETURN_ENOSYS; + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CMMS= + cmd_str = g_strdup_printf("AT+CMMS=%d%s", sendUmtsMsg->more, "\r"); + dbg("[tcore_SMS] *************************MsgLen[%d]", sendUmtsMsg->msgDataPackage.msgLength); + + queue = tcore_object_ref_user_data(o); + if (queue) + util_add_waiting_job(queue, ID_RESERVED_AT, ur); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_send_umts_msg, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + + free(cmd_str); + + return tcore_hal_send_request(h, pending); +} + +static TReturn Send_SmsSubmitTpdu(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_sms_send_umts_msg *sendUmtsMsg = NULL; + GQueue *queue = NULL; + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + char tpdu[MAX_GSM_SMS_TPDU_SIZE]; + int ScLength = 0; + char *hexString = NULL; + int tpduDataLen = 0; + int i = 0; + + TReturn api_err = TCORE_RETURN_SUCCESS; + + dbg("new pending(IPC_SMS_SEND_MSG)"); + + sendUmtsMsg = tcore_user_request_ref_data(ur, NULL); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + if (!sendUmtsMsg || !h) + return TCORE_RETURN_ENOSYS; + + /* Populate data */ + dbg("[tcore_SMS] MoreToSend[0x%x](1:Persist, 2:NotPersist) MsgLen[%d]",sendUmtsMsg->more, sendUmtsMsg->msgDataPackage.msgLength); + for(i=0; imsgDataPackage.msgLength; i++) + dbg("[%02x]", sendUmtsMsg->msgDataPackage.tpduData[i]); + + if ((sendUmtsMsg->msgDataPackage.msgLength > 0) && (MAX_GSM_SMS_TPDU_SIZE > sendUmtsMsg->msgDataPackage.msgLength)) + { + if (sendUmtsMsg->msgDataPackage.msgLength < SMS_SMDATA_SIZE_MAX) + { + memset(tpdu, 0, sizeof(MAX_GSM_SMS_TPDU_SIZE)); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"+CMGS:",strlen("+CMGS:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + ScLength = sendUmtsMsg->msgDataPackage.sca[0]; + if(sendUmtsMsg->msgDataPackage.sca[0] == 0) + { + memcpy(&tpdu[0], sendUmtsMsg->msgDataPackage.sca, ScLength+2); + } + else + { + dbg("SC length in ipc tx is %d - before", ScLength); + + util_sms_get_length_of_sca(&ScLength); + + dbg(" SC length in ipc tx is %d - after", ScLength); + + tpdu[0] = ScLength +1 ; + //1Copy SCA to the ipc stream first + memcpy(&(tpdu[1]), &( sendUmtsMsg->msgDataPackage.sca[1]), (ScLength + 1)); + } + + if ((ScLength <= SMS_MAX_SMS_SERVICE_CENTER_ADDR) && (sendUmtsMsg->msgDataPackage.msgLength < SMS_SMDATA_SIZE_MAX)) + { + //1Copy rest of the SMS-SUBMIT TPDU + memcpy(&(tpdu[ScLength + 2]), sendUmtsMsg->msgDataPackage.tpduData, sendUmtsMsg->msgDataPackage.msgLength); + } else + { + dbg("SCA len is %d", ScLength); + api_err = TCORE_RETURN_SMS_INVALID_DATA_LEN; + return api_err; + } + + tpduDataLen = sendUmtsMsg->msgDataPackage.msgLength + (ScLength + 2); + hexString = calloc(tpduDataLen*2, 1);; + + for( i=0; i> 4; + if(value < 0xA) + hexString[i] = ((tpdu[i/2] & 0xf0 ) >> 4) + '0'; + else hexString[i] = ((tpdu[i/2] & 0xf0 ) >> 4) + 'A' -10; + + value = tpdu[i/2] & 0x0f; + if(value < 0xA) + hexString[i+1] = (tpdu[i/2] & 0x0f ) + '0'; + else hexString[i+1] = (tpdu[i/2] & 0x0f ) + 'A' -10; + + } + + // AT+CMGS=pdu_is_given + cmd_str = g_strdup_printf("AT+CMGS=%d%s%s%x%s", sendUmtsMsg->msgDataPackage.msgLength, "\r", hexString, 0x1A,"\r"); + dbg("cmd_str is %s", cmd_str); + + queue = tcore_object_ref_user_data(o); + if (queue) + util_add_waiting_job(queue, ID_RESERVED_AT, ur); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_send_smsSubmitTpdu, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + + api_err = tcore_hal_send_request(h, pending); + + free(cmd_str); + free(hexString); + } + else + { + dbg("[tcore_SMS] TPDU size[%d] is over !!!, max is [%d]", sendUmtsMsg->msgDataPackage.msgLength, SMS_SMDATA_SIZE_MAX); + api_err = TCORE_RETURN_SMS_INVALID_DATA_LEN; + return api_err; + } + } + else + { + dbg("[tcore_SMS] Invalid Data Length"); + api_err = TCORE_RETURN_SMS_INVALID_DATA_LEN; + } + + return api_err; + +} + +static TReturn send_cdma_msg(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS;} + +static TReturn read_msg(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn save_msg(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn delete_msg(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn get_storedMsgCnt(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_sms_get_msg_count *getStoredMsgCnt = NULL; + + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + dbg("new pending(IPC_SMS_GET_STORED_MSG_COUNT)"); + + getStoredMsgCnt = tcore_user_request_ref_data(ur, NULL); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + if (!h) + { + dbg("[ERR] tcore_plugin_ref_hal() pointer is NULL"); + return TCORE_RETURN_ENOSYS; + } + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"+CPMS:",strlen("+CPMS:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CPMS=[,[,]] + // Possible response(s) : +CPMS: ,,,,, + cmd_str = g_strdup_printf("AT+CPMS=\"SM\"%s", "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_get_storedMsgCnt, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + + free(cmd_str); + + return tcore_hal_send_request(h, pending); + +} + +static TReturn get_sca(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_sms_get_sca *getSca = NULL; + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + dbg("new pending(IPC_SMS_GET_SCA)"); + + getSca = tcore_user_request_ref_data(ur, NULL); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + if (!getSca || !h) + return TCORE_RETURN_ENOSYS; + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"+CSCA:",strlen("+CSCA:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT +CSCA? + // Possible response(s) : +CSCA: , + cmd_str = g_strdup_printf("AT +CSCA?%s", "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_get_sca, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + + free(cmd_str); + + return tcore_hal_send_request(h, pending); + +} + +static TReturn set_sca(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_sms_set_sca *setSca; + int scaType = 0; + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + dbg("new pending(IPC_SMS_SET_SCA)"); + + setSca = tcore_user_request_ref_data(ur, NULL); + + if(setSca->index != 0){ + dbg("Index except 0 is supported"); + return TCORE_RETURN_EINVAL; // TCORE_API_NOT_SUPPORTED; + } + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + if (!setSca || !h) + return TCORE_RETURN_ENOSYS; + + if(setSca->scaInfo.typeOfNum == SIM_TON_INTERNATIONAL) + scaType = 145; + else scaType = 129; + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT +CSCA=[,] + // 129:Unknown numbering plan, national/international number unknown, 145:international number + cmd_str = g_strdup_printf("AT+CSCA=\"%s\", %d%s", setSca->scaInfo.diallingNum, scaType, "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_set_sca, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + + free(cmd_str); + + return tcore_hal_send_request(h, pending); + +} + +static TReturn get_cb_config(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn set_cb_config(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn set_mem_status(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn get_pref_brearer(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn set_pref_brearer(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn set_delivery_report(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_sms_set_delivery_report *deliveryReport = NULL; + char *cmd_str; + struct ATReqMetaInfo metainfo; + int info_len =0; + + dbg("new pending(IPC_SMS_SVC_CENTER_ADDR)"); + + deliveryReport = tcore_user_request_ref_data(ur, NULL); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + if (!deliveryReport || !h) + return TCORE_RETURN_ENOSYS; + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CNMA + if(deliveryReport->rspType == SMS_SENDSMS_SUCCESS) + cmd_str = g_strdup_printf("AT+CNMA=0%s", "\r"); + else + cmd_str = g_strdup_printf("AT+CNMA=2,3%s%x%s", "/n", 0x00ff00, ""); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_set_delivery_report, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + + free(cmd_str); + + return tcore_hal_send_request(h, pending); + +} + +static TReturn set_msg_status(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn get_sms_params(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_sms_get_params *getSmsParams = NULL; + + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + dbg("new pending(IPC_SMS_GET_CBS_CFG)"); + + getSmsParams = tcore_user_request_ref_data(ur, NULL); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + if (!getSmsParams || !h) + { + dbg("[ERR] pointer is NULL, getSmsParams=0x%x, h=0x%x", getSmsParams, h); + return TCORE_RETURN_ENOSYS; + } + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"+CRSM:",strlen("+CRSM:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CRSM=,,, + cmd_str = g_strdup_printf("AT+CRSM=%d, %d, %d, 4, 40%s", 178, 0x6F42, getSmsParams->index + 1, "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_get_sms_params, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + + free(cmd_str); + + return tcore_hal_send_request(h, pending); + +} + +static TReturn set_sms_params(CoreObject *o, UserRequest *ur) +{ + dbg("[tcore_SMS] Not supported"); + return TCORE_RETURN_ENOSYS; +} + +static TReturn get_paramcnt(CoreObject *o, UserRequest *ur) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + const struct treq_sms_get_paramcnt *getParamCnt = NULL; + + char *cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + getParamCnt = tcore_user_request_ref_data(ur, NULL); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + if (!h) // request data is NULL, so do not NULL check for getParamCnt + { + dbg("[ERR] pointer is NULL, getParamCnt=0x%x, h=0x%x", getParamCnt, h); + return TCORE_RETURN_ENOSYS; + } + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = SINGLELINE; + memcpy(metainfo.responsePrefix,"+CRSM:",strlen("+CRSM:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + // AT+CRSM=,,,, EFsmsp: 0x6F42 + cmd_str = g_strdup_printf("AT+CRSM=192, %d%s", 0x6F42, "\r"); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, on_response_get_paramcnt, NULL); + tcore_pending_link_user_request(pending, ur); + + tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL); + + free(cmd_str); + + return tcore_hal_send_request(h, pending); +} + +static struct tcore_sms_operations sms_ops = +{ + .send_umts_msg = send_umts_msg, + .read_msg = read_msg, + .save_msg = save_msg, + .delete_msg = delete_msg, + .get_storedMsgCnt = get_storedMsgCnt, + .get_sca = get_sca, + .set_sca = set_sca, + .get_cb_config = get_cb_config, + .set_cb_config = set_cb_config, + .set_mem_status = set_mem_status, + .get_pref_brearer = get_pref_brearer, + .set_pref_brearer = set_pref_brearer, + .set_delivery_report = set_delivery_report, + .set_msg_status = set_msg_status, + .get_sms_params = get_sms_params, + .set_sms_params = set_sms_params, + .get_paramcnt = get_paramcnt, + .send_cdma_msg = send_cdma_msg, +}; + +gboolean s_sms_init(TcorePlugin *p) +{ + CoreObject *o; + struct property_sms_info *data; + GQueue *work_queue; + + o = tcore_sms_new(p, "umts_sms", &sms_ops); + if (!o) + return FALSE; + + work_queue = g_queue_new(); + tcore_object_link_user_data(o, work_queue); + + tcore_object_add_callback(o, EVENT_SMS_INCOM_MSG, on_event_sms_incom_msg, NULL); + tcore_object_add_callback(o, EVENT_SMS_DEVICE_READY, on_event_sms_device_ready, NULL); + + data = calloc(sizeof(struct property_sms_info), 1); + tcore_plugin_link_property(p, "SMS", data); + + return TRUE; +} + + +void s_sms_exit(TcorePlugin *p) +{ + CoreObject *o; + struct property_sms_info *data; + + o = tcore_plugin_ref_core_object(p, "umts_sms"); + if (!o) + return; + + data = tcore_plugin_ref_property(p, "SMS"); + if (data) + free(data); + + tcore_sms_free(o); +} + diff --git a/src/s_ss.c b/src/s_ss.c new file mode 100644 index 0000000..05b056c --- /dev/null +++ b/src/s_ss.c @@ -0,0 +1,2536 @@ +/* + * tel-plugin-atmodem + * + * 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 +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "s_common.h" +#include "s_ss.h" +#include "util.h" + +#include "atchannel.h" +#include "at_tok.h" + +extern struct ATResponse *sp_response; +extern char *s_responsePrefix; +extern enum ATCommandType s_type; + + +gboolean gcf = FALSE; + +enum telephony_ss_opcode { + TIZEN_SS_OPCO_REG=0x01, /* 0x01 : Registration */ + TIZEN_SS_OPCO_DEREG, /* 0x02 : De-registration( erase ) */ + TIZEN_SS_OPCO_ACTIVATE, /* 0x03 : Activation */ + TIZEN_SS_OPCO_DEACTIVATE, /* 0x04 : De-activation */ + TIZEN_SS_OPCO_MAX +} ; + + +struct ss_confirm_info { + enum telephony_ss_class class; + int flavor_type; + enum tcore_response_command resp; + void *data; + int data_len; +}; + + #define TIZEN_NUM_TYPE_INTERNATIONAL 0x01 + #define TIZEN_NUM_PLAN_ISDN 0x01 + + +static gboolean _ss_request_message( CoreObject *o, + UserRequest *ur, + char *cmd, + unsigned int cmd_len, + void* on_resp, + void* user_data ); +#if 0 +static TReturn _ss_general_response_result(const int result); +#endif + +static TReturn _ss_barring_get( CoreObject *o, + UserRequest *ur, + enum telephony_ss_class class, + enum telephony_ss_barring_mode type, + enum tcore_response_command resp ); + +static TReturn _ss_forwarding_get( CoreObject *o, + UserRequest *ur, + enum telephony_ss_class class, + enum telephony_ss_forwarding_mode type, + enum tcore_response_command resp ); + +static TReturn _ss_waiting_get( CoreObject *o, + UserRequest *ur, + enum telephony_ss_class class, + enum tcore_response_command resp ); + + +static TReturn s_ss_barring_activate( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_barring_deactivate( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_barring_change_password( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_barring_get_status( CoreObject *o, UserRequest *ur ); + +static TReturn s_ss_forwarding_activate( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_forwarding_deactivate( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_forwarding_register( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_forwarding_deregister( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_forwarding_get_status( CoreObject *o, UserRequest *ur ); + +static TReturn s_ss_waiting_activate( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_waiting_deactivate( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_waiting_get_status( CoreObject *o, UserRequest *ur ); + +static TReturn s_ss_cli_activate( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_cli_deactivate( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_cli_get_status( CoreObject *o, UserRequest *ur ); + +static TReturn s_ss_send_ussd( CoreObject *o, UserRequest *ur ); + +static TReturn s_ss_set_aoc( CoreObject *o, UserRequest *ur ); +static TReturn s_ss_get_aoc( CoreObject *o, UserRequest *ur ); + +static TReturn s_ss_manage_call_0_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ); +static TReturn s_ss_manage_call_1_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ); +static TReturn s_ss_manage_call_1x_send( CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data ); +static TReturn s_ss_manage_call_2_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ); +static TReturn s_ss_manage_call_2x_send( CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data ); +static TReturn s_ss_manage_call_3_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ); +static TReturn s_ss_manage_call_4_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ); +static TReturn s_ss_manage_call_4dn_send( CoreObject* o, UserRequest* ur, const char* number, ConfirmCallback cb, void* user_data ); +/* +static TReturn s_ss_manage_call_5_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ); +static TReturn s_ss_manage_call_6_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ); +*/ + +static void on_confirmation_call_control_ss_message_send( TcorePending *p, gboolean result, void *user_data ); + +static void on_confirmation_ss_message_send( TcorePending *p, gboolean result, void *user_data ); + + +static void on_notification_ss_info( CoreObject *o, const void *data, void *user_data ); + +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 void on_notification_ss_ussd( CoreObject *o, const void *data, void *user_data ); + + +static gboolean _ss_request_message( CoreObject *o, + UserRequest *ur, + char *cmd, + unsigned int cmd_len, + void* on_resp, + void* user_data ) +{ + TcorePending *pending = 0; + TcorePlugin *p = 0; + TcoreHal *h = 0; + UserRequest *ur2 = 0; + + ur2 = tcore_user_request_dup( ur ); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, cmd_len, cmd); + tcore_pending_set_timeout(pending, 0); + + if ( on_resp ) + tcore_pending_set_response_callback(pending, on_resp, user_data); + + tcore_pending_set_send_callback(pending, on_confirmation_ss_message_send, 0); + + if ( !ur2 ) { + dbg("[ check ] ur is 0, is this internal request??"); + } else { + tcore_pending_link_user_request(pending, ur2); + } + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + tcore_hal_send_request(h, pending); + + return TRUE; +} + +#if 0 +static TReturn _ss_general_response_result(const int ret) +{ + if (ret == 0x8000 || ret == 0x8100) { + return TCORE_RETURN_SUCCESS; + } + + return TCORE_RETURN_3GPP_ERROR + ret; +} +#endif + +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; + + if ( !ur ) { + dbg("[ error ] ur : (NULL)"); + return ; + } + + resp.type = type; + resp.status = status; + resp.err = FALSE; + + if ( ussd_str ) { + + int len = strlen( ussd_str ); + + if ( len < MAX_SS_USSD_LEN ) { + memcpy( resp.str, ussd_str, len ); + resp.str[ len ] = '\0'; + } else { + memcpy( resp.str, ussd_str, MAX_SS_USSD_LEN ); + resp.str[ MAX_SS_USSD_LEN - 1 ] = '\0'; + } + + dbg("resp.str : %s", resp.str); + + } else { + + memset( resp.str, '\0', MAX_SS_USSD_LEN ); + + } + + tcore_user_request_send_response(ur, TRESP_SS_SEND_USSD, sizeof(struct tresp_ss_ussd), &resp); +} + +static void _ss_ussd_notification( TcorePlugin *p, const char* ussd_str, enum telephony_ss_ussd_status status ) +{ + CoreObject *o = 0; + struct tnoti_ss_ussd noti; + + if ( !p ) { + dbg("[ error ] p : (NULL)"); + return ; + } + + noti.status = status; + + if ( ussd_str ) { + + int len = strlen( ussd_str ); + + if ( len < MAX_SS_USSD_LEN ) { + memcpy( noti.str, ussd_str, len ); + noti.str[ len ] = '\0'; + } else { + memcpy( noti.str, ussd_str, MAX_SS_USSD_LEN ); + noti.str[ MAX_SS_USSD_LEN - 1 ] = '\0'; + } + + } else { + + memset( noti.str, '\0', MAX_SS_USSD_LEN ); + + } + + o = tcore_plugin_ref_core_object(p, "ss"); + + tcore_server_send_notification( tcore_plugin_ref_server(p), + o, + TNOTI_SS_USSD, + sizeof(struct tnoti_ss_ussd), + (void*)¬i ); + +} + +static void on_notification_ss_ussd( CoreObject *o, const void *data, void *user_data ) +{ + enum telephony_ss_ussd_status status; + UssdSession *ussd_session = 0; + char *ussd_str = 0, *cmd = 0, *tmp_str=0; + TcorePlugin *p = 0; + int err =0, m=0, dcs=0; + + p = tcore_object_ref_plugin(o); + + ussd_session = tcore_ss_ussd_get_session(o); + + cmd = (char*)data; + + // parse ussd status + at_tok_start(&cmd); + err = at_tok_nextint(&cmd, &m); + dbg("m: %d", m); + + switch(m){ + case 0: + status = SS_USSD_NO_ACTION_REQUIRE; + break; + + case 1: + status = SS_USSD_ACTION_REQUIRE; + break; + + case 2: + status = SS_USSD_TERMINATED_BY_NET; + break; + + case 3: + status = SS_USSD_OTHER_CLIENT; + break; + + case 4: + status = SS_USSD_NOT_SUPPORT; + break; + + case 5: + status = SS_USSD_TIME_OUT; + break; + + default: + dbg("unsupported m : %d", m); + status = SS_USSD_MAX; + break; + } + + if(at_tok_hasmore(&cmd)) + { + err = at_tok_nextstr(&cmd, &tmp_str); + err = at_tok_nextint(&cmd, &dcs); + + dbg("ussdstr: %s, dcs :%d", tmp_str, dcs); + + } + + 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(tmp_str, strlen(tmp_str)); + } break; + + case TCORE_DCS_TYPE_UCS2: + case TCORE_DCS_TYPE_8_BIT: { + if ( strlen(tmp_str) > 0 ) { + ussd_str = g_new0( char, strlen(tmp_str) + 1); + memcpy( ussd_str,tmp_str, strlen(tmp_str) ); + ussd_str[ strlen(tmp_str) ] = '\0'; + } + } break; + default: { + dbg("[ error ] unknown dcs type. ussd_session : %x", ussd_session); + if ( ussd_session ) { + + UserRequest *ur = 0; + enum telephony_ss_ussd_type type; + + tcore_ss_ussd_get_session_data( ussd_session, (void**)&ur ); + if ( !ur ) { + dbg("[ error ] ur : (0)"); + return; + } + + type = (enum telephony_ss_ussd_type)tcore_ss_ussd_get_session_type( ussd_session ); + + _ss_ussd_response( ur, ussd_str, type, status ); + } + return; + } + } + + switch ( status ) { + case SS_USSD_NO_ACTION_REQUIRE: + case SS_USSD_ACTION_REQUIRE: + case SS_USSD_OTHER_CLIENT: + case SS_USSD_NOT_SUPPORT: + case SS_USSD_TIME_OUT: { + + // UserRequest *ur = 0; + + if ( ussd_session ) { + + UserRequest *ur = 0; + enum telephony_ss_ussd_type type; + + tcore_ss_ussd_get_session_data( ussd_session, (void**)&ur ); + if ( !ur ) { + dbg("[ error ] ur : (0)"); + return; + } + + type = (enum telephony_ss_ussd_type)tcore_ss_ussd_get_session_type( ussd_session ); + + _ss_ussd_response( ur, (const char*)ussd_str, type, status ); + + g_free( ussd_str ); + + } else { + + tcore_ss_ussd_create_session( o, TCORE_SS_USSD_TYPE_NETWORK_INITIATED, 0, 0 ); + + _ss_ussd_notification( p, (const char*)ussd_str, status ); + + 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_user_request_free( ur ); + + tcore_ss_ussd_destroy_session( ussd_session ); + } + + } break; + default: + break; + } + +} + +static void on_notification_ss_info( CoreObject *o, const void *data, void *user_data ) +{ + TcorePlugin *p = 0; + CoreObject *co = 0; + char* cmd = 0, *number = 0; + int code2 =0, err=0, index=0, ton=0; + + + p = tcore_object_ref_plugin( o ); + co = tcore_plugin_ref_core_object( p, "call" ); + if (!co) { + dbg("[ error ] plugin_ref_core_object : call"); + return ; + } + + cmd = (char*)data; + at_tok_start(&cmd); + + err = at_tok_nextint(&cmd, &code2); + dbg("code2 : %d",code2); + + if(at_tok_hasmore(&cmd)) + err = at_tok_nextint(&cmd, &index); //cug index - skip + if(at_tok_hasmore(&cmd)){ + err = at_tok_nextstr(&cmd, &number); + dbg("number : %s",number); + err = at_tok_nextint(&cmd, &ton); + } + + switch(code2){ + case 0: //this is a forwarded call (MT call setup) + tcore_call_information_mt_forwarded_call( co, number ); + break; + + case 2: //call has been put on hold (during a voice call) + tcore_call_information_held( co, number ); + break; + + case 3: //call has been retrieved (during a voice call) + tcore_call_information_active( co, number ); + break; + + case 4: //multiparty call entered (during a voice call) + tcore_call_information_joined( co, number ); + break; + + case 5: //call on hold has been released + tcore_call_information_released_on_hold( co, number ); + break; + + case 6: //forward check SS message received (can be received whenever) + tcore_call_information_cf_check_ss_message( co, number ); + 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 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 9: //this is a deflected call (MT call setup): + tcore_call_information_mt_deflected_call( co, number ); + break; + + default: + dbg("unsupported cmd2 : %d",code2); + break; + } +} + +static void on_confirmation_ss_message_send( TcorePending *p, gboolean result, void *user_data ) +{ + UserRequest* ur = NULL; + struct ATReqMetaInfo* metainfo = NULL; + unsigned int info_len =0; + dbg("on_confirmation_ss_message_send - msg out from queue. alloc ATRsp buffer & write rspPrefix if needed\n"); + + ReleaseResponse(); // release leftover +//alloc new sp_response + sp_response = at_response_new(); + + + ur = tcore_pending_ref_user_request(p); + metainfo = (struct ATReqMetaInfo*)tcore_user_request_ref_metainfo(ur,&info_len); + + if((metainfo->type == SINGLELINE)|| + (metainfo->type == MULTILINE)) + { + //cp rsp prefix + s_responsePrefix = strdup(metainfo->responsePrefix); + dbg("duplicating responsePrefix : %s\n", s_responsePrefix); + } + else + { + s_responsePrefix = NULL; + } + +//set atcmd type into s_type + s_type = metainfo->type; +} + +static void on_confirmation_call_control_ss_message_send( TcorePending *p, gboolean result, void *user_data ) +{ + UserRequest* ur = NULL; + struct ATReqMetaInfo* metainfo = NULL; + unsigned int info_len =0; + dbg("on_confirmation_call_control_ss_message_send - msg out from queue. alloc ATRsp buffer & write rspPrefix if needed\n"); + + ReleaseResponse(); // release leftover +//alloc new sp_response + sp_response = at_response_new(); + + + ur = tcore_pending_ref_user_request(p); + metainfo = (struct ATReqMetaInfo*)tcore_user_request_ref_metainfo(ur,&info_len); + + if((metainfo->type == SINGLELINE)|| + (metainfo->type == MULTILINE)) + { + //cp rsp prefix + s_responsePrefix = strdup(metainfo->responsePrefix); + dbg("duplicating responsePrefix : %s\n", s_responsePrefix); + } + else + { + s_responsePrefix = NULL; + } + +//set atcmd type into s_type + s_type = metainfo->type; +} + +static void on_response_ss_barring_set( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + struct ss_confirm_info *info = 0; + enum telephony_ss_class class; + + CoreObject* o = 0; + UserRequest *ur; + struct tresp_ss_general resp; + UserRequest *ur_dup=0; + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + printResponse(); + + info = (struct ss_confirm_info*)user_data; + class = info->class; + + + if(sp_response->success > 0){ + resp.err = TCORE_RETURN_SUCCESS; + } + else{ + resp.err = TCORE_RETURN_FAILURE; + } + + dbg("on_response_ss_barring_set - rsp.err : %d, ur : %x", resp.err, ur); + + + if(sp_response->success > 0) + { + ReleaseResponse(); + + if ( info->class == SS_CLASS_VOICE ) + class = SS_CLASS_ALL_TELE_BEARER; + + ur_dup = tcore_user_request_dup(ur); + + 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 ) + _ss_barring_get( o, ur_dup, class, SS_BARR_MODE_BAIC, info->resp ); + else + _ss_barring_get( o, ur_dup, class, info->flavor_type, info->resp ); + + } + else + { + ReleaseResponse(); + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp); + else + dbg("[ error ] ur is 0"); + + } + + g_free(user_data); + + +} +static void on_response_ss_barring_change_pwd( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + struct ss_confirm_info *info = 0; + UserRequest *ur; + struct tresp_ss_general resp; + + ur = tcore_pending_ref_user_request(p); + + info = (struct ss_confirm_info*)user_data; + + printResponse(); + + if(sp_response->success > 0){ + resp.err = TCORE_RETURN_SUCCESS; + } + else{ + resp.err = TCORE_RETURN_FAILURE; + } + + ReleaseResponse(); + + dbg("on_response_ss_barring_change_pwd: rsp.err : %d, usr : %x", resp.err, ur); + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp); + else + dbg("[ error ] ur is 0"); + + g_free(user_data); + +} + + +static void on_response_ss_barring_get( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + struct ATLine *p_cur; + int status=0, classx =0, err=0; + + struct ss_confirm_info* info = 0; + struct tresp_ss_barring resp; + int countRecords=0, countValidRecords =0; + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + printResponse(); + + info = (struct ss_confirm_info*)user_data; + + /* count the calls */ + for (countRecords = 0, p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next + ) { + countRecords++; + } + dbg("total records : %d",countRecords); + + + resp.record_num = countRecords; + + if ( resp.record_num > 0 ) { +// int i = 0; + + resp.record = g_new0( struct barring_info, resp.record_num ); + + for (countValidRecords = 0, p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next) + { + err = at_tok_start(&(p_cur->line)); + if (err < 0){ + dbg("start line error. skip this line"); + goto error; + } + err = at_tok_nextint(&(p_cur->line), &status);// status + if (err < 0) { + dbg("status error. skip this line"); + goto error; + } + + if(status == 1){ + resp.record[countValidRecords].status = SS_STATUS_ACTIVATE; + } + else { + resp.record[countValidRecords].status = SS_STATUS_DEACTIVATE; + } + + err = at_tok_nextint(&(p_cur->line), &classx); //class + if (err < 0) { + dbg("class error. classx not exist - set to requested one : %d", info->class); + switch(info->class){ + case SS_CLASS_ALL_TELE: + classx =7; + break; + case SS_CLASS_VOICE: + classx =1; + break; + case SS_CLASS_ALL_DATA_TELE: + classx =2; + break; + case SS_CLASS_FAX: + classx =4; + break; + case SS_CLASS_SMS: + classx = 8; + break; + case SS_CLASS_ALL_CS_SYNC: + classx = 16; + break; + + default: + classx =7; + dbg("unsupported class %d. set to default : 7", info->class); + break; + } + } + + switch(classx){ + case 1: + resp.record[countValidRecords].class = SS_CLASS_VOICE; + break; + case 2: + resp.record[countValidRecords].class = SS_CLASS_ALL_DATA_TELE; + break; + case 4: + resp.record[countValidRecords].class = SS_CLASS_FAX; + break; + case 7: + resp.record[countValidRecords].class = SS_CLASS_ALL_TELE; + break; + case 8: + resp.record[countValidRecords].class = SS_CLASS_SMS; + break; + case 16: + resp.record[countValidRecords].class = SS_CLASS_ALL_CS_SYNC; + break; + case 32: + resp.record[countValidRecords].class = SS_CLASS_ALL_CS_ASYNC; + break; + default: + dbg("unspoorted class : [%d]\n", classx ); + goto error; + break; + } + + resp.record[countValidRecords].mode = (enum telephony_ss_barring_mode)(info->flavor_type); + + countValidRecords++; + continue; +error: + dbg("invalid field found. coutinue"); + continue; + } + + dbg("valid count :%d",countValidRecords); + resp.record_num = countValidRecords; + resp.err = TCORE_RETURN_SUCCESS; + + } + else + { + dbg("no active status - return to user") + resp.err = TCORE_RETURN_FAILURE; + } + dbg("on_response_ss_barring_get- rsp.err : %d, ur : %x", resp.err, ur); + + ReleaseResponse(); + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_barring), &resp); + else + dbg("[ error ] ur is 0"); + + g_free( user_data ); + +} + +static void on_response_ss_forwarding_set( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0, *dup_ur=0; + struct ss_confirm_info *info = 0; + struct tresp_ss_general resp; + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + info = (struct ss_confirm_info*)user_data; + + printResponse(); + + if(sp_response->success > 0){ + resp.err = TCORE_RETURN_SUCCESS; + }else{ + resp.err = TCORE_RETURN_FAILURE; + } + + dbg("[ check ] class : 0x%x", info->class ); + dbg("[ check ] flavor_type : 0x%x", info->flavor_type ); + + dbg("on_response_ss_forwarding_set - rsp.err : %d, ur : %x", resp.err, ur); + + if ( sp_response->success > 0) { + + ReleaseResponse(); + + if ( info->flavor_type == SS_CF_MODE_CF_ALL || + info->flavor_type == SS_CF_MODE_CFC ) { + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp); + else + dbg("[ error ] ur is 0"); + + } else { + dup_ur = tcore_user_request_dup(ur); + _ss_forwarding_get( o, dup_ur, info->class, info->flavor_type, info->resp ); + } + + } else { + ReleaseResponse(); + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp); + else + dbg("[ error ] ur is 0"); + + } + g_free(user_data); +} + +static void on_response_ss_forwarding_get( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + struct ATLine *p_cur; + int status=0, classx =0, err=0, ton =0, time=0; + char* num, *subaddr; + + struct ss_confirm_info* info = 0; + struct tresp_ss_forwarding resp; + int countRecords=0, countValidRecords =0; + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + printResponse(); + + info = (struct ss_confirm_info*)user_data; + + /* count the calls */ + for (countRecords = 0, p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next + ) { + countRecords++; + } + dbg("total records : %d",countRecords); + + + resp.record_num = countRecords; + + if ( resp.record_num > 0 ) { +// int i = 0; + + resp.record = g_new0( struct forwarding_info, resp.record_num ); + + for (countValidRecords = 0, p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next) + { + err = at_tok_start(&(p_cur->line)); + if (err < 0){ + dbg("start line error. skip this line"); + goto error; + } + err = at_tok_nextint(&(p_cur->line), &status);// status + if (err < 0) { + dbg("status error. skip this line"); + goto error; + } + + if(status == 1){ + resp.record[countValidRecords].status = SS_STATUS_ACTIVATE; + } + else { + resp.record[countValidRecords].status = SS_STATUS_DEACTIVATE; + } + + err = at_tok_nextint(&(p_cur->line), &classx); //class + if (err < 0) { + dbg("class error. skip this line"); + goto error; + } + + switch(classx){ + case 1: + resp.record[countValidRecords].class = SS_CLASS_VOICE; + break; + case 2: + resp.record[countValidRecords].class = SS_CLASS_ALL_DATA_TELE; + break; + case 4: + resp.record[countValidRecords].class = SS_CLASS_FAX; + break; + case 7: + resp.record[countValidRecords].class = SS_CLASS_ALL_TELE; + break; + case 8: + resp.record[countValidRecords].class = SS_CLASS_SMS; + break; + case 16: + resp.record[countValidRecords].class = SS_CLASS_ALL_CS_SYNC; + break; + case 32: + resp.record[countValidRecords].class = SS_CLASS_ALL_CS_ASYNC; + break; + default: + dbg("unspoorted class : [%d]\n", classx ); + goto error; + break; + } + + if(at_tok_hasmore(&(p_cur->line)) ==1){ //more data present + err = at_tok_nextstr(&(p_cur->line), &num); //number + memcpy((resp.record[countValidRecords].number), num, strlen(num)); + resp.record[countValidRecords].number_present = TRUE; + + err = at_tok_nextint(&(p_cur->line), &ton); // type of number - skip + resp.record[countValidRecords].number_type = ton; + + if(at_tok_hasmore(&(p_cur->line)) ==1){ + err = at_tok_nextstr(&(p_cur->line), &subaddr); //subaddr - skip + err =at_tok_nextint(&(p_cur->line), &ton); //ton of subaddr - skip + + if(at_tok_hasmore(&(p_cur->line)) ==1){ + err = at_tok_nextint(&(p_cur->line), &time); //time + resp.record[countValidRecords].time = (enum telephony_ss_forwarding_no_reply_time)time; + } + + } + + } + + resp.record[countValidRecords].mode = (enum telephony_ss_barring_mode)(info->flavor_type); + + countValidRecords++; + continue; +error: + dbg("invalid field found. coutinue"); + continue; + } + + dbg("valid count :%d",countValidRecords); + resp.record_num = countValidRecords; + resp.err = TCORE_RETURN_SUCCESS; + + } + else + { + dbg("no active status - return to user") + resp.err = TCORE_RETURN_FAILURE; + } + + ReleaseResponse(); + dbg("on_response_ss_forwarding_get - rsp.err : %d, ur : %x", resp.err, ur); + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_forwarding), &resp); + else + dbg("[ error ] ur is 0"); + + g_free( user_data ); + +} + +static void on_response_ss_waiting_set( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + struct ss_confirm_info *info = 0; + struct tresp_ss_general resp; + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + info = (struct ss_confirm_info*)user_data; + + if(sp_response->success > 0){ + resp.err = TCORE_RETURN_SUCCESS; + }else{ + resp.err = TCORE_RETURN_FAILURE; + } + + ReleaseResponse(); + + dbg("on_response_ss_waiting_set - rsp.err : %d, ur : %x, class : %d", resp.err, ur, info->class ); + + if ( resp.err == TCORE_RETURN_SUCCESS ) { + + _ss_waiting_get( o, ur, info->class, info->resp ); + + } else { + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp); + else + dbg("[ error ] ur is 0"); + + } + g_free( user_data ); +} + +static void on_response_ss_waiting_get( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + CoreObject* o = 0; + UserRequest* ur = 0; + struct ATLine *p_cur; + int status=0, classx =0, err=0; + + struct ss_confirm_info* info = 0; + struct tresp_ss_waiting resp; + int countRecords=0, countValidRecords =0; + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + printResponse(); + + info = (struct ss_confirm_info*)user_data; + + /* count the calls */ + for (countRecords = 0, p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next + ) { + countRecords++; + } + dbg("total records : %d",countRecords); + + + resp.record_num = countRecords; + + if ( resp.record_num > 0 ) { +// int i = 0; + + resp.record = g_new0( struct waiting_info, resp.record_num ); + + for (countValidRecords = 0, p_cur = sp_response->p_intermediates + ; p_cur != NULL + ; p_cur = p_cur->p_next) + { + err = at_tok_start(&(p_cur->line)); + if (err < 0){ + dbg("start line error. skip this line"); + goto error; + } + + err = at_tok_nextint(&(p_cur->line), &status);// status + if (err < 0) { + dbg("status error. skip this line"); + goto error; + } + + if(status == 1){ + resp.record[countValidRecords].status = SS_STATUS_ACTIVATE; + } + else { + resp.record[countValidRecords].status = SS_STATUS_DEACTIVATE; + } + + err = at_tok_nextint(&(p_cur->line), &classx); //class + if (err < 0) { + dbg("class error. skip this line"); + goto error; + } + + switch(classx){ + case 1: + resp.record[countValidRecords].class = SS_CLASS_VOICE; + break; + case 2: + resp.record[countValidRecords].class = SS_CLASS_ALL_DATA_TELE; + break; + case 4: + resp.record[countValidRecords].class = SS_CLASS_FAX; + break; + case 7: + resp.record[countValidRecords].class = SS_CLASS_ALL_TELE; + break; + case 8: + resp.record[countValidRecords].class = SS_CLASS_SMS; + break; + case 16: + resp.record[countValidRecords].class = SS_CLASS_ALL_CS_SYNC; + break; + case 32: + resp.record[countValidRecords].class = SS_CLASS_ALL_CS_ASYNC; + break; + default: + dbg("unspoorted class : [%d]\n", classx ); + goto error; + break; + } + + countValidRecords++; + continue; +error: + dbg("invalid field found. coutinue"); + continue; + } + + dbg("valid count :%d",countValidRecords); + resp.record_num = countValidRecords; + resp.err = TCORE_RETURN_SUCCESS; + } + else + { + dbg("no active status - return to user") + resp.err = TCORE_RETURN_FAILURE; + } + dbg("on_response_ss_waiting_get - rsp.err : %d, ur : %x", resp.err, ur); + + ReleaseResponse(); + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_waiting), &resp); + else + dbg("[ error ] ur is 0"); + + g_free( user_data ); + +} + +static void on_confirmation_ss_ussd( TcorePending *p, int data_len, const void *data, void *user_data ) +{ + struct ss_confirm_info *info = 0; + + struct tresp_ss_ussd resp; + CoreObject* o = 0; + UserRequest* ur = 0; + + o = tcore_pending_ref_core_object(p); + ur = tcore_pending_ref_user_request(p); + + + printResponse(); + + info = (struct ss_confirm_info*)user_data; + + if(sp_response->success > 0){ + resp.err = TCORE_RETURN_SUCCESS; + } + else{ + resp.err = TCORE_RETURN_FAILURE; + } + + dbg("on_confirmation_ss_ussd - rsp.err : %d, ur : %x", resp.err, ur); + + + if ( resp.err ) { + + UssdSession *ussd_s = 0; + enum tcore_ss_ussd_type type = 0; + + ussd_s = tcore_ss_ussd_get_session( o ); + + if ( ussd_s ) + type = tcore_ss_ussd_get_session_type( ussd_s ); + else + dbg("[ error ] ussd_s : (0)"); + + resp.type = (enum telephony_ss_ussd_type)type; + + if ( type == TCORE_SS_USSD_TYPE_USER_INITIATED ) { + UserRequest *ur2 = 0; + + tcore_ss_ussd_get_session_data( ussd_s, (void**)&ur2 ); + if ( ur2 ) + tcore_user_request_free( ur2 ); + + tcore_ss_ussd_destroy_session( ussd_s ); + } + + if ( ur ) + tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_ussd), &resp); + else + dbg("[ error ] ur : (0)"); + + ReleaseResponse(); + } +} + + +static struct tcore_ss_operations ss_ops = { + .barring_activate = s_ss_barring_activate, + .barring_deactivate = s_ss_barring_deactivate, + .barring_change_password= s_ss_barring_change_password, + .barring_get_status = s_ss_barring_get_status, + .forwarding_activate = s_ss_forwarding_activate, + .forwarding_deactivate = s_ss_forwarding_deactivate, + .forwarding_register = s_ss_forwarding_register, + .forwarding_deregister = s_ss_forwarding_deregister, + .forwarding_get_status = s_ss_forwarding_get_status, + .waiting_activate = s_ss_waiting_activate, + .waiting_deactivate = s_ss_waiting_deactivate, + .waiting_get_status = s_ss_waiting_get_status, + .cli_activate = s_ss_cli_activate, + .cli_deactivate = s_ss_cli_deactivate, + .cli_get_status = s_ss_cli_get_status, + .send_ussd = s_ss_send_ussd, + .set_aoc = s_ss_set_aoc, + .get_aoc = s_ss_get_aoc, +}; + + +static TReturn _ss_barring_set( CoreObject *o, UserRequest *ur, enum telephony_ss_opcode op ) +{ + struct treq_ss_barring *barring = 0; + TcorePlugin *p = 0; + struct ss_confirm_info *user_data = 0; + gboolean ret = FALSE; + char passwd[MAX_SS_BARRING_PASSWORD_LEN+1]; + + struct ATReqMetaInfo metainfo; + int info_len =0; + char* cmd_str = NULL; + int opco; + int classx; + char* facility = NULL; + + + barring = (struct treq_ss_barring*)tcore_user_request_ref_data( ur, 0 ); + p = tcore_object_ref_plugin( o ); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + + switch(op){ + case TIZEN_SS_OPCO_ACTIVATE: + opco = 1; + break; + case TIZEN_SS_OPCO_DEACTIVATE: + opco = 0; + break; + default: + dbg("unsupported opco : %d", op); + return TCORE_RETURN_FAILURE; + } + + + switch(barring->mode){ + case SS_BARR_MODE_BAOC: + facility = "AO"; + break; + case SS_BARR_MODE_BOIC: + facility = "OI"; + break; + case SS_BARR_MODE_BOIC_NOT_HC: + facility = "OX"; + break; + case SS_BARR_MODE_BAIC: + facility = "AI"; + break; + case SS_BARR_MODE_BIC_ROAM: + facility = "IR"; + break; + case SS_BARR_MODE_AB: + facility = "AB"; + break; + case SS_BARR_MODE_AOB: + facility = "AG"; + break; + case SS_BARR_MODE_AIB: + facility = "AC"; + break; + case SS_BARR_MODE_BIC_NOT_SIM: + facility = "NS"; + break; + default: + dbg("unspported mode %d", barring->mode); + return TCORE_RETURN_FAILURE; + } + + switch(barring->class) + { + case SS_CLASS_ALL_TELE: + classx =7; + break; + case SS_CLASS_VOICE: + classx =1; + break; + case SS_CLASS_ALL_DATA_TELE: + classx =2; + break; + case SS_CLASS_FAX: + classx =4; + break; + case SS_CLASS_SMS: + classx = 8; + break; + case SS_CLASS_ALL_CS_SYNC: + classx = 16; + break; + + default: + classx =7; + dbg("unsupported class %d. set to default : 7", barring->class); + break; + } + + // null-ended pwd handling added - unexpected 0x11 value observed in req string + memcpy(passwd, barring->password, MAX_SS_BARRING_PASSWORD_LEN); + passwd[MAX_SS_BARRING_PASSWORD_LEN]='\0'; + + + cmd_str = g_strdup_printf("AT+CLCK=\"%s\",%d,\"%s\",%d%s", facility, opco, passwd, classx,"\r"); + dbg("request command : %s", cmd_str); + + + + user_data = g_new0( struct ss_confirm_info, 1 ); + + if ( op == TIZEN_SS_OPCO_ACTIVATE) { + user_data->resp = TRESP_SS_BARRING_ACTIVATE; + + } else if ( op == TIZEN_SS_OPCO_DEACTIVATE) { + user_data->resp = TRESP_SS_BARRING_DEACTIVATE; + + } else { + dbg("[ error ] wrong ss opco ( 0x%x )", op ); + return TCORE_RETURN_FAILURE; + } + + user_data->flavor_type = (int)(barring->mode); + user_data->class = barring->class; + + ret = _ss_request_message( o, ur, cmd_str, strlen(cmd_str), on_response_ss_barring_set, user_data ); + + g_free(cmd_str); + + if ( !ret ) + return TCORE_RETURN_FAILURE; + + return TCORE_RETURN_SUCCESS; +} + +static TReturn _ss_barring_get( CoreObject *o, + UserRequest *ur, + enum telephony_ss_class class, + enum telephony_ss_barring_mode mode, + enum tcore_response_command resp ) +{ + TcorePlugin *p = 0; + struct ss_confirm_info *user_data = 0; + gboolean ret = FALSE; + + struct ATReqMetaInfo metainfo; + int info_len =0; + char* cmd_str = NULL; + int opco, classx; + char* facility = NULL; + + p = tcore_object_ref_plugin( o ); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = MULTILINE; + memcpy(metainfo.responsePrefix,"+CLCK:",strlen("+CLCK:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + //query status - opco is fixed to 2 + opco = 2; + + //barring mode + switch(mode){ + case SS_BARR_MODE_BAOC: + facility = "AO"; + break; + case SS_BARR_MODE_BOIC: + facility = "OI"; + break; + case SS_BARR_MODE_BOIC_NOT_HC: + facility = "OX"; + break; + case SS_BARR_MODE_BAIC: + facility = "AI"; + break; + case SS_BARR_MODE_BIC_ROAM: + facility = "IR"; + break; + case SS_BARR_MODE_AB: + facility = "AB"; + break; + case SS_BARR_MODE_AOB: + facility = "AG"; + break; + case SS_BARR_MODE_AIB: + facility = "AC"; + break; + case SS_BARR_MODE_BIC_NOT_SIM: + facility = "NS"; + break; + default: + dbg("unspported mode %d", mode); + return TCORE_RETURN_FAILURE; + } + + switch(class) + { + case SS_CLASS_ALL_TELE: + classx =7; + break; + case SS_CLASS_VOICE: + classx =1; + break; + case SS_CLASS_ALL_DATA_TELE: + classx =2; + break; + case SS_CLASS_FAX: + classx =4; + break; + case SS_CLASS_SMS: + classx = 8; + break; + case SS_CLASS_ALL_CS_SYNC: + classx = 16; + break; + + default: + classx =7; + dbg("unsupported class %d. set to default : 7", class); + break; + } + + + if(classx ==7) + cmd_str = g_strdup_printf("AT+CLCK=\"%s\",%d%s", facility, opco,"\r"); + else + cmd_str = g_strdup_printf("AT+CLCK=\"%s\",%d,,%d%s", facility, opco,classx,"\r"); + + dbg("request command : %s", cmd_str); + + user_data = g_new0( struct ss_confirm_info, 1 ); + user_data->resp = resp; + + user_data->flavor_type = (int)(mode); + user_data->class = class; + + ret = _ss_request_message( o, ur, cmd_str, strlen(cmd_str), on_response_ss_barring_get, user_data ); + + g_free(cmd_str); + + if ( !ret ) + return TCORE_RETURN_FAILURE; + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_barring_activate( CoreObject *o, UserRequest *ur ) +{ + return _ss_barring_set( o, ur, TIZEN_SS_OPCO_ACTIVATE ); +} + +static TReturn s_ss_barring_deactivate( CoreObject *o, UserRequest *ur ) +{ + return _ss_barring_set( o, ur, TIZEN_SS_OPCO_DEACTIVATE ); +} + +static TReturn s_ss_barring_change_password( CoreObject *o, UserRequest *ur ) +{ + TcorePlugin *p = 0; + struct treq_ss_barring_change_password *barring = 0; + + struct ss_confirm_info *user_data = 0; + + gboolean ret = FALSE; + +// struct ATReqMetaInfo metainfo; +// int info_len =0; + char* cmd_str = NULL; + + p = tcore_object_ref_plugin( o ); + barring = (struct treq_ss_barring_change_password*)tcore_user_request_ref_data( ur, 0 ); + + + cmd_str = g_strdup_printf("AT+CPWD=\"%s\",\"%s\",\"%s\"%s", "AB", barring->password_old, barring->password_new,"\r"); + dbg("request command : %s", cmd_str); + + + user_data = g_new0( struct ss_confirm_info, 1 ); + user_data->resp = TRESP_SS_BARRING_CHANGE_PASSWORD; + + ret = _ss_request_message( o, ur, cmd_str, strlen(cmd_str), on_response_ss_barring_change_pwd, user_data ); + + g_free(cmd_str); + if ( !ret ) + return TCORE_RETURN_FAILURE; + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_barring_get_status( CoreObject *o, UserRequest *ur ) +{ + struct treq_ss_barring *barring = 0; + barring = (struct treq_ss_barring*)tcore_user_request_ref_data( ur, 0 ); + + return _ss_barring_get( o, ur, barring->class, barring->mode, TRESP_SS_BARRING_GET_STATUS ); +} + +static TReturn _ss_forwarding_set( CoreObject *o, UserRequest *ur, enum telephony_ss_opcode op ) +{ + TcorePlugin *p = 0; + struct treq_ss_forwarding *forwarding = 0; + + struct ss_confirm_info *user_data = 0; + + gboolean ret = FALSE; + int len = 0; + + struct ATReqMetaInfo metainfo; + int info_len =0; + char* cmd_str = NULL; + char* tmp_str = NULL; + int reason=0,mode=0,num_type=0, classx=0,time=0; + gboolean valid_num = FALSE; + + dbg("_ss_forwarding_set with opco %d ", op); + + + forwarding = (struct treq_ss_forwarding*) tcore_user_request_ref_data( ur, 0 ); + p = tcore_object_ref_plugin( o ); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + switch(forwarding->mode) + { + case SS_CF_MODE_CFU: + reason =0; + break; + case SS_CF_MODE_CFB: + reason =1; + break; + case SS_CF_MODE_CFNRy: + reason =2; + break; + case SS_CF_MODE_CFNRc: + reason =3; + break; + case SS_CF_MODE_CF_ALL: + reason = 4; + break; + case SS_CF_MODE_CFC: + reason = 5; + break; + + default: + dbg("unsupported reason : %d"); + break; + } + + switch(op){ + case TIZEN_SS_OPCO_DEACTIVATE: + mode = 0; + break; + case TIZEN_SS_OPCO_ACTIVATE: + mode = 1; + break; + case TIZEN_SS_OPCO_REG: + mode = 3; + break; + case TIZEN_SS_OPCO_DEREG: + mode = 4; + break; + + default: + dbg("unsupported opco : %d", op); + return TCORE_RETURN_FAILURE; + } + + +// class + switch(forwarding->class) + { + case SS_CLASS_ALL_TELE: + classx =7; + break; + case SS_CLASS_VOICE: + classx =1; + break; + case SS_CLASS_ALL_DATA_TELE: + classx =2; + break; + case SS_CLASS_FAX: + classx =4; + break; + case SS_CLASS_SMS: + classx = 8; + break; + case SS_CLASS_ALL_CS_SYNC: + classx = 16; + break; + + default: + classx =7; + dbg("unsupported class %d. set to default : 7", forwarding->class); + break; + } + +//number + len = strlen(forwarding->number); + if ( len > 0 ){ + valid_num = TRUE; + if ( forwarding->number[0] == '+' ) + num_type = ((TIZEN_NUM_TYPE_INTERNATIONAL << 4)|TIZEN_NUM_PLAN_ISDN); + else + num_type = 0; + } + user_data = g_new0( struct ss_confirm_info, 1 ); + + switch ( op ) { + case TIZEN_SS_OPCO_REG: + user_data->resp = TRESP_SS_FORWARDING_REGISTER; + break; + case TIZEN_SS_OPCO_DEREG: + user_data->resp = TRESP_SS_FORWARDING_DEREGISTER; + break; + case TIZEN_SS_OPCO_ACTIVATE: + user_data->resp = TRESP_SS_FORWARDING_ACTIVATE; + break; + case TIZEN_SS_OPCO_DEACTIVATE: + user_data->resp = TRESP_SS_FORWARDING_DEACTIVATE; + break; + default: + dbg("[ error ] unknown op ( 0x%x )", op ); + break; + } + + if(op == TIZEN_SS_OPCO_REG) + tmp_str = g_strdup_printf("AT+CCFC=%d,%d,\"%s\",%d,%d", reason, mode, forwarding->number, num_type, classx); + else// other opcode does not need num field + tmp_str = g_strdup_printf("AT+CCFC=%d,%d,,,%d", reason, mode, classx); + + + if(forwarding->mode == SS_CF_MODE_CFNRy){ + //add time info to 'no reply' case + time = (int)(forwarding->time); + cmd_str = g_strdup_printf("%s,,,%d%s", tmp_str,time,"\r"); + } + else { + cmd_str = g_strdup_printf("%s%s", tmp_str,"\r"); + } + + dbg("request command : %s", cmd_str); + + + + user_data->flavor_type = forwarding->mode; + user_data->class = forwarding->class; + + ret = _ss_request_message( o, ur, cmd_str, strlen(cmd_str), on_response_ss_forwarding_set, user_data ); + g_free(tmp_str); + g_free(cmd_str); + + if ( !ret ) + return TCORE_RETURN_FAILURE; + + return TCORE_RETURN_SUCCESS; +} + +static TReturn _ss_forwarding_get( CoreObject *o, + UserRequest *ur, + enum telephony_ss_class class, + enum telephony_ss_forwarding_mode type, + enum tcore_response_command resp ) +{ + TcorePlugin *p = 0; + struct ss_confirm_info *user_data = 0; + + gboolean ret = FALSE; +// int len = 0; + + struct ATReqMetaInfo metainfo; + int info_len=0, reason=0, mode=0, classx =0; + char* cmd_str = NULL; + + p = tcore_object_ref_plugin( o ); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = MULTILINE; + memcpy(metainfo.responsePrefix,"+CCFC:",strlen("+CCFC:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + switch(type) + { + case SS_CF_MODE_CFU: + reason =0; + break; + case SS_CF_MODE_CFB: + reason =1; + break; + case SS_CF_MODE_CFNRy: + reason =2; + break; + case SS_CF_MODE_CFNRc: + reason =3; + break; + case SS_CF_MODE_CF_ALL: + reason = 4; + break; + case SS_CF_MODE_CFC: + reason = 5; + break; + + default: + dbg("unsupported reason : %d"); + break; + } + + switch(class) + { + case SS_CLASS_ALL_TELE: + classx =7; + break; + case SS_CLASS_VOICE: + classx =1; + break; + case SS_CLASS_ALL_DATA_TELE: + classx =2; + break; + case SS_CLASS_FAX: + classx =4; + break; + case SS_CLASS_SMS: + classx = 8; + break; + case SS_CLASS_ALL_CS_SYNC: + classx = 16; + break; + default: + classx =7; + dbg("unsupported class %d. set to default : 7", class); + break; + } + + //query status - mode set to 2 + mode =2; + + user_data = g_new0( struct ss_confirm_info, 1 ); + user_data->resp = resp; + + user_data->class = class; + user_data->flavor_type = type; + + if(classx ==7) + cmd_str = g_strdup_printf("AT+CCFC=%d,%d%s", reason, mode,"\r"); + else + cmd_str = g_strdup_printf("AT+CCFC=%d,%d,,,%d%s", reason, mode,classx,"\r"); + + dbg("request command : %s", cmd_str); + ret = _ss_request_message( o, ur, cmd_str, strlen(cmd_str), on_response_ss_forwarding_get, user_data ); + g_free(cmd_str); + + if ( !ret ) + return TCORE_RETURN_FAILURE; + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_forwarding_activate( CoreObject *o, UserRequest *ur ) +{ + return _ss_forwarding_set( o, ur, TIZEN_SS_OPCO_ACTIVATE ); +} + +static TReturn s_ss_forwarding_deactivate( CoreObject *o, UserRequest *ur ) +{ + return _ss_forwarding_set( o, ur, TIZEN_SS_OPCO_DEACTIVATE ); +} + +static TReturn s_ss_forwarding_register( CoreObject *o, UserRequest *ur ) +{ + return _ss_forwarding_set( o, ur, TIZEN_SS_OPCO_REG ); +} + +static TReturn s_ss_forwarding_deregister( CoreObject *o, UserRequest *ur ) +{ + return _ss_forwarding_set( o, ur, TIZEN_SS_OPCO_DEREG ); +} + +static TReturn s_ss_forwarding_get_status( CoreObject *o, UserRequest *ur ) +{ + struct treq_ss_forwarding *forwarding = 0; + forwarding = (struct treq_ss_forwarding*)tcore_user_request_ref_data( ur, 0 ); + + return _ss_forwarding_get( o, ur, forwarding->class, forwarding->mode, TRESP_SS_FORWARDING_GET_STATUS ); +} + +static TReturn _ss_waiting_set( CoreObject *o, UserRequest *ur, enum telephony_ss_opcode opco ) +{ + TcorePlugin *p = 0; + struct treq_ss_waiting *waiting = 0; + + struct ss_confirm_info *user_data = 0; + + gboolean ret = FALSE; + int mode=0, classx=0; + char* cmd_str; + struct ATReqMetaInfo metainfo; + +//set metainfo + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + + tcore_user_request_set_metainfo(ur, sizeof(struct ATReqMetaInfo), &metainfo); + + p = tcore_object_ref_plugin( o ); + + waiting = (struct treq_ss_waiting*) tcore_user_request_ref_data( ur, 0 ); + + user_data = g_new0( struct ss_confirm_info, 1 ); + + if ( opco == TIZEN_SS_OPCO_ACTIVATE ){ + user_data->resp = TRESP_SS_WAITING_ACTIVATE; + mode = 1;//enable + } + else if ( opco == TIZEN_SS_OPCO_DEACTIVATE ){ + user_data->resp = TRESP_SS_WAITING_DEACTIVATE; + mode =0; //diable + } + else + dbg("[ error ] unknown ss mode (0x%x)", opco); + +switch(waiting->class) + { + case SS_CLASS_ALL_TELE: + classx =7; + break; + case SS_CLASS_VOICE: + classx =1; + break; + case SS_CLASS_ALL_DATA_TELE: + classx =2; + break; + case SS_CLASS_FAX: + classx =4; + break; + case SS_CLASS_SMS: + classx = 8; + break; + + default: + classx =7; + dbg("unsupported class %d. set to default : 7", waiting->class); + break; + } + + + user_data->class = waiting->class; + user_data->flavor_type = (int)opco; + + cmd_str = g_strdup_printf("AT+CCWA=1,%d,%d%s", mode, classx,"\r"); //always enable +CCWA: unsolicited cmd + dbg("request command : %s",cmd_str); + + ret = _ss_request_message( o, ur, cmd_str, strlen(cmd_str), on_response_ss_waiting_set, user_data ); + + g_free(cmd_str); + if ( !ret ) + return TCORE_RETURN_FAILURE; + + return TCORE_RETURN_SUCCESS; +} + +static TReturn _ss_waiting_get( CoreObject *o, + UserRequest *ur, + enum telephony_ss_class class, + enum tcore_response_command resp ) +{ + TcorePlugin *p = 0; + + struct ss_confirm_info *user_data = 0; + + gboolean ret = FALSE; + int classx, info_len=0;//mode, + char* cmd_str; + struct ATReqMetaInfo metainfo; + +//set metainfo + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = MULTILINE; + memcpy(metainfo.responsePrefix,"+CCWA:",strlen("+CCWA:")); + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, sizeof(struct ATReqMetaInfo), &metainfo); + + p = tcore_object_ref_plugin( o ); + + switch(class) + { + case SS_CLASS_ALL_TELE: + classx =7; + break; + case SS_CLASS_VOICE: + classx =1; + break; + case SS_CLASS_ALL_DATA_TELE: + classx =2; + break; + case SS_CLASS_FAX: + classx =4; + break; + case SS_CLASS_SMS: + classx = 8; + break; + + default: + classx =7; + dbg("unsupported class %d. set to default : 7", class); + break; + } + + dbg("allocating user data"); + user_data = g_new0( struct ss_confirm_info, 1 ); + user_data->resp = resp; + user_data->class = class; + + cmd_str = g_strdup_printf("AT+CCWA=1,2,%d%s", classx,"\r"); //always enable +CCWA: unsolicited cmd , mode is fixed to 2(query status) + dbg("request cmd : %s", cmd_str); + + ret = _ss_request_message( o, ur, cmd_str, strlen(cmd_str), on_response_ss_waiting_get, user_data ); + + g_free(cmd_str); + + if ( !ret ) + return TCORE_RETURN_FAILURE; + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_waiting_activate( CoreObject *o, UserRequest *ur ) +{ + return _ss_waiting_set( o, ur, TIZEN_SS_OPCO_ACTIVATE ); +} + +static TReturn s_ss_waiting_deactivate( CoreObject *o, UserRequest *ur ) +{ + return _ss_waiting_set( o, ur, TIZEN_SS_OPCO_DEACTIVATE ); +} + +static TReturn s_ss_waiting_get_status( CoreObject *o, UserRequest *ur ) +{ + struct treq_ss_waiting *waiting = 0; + waiting = (struct treq_ss_waiting*)tcore_user_request_ref_data( ur, 0 ); + + return _ss_waiting_get( o, ur, waiting->class, TRESP_SS_WAITING_GET_STATUS ); +} + +static TReturn s_ss_cli_activate( CoreObject *o, UserRequest *ur ) +{ + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_cli_deactivate( CoreObject *o, UserRequest *ur ) +{ + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_cli_get_status( CoreObject *o, UserRequest *ur ) +{ + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_send_ussd( CoreObject *o, UserRequest *ur ) +{ + TcorePlugin *p = 0; + UssdSession *ussd_s = 0; + + struct treq_ss_ussd *ussd = 0; + struct ss_confirm_info *user_data = 0; + + gboolean ret = FALSE; + char* cmd_str; + struct ATReqMetaInfo metainfo; + +//set metainfo + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + tcore_user_request_set_metainfo(ur, sizeof(struct ATReqMetaInfo), &metainfo); + + p = tcore_object_ref_plugin(o); + ussd = (struct treq_ss_ussd*)tcore_user_request_ref_data( ur, 0 ); + + cmd_str = g_strdup_printf("AT+CUSD=1,\"%s\",%d%s", ussd->str, 0x0f,"\r"); //always enable +CUSD: unsolicited cmd. set to dcs to 0x0f. only supports HEX type + dbg("request command : %s",cmd_str); + + + user_data = g_new0( struct ss_confirm_info, 1 ); + user_data->resp = TRESP_SS_SEND_USSD; + + ussd_s = tcore_ss_ussd_get_session( o ); + if ( !ussd_s ) { + tcore_ss_ussd_create_session( o, (enum tcore_ss_ussd_type)ussd->type, (void*)tcore_user_request_dup(ur), 0 ); + } else { + + if ( ussd->type == SS_USSD_TYPE_USER_INITIATED ) { + dbg("[ error ] ussd session is already exist"); + + g_free( user_data ); + return TCORE_RETURN_FAILURE; + } + + tcore_ss_ussd_set_session_type( ussd_s, (enum tcore_ss_ussd_type)ussd->type); + } + + ret = _ss_request_message( o, ur, cmd_str, strlen(cmd_str), on_confirmation_ss_ussd, user_data ); + + if ( !ret ) + return TCORE_RETURN_FAILURE; + + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_set_aoc( CoreObject *o, UserRequest *ur ) +{ + dbg("[ error ] unsupported function"); + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_get_aoc( CoreObject *o, UserRequest *ur ) +{ + dbg("[ error ] unsupported function"); + return TCORE_RETURN_SUCCESS; +} + +static struct tcore_call_control_operations call_ops = { + .answer_hold_and_accept = s_ss_manage_call_2_send, + .answer_replace = s_ss_manage_call_1_send, + .answer_reject = s_ss_manage_call_0_send, + .end_specific = s_ss_manage_call_1x_send, + .end_all_active = s_ss_manage_call_1_send, + .end_all_held = s_ss_manage_call_0_send, + .active = s_ss_manage_call_2_send, + .hold = s_ss_manage_call_2_send, + .swap = s_ss_manage_call_2_send, + .join = s_ss_manage_call_3_send, + .split = s_ss_manage_call_2x_send, + .transfer = s_ss_manage_call_4_send, + .deflect = s_ss_manage_call_4dn_send, +}; + +static TReturn s_ss_manage_call_0_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup_printf("%s%s", "AT+CHLD=0", "\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_manage_call_1_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup_printf("%s%s", "AT+CHLD=1", "\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_manage_call_1x_send( CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup_printf("%s%d%s", "AT+CHLD=1", id,"\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_manage_call_2_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup_printf("%s%s", "AT+CHLD=2", "\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_manage_call_2x_send( CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup_printf("%s%d%s", "AT+CHLD=2", id,"\r"); + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_manage_call_3_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ) +{ +// gboolean ret = FALSE; + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + GSList *l = 0; + CallObject *co = 0; + int id = 0; + + l = tcore_call_object_find_by_status( o, CALL_STATUS_ACTIVE ); + if ( !l || !l->data ) { + dbg("[ error ] there is no call status [ call_active ]"); + return TCORE_RETURN_FAILURE; + } + + co = l->data; + id = tcore_call_object_get_id( co ); + dbg("active call id : [ %d ]"); + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + cmd_str = g_strdup_printf("%s%s", "AT+CHLD=3","\r"); + + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_manage_call_4_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + + cmd_str = g_strdup_printf("%s%s", "AT+CHLD=4", "\r"); + + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_manage_call_4dn_send( CoreObject* o, UserRequest* ur, const char* number, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + + cmd_str = g_strdup_printf("%s%s%s", "AT+CHLD=4", number,"\r"); + + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +#if 0 +static TReturn s_ss_manage_call_5_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + + cmd_str = g_strdup_printf("%s%s", "AT+CHLD=5", "\r"); + + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} + +static TReturn s_ss_manage_call_6_send( CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data ) +{ + TcorePlugin *p = NULL; + TcoreHal *h = NULL; + TcorePending *pending = NULL; + char* cmd_str = NULL; + struct ATReqMetaInfo metainfo; + int info_len =0; + + p = tcore_object_ref_plugin(o); + h = tcore_plugin_ref_hal(p); + + memset(&metainfo, 0, sizeof(struct ATReqMetaInfo)); + metainfo.type = NO_RESULT; + metainfo.responsePrefix[0] ='\0'; + info_len = sizeof(struct ATReqMetaInfo); + + tcore_user_request_set_metainfo(ur, info_len, &metainfo); + + + cmd_str= g_strdup_printf("%s%s", "AT+CHLD=6", "\r"); + + dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str)); + + pending = tcore_pending_new(o, ID_RESERVED_AT); + tcore_pending_set_request_data(pending, strlen(cmd_str), cmd_str); + g_free(cmd_str); + tcore_pending_set_timeout(pending, 0); + tcore_pending_set_response_callback(pending, (TcorePendingResponseCallback)cb, user_data); + tcore_pending_link_user_request(pending, ur); + tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT); + + tcore_pending_set_send_callback(pending, on_confirmation_call_control_ss_message_send, NULL); + + + tcore_hal_send_request(h, pending); + + return TCORE_RETURN_SUCCESS; +} +#endif + + +gboolean s_ss_init( TcorePlugin *p ) +{ + CoreObject *so = 0, *co = 0; + struct property_call_info *data = 0; + + dbg("s_ss_init()"); + + so = tcore_ss_new( p, "ss", &ss_ops ); + if (!so) { + dbg("[ error ] ss_new()"); + return FALSE; + } + + co = tcore_plugin_ref_core_object(p, "call"); + if (!co) { + dbg("[ error ] plugin_ref_core_object"); + return FALSE; + } + + tcore_call_control_set_operations( co, &call_ops ); + + tcore_object_add_callback( so, EVENT_SS_INFO, on_notification_ss_info, 0 ); + tcore_object_add_callback( so, EVENT_SS_USSD, on_notification_ss_ussd, 0 ); + + data = calloc( sizeof(struct property_call_info *), 1); + tcore_plugin_link_property(p, "SS", data); + + return TRUE; +} + +void s_ss_exit( TcorePlugin *p ) +{ + CoreObject *o; +// TcoreHal *h; + struct property_network_info *data; + + o = tcore_plugin_ref_core_object(p, "ss"); + + data = tcore_plugin_ref_property(p, "SS"); + if (data) + free(data); + + tcore_ss_free(o); +} -- 2.34.1