OSDN Git Service

Port Mock Ril from master branch to GB. DO NOT MERGE
authorXia Wang <xiaw@google.com>
Wed, 6 Oct 2010 02:29:48 +0000 (19:29 -0700)
committerXia Wang <xiaw@google.com>
Wed, 6 Oct 2010 03:50:02 +0000 (20:50 -0700)
- Replace functions in protobuf_v8.cpp, node_buffer.cpp with those in v8 version of GB:
  replace Object::Get(uint32_t index) with Object::Get(Handle<Value> key)
  replace As function with Object::Cast();
- Modify Android.mk file
  Add "LOCAL_MODULE_TAGS" for librilproto-java
  Tag modules as "debug" so that it can be build in userdebug build

Change-Id: I1523786a63ef66b263b80e069dfcab865cab348f

66 files changed:
mock-ril/.gitignore [new file with mode: 0644]
mock-ril/Android.mk [new file with mode: 0644]
mock-ril/MODULE_LICENSE_APACHE2 [new file with mode: 0644]
mock-ril/Makefile [new file with mode: 0644]
mock-ril/NOTICE [new file with mode: 0644]
mock-ril/README.txt [new file with mode: 0644]
mock-ril/src/cpp/ctrl_server.cpp [new file with mode: 0644]
mock-ril/src/cpp/ctrl_server.h [new file with mode: 0644]
mock-ril/src/cpp/experiments.cpp [new file with mode: 0644]
mock-ril/src/cpp/experiments.h [new file with mode: 0644]
mock-ril/src/cpp/js_support.cpp [new file with mode: 0644]
mock-ril/src/cpp/js_support.h [new file with mode: 0644]
mock-ril/src/cpp/logging.h [new file with mode: 0644]
mock-ril/src/cpp/mock_ril.cpp [new file with mode: 0644]
mock-ril/src/cpp/mock_ril.h [new file with mode: 0644]
mock-ril/src/cpp/msgheader.pb.cpp [new file with mode: 0644]
mock-ril/src/cpp/msgheader.pb.h [new file with mode: 0644]
mock-ril/src/cpp/node_buffer.cpp [new file with mode: 0644]
mock-ril/src/cpp/node_buffer.h [new file with mode: 0644]
mock-ril/src/cpp/node_object_wrap.h [new file with mode: 0644]
mock-ril/src/cpp/node_util.cpp [new file with mode: 0644]
mock-ril/src/cpp/node_util.h [new file with mode: 0644]
mock-ril/src/cpp/protobuf_v8.cpp [new file with mode: 0644]
mock-ril/src/cpp/protobuf_v8.h [new file with mode: 0644]
mock-ril/src/cpp/requests.cpp [new file with mode: 0644]
mock-ril/src/cpp/requests.h [new file with mode: 0644]
mock-ril/src/cpp/responses.cpp [new file with mode: 0644]
mock-ril/src/cpp/responses.h [new file with mode: 0644]
mock-ril/src/cpp/status.h [new file with mode: 0644]
mock-ril/src/cpp/util.cpp [new file with mode: 0644]
mock-ril/src/cpp/util.h [new file with mode: 0644]
mock-ril/src/cpp/v8_extension.cc~ [new file with mode: 0644]
mock-ril/src/cpp/worker.cpp [new file with mode: 0644]
mock-ril/src/cpp/worker.h [new file with mode: 0644]
mock-ril/src/cpp/worker_v8.cpp [new file with mode: 0644]
mock-ril/src/cpp/worker_v8.h [new file with mode: 0644]
mock-ril/src/generated/cpp/ctrl.pb.cpp [new file with mode: 0644]
mock-ril/src/generated/cpp/ctrl.pb.h [new file with mode: 0644]
mock-ril/src/generated/cpp/msgheader.pb.cpp [new file with mode: 0644]
mock-ril/src/generated/cpp/msgheader.pb.h [new file with mode: 0644]
mock-ril/src/generated/cpp/ril.pb.cpp [new file with mode: 0644]
mock-ril/src/generated/cpp/ril.pb.h [new file with mode: 0644]
mock-ril/src/generated/desc/ctrl.desc [new file with mode: 0644]
mock-ril/src/generated/desc/msgheader.desc [new file with mode: 0644]
mock-ril/src/generated/desc/ril.desc [new file with mode: 0644]
mock-ril/src/generated/java/com/android/internal/communication/MsgHeader.java [new file with mode: 0644]
mock-ril/src/generated/java/com/android/internal/telephony/ril_proto/RilCmds.java [new file with mode: 0644]
mock-ril/src/generated/java/com/android/internal/telephony/ril_proto/RilCtrlCmds.java [new file with mode: 0644]
mock-ril/src/generated/python/ctrl_pb2.py [new file with mode: 0644]
mock-ril/src/generated/python/msgheader_pb2.py [new file with mode: 0644]
mock-ril/src/generated/python/ril_pb2.py [new file with mode: 0644]
mock-ril/src/java/com/android/internal/communication/Msg.java [new file with mode: 0644]
mock-ril/src/java/com/android/internal/telephony/RilChannel.java [new file with mode: 0644]
mock-ril/src/js/ctrl_server.js [new file with mode: 0644]
mock-ril/src/js/ctrl_server_tests.js [new file with mode: 0644]
mock-ril/src/js/mock_ril.js [new file with mode: 0644]
mock-ril/src/js/mock_ril_tests.js [new file with mode: 0644]
mock-ril/src/js/ril_vars.js [new file with mode: 0644]
mock-ril/src/js/simulated_icc.js [new file with mode: 0644]
mock-ril/src/js/simulated_icc_tests.js [new file with mode: 0644]
mock-ril/src/js/simulated_radio.js [new file with mode: 0644]
mock-ril/src/js/simulated_radio_tests.js [new file with mode: 0644]
mock-ril/src/proto/ctrl.proto [new file with mode: 0644]
mock-ril/src/proto/msgheader.proto [new file with mode: 0644]
mock-ril/src/proto/ril.proto [new file with mode: 0644]
mock-ril/src/python/tcs.py [new file with mode: 0755]

diff --git a/mock-ril/.gitignore b/mock-ril/.gitignore
new file mode 100644 (file)
index 0000000..d18402d
--- /dev/null
@@ -0,0 +1,2 @@
+*.pyc
+.*.swp
diff --git a/mock-ril/Android.mk b/mock-ril/Android.mk
new file mode 100644 (file)
index 0000000..daa8e43
--- /dev/null
@@ -0,0 +1,95 @@
+# Copyright 2010 The Android Open Source Project
+#
+# not currently building V8 for x86 targets
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(TARGET_ARCH),arm)
+
+# Mock-ril only buid for debug variants
+ifneq ($(filter userdebug eng tests, $(TARGET_BUILD_VARIANT)),)
+
+include $(CLEAR_VARS)
+
+# Directories of source files
+src_cpp=src/cpp
+src_java=src/java
+src_py=src/py
+src_js=src/js
+src_proto=src/proto
+src_generated=src/generated
+
+# Directories of generated source files
+gen_src_cpp=$(src_generated)/cpp
+gen_src_java=$(src_generated)/java
+gen_src_py=$(src_generated)/python
+gen_src_desc=$(src_generated)/desc
+
+LOCAL_SRC_FILES:= \
+    $(src_cpp)/ctrl_server.cpp \
+    $(src_cpp)/experiments.cpp \
+    $(src_cpp)/js_support.cpp \
+    $(src_cpp)/mock_ril.cpp \
+    $(src_cpp)/node_buffer.cpp \
+    $(src_cpp)/node_util.cpp \
+    $(src_cpp)/protobuf_v8.cpp \
+    $(src_cpp)/responses.cpp \
+    $(src_cpp)/requests.cpp \
+    $(src_cpp)/util.cpp \
+    $(src_cpp)/worker.cpp \
+    $(src_cpp)/worker_v8.cpp \
+    $(gen_src_cpp)/ril.pb.cpp \
+    $(gen_src_cpp)/ctrl.pb.cpp \
+    $(gen_src_cpp)/msgheader.pb.cpp
+
+
+LOCAL_SHARED_LIBRARIES := \
+    libz libcutils libutils libril
+
+LOCAL_STATIC_LIBRARIES := \
+    libprotobuf-cpp-2.3.0-full libv8
+
+LOCAL_CFLAGS := -D_GNU_SOURCE -UNDEBUG -DGOOGLE_PROTOBUF_NO_RTTI -DRIL_SHLIB
+
+LOCAL_C_INCLUDES := \
+    $(LOCAL_PATH)/$(src_cpp) \
+    $(LOCAL_PATH)/$(gen_src_cpp) \
+    external/protobuf/src \
+    external/v8/include \
+    bionic \
+    $(KERNEL_HEADERS)
+
+# stlport conflicts with the host stl library
+ifneq ($(TARGET_SIMULATOR),true)
+LOCAL_SHARED_LIBRARIES += libstlport
+LOCAL_C_INCLUDES += external/stlport/stlport
+endif
+
+# build shared library but don't require it be prelinked
+# __BSD_VISIBLE for htolexx macros.
+LOCAL_STRIP_MODULE := true
+LOCAL_PRELINK_MODULE := false
+LOCAL_LDLIBS += -lpthread
+LOCAL_CFLAGS += -DMOCK_RIL -D__BSD_VISIBLE
+LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE:= libmock_ril
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif
+
+endif
+
+# Java librilproto
+# =======================================================
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE := librilproto-java
+
+LOCAL_STATIC_JAVA_LIBRARIES := libprotobuf-java-2.3.0-micro
+
+LOCAL_SRC_FILES := $(call all-java-files-under, $(src_java) $(gen_src_java))
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+# =======================================================
diff --git a/mock-ril/MODULE_LICENSE_APACHE2 b/mock-ril/MODULE_LICENSE_APACHE2
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mock-ril/Makefile b/mock-ril/Makefile
new file mode 100644 (file)
index 0000000..c03e765
--- /dev/null
@@ -0,0 +1,182 @@
+# This has various targets to assist in developing
+# and testing the mock ril. The default "all" target
+# invokes protoc to generate the appropriate protobuf
+# code. The other targest are used for testing.
+
+# Assume this Makefile is run in place then top
+# point to the top of the android source tree
+top=../../../
+
+# Directories of source files
+src_java=src/java
+src_cpp=src/cpp
+src_py=src/py
+src_js=src/js
+src_proto=src/proto
+src_generated=src/generated
+
+# Directories of generated source files
+gen_src_cpp=$(src_generated)/cpp
+gen_src_java=$(src_generated)/java
+gen_src_py=$(src_generated)/python
+gen_src_desc=$(src_generated)/desc
+
+# Generated files
+generated=$(gen_src_cpp)/msgheader.pb.cpp $(gen_src_cpp)/msgheader.pb.h $(gen_src_desc)/msgheader.desc \
+      $(gen_src_py)/msgheader_pb2.py $(gen_src_java)/com/android/internal/communication/MsgHeader.java \
+      $(gen_src_cpp)/ril.pb.cpp $(gen_src_cpp)/ril.pb.h $(gen_src_desc)/ril.desc \
+      $(gen_src_py)/ril_pb2.py $(gen_src_java)/com/android/internal/telephony/ril_proto/RilCmds.java \
+      $(gen_src_cpp)/ctrl.pb.cpp $(gen_src_cpp)/ctrl.pb.h $(gen_src_desc)/ctrl.desc \
+      $(gen_src_py)/ctrl_pb2.py $(gen_src_java)/com/android/internal/telephony/ril_proto/RilCtrlCmds.java
+
+# A Makefile to run protoc and simplify testing.
+.PHONY : all
+all : $(generated)
+
+# TODO: Document/cleanup these testing targets as we learn whats needed.
+
+# Make the unit tests
+.PHONY : ut
+ut :
+       source $(top)build/envsetup.sh ; mmm $(top)frameworks/base/telephony/tests/telephonytests
+       adb install -r $(top)out/target/product/passion/data/app/FrameworksTelephonyTests.apk
+
+t : $(gen_src_cpp)/msgheader.pb.cpp $(gen_src_desc)/msgheader.desc $(gen_src_py)/msgheader_pb2.py $(gen_src_java)/com/android/internal/communication/MsgHeader.java
+
+# Run protoc to create the c++ files for msgheader
+$(gen_src_cpp)/msgheader.pb.cpp $(gen_src_cpp)/msgheader.pb.h : $(src_proto)/msgheader.proto
+       mkdir -p $(gen_src_cpp)
+       protoc --cpp_out=$(gen_src_cpp) --proto_path=$(src_proto) $<
+       mv $(gen_src_cpp)/msgheader.pb.cc $(gen_src_cpp)/msgheader.pb.cpp
+
+# Run protoc to create the python files for msgheader
+$(gen_src_desc)/msgheader.desc : $(src_proto)/msgheader.proto
+       mkdir -p $(gen_src_desc)
+       protoc --descriptor_set_out=$@ --proto_path=$(src_proto) --include_imports $<
+
+# Run protoc to create the pyhton files for msgheader
+$(gen_src_py)/msgheader_pb2.py : $(src_proto)/msgheader.proto
+       mkdir -p $(gen_src_py)
+       protoc --python_out=$(gen_src_py) --proto_path=$(src_proto) $<
+
+# Run protoc to create the java files for ril
+$(gen_src_java)/com/android/internal/communication/MsgHeader.java : $(src_proto)/msgheader.proto
+       mkdir -p $(gen_src_java)
+       protoc --javamicro_out=$(gen_src_java) --proto_path=$(src_proto) $<
+
+# Run protoc to create the c++ files for ril
+$(gen_src_cpp)/ril.pb.cpp $(gen_src_cpp)/ril.pb.h : $(src_proto)/ril.proto
+       mkdir -p $(gen_src_cpp)
+       protoc --cpp_out=$(gen_src_cpp) --proto_path=$(src_proto) $<
+       mv $(gen_src_cpp)/ril.pb.cc $(gen_src_cpp)/ril.pb.cpp
+
+# Run protoc to create the ril descriptor file for ril
+$(gen_src_desc)/ril.desc : $(src_proto)/ril.proto
+       mkdir -p $(gen_src_desc)
+       protoc --descriptor_set_out=$@ --proto_path=$(src_proto) --include_imports $<
+
+# Run protoc to create the pyhton files for ril
+$(gen_src_py)/ril_pb2.py : $(src_proto)/ril.proto
+       mkdir -p $(gen_src_py)
+       protoc --python_out=$(gen_src_py) --proto_path=$(src_proto) $<
+
+# Run protoc to create the java files for ril
+$(gen_src_java)/com/android/internal/telephony/ril_proto/RilCmds.java : $(src_proto)/ril.proto
+       mkdir -p $(gen_src_java)
+       protoc --javamicro_out=$(gen_src_java) --proto_path=$(src_proto) $<
+
+# Run protoc to create the c++ files for control
+$(gen_src_cpp)/ctrl.pb.cpp $(gen_src_cpp)/ctrl.pb.h : $(src_proto)/ctrl.proto
+       mkdir -p $(gen_src_cpp)
+       protoc --cpp_out=$(gen_src_cpp) --proto_path=$(src_proto) $<
+       mv $(gen_src_cpp)/ctrl.pb.cc $(gen_src_cpp)/ctrl.pb.cpp
+
+# Run protoc to create the pyhton files for control
+$(gen_src_py)/ctrl_pb2.py : $(src_proto)/ctrl.proto
+       mkdir -p $(gen_src_py)
+       protoc --python_out=$(gen_src_py) --proto_path=$(src_proto) $<
+
+# Run protoc to create the ctrl descriptor file for control
+$(gen_src_desc)/ctrl.desc : $(src_proto)/ctrl.proto
+       mkdir -p $(gen_src_desc)
+       protoc --descriptor_set_out=$@ --proto_path=$(src_proto) --include_imports $<
+
+# Run protoc to create the java files for ril
+$(gen_src_java)/com/android/internal/telephony/ril_proto/RilCtrlCmds.java : $(src_proto)/ctrl.proto
+       mkdir -p $(gen_src_java)
+       protoc --javamicro_out=$(gen_src_java) --proto_path=$(src_proto) $<
+
+# After starting phone do this first to get lastest ril.desc/proto and setup rild
+.PHONY : first
+first : root_remount copy_all forward
+
+# copy js and descriptors, restart rild and run mockril_tests
+.PHONY : tmr
+tmr : copy_js_desc restart_rild mockril_tests
+
+# Copy all files, restart rild and run mockril_tests
+.PHONY : test
+test : copy_all restart_rild install_mockril_tests mockril_tests
+
+# Restart rild
+.PHONY : restart_rild
+restart_rild :
+       adb shell ps | awk '/rild/ { print $$2 }' | xargs adb shell kill
+
+# Update only the js/copy and restart rild
+.PHONY : tjs
+tjs : copy_js_desc restart_rild
+
+# Run test control server python script
+.PHONY : tcs
+tcs :
+       ./tcs.py 127.0.0.1 11111
+
+# Run the mock ril tests (use adb shell pm list instrumentation to see the Runner)
+.PHONY : mockril_tests
+mockril_tests :
+       adb  shell am instrument -e class 'com.android.internal.telephony.mockril.MockRilTest' -w com.android.frameworks.telephonytests/.TelephonyMockRilTestRunner
+
+# forward the control server tcp port (54312) to a port on the PC side (11111)
+.PHONY : forward
+forward :
+       adb forward tcp:11111 tcp:54312
+
+# change to root and remount device
+.PHONY : root_remount
+root_remount :
+       adb root ; sleep 3 ; adb remount ; adb shell setprop rild.libpath /data/lib/libmock_ril.so
+
+# Copy all files
+.PHONY : copy_all
+copy_all : copy_js_desc copy_mockril
+
+# Copy js and the protobuf descriptor files
+.PHONY : copy_js_desc
+copy_js_desc :
+       adb push $(src_js)/mock_ril.js /sdcard/data/
+       adb push $(src_js)/mock_ril_tests.js /sdcard/data/
+       adb push $(src_js)/simulated_radio.js /sdcard/data/
+       adb push $(src_js)/simulated_radio_tests.js /sdcard/data/
+       adb push $(src_js)/simulated_icc.js /sdcard/data/
+       adb push $(src_js)/simulated_icc_tests.js /sdcard/data/
+       adb push $(src_js)/ctrl_server.js /sdcard/data/
+       adb push $(src_js)/ctrl_server_tests.js /sdcard/data/
+       adb push $(src_js)/ril_vars.js /sdcard/data/
+       adb push $(gen_src_desc)/ril.desc /sdcard/data/
+       adb push $(gen_src_desc)/ctrl.desc /sdcard/data/
+       adb forward tcp:11111 tcp:54312
+
+# Copy the mock ril library
+.PHONY : copy_mockril
+copy_mockril :
+       adb push $(top)out/target/product/passion/system/lib/libmock_ril.so /data/lib/
+
+.PHONY : install_mockril_tests
+install_mockril_tests :
+       adb install -r $(top)out/target/product/passion/data/app/FrameworksTelephonyTests.apk
+
+# Remove generated files
+.PHONY : clean
+clean :
+       rm -f $(generated)
diff --git a/mock-ril/NOTICE b/mock-ril/NOTICE
new file mode 100644 (file)
index 0000000..15930fa
--- /dev/null
@@ -0,0 +1,221 @@
+
+   Copyright (c) 2005-2008, 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.
+
+   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.
+
+
+                                 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
+-------------------------------------------------------------------------
+The following files are copied from http://www.nodejs.obj and modified:
+    node_buffer.h
+    node_buffer.cc (renamed to node_buffer.cpp)
+    node_object_wrap.h
+
+The following files are snippets from http://www.nodejs.obj node.cc/node.h
+    node_util.h
+    node_util.cpp
+
+
+Node's license follows:
+
+Copyright 2009, 2010 Ryan Lienhart Dahl. All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+-------------------------------------------------------------------------
diff --git a/mock-ril/README.txt b/mock-ril/README.txt
new file mode 100644 (file)
index 0000000..32abdd8
--- /dev/null
@@ -0,0 +1,133 @@
+Mock-ril:
+
+Install:
+
+Install protoc see the external/protobuf/INSTALL.txt and
+external/protobuf/python/README.txt. The short answer is:
+
+    $ cd external/protobuf
+    $ ./configure
+    $ make
+    $ make check
+    $ make install
+    $ cd python
+    $ python setup.py install
+
+If you get "from google.protobuf import xxxx" statements
+that google.protobuf is not found you didn't install the
+python support for protobuf. Also on Mac OSX I got an
+error running the protoc tests but installing was fine.
+
+Running/testing:
+
+See "Testing a new ril:" below for general instructions but
+for the mock-ril I've added some targets to the Makefile to
+ease testing.
+
+Execute the "first" target first to setup appropriate
+environment:
+  $ cd hardware/ril/mock-ril
+  $ make first
+
+If changes made to ".proto" files run make with the default
+"all" target:
+  $ make
+
+If changes are made to "c++" file create a new library and
+run the "test" target:
+  $ mm
+  $ make test
+
+If changes to only the execute "js" target:
+  $ make js
+
+To run the test control server:
+  $ make tcs
+
+Implementation:
+
+The mock-ril is a library where the ril is implemented primarily
+in javascript, mock-ril.js. In addition it can be controlled by
+sending messages from another computer to port 54312 (TODO make
+programmable) to the ctrlServer, a Worker in In mock-ril.js.
+
+See mock_ril.js for additional documentation.
+
+files:
+  ctrl.proto                    Protobuf messages for the control server
+  ctrl.*                        Protobuf generated files.
+  ctrl_pb2.py                   Python files generated from ctrl.proto
+  ctrl_server.*                 Cpp interface routines between ctrlServer
+                                in javascript and the controller.
+  experiments.*                 Early experiments
+  js_support.*                  Java script support methods. Exposes various
+                                routines to javascript, such as print, readFile
+                                and include.
+  logging.h                     LOG_TAG and include utils/log.h
+  mock_ril.[cpp|h]              Main module inteface code.
+  mock_ril.js                   The mock ril
+  node_buffer.*                 A Buffer for communicating between c++ and js.
+                                This was ported from nodejs.org.
+  node_object.*                 An object wrapper to make it easier to expose
+                                c++ code to js. Ported from nodejs.org.
+  node_util.*                   Some utilities ported from nodejs.org.
+  protobuf_v8.*                 Protobuf code for javascript ported from
+                                http://code.google.com/p/protobuf-for-node/.
+  requests.*                    Interface code for handling framework requests.
+  responses*                    Interface code for handling framework responses.
+  ril.proto                     The protobuf version of ril.h
+  ril_vars.js                   Some additional variables defined for enums in
+                                ril.h.
+  ril_pb2.py                    Python files generated from ril.proto.
+  status.h                      STATUS constants.
+  tcs.py                        Test the ctrlServer.
+  util.*                        Utility routines
+  worker.*                      Define WorkerThread and WorkerQueue.
+  worker_v8.*                   Expose WorkerQueue to js.
+
+
+TODO: more documentation.
+
+
+Testing a new ril:
+
+The Makefile is used to generate files and make testing easier.
+I has several targets:
+
+all         runs protoc and generates files, ril.desc ril.pb.*
+
+clean       target removes generated files.
+
+first       changes to root, remounts r/w and copies some files.
+
+test        copies the latest libmock_ril.so and kills rild
+            to run the new mockril
+
+General instructions for testing ril's:
+
+1) On the device login in as root and remount file system so it's read/write:
+     $ adb root
+     restarting adbd as root
+
+     $ adb remount
+     remount succeeded
+
+2) Set rild.libpath to the name of the ril:
+     adb shell setprop rild.libpath /system/lib/libmock_ril.so
+
+  Using setprop makes the change temporary and the old ril will be
+  used after rebooting. (Another option is to set rild.libpath in
+  /data/local.prop, but don't forget to reboot for it to take effect).
+
+3) Compile and copy the ril to /system/lib/:
+   adb push out/target/product/passion/system/lib/libmock_ril.so /system/lib/
+
+4) To restart the ril, kill the currently running ril and the new one
+   will automatically be restarted. You can use the ps command to find
+   /system/bin/rild PID, 3212 below and kill it:
+     $ adb shell ps | grep rild
+     radio     3212  1     3224   628   ffffffff afd0e4fc S /system/bin/rild
+
+     $ adb shell kill 3212
+
+5) Make modifications, go to step 3.
diff --git a/mock-ril/src/cpp/ctrl_server.cpp b/mock-ril/src/cpp/ctrl_server.cpp
new file mode 100644 (file)
index 0000000..2dc9634
--- /dev/null
@@ -0,0 +1,473 @@
+/**
+ * Copyright (C) 2010 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 <alloca.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/endian.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include <cutils/sockets.h>
+
+#include "logging.h"
+#include "node_buffer.h"
+#include "status.h"
+#include "util.h"
+#include "worker.h"
+
+#include "msgheader.pb.h"
+
+#include "ctrl.pb.h"
+#include "ctrl_server.h"
+
+//#define CONTROL_SERVER_DEBUG
+#ifdef  CONTROL_SERVER_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+#define MOCK_RIL_CONTROL_SERVER_STOPPING_SOCKET 54311
+#define MOCK_RIL_CONTROL_SERVER_SOCKET 54312
+
+using communication::MsgHeader;
+
+class CtrlServerThread;
+static CtrlServerThread *g_ctrl_server;
+
+class CtrlServerThread : public WorkerThread {
+  private:
+    #define SOCKET_NAME_MOCK_RIL_CST_STOPPER "mock-ril-cst-stopper"
+    v8::Handle<v8::Context> context_;
+    int server_accept_socket_;
+    int server_to_client_socket_;
+    int stop_server_fd_;
+    int stop_client_fd_;
+    int stopper_fd_;
+    fd_set rd_fds_;
+    fd_set wr_fds_;
+    bool done_;
+
+    Buffer *ObtainBuffer(int length) {
+        Buffer *b = Buffer::New(length);
+        return b;
+    }
+
+    int WriteAll(int s, void *data, int length) {
+        int ret_value;
+        uint8_t *bytes = (uint8_t *)data;
+        int count = length;
+
+        while (length > 0) {
+            ret_value = send(s, bytes, length, 0);
+            if (ret_value < 0) {
+                return STATUS_ERR;
+            }
+            if (ret_value == 0) {
+                return STATUS_CLIENT_CLOSED_CONNECTION;
+            }
+            bytes += ret_value;
+            length -= ret_value;
+        }
+
+        return STATUS_OK;
+    }
+
+    int ReadAll(int s, void *data, int length) {
+        int ret_value;
+        uint8_t *bytes = (uint8_t *)data;
+        int count = length;
+
+        while (length != 0) {
+            ret_value = recv(s, bytes, length, 0);
+            if (ret_value < 0) {
+                return STATUS_ERR;
+            }
+            if (ret_value == 0) {
+                return STATUS_CLIENT_CLOSED_CONNECTION;
+            }
+            bytes += ret_value;
+            length -= ret_value;
+        }
+
+        return STATUS_OK;
+    }
+
+    int ReadMessage(MsgHeader *mh, Buffer **pBuffer) {
+        int status;
+        int32_t len_msg_header;
+
+        // Reader header length
+        status = ReadAll(server_to_client_socket_, &len_msg_header, sizeof(len_msg_header));
+        len_msg_header = letoh32(len_msg_header);
+        DBG("rm: read len_msg_header=%d  status=%d", len_msg_header, status);
+        if (status != STATUS_OK) return status;
+
+        // Read header into an array allocated on the stack and unmarshall
+        uint8_t *msg_header_raw = (uint8_t *)alloca(len_msg_header);
+        status = ReadAll(server_to_client_socket_, msg_header_raw, len_msg_header);
+        DBG("rm: read msg_header_raw=%p  status=%d", msg_header_raw, status);
+        if (status != STATUS_OK) return status;
+        mh->ParseFromArray(msg_header_raw, len_msg_header);
+
+        // Read auxillary data
+        Buffer *buffer;
+        if (mh->length_data() > 0) {
+            buffer = ObtainBuffer(mh->length_data());
+            status = ReadAll(server_to_client_socket_, buffer->data(), buffer->length());
+            DBG("rm: read protobuf status=%d", status);
+            if (status != STATUS_OK) return status;
+        } else {
+            DBG("rm: NO protobuf");
+            buffer = NULL;
+        }
+
+        *pBuffer = buffer;
+        return STATUS_OK;
+    }
+
+  public:
+    int WriteMessage(MsgHeader *mh, Buffer *buffer) {
+        int status;
+        uint32_t i;
+        uint64_t l;
+
+        // Set length of data
+        if (buffer == NULL) {
+            mh->set_length_data(0);
+        } else {
+            mh->set_length_data(buffer->length());
+        }
+
+        // Serialize header
+        uint32_t len_msg_header = mh->ByteSize();
+        uint8_t *msg_header_raw = (uint8_t *)alloca(len_msg_header);
+        mh->SerializeToArray(msg_header_raw, len_msg_header);
+
+        // Write length in little endian followed by the header
+        i = htole32(len_msg_header);
+        status = WriteAll(server_to_client_socket_, &i, 4);
+        DBG("wm: write len_msg_header=%d status=%d", len_msg_header, status);
+        if (status != 0) return status;
+        status = WriteAll(server_to_client_socket_, msg_header_raw, len_msg_header);
+        DBG("wm: write msg_header_raw=%p  status=%d", msg_header_raw, status);
+        if (status != 0) return status;
+
+        // Write data
+        if (mh->length_data() > 0) {
+            status = WriteAll(server_to_client_socket_, buffer->data(), buffer->length());
+            DBG("wm: protobuf data=%p len=%d status=%d",
+                    buffer->data(), buffer->length(), status);
+            if (status != 0) return status;
+        }
+
+        return STATUS_OK;
+    }
+
+    CtrlServerThread(v8::Handle<v8::Context> context) :
+            context_(context),
+            server_accept_socket_(-1),
+            server_to_client_socket_(-1),
+            done_(false) {
+    }
+
+    virtual int Run() {
+        DBG("CtrlServerThread::Run E");
+
+        // Create a server socket.
+        server_accept_socket_ = socket_inaddr_any_server(
+            MOCK_RIL_CONTROL_SERVER_SOCKET, SOCK_STREAM);
+        if (server_accept_socket_ < 0) {
+            LOGE("CtrlServerThread::Run error creating server_accept_socket_ '%s'",
+                    strerror(errno));
+            return STATUS_ERR;
+        }
+
+        // Create a server socket that will be used for stopping
+        stop_server_fd_ = socket_loopback_server(
+                MOCK_RIL_CONTROL_SERVER_STOPPING_SOCKET, SOCK_STREAM);
+        if (stop_server_fd_ < 0) {
+            LOGE("CtrlServerThread::Run error creating stop_server_fd_ '%s'",
+                    strerror(errno));
+            return STATUS_ERR;
+        }
+
+        // Create a client socket that will be used for sending a stop
+        stop_client_fd_ = socket_loopback_client(
+                MOCK_RIL_CONTROL_SERVER_STOPPING_SOCKET, SOCK_STREAM);
+        if (stop_client_fd_ < 0) {
+            LOGE("CtrlServerThread::Run error creating stop_client_fd_ '%s'",
+                    strerror(errno));
+            return STATUS_ERR;
+        }
+
+        // Accept the connection of the stop_client_fd_
+        stopper_fd_ = accept(stop_server_fd_, NULL, NULL);
+        if (stopper_fd_ < 0) {
+            LOGE("CtrlServerThread::Run error accepting stop_client_fd '%s'",
+                    strerror(errno));
+            return STATUS_ERR;
+        }
+
+        // Run the new thread
+        int ret_value = WorkerThread::Run(NULL);
+        DBG("CtrlServerThread::Run X");
+        return ret_value;
+    }
+
+    virtual void Stop() {
+        DBG("CtrlServerThread::Stop E");
+        if (BeginStopping()) {
+            done_ = true;
+            int rv = send(stop_client_fd_, &done_, sizeof(done_), 0);
+            if (rv <= 0) {
+                LOGE("CtrlServerThread::Stop could not send stop"
+                            "WE WILL PROBABLY HANG");
+            }
+            WaitUntilStopped();
+        }
+        DBG("CtrlServerThread::Stop X");
+    }
+
+    virtual bool isRunning() {
+        bool rv = done_ || WorkerThread::isRunning();
+        return rv;
+    }
+
+    int WaitOnSocketOrStopping(fd_set *rfds, int s) {
+        DBG("WaitOnSocketOrStopping E s=%d stopper_fd_=%d", s, stopper_fd_);
+        FD_ZERO(rfds);
+        FD_SET(s, rfds);
+        FD_SET(stopper_fd_, rfds);
+        int fd_number = s > stopper_fd_ ? s + 1 : stopper_fd_ + 1;
+        v8::Unlocker unlocker;
+        int rv = select(fd_number, rfds, NULL, NULL, NULL);
+        v8::Locker locker;
+        DBG("WaitOnSocketOrStopping X rv=%d s=%d stopper_fd_=%d", rv, s, stopper_fd_);
+        return rv;
+    }
+
+    int sendToCtrlServer(MsgHeader *mh, Buffer *buffer) {
+        DBG("sendToCtrlServer E: cmd=%d token=%lld", mh->cmd(), mh->token());
+
+        int status = STATUS_OK;
+        v8::HandleScope handle_scope;
+        v8::TryCatch try_catch;
+        try_catch.SetVerbose(true);
+
+        // Get the onRilRequest Function
+        v8::Handle<v8::String> name = v8::String::New("onCtrlServerCmd");
+        v8::Handle<v8::Value> onCtrlServerCmdFunctionValue =
+                context_->Global()->Get(name);
+        v8::Handle<v8::Function> onCtrlServerCmdFunction =
+                v8::Handle<v8::Function>::Cast(onCtrlServerCmdFunctionValue);
+
+        // Create the CmdValue and TokenValue
+        v8::Handle<v8::Value> v8CmdValue = v8::Number::New(mh->cmd());
+        v8::Handle<v8::Value> v8TokenValue = v8::Number::New(mh->token());
+
+        // Invoke onRilRequest
+        const int argc = 3;
+        v8::Handle<v8::Value> buf;
+        if (mh->length_data() == 0) {
+            buf = v8::Undefined();
+        } else {
+            buf = buffer->handle_;
+        }
+        v8::Handle<v8::Value> argv[argc] = {
+                v8CmdValue, v8TokenValue, buf };
+        v8::Handle<v8::Value> result =
+            onCtrlServerCmdFunction->Call(context_->Global(), argc, argv);
+        if (try_catch.HasCaught()) {
+            ReportException(&try_catch);
+            status = STATUS_ERR;
+        } else {
+            v8::String::Utf8Value result_string(result);
+            DBG("sendToCtrlServer result=%s", ToCString(result_string));
+            status = STATUS_OK;
+        }
+
+        if (status != STATUS_OK) {
+            LOGE("sendToCtrlServer Error: status=%d", status);
+            // An error report complete now
+            mh->set_length_data(0);
+            mh->set_status(ril_proto::CTRL_STATUS_ERR);
+            g_ctrl_server->WriteMessage(mh, NULL);
+        }
+
+        DBG("sendToCtrlServer X: status=%d", status);
+        return status;
+    }
+
+    virtual void * Worker(void *param) {
+        DBG("CtrlServerThread::Worker E param=%p stopper_fd_=%d",
+                param, stopper_fd_);
+
+        v8::Locker locker;
+        v8::HandleScope handle_scope;
+        v8::Context::Scope context_scope(context_);
+
+        while (isRunning()) {
+            int ret_value;
+
+            // Wait on either server_accept_socket_ or stopping
+            DBG("CtrlServerThread::Worker wait on server for a client");
+            WaitOnSocketOrStopping(&rd_fds_, server_accept_socket_);
+            if (isRunning() != true) {
+                break;
+            }
+
+            if (FD_ISSET(server_accept_socket_, &rd_fds_)) {
+                server_to_client_socket_ = accept(server_accept_socket_, NULL, NULL);
+                DBG("CtrlServerThread::Worker accepted server_to_client_socket_=%d isRunning()=%d",
+                        server_to_client_socket_, isRunning());
+
+                int status;
+                Buffer *buffer;
+                MsgHeader mh;
+                while ((server_to_client_socket_ > 0) && isRunning()) {
+                    DBG("CtrlServerThread::Worker wait on client for message");
+                    WaitOnSocketOrStopping(&rd_fds_, server_to_client_socket_);
+                    if (isRunning() != true) {
+                        break;
+                    }
+
+                    status = ReadMessage(&mh, &buffer);
+                    if (status != STATUS_OK) break;
+
+                    if (mh.cmd() == ril_proto::CTRL_CMD_ECHO) {
+                        LOGD("CtrlServerThread::Worker echo");
+                        status = WriteMessage(&mh, buffer);
+                        if (status != STATUS_OK) break;
+                    } else {
+                        DBG("CtrlServerThread::Worker sendToCtrlServer");
+                        status = sendToCtrlServer(&mh, buffer);
+                        if (status != STATUS_OK) break;
+                    }
+                }
+                close(server_to_client_socket_);
+                server_to_client_socket_ = -1;
+            }
+        }
+        close(stop_server_fd_);
+        stop_server_fd_ = -1;
+
+        close(stop_client_fd_);
+        stop_client_fd_ = -1;
+
+        close(stopper_fd_);
+        stopper_fd_ = -1;
+
+        close(server_accept_socket_);
+        server_accept_socket_ = -1;
+
+        DBG("CtrlServerThread::Worker X param=%p", param);
+        return NULL;
+    }
+};
+
+/**
+ * Send a control request complete response.
+ */
+v8::Handle<v8::Value> SendCtrlRequestComplete(const v8::Arguments& args) {
+    DBG("SendCtrlRequestComplete E:");
+    v8::HandleScope handle_scope;
+    v8::Handle<v8::Value> retValue;
+
+    void *data;
+    size_t datalen;
+
+    Buffer* buffer;
+    MsgHeader mh;
+
+    /**
+     * Get the arguments. There should be at least 3, reqNum,
+     * ril error code and token. Optionally a Buffer containing
+     * the protobuf representation of the data to return.
+     */
+    if (args.Length() < 3) {
+        // Expecting a reqNum, ERROR and token
+        LOGE("SendCtrlRequestComplete X %d parameters"
+             " expecting at least 3: status, reqNum, and token",
+                args.Length());
+        return v8::Undefined();
+    }
+    v8::Handle<v8::Value> v8CtrlStatus(args[0]->ToObject());
+    mh.set_status(ril_proto::CtrlStatus(v8CtrlStatus->NumberValue()));
+    DBG("SendCtrlRequestComplete: status=%d", mh.status());
+
+    v8::Handle<v8::Value> v8ReqNum(args[1]->ToObject());
+    mh.set_cmd(int(v8ReqNum->NumberValue()));
+    DBG("SendCtrlRequestComplete: cmd=%d", mh.cmd());
+
+    v8::Handle<v8::Value> v8Token(args[2]->ToObject());
+    mh.set_token(int64_t(v8Token->NumberValue()));
+    DBG("SendCtrlRequestComplete: token=%lld", mh.token());
+
+    if (args.Length() >= 4) {
+        buffer = ObjectWrap::Unwrap<Buffer>(args[3]->ToObject());
+        mh.set_length_data(buffer->length());
+        DBG("SendCtrlRequestComplete: mh.length_data=%d",
+                mh.length_data());
+    } else {
+        mh.set_length_data(0);
+        buffer = NULL;
+        DBG("SendCtrlRequestComplete: NO PROTOBUF");
+    }
+
+    DBG("SendCtrlRequestComplete: WriteMessage");
+    int status = g_ctrl_server->WriteMessage(&mh, buffer);
+
+    DBG("SendCtrlRequestComplete E:");
+    return v8::Undefined();
+}
+
+void ctrlServerInit(v8::Handle<v8::Context> context) {
+    int status;
+
+    g_ctrl_server = new CtrlServerThread(context);
+    status = g_ctrl_server->Run();
+    if (status != STATUS_OK) {
+        LOGE("mock_ril control server could not start");
+    } else {
+        LOGD("CtrlServer started");
+    }
+
+#if 0
+    LOGD("Test CtrlServerThread stop sleeping 10 seconds...");
+    v8::Unlocker unlocker;
+    sleep(10);
+    LOGD("Test CtrlServerThread call Stop");
+    g_ctrl_server->Stop();
+    v8::Locker locker;
+
+    // Restart
+    g_ctrl_server = new CtrlServerThread(context);
+    status = g_ctrl_server->Run();
+    if (status != STATUS_OK) {
+        LOGE("mock_ril control server could not start");
+    } else {
+        DBG("mock_ril control server started");
+    }
+#endif
+}
diff --git a/mock-ril/src/cpp/ctrl_server.h b/mock-ril/src/cpp/ctrl_server.h
new file mode 100644 (file)
index 0000000..2850f04
--- /dev/null
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_CONTROL_SERVER_H_
+#define MOCK_RIL_CONTROL_SERVER_H_
+
+#include <v8.h>
+
+extern v8::Handle<v8::Value> SendCtrlRequestComplete(const v8::Arguments& args);
+
+extern void ctrlServerInit(v8::Handle<v8::Context> context);
+
+#endif // MOCK_RIL_CONTROL_SERVER_H_
diff --git a/mock-ril/src/cpp/experiments.cpp b/mock-ril/src/cpp/experiments.cpp
new file mode 100644 (file)
index 0000000..317fd9d
--- /dev/null
@@ -0,0 +1,281 @@
+/**
+ * Copyright (C) 2010 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 <v8.h>
+#include <telephony/ril.h>
+
+#include "logging.h"
+#include "status.h"
+#include "worker.h"
+#include "util.h"
+
+#include "ril.pb.h"
+
+#include "logging.h"
+#include "js_support.h"
+#include "node_buffer.h"
+#include "node_util.h"
+#include "protobuf_v8.h"
+#include "requests.h"
+
+#include "experiments.h"
+
+void testStlPort() {
+    // Test using STLport
+    std::queue<int *> q;
+    int data[] = {1, 2, 3};
+
+    int *param = data;
+    LOGD("before push q.size=%d", q.size());
+    q.push(param);
+    LOGD("after push q.size=%d", q.size());
+    void *p = q.front();
+    if (p == param) {
+        LOGD("q.push succeeded");
+    } else {
+        LOGD("q.push failed");
+    }
+    q.pop();
+    LOGD("after pop q.size=%d", q.size());
+}
+
+v8::Handle<v8::Value> GetReqScreenState(v8::Local<v8::String> property,
+                               const v8::AccessorInfo &info) {
+    v8::Local<v8::Object> self = info.Holder();
+    v8::Local<v8::External> wrap =
+            v8::Local<v8::External>::Cast(self->GetInternalField(0));
+    void *p = wrap->Value();
+    int state = static_cast<int *>(p)[0];
+    LOGD("GetReqScreenState state=%d", state);
+    return v8::Integer::New(state);
+}
+
+bool callOnRilRequest(v8::Handle<v8::Context> context, int request,
+                   void *data, size_t datalen, RIL_Token t) {
+    v8::HandleScope handle_scope;
+    v8::TryCatch try_catch;
+
+    // Get the onRilRequestFunction, making sure its a function
+    v8::Handle<v8::String> name = v8::String::New("onRilRequest");
+    v8::Handle<v8::Value> onRilRequestFunctionValue = context->Global()->Get(name);
+    if(!onRilRequestFunctionValue->IsFunction()) {
+        // Wasn't a function
+        LOGD("callOnRilRequest X wasn't a function");
+        return false;
+    }
+    v8::Handle<v8::Function> onRilRequestFunction =
+        v8::Handle<v8::Function>::Cast(onRilRequestFunctionValue);
+
+    // Create the request
+    v8::Handle<v8::Value> v8RequestValue = v8::Number::New(request);
+
+    // Create the parameter for the request
+    v8::Handle<v8::Object> params_obj =
+            v8::ObjectTemplate::New()->NewInstance();
+    switch(request) {
+        case(RIL_REQUEST_SCREEN_STATE): {
+            LOGD("callOnRilRequest RIL_REQUEST_SCREEN_STATE");
+            if (datalen < sizeof(int)) {
+                LOGD("callOnRilRequest err size < sizeof int");
+            } else {
+                v8::Handle<v8::ObjectTemplate> params_obj_template =
+                        v8::ObjectTemplate::New();
+                params_obj_template->SetInternalFieldCount(1);
+                params_obj_template->SetAccessor(v8::String::New(
+                            "ReqScreenState"), GetReqScreenState, NULL);
+                // How to not leak this pointer!!!
+                int *p = new int;
+                *p = ((int *)data)[0];
+                params_obj = params_obj_template->NewInstance();
+                params_obj->SetInternalField(0, v8::External::New(p));
+            }
+            break;
+        }
+        default: {
+            LOGD("callOnRilRequest X unknown request");
+            break;
+        }
+    }
+
+    // Invoke onRilRequest
+    bool retValue;
+    const int argc = 2;
+    v8::Handle<v8::Value> argv[argc] = { v8RequestValue, params_obj };
+    v8::Handle<v8::Value> result =
+        onRilRequestFunction->Call(context->Global(), argc, argv);
+    if (try_catch.HasCaught()) {
+        LOGD("callOnRilRequest error");
+        ReportException(&try_catch);
+        retValue = false;
+    } else {
+        v8::String::Utf8Value result_string(result);
+        LOGD("callOnRilRequest result=%s", ToCString(result_string));
+        retValue = true;
+    }
+    return retValue;
+}
+
+void testOnRilRequestUsingCppRequestObjs(v8::Handle<v8::Context> context) {
+    LOGD("testOnRilRequestUsingCppRequestObjs E:");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    runJs(context, &try_catch, "local-string",
+        "function onRilRequest(reqNum, params) {\n"
+        "  print(\"reqNum=\" + reqNum);\n"
+        "  if (reqNum == 61) {\n"
+        "      print(\"params.ReqScreenState=\" + params.ReqScreenState);\n"
+        "  }\n"
+        "  return \"Hello World\";\n"
+        "}\n");
+    if (!try_catch.HasCaught()) {
+        // Call the onRilRequest function
+        int data[1] = { 0 };
+        callOnRilRequest(context, RIL_REQUEST_SCREEN_STATE, data,
+                sizeof(data), NULL);
+    }
+    LOGD("testOnRilRequestUsingCppRequestObjs X:");
+}
+
+void testReqScreenStateProtobuf() {
+    v8::HandleScope handle_scope;
+    v8::TryCatch try_catch;
+
+    LOGD("testReqScreenStateProtobuf E");
+
+    LOGD("create ReqScreenState");
+    ril_proto::ReqScreenState* ss = new ril_proto::ReqScreenState();
+    ss->set_state(true);
+    bool state = ss->state();
+    LOGD("state=%d", state);
+    ss->set_state(false);
+    state = ss->state();
+    LOGD("state=%d", state);
+    int len = ss->ByteSize();
+    LOGD("create buffer len=%d", len);
+    char *buffer = new char[len];
+    LOGD("serialize");
+    bool ok = ss->SerializeToArray(buffer, len);
+    if (!ok) {
+        LOGD("testReqScreenStateProtobuf X: Could not serialize ss");
+        return;
+    }
+    LOGD("ReqScreenState serialized ok");
+    ril_proto::ReqScreenState *newSs = new ril_proto::ReqScreenState();
+    ok = newSs->ParseFromArray(buffer, len);
+    if (!ok) {
+        LOGD("testReqScreenStateProtobuf X: Could not deserialize ss");
+        return;
+    }
+    LOGD("newSs->state=%d", newSs->state());
+
+    delete [] buffer;
+    delete ss;
+    delete newSs;
+    LOGD("testReqScreenStateProtobuf X");
+}
+
+void testReqHangUpProtobuf() {
+    v8::HandleScope handle_scope;
+    v8::TryCatch try_catch;
+
+    LOGD("testReqHangUpProtobuf E");
+
+    LOGD("create ReqHangUp");
+    ril_proto::ReqHangUp* hu = new ril_proto::ReqHangUp();
+    hu->set_connection_index(3);
+    bool connection_index = hu->connection_index();
+    LOGD("connection_index=%d", connection_index);
+    hu->set_connection_index(2);
+    connection_index = hu->connection_index();
+    LOGD("connection_index=%d", connection_index);
+    LOGD("create buffer");
+    int len = hu->ByteSize();
+    char *buffer = new char[len];
+    LOGD("serialize");
+    bool ok = hu->SerializeToArray(buffer, len);
+    if (!ok) {
+        LOGD("testReqHangUpProtobuf X: Could not serialize hu");
+        return;
+    }
+    LOGD("ReqHangUp serialized ok");
+    ril_proto::ReqHangUp *newHu = new ril_proto::ReqHangUp();
+    ok = newHu->ParseFromArray(buffer, len);
+    if (!ok) {
+        LOGD("testReqHangUpProtobuf X: Could not deserialize hu");
+        return;
+    }
+    LOGD("newHu->connection_index=%d", newHu->connection_index());
+
+    delete [] buffer;
+    delete hu;
+    delete newHu;
+    LOGD("testReqHangUpProtobuf X");
+}
+
+void testProtobufV8(v8::Handle<v8::Context> context) {
+    LOGD("testProtobufV8 E:");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    if (try_catch.HasCaught()) {
+        LOGD("TryCatch.hasCaught is true after protobuf_v8::init");
+        ReportException(&try_catch);
+    }
+    runJs(context, &try_catch, "local-string",
+        "fileContents = readFileToString('mock_ril.js');\n"
+        "print('fileContents:\\n' + fileContents);\n"
+        "\n"
+        "buffer = readFileToBuffer('ril.desc');\n"
+        "var schema = new Schema(buffer);\n"
+        "\n"
+        "var originalReqEnterSimPin = { pin : 'hello-the-pin' };\n"
+        "print('originalReqEnterSimPin: pin=' + originalReqEnterSimPin.pin);\n"
+        "var ReqEnterSimPinSchema = schema['ril_proto.ReqEnterSimPin'];\n"
+        "serializedOriginalReqEnterSimPin = ReqEnterSimPinSchema.serialize(originalReqEnterSimPin);\n"
+        "print('serializedOriginalReqEnterSimPin.length=' + serializedOriginalReqEnterSimPin.length);\n"
+        "newReqEnterSimPin = ReqEnterSimPinSchema.parse(serializedOriginalReqEnterSimPin);\n"
+        "print('newReqEnterSimPin: pin=' + newReqEnterSimPin.pin);\n"
+        "\n"
+        "var originalReqScreenState = { state : true };\n"
+        "print('originalReqScreenState: state=' + originalReqScreenState.state);\n"
+        "var ReqScreenStateSchema = schema['ril_proto.ReqScreenState'];\n"
+        "var serializedOriginalReqScreenState = ReqScreenStateSchema.serialize(originalReqScreenState);\n"
+        "print('serializedOriginalReqScreenState.length=' + serializedOriginalReqScreenState.length);\n"
+        "var newReqScreenState = ReqScreenStateSchema.parse(serializedOriginalReqScreenState);\n"
+        "print('newReqScreenState: state=' + newReqScreenState.state);\n"
+        "\n"
+        "originalReqScreenState.state = false;\n"
+        "print('originalReqScreenState: state=' + originalReqScreenState.state);\n"
+        "serializedOriginalReqScreenState = ReqScreenStateSchema.serialize(originalReqScreenState);\n"
+        "print('serializedOriginalReqScreenState.length=' + serializedOriginalReqScreenState.length);\n"
+        "newReqScreenState = ReqScreenStateSchema.parse(serializedOriginalReqScreenState);\n"
+        "print('newReqScreenState: state=' + newReqScreenState.state);\n");
+    LOGD("testProtobufV8 X");
+}
+
+void experiments(v8::Handle<v8::Context> context) {
+    LOGD("experiments E: ********");
+    testStlPort();
+    testReqScreenStateProtobuf();
+    testOnRilRequestUsingCppRequestObjs(context);
+    testProtobufV8(context);
+    LOGD("experiments X: ********\n");
+}
diff --git a/mock-ril/src/cpp/experiments.h b/mock-ril/src/cpp/experiments.h
new file mode 100644 (file)
index 0000000..54044ab
--- /dev/null
@@ -0,0 +1,24 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_INITIAL_TESTS_H_
+#define MOCK_RIL_INITIAL_TESTS_H_
+
+#include <v8.h>
+
+void experiments(v8::Handle<v8::Context> context);
+
+#endif  // MOCK_RIL_INITIAL_TESTS_H_
diff --git a/mock-ril/src/cpp/js_support.cpp b/mock-ril/src/cpp/js_support.cpp
new file mode 100644 (file)
index 0000000..9497176
--- /dev/null
@@ -0,0 +1,415 @@
+/**
+ * Copyright (C) 2010 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 <v8.h>
+#include <telephony/ril.h>
+
+#include "ctrl_server.h"
+#include "logging.h"
+#include "node_buffer.h"
+#include "node_object_wrap.h"
+#include "node_util.h"
+#include "protobuf_v8.h"
+#include "responses.h"
+#include "status.h"
+#include "util.h"
+#include "worker.h"
+#include "worker_v8.h"
+
+#include "js_support.h"
+
+//#define JS_SUPPORT_DEBUG
+#ifdef  JS_SUPPORT_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+/**
+ * Current Radio state
+ */
+RIL_RadioState gRadioState = RADIO_STATE_UNAVAILABLE;
+
+v8::Handle<v8::Value> RadioStateGetter(v8::Local<v8::String> property,
+        const v8::AccessorInfo& info) {
+    return v8::Integer::New((int)gRadioState);
+}
+
+void RadioStateSetter(v8::Local<v8::String> property,
+        v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+    gRadioState = RIL_RadioState(value->Int32Value());
+}
+
+// A javascript sleep for a number of milli-seconds
+v8::Handle<v8::Value> MsSleep(const v8::Arguments& args) {
+    if (args.Length() != 1) {
+        DBG("MsSleep: expecting milli-seconds to sleep");
+    } else {
+        v8::Handle<v8::Value> v8MsValue(args[0]->ToObject());
+        int ms = int(v8MsValue->NumberValue());
+        v8::Unlocker unlocker;
+        usleep(ms * 1000);
+        v8::Locker locker;
+    }
+    return v8::Undefined();
+}
+
+// A javascript print function
+v8::Handle<v8::Value> Print(const v8::Arguments& args) {
+    bool first = true;
+    const int str_size = 1000;
+    char* str = new char[str_size];
+    int offset = 0;
+    for (int i = 0; i < args.Length(); i++) {
+        v8::HandleScope handle_scope;
+        if (first) {
+            first = false;
+        } else {
+            offset += snprintf(&str[offset], str_size, " ");
+        }
+        v8::String::Utf8Value strUtf8(args[i]);
+        const char* cstr = ToCString(strUtf8);
+        offset += snprintf(&str[offset], str_size, "%s", cstr);
+    }
+    LOGD("%s", str);
+    delete [] str;
+    return v8::Undefined();
+}
+
+int ReadFile(const char *fileName, char** data, size_t *length) {
+    int status;
+    char* buffer = NULL;
+    size_t fileLength = 0;
+    FILE *f;
+
+    DBG("ReadFile E fileName=%s", fileName);
+
+    f = fopen(fileName, "rb");
+    if (f == NULL) {
+        DBG("Could not fopen '%s'", fileName);
+        status = STATUS_COULD_NOT_OPEN_FILE;
+    } else {
+        // Determine the length of the file
+        fseek(f, 0, SEEK_END);
+        fileLength = ftell(f);
+        DBG("fileLength=%d", fileLength);
+        rewind(f);
+
+        // Read file into a buffer
+        buffer = new char[fileLength+1];
+        size_t readLength = fread(buffer, 1, fileLength, f);
+        if (readLength != fileLength) {
+            DBG("Couldn't read entire file");
+            delete [] buffer;
+            buffer = NULL;
+            status = STATUS_COULD_NOT_READ_FILE;
+        } else {
+            DBG("File read");
+            buffer[fileLength] = 0;
+            status = STATUS_OK;
+        }
+        fclose(f);
+    }
+
+    if (length != NULL) {
+        *length = fileLength;
+    }
+    *data = buffer;
+    DBG("ReadFile X status=%d", status);
+    return status;
+}
+
+char *CreateFileName(const v8::Arguments& args) {
+    v8::String::Utf8Value fileNameUtf8Value(args[0]);
+    const char* fileName = ToCString(fileNameUtf8Value);
+    const char* directory = "/sdcard/data/";
+
+    int fullPathLength = strlen(directory) + strlen(fileName) + 1;
+    char * fullPath = new char[fullPathLength];
+    strncpy(fullPath, directory, fullPathLength);
+    strncat(fullPath, fileName, fullPathLength);
+    return fullPath;
+}
+
+// A javascript read file function arg[0] = filename
+v8::Handle<v8::Value> ReadFileToString(const v8::Arguments& args) {
+    DBG("ReadFileToString E");
+    v8::HandleScope handle_scope;
+    v8::Handle<v8::Value> retValue;
+
+    if (args.Length() < 1) {
+        // No file name return Undefined
+        DBG("ReadFile X no argumens");
+        return v8::Undefined();
+    } else {
+        char *fileName = CreateFileName(args);
+
+        char *buffer;
+        int status = ReadFile(fileName, &buffer);
+        if (status == 0) {
+            retValue = v8::String::New(buffer);
+        } else {
+            retValue = v8::Undefined();
+        }
+    }
+    DBG("ReadFileToString X");
+    return retValue;
+}
+
+// A javascript read file function arg[0] = filename
+v8::Handle<v8::Value> ReadFileToBuffer(const v8::Arguments& args) {
+    DBG("ReadFileToBuffer E");
+    v8::HandleScope handle_scope;
+    v8::Handle<v8::Value> retValue;
+
+    if (args.Length() < 1) {
+        // No file name return Undefined
+        DBG("ReadFileToBuffer X no argumens");
+        return v8::Undefined();
+    } else {
+        char *fileName = CreateFileName(args);
+
+        char *buffer;
+        size_t length;
+        int status = ReadFile(fileName, &buffer, &length);
+        if (status == 0) {
+            Buffer *buf = Buffer::New(length);
+            memmove(buf->data(), buffer, length);
+            retValue = buf->handle_;
+        } else {
+            retValue = v8::Undefined();
+        }
+    }
+    DBG("ReadFileToBuffer X");
+    return retValue;
+}
+
+void ErrorCallback(v8::Handle<v8::Message> message,
+        v8::Handle<v8::Value> data) {
+    LogErrorMessage(message, "");
+}
+
+// Read, compile and run a javascript file
+v8::Handle<v8::Value> Include(const v8::Arguments& args) {
+    DBG("Include E");
+    v8::HandleScope handle_scope;
+    v8::Handle<v8::Value> retValue;
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    if (args.Length() < 1) {
+        // No file name return Undefined
+        DBG("Include X no argumens");
+        return v8::Undefined();
+    } else {
+        char *fileName = CreateFileName(args);
+
+        char *buffer;
+        int status = ReadFile(fileName, &buffer);
+        if (status == 0) {
+            runJs(v8::Context::GetCurrent(), &try_catch, fileName, buffer);
+        } else {
+            retValue = v8::Undefined();
+        }
+    }
+    DBG("Include X");
+    return retValue;
+}
+
+
+/**
+ * Create a JsContext, must be called within a HandleScope?
+ */
+v8::Persistent<v8::Context> makeJsContext() {
+    v8::HandleScope handle_scope;
+    v8::TryCatch try_catch;
+
+    // Add a Message listner to Catch errors as they occur
+    v8::V8::AddMessageListener(ErrorCallback);
+
+    // Create a template for the global object and
+    // add the function template for print to it.
+    v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
+    global->SetAccessor(v8::String::New("gRadioState"),
+            RadioStateGetter, RadioStateSetter);
+    global->Set(v8::String::New("msSleep"), v8::FunctionTemplate::New(MsSleep));
+    global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print));
+    global->Set(v8::String::New("readFileToBuffer"),
+            v8::FunctionTemplate::New(ReadFileToBuffer));
+    global->Set(v8::String::New("readFileToString"),
+            v8::FunctionTemplate::New(ReadFileToString));
+    global->Set(v8::String::New("sendRilRequestComplete"),
+            v8::FunctionTemplate::New(SendRilRequestComplete));
+    global->Set(v8::String::New("sendRilUnsolicitedResponse"),
+            v8::FunctionTemplate::New(SendRilUnsolicitedResponse));
+    global->Set(v8::String::New("sendCtrlRequestComplete"),
+            v8::FunctionTemplate::New(SendCtrlRequestComplete));
+    global->Set(v8::String::New("include"), v8::FunctionTemplate::New(Include));
+    WorkerV8ObjectTemplateInit(global);
+    SchemaObjectTemplateInit(global);
+    Buffer::InitializeObjectTemplate(global);
+
+    // Create context with our globals and make it the current scope
+    v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
+
+
+    if (try_catch.HasCaught()) {
+        DBG("makeJsContext: Exception making the context");
+        ReportException(&try_catch);
+        try_catch.ReThrow();
+    }
+
+    return context;
+}
+
+/**
+ * Run some javascript code.
+ */
+void runJs(v8::Handle<v8::Context> context, v8::TryCatch *try_catch,
+        const char *fileName, const char *code) {
+    v8::HandleScope handle_scope;
+
+    // Compile the source
+    v8::Handle<v8::Script> script = v8::Script::Compile(
+                v8::String::New(code), v8::String::New(fileName));
+    if (try_catch->HasCaught()) {
+        LOGE("-- Compiling the source failed");
+    } else {
+        // Run the resulting script
+        v8::Handle<v8::Value> result = script->Run();
+        if (try_catch->HasCaught()) {
+            LOGE("-- Running the script failed");
+        }
+    }
+}
+
+void testRadioState(v8::Handle<v8::Context> context) {
+    LOGD("testRadioState E:");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    runJs(context, &try_catch, "local-string",
+        "for(i = 0; i < 10; i++) {\n"
+        "  gRadioState = i;\n"
+        "  print('gRadioState=' + gRadioState);\n"
+        "}\n"
+        "gRadioState = 1;\n"
+        "print('last gRadioState=' + gRadioState);\n");
+    LOGD("testRadioState X:");
+}
+
+void testMsSleep(v8::Handle<v8::Context> context) {
+    LOGD("testMsSleep E:");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    runJs(context, &try_catch, "local-string",
+        "for(i = 0; i < 10; i++) {\n"
+        "  sleeptime = i * 200\n"
+        "  print('msSleep ' + sleeptime);\n"
+        "  msSleep(sleeptime);\n"
+        "}\n");
+    LOGD("testMsSleep X:");
+}
+
+void testPrint(v8::Handle<v8::Context> context) {
+    LOGD("testPrint E:");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    runJs(context, &try_catch, "local-string", "print(\"Hello\")");
+    LOGD("testPrint X:");
+}
+
+void testCompileError(v8::Handle<v8::Context> context) {
+    LOGD("testCompileError E:");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    // +++ generate a compile time error
+    runJs(context, &try_catch, "local-string", "+++");
+    LOGD("testCompileError X:");
+}
+
+void testRuntimeError(v8::Handle<v8::Context> context) {
+    LOGD("testRuntimeError E:");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    // Runtime error
+    runJs(context, &try_catch, "local-string",
+        "function hello() {\n"
+        "  print(\"Hi there\");\n"
+        "}\n"
+        "helloo()");
+    LOGD("testRuntimeError X:");
+}
+
+void testReadFile() {
+    char *buffer;
+    size_t length;
+    int status;
+
+    LOGD("testReadFile E:");
+
+    status = ReadFile("/sdcard/data/no-file", &buffer, &length);
+    LOGD("testReadFile expect status != 0, status=%d, buffer=%p, length=%d",
+            status, buffer, length);
+
+    LOGD("testReadFile X:");
+}
+
+
+void testReadFileToStringBuffer(v8::Handle<v8::Context> context) {
+    LOGD("testReadFileToStringBuffer E:");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    runJs(context, &try_catch, "local-string",
+        "fileContents = readFileToString(\"mock_ril.js\");\n"
+        "print(\"fileContents:\\n\" + fileContents);\n"
+        "buffer = readFileToBuffer(\"ril.desc\");\n"
+        "print(\"buffer.length=\" + buffer.length);\n");
+    LOGD("testReadFileToStringBuffer X:");
+}
+
+void testJsSupport(v8::Handle<v8::Context> context) {
+    LOGD("testJsSupport E: ********");
+    testRadioState(context);
+    testMsSleep(context);
+    testPrint(context);
+    testCompileError(context);
+    testRuntimeError(context);
+    testReadFile();
+    testReadFileToStringBuffer(context);
+    LOGD("testJsSupport X: ********\n");
+}
diff --git a/mock-ril/src/cpp/js_support.h b/mock-ril/src/cpp/js_support.h
new file mode 100644 (file)
index 0000000..6c70b82
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_JS_SUPPORT_H_
+#define MOCK_RIL_JS_SUPPORT_H_
+
+#include <v8.h>
+#include <telephony/ril.h>
+
+// The global value of radio state shared between cpp and js code.
+extern RIL_RadioState gRadioState;
+
+// A javascript print function
+extern v8::Handle<v8::Value> Print(const v8::Arguments& args);
+
+// Read a file into a array returning the buffer and the size
+extern int ReadFile(const char *fileName, char** data, size_t *length = NULL);
+
+// A javascript read file function arg[0] = filename
+extern v8::Handle<v8::Value> ReadFileToString(const v8::Arguments& args);
+
+// A javascript read file function arg[0] = filename
+extern v8::Handle<v8::Value> ReadFileToBuffer(const v8::Arguments& args);
+
+// make the Java
+extern v8::Persistent<v8::Context> makeJsContext();
+
+// Run a javascript
+extern void runJs(v8::Handle<v8::Context> context, v8::TryCatch *try_catch,
+           const char *fileName, const char *code);
+
+// Test this module
+extern void testJsSupport(v8::Handle<v8::Context> context);
+
+#endif // MOCK_RIL_JS_SUPPORT_H_
diff --git a/mock-ril/src/cpp/logging.h b/mock-ril/src/cpp/logging.h
new file mode 100644 (file)
index 0000000..602fbf2
--- /dev/null
@@ -0,0 +1,25 @@
+/**
+ * Copyright (C) 2010 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 _LOGGING_H
+#define _LOGGING_H
+
+// The LOG_TAG should start with "RIL" so it shows up in the  radio log
+#define LOG_TAG "RIL-MOCK"
+
+#include <utils/Log.h>
+
+#endif
diff --git a/mock-ril/src/cpp/mock_ril.cpp b/mock-ril/src/cpp/mock_ril.cpp
new file mode 100644 (file)
index 0000000..88da546
--- /dev/null
@@ -0,0 +1,362 @@
+/**
+ * Copyright (C) 2010 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 <telephony/ril.h>
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <alloca.h>
+#include <getopt.h>
+#include <sys/socket.h>
+#include <cutils/sockets.h>
+#include <termios.h>
+
+#include <v8.h>
+
+#include "ril.pb.h"
+
+#include "ctrl_server.h"
+#include "logging.h"
+#include "experiments.h"
+#include "js_support.h"
+#include "node_buffer.h"
+#include "node_object_wrap.h"
+#include "node_util.h"
+#include "protobuf_v8.h"
+#include "requests.h"
+#include "responses.h"
+#include "status.h"
+#include "util.h"
+#include "worker.h"
+#include "worker_v8.h"
+
+#include "mock_ril.h"
+
+extern "C" {
+// Needed so we can call it prior to calling startMockRil
+extern void RIL_register(const RIL_RadioFunctions *callbacks);
+}
+
+//#define MOCK_RIL_DEBUG
+#ifdef  MOCK_RIL_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+
+#define MOCK_RIL_VER_STRING "Android Mock-ril 0.1"
+
+/**
+ * Forward declarations
+ */
+static void onRequest (int request, void *data, size_t datalen, RIL_Token t);
+static RIL_RadioState currentState();
+static int onSupports (int requestCode);
+static void onCancel (RIL_Token t);
+static const char *getVersion();
+
+static void testOnRequestComplete(RIL_Token t, RIL_Errno e,
+                       void *response, size_t responselen);
+static void testRequestTimedCallback(RIL_TimedCallback callback,
+                void *param, const struct timeval *relativeTime);
+static void testOnUnsolicitedResponse(int unsolResponse, const void *data,
+                                size_t datalen);
+
+/**
+ * The environment from rild with the completion routine
+ */
+const struct RIL_Env *s_rilenv;
+
+/**
+ * Expose our routines to rild
+ */
+static const RIL_RadioFunctions s_callbacks = {
+    RIL_VERSION,
+    onRequest,
+    currentState,
+    onSupports,
+    onCancel,
+    getVersion
+};
+
+/**
+ * A test environment
+ */
+static const RIL_Env testEnv = {
+    testOnRequestComplete,
+    testOnUnsolicitedResponse,
+    testRequestTimedCallback
+};
+
+/**
+ * The request worker queue to handle requests
+ */
+static RilRequestWorkerQueue *s_requestWorkerQueue;
+
+/**
+ * Call from RIL to us to make a RIL_REQUEST
+ *
+ * Must be completed with a call to RIL_onRequestComplete()
+ *
+ * RIL_onRequestComplete() may be called from any thread, before or after
+ * this function returns.
+ *
+ * Will always be called from the same thread, so returning here implies
+ * that the radio is ready to process another command (whether or not
+ * the previous command has c1mpleted).
+ */
+static void onRequest (int request, void *data, size_t datalen, RIL_Token t)
+{
+    DBG("onRequest: request=%d data=%p datalen=%d token=%p",
+            request, data, datalen, t);
+    s_requestWorkerQueue->AddRequest(request, data, datalen, t);
+}
+
+/**
+ * Synchronous call from the RIL to us to return current radio state.
+ * RADIO_STATE_UNAVAILABLE should be the initial state.
+ */
+static RIL_RadioState currentState()
+{
+    DBG("currentState: gRadioState=%d", gRadioState);
+    return gRadioState;
+}
+
+/**
+ * Call from RIL to us to find out whether a specific request code
+ * is supported by this implementation.
+ *
+ * Return 1 for "supported" and 0 for "unsupported"
+ */
+
+static int
+onSupports (int requestCode)
+{
+    DBG("onSupports: nothing supported at the moment, return 0");
+    return 0;
+}
+
+static void onCancel (RIL_Token t)
+{
+    DBG("onCancel: ignorning");
+}
+
+static const char * getVersion(void)
+{
+    DBG("getVersion: return '%s'", MOCK_RIL_VER_STRING);
+    return MOCK_RIL_VER_STRING;
+}
+
+/**
+ * "t" is parameter passed in on previous call to RIL_Notification
+ * routine.
+ *
+ * If "e" != SUCCESS, then response can be null/is ignored
+ *
+ * "response" is owned by caller, and should not be modified or
+ * freed by callee
+ *
+ * RIL_onRequestComplete will return as soon as possible
+ */
+void testOnRequestComplete(RIL_Token t, RIL_Errno e,
+                       void *response, size_t responselen) {
+    DBG("testOnRequestComplete E: token=%p rilErrCode=%d data=%p datalen=%d",
+            t, e, response, responselen);
+    DBG("testOnRequestComplete X:");
+}
+
+/**
+ * "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
+ * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
+ *
+ * "data" is owned by caller, and should not be modified or freed by callee
+ */
+void testOnUnsolicitedResponse(int unsolResponse, const void *data,
+                                size_t datalen) {
+    DBG("testOnUnsolicitedResponse ignoring");
+}
+
+/**
+ * Call user-specifed "callback" function on on the same thread that
+ * RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
+ * a relative time value at which the callback is invoked. If relativeTime is
+ * NULL or points to a 0-filled structure, the callback will be invoked as
+ * soon as possible
+ */
+void testRequestTimedCallback(RIL_TimedCallback callback,
+                               void *param, const struct timeval *relativeTime) {
+    DBG("testRequestTimedCallback ignoring");
+}
+
+#if 0
+class UnsolicitedThread : public WorkerThread {
+  private:
+    v8::Handle<v8::Context> context_;
+
+  public:
+    UnsolicitedThread(v8::Handle<v8::Context> context) :
+        context_(context) {
+    }
+
+    int OnUnsolicitedTick(int tick) {
+        v8::HandleScope handle_scope;
+
+        // Get handle to onUnslicitedTick.
+        v8::Handle<v8::String> name = v8::String::New("onUnsolicitedTick");
+        v8::Handle<v8::Value> functionValue = context_->Global()->Get(name);
+        v8::Handle<v8::Function> onUnsolicitedTick =
+                v8::Handle<v8::Function>::Cast(functionValue);
+
+        // Create the argument array
+        v8::Handle<v8::Value> v8TickValue = v8::Number::New(tick);
+        v8::Handle<v8::Value> argv[1] = { v8TickValue };
+
+        v8::Handle<v8::Value> resultValue =
+            onUnsolicitedTick->Call(context_->Global(), 1, argv);
+        int result = int(resultValue->NumberValue());
+        return result;
+    }
+
+    void * Worker(void *param)
+    {
+        LOGD("UnsolicitedThread::Worker E param=%p", param);
+
+        v8::Locker locker;
+
+        for (int i = 0; isRunning(); i++) {
+            // Get access and setup scope
+            v8::HandleScope handle_scope;
+            v8::Context::Scope context_scope(context_);
+
+            // Do it
+            int sleepTime = OnUnsolicitedTick(i);
+
+            // Wait
+            v8::Unlocker unlocker;
+            sleep(sleepTime);
+            v8::Locker locker;
+        }
+
+        LOGD("UnsolicitedThread::Worker X param=%p", param);
+
+        return NULL;
+    }
+};
+#endif
+
+void startMockRil(v8::Handle<v8::Context> context) {
+    v8::HandleScope handle_scope;
+    v8::TryCatch try_catch;
+
+    // Get handle to startMockRil and call it.
+    v8::Handle<v8::String> name = v8::String::New("startMockRil");
+    v8::Handle<v8::Value> functionValue = context->Global()->Get(name);
+    v8::Handle<v8::Function> start =
+            v8::Handle<v8::Function>::Cast(functionValue);
+
+    v8::Handle<v8::Value> result = start->Call(context->Global(), 0, NULL);
+    if (try_catch.HasCaught()) {
+        LOGE("startMockRil error");
+        ReportException(&try_catch);
+        LOGE("FATAL ERROR: Unsable to startMockRil.");
+    } else {
+        v8::String::Utf8Value result_string(result);
+        LOGE("startMockRil result=%s", ToCString(result_string));
+    }
+
+}
+
+
+const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc,
+        char **argv) {
+    int ret;
+    pthread_attr_t attr;
+
+    LOGD("RIL_Init E: ----------------");
+
+    // Initialize V8
+    v8::V8::Initialize();
+
+    // We're going to use multiple threads need to start locked
+    v8::Locker locker;
+
+    // Initialize modules
+    protobuf_v8::Init();
+    WorkerV8Init();
+
+    // Make a context and setup a scope
+    v8::Persistent<v8::Context> context = makeJsContext();
+    v8::Context::Scope context_scope(context);
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    // Initialize modules needing context
+    ctrlServerInit(context);
+
+    s_rilenv = &testEnv;
+
+    // load/run mock_ril.js
+    char *buffer;
+    int status = ReadFile("/sdcard/data/mock_ril.js", &buffer);
+    if (status == 0) {
+        runJs(context, &try_catch, "mock_ril.js", buffer);
+        if (try_catch.HasCaught()) {
+            // TODO: Change to event this is fatal
+            LOGE("FATAL ERROR: Unable to run mock_ril.js");
+        }
+    }
+
+    s_rilenv = env;
+    requestsInit(context, &s_requestWorkerQueue);
+    responsesInit(context);
+
+#if 0
+    LOGD("RIL_Init run tests #####################");
+    testJsSupport(context);
+    testRequests(context);
+    experiments(context);
+    testWorker();
+    testWorkerV8(context);
+    LOGD("RIL_Init tests completed ###############");
+#endif
+
+    // Register our call backs so when we startMockRil
+    // and it wants to send unsolicited messages the
+    // mock ril is registered
+    RIL_register(&s_callbacks);
+
+    // Start the mock ril
+    startMockRil(context);
+
+#if 0
+    UnsolicitedThread *ut = new UnsolicitedThread(context);
+    ut->Run(NULL);
+#endif
+
+    LOGD("RIL_Init X: ----------------");
+    return &s_callbacks;
+}
diff --git a/mock-ril/src/cpp/mock_ril.h b/mock-ril/src/cpp/mock_ril.h
new file mode 100644 (file)
index 0000000..c29b5ed
--- /dev/null
@@ -0,0 +1,24 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_MOCK_RIL_H_
+#define MOCK_RIL_MOCK_RIL_H_
+
+#include <telephony/ril.h>
+
+extern const struct RIL_Env *s_rilenv;
+
+#endif  // MOCK_RIL_MOCK_RIL_H_
diff --git a/mock-ril/src/cpp/msgheader.pb.cpp b/mock-ril/src/cpp/msgheader.pb.cpp
new file mode 100644 (file)
index 0000000..b4bd1a5
--- /dev/null
@@ -0,0 +1,429 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
+#include "msgheader.pb.h"
+#include <google/protobuf/stubs/once.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/reflection_ops.h>
+#include <google/protobuf/wire_format.h>
+// @@protoc_insertion_point(includes)
+
+namespace communication {
+
+namespace {
+
+const ::google::protobuf::Descriptor* MsgHeader_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  MsgHeader_reflection_ = NULL;
+
+}  // namespace
+
+
+void protobuf_AssignDesc_msgheader_2eproto() {
+  protobuf_AddDesc_msgheader_2eproto();
+  const ::google::protobuf::FileDescriptor* file =
+    ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
+      "msgheader.proto");
+  GOOGLE_CHECK(file != NULL);
+  MsgHeader_descriptor_ = file->message_type(0);
+  static const int MsgHeader_offsets_[4] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, cmd_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, length_data_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, status_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, token_),
+  };
+  MsgHeader_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      MsgHeader_descriptor_,
+      MsgHeader::default_instance_,
+      MsgHeader_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(MsgHeader));
+}
+
+namespace {
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
+inline void protobuf_AssignDescriptorsOnce() {
+  ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
+                 &protobuf_AssignDesc_msgheader_2eproto);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    MsgHeader_descriptor_, &MsgHeader::default_instance());
+}
+
+}  // namespace
+
+void protobuf_ShutdownFile_msgheader_2eproto() {
+  delete MsgHeader::default_instance_;
+  delete MsgHeader_reflection_;
+}
+
+void protobuf_AddDesc_msgheader_2eproto() {
+  static bool already_here = false;
+  if (already_here) return;
+  already_here = true;
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+    "\n\017msgheader.proto\022\rcommunication\"L\n\tMsgH"
+    "eader\022\013\n\003cmd\030\001 \002(\r\022\023\n\013length_data\030\002 \002(\r\022"
+    "\016\n\006status\030\003 \001(\r\022\r\n\005token\030\004 \001(\004B$\n\"com.an"
+    "droid.internal.communication", 148);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "msgheader.proto", &protobuf_RegisterTypes);
+  MsgHeader::default_instance_ = new MsgHeader();
+  MsgHeader::default_instance_->InitAsDefaultInstance();
+  ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_msgheader_2eproto);
+}
+
+// Force AddDescriptors() to be called at static initialization time.
+struct StaticDescriptorInitializer_msgheader_2eproto {
+  StaticDescriptorInitializer_msgheader_2eproto() {
+    protobuf_AddDesc_msgheader_2eproto();
+  }
+} static_descriptor_initializer_msgheader_2eproto_;
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int MsgHeader::kCmdFieldNumber;
+const int MsgHeader::kLengthDataFieldNumber;
+const int MsgHeader::kStatusFieldNumber;
+const int MsgHeader::kTokenFieldNumber;
+#endif  // !_MSC_VER
+
+MsgHeader::MsgHeader()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void MsgHeader::InitAsDefaultInstance() {
+}
+
+MsgHeader::MsgHeader(const MsgHeader& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void MsgHeader::SharedCtor() {
+  _cached_size_ = 0;
+  cmd_ = 0u;
+  length_data_ = 0u;
+  status_ = 0u;
+  token_ = GOOGLE_ULONGLONG(0);
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+MsgHeader::~MsgHeader() {
+  SharedDtor();
+}
+
+void MsgHeader::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void MsgHeader::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* MsgHeader::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return MsgHeader_descriptor_;
+}
+
+const MsgHeader& MsgHeader::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_msgheader_2eproto();  return *default_instance_;
+}
+
+MsgHeader* MsgHeader::default_instance_ = NULL;
+
+MsgHeader* MsgHeader::New() const {
+  return new MsgHeader;
+}
+
+void MsgHeader::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    cmd_ = 0u;
+    length_data_ = 0u;
+    status_ = 0u;
+    token_ = GOOGLE_ULONGLONG(0);
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool MsgHeader::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required uint32 cmd = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+                 input, &cmd_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_length_data;
+        break;
+      }
+      
+      // required uint32 length_data = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_length_data:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+                 input, &length_data_)));
+          _set_bit(1);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(24)) goto parse_status;
+        break;
+      }
+      
+      // optional uint32 status = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_status:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+                 input, &status_)));
+          _set_bit(2);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(32)) goto parse_token;
+        break;
+      }
+      
+      // optional uint64 token = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_token:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+                 input, &token_)));
+          _set_bit(3);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void MsgHeader::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required uint32 cmd = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->cmd(), output);
+  }
+  
+  // required uint32 length_data = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->length_data(), output);
+  }
+  
+  // optional uint32 status = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->status(), output);
+  }
+  
+  // optional uint64 token = 4;
+  if (_has_bit(3)) {
+    ::google::protobuf::internal::WireFormatLite::WriteUInt64(4, this->token(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* MsgHeader::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required uint32 cmd = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->cmd(), target);
+  }
+  
+  // required uint32 length_data = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->length_data(), target);
+  }
+  
+  // optional uint32 status = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->status(), target);
+  }
+  
+  // optional uint64 token = 4;
+  if (_has_bit(3)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(4, this->token(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int MsgHeader::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required uint32 cmd = 1;
+    if (has_cmd()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::UInt32Size(
+          this->cmd());
+    }
+    
+    // required uint32 length_data = 2;
+    if (has_length_data()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::UInt32Size(
+          this->length_data());
+    }
+    
+    // optional uint32 status = 3;
+    if (has_status()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::UInt32Size(
+          this->status());
+    }
+    
+    // optional uint64 token = 4;
+    if (has_token()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::UInt64Size(
+          this->token());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void MsgHeader::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const MsgHeader* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const MsgHeader*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void MsgHeader::MergeFrom(const MsgHeader& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_cmd(from.cmd());
+    }
+    if (from._has_bit(1)) {
+      set_length_data(from.length_data());
+    }
+    if (from._has_bit(2)) {
+      set_status(from.status());
+    }
+    if (from._has_bit(3)) {
+      set_token(from.token());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void MsgHeader::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void MsgHeader::CopyFrom(const MsgHeader& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool MsgHeader::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
+  
+  return true;
+}
+
+void MsgHeader::Swap(MsgHeader* other) {
+  if (other != this) {
+    std::swap(cmd_, other->cmd_);
+    std::swap(length_data_, other->length_data_);
+    std::swap(status_, other->status_);
+    std::swap(token_, other->token_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata MsgHeader::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = MsgHeader_descriptor_;
+  metadata.reflection = MsgHeader_reflection_;
+  return metadata;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace communication
+
+// @@protoc_insertion_point(global_scope)
diff --git a/mock-ril/src/cpp/msgheader.pb.h b/mock-ril/src/cpp/msgheader.pb.h
new file mode 100644 (file)
index 0000000..a98bf3e
--- /dev/null
@@ -0,0 +1,237 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: msgheader.proto
+
+#ifndef PROTOBUF_msgheader_2eproto__INCLUDED
+#define PROTOBUF_msgheader_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 2003000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please update
+#error your headers.
+#endif
+#if 2003000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/extension_set.h>
+#include <google/protobuf/generated_message_reflection.h>
+// @@protoc_insertion_point(includes)
+
+namespace communication {
+
+// Internal implementation detail -- do not call these.
+void  protobuf_AddDesc_msgheader_2eproto();
+void protobuf_AssignDesc_msgheader_2eproto();
+void protobuf_ShutdownFile_msgheader_2eproto();
+
+class MsgHeader;
+
+// ===================================================================
+
+class MsgHeader : public ::google::protobuf::Message {
+ public:
+  MsgHeader();
+  virtual ~MsgHeader();
+  
+  MsgHeader(const MsgHeader& from);
+  
+  inline MsgHeader& operator=(const MsgHeader& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const MsgHeader& default_instance();
+  
+  void Swap(MsgHeader* other);
+  
+  // implements Message ----------------------------------------------
+  
+  MsgHeader* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const MsgHeader& from);
+  void MergeFrom(const MsgHeader& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required uint32 cmd = 1;
+  inline bool has_cmd() const;
+  inline void clear_cmd();
+  static const int kCmdFieldNumber = 1;
+  inline ::google::protobuf::uint32 cmd() const;
+  inline void set_cmd(::google::protobuf::uint32 value);
+  
+  // required uint32 length_data = 2;
+  inline bool has_length_data() const;
+  inline void clear_length_data();
+  static const int kLengthDataFieldNumber = 2;
+  inline ::google::protobuf::uint32 length_data() const;
+  inline void set_length_data(::google::protobuf::uint32 value);
+  
+  // optional uint32 status = 3;
+  inline bool has_status() const;
+  inline void clear_status();
+  static const int kStatusFieldNumber = 3;
+  inline ::google::protobuf::uint32 status() const;
+  inline void set_status(::google::protobuf::uint32 value);
+  
+  // optional uint64 token = 4;
+  inline bool has_token() const;
+  inline void clear_token();
+  static const int kTokenFieldNumber = 4;
+  inline ::google::protobuf::uint64 token() const;
+  inline void set_token(::google::protobuf::uint64 value);
+  
+  // @@protoc_insertion_point(class_scope:communication.MsgHeader)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::uint32 cmd_;
+  ::google::protobuf::uint32 length_data_;
+  ::google::protobuf::uint32 status_;
+  ::google::protobuf::uint64 token_;
+  friend void  protobuf_AddDesc_msgheader_2eproto();
+  friend void protobuf_AssignDesc_msgheader_2eproto();
+  friend void protobuf_ShutdownFile_msgheader_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static MsgHeader* default_instance_;
+};
+// ===================================================================
+
+
+// ===================================================================
+
+// MsgHeader
+
+// required uint32 cmd = 1;
+inline bool MsgHeader::has_cmd() const {
+  return _has_bit(0);
+}
+inline void MsgHeader::clear_cmd() {
+  cmd_ = 0u;
+  _clear_bit(0);
+}
+inline ::google::protobuf::uint32 MsgHeader::cmd() const {
+  return cmd_;
+}
+inline void MsgHeader::set_cmd(::google::protobuf::uint32 value) {
+  _set_bit(0);
+  cmd_ = value;
+}
+
+// required uint32 length_data = 2;
+inline bool MsgHeader::has_length_data() const {
+  return _has_bit(1);
+}
+inline void MsgHeader::clear_length_data() {
+  length_data_ = 0u;
+  _clear_bit(1);
+}
+inline ::google::protobuf::uint32 MsgHeader::length_data() const {
+  return length_data_;
+}
+inline void MsgHeader::set_length_data(::google::protobuf::uint32 value) {
+  _set_bit(1);
+  length_data_ = value;
+}
+
+// optional uint32 status = 3;
+inline bool MsgHeader::has_status() const {
+  return _has_bit(2);
+}
+inline void MsgHeader::clear_status() {
+  status_ = 0u;
+  _clear_bit(2);
+}
+inline ::google::protobuf::uint32 MsgHeader::status() const {
+  return status_;
+}
+inline void MsgHeader::set_status(::google::protobuf::uint32 value) {
+  _set_bit(2);
+  status_ = value;
+}
+
+// optional uint64 token = 4;
+inline bool MsgHeader::has_token() const {
+  return _has_bit(3);
+}
+inline void MsgHeader::clear_token() {
+  token_ = GOOGLE_ULONGLONG(0);
+  _clear_bit(3);
+}
+inline ::google::protobuf::uint64 MsgHeader::token() const {
+  return token_;
+}
+inline void MsgHeader::set_token(::google::protobuf::uint64 value) {
+  _set_bit(3);
+  token_ = value;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace communication
+
+#ifndef SWIG
+namespace google {
+namespace protobuf {
+
+
+}  // namespace google
+}  // namespace protobuf
+#endif  // SWIG
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_msgheader_2eproto__INCLUDED
diff --git a/mock-ril/src/cpp/node_buffer.cpp b/mock-ril/src/cpp/node_buffer.cpp
new file mode 100644 (file)
index 0000000..3b4af5e
--- /dev/null
@@ -0,0 +1,644 @@
+/**
+ * Copied from node_buffer.cc
+ * see http://www.nodejs.org/
+ *
+ * Node's license follows:
+ *
+ * Copyright 2009, 2010 Ryan Lienhart Dahl. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "node_buffer.h"
+
+#include <assert.h>
+#include <stdlib.h> // malloc, free
+#include <v8.h>
+
+#include <string.h> // memcpy
+
+#include <arpa/inet.h>  // htons, htonl
+
+#include "logging.h"
+#include "node_util.h"
+#include "util.h"
+
+//#define BUFFER_DEBUG
+#ifdef  BUFFER_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+using namespace v8;
+
+#define SLICE_ARGS(start_arg, end_arg)                                   \
+  if (!start_arg->IsInt32() || !end_arg->IsInt32()) {                    \
+    return ThrowException(Exception::TypeError(                          \
+          v8::String::New("Bad argument.")));                            \
+  }                                                                      \
+  int32_t start = start_arg->Int32Value();                               \
+  int32_t end = end_arg->Int32Value();                                   \
+  if (start < 0 || end < 0) {                                            \
+    return ThrowException(Exception::TypeError(                          \
+          v8::String::New("Bad argument.")));                            \
+  }                                                                      \
+  if (!(start <= end)) {                                                 \
+    return ThrowException(Exception::Error(                              \
+          v8::String::New("Must have start <= end")));                   \
+  }                                                                      \
+  if ((size_t)end > parent->length_) {                                   \
+    return ThrowException(Exception::Error(                              \
+          v8::String::New("end cannot be longer than parent.length")));  \
+  }
+
+static Persistent<String> length_symbol;
+static Persistent<String> chars_written_sym;
+static Persistent<String> write_sym;
+Persistent<FunctionTemplate> Buffer::constructor_template;
+
+
+// Each javascript Buffer object is backed by a Blob object.
+// the Blob is just a C-level chunk of bytes.
+// It has a reference count.
+struct Blob_ {
+  unsigned int refs;
+  size_t length;
+  char *data;
+};
+typedef struct Blob_ Blob;
+
+
+static inline Blob * blob_new(size_t length) {
+  DBG("blob_new E");
+  Blob * blob  = (Blob*) malloc(sizeof(Blob));
+  if (!blob) return NULL;
+
+  blob->data = (char*) malloc(length);
+  if (!blob->data) {
+    DBG("blob_new X no memory for data");
+    free(blob);
+    return NULL;
+  }
+
+  V8::AdjustAmountOfExternalAllocatedMemory(sizeof(Blob) + length);
+  blob->length = length;
+  blob->refs = 0;
+  DBG("blob_new X");
+  return blob;
+}
+
+
+static inline void blob_ref(Blob *blob) {
+  blob->refs++;
+}
+
+
+static inline void blob_unref(Blob *blob) {
+  assert(blob->refs > 0);
+  if (--blob->refs == 0) {
+    DBG("blob_unref == 0");
+    //fprintf(stderr, "free %d bytes\n", blob->length);
+    V8::AdjustAmountOfExternalAllocatedMemory(-(sizeof(Blob) + blob->length));
+    free(blob->data);
+    free(blob);
+    DBG("blob_unref blob and its data freed");
+  }
+}
+
+#if 0
+// When someone calls buffer.asciiSlice, data is not copied. Instead V8
+// references in the underlying Blob with this ExternalAsciiStringResource.
+class AsciiSliceExt: public String::ExternalAsciiStringResource {
+ friend class Buffer;
+ public:
+  AsciiSliceExt(Buffer *parent, size_t start, size_t end) {
+    blob_ = parent->blob();
+    blob_ref(blob_);
+
+    assert(start <= end);
+    length_ = end - start;
+    assert(start + length_ <= parent->length());
+    data_ = parent->data() + start;
+  }
+
+
+  ~AsciiSliceExt() {
+    //fprintf(stderr, "free ascii slice (%d refs left)\n", blob_->refs);
+    blob_unref(blob_);
+  }
+
+
+  const char* data() const { return data_; }
+  size_t length() const { return length_; }
+
+ private:
+  const char *data_;
+  size_t length_;
+  Blob *blob_;
+};
+#endif
+
+Buffer* Buffer::New(size_t size) {
+  DBG("Buffer::New(size) E");
+  HandleScope scope;
+
+  Local<Value> arg = Integer::NewFromUnsigned(size);
+  Local<Object> b = constructor_template->GetFunction()->NewInstance(1, &arg);
+
+  DBG("Buffer::New(size) X");
+  return ObjectWrap::Unwrap<Buffer>(b);
+}
+
+
+Handle<Value> Buffer::New(const Arguments &args) {
+  DBG("Buffer::New(args) E");
+  HandleScope scope;
+
+  Buffer *buffer;
+  if ((args.Length() == 0) || args[0]->IsInt32()) {
+    size_t length = 0;
+    if (args[0]->IsInt32()) {
+      length = args[0]->Uint32Value();
+    }
+    buffer = new Buffer(length);
+  } else if (args[0]->IsArray()) {
+    Local<Array> a = Local<Array>::Cast(args[0]);
+    buffer = new Buffer(a->Length());
+    char *p = buffer->data();
+    for (int i = 0; i < a->Length(); i++) {
+      Handle<Value> index = v8::Number::New(i);
+      p[i] = a->Get(index)->Uint32Value();
+      //p[i] = a->Get(i)->Uint32Value();
+    }
+  } else if (args[0]->IsString()) {
+    Local<String> s = args[0]->ToString();
+    enum encoding e = ParseEncoding(args[1], UTF8);
+    int length = e == UTF8 ? s->Utf8Length() : s->Length();
+    buffer = new Buffer(length);
+  } else if (Buffer::HasInstance(args[0]) && args.Length() > 2) {
+    // var slice = new Buffer(buffer, 123, 130);
+    // args: parent, start, end
+    Buffer *parent = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
+    SLICE_ARGS(args[1], args[2])
+    buffer = new Buffer(parent, start, end);
+  } else {
+    DBG("Buffer::New(args) X Bad argument");
+    return ThrowException(Exception::TypeError(String::New("Bad argument")));
+  }
+
+  buffer->Wrap(args.This());
+  args.This()->SetIndexedPropertiesToExternalArrayData(buffer->data(),
+                                                       kExternalUnsignedByteArray,
+                                                       buffer->length());
+  args.This()->Set(length_symbol, Integer::New(buffer->length_));
+
+  if (args[0]->IsString()) {
+    if (write_sym.IsEmpty()) {
+      write_sym = Persistent<String>::New(String::NewSymbol("write"));
+    }
+
+    Local<Value> write_v = args.This()->Get(write_sym);
+    assert(write_v->IsFunction());
+    Local<Function> write = Local<Function>::Cast(write_v);
+
+    Local<Value> argv[2] = { args[0], args[1] };
+
+    TryCatch try_catch;
+
+    write->Call(args.This(), 2, argv);
+
+    if (try_catch.HasCaught()) {
+      ReportException(&try_catch);
+    }
+  }
+
+  DBG("Buffer::New(args) X");
+  return args.This();
+}
+
+
+Buffer::Buffer(size_t length) : ObjectWrap() {
+  DBG("Buffer::Buffer(length) E");
+  blob_ = blob_new(length);
+  off_ = 0;
+  length_ = length;
+
+  blob_ref(blob_);
+
+  V8::AdjustAmountOfExternalAllocatedMemory(sizeof(Buffer));
+  DBG("Buffer::Buffer(length) X");
+}
+
+
+Buffer::Buffer(Buffer *parent, size_t start, size_t end) : ObjectWrap() {
+  DBG("Buffer::Buffer(parent, start, end) E");
+  blob_ = parent->blob_;
+  assert(blob_->refs > 0);
+  blob_ref(blob_);
+
+  assert(start <= end);
+  off_ = parent->off_ + start;
+  length_ = end - start;
+  assert(length_ <= parent->length_);
+
+  V8::AdjustAmountOfExternalAllocatedMemory(sizeof(Buffer));
+  DBG("Buffer::Buffer(parent, start, end) X");
+}
+
+
+Buffer::~Buffer() {
+  DBG("Buffer::~Buffer() E");
+  assert(blob_->refs > 0);
+  //fprintf(stderr, "free buffer (%d refs left)\n", blob_->refs);
+  blob_unref(blob_);
+  V8::AdjustAmountOfExternalAllocatedMemory(-static_cast<long int>(sizeof(Buffer)));
+  DBG("Buffer::~Buffer() X");
+}
+
+
+char* Buffer::data() {
+  char *p = blob_->data + off_;
+  DBG("Buffer::data() EX p=%p", p);
+  return p;
+}
+
+void Buffer::NewBlob(size_t length) {
+  DBG("Buffer::NewBlob(length) E");
+  blob_unref(blob_);
+  blob_ = blob_new(length);
+  off_ = 0;
+  length_ = length;
+
+  blob_ref(blob_);
+
+  V8::AdjustAmountOfExternalAllocatedMemory(sizeof(Buffer));
+  DBG("Buffer::NewBlob(length) X");
+}
+
+
+Handle<Value> Buffer::BinarySlice(const Arguments &args) {
+  DBG("Buffer::BinarySlice(args) E");
+  HandleScope scope;
+  Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This());
+  SLICE_ARGS(args[0], args[1])
+
+  const char *data = const_cast<char*>(parent->data() + start);
+  //Local<String> string = String::New(data, end - start);
+
+  Local<Value> b =  Encode(data, end - start, BINARY);
+
+  DBG("Buffer::BinarySlice(args) X");
+  return scope.Close(b);
+}
+
+
+Handle<Value> Buffer::AsciiSlice(const Arguments &args) {
+  DBG("Buffer::AsciiSlice(args) E");
+  HandleScope scope;
+  Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This());
+  SLICE_ARGS(args[0], args[1])
+
+#if 0
+  AsciiSliceExt *ext = new AsciiSliceExt(parent, start, end);
+  Local<String> string = String::NewExternal(ext);
+  // There should be at least two references to the blob now - the parent
+  // and the slice.
+  assert(parent->blob_->refs >= 2);
+#endif
+
+  const char *data = const_cast<char*>(parent->data() + start);
+  Local<String> string = String::New(data, end - start);
+
+
+  DBG("Buffer::AsciiSlice(args) X");
+  return scope.Close(string);
+}
+
+
+Handle<Value> Buffer::Utf8Slice(const Arguments &args) {
+  DBG("Buffer::Utf8Slice(args) E");
+  HandleScope scope;
+  Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This());
+  SLICE_ARGS(args[0], args[1])
+  const char *data = const_cast<char*>(parent->data() + start);
+  Local<String> string = String::New(data, end - start);
+  DBG("Buffer::Utf8Slice(args) X");
+  return scope.Close(string);
+}
+
+
+Handle<Value> Buffer::Slice(const Arguments &args) {
+  DBG("Buffer::Slice(args) E");
+  HandleScope scope;
+  Local<Value> argv[3] = { args.This(), args[0], args[1] };
+  Local<Object> slice =
+    constructor_template->GetFunction()->NewInstance(3, argv);
+  DBG("Buffer::Slice(args) X");
+  return scope.Close(slice);
+}
+
+
+// var bytesCopied = buffer.copy(target, targetStart, sourceStart, sourceEnd);
+Handle<Value> Buffer::Copy(const Arguments &args) {
+  DBG("Buffer::Copy(args) E");
+  HandleScope scope;
+
+  Buffer *source = ObjectWrap::Unwrap<Buffer>(args.This());
+
+  if (!Buffer::HasInstance(args[0])) {
+    DBG("Buffer::Copy(args) X arg[0] not buffer");
+    return ThrowException(Exception::TypeError(String::New(
+            "First arg should be a Buffer")));
+  }
+
+  Buffer *target = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
+
+  ssize_t target_start = args[1]->Int32Value();
+  ssize_t source_start = args[2]->Int32Value();
+  ssize_t source_end = args[3]->IsInt32() ? args[3]->Int32Value()
+                                          : source->length();
+
+  if (source_end < source_start) {
+    DBG("Buffer::Copy(args) X end < start");
+    return ThrowException(Exception::Error(String::New(
+            "sourceEnd < sourceStart")));
+  }
+
+  if (target_start < 0 || ((size_t)target_start) > target->length()) {
+    DBG("Buffer::Copy(args) X targetStart bad");
+    return ThrowException(Exception::Error(String::New(
+            "targetStart out of bounds")));
+  }
+
+  if (source_start < 0 || ((size_t)source_start) > source->length()) {
+    DBG("Buffer::Copy(args) X base source start");
+    return ThrowException(Exception::Error(String::New(
+            "sourceStart out of bounds")));
+  }
+
+  if (source_end < 0 || ((size_t)source_end) > source->length()) {
+    DBG("Buffer::Copy(args) X bad source");
+    return ThrowException(Exception::Error(String::New(
+            "sourceEnd out of bounds")));
+  }
+
+  ssize_t to_copy = MIN(source_end - source_start,
+                        target->length() - target_start);
+
+  memcpy((void*)(target->data() + target_start),
+         (const void*)(source->data() + source_start),
+         to_copy);
+
+  DBG("Buffer::Copy(args) X");
+  return scope.Close(Integer::New(to_copy));
+}
+
+
+// var charsWritten = buffer.utf8Write(string, offset);
+Handle<Value> Buffer::Utf8Write(const Arguments &args) {
+  DBG("Buffer::Utf8Write(args) X");
+  HandleScope scope;
+  Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
+
+  if (!args[0]->IsString()) {
+  DBG("Buffer::Utf8Write(args) X arg[0] not string");
+    return ThrowException(Exception::TypeError(String::New(
+            "Argument must be a string")));
+  }
+
+  Local<String> s = args[0]->ToString();
+
+  size_t offset = args[1]->Int32Value();
+
+  if (offset >= buffer->length_) {
+    DBG("Buffer::Utf8Write(args) X offset bad");
+    return ThrowException(Exception::TypeError(String::New(
+            "Offset is out of bounds")));
+  }
+
+  const char *p = buffer->data() + offset;
+
+  int char_written;
+
+  int written = s->WriteUtf8((char*)p,
+                             buffer->length_ - offset);
+//                             &char_written,
+//                             String::HINT_MANY_WRITES_EXPECTED);
+
+  constructor_template->GetFunction()->Set(chars_written_sym,
+                                           Integer::New(written));
+
+  if (written > 0 && p[written-1] == '\0') written--;
+
+  DBG("Buffer::Utf8Write(args) X");
+  return scope.Close(Integer::New(written));
+}
+
+
+// var charsWritten = buffer.asciiWrite(string, offset);
+Handle<Value> Buffer::AsciiWrite(const Arguments &args) {
+  DBG("Buffer::AsciiWrite(args) E");
+  HandleScope scope;
+
+  Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
+
+  if (!args[0]->IsString()) {
+    DBG("Buffer::AsciiWrite(args) X arg[0] not string");
+    return ThrowException(Exception::TypeError(String::New(
+            "Argument must be a string")));
+  }
+
+  Local<String> s = args[0]->ToString();
+
+  size_t offset = args[1]->Int32Value();
+
+  if (offset >= buffer->length_) {
+    DBG("Buffer::AsciiWrite(args) X bad offset");
+    return ThrowException(Exception::TypeError(String::New(
+            "Offset is out of bounds")));
+  }
+
+  const char *p = buffer->data() + offset;
+
+  size_t towrite = MIN((unsigned long) s->Length(), buffer->length_ - offset);
+
+  int written = s->WriteAscii((char*)p, 0, towrite);
+  DBG("Buffer::AsciiWrite(args) X");
+  return scope.Close(Integer::New(written));
+}
+
+
+Handle<Value> Buffer::BinaryWrite(const Arguments &args) {
+  DBG("Buffer::BinaryWrite(args) E");
+  HandleScope scope;
+
+  Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
+
+  if (!args[0]->IsString()) {
+    DBG("Buffer::BinaryWrite(args) X arg[0] not string");
+    return ThrowException(Exception::TypeError(String::New(
+            "Argument must be a string")));
+  }
+
+  Local<String> s = args[0]->ToString();
+
+  size_t offset = args[1]->Int32Value();
+
+  if (offset >= buffer->length_) {
+    DBG("Buffer::BinaryWrite(args) X offset bad");
+    return ThrowException(Exception::TypeError(String::New(
+            "Offset is out of bounds")));
+  }
+
+  char *p = (char*)buffer->data() + offset;
+
+  size_t towrite = MIN((unsigned long) s->Length(), buffer->length_ - offset);
+
+  int written = DecodeWrite(p, towrite, s, BINARY);
+  DBG("Buffer::BinaryWrite(args) X");
+  return scope.Close(Integer::New(written));
+}
+
+
+// buffer.unpack(format, index);
+// Starting at 'index', unpacks binary from the buffer into an array.
+// 'format' is a string
+//
+//  FORMAT  RETURNS
+//    N     uint32_t   a 32bit unsigned integer in network byte order
+//    n     uint16_t   a 16bit unsigned integer in network byte order
+//    o     uint8_t    a 8bit unsigned integer
+Handle<Value> Buffer::Unpack(const Arguments &args) {
+  DBG("Buffer::Unpack(args) E");
+  HandleScope scope;
+  Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
+
+  if (!args[0]->IsString()) {
+    DBG("Buffer::Unpack(args) X arg[0] not string");
+    return ThrowException(Exception::TypeError(String::New(
+            "Argument must be a string")));
+  }
+
+  String::AsciiValue format(args[0]->ToString());
+  uint32_t index = args[1]->Uint32Value();
+
+#define OUT_OF_BOUNDS ThrowException(Exception::Error(String::New("Out of bounds")))
+
+  Local<Array> array = Array::New(format.length());
+
+  uint8_t  uint8;
+  uint16_t uint16;
+  uint32_t uint32;
+
+  for (int i = 0; i < format.length(); i++) {
+    switch ((*format)[i]) {
+      // 32bit unsigned integer in network byte order
+      case 'N':
+        if (index + 3 >= buffer->length_) return OUT_OF_BOUNDS;
+        uint32 = htonl(*(uint32_t*)(buffer->data() + index));
+        array->Set(Integer::New(i), Integer::NewFromUnsigned(uint32));
+        index += 4;
+        break;
+
+      // 16bit unsigned integer in network byte order
+      case 'n':
+        if (index + 1 >= buffer->length_) return OUT_OF_BOUNDS;
+        uint16 = htons(*(uint16_t*)(buffer->data() + index));
+        array->Set(Integer::New(i), Integer::NewFromUnsigned(uint16));
+        index += 2;
+        break;
+
+      // a single octet, unsigned.
+      case 'o':
+        if (index >= buffer->length_) return OUT_OF_BOUNDS;
+        uint8 = (uint8_t)buffer->data()[index];
+        array->Set(Integer::New(i), Integer::NewFromUnsigned(uint8));
+        index += 1;
+        break;
+
+      default:
+        DBG("Buffer::Unpack(args) X unknown format character");
+        return ThrowException(Exception::Error(
+              String::New("Unknown format character")));
+    }
+  }
+
+  DBG("Buffer::Unpack(args) X");
+  return scope.Close(array);
+}
+
+
+// var nbytes = Buffer.byteLength("string", "utf8")
+Handle<Value> Buffer::ByteLength(const Arguments &args) {
+  DBG("Buffer::ByteLength(args) E");
+  HandleScope scope;
+
+  if (!args[0]->IsString()) {
+    DBG("Buffer::ByteLength(args) X arg[0] not a string");
+    return ThrowException(Exception::TypeError(String::New(
+            "Argument must be a string")));
+  }
+
+  Local<String> s = args[0]->ToString();
+  enum encoding e = ParseEncoding(args[1], UTF8);
+
+  Local<Integer> length =
+    Integer::New(e == UTF8 ? s->Utf8Length() : s->Length());
+
+  DBG("Buffer::ByteLength(args) X");
+  return scope.Close(length);
+}
+
+void Buffer::InitializeObjectTemplate(Handle<ObjectTemplate> target) {
+  DBG("InitializeObjectTemplate(target) E:");
+  HandleScope scope;
+
+  length_symbol = Persistent<String>::New(String::NewSymbol("length"));
+  chars_written_sym = Persistent<String>::New(String::NewSymbol("_charsWritten"));
+
+  Local<FunctionTemplate> t = FunctionTemplate::New(Buffer::New);
+  constructor_template = Persistent<FunctionTemplate>::New(t);
+  constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
+  constructor_template->SetClassName(String::NewSymbol("Buffer"));
+
+  // copy free
+  SET_PROTOTYPE_METHOD(constructor_template, "binarySlice", Buffer::BinarySlice);
+  SET_PROTOTYPE_METHOD(constructor_template, "asciiSlice", Buffer::AsciiSlice);
+  SET_PROTOTYPE_METHOD(constructor_template, "slice", Buffer::Slice);
+  // TODO SET_PROTOTYPE_METHOD(t, "utf16Slice", Utf16Slice);
+  // copy
+  SET_PROTOTYPE_METHOD(constructor_template, "utf8Slice", Buffer::Utf8Slice);
+
+  SET_PROTOTYPE_METHOD(constructor_template, "utf8Write", Buffer::Utf8Write);
+  SET_PROTOTYPE_METHOD(constructor_template, "asciiWrite", Buffer::AsciiWrite);
+  SET_PROTOTYPE_METHOD(constructor_template, "binaryWrite", Buffer::BinaryWrite);
+  SET_PROTOTYPE_METHOD(constructor_template, "unpack", Buffer::Unpack);
+  SET_PROTOTYPE_METHOD(constructor_template, "copy", Buffer::Copy);
+
+  SET_PROTOTYPE_METHOD(constructor_template, "byteLength", Buffer::ByteLength);
+
+  target->Set(String::NewSymbol("Buffer"), constructor_template);
+  DBG("InitializeObjectTemplate(target) X:");
+}
diff --git a/mock-ril/src/cpp/node_buffer.h b/mock-ril/src/cpp/node_buffer.h
new file mode 100644 (file)
index 0000000..0d3d774
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * Copied from node_buffer.h
+ * see http://www.nodejs.org/
+ *
+ * Node's license follows:
+ *
+ * Copyright 2009, 2010 Ryan Lienhart Dahl. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef MOCK_RIL_NODE_BUFFER_H_
+#define MOCK_RIL_NODE_BUFFER_H_
+
+#include <v8.h>
+#include "node_object_wrap.h"
+
+/* A buffer is a chunk of memory stored outside the V8 heap, mirrored by an
+ * object in javascript. The object is not totally opaque, one can access
+ * individual bytes with [] and slice it into substrings or sub-buffers
+ * without copying memory.
+ *
+ * // return an ascii encoded string - no memory iscopied
+ * buffer.asciiSlide(0, 3)
+ *
+ * // returns another buffer - no memory is copied
+ * buffer.slice(0, 3)
+ *
+ * Interally, each javascript buffer object is backed by a "struct buffer"
+ * object.  These "struct buffer" objects are either a root buffer (in the
+ * case that buffer->root == NULL) or slice objects (in which case
+ * buffer->root != NULL).  A root buffer is only GCed once all its slices
+ * are GCed.
+ */
+
+
+struct Blob_;
+
+class Buffer : public ObjectWrap {
+ public:
+  ~Buffer();
+
+  static void Initialize(v8::Handle<v8::Object> target);
+  static void InitializeObjectTemplate(v8::Handle<v8::ObjectTemplate> target);
+  static Buffer* New(size_t length); // public constructor
+  static inline bool HasInstance(v8::Handle<v8::Value> val) {
+    if (!val->IsObject()) return false;
+    v8::Local<v8::Object> obj = val->ToObject();
+    return constructor_template->HasInstance(obj);
+  }
+
+  char* data();
+  size_t length() const { return length_; }
+  struct Blob_* blob() const { return blob_; }
+  void   NewBlob(size_t length);
+
+  int AsciiWrite(char *string, int offset, int length);
+  int Utf8Write(char *string, int offset, int length);
+
+ private:
+  static v8::Persistent<v8::FunctionTemplate> constructor_template;
+
+  static v8::Handle<v8::Value> New(const v8::Arguments &args);
+  static v8::Handle<v8::Value> Slice(const v8::Arguments &args);
+  static v8::Handle<v8::Value> BinarySlice(const v8::Arguments &args);
+  static v8::Handle<v8::Value> AsciiSlice(const v8::Arguments &args);
+  static v8::Handle<v8::Value> Utf8Slice(const v8::Arguments &args);
+  static v8::Handle<v8::Value> BinaryWrite(const v8::Arguments &args);
+  static v8::Handle<v8::Value> AsciiWrite(const v8::Arguments &args);
+  static v8::Handle<v8::Value> Utf8Write(const v8::Arguments &args);
+  static v8::Handle<v8::Value> ByteLength(const v8::Arguments &args);
+  static v8::Handle<v8::Value> Unpack(const v8::Arguments &args);
+  static v8::Handle<v8::Value> Copy(const v8::Arguments &args);
+
+  Buffer(size_t length);
+  Buffer(Buffer *parent, size_t start, size_t end);
+
+  size_t off_; // offset inside blob_
+  size_t length_; // length inside blob_
+  struct Blob_ *blob_;
+};
+
+#endif  // MOCK_RIL_NODE_BUFFER_H_
diff --git a/mock-ril/src/cpp/node_object_wrap.h b/mock-ril/src/cpp/node_object_wrap.h
new file mode 100644 (file)
index 0000000..1bcee62
--- /dev/null
@@ -0,0 +1,112 @@
+/**
+ * Copied from node_object_wrap.h
+ * see http://www.nodejs.org/
+ *
+ * Node's license follows:
+ *
+ * Copyright 2009, 2010 Ryan Lienhart Dahl. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef MOCK_RIL_NODE_OBJECT_WRAP_H_
+#define MOCK_RIL_NODE_OBJECT_WRAP_H_
+
+#include <v8.h>
+#include <assert.h>
+
+class ObjectWrap {
+ public:
+  ObjectWrap ( ) {
+    refs_ = 0;
+  }
+
+  virtual ~ObjectWrap ( ) {
+    if (!handle_.IsEmpty()) {
+      assert(handle_.IsNearDeath());
+      handle_->SetInternalField(0, v8::Undefined());
+      handle_.Dispose();
+      handle_.Clear();
+    }
+  }
+
+  template <class T>
+  static inline T* Unwrap (v8::Handle<v8::Object> handle)
+  {
+    assert(!handle.IsEmpty());
+    assert(handle->InternalFieldCount() > 0);
+    return static_cast<T*>(v8::Handle<v8::External>::Cast(
+        handle->GetInternalField(0))->Value());
+  }
+
+  v8::Persistent<v8::Object> handle_; // ro
+
+ protected:
+  inline void Wrap (v8::Handle<v8::Object> handle)
+  {
+    assert(handle_.IsEmpty());
+    assert(handle->InternalFieldCount() > 0);
+    handle_ = v8::Persistent<v8::Object>::New(handle);
+    handle_->SetInternalField(0, v8::External::New(this));
+    MakeWeak();
+  }
+
+  inline void MakeWeak (void)
+  {
+    handle_.MakeWeak(this, WeakCallback);
+  }
+
+  /* Ref() marks the object as being attached to an event loop.
+   * Refed objects will not be garbage collected, even if
+   * all references are lost.
+   */
+  virtual void Ref() {
+    assert(!handle_.IsEmpty());
+    refs_++;
+    handle_.ClearWeak();
+  }
+
+  /* Unref() marks an object as detached from the event loop.  This is its
+   * default state.  When an object with a "weak" reference changes from
+   * attached to detached state it will be freed. Be careful not to access
+   * the object after making this call as it might be gone!
+   * (A "weak reference" means an object that only has a
+   * persistant handle.)
+   *
+   * DO NOT CALL THIS FROM DESTRUCTOR
+   */
+  virtual void Unref() {
+    assert(!handle_.IsEmpty());
+    assert(!handle_.IsWeak());
+    assert(refs_ > 0);
+    if (--refs_ == 0) { MakeWeak(); }
+  }
+
+  int refs_; // ro
+
+ private:
+  static void WeakCallback (v8::Persistent<v8::Value> value, void *data)
+  {
+    ObjectWrap *obj = static_cast<ObjectWrap*>(data);
+    assert(value == obj->handle_);
+    assert(!obj->refs_);
+    if (value.IsNearDeath()) delete obj;
+  }
+};
+
+#endif // MOCK_RIL_NODE_OBJECT_WRAP_H_
diff --git a/mock-ril/src/cpp/node_util.cpp b/mock-ril/src/cpp/node_util.cpp
new file mode 100644 (file)
index 0000000..8368848
--- /dev/null
@@ -0,0 +1,144 @@
+/**
+ * Contents of this file are snippets from node.cc
+ * see http://www.nodejs.org/
+ *
+ * Node's license follows:
+ *
+ * Copyright 2009, 2010 Ryan Lienhart Dahl. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ */
+#include <v8.h>
+#include <string.h>
+
+#include "logging.h"
+#include "node_object_wrap.h"
+
+#include "node_util.h"
+
+enum encoding ParseEncoding(v8::Handle<v8::Value> encoding_v, enum encoding _default) {
+  v8::HandleScope scope;
+
+  if (!encoding_v->IsString()) return _default;
+
+  v8::String::Utf8Value encoding(encoding_v->ToString());
+
+  if (strcasecmp(*encoding, "utf8") == 0) {
+    return UTF8;
+  } else if (strcasecmp(*encoding, "utf-8") == 0) {
+    return UTF8;
+  } else if (strcasecmp(*encoding, "ascii") == 0) {
+    return ASCII;
+  } else if (strcasecmp(*encoding, "binary") == 0) {
+    return BINARY;
+  } else if (strcasecmp(*encoding, "raw") == 0) {
+    fprintf(stderr, "'raw' (array of integers) has been removed. "
+                    "Use 'binary'.\n");
+    return BINARY;
+  } else if (strcasecmp(*encoding, "raws") == 0) {
+    fprintf(stderr, "'raws' encoding has been renamed to 'binary'. "
+                    "Please update your code.\n");
+    return BINARY;
+  } else {
+    return _default;
+  }
+}
+
+v8::Local<v8::Value> Encode(const void *buf, size_t len, enum encoding encoding) {
+  v8::HandleScope scope;
+
+  if (!len) return scope.Close(v8::String::Empty());
+
+  if (encoding == BINARY) {
+    const unsigned char *cbuf = static_cast<const unsigned char*>(buf);
+    uint16_t * twobytebuf = new uint16_t[len];
+    for (size_t i = 0; i < len; i++) {
+      // XXX is the following line platform independent?
+      twobytebuf[i] = cbuf[i];
+    }
+    v8::Local<v8::String> chunk = v8::String::New(twobytebuf, len);
+    delete [] twobytebuf; // TODO use ExternalTwoBytev8::String?
+    return scope.Close(chunk);
+  }
+
+  // utf8 or ascii encoding
+  v8::Local<v8::String> chunk = v8::String::New((const char*)buf, len);
+  return scope.Close(chunk);
+}
+
+// Returns -1 if the handle was not valid for decoding
+ssize_t DecodeBytes(v8::Handle<v8::Value> val, enum encoding encoding) {
+  v8::HandleScope scope;
+
+  if (val->IsArray()) {
+    fprintf(stderr, "'raw' encoding (array of integers) has been removed. "
+                    "Use 'binary'.\n");
+    assert(0);
+    return -1;
+  }
+
+  v8::Local<v8::String> str = val->ToString();
+
+  if (encoding == UTF8) return str->Utf8Length();
+
+  return str->Length();
+}
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+// Returns number of bytes written.
+ssize_t DecodeWrite(char *buf,
+                    size_t buflen,
+                    v8::Handle<v8::Value> val,
+                    enum encoding encoding) {
+  v8::HandleScope scope;
+
+  // XXX
+  // A lot of improvement can be made here. See:
+  // http://code.google.com/p/v8/issues/detail?id=270
+  // http://groups.google.com/group/v8-dev/browse_thread/thread/dba28a81d9215291/ece2b50a3b4022c
+  // http://groups.google.com/group/v8-users/browse_thread/thread/1f83b0ba1f0a611
+
+  if (val->IsArray()) {
+    fprintf(stderr, "'raw' encoding (array of integers) has been removed. "
+                    "Use 'binary'.\n");
+    assert(0);
+    return -1;
+  }
+
+  v8::Local<v8::String> str = val->ToString();
+
+  if (encoding == UTF8) {
+    str->WriteUtf8(buf, buflen);
+    return buflen;
+  }
+
+  if (encoding == ASCII) {
+    str->WriteAscii(buf, 0, buflen);
+    return buflen;
+  }
+
+  // THIS IS AWFUL!!! FIXME
+
+  assert(encoding == BINARY);
+
+  uint16_t * twobytebuf = new uint16_t[buflen];
+
+  str->Write(twobytebuf, 0, buflen);
+
+  for (size_t i = 0; i < buflen; i++) {
+    unsigned char *b = reinterpret_cast<unsigned char*>(&twobytebuf[i]);
+    assert(b[1] == 0);
+    buf[i] = b[0];
+  }
+
+  delete [] twobytebuf;
+
+  return buflen;
+}
diff --git a/mock-ril/src/cpp/node_util.h b/mock-ril/src/cpp/node_util.h
new file mode 100644 (file)
index 0000000..e19a8e7
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ * Contents of this file are snippets from node.h and node.cc
+ * see http://www.nodejs.org/
+ *
+ * Node's license follows:
+ *
+ * Copyright 2009, 2010 Ryan Lienhart Dahl. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ */
+
+
+#ifndef MOCK_RIL_NODE_UTIL_H_
+#define MOCK_RIL_NODE_UTIL_H_
+
+#include <v8.h>
+
+enum encoding {ASCII, UTF8, BINARY};
+
+enum encoding ParseEncoding(v8::Handle<v8::Value> encoding_v,
+                            enum encoding _default = BINARY);
+
+void FatalException(v8::TryCatch &try_catch);
+
+v8::Local<v8::Value> Encode(const void *buf, size_t len,
+                            enum encoding encoding = BINARY);
+
+// returns bytes written.
+ssize_t DecodeWrite(char *buf,
+                    size_t buflen,
+                    v8::Handle<v8::Value>,
+                    enum encoding encoding = BINARY);
+
+#define SET_PROTOTYPE_METHOD(templ, name, callback)                      \
+do {                                                                     \
+  v8::Local<v8::Signature> __callback##_SIG = v8::Signature::New(templ); \
+  v8::Local<v8::FunctionTemplate> __callback##_TEM =                     \
+    v8::FunctionTemplate::New(callback, v8::Handle<v8::Value>(),         \
+                          __callback##_SIG);                             \
+  templ->PrototypeTemplate()->Set(v8::String::NewSymbol(name),           \
+                                  __callback##_TEM);                     \
+} while (0)
+
+#define SET_METHOD(obj, name, callback)                                  \
+  obj->Set(v8::String::NewSymbol(name),                                  \
+           v8::FunctionTemplate::New(callback)->GetFunction())
+
+
+#endif  // MOCK_RIL_NODE_UTIL_H_
diff --git a/mock-ril/src/cpp/protobuf_v8.cpp b/mock-ril/src/cpp/protobuf_v8.cpp
new file mode 100644 (file)
index 0000000..c4acb0a
--- /dev/null
@@ -0,0 +1,556 @@
+// Copyright 2010 Google Inc.
+//
+// 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 "protobuf_v8.h"
+
+#include <map>
+#include <string>
+#include <iostream>
+#include <sstream>
+
+#include <google/protobuf/dynamic_message.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/descriptor.pb.h>
+
+#include "logging.h"
+#include "util.h"
+
+#include "node_buffer.h"
+#include "node_object_wrap.h"
+
+#include "node_util.h"
+
+//#define PROTOBUF_V8_DEBUG
+#ifdef  PROTOBUF_V8_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+using google::protobuf::Descriptor;
+using google::protobuf::DescriptorPool;
+using google::protobuf::DynamicMessageFactory;
+using google::protobuf::FieldDescriptor;
+using google::protobuf::FileDescriptorSet;
+using google::protobuf::Message;
+using google::protobuf::Reflection;
+
+//using ObjectWrap;
+//using Buffer;
+
+using std::map;
+using std::string;
+
+using v8::Array;
+using v8::AccessorInfo;
+using v8::Arguments;
+using v8::Boolean;
+using v8::Context;
+using v8::External;
+using v8::Function;
+using v8::FunctionTemplate;
+using v8::Integer;
+using v8::Handle;
+using v8::HandleScope;
+using v8::InvocationCallback;
+using v8::Local;
+using v8::NamedPropertyGetter;
+using v8::Number;
+using v8::Object;
+using v8::ObjectTemplate;
+using v8::Persistent;
+using v8::Script;
+using v8::String;
+using v8::Value;
+using v8::V8;
+
+namespace protobuf_v8 {
+
+  template <typename T>
+  static T* UnwrapThis(const Arguments& args) {
+    return ObjectWrap::Unwrap<T>(args.This());
+  }
+
+  template <typename T>
+  static T* UnwrapThis(const AccessorInfo& args) {
+    return ObjectWrap::Unwrap<T>(args.This());
+  }
+
+  Persistent<FunctionTemplate> SchemaTemplate;
+  Persistent<FunctionTemplate> TypeTemplate;
+  Persistent<FunctionTemplate> ParseTemplate;
+  Persistent<FunctionTemplate> SerializeTemplate;
+
+  class Schema : public ObjectWrap {
+  public:
+    Schema(Handle<Object> self, const DescriptorPool* pool)
+        : pool_(pool) {
+      DBG("Schema::Schema E:");
+      factory_.SetDelegateToGeneratedFactory(true);
+      self->SetInternalField(1, Array::New());
+      Wrap(self);
+      DBG("Schema::Schema X:");
+    }
+
+    virtual ~Schema() {
+      DBG("~Schema::Schema E:");
+      if (pool_ != DescriptorPool::generated_pool())
+        delete pool_;
+      DBG("~Schema::Schema X:");
+    }
+
+    class Type : public ObjectWrap {
+    public:
+      Schema* schema_;
+      const Descriptor* descriptor_;
+
+      Message* NewMessage() const {
+        DBG("Type::NewMessage() EX:");
+        return schema_->NewMessage(descriptor_);
+      }
+
+      Handle<Function> Constructor() const {
+        DBG("Type::Constrocutor() EX:");
+        return Handle<Function>::Cast(handle_->GetInternalField(2));
+      }
+
+      Local<Object> NewObject(Handle<Value> properties) const {
+        DBG("Type::NewObjext(properties) EX:");
+        return Constructor()->NewInstance(1, &properties);
+      }
+
+      Type(Schema* schema, const Descriptor* descriptor, Handle<Object> self)
+        : schema_(schema), descriptor_(descriptor) {
+        DBG("Type::Type(schema, descriptor, self) E:");
+        // Generate functions for bulk conversion between a JS object
+        // and an array in descriptor order:
+        //   from = function(arr) { this.f0 = arr[0]; this.f1 = arr[1]; ... }
+        //   to   = function()    { return [ this.f0, this.f1, ... ] }
+        // This is faster than repeatedly calling Get/Set on a v8::Object.
+        std::ostringstream from, to;
+        from << "(function(arr) { if(arr) {";
+        to << "(function() { return [ ";
+
+        for (int i = 0; i < descriptor->field_count(); i++) {
+          from <<
+            "var x = arr[" << i << "]; "
+            "if(x !== undefined) this['" <<
+            descriptor->field(i)->camelcase_name() <<
+            "'] = x; ";
+
+          if (i > 0) to << ", ";
+          to << "this['" << descriptor->field(i)->camelcase_name() << "']";
+          DBG("field name=%s", descriptor->field(i)->name().c_str());
+        }
+
+        from << " }})";
+        to << " ]; })";
+
+        // managed type->schema link
+        self->SetInternalField(1, schema_->handle_);
+
+        Handle<Function> constructor = Handle<Function>::Cast(
+          Script::Compile(String::New(from.str().c_str()))->Run());
+        constructor->SetHiddenValue(String::New("type"), self);
+
+        Handle<Function> bind = Handle<Function>::Cast(
+          Script::Compile(String::New(
+              "(function(self) {"
+              "  var f = this;"
+              "  return function(arg) {"
+              "    return f.call(self, arg);"
+              "  };"
+              "})"))->Run());
+        Handle<Value> arg = self;
+        constructor->Set(String::New("parse"), bind->Call(ParseTemplate->GetFunction(), 1, &arg));
+        constructor->Set(String::New("serialize"), bind->Call(SerializeTemplate->GetFunction(), 1, &arg));
+        self->SetInternalField(2, constructor);
+        self->SetInternalField(3, Script::Compile(String::New(to.str().c_str()))->Run());
+
+        Wrap(self);
+        DBG("Type::Type(schema, descriptor, self) X:");
+      }
+
+#define GET(TYPE)                                                        \
+      (index >= 0 ?                                                      \
+       reflection->GetRepeated##TYPE(instance, field, index) :           \
+       reflection->Get##TYPE(instance, field))
+
+      static Handle<Value> ToJs(const Message& instance,
+                                const Reflection* reflection,
+                                const FieldDescriptor* field,
+                                const Type* message_type,
+                                int index) {
+        DBG("Type::ToJs(instance, refelction, field, message_type) E:");
+        switch (field->cpp_type()) {
+        case FieldDescriptor::CPPTYPE_MESSAGE:
+          DBG("Type::ToJs CPPTYPE_MESSAGE");
+          return message_type->ToJs(GET(Message));
+        case FieldDescriptor::CPPTYPE_STRING: {
+          DBG("Type::ToJs CPPTYPE_STRING");
+          const string& value = GET(String);
+          return String::New(value.data(), value.length());
+        }
+        case FieldDescriptor::CPPTYPE_INT32:
+          DBG("Type::ToJs CPPTYPE_INT32");
+          return Integer::New(GET(Int32));
+        case FieldDescriptor::CPPTYPE_UINT32:
+          DBG("Type::ToJs CPPTYPE_UINT32");
+          return Integer::NewFromUnsigned(GET(UInt32));
+        case FieldDescriptor::CPPTYPE_INT64:
+          DBG("Type::ToJs CPPTYPE_INT64");
+          return Number::New(GET(Int64));
+        case FieldDescriptor::CPPTYPE_UINT64:
+          DBG("Type::ToJs CPPTYPE_UINT64");
+          return Number::New(GET(UInt64));
+        case FieldDescriptor::CPPTYPE_FLOAT:
+          DBG("Type::ToJs CPPTYPE_FLOAT");
+          return Number::New(GET(Float));
+        case FieldDescriptor::CPPTYPE_DOUBLE:
+          DBG("Type::ToJs CPPTYPE_DOUBLE");
+          return Number::New(GET(Double));
+        case FieldDescriptor::CPPTYPE_BOOL:
+          DBG("Type::ToJs CPPTYPE_BOOL");
+          return Boolean::New(GET(Bool));
+        case FieldDescriptor::CPPTYPE_ENUM:
+          DBG("Type::ToJs CPPTYPE_ENUM");
+          return String::New(GET(Enum)->name().c_str());
+        }
+
+        return Handle<Value>();  // NOTREACHED
+      }
+#undef GET
+
+      Handle<Object> ToJs(const Message& instance) const {
+        DBG("Type::ToJs(Message) E:");
+        const Reflection* reflection = instance.GetReflection();
+        const Descriptor* descriptor = instance.GetDescriptor();
+
+        Handle<Array> properties = Array::New(descriptor->field_count());
+        for (int i = 0; i < descriptor->field_count(); i++) {
+          HandleScope scope;
+
+          const FieldDescriptor* field = descriptor->field(i);
+          bool repeated = field->is_repeated();
+          if (repeated && !reflection->FieldSize(instance, field)) {
+            DBG("Ignore repeated field with no size in reflection data");
+            continue;
+          }
+          if (!repeated && !reflection->HasField(instance, field)) {
+            DBG("Ignore field with no field in relfection data");
+            continue;
+          }
+
+          const Type* child_type =
+            (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) ?
+            schema_->GetType(field->message_type()) : NULL;
+
+          Handle<Value> value;
+          if (field->is_repeated()) {
+            int size = reflection->FieldSize(instance, field);
+            Handle<Array> array = Array::New(size);
+            for (int j = 0; j < size; j++) {
+              Handle<Value> index = Number::New(i);
+              array->Set(index, ToJs(instance, reflection, field, child_type, j));
+            }
+            value = array;
+          } else {
+            value = ToJs(instance, reflection, field, child_type, -1);
+          }
+
+          DBG("Type::ToJs: set property[%d]=%s", i, ToCString(value));
+          Handle<Value> key = Number::New(i);
+          properties->Set(key, value);
+        }
+
+        DBG("Type::ToJs(Message) X:");
+        return NewObject(properties);
+      }
+
+      static Handle<Value> Parse(const Arguments& args) {
+        DBG("Type::Parse(args) E:");
+        Type* type = UnwrapThis<Type>(args);
+        Buffer* buf = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
+
+        Message* message = type->NewMessage();
+        message->ParseFromArray(buf->data(), buf->length());
+        Handle<Object> result = type->ToJs(*message);
+        delete message;
+
+        DBG("Type::Parse(args) X:");
+        return result;
+      }
+
+#define SET(TYPE, EXPR)                                                 \
+      if (repeated) reflection->Add##TYPE(instance, field, EXPR);       \
+      else reflection->Set##TYPE(instance, field, EXPR)
+
+      static bool ToProto(Message* instance,
+                          const FieldDescriptor* field,
+                          Handle<Value> value,
+                          const Type* type,
+                          bool repeated) {
+        DBG("Type::ToProto(instance, field, value, type, repeated) E:");
+        bool ok = true;
+        HandleScope scope;
+
+        DBG("Type::ToProto field->name()=%s", field->name().c_str());
+        const Reflection* reflection = instance->GetReflection();
+        switch (field->cpp_type()) {
+        case FieldDescriptor::CPPTYPE_MESSAGE:
+          DBG("Type::ToProto CPPTYPE_MESSAGE");
+          ok = type->ToProto(repeated ?
+                                reflection->AddMessage(instance, field) :
+                                reflection->MutableMessage(instance, field),
+                                    Handle<Object>::Cast(value));
+          break;
+        case FieldDescriptor::CPPTYPE_STRING: {
+          DBG("Type::ToProto CPPTYPE_STRING");
+          String::AsciiValue ascii(value);
+          SET(String, string(*ascii, ascii.length()));
+          break;
+        }
+        case FieldDescriptor::CPPTYPE_INT32:
+          DBG("Type::ToProto CPPTYPE_INT32");
+          SET(Int32, value->NumberValue());
+          break;
+        case FieldDescriptor::CPPTYPE_UINT32:
+          DBG("Type::ToProto CPPTYPE_UINT32");
+          SET(UInt32, value->NumberValue());
+          break;
+        case FieldDescriptor::CPPTYPE_INT64:
+          DBG("Type::ToProto CPPTYPE_INT64");
+          SET(Int64, value->NumberValue());
+          break;
+        case FieldDescriptor::CPPTYPE_UINT64:
+          DBG("Type::ToProto CPPTYPE_UINT64");
+          SET(UInt64, value->NumberValue());
+          break;
+        case FieldDescriptor::CPPTYPE_FLOAT:
+          DBG("Type::ToProto CPPTYPE_FLOAT");
+          SET(Float, value->NumberValue());
+          break;
+        case FieldDescriptor::CPPTYPE_DOUBLE:
+          DBG("Type::ToProto CPPTYPE_DOUBLE");
+          SET(Double, value->NumberValue());
+          break;
+        case FieldDescriptor::CPPTYPE_BOOL:
+          DBG("Type::ToProto CPPTYPE_BOOL");
+          SET(Bool, value->BooleanValue());
+          break;
+        case FieldDescriptor::CPPTYPE_ENUM:
+          DBG("Type::ToProto CPPTYPE_ENUM");
+
+          // Don't use SET as vd can be NULL
+          char error_buff[256];
+          const google::protobuf::EnumValueDescriptor* vd;
+          int i32_value = 0;
+          const char *str_value = NULL;
+          const google::protobuf::EnumDescriptor* ed = field->enum_type();
+
+          if (value->IsNumber()) {
+            i32_value = value->Int32Value();
+            vd = ed->FindValueByNumber(i32_value);
+            if (vd == NULL) {
+              snprintf(error_buff, sizeof(error_buff),
+                  "Type::ToProto Bad enum value, %d is not a member of enum %s",
+                      i32_value, ed->full_name().c_str());
+            }
+          } else {
+            str_value = ToCString(value);
+            // TODO: Why can str_value be corrupted sometimes?
+            LOGD("str_value=%s", str_value);
+            vd = ed->FindValueByName(str_value);
+            if (vd == NULL) {
+              snprintf(error_buff, sizeof(error_buff),
+                  "Type::ToProto Bad enum value, %s is not a member of enum %s",
+                      str_value, ed->full_name().c_str());
+            }
+          }
+          if (vd != NULL) {
+            if (repeated) {
+               reflection->AddEnum(instance, field, vd);
+            } else {
+               reflection->SetEnum(instance, field, vd);
+            }
+          } else {
+            v8::ThrowException(String::New(error_buff));
+            ok = false;
+          }
+          break;
+        }
+        DBG("Type::ToProto(instance, field, value, type, repeated) X: ok=%d", ok);
+        return ok;
+      }
+#undef SET
+
+      bool ToProto(Message* instance, Handle<Object> src) const {
+        DBG("ToProto(Message *, Handle<Object>) E:");
+
+        Handle<Function> to_array = Handle<Function>::Cast(handle_->GetInternalField(3));
+        Handle<Array> properties = Handle<Array>::Cast(to_array->Call(src, 0, NULL));
+        bool ok = true;
+        for (int i = 0; ok && (i < descriptor_->field_count()); i++) {
+          Handle<Value> value = properties->Get(Number::New(i));
+          if (value->IsUndefined()) continue;
+
+          const FieldDescriptor* field = descriptor_->field(i);
+          const Type* child_type =
+            (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) ?
+            schema_->GetType(field->message_type()) : NULL;
+          if (field->is_repeated()) {
+            if(!value->IsArray()) {
+              ok = ToProto(instance, field, value, child_type, true);
+            } else {
+              Handle<Array> array = Handle<Array>::Cast(value);
+              int length = array->Length();
+              for (int j = 0; ok && (j < length); j++) {
+                ok = ToProto(instance, field, array->Get(Number::New(j)), child_type, true);
+              }
+            }
+          } else {
+            ok = ToProto(instance, field, value, child_type, false);
+          }
+        }
+        DBG("ToProto(Message *, Handle<Object>) X: ok=%d", ok);
+        return ok;
+      }
+
+      static Handle<Value> Serialize(const Arguments& args) {
+        Handle<Value> result;
+        DBG("Serialize(Arguments&) E:");
+        if (!args[0]->IsObject()) {
+          DBG("Serialize(Arguments&) X: not an object");
+          return v8::ThrowException(args[0]);
+        }
+
+        Type* type = UnwrapThis<Type>(args);
+        Message* message = type->NewMessage();
+        if (type->ToProto(message, Handle<Object>::Cast(args[0]))) {
+          int length = message->ByteSize();
+          Buffer* buffer = Buffer::New(length);
+          message->SerializeWithCachedSizesToArray((google::protobuf::uint8*)buffer->data());
+          delete message;
+
+          result = buffer->handle_;
+        } else {
+          result = v8::Undefined();
+        }
+        DBG("Serialize(Arguments&) X");
+        return result;
+      }
+
+      static Handle<Value> ToString(const Arguments& args) {
+        return String::New(UnwrapThis<Type>(args)->descriptor_->full_name().c_str());
+      }
+    };
+
+    Message* NewMessage(const Descriptor* descriptor) {
+      DBG("Schema::NewMessage(descriptor) EX:");
+      return factory_.GetPrototype(descriptor)->New();
+    }
+
+    Type* GetType(const Descriptor* descriptor) {
+      DBG("Schema::GetType(descriptor) E:");
+      Type* result = types_[descriptor];
+      if (result) return result;
+
+      result = types_[descriptor] =
+        new Type(this, descriptor, TypeTemplate->GetFunction()->NewInstance());
+
+      // managed schema->[type] link
+      Handle<Array> types = Handle<Array>::Cast(handle_->GetInternalField(1));
+      Handle<Value> key = Number::New(types->Length());
+      types->Set(key, result->handle_);
+      DBG("Schema::GetType(descriptor) X:");
+      return result;
+    }
+
+    const DescriptorPool* pool_;
+    map<const Descriptor*, Type*> types_;
+    DynamicMessageFactory factory_;
+
+    static Handle<Value> GetType(const Local<String> name,
+                                 const AccessorInfo& args) {
+      DBG("Schema::GetType(name, args) E:");
+      Schema* schema = UnwrapThis<Schema>(args);
+      const Descriptor* descriptor =
+        schema->pool_->FindMessageTypeByName(*String::AsciiValue(name));
+
+      DBG("Schema::GetType(name, args) X:");
+      return descriptor ?
+        schema->GetType(descriptor)->Constructor() :
+        Handle<Function>();
+    }
+
+    static Handle<Value> NewSchema(const Arguments& args) {
+      DBG("Schema::NewSchema E: args.Length()=%d", args.Length());
+      if (!args.Length()) {
+        return (new Schema(args.This(),
+                           DescriptorPool::generated_pool()))->handle_;
+      }
+
+      Buffer* buf = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
+
+      FileDescriptorSet descriptors;
+      if (!descriptors.ParseFromArray(buf->data(), buf->length())) {
+        DBG("Schema::NewSchema X: bad descriptor");
+        return v8::ThrowException(String::New("Malformed descriptor"));
+      }
+
+      DescriptorPool* pool = new DescriptorPool;
+      for (int i = 0; i < descriptors.file_size(); i++) {
+        pool->BuildFile(descriptors.file(i));
+      }
+
+      DBG("Schema::NewSchema X");
+      return (new Schema(args.This(), pool))->handle_;
+    }
+  };
+
+  void Init() {
+    DBG("Init E:");
+    HandleScope handle_scope;
+
+    TypeTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New());
+    TypeTemplate->SetClassName(String::New("Type"));
+    // native self
+    // owning schema (so GC can manage our lifecyle)
+    // constructor
+    // toArray
+    TypeTemplate->InstanceTemplate()->SetInternalFieldCount(4);
+
+    SchemaTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Schema::NewSchema));
+    SchemaTemplate->SetClassName(String::New("Schema"));
+    // native self
+    // array of types (so GC can manage our lifecyle)
+    SchemaTemplate->InstanceTemplate()->SetInternalFieldCount(2);
+    SchemaTemplate->InstanceTemplate()->SetNamedPropertyHandler(Schema::GetType);
+
+    ParseTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Schema::Type::Parse));
+    SerializeTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Schema::Type::Serialize));
+
+    DBG("Init X:");
+  }
+
+}  // namespace protobuf_v8
+
+extern "C" void SchemaObjectTemplateInit(Handle<ObjectTemplate> target) {
+  DBG("SchemaObjectTemplateInit(target) EX:");
+  target->Set(String::New("Schema"), protobuf_v8::SchemaTemplate);
+}
diff --git a/mock-ril/src/cpp/protobuf_v8.h b/mock-ril/src/cpp/protobuf_v8.h
new file mode 100644 (file)
index 0000000..4244e27
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2010 Google Inc.
+//
+// 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 <v8.h>
+
+namespace protobuf_v8 {
+  extern void Init();
+}  // namespace protobuf_v8
+
+// Add Schema to the object template
+extern "C" void SchemaObjectTemplateInit(v8::Handle<v8::ObjectTemplate> target);
diff --git a/mock-ril/src/cpp/requests.cpp b/mock-ril/src/cpp/requests.cpp
new file mode 100644 (file)
index 0000000..8cd1bf4
--- /dev/null
@@ -0,0 +1,523 @@
+/**
+ * Copyright (C) 2010 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 <map>
+
+#include <v8.h>
+#include <telephony/ril.h>
+
+
+#include "ril.pb.h"
+
+#include "logging.h"
+#include "js_support.h"
+#include "mock_ril.h"
+#include "node_buffer.h"
+#include "node_object_wrap.h"
+#include "node_util.h"
+#include "protobuf_v8.h"
+#include "status.h"
+#include "util.h"
+#include "worker.h"
+
+#include "requests.h"
+
+//#define REQUESTS_DEBUG
+#ifdef  REQUESTS_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+
+/**
+ * Request has no data so create an empty Buffer
+ */
+int ReqWithNoData(Buffer **pBuffer,
+        const void *data, const size_t datalen, const RIL_Token t) {
+    int status;
+    static Buffer *emptyBuffer = Buffer::New(0L);
+
+    DBG("ReqWithNoData E");
+    *pBuffer = emptyBuffer;
+    status = STATUS_OK;
+
+    DBG("ReqWithNoData X status=%d", status);
+    return status;
+}
+
+/**
+ * request for RIL_REQUEST_ENTER_SIM_PIN  // 2
+ */
+int ReqEnterSimPin(Buffer **pBuffer,
+        const void *data, const size_t datalen, const RIL_Token t) {
+    int status;
+    Buffer *buffer;
+
+    DBG("ReqEnterSimPin E");
+    if (datalen < sizeof(int)) {
+        LOGE("ReqEnterSimPin: data to small err size < sizeof int");
+        status = STATUS_BAD_DATA;
+    } else {
+        ril_proto::ReqEnterSimPin *req = new ril_proto::ReqEnterSimPin();
+        DBG("ReqEnterSimPin: pin = %s", ((const char **)data)[0]);
+        req->set_pin((((char **)data)[0]));
+        buffer = Buffer::New(req->ByteSize());
+        req->SerializeToArray(buffer->data(), buffer->length());
+        delete req;
+        *pBuffer = buffer;
+        status = STATUS_OK;
+    }
+    DBG("ReqEnterSimPin X status=%d", status);
+    return status;
+}
+
+/**
+ * request for RIL_REQUEST_DIAL  // 10
+ */
+int ReqDial(Buffer **pBuffer,
+            const void *data, const size_t datalen, const RIL_Token t) {
+    int status;
+    Buffer *buffer;
+
+    DBG("ReqDial E");
+    DBG("data=%p datalen=%d t=%p", data, datalen, t);
+
+    if (datalen < sizeof(int)) {
+        LOGE("ReqDial: data to small err size < sizeof int");
+        status = STATUS_BAD_DATA;
+    } else {
+        ril_proto::ReqDial *req = new ril_proto::ReqDial();
+
+        // cast the data to RIL_Dial
+        RIL_Dial *rilDial = (RIL_Dial *)data;
+        DBG("ReqDial: rilDial->address =%s, rilDial->clir=%d", rilDial->address, rilDial->clir);
+
+        req->set_address(rilDial->address);
+        req->set_clir(rilDial->clir);
+        ril_proto::RilUusInfo *uusInfo = (ril_proto::RilUusInfo *)(&(req->uus_info()));
+
+        if (rilDial->uusInfo != NULL) {
+            DBG("ReqDial: print uusInfo:");
+            DBG("rilDial->uusInfo->uusType = %d, "
+                "rilDial->uusInfo->uusDcs =%d, "
+                "rilDial->uusInfo->uusLength=%d, "
+                "rilDial->uusInfo->uusData = %s",
+                rilDial->uusInfo->uusType,
+                rilDial->uusInfo->uusDcs,
+                rilDial->uusInfo->uusLength,
+                rilDial->uusInfo->uusData);
+
+            uusInfo->set_uus_type((ril_proto::RilUusType)rilDial->uusInfo->uusType);
+            uusInfo->set_uus_dcs((ril_proto::RilUusDcs)rilDial->uusInfo->uusDcs);
+            uusInfo->set_uus_length(rilDial->uusInfo->uusLength);
+            uusInfo->set_uus_data(rilDial->uusInfo->uusData);
+        } else {
+            DBG("uusInfo is NULL");
+        }
+
+        DBG("ReqDial: after set the request");
+        DBG("req->ByetSize=%d", req->ByteSize());
+        buffer = Buffer::New(req->ByteSize());
+        DBG("buffer size=%d", buffer->length());
+
+        req->SerializeToArray(buffer->data(), buffer->length());
+        delete req;
+        *pBuffer = buffer;
+        status = STATUS_OK;
+        DBG("ReqDial X, buffer->length()=%d", buffer->length());
+    }
+    DBG("ReqDial X status = %d", status);
+    return status;
+}
+
+/**
+ * request for RIL_REQUEST_HANGUP    // 12
+ */
+int ReqHangUp(Buffer **pBuffer,
+        const void *data, const size_t datalen, const RIL_Token t) {
+    int status;
+    Buffer *buffer;
+
+    DBG("ReqHangUp E");
+    if (datalen < sizeof(int)) {
+        LOGE("ReqHangUp: data to small err size < sizeof int");
+        status = STATUS_BAD_DATA;
+    } else {
+        ril_proto::ReqHangUp *req = new ril_proto::ReqHangUp();
+        DBG("ReqHangUp: connection_index=%d", ((int *)data)[0]);
+        req->set_connection_index(((int *)data)[0]);
+        buffer = Buffer::New(req->ByteSize());
+        req->SerializeToArray(buffer->data(), buffer->length());
+        delete req;
+        *pBuffer = buffer;
+        status = STATUS_OK;
+    }
+    DBG("ReqHangUp X status=%d", status);
+    return status;
+}
+
+/**
+ * request for RIL_REQUEST_SEPARATE_CONNECTION    // 52
+ */
+int ReqSeparateConnection (Buffer **pBuffer,
+                           const void *data, const size_t datalen, const RIL_Token t) {
+    int status;
+    Buffer *buffer;
+    v8::HandleScope handle_scope;
+
+    DBG("ReqSeparateConnection E");
+    if (datalen < sizeof(int)) {
+        LOGE("ReqSetMute: data to small err size < sizeof int");
+        status = STATUS_BAD_DATA;
+    } else {
+        ril_proto::ReqSeparateConnection *req = new ril_proto::ReqSeparateConnection();
+        DBG("ReqSeparateConnection: index=%d", ((int *)data)[0]);
+        req->set_index(((int *)data)[0]);
+        DBG("ReqSeparateConnection: req->ByetSize=%d", req->ByteSize());
+        buffer = Buffer::New(req->ByteSize());
+        req->SerializeToArray(buffer->data(), buffer->length());
+        delete req;
+        *pBuffer = buffer;
+        status = STATUS_OK;
+    }
+    DBG("ReqSeparateConnection X status=%d", status);
+    return status;
+}
+
+/**
+ * request for RIL_REQUEST_SET_MUTE      // 53
+ */
+int ReqSetMute(Buffer **pBuffer,
+               const void *data, const size_t datalen, const RIL_Token t) {
+    int status;
+    Buffer *buffer;
+    v8::HandleScope handle_scope;
+
+    DBG("ReqSetMute E");
+    if (datalen < sizeof(int)) {
+        LOGE("ReqSetMute: data to small err size < sizeof int");
+        status = STATUS_BAD_DATA;
+    } else {
+        ril_proto::ReqSetMute *req = new ril_proto::ReqSetMute();
+        DBG("ReqSetMute: state=%d", ((int *)data)[0]);
+        req->set_state(((int *)data)[0]);
+        DBG("ReqSetMute: req->ByetSize=%d", req->ByteSize());
+        buffer = Buffer::New(req->ByteSize());
+        req->SerializeToArray(buffer->data(), buffer->length());
+        delete req;
+        *pBuffer = buffer;
+        status = STATUS_OK;
+    }
+    DBG("ReqSetMute X status=%d", status);
+    return status;
+}
+
+/**
+ * request for RIL_REQUEST_SCREEN_STATE  // 61
+ */
+int ReqScreenState(Buffer **pBuffer,
+        const void *data, const size_t datalen, const RIL_Token t) {
+    int status;
+    Buffer *buffer;
+    v8::HandleScope handle_scope;
+
+    DBG("ReqScreenState E data=%p datalen=%d t=%p",
+         data, datalen, t);
+    if (datalen < sizeof(int)) {
+        LOGE("ReqScreenState: data to small err size < sizeof int");
+        status = STATUS_BAD_DATA;
+    } else {
+        ril_proto::ReqScreenState *req = new ril_proto::ReqScreenState();
+        DBG("ReqScreenState: state=%d", ((int *)data)[0]);
+        req->set_state(((int *)data)[0]);
+        DBG("ReqScreenState: req->ByteSize()=%d", req->ByteSize());
+        buffer = Buffer::New(req->ByteSize());
+        DBG("ReqScreenState: serialize");
+        req->SerializeToArray(buffer->data(), buffer->length());
+        delete req;
+        *pBuffer = buffer;
+        status = STATUS_OK;
+    }
+    DBG("ReqScreenState X status=%d", status);
+    return status;
+}
+
+/**
+ * Map from indexed by cmd and used to convert Data to Protobuf.
+ */
+typedef int (*ReqConversion)(Buffer** pBuffer, const void *data,
+                const size_t datalen, const RIL_Token t);
+typedef std::map<int, ReqConversion> ReqConversionMap;
+ReqConversionMap rilReqConversionMap;
+
+int callOnRilRequest(v8::Handle<v8::Context> context, int cmd,
+                   const void *buffer, RIL_Token t) {
+    DBG("callOnRilRequest E: cmd=%d", cmd);
+
+    int status;
+    v8::HandleScope handle_scope;
+    v8::TryCatch try_catch;
+
+    // Get the onRilRequest Function
+    v8::Handle<v8::String> name = v8::String::New("onRilRequest");
+    v8::Handle<v8::Value> onRilRequestFunctionValue = context->Global()->Get(name);
+    v8::Handle<v8::Function> onRilRequestFunction =
+        v8::Handle<v8::Function>::Cast(onRilRequestFunctionValue);
+
+    // Create the cmd and token
+    v8::Handle<v8::Value> v8RequestValue = v8::Number::New(cmd);
+    v8::Handle<v8::Value> v8TokenValue = v8::Number::New(int64_t(t));
+
+    // Invoke onRilRequest
+    const int argc = 3;
+    v8::Handle<v8::Value> argv[argc] = {
+            v8RequestValue, v8TokenValue, ((Buffer *)buffer)->handle_ };
+    v8::Handle<v8::Value> result =
+        onRilRequestFunction->Call(context->Global(), argc, argv);
+    if (try_catch.HasCaught()) {
+        LOGE("callOnRilRequest error");
+        ReportException(&try_catch);
+        status = STATUS_ERR;
+    } else {
+        v8::String::Utf8Value result_string(result);
+        DBG("callOnRilRequest result=%s", ToCString(result_string));
+        status = STATUS_OK;
+    }
+
+    DBG("callOnRilRequest X: status=%d", status);
+    return status;
+}
+
+RilRequestWorkerQueue::RilRequestWorkerQueue(v8::Handle<v8::Context> context) {
+    DBG("RilRequestWorkerQueue E:");
+
+    context_ = context;
+    pthread_mutex_init(&free_list_mutex_, NULL);
+
+    DBG("RilRequestWorkerQueue X:");
+}
+
+RilRequestWorkerQueue::~RilRequestWorkerQueue() {
+    DBG("~RilRequestWorkerQueue E:");
+    Request *req;
+    pthread_mutex_lock(&free_list_mutex_);
+    while(free_list_.size() != 0) {
+        req = free_list_.front();
+        delete req;
+        free_list_.pop();
+    }
+    pthread_mutex_unlock(&free_list_mutex_);
+    pthread_mutex_destroy(&free_list_mutex_);
+    DBG("~RilRequestWorkerQueue X:");
+}
+
+/**
+ * Add a request to the processing queue.
+ * Data is serialized to a protobuf before adding to the queue.
+ */
+void RilRequestWorkerQueue::AddRequest (const int request,
+        const void *data, const size_t datalen, const RIL_Token token) {
+    DBG("RilRequestWorkerQueue:AddRequest: %d E", request);
+
+    v8::Locker locker;
+    v8::HandleScope handle_scope;
+    v8::Context::Scope context_scope(context_);
+
+    int status;
+
+    // Convert the data to a protobuf before inserting it into the request queue (serialize data)
+    Buffer *buffer = NULL;
+    ReqConversionMap::iterator itr;
+    itr = rilReqConversionMap.find(request);
+    if (itr != rilReqConversionMap.end()) {
+        status = itr->second(&buffer, data, datalen, token);
+    } else {
+        LOGE("RilRequestWorkerQueue:AddRequest: X unknown request %d", request);
+        status = STATUS_UNSUPPORTED_REQUEST;
+    }
+
+    if (status == STATUS_OK) {
+        // Add serialized request to the queue
+        Request *req;
+        pthread_mutex_lock(&free_list_mutex_);
+        DBG("RilRequestWorkerQueue:AddRequest: return ok, buffer = %p, buffer->length()=%d",
+            buffer, buffer->length());
+        if (free_list_.size() == 0) {
+            req = new Request(request, buffer, token);
+            pthread_mutex_unlock(&free_list_mutex_);
+        } else {
+            req = free_list_.front();
+            free_list_.pop();
+            pthread_mutex_unlock(&free_list_mutex_);
+            req->Set(request, buffer, token);
+        }
+        // add the request
+        Add(req);
+    } else {
+        DBG("RilRequestWorkerQueue:AddRequest: return from the serialization, status is not OK");
+        // An error report complete now
+        RIL_Errno rilErrCode = (status == STATUS_UNSUPPORTED_REQUEST) ?
+                 RIL_E_REQUEST_NOT_SUPPORTED : RIL_E_GENERIC_FAILURE;
+        s_rilenv->OnRequestComplete(token, rilErrCode, NULL, 0);
+    }
+
+    DBG("RilRequestWorkerQueue::AddRequest: X"
+         " request=%d data=%p datalen=%d token=%p",
+            request, data, datalen, token);
+}
+
+void RilRequestWorkerQueue::Process(void *p) {
+
+    Request *req = (Request *)p;
+    DBG("RilRequestWorkerQueue::Process: E"
+         " request=%d buffer=%p, bufferlen=%d t=%p",
+            req->request_, req->buffer_, req->buffer_->length(), req->token_);
+
+    v8::Locker locker;
+    v8::HandleScope handle_scope;
+    v8::Context::Scope context_scope(context_);
+    callOnRilRequest(context_, req->request_,
+                          req->buffer_, req->token_);
+
+    pthread_mutex_lock(&free_list_mutex_);
+    free_list_.push(req);
+    pthread_mutex_unlock(&free_list_mutex_);
+}
+
+int requestsInit(v8::Handle<v8::Context> context, RilRequestWorkerQueue **rwq) {
+    LOGD("requestsInit E");
+
+    rilReqConversionMap[RIL_REQUEST_GET_SIM_STATUS] = ReqWithNoData; // 1
+    rilReqConversionMap[RIL_REQUEST_ENTER_SIM_PIN] = ReqEnterSimPin; // 2
+    rilReqConversionMap[RIL_REQUEST_GET_CURRENT_CALLS] = ReqWithNoData; // 9
+    rilReqConversionMap[RIL_REQUEST_DIAL] = ReqDial;   // 10
+    rilReqConversionMap[RIL_REQUEST_GET_IMSI] = ReqWithNoData; // 11
+    rilReqConversionMap[RIL_REQUEST_HANGUP] = ReqHangUp; // 12
+    rilReqConversionMap[RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND] = ReqWithNoData; // 13
+    rilReqConversionMap[RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND] = ReqWithNoData; // 14
+    rilReqConversionMap[RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE] = ReqWithNoData; // 15
+    rilReqConversionMap[RIL_REQUEST_CONFERENCE] = ReqWithNoData;  // 16
+    rilReqConversionMap[RIL_REQUEST_SIGNAL_STRENGTH] = ReqWithNoData; // 19
+    rilReqConversionMap[RIL_REQUEST_REGISTRATION_STATE] = ReqWithNoData; // 20
+    rilReqConversionMap[RIL_REQUEST_GPRS_REGISTRATION_STATE] = ReqWithNoData; // 21
+    rilReqConversionMap[RIL_REQUEST_OPERATOR] = ReqWithNoData; // 22
+    rilReqConversionMap[RIL_REQUEST_GET_IMEI] = ReqWithNoData; // 38
+    rilReqConversionMap[RIL_REQUEST_GET_IMEISV] = ReqWithNoData; // 39
+    rilReqConversionMap[RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE] = ReqWithNoData; // 45
+    rilReqConversionMap[RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = ReqWithNoData; // 46
+    rilReqConversionMap[RIL_REQUEST_BASEBAND_VERSION] = ReqWithNoData; // 51
+    rilReqConversionMap[RIL_REQUEST_SEPARATE_CONNECTION] = ReqSeparateConnection; // 52
+    rilReqConversionMap[RIL_REQUEST_SET_MUTE] = ReqSetMute; // 53
+    rilReqConversionMap[RIL_REQUEST_SCREEN_STATE] = ReqScreenState; // 61
+
+    *rwq = new RilRequestWorkerQueue(context);
+    int status = (*rwq)->Run();
+
+    LOGD("requestsInit X: status=%d", status);
+    return status;
+}
+
+/**
+ * Subroutine to test a single RIL request
+ */
+void testRilRequest(v8::Handle<v8::Context> context, int request, const void *data,
+                    const size_t datalen, const RIL_Token t) {
+    Buffer *buffer = NULL;
+    ReqConversionMap::iterator itr;
+    int status;
+
+    LOGD("testRilRequest: request=%d", request);
+
+    itr = rilReqConversionMap.find(request);
+    if (itr != rilReqConversionMap.end()) {
+        status = itr->second(&buffer, data, sizeof(data), (void *)0x12345677);
+    } else {
+        LOGE("testRequests X unknown request %d", request);
+        status = STATUS_UNSUPPORTED_REQUEST;
+    }
+    if (status == STATUS_OK) {
+        callOnRilRequest(context, request, buffer, (void *)0x12345677);
+    } else {
+        LOGE("testRilRequest X, serialize error");
+    }
+}
+
+void testRequests(v8::Handle<v8::Context> context) {
+    LOGD("testRequests E: ********");
+
+    v8::TryCatch try_catch;
+
+    char *buffer;
+    const char *fileName= "/sdcard/data/mock_ril.js";
+    int status = ReadFile(fileName, &buffer);
+    if (status == 0) {
+        runJs(context, &try_catch, fileName, buffer);
+        Buffer *buffer = NULL;
+        ReqConversionMap::iterator itr;
+        int status;
+        int request;
+
+        if (!try_catch.HasCaught()) {
+            {
+                const int data[1] = { 1 };
+                testRilRequest(context, RIL_REQUEST_SIGNAL_STRENGTH, data, sizeof(data),
+                               (void *)0x12345677);
+            }
+            {
+                const char *data[1] = { "winks-pin" };
+                testRilRequest(context, RIL_REQUEST_ENTER_SIM_PIN, data, sizeof(data),
+                               (void *)0x12345677);
+            }
+            {
+                const int data[1] = { 1 };
+                testRilRequest(context, RIL_REQUEST_HANGUP, data, sizeof(data),
+                               (void *)0x12345677);
+            }
+            {
+                const int data[1] = { 1 };
+                testRilRequest(context, RIL_REQUEST_SCREEN_STATE, data, sizeof(data),
+                               (void *)0x12345677);
+            }
+            {
+                const int data[1] = { 1 };
+                testRilRequest(context, RIL_REQUEST_GET_SIM_STATUS, data, sizeof(data),
+                               (void *)0x12345677);
+            }
+            {
+                RilRequestWorkerQueue *rwq = new RilRequestWorkerQueue(context);
+                if (rwq->Run() == STATUS_OK) {
+                    const int data[1] = { 1 };
+                    rwq->AddRequest(RIL_REQUEST_SCREEN_STATE,
+                                    data, sizeof(data), (void *)0x1234567A);
+                    rwq->AddRequest(RIL_REQUEST_SIGNAL_STRENGTH,
+                                    data, sizeof(data), (void *)0x1234567A);
+                    // Sleep to let it be processed
+                    v8::Unlocker unlocker;
+                    sleep(3);
+                    v8::Locker locker;
+                }
+                delete rwq;
+            }
+        }
+    }
+
+    LOGD("testRequests X: ********\n");
+}
diff --git a/mock-ril/src/cpp/requests.h b/mock-ril/src/cpp/requests.h
new file mode 100644 (file)
index 0000000..6c1b077
--- /dev/null
@@ -0,0 +1,101 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_REQUESTS_H_
+#define MOCK_RIL_REQUESTS_H_
+
+#include <queue>
+#include <pthread.h>
+
+#include <v8.h>
+#include "worker.h"
+#include "node_object_wrap.h"
+
+/**
+ * A request
+ */
+struct Request {
+    int request_;
+    Buffer *buffer_;
+    RIL_Token token_;
+
+    Request(const int request, const Buffer *buffer, const RIL_Token token) :
+            request_(0),
+            buffer_(NULL),
+            token_(0) {
+        Set(request, buffer, token);
+    }
+
+    ~Request() {
+        delete [] buffer_;
+    }
+
+    void Set(const int request,
+        const Buffer *buffer, const RIL_Token token) {
+        request_ = request;
+        token_ = token;
+        buffer_ = (Buffer *)buffer;
+    }
+};
+
+/**
+ * Ril request worker queue.
+ *
+ * Pass requests to mock-ril.js for processing
+ */
+class RilRequestWorkerQueue : public WorkerQueue {
+  private:
+    v8::Handle<v8::Context> context_;
+    // TODO: Need a thread-safe queue
+    std::queue<Request *> free_list_;
+    pthread_mutex_t free_list_mutex_;
+
+  public:
+    /**
+     * Constructor
+     */
+    RilRequestWorkerQueue(v8::Handle<v8::Context> context);
+
+    /**
+     * Destructor
+     */
+    virtual ~RilRequestWorkerQueue();
+
+    /**
+     * Add a request to the Queue
+     */
+    void AddRequest(const int request,
+                    const void *data, const size_t datalen, const RIL_Token token);
+
+    /**
+     * Processes a request sending it to mock-ril.js
+     */
+    virtual void Process(void *p);
+};
+
+/**
+ * Initialize module
+ *
+ * @return 0 if no errors
+ */
+int requestsInit(v8::Handle<v8::Context> context, RilRequestWorkerQueue **rwq);
+
+/**
+ * Run tests
+ */
+void testRequests(v8::Handle<v8::Context> context);
+
+#endif  // MOCK_RIL_REQUESTS_H_
diff --git a/mock-ril/src/cpp/responses.cpp b/mock-ril/src/cpp/responses.cpp
new file mode 100644 (file)
index 0000000..5705010
--- /dev/null
@@ -0,0 +1,523 @@
+/**
+ * Copyright (C) 2010 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 <map>
+
+#include <v8.h>
+#include <telephony/ril.h>
+
+#include "ril.pb.h"
+
+#include "logging.h"
+#include "mock_ril.h"
+#include "node_buffer.h"
+#include "node_object_wrap.h"
+#include "protobuf_v8.h"
+#include "status.h"
+#include "util.h"
+#include "worker.h"
+
+#include "responses.h"
+
+//#define RESPONSES_DEBUG
+#ifdef  RESPONSES_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+
+/**
+ * The Buffer is assumed to be empty so nothing to convert
+ * @return STATUS_OK and *data = NULL *datalen = 0;
+ */
+RIL_Errno RspWithNoData(
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
+    DBG("RspWithNoData E");
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno, NULL, 0);
+
+    DBG("RspWithNoData X");
+    return rilErrno;
+}
+
+/**
+ * Handle response for an array of strings
+ *
+ * If a string value is "*magic-null*" then that value
+ * will be returned as null.
+ */
+RIL_Errno RspStrings(
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
+    DBG("RspStrings E");
+
+    ril_proto::RspStrings *rsp = new ril_proto::RspStrings();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    int result_len = rsp->strings_size() * sizeof(const char *);
+    const char **result = (const char **)alloca(result_len);
+    for (int i = 0; i < rsp->strings_size();  i++) {
+        result[i] = rsp->strings(i).c_str();
+        DBG("result[%d]='%s'", i, result[i]);
+        if (strcmp("*magic-null*", result[i]) == 0) {
+            result[i] = NULL;
+        }
+    }
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno, result, result_len);
+
+    DBG("RspStrings X rilErrno=%d", rilErrno);
+    return rilErrno;
+}
+
+/**
+ * Handle response for a string
+ */
+RIL_Errno RspString(
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
+    DBG("RspString E");
+
+    ril_proto::RspStrings *rsp = new ril_proto::RspStrings();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    const char *result = rsp->strings(0).c_str();
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno, (void *)result, strlen(result));
+
+    DBG("RspString X rilErrno=%d", rilErrno);
+    return rilErrno;
+}
+
+/**
+ * Handle response for an array of integers
+ */
+RIL_Errno RspIntegers(
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
+    DBG("RspIntegers E");
+
+    ril_proto::RspIntegers *rsp = new ril_proto::RspIntegers();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    int result_len = rsp->integers_size() * sizeof(const int32_t);
+    int32_t *result = (int32_t *)alloca(result_len);
+    for (int i = 0; i < rsp->integers_size();  i++) {
+        result[i] = rsp->integers(i);
+        DBG("result[%d]=%d", i, result[i]);
+    }
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno, result, result_len);
+
+    DBG("RspIntegers X rilErrno=%d", rilErrno);
+    return rilErrno;
+}
+
+/**
+ * Handle RIL_REQUEST_GET_SIM_STATUS response
+ */
+RIL_Errno RspGetSimStatus(
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 1
+    DBG("RspGetSimStatus E");
+
+    ril_proto::RspGetSimStatus *rsp = new ril_proto::RspGetSimStatus();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    const ril_proto::RilCardStatus& r = rsp->card_status();
+    RIL_CardStatus cardStatus;
+    cardStatus.card_state = RIL_CardState(r.card_state());
+    cardStatus.universal_pin_state = RIL_PinState(r.universal_pin_state());
+    cardStatus.gsm_umts_subscription_app_index = r.gsm_umts_subscription_app_index();
+    cardStatus.num_applications = r.num_applications();
+    for (int i = 0; i < cardStatus.num_applications; i++) {
+       cardStatus.applications[i].app_type = RIL_AppType(r.applications(i).app_type());
+       cardStatus.applications[i].app_state = RIL_AppState(r.applications(i).app_state());
+       cardStatus.applications[i].perso_substate =
+            RIL_PersoSubstate(r.applications(i).perso_substate());
+       cardStatus.applications[i].aid_ptr = const_cast<char *>(r.applications(i).aid().c_str());
+       cardStatus.applications[i].app_label_ptr =
+            const_cast<char *>(r.applications(i).app_label().c_str());
+       cardStatus.applications[i].pin1_replaced = r.applications(i).pin1_replaced();
+       cardStatus.applications[i].pin1 = RIL_PinState(r.applications(i).pin1());
+       cardStatus.applications[i].pin2 = RIL_PinState(r.applications(i).pin2());
+    }
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno,
+            &cardStatus, sizeof(cardStatus));
+
+    DBG("RspGetSimStatus X rilErrno=%d", rilErrno);
+    return rilErrno;
+}
+
+/**
+ * Handle RIL_REQUEST_ENTER_SIM_PIN_DATA response
+ */
+RIL_Errno RspEnterSimPinData(
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 2
+    DBG("RspEnterSimPinData E");
+
+    ril_proto::RspEnterSimPin *rsp = new ril_proto::RspEnterSimPin();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    DBG("retries_remaining=%d", rsp->retries_remaining());
+    int retries_remaining = rsp->retries_remaining();
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno,
+            &retries_remaining, sizeof(retries_remaining));
+
+    DBG("RspEnterSimPinData X rilErrno=%d", rilErrno);
+    return rilErrno;
+}
+
+/**
+ * Handle RIL_REQUEST_GET_CURRENT_CALLS response  // 9
+ */
+RIL_Errno RspGetCurrentCalls (
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 9
+    DBG("RspGetCurrentCalls E");
+
+    ril_proto::RspGetCurrentCalls *rsp = new ril_proto::RspGetCurrentCalls();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    int result_len = rsp->calls_size() * sizeof(const RIL_Call *);
+    DBG("RspGetCurrentCalls rilErrno=%d result_len=%d", rilErrno, result_len);
+    RIL_Call **result = (RIL_Call **)alloca(result_len);
+    for (int i = 0; i < rsp->calls_size();  i++) {
+        const ril_proto::RilCall& srcCall = rsp->calls(i);
+        RIL_Call *dstCall = (RIL_Call *)alloca(sizeof(RIL_Call));
+
+        result[i] = dstCall;
+        dstCall->state = (RIL_CallState)srcCall.state();
+        dstCall->index = srcCall.index();
+        dstCall->toa = srcCall.toa();
+        dstCall->isMpty = (char)srcCall.is_mpty();
+        dstCall->isMT = (char)srcCall.is_mt();
+        dstCall->als = srcCall.als();
+        dstCall->isVoice = (char)srcCall.is_voice();
+        dstCall->isVoicePrivacy = (char)srcCall.is_voice_privacy();
+        dstCall->number = (char *)srcCall.number().c_str();
+        dstCall->numberPresentation = srcCall.number_presentation();
+        dstCall->name = (char *)srcCall.name().c_str();
+        dstCall->namePresentation = srcCall.name_presentation();
+        if (srcCall.has_uus_info()) {
+            dstCall->uusInfo =
+                (RIL_UUS_Info *)alloca(sizeof(RIL_UUS_Info));
+            dstCall->uusInfo->uusType =
+                (RIL_UUS_Type)srcCall.uus_info().uus_type();
+            dstCall->uusInfo->uusDcs =
+                (RIL_UUS_DCS)srcCall.uus_info().uus_dcs();
+            dstCall->uusInfo->uusLength =
+                srcCall.uus_info().uus_length();
+            dstCall->uusInfo->uusData =
+                (char *)srcCall.uus_info().uus_data().c_str();
+        } else {
+            dstCall->uusInfo = NULL;
+        }
+    }
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno, result, result_len);
+
+    DBG("RspGetCurrentCalls X rilErrno=%d", rilErrno);
+    return rilErrno;
+}
+
+/**
+ * Handle RIL_REQUEST_SIGNAL_STRENGTH response
+ */
+RIL_Errno RspSignalStrength(
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 19
+    DBG("RspSignalStrength E");
+
+    DBG("cmd = %d, token=%p, rilErrno=%d", cmd, token, rilErrno);
+
+    // Retrieve response from response message
+    ril_proto::RspSignalStrength *rsp = new ril_proto::RspSignalStrength();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    const ril_proto::RILGWSignalStrength& gwST = rsp->gw_signalstrength();
+    const ril_proto::RILCDMASignalStrength& cdmaST = rsp->cdma_signalstrength();
+    const ril_proto::RILEVDOSignalStrength& evdoST = rsp->evdo_signalstrength();
+
+    // Copy the response message from response to format defined in ril.h
+    RIL_SignalStrength curSignalStrength;
+
+    curSignalStrength.GW_SignalStrength.signalStrength = gwST.signal_strength();
+    curSignalStrength.GW_SignalStrength.bitErrorRate = gwST.bit_error_rate();
+    curSignalStrength.CDMA_SignalStrength.dbm = cdmaST.dbm();
+    curSignalStrength.CDMA_SignalStrength.ecio = cdmaST.ecio();
+    curSignalStrength.EVDO_SignalStrength.dbm = evdoST.dbm();
+    curSignalStrength.EVDO_SignalStrength.ecio = evdoST.ecio();
+    curSignalStrength.EVDO_SignalStrength.signalNoiseRatio = evdoST.signal_noise_ratio();
+
+    DBG("print response signal strength: ");
+    DBG("gw signalstrength = %d", curSignalStrength.GW_SignalStrength.signalStrength);
+    DBG("gw_signalstrength = %d", curSignalStrength.GW_SignalStrength.bitErrorRate);
+    DBG("cdma_signalstrength = %d", curSignalStrength.CDMA_SignalStrength.dbm);
+    DBG("cdma_signalstrength = %d", curSignalStrength.CDMA_SignalStrength.ecio);
+    DBG("evdo_signalstrength = %d", curSignalStrength.EVDO_SignalStrength.dbm);
+    DBG("evdo_signalstrength = %d", curSignalStrength.EVDO_SignalStrength.ecio);
+    DBG("evdo_signalstrength = %d", curSignalStrength.EVDO_SignalStrength.signalNoiseRatio);
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno, &curSignalStrength, sizeof(curSignalStrength));
+
+    DBG("RspSignalStrength X rilErrno=%d", rilErrno);
+    return rilErrno;
+}
+
+/**
+ * Handle RIL_REQUEST_OPERATOR response
+ */
+RIL_Errno RspOperator(
+        int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 22
+    int status;
+
+    DBG("RspOperator E");
+
+    ril_proto::RspOperator *rsp = new ril_proto::RspOperator();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    const char *result[3] = { NULL, NULL, NULL };
+    if (rsp->has_long_alpha_ons()) {
+        DBG("long_alpha_ons=%s", rsp->long_alpha_ons().c_str());
+        result[0] = rsp->long_alpha_ons().c_str();
+    }
+    if (rsp->has_short_alpha_ons()) {
+        DBG("short_alpha_ons=%s", rsp->short_alpha_ons().c_str());
+        result[1] = rsp->short_alpha_ons().c_str();
+    }
+    if (rsp->has_mcc_mnc()) {
+        DBG("mcc_mnc=%s", rsp->mcc_mnc().c_str());
+        result[2] = rsp->mcc_mnc().c_str();
+    }
+
+    // Complete the request
+    s_rilenv->OnRequestComplete(token, rilErrno, result, sizeof(result));
+
+    DBG("RspOperator X rilErrno=%d", rilErrno);
+    return rilErrno;
+}
+
+// ----------------- Handle unsolicited response ----------------------------------------
+ /**
+ * Handle RIL_UNSOL_SIGNAL_STRENGTH response
+ */
+void UnsolRspSignalStrength(int cmd, Buffer* buffer) {
+
+    DBG("UnsolRspSignalStrength E");
+    LOGE("unsolicited response command: %d", cmd);
+    // Retrieve response from response message
+    ril_proto::RspSignalStrength *rsp = new ril_proto::RspSignalStrength();
+    rsp->ParseFromArray(buffer->data(), buffer->length());
+    const ril_proto::RILGWSignalStrength& gwST = rsp->gw_signalstrength();
+    const ril_proto::RILCDMASignalStrength& cdmaST = rsp->cdma_signalstrength();
+    const ril_proto::RILEVDOSignalStrength& evdoST = rsp->evdo_signalstrength();
+
+    // Copy the response message from response to format defined in ril.h
+    RIL_SignalStrength curSignalStrength;
+
+    curSignalStrength.GW_SignalStrength.signalStrength = gwST.signal_strength();
+    curSignalStrength.GW_SignalStrength.bitErrorRate = gwST.bit_error_rate();
+    curSignalStrength.CDMA_SignalStrength.dbm = cdmaST.dbm();
+    curSignalStrength.CDMA_SignalStrength.ecio = cdmaST.ecio();
+    curSignalStrength.EVDO_SignalStrength.dbm = evdoST.dbm();
+    curSignalStrength.EVDO_SignalStrength.ecio = evdoST.ecio();
+    curSignalStrength.EVDO_SignalStrength.signalNoiseRatio = evdoST.signal_noise_ratio();
+
+    DBG("print response signal strength: ");
+    DBG("gw signalstrength = %d", curSignalStrength.GW_SignalStrength.signalStrength);
+    DBG("gw_signalstrength = %d", curSignalStrength.GW_SignalStrength.bitErrorRate);
+    DBG("cdma_signalstrength = %d", curSignalStrength.CDMA_SignalStrength.dbm);
+    DBG("cdma_signalstrength = %d", curSignalStrength.CDMA_SignalStrength.ecio);
+    DBG("evdo_signalstrength = %d", curSignalStrength.EVDO_SignalStrength.dbm);
+    DBG("evdo_signalstrength = %d", curSignalStrength.EVDO_SignalStrength.ecio);
+    DBG("evdo_signalstrength = %d", curSignalStrength.EVDO_SignalStrength.signalNoiseRatio);
+
+    s_rilenv->OnUnsolicitedResponse(cmd, &curSignalStrength, sizeof(curSignalStrength));
+    DBG("UnsolRspSignalStrength X");
+}
+
+/**
+ * Maps for converting request complete and unsoliciated response
+ * protobufs to ril data arrays.
+ */
+typedef RIL_Errno (*RspConversion)(
+                int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer* buffer);
+typedef std::map<int, RspConversion> RspConversionMap;
+RspConversionMap rilRspConversionMap;
+
+typedef void (*UnsolRspConversion)(int cmd, Buffer* buffer);
+typedef std::map<int, UnsolRspConversion> UnsolRspConversionMap;
+UnsolRspConversionMap unsolRilRspConversionMap;
+
+/**
+ * Send a ril request complete response.
+ */
+v8::Handle<v8::Value> SendRilRequestComplete(const v8::Arguments& args) {
+    DBG("SendRilRequestComplete E");
+    v8::HandleScope handle_scope;
+    v8::Handle<v8::Value> retValue;
+
+    int cmd;
+    RIL_Errno rilErrno;
+    RIL_Token token;
+    Buffer* buffer;
+
+    /**
+     * Get the arguments. There should be at least 3, cmd,
+     * ril error code and token. Optionally a Buffer containing
+     * the protobuf representation of the data to return.
+     */
+    if (args.Length() < REQUEST_COMPLETE_REQUIRED_CMDS) {
+        // Expecting a cmd, ERROR and token
+        LOGE("SendRilRequestComplete X %d parameters"
+             " expecting at least %d: rilErrno, cmd, and token",
+                args.Length(), REQUEST_COMPLETE_REQUIRED_CMDS);
+        return v8::Undefined();
+    }
+    v8::Handle<v8::Value> v8RilErrCode(
+                    args[REQUEST_COMPLETE_RIL_ERR_CODE_INDEX]->ToObject());
+    rilErrno = RIL_Errno(v8RilErrCode->NumberValue());
+
+    v8::Handle<v8::Value> v8Cmd(
+                    args[REQUEST_COMPLETE_CMD_INDEX]->ToObject());
+    cmd = int(v8Cmd->NumberValue());
+
+    v8::Handle<v8::Value> v8Token(
+                    args[REQUEST_COMPLETE_TOKEN_INDEX]->ToObject());
+    token = RIL_Token(int64_t(v8Token->NumberValue()));
+
+    if (args.Length() >= (REQUEST_COMPLETE_DATA_INDEX+1)) {
+        buffer = ObjectWrap::Unwrap<Buffer>(
+                    args[REQUEST_COMPLETE_DATA_INDEX]->ToObject());
+    } else {
+        buffer = NULL;
+    }
+
+    DBG("SendRilRequestComplete: rilErrno=%d, cmd=%d, token=%p", rilErrno, cmd, token);
+    RspConversionMap::iterator itr;
+    itr = rilRspConversionMap.find(cmd);
+    if (itr != rilRspConversionMap.end()) {
+        itr->second(cmd, token, rilErrno, buffer);
+    } else {
+        if ((buffer == NULL) || (buffer->length() <= 0)) {
+            // Nothing to convert
+            rilErrno = RIL_E_SUCCESS;
+        } else {
+            // There was a buffer but we don't support the resonse yet.
+            LOGE("SendRilRequestComplete: No conversion routine for cmd %d,"
+                    " return RIL_E_REQUEST_NOT_SUPPORTED", cmd);
+            rilErrno = RIL_E_REQUEST_NOT_SUPPORTED;
+        }
+        // Complete the request
+        s_rilenv->OnRequestComplete(token, rilErrno, NULL, 0);
+    }
+
+    DBG("SendRilRequestComplete X rillErrno=%d", rilErrno);
+    return v8::Undefined();
+}
+
+/**
+ * Send an unsolicited response.
+ */
+v8::Handle<v8::Value> SendRilUnsolicitedResponse(const v8::Arguments& args) {
+    DBG("SendRilUnsolicitedResponse E");
+    v8::HandleScope handle_scope;
+    v8::Handle<v8::Value> retValue;
+
+    int status;
+    void *data;
+    size_t datalen;
+
+    int cmd;
+    Buffer* buffer;
+
+    /**
+     * Get the cmd number and data arguments
+     */
+    if (args.Length() < UNSOL_RESPONSE_REQUIRED_CMDS) {
+        // Expecting a cmd
+        LOGE("SendRilUnsolicitedResponse X %d parameters"
+             " expecting at least a cmd",
+                args.Length());
+        return v8::Undefined();
+    }
+    v8::Handle<v8::Value> v8RilErrCode(args[UNSOL_RESPONSE_CMD_INDEX]->ToObject());
+    cmd = int(v8RilErrCode->NumberValue());
+
+    // data is optional
+    if (args.Length() >= (UNSOL_RESPONSE_DATA_INDEX+1)) {
+        buffer = ObjectWrap::Unwrap<Buffer>(args[UNSOL_RESPONSE_DATA_INDEX]->ToObject());
+    } else {
+        buffer = NULL;
+    }
+
+    UnsolRspConversionMap::iterator itr;
+    itr = unsolRilRspConversionMap.find(cmd);
+    if (itr != unsolRilRspConversionMap.end()) {
+        itr->second(cmd, buffer);
+    } else {
+        if ((buffer == NULL) || (buffer->length() <= 0)) {
+            // Nothing to convert
+            data = NULL;
+            datalen = 0;
+        } else {
+            // There was a buffer but we don't support the response yet.
+            LOGE("SendRilUnsolicitedResponse: No conversion routine for cmd %d,"
+                    " return RIL_E_REQUEST_NOT_SUPPORTED", cmd);
+            data = NULL;
+            datalen = 0;
+        }
+        s_rilenv->OnUnsolicitedResponse(cmd, NULL, 0);
+    }
+
+    DBG("SendRilUnsolicitedResponse X");
+    return v8::Undefined();
+}
+
+int responsesInit(v8::Handle<v8::Context> context) {
+    LOGD("responsesInit E");
+    int status = STATUS_OK;
+
+    rilRspConversionMap[RIL_REQUEST_GET_SIM_STATUS] = RspGetSimStatus; // 1
+    rilRspConversionMap[RIL_REQUEST_ENTER_SIM_PIN] = RspEnterSimPinData; // 2
+    rilRspConversionMap[RIL_REQUEST_GET_CURRENT_CALLS] = RspGetCurrentCalls; // 9
+    rilRspConversionMap[RIL_REQUEST_GET_IMSI] = RspString; // 11
+    rilRspConversionMap[RIL_REQUEST_HANGUP] = RspWithNoData; // 12
+    rilRspConversionMap[RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND] = RspWithNoData; // 13
+    rilRspConversionMap[RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND] = RspWithNoData; // 14
+    rilRspConversionMap[RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE] = RspWithNoData; // 15
+    rilRspConversionMap[RIL_REQUEST_CONFERENCE] = RspWithNoData;  // 16
+    rilRspConversionMap[RIL_REQUEST_SIGNAL_STRENGTH] = RspSignalStrength; // 19
+    rilRspConversionMap[RIL_REQUEST_REGISTRATION_STATE] = RspStrings; // 20
+    rilRspConversionMap[RIL_REQUEST_GPRS_REGISTRATION_STATE] = RspStrings; // 21
+    rilRspConversionMap[RIL_REQUEST_OPERATOR] = RspOperator; // 22
+    rilRspConversionMap[RIL_REQUEST_GET_IMEI] = RspString; // 38
+    rilRspConversionMap[RIL_REQUEST_GET_IMEISV] = RspString; // 39
+    rilRspConversionMap[RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE] = RspIntegers; // 45
+    rilRspConversionMap[RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = RspWithNoData; // 46
+    rilRspConversionMap[RIL_REQUEST_BASEBAND_VERSION] = RspString; // 51
+    rilRspConversionMap[RIL_REQUEST_SEPARATE_CONNECTION] = RspWithNoData;  // 52
+    rilRspConversionMap[RIL_REQUEST_SET_MUTE] = RspWithNoData;  // 53
+    rilRspConversionMap[RIL_REQUEST_SCREEN_STATE] = RspWithNoData; // 61
+
+    unsolRilRspConversionMap[RIL_UNSOL_SIGNAL_STRENGTH] = UnsolRspSignalStrength;  // 1009
+
+
+    LOGD("responsesInit X: status=%d", status);
+    return STATUS_OK;
+}
diff --git a/mock-ril/src/cpp/responses.h b/mock-ril/src/cpp/responses.h
new file mode 100644 (file)
index 0000000..e177066
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_RESPONSES_H_
+#define MOCK_RIL_RESPONSES_H_
+
+#include <v8.h>
+
+/**
+ * Send a ril request complete, data is optional
+ *
+ * args[0] = rilErrCode
+ * args[1] = cmd
+ * args[2] = token
+ * args[3] = optional data
+ */
+#define REQUEST_COMPLETE_REQUIRED_CMDS      3
+#define REQUEST_COMPLETE_RIL_ERR_CODE_INDEX 0
+#define REQUEST_COMPLETE_CMD_INDEX          1
+#define REQUEST_COMPLETE_TOKEN_INDEX        2
+#define REQUEST_COMPLETE_DATA_INDEX         3
+v8::Handle<v8::Value> SendRilRequestComplete(const v8::Arguments& args);
+
+/**
+ * Send a ril unsolicited response, buffer is optional
+ *
+ * args[0] = cmd
+ * args[1] = optional data
+ */
+#define UNSOL_RESPONSE_REQUIRED_CMDS      1
+#define UNSOL_RESPONSE_CMD_INDEX          0
+#define UNSOL_RESPONSE_DATA_INDEX         1
+v8::Handle<v8::Value> SendRilUnsolicitedResponse(const v8::Arguments& args);
+
+// Initialize module
+int responsesInit(v8::Handle<v8::Context> context);
+
+#endif  // MOCK_RIL_RESPONSES_H_
diff --git a/mock-ril/src/cpp/status.h b/mock-ril/src/cpp/status.h
new file mode 100644 (file)
index 0000000..cbacf22
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * Copyright (C) 2010 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 __STATUS_H_
+#define __STATUS_H_
+
+// Internal STATUS values
+#define STATUS_OK                       0
+#define STATUS_ERR                      1
+#define STATUS_BAD_DATA                 2
+#define STATUS_BAD_PARAMETER            3
+#define STATUS_UNSUPPORTED_REQUEST      4
+#define STATUS_UNSUPPORTED_RESPONSE     5
+#define STATUS_NO_JS_ONREQUEST_FUNCTION 6
+#define STATUS_COULD_NOT_OPEN_FILE      7
+#define STATUS_COULD_NOT_READ_FILE      8
+#define STATUS_CLIENT_CLOSED_CONNECTION 9
+
+
+#endif  // __STATUS_H_
diff --git a/mock-ril/src/cpp/util.cpp b/mock-ril/src/cpp/util.cpp
new file mode 100644 (file)
index 0000000..6d0bf1a
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+ * Copyright (C) 2010 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 <v8.h>
+#include <string.h>
+
+#include "logging.h"
+#include "util.h"
+
+// Extracts a C string from a V8 Utf8Value.
+const char* ToCString(const v8::String::Utf8Value& value) {
+    return *value ? *value : "<string conversion failed>";
+}
+
+// Extracts a C string from a V8 AsciiValue.
+const char* ToCString(const v8::String::AsciiValue& value) {
+    return *value ? *value : "<string conversion failed>";
+}
+
+// Extracts a C string from a v8::Value
+const char* ToCString(v8::Handle<v8::Value> value) {
+    v8::String::AsciiValue strAsciiValue(value);
+    return ToCString(strAsciiValue);
+}
+
+// Report an exception
+void LogErrorMessage(v8::Handle<v8::Message> message,
+        const char *alternate_message) {
+    v8::HandleScope handle_scope;
+    if (message.IsEmpty()) {
+        // V8 didn't provide any extra information about this error; just
+        // print the exception.
+        if (alternate_message == NULL || strlen(alternate_message) == 0) {
+            LOGD("LogErrorMessage no message");
+        } else {
+            LOGD("LogErrorMessage no message: %s", alternate_message);
+        }
+    } else {
+        v8::String::Utf8Value filename(message->GetScriptResourceName());
+        const char* filename_string = ToCString(filename);
+        int linenum = message->GetLineNumber();
+        LOGD("file:%s line:%i", filename_string, linenum);
+
+        // Print line of source code.
+        v8::String::Utf8Value sourceline(message->GetSourceLine());
+        const char* sourceline_string = ToCString(sourceline);
+        LOGD("%s", sourceline_string);
+
+        // Print location information under source line
+        int start = message->GetStartColumn();
+        int end = message->GetEndColumn();
+        int lenErr = end - start;
+        int size = end + 1;
+        if (lenErr == 0) {
+            lenErr += 1;
+            size += 1;
+        }
+        char *error_string = new char[size];
+        memset(error_string, ' ', start);
+        memset(&error_string[start], '^', lenErr);
+        error_string[size-1] = 0;
+        LOGD("%s", error_string);
+        LOGD("%s", ToCString(v8::String::Utf8Value(message->Get())));
+        delete [] error_string;
+    }
+}
+
+// Report an exception
+void ReportException(v8::TryCatch* try_catch) {
+    v8::HandleScope handle_scope;
+
+    v8::String::Utf8Value exception(try_catch->Exception());
+    v8::Handle<v8::Message> msg = try_catch->Message();
+    if (msg.IsEmpty()) {
+        // Why is try_catch->Message empty?
+        // it is always empty on compile errors
+    }
+    LogErrorMessage(msg, ToCString(exception));
+}
diff --git a/mock-ril/src/cpp/util.h b/mock-ril/src/cpp/util.h
new file mode 100644 (file)
index 0000000..1e49176
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_UTIL_H_
+#define MOCK_RIL_UTIL_H_
+
+const char* ToCString(const v8::String::Utf8Value& value);
+
+const char* ToCString(const v8::String::AsciiValue& value);
+
+const char* ToCString(v8::Handle<v8::Value> value);
+
+void LogErrorMessage(v8::Handle<v8::Message> message,
+                        const char *alternate_message);
+
+void ReportException(v8::TryCatch* try_catch);
+
+
+#endif  // MOCK_RIL_UTIL_H_
diff --git a/mock-ril/src/cpp/v8_extension.cc~ b/mock-ril/src/cpp/v8_extension.cc~
new file mode 100644 (file)
index 0000000..09397f9
--- /dev/null
@@ -0,0 +1,15 @@
+
+#include "v8_extension.h"
+
+Local<Value> v8::Object::Get(uint32_t index) {
+  ON_BAILOUT("v8::Object::Get()", return Local<v8::Value>());
+  ENTER_V8;
+  i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+  EXCEPTION_PREAMBLE();
+  i::Handle<i::Object> result = i::GetElement(self, index);
+  has_pending_exception = result.is_null();
+  EXCEPTION_BAILOUT_CHECK(Local<Value>());
+  return Utils::ToLocal(result);
+}
+
+
diff --git a/mock-ril/src/cpp/worker.cpp b/mock-ril/src/cpp/worker.cpp
new file mode 100644 (file)
index 0000000..fcd3969
--- /dev/null
@@ -0,0 +1,367 @@
+/**
+ * Copyright (C) 2010 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 "logging.h"
+#include "status.h"
+#include "worker.h"
+
+#include <time.h>
+
+#define WORKER_DEBUG
+#ifdef  WORKER_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+void * WorkerThread::Work(void *param) {
+    WorkerThread *t = (WorkerThread *)param;
+    android_atomic_acquire_store(STATE_RUNNING, &t->state_);
+    void * v = t->Worker(t->workerParam_);
+    android_atomic_acquire_store(STATE_STOPPED, &t->state_);
+    return v;
+}
+
+bool WorkerThread::isRunning() {
+    DBG("WorkerThread::isRunning E");
+    bool ret_value = android_atomic_acquire_load(&state_) == STATE_RUNNING;
+    DBG("WorkerThread::isRunning X ret_value=%d", ret_value);
+    return ret_value;
+}
+
+WorkerThread::WorkerThread() {
+    DBG("WorkerThread::WorkerThread E");
+    state_ = STATE_INITIALIZED;
+    pthread_mutex_init(&mutex_, NULL);
+    pthread_cond_init(&cond_, NULL);
+    DBG("WorkerThread::WorkerThread X");
+}
+
+WorkerThread::~WorkerThread() {
+    DBG("WorkerThread::~WorkerThread E");
+    Stop();
+    pthread_mutex_destroy(&mutex_);
+    DBG("WorkerThread::~WorkerThread X");
+}
+
+// Return true if changed from STATE_RUNNING to STATE_STOPPING
+bool WorkerThread::BeginStopping() {
+    DBG("WorkerThread::BeginStopping E");
+    bool ret_value = (android_atomic_acquire_cas(STATE_RUNNING, STATE_STOPPING, &state_) == 0);
+    DBG("WorkerThread::BeginStopping X ret_value=%d", ret_value);
+    return ret_value;
+}
+
+// Wait until state is not STATE_STOPPING
+void WorkerThread::WaitUntilStopped() {
+    DBG("WorkerThread::WaitUntilStopped E");
+    pthread_cond_signal(&cond_);
+    while(android_atomic_release_load(&state_) == STATE_STOPPING) {
+        usleep(200000);
+    }
+    DBG("WorkerThread::WaitUntilStopped X");
+}
+
+void WorkerThread::Stop() {
+    DBG("WorkerThread::Stop E");
+    if (BeginStopping()) {
+        WaitUntilStopped();
+    }
+    DBG("WorkerThread::Stop X");
+}
+
+int WorkerThread::Run(void *workerParam) {
+    DBG("WorkerThread::Run E workerParam=%p", workerParam);
+    int status;
+    int ret;
+
+    workerParam_ = workerParam;
+
+    ret = pthread_attr_init(&attr_);
+    if (ret != 0) {
+        LOGE("RIL_Init X: pthread_attr_init failed err=%s", strerror(ret));
+        return STATUS_ERR;
+    }
+    ret = pthread_attr_setdetachstate(&attr_, PTHREAD_CREATE_DETACHED);
+    if (ret != 0) {
+        LOGE("RIL_Init X: pthread_attr_setdetachstate failed err=%s",
+                strerror(ret));
+        return STATUS_ERR;
+    }
+    ret = pthread_create(&tid_, &attr_,
+                (void * (*)(void *))&WorkerThread::Work, this);
+    if (ret != 0) {
+        LOGE("RIL_Init X: pthread_create failed err=%s", strerror(ret));
+        return STATUS_ERR;
+    }
+
+    // Wait until worker is running
+    while (android_atomic_acquire_load(&state_) == STATE_INITIALIZED) {
+        usleep(200000);
+    }
+
+    DBG("WorkerThread::Run X workerParam=%p", workerParam);
+    return STATUS_OK;
+}
+
+
+class WorkerQueueThread : public WorkerThread {
+  private:
+    friend class WorkerQueue;
+
+  public:
+    WorkerQueueThread() {
+    }
+
+    virtual ~WorkerQueueThread() {
+        Stop();
+    }
+
+    void * Worker(void *param) {
+        DBG("WorkerQueueThread::Worker E");
+        WorkerQueue *wq = (WorkerQueue *)param;
+
+        // Do the work until we're told to stop
+        while (isRunning()) {
+            pthread_mutex_lock(&mutex_);
+            while (isRunning() && wq->q_.size() == 0) {
+                if (wq->delayed_q_.size() == 0) {
+                    // Both queue's are empty so wait
+                    pthread_cond_wait(&cond_, &mutex_);
+                } else {
+                    // delayed_q_ is not empty, move any
+                    // timed out records to q_.
+                    int64_t now = android::elapsedRealtime();
+                    while((wq->delayed_q_.size() != 0) &&
+                            ((wq->delayed_q_.top()->time - now) <= 0)) {
+                        struct WorkerQueue::Record *r = wq->delayed_q_.top();
+                        DBG("WorkerQueueThread::Worker move p=%p time=%lldms",
+                                r->p, r->time);
+                        wq->delayed_q_.pop();
+                        wq->q_.push_back(r);
+                    }
+
+                    if ((wq->q_.size() == 0) && (wq->delayed_q_.size() != 0)) {
+                        // We need to do a timed wait
+                        struct timeval tv;
+                        struct timespec ts;
+                        struct WorkerQueue::Record *r = wq->delayed_q_.top();
+                        int64_t delay_ms = r->time - now;
+                        DBG("WorkerQueueThread::Worker wait"
+                            " p=%p time=%lldms delay_ms=%lldms",
+                                r->p, r->time, delay_ms);
+                        gettimeofday(&tv, NULL);
+                        ts.tv_sec = tv.tv_sec + (delay_ms / 1000);
+                        ts.tv_nsec = (tv.tv_usec +
+                                        ((delay_ms % 1000) * 1000)) * 1000;
+                        pthread_cond_timedwait(&cond_, &mutex_, &ts);
+                    }
+                }
+            }
+            if (isRunning()) {
+                struct WorkerQueue::Record *r = wq->q_.front();
+                wq->q_.pop_front();
+                void *p = r->p;
+                wq->release_record(r);
+                pthread_mutex_unlock(&mutex_);
+                wq->Process(r->p);
+            } else {
+                pthread_mutex_unlock(&mutex_);
+            }
+        }
+        DBG("WorkerQueueThread::Worker X");
+        return NULL;
+    }
+};
+
+WorkerQueue::WorkerQueue() {
+    DBG("WorkerQueue::WorkerQueue E");
+    wqt_ = new WorkerQueueThread();
+    DBG("WorkerQueue::WorkerQueue X");
+}
+
+WorkerQueue::~WorkerQueue() {
+    DBG("WorkerQueue::~WorkerQueue E");
+    Stop();
+
+    Record *r;
+    pthread_mutex_lock(&wqt_->mutex_);
+    while(free_list_.size() != 0) {
+        r = free_list_.front();
+        free_list_.pop_front();
+        DBG("WorkerQueue::~WorkerQueue delete free_list_ r=%p", r);
+        delete r;
+    }
+    while(delayed_q_.size() != 0) {
+        r = delayed_q_.top();
+        delayed_q_.pop();
+        DBG("WorkerQueue::~WorkerQueue delete delayed_q_ r=%p", r);
+        delete r;
+    }
+    pthread_mutex_unlock(&wqt_->mutex_);
+
+    delete wqt_;
+    DBG("WorkerQueue::~WorkerQueue X");
+}
+
+int WorkerQueue::Run() {
+    return wqt_->Run(this);
+}
+
+void WorkerQueue::Stop() {
+    wqt_->Stop();
+}
+
+/**
+ * Obtain a record from free_list if it is not empty, fill in the record with provided
+ * information: *p and delay_in_ms
+ */
+struct WorkerQueue::Record *WorkerQueue::obtain_record(void *p, int delay_in_ms) {
+    struct Record *r;
+    if (free_list_.size() == 0) {
+        r = new Record();
+        DBG("WorkerQueue::obtain_record new r=%p", r);
+    } else {
+        r = free_list_.front();
+        DBG("WorkerQueue::obtain_record reuse r=%p", r);
+        free_list_.pop_front();
+    }
+    r->p = p;
+    if (delay_in_ms != 0) {
+        r->time = android::elapsedRealtime() + delay_in_ms;
+    } else {
+        r->time = 0;
+    }
+    return r;
+}
+
+/**
+ * release a record and insert into the front of the free_list
+ */
+void WorkerQueue::release_record(struct Record *r) {
+    DBG("WorkerQueue::release_record r=%p", r);
+    free_list_.push_front(r);
+}
+
+/**
+ * Add a record to processing queue q_
+ */
+void WorkerQueue::Add(void *p) {
+    DBG("WorkerQueue::Add E:");
+    pthread_mutex_lock(&wqt_->mutex_);
+    struct Record *r = obtain_record(p, 0);
+    q_.push_back(r);
+    if (q_.size() == 1) {
+        pthread_cond_signal(&wqt_->cond_);
+    }
+    pthread_mutex_unlock(&wqt_->mutex_);
+    DBG("WorkerQueue::Add X:");
+}
+
+void WorkerQueue::AddDelayed(void *p, int delay_in_ms) {
+    DBG("WorkerQueue::AddDelayed E:");
+    if (delay_in_ms <= 0) {
+        Add(p);
+    } else {
+        pthread_mutex_lock(&wqt_->mutex_);
+        struct Record *r = obtain_record(p, delay_in_ms);
+        delayed_q_.push(r);
+#ifdef WORKER_DEBUG
+        int64_t now = android::elapsedRealtime();
+        DBG("WorkerQueue::AddDelayed"
+            " p=%p delay_in_ms=%d now=%lldms top->p=%p"
+            " top->time=%lldms diff=%lldms",
+                p, delay_in_ms, now, delayed_q_.top()->p,
+                delayed_q_.top()->time, delayed_q_.top()->time - now);
+#endif
+        if ((q_.size() == 0) && (delayed_q_.top() == r)) {
+            // q_ is empty and the new record is at delayed_q_.top
+            // so we signal the waiting thread so it can readjust
+            // the wait time.
+            DBG("WorkerQueue::AddDelayed signal");
+            pthread_cond_signal(&wqt_->cond_);
+        }
+        pthread_mutex_unlock(&wqt_->mutex_);
+    }
+    DBG("WorkerQueue::AddDelayed X:");
+}
+
+
+class TestWorkerQueue : public WorkerQueue {
+    virtual void Process(void *p) {
+        LOGD("TestWorkerQueue::Process: EX p=%p", p);
+    }
+};
+
+class TesterThread : public WorkerThread {
+  public:
+    void * Worker(void *param)
+    {
+        LOGD("TesterThread::Worker E param=%p", param);
+        WorkerQueue *wq = (WorkerQueue *)param;
+
+        // Test AddDelayed
+        wq->AddDelayed((void *)1000, 1000);
+        wq->Add((void *)0);
+        wq->Add((void *)0);
+        wq->Add((void *)0);
+        wq->Add((void *)0);
+        wq->AddDelayed((void *)100, 100);
+        wq->AddDelayed((void *)2000, 2000);
+
+        for (int i = 1; isRunning(); i++) {
+            LOGD("TesterThread: looping %d", i);
+            wq->Add((void *)i);
+            wq->Add((void *)i);
+            wq->Add((void *)i);
+            wq->Add((void *)i);
+            sleep(1);
+        }
+
+        LOGD("TesterThread::Worker X param=%p", param);
+
+        return NULL;
+    }
+};
+
+void testWorker() {
+    LOGD("testWorker E: ********");
+
+    // Test we can create a thread and delete it
+    TesterThread *tester = new TesterThread();
+    delete tester;
+
+    TestWorkerQueue *wq = new TestWorkerQueue();
+    if (wq->Run() == STATUS_OK) {
+        LOGD("testWorker WorkerQueue %p running", wq);
+
+        // Test we can run a thread, stop it then delete it
+        tester = new TesterThread();
+        tester->Run(wq);
+        LOGD("testWorker tester %p running", tester);
+        sleep(10);
+        LOGD("testWorker tester %p stopping", tester);
+        tester->Stop();
+        LOGD("testWorker tester %p stopped", tester);
+        wq->Stop();
+        LOGD("testWorker wq %p stopped", wq);
+    }
+    LOGD("testWorker X: ********\n");
+}
diff --git a/mock-ril/src/cpp/worker.h b/mock-ril/src/cpp/worker.h
new file mode 100644 (file)
index 0000000..9518fb3
--- /dev/null
@@ -0,0 +1,149 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_WORKER_H_
+#define MOCK_RIL_WORKER_H_
+
+#include <queue>
+#include <list>
+#include <vector>
+#include <pthread.h>
+#include <cutils/atomic.h>
+#include <utils/SystemClock.h>
+
+/**
+ * A Thread class.
+ *
+ * 0) Extend WorkerThread creating a Worker method which
+ *    monitors isRunning(). For example:
+ *
+ *   void * Worker(void *param) {
+ *       while (isRunning() == 0) {
+ *           pthread_mutex_lock(&mutex_);
+ *           while (isRunning() && !SOME-CONDITION) {
+ *               pthread_cond_wait(&cond_, &mutex_);
+ *           }
+ *           if (isRunning()) {
+ *               DO-WORK
+ *           } else {
+ *               pthread_mutex_unlock(&mutex_);
+ *           }
+ *       }
+ *       return NULL;
+ *   }
+ *
+ * 1) Create the WorkerThread.
+ * 2) Execute Run passing a param which will be passed to Worker.
+ * 3) Call Stop() or destroy the thread to stop processing.
+ *
+ */
+class WorkerThread {
+  protected:
+    pthread_attr_t attr_;
+    pthread_mutex_t mutex_;
+    pthread_cond_t cond_;
+    pthread_t tid_;
+    void *workerParam_;
+
+    #define STATE_INITIALIZED   1
+    #define STATE_RUNNING       2
+    #define STATE_STOPPING      3
+    #define STATE_STOPPED       4
+    int32_t state_;
+
+    static void * Work(void *param);
+
+    virtual bool isRunning();
+
+  public:
+    WorkerThread();
+
+    virtual ~WorkerThread();
+
+    // Return true if changed from STATE_RUNNING to STATE_STOPPING
+    virtual bool BeginStopping();
+
+    // Wait until state is not STATE_STOPPING
+    virtual void WaitUntilStopped();
+
+    virtual void Stop();
+
+    virtual int Run(void *workerParam);
+
+    /**
+     * Method called to do work, see example above.
+     * While running isRunning() must be monitored.
+     */
+    virtual void *Worker(void *) = 0;
+};
+
+
+/**
+ * A WorkerQueue.
+ *
+ * 0) Extend overriding Process
+ * 1) Create an instance
+ * 2) Call Run.
+ * 3) Call Add, passing a pointer which is added to a queue
+ * 4) Process will be called with a pointer as work can be done.
+ */
+class WorkerQueue {
+  private:
+    friend class WorkerQueueThread;
+
+    struct Record {
+        int64_t time;
+        void *p;
+    };
+
+    class record_compare {
+      public:
+        // To get ascending order return true if lhs > rhs.
+        bool operator() (const struct Record* lhs, const struct Record* rhs) const {
+            return lhs->time > rhs->time;
+        }
+    };
+
+    std::list<struct Record *> q_;                // list of records to be processed
+    std::list<struct Record *> free_list_;        // list of records that have been released
+    std::priority_queue<struct Record *, std::vector<struct Record *>, record_compare> delayed_q_;
+                                                  // list of records that are delayed
+    class WorkerQueueThread *wqt_;
+
+  protected:
+    struct Record *obtain_record(void *p, int delay_in_ms);
+
+    void release_record(struct Record *r);
+
+  public:
+    WorkerQueue();
+
+    virtual ~WorkerQueue();
+
+    int Run();
+
+    void Stop();
+
+    void Add(void *p);
+
+    void AddDelayed(void *p, int delay_in_ms);
+
+    virtual void Process(void *) = 0;
+};
+
+extern void testWorker();
+
+#endif // MOCK_RIL_WORKER_H_
diff --git a/mock-ril/src/cpp/worker_v8.cpp b/mock-ril/src/cpp/worker_v8.cpp
new file mode 100644 (file)
index 0000000..61e1d3b
--- /dev/null
@@ -0,0 +1,224 @@
+/**
+ * Copyright (C) 2010 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 <queue>
+#include <v8.h>
+
+#include "logging.h"
+#include "js_support.h"
+#include "node_object_wrap.h"
+#include "node_util.h"
+#include "util.h"
+#include "worker.h"
+
+#include "worker_v8.h"
+
+
+//#define WORKER_V8_V8_DEBUG
+#ifdef  WORKER_V8_V8_DEBUG
+
+#define DBG(...) LOGD(__VA_ARGS__)
+
+#else
+
+#define DBG(...)
+
+#endif
+
+v8::Persistent<v8::FunctionTemplate> WorkerV8Template;
+
+class WorkerV8 : public ObjectWrap {
+  private:
+    friend class Handler;
+
+
+    struct ArgInfo {
+        v8::Persistent<v8::Object> js_this;
+        v8::Persistent<v8::Value> value;
+    };
+
+    pthread_mutex_t ai_free_list_mutex_;
+    std::queue<ArgInfo *>  ai_free_list_;
+
+    ArgInfo *ObtainArgInfo() {
+        ArgInfo *ai;
+        pthread_mutex_lock(&ai_free_list_mutex_);
+        if (ai_free_list_.size() == 0) {
+            ai = new ArgInfo();
+        } else {
+            ai = ai_free_list_.front();
+            ai_free_list_.pop();
+        }
+        pthread_mutex_unlock(&ai_free_list_mutex_);
+        return ai;
+    }
+
+    void ReleaseArgInfo(ArgInfo *ai) {
+        pthread_mutex_lock(&ai_free_list_mutex_);
+        ai_free_list_.push(ai);
+        pthread_mutex_unlock(&ai_free_list_mutex_);
+    }
+
+    class Handler : public WorkerQueue {
+      private:
+        v8::Persistent<v8::Value> functionValue_;
+        WorkerV8 *worker_;
+
+      public:
+        Handler(WorkerV8 *worker, v8::Handle<v8::Value> value)
+            : worker_(worker) {
+            functionValue_ = v8::Persistent<v8::Value>::New(value);
+        }
+
+        void Process(void *param) {
+            DBG("Handler::Process: E");
+
+            v8::Locker locker;
+            v8::HandleScope handle_scope;
+            v8::TryCatch try_catch;
+            try_catch.SetVerbose(true);
+
+            ArgInfo *ai = (ArgInfo*)param;
+            v8::Handle<v8::Value> args(ai->value);
+            v8::Function::Cast(*functionValue_)->Call(ai->js_this, 1, &args);
+
+            ai->js_this.Dispose();
+            ai->value.Dispose();
+
+            worker_->ReleaseArgInfo(ai);
+
+            DBG("Handler::Process: X");
+        }
+    };
+
+    Handler *handler_;
+
+  public:
+    WorkerV8(v8::Handle<v8::Object> self, v8::Handle<v8::Value> functionValue) {
+        DBG("WorkerV8::WorkerV8 E:");
+        pthread_mutex_init(&ai_free_list_mutex_, NULL);
+        handler_ = new Handler(this, functionValue);
+        Wrap(self);
+        DBG("WorkerV8::WorkerV8 X: this=%p handler_=%p", this, handler_);
+    }
+
+    virtual ~WorkerV8() {
+        DBG("~WorkerV8::WorkerV8 E:");
+        DBG("~WorkerV8::WorkerV8 X:");
+    }
+
+    static v8::Handle<v8::Value> Run(const v8::Arguments& args) {
+        WorkerV8 *workerV8 = ObjectWrap::Unwrap<WorkerV8>(args.This());
+        DBG("WorkerV8::Run(args) E:");
+        workerV8->handler_->Run();
+        DBG("WorkerV8::Run(args) X:");
+        return v8::Undefined();
+    }
+
+    static v8::Handle<v8::Value> Add(const v8::Arguments& args) {
+        DBG("WorkerV8::Add(args) E:");
+        WorkerV8 *workerV8 = ObjectWrap::Unwrap<WorkerV8>(args.This());
+
+        // Validate one argument to add
+        if (args.Length() != 1) {
+            DBG("WorkerV8::Add(args) X: expecting one param");
+            return v8::ThrowException(v8::String::New("Add has no parameter"));
+        }
+        ArgInfo *ai = workerV8->ObtainArgInfo();
+        ai->js_this = v8::Persistent<v8::Object>::New( args.This() );
+        ai->value = v8::Persistent<v8::Value>::New( args[0] );
+
+        workerV8->handler_->Add(ai);
+        DBG("WorkerV8::Add(args) X:");
+        return v8::Undefined();
+    }
+
+    static v8::Handle<v8::Value> AddDelayed(const v8::Arguments& args) {
+        DBG("WorkerV8::AddDelayed(args) E:");
+        WorkerV8 *workerV8 = ObjectWrap::Unwrap<WorkerV8>(args.This());
+
+        // Validate two argument to addDelayed
+        if (args.Length() != 2) {
+            DBG("WorkerV8::AddDelayed(args) X: expecting two params");
+            return v8::ThrowException(v8::String::New("AddDelayed expects req delayTime params"));
+        }
+        ArgInfo *ai = workerV8->ObtainArgInfo();
+        ai->js_this = v8::Persistent<v8::Object>::New( args.This() );
+        ai->value = v8::Persistent<v8::Value>::New( args[0] );
+        v8::Handle<v8::Value> v8DelayMs(args[1]->ToObject());
+        int32_t delay_ms = v8DelayMs->Int32Value();
+        workerV8->handler_->AddDelayed(ai, delay_ms);
+
+        DBG("WorkerV8::AddDelayed(args) X:");
+        return v8::Undefined();
+    }
+
+    static v8::Handle<v8::Value> NewWorkerV8(const v8::Arguments& args) {
+        DBG("WorkerV8::NewWorkerV8 E: args.Length()=%d", args.Length());
+        WorkerV8 *worker = new WorkerV8(args.This(), args[0]);
+        DBG("WorkerV8::NewWorkerV8 X:");
+        return worker->handle_;
+    }
+};
+
+void WorkerV8Init() {
+    DBG("WorkerV8Init E:");
+    v8::HandleScope handle_scope;
+
+    WorkerV8Template = v8::Persistent<v8::FunctionTemplate>::New(
+                           v8::FunctionTemplate::New(WorkerV8::NewWorkerV8));
+    WorkerV8Template->SetClassName(v8::String::New("Worker"));
+    // native self (Field 0 is handle_) field count is at least 1
+    WorkerV8Template->InstanceTemplate()->SetInternalFieldCount(1);
+
+    // Set prototype methods
+    SET_PROTOTYPE_METHOD(WorkerV8Template, "run", WorkerV8::Run);
+    SET_PROTOTYPE_METHOD(WorkerV8Template, "add", WorkerV8::Add);
+    SET_PROTOTYPE_METHOD(WorkerV8Template, "addDelayed", WorkerV8::AddDelayed);
+
+    DBG("WorkerV8Init X:");
+}
+
+void testWorkerV8(v8::Handle<v8::Context> context) {
+    LOGD("testWorkerV8 E: ********");
+    v8::HandleScope handle_scope;
+
+    v8::TryCatch try_catch;
+    try_catch.SetVerbose(true);
+
+    LOGD("testWorkerV8 runJs");
+    runJs(context, &try_catch, "local-string",
+        "var w1 = new Worker(function (msg) {"
+        "     print('w1: ' + msg);\n"
+        "});\n"
+        "w1.run();\n"
+        "var w2 = new Worker(function (msg) {"
+        "     print('w2: ' + msg);\n"
+        "});\n"
+        "w2.run();\n"
+        "w2.addDelayed('three', 1000);\n"
+        "w2.add('one');\n"
+        "w1.add('two');\n"
+        "w1.addDelayed('four', 2000);\n"
+    );
+    LOGD("testWorkerV8 X: ********");
+}
+
+extern void WorkerV8ObjectTemplateInit(v8::Handle<v8::ObjectTemplate> target) {
+    DBG("WorkerV8ObjectTemplateInit(target) E:");
+    target->Set(v8::String::New("Worker"), WorkerV8Template);
+    DBG("WorkerV8ObjectTemplateInit(target) X:\n");
+}
diff --git a/mock-ril/src/cpp/worker_v8.h b/mock-ril/src/cpp/worker_v8.h
new file mode 100644 (file)
index 0000000..7c9bb88
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Copyright (C) 2010 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 MOCK_RIL_WORKER_V8_H_
+#define MOCK_RIL_WORKER_V8_H_
+
+#include <v8.h>
+
+// Initialize this module
+extern void WorkerV8Init();
+
+// Add Worker to the object template
+extern void WorkerV8ObjectTemplateInit(v8::Handle<v8::ObjectTemplate> target);
+
+extern void testWorkerV8(v8::Handle<v8::Context> context);
+
+#endif //  MOCK_RIL_WORKER_V8_H_
diff --git a/mock-ril/src/generated/cpp/ctrl.pb.cpp b/mock-ril/src/generated/cpp/ctrl.pb.cpp
new file mode 100644 (file)
index 0000000..03eed89
--- /dev/null
@@ -0,0 +1,842 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
+#include "ctrl.pb.h"
+#include <google/protobuf/stubs/once.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/reflection_ops.h>
+#include <google/protobuf/wire_format.h>
+// @@protoc_insertion_point(includes)
+
+namespace ril_proto {
+
+namespace {
+
+const ::google::protobuf::Descriptor* CtrlReqRadioState_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  CtrlReqRadioState_reflection_ = NULL;
+const ::google::protobuf::Descriptor* CtrlRspRadioState_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  CtrlRspRadioState_reflection_ = NULL;
+const ::google::protobuf::Descriptor* CtrlReqSetMTCall_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  CtrlReqSetMTCall_reflection_ = NULL;
+const ::google::protobuf::EnumDescriptor* CtrlCmd_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* CtrlStatus_descriptor_ = NULL;
+
+}  // namespace
+
+
+void protobuf_AssignDesc_ctrl_2eproto() {
+  protobuf_AddDesc_ctrl_2eproto();
+  const ::google::protobuf::FileDescriptor* file =
+    ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
+      "ctrl.proto");
+  GOOGLE_CHECK(file != NULL);
+  CtrlReqRadioState_descriptor_ = file->message_type(0);
+  static const int CtrlReqRadioState_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlReqRadioState, state_),
+  };
+  CtrlReqRadioState_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      CtrlReqRadioState_descriptor_,
+      CtrlReqRadioState::default_instance_,
+      CtrlReqRadioState_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlReqRadioState, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlReqRadioState, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(CtrlReqRadioState));
+  CtrlRspRadioState_descriptor_ = file->message_type(1);
+  static const int CtrlRspRadioState_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlRspRadioState, state_),
+  };
+  CtrlRspRadioState_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      CtrlRspRadioState_descriptor_,
+      CtrlRspRadioState::default_instance_,
+      CtrlRspRadioState_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlRspRadioState, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlRspRadioState, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(CtrlRspRadioState));
+  CtrlReqSetMTCall_descriptor_ = file->message_type(2);
+  static const int CtrlReqSetMTCall_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlReqSetMTCall, phone_number_),
+  };
+  CtrlReqSetMTCall_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      CtrlReqSetMTCall_descriptor_,
+      CtrlReqSetMTCall::default_instance_,
+      CtrlReqSetMTCall_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlReqSetMTCall, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CtrlReqSetMTCall, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(CtrlReqSetMTCall));
+  CtrlCmd_descriptor_ = file->enum_type(0);
+  CtrlStatus_descriptor_ = file->enum_type(1);
+}
+
+namespace {
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
+inline void protobuf_AssignDescriptorsOnce() {
+  ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
+                 &protobuf_AssignDesc_ctrl_2eproto);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    CtrlReqRadioState_descriptor_, &CtrlReqRadioState::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    CtrlRspRadioState_descriptor_, &CtrlRspRadioState::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    CtrlReqSetMTCall_descriptor_, &CtrlReqSetMTCall::default_instance());
+}
+
+}  // namespace
+
+void protobuf_ShutdownFile_ctrl_2eproto() {
+  delete CtrlReqRadioState::default_instance_;
+  delete CtrlReqRadioState_reflection_;
+  delete CtrlRspRadioState::default_instance_;
+  delete CtrlRspRadioState_reflection_;
+  delete CtrlReqSetMTCall::default_instance_;
+  delete CtrlReqSetMTCall_reflection_;
+}
+
+void protobuf_AddDesc_ctrl_2eproto() {
+  static bool already_here = false;
+  if (already_here) return;
+  already_here = true;
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+  ::ril_proto::protobuf_AddDesc_ril_2eproto();
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+    "\n\nctrl.proto\022\tril_proto\032\tril.proto\"9\n\021Ct"
+    "rlReqRadioState\022$\n\005state\030\001 \002(\0162\025.ril_pro"
+    "to.RadioState\"9\n\021CtrlRspRadioState\022$\n\005st"
+    "ate\030\001 \002(\0162\025.ril_proto.RadioState\"(\n\020Ctrl"
+    "ReqSetMTCall\022\024\n\014phone_number\030\001 \002(\t*r\n\007Ct"
+    "rlCmd\022\021\n\rCTRL_CMD_ECHO\020\000\022\034\n\030CTRL_CMD_GET"
+    "_RADIO_STATE\020\001\022\034\n\030CTRL_CMD_SET_RADIO_STA"
+    "TE\020\002\022\030\n\024CTRL_CMD_SET_MT_CALL\020\003*5\n\nCtrlSt"
+    "atus\022\022\n\016CTRL_STATUS_OK\020\000\022\023\n\017CTRL_STATUS_"
+    "ERR\020\001B7\n(com.android.internal.telephony."
+    "ril_protoB\013RilCtrlCmds", 422);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "ctrl.proto", &protobuf_RegisterTypes);
+  CtrlReqRadioState::default_instance_ = new CtrlReqRadioState();
+  CtrlRspRadioState::default_instance_ = new CtrlRspRadioState();
+  CtrlReqSetMTCall::default_instance_ = new CtrlReqSetMTCall();
+  CtrlReqRadioState::default_instance_->InitAsDefaultInstance();
+  CtrlRspRadioState::default_instance_->InitAsDefaultInstance();
+  CtrlReqSetMTCall::default_instance_->InitAsDefaultInstance();
+  ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_ctrl_2eproto);
+}
+
+// Force AddDescriptors() to be called at static initialization time.
+struct StaticDescriptorInitializer_ctrl_2eproto {
+  StaticDescriptorInitializer_ctrl_2eproto() {
+    protobuf_AddDesc_ctrl_2eproto();
+  }
+} static_descriptor_initializer_ctrl_2eproto_;
+
+const ::google::protobuf::EnumDescriptor* CtrlCmd_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return CtrlCmd_descriptor_;
+}
+bool CtrlCmd_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* CtrlStatus_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return CtrlStatus_descriptor_;
+}
+bool CtrlStatus_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+      return true;
+    default:
+      return false;
+  }
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int CtrlReqRadioState::kStateFieldNumber;
+#endif  // !_MSC_VER
+
+CtrlReqRadioState::CtrlReqRadioState()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void CtrlReqRadioState::InitAsDefaultInstance() {
+}
+
+CtrlReqRadioState::CtrlReqRadioState(const CtrlReqRadioState& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void CtrlReqRadioState::SharedCtor() {
+  _cached_size_ = 0;
+  state_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+CtrlReqRadioState::~CtrlReqRadioState() {
+  SharedDtor();
+}
+
+void CtrlReqRadioState::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void CtrlReqRadioState::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* CtrlReqRadioState::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return CtrlReqRadioState_descriptor_;
+}
+
+const CtrlReqRadioState& CtrlReqRadioState::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ctrl_2eproto();  return *default_instance_;
+}
+
+CtrlReqRadioState* CtrlReqRadioState::default_instance_ = NULL;
+
+CtrlReqRadioState* CtrlReqRadioState::New() const {
+  return new CtrlReqRadioState;
+}
+
+void CtrlReqRadioState::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    state_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool CtrlReqRadioState::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required .ril_proto.RadioState state = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RadioState_IsValid(value)) {
+            set_state(static_cast< ril_proto::RadioState >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(1, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void CtrlReqRadioState::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required .ril_proto.RadioState state = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->state(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* CtrlReqRadioState::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required .ril_proto.RadioState state = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->state(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int CtrlReqRadioState::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required .ril_proto.RadioState state = 1;
+    if (has_state()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->state());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void CtrlReqRadioState::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const CtrlReqRadioState* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const CtrlReqRadioState*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void CtrlReqRadioState::MergeFrom(const CtrlReqRadioState& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_state(from.state());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void CtrlReqRadioState::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void CtrlReqRadioState::CopyFrom(const CtrlReqRadioState& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool CtrlReqRadioState::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void CtrlReqRadioState::Swap(CtrlReqRadioState* other) {
+  if (other != this) {
+    std::swap(state_, other->state_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata CtrlReqRadioState::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = CtrlReqRadioState_descriptor_;
+  metadata.reflection = CtrlReqRadioState_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int CtrlRspRadioState::kStateFieldNumber;
+#endif  // !_MSC_VER
+
+CtrlRspRadioState::CtrlRspRadioState()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void CtrlRspRadioState::InitAsDefaultInstance() {
+}
+
+CtrlRspRadioState::CtrlRspRadioState(const CtrlRspRadioState& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void CtrlRspRadioState::SharedCtor() {
+  _cached_size_ = 0;
+  state_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+CtrlRspRadioState::~CtrlRspRadioState() {
+  SharedDtor();
+}
+
+void CtrlRspRadioState::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void CtrlRspRadioState::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* CtrlRspRadioState::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return CtrlRspRadioState_descriptor_;
+}
+
+const CtrlRspRadioState& CtrlRspRadioState::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ctrl_2eproto();  return *default_instance_;
+}
+
+CtrlRspRadioState* CtrlRspRadioState::default_instance_ = NULL;
+
+CtrlRspRadioState* CtrlRspRadioState::New() const {
+  return new CtrlRspRadioState;
+}
+
+void CtrlRspRadioState::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    state_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool CtrlRspRadioState::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required .ril_proto.RadioState state = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RadioState_IsValid(value)) {
+            set_state(static_cast< ril_proto::RadioState >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(1, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void CtrlRspRadioState::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required .ril_proto.RadioState state = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->state(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* CtrlRspRadioState::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required .ril_proto.RadioState state = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->state(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int CtrlRspRadioState::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required .ril_proto.RadioState state = 1;
+    if (has_state()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->state());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void CtrlRspRadioState::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const CtrlRspRadioState* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const CtrlRspRadioState*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void CtrlRspRadioState::MergeFrom(const CtrlRspRadioState& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_state(from.state());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void CtrlRspRadioState::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void CtrlRspRadioState::CopyFrom(const CtrlRspRadioState& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool CtrlRspRadioState::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void CtrlRspRadioState::Swap(CtrlRspRadioState* other) {
+  if (other != this) {
+    std::swap(state_, other->state_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata CtrlRspRadioState::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = CtrlRspRadioState_descriptor_;
+  metadata.reflection = CtrlRspRadioState_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+const ::std::string CtrlReqSetMTCall::_default_phone_number_;
+#ifndef _MSC_VER
+const int CtrlReqSetMTCall::kPhoneNumberFieldNumber;
+#endif  // !_MSC_VER
+
+CtrlReqSetMTCall::CtrlReqSetMTCall()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void CtrlReqSetMTCall::InitAsDefaultInstance() {
+}
+
+CtrlReqSetMTCall::CtrlReqSetMTCall(const CtrlReqSetMTCall& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void CtrlReqSetMTCall::SharedCtor() {
+  _cached_size_ = 0;
+  phone_number_ = const_cast< ::std::string*>(&_default_phone_number_);
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+CtrlReqSetMTCall::~CtrlReqSetMTCall() {
+  SharedDtor();
+}
+
+void CtrlReqSetMTCall::SharedDtor() {
+  if (phone_number_ != &_default_phone_number_) {
+    delete phone_number_;
+  }
+  if (this != default_instance_) {
+  }
+}
+
+void CtrlReqSetMTCall::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* CtrlReqSetMTCall::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return CtrlReqSetMTCall_descriptor_;
+}
+
+const CtrlReqSetMTCall& CtrlReqSetMTCall::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ctrl_2eproto();  return *default_instance_;
+}
+
+CtrlReqSetMTCall* CtrlReqSetMTCall::default_instance_ = NULL;
+
+CtrlReqSetMTCall* CtrlReqSetMTCall::New() const {
+  return new CtrlReqSetMTCall;
+}
+
+void CtrlReqSetMTCall::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (_has_bit(0)) {
+      if (phone_number_ != &_default_phone_number_) {
+        phone_number_->clear();
+      }
+    }
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool CtrlReqSetMTCall::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required string phone_number = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_phone_number()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->phone_number().data(), this->phone_number().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void CtrlReqSetMTCall::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required string phone_number = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->phone_number().data(), this->phone_number().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      1, this->phone_number(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* CtrlReqSetMTCall::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required string phone_number = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->phone_number().data(), this->phone_number().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        1, this->phone_number(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int CtrlReqSetMTCall::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required string phone_number = 1;
+    if (has_phone_number()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->phone_number());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void CtrlReqSetMTCall::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const CtrlReqSetMTCall* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const CtrlReqSetMTCall*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void CtrlReqSetMTCall::MergeFrom(const CtrlReqSetMTCall& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_phone_number(from.phone_number());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void CtrlReqSetMTCall::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void CtrlReqSetMTCall::CopyFrom(const CtrlReqSetMTCall& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool CtrlReqSetMTCall::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void CtrlReqSetMTCall::Swap(CtrlReqSetMTCall* other) {
+  if (other != this) {
+    std::swap(phone_number_, other->phone_number_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata CtrlReqSetMTCall::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = CtrlReqSetMTCall_descriptor_;
+  metadata.reflection = CtrlReqSetMTCall_reflection_;
+  return metadata;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace ril_proto
+
+// @@protoc_insertion_point(global_scope)
diff --git a/mock-ril/src/generated/cpp/ctrl.pb.h b/mock-ril/src/generated/cpp/ctrl.pb.h
new file mode 100644 (file)
index 0000000..28432ce
--- /dev/null
@@ -0,0 +1,466 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: ctrl.proto
+
+#ifndef PROTOBUF_ctrl_2eproto__INCLUDED
+#define PROTOBUF_ctrl_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 2003000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please update
+#error your headers.
+#endif
+#if 2003000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/extension_set.h>
+#include <google/protobuf/generated_message_reflection.h>
+#include "ril.pb.h"
+// @@protoc_insertion_point(includes)
+
+namespace ril_proto {
+
+// Internal implementation detail -- do not call these.
+void  protobuf_AddDesc_ctrl_2eproto();
+void protobuf_AssignDesc_ctrl_2eproto();
+void protobuf_ShutdownFile_ctrl_2eproto();
+
+class CtrlReqRadioState;
+class CtrlRspRadioState;
+class CtrlReqSetMTCall;
+
+enum CtrlCmd {
+  CTRL_CMD_ECHO = 0,
+  CTRL_CMD_GET_RADIO_STATE = 1,
+  CTRL_CMD_SET_RADIO_STATE = 2,
+  CTRL_CMD_SET_MT_CALL = 3
+};
+bool CtrlCmd_IsValid(int value);
+const CtrlCmd CtrlCmd_MIN = CTRL_CMD_ECHO;
+const CtrlCmd CtrlCmd_MAX = CTRL_CMD_SET_MT_CALL;
+const int CtrlCmd_ARRAYSIZE = CtrlCmd_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* CtrlCmd_descriptor();
+inline const ::std::string& CtrlCmd_Name(CtrlCmd value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    CtrlCmd_descriptor(), value);
+}
+inline bool CtrlCmd_Parse(
+    const ::std::string& name, CtrlCmd* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<CtrlCmd>(
+    CtrlCmd_descriptor(), name, value);
+}
+enum CtrlStatus {
+  CTRL_STATUS_OK = 0,
+  CTRL_STATUS_ERR = 1
+};
+bool CtrlStatus_IsValid(int value);
+const CtrlStatus CtrlStatus_MIN = CTRL_STATUS_OK;
+const CtrlStatus CtrlStatus_MAX = CTRL_STATUS_ERR;
+const int CtrlStatus_ARRAYSIZE = CtrlStatus_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* CtrlStatus_descriptor();
+inline const ::std::string& CtrlStatus_Name(CtrlStatus value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    CtrlStatus_descriptor(), value);
+}
+inline bool CtrlStatus_Parse(
+    const ::std::string& name, CtrlStatus* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<CtrlStatus>(
+    CtrlStatus_descriptor(), name, value);
+}
+// ===================================================================
+
+class CtrlReqRadioState : public ::google::protobuf::Message {
+ public:
+  CtrlReqRadioState();
+  virtual ~CtrlReqRadioState();
+  
+  CtrlReqRadioState(const CtrlReqRadioState& from);
+  
+  inline CtrlReqRadioState& operator=(const CtrlReqRadioState& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const CtrlReqRadioState& default_instance();
+  
+  void Swap(CtrlReqRadioState* other);
+  
+  // implements Message ----------------------------------------------
+  
+  CtrlReqRadioState* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const CtrlReqRadioState& from);
+  void MergeFrom(const CtrlReqRadioState& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required .ril_proto.RadioState state = 1;
+  inline bool has_state() const;
+  inline void clear_state();
+  static const int kStateFieldNumber = 1;
+  inline ril_proto::RadioState state() const;
+  inline void set_state(ril_proto::RadioState value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.CtrlReqRadioState)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  int state_;
+  friend void  protobuf_AddDesc_ctrl_2eproto();
+  friend void protobuf_AssignDesc_ctrl_2eproto();
+  friend void protobuf_ShutdownFile_ctrl_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static CtrlReqRadioState* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class CtrlRspRadioState : public ::google::protobuf::Message {
+ public:
+  CtrlRspRadioState();
+  virtual ~CtrlRspRadioState();
+  
+  CtrlRspRadioState(const CtrlRspRadioState& from);
+  
+  inline CtrlRspRadioState& operator=(const CtrlRspRadioState& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const CtrlRspRadioState& default_instance();
+  
+  void Swap(CtrlRspRadioState* other);
+  
+  // implements Message ----------------------------------------------
+  
+  CtrlRspRadioState* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const CtrlRspRadioState& from);
+  void MergeFrom(const CtrlRspRadioState& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required .ril_proto.RadioState state = 1;
+  inline bool has_state() const;
+  inline void clear_state();
+  static const int kStateFieldNumber = 1;
+  inline ril_proto::RadioState state() const;
+  inline void set_state(ril_proto::RadioState value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.CtrlRspRadioState)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  int state_;
+  friend void  protobuf_AddDesc_ctrl_2eproto();
+  friend void protobuf_AssignDesc_ctrl_2eproto();
+  friend void protobuf_ShutdownFile_ctrl_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static CtrlRspRadioState* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class CtrlReqSetMTCall : public ::google::protobuf::Message {
+ public:
+  CtrlReqSetMTCall();
+  virtual ~CtrlReqSetMTCall();
+  
+  CtrlReqSetMTCall(const CtrlReqSetMTCall& from);
+  
+  inline CtrlReqSetMTCall& operator=(const CtrlReqSetMTCall& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const CtrlReqSetMTCall& default_instance();
+  
+  void Swap(CtrlReqSetMTCall* other);
+  
+  // implements Message ----------------------------------------------
+  
+  CtrlReqSetMTCall* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const CtrlReqSetMTCall& from);
+  void MergeFrom(const CtrlReqSetMTCall& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required string phone_number = 1;
+  inline bool has_phone_number() const;
+  inline void clear_phone_number();
+  static const int kPhoneNumberFieldNumber = 1;
+  inline const ::std::string& phone_number() const;
+  inline void set_phone_number(const ::std::string& value);
+  inline void set_phone_number(const char* value);
+  inline void set_phone_number(const char* value, size_t size);
+  inline ::std::string* mutable_phone_number();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.CtrlReqSetMTCall)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::std::string* phone_number_;
+  static const ::std::string _default_phone_number_;
+  friend void  protobuf_AddDesc_ctrl_2eproto();
+  friend void protobuf_AssignDesc_ctrl_2eproto();
+  friend void protobuf_ShutdownFile_ctrl_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static CtrlReqSetMTCall* default_instance_;
+};
+// ===================================================================
+
+
+// ===================================================================
+
+// CtrlReqRadioState
+
+// required .ril_proto.RadioState state = 1;
+inline bool CtrlReqRadioState::has_state() const {
+  return _has_bit(0);
+}
+inline void CtrlReqRadioState::clear_state() {
+  state_ = 0;
+  _clear_bit(0);
+}
+inline ril_proto::RadioState CtrlReqRadioState::state() const {
+  return static_cast< ril_proto::RadioState >(state_);
+}
+inline void CtrlReqRadioState::set_state(ril_proto::RadioState value) {
+  GOOGLE_DCHECK(ril_proto::RadioState_IsValid(value));
+  _set_bit(0);
+  state_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// CtrlRspRadioState
+
+// required .ril_proto.RadioState state = 1;
+inline bool CtrlRspRadioState::has_state() const {
+  return _has_bit(0);
+}
+inline void CtrlRspRadioState::clear_state() {
+  state_ = 0;
+  _clear_bit(0);
+}
+inline ril_proto::RadioState CtrlRspRadioState::state() const {
+  return static_cast< ril_proto::RadioState >(state_);
+}
+inline void CtrlRspRadioState::set_state(ril_proto::RadioState value) {
+  GOOGLE_DCHECK(ril_proto::RadioState_IsValid(value));
+  _set_bit(0);
+  state_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// CtrlReqSetMTCall
+
+// required string phone_number = 1;
+inline bool CtrlReqSetMTCall::has_phone_number() const {
+  return _has_bit(0);
+}
+inline void CtrlReqSetMTCall::clear_phone_number() {
+  if (phone_number_ != &_default_phone_number_) {
+    phone_number_->clear();
+  }
+  _clear_bit(0);
+}
+inline const ::std::string& CtrlReqSetMTCall::phone_number() const {
+  return *phone_number_;
+}
+inline void CtrlReqSetMTCall::set_phone_number(const ::std::string& value) {
+  _set_bit(0);
+  if (phone_number_ == &_default_phone_number_) {
+    phone_number_ = new ::std::string;
+  }
+  phone_number_->assign(value);
+}
+inline void CtrlReqSetMTCall::set_phone_number(const char* value) {
+  _set_bit(0);
+  if (phone_number_ == &_default_phone_number_) {
+    phone_number_ = new ::std::string;
+  }
+  phone_number_->assign(value);
+}
+inline void CtrlReqSetMTCall::set_phone_number(const char* value, size_t size) {
+  _set_bit(0);
+  if (phone_number_ == &_default_phone_number_) {
+    phone_number_ = new ::std::string;
+  }
+  phone_number_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* CtrlReqSetMTCall::mutable_phone_number() {
+  _set_bit(0);
+  if (phone_number_ == &_default_phone_number_) {
+    phone_number_ = new ::std::string;
+  }
+  return phone_number_;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace ril_proto
+
+#ifndef SWIG
+namespace google {
+namespace protobuf {
+
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::CtrlCmd>() {
+  return ril_proto::CtrlCmd_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::CtrlStatus>() {
+  return ril_proto::CtrlStatus_descriptor();
+}
+
+}  // namespace google
+}  // namespace protobuf
+#endif  // SWIG
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_ctrl_2eproto__INCLUDED
diff --git a/mock-ril/src/generated/cpp/msgheader.pb.cpp b/mock-ril/src/generated/cpp/msgheader.pb.cpp
new file mode 100644 (file)
index 0000000..b4bd1a5
--- /dev/null
@@ -0,0 +1,429 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
+#include "msgheader.pb.h"
+#include <google/protobuf/stubs/once.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/reflection_ops.h>
+#include <google/protobuf/wire_format.h>
+// @@protoc_insertion_point(includes)
+
+namespace communication {
+
+namespace {
+
+const ::google::protobuf::Descriptor* MsgHeader_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  MsgHeader_reflection_ = NULL;
+
+}  // namespace
+
+
+void protobuf_AssignDesc_msgheader_2eproto() {
+  protobuf_AddDesc_msgheader_2eproto();
+  const ::google::protobuf::FileDescriptor* file =
+    ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
+      "msgheader.proto");
+  GOOGLE_CHECK(file != NULL);
+  MsgHeader_descriptor_ = file->message_type(0);
+  static const int MsgHeader_offsets_[4] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, cmd_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, length_data_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, status_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, token_),
+  };
+  MsgHeader_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      MsgHeader_descriptor_,
+      MsgHeader::default_instance_,
+      MsgHeader_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MsgHeader, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(MsgHeader));
+}
+
+namespace {
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
+inline void protobuf_AssignDescriptorsOnce() {
+  ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
+                 &protobuf_AssignDesc_msgheader_2eproto);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    MsgHeader_descriptor_, &MsgHeader::default_instance());
+}
+
+}  // namespace
+
+void protobuf_ShutdownFile_msgheader_2eproto() {
+  delete MsgHeader::default_instance_;
+  delete MsgHeader_reflection_;
+}
+
+void protobuf_AddDesc_msgheader_2eproto() {
+  static bool already_here = false;
+  if (already_here) return;
+  already_here = true;
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+    "\n\017msgheader.proto\022\rcommunication\"L\n\tMsgH"
+    "eader\022\013\n\003cmd\030\001 \002(\r\022\023\n\013length_data\030\002 \002(\r\022"
+    "\016\n\006status\030\003 \001(\r\022\r\n\005token\030\004 \001(\004B$\n\"com.an"
+    "droid.internal.communication", 148);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "msgheader.proto", &protobuf_RegisterTypes);
+  MsgHeader::default_instance_ = new MsgHeader();
+  MsgHeader::default_instance_->InitAsDefaultInstance();
+  ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_msgheader_2eproto);
+}
+
+// Force AddDescriptors() to be called at static initialization time.
+struct StaticDescriptorInitializer_msgheader_2eproto {
+  StaticDescriptorInitializer_msgheader_2eproto() {
+    protobuf_AddDesc_msgheader_2eproto();
+  }
+} static_descriptor_initializer_msgheader_2eproto_;
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int MsgHeader::kCmdFieldNumber;
+const int MsgHeader::kLengthDataFieldNumber;
+const int MsgHeader::kStatusFieldNumber;
+const int MsgHeader::kTokenFieldNumber;
+#endif  // !_MSC_VER
+
+MsgHeader::MsgHeader()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void MsgHeader::InitAsDefaultInstance() {
+}
+
+MsgHeader::MsgHeader(const MsgHeader& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void MsgHeader::SharedCtor() {
+  _cached_size_ = 0;
+  cmd_ = 0u;
+  length_data_ = 0u;
+  status_ = 0u;
+  token_ = GOOGLE_ULONGLONG(0);
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+MsgHeader::~MsgHeader() {
+  SharedDtor();
+}
+
+void MsgHeader::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void MsgHeader::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* MsgHeader::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return MsgHeader_descriptor_;
+}
+
+const MsgHeader& MsgHeader::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_msgheader_2eproto();  return *default_instance_;
+}
+
+MsgHeader* MsgHeader::default_instance_ = NULL;
+
+MsgHeader* MsgHeader::New() const {
+  return new MsgHeader;
+}
+
+void MsgHeader::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    cmd_ = 0u;
+    length_data_ = 0u;
+    status_ = 0u;
+    token_ = GOOGLE_ULONGLONG(0);
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool MsgHeader::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required uint32 cmd = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+                 input, &cmd_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_length_data;
+        break;
+      }
+      
+      // required uint32 length_data = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_length_data:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+                 input, &length_data_)));
+          _set_bit(1);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(24)) goto parse_status;
+        break;
+      }
+      
+      // optional uint32 status = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_status:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+                 input, &status_)));
+          _set_bit(2);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(32)) goto parse_token;
+        break;
+      }
+      
+      // optional uint64 token = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_token:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+                 input, &token_)));
+          _set_bit(3);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void MsgHeader::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required uint32 cmd = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->cmd(), output);
+  }
+  
+  // required uint32 length_data = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->length_data(), output);
+  }
+  
+  // optional uint32 status = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->status(), output);
+  }
+  
+  // optional uint64 token = 4;
+  if (_has_bit(3)) {
+    ::google::protobuf::internal::WireFormatLite::WriteUInt64(4, this->token(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* MsgHeader::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required uint32 cmd = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->cmd(), target);
+  }
+  
+  // required uint32 length_data = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->length_data(), target);
+  }
+  
+  // optional uint32 status = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->status(), target);
+  }
+  
+  // optional uint64 token = 4;
+  if (_has_bit(3)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(4, this->token(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int MsgHeader::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required uint32 cmd = 1;
+    if (has_cmd()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::UInt32Size(
+          this->cmd());
+    }
+    
+    // required uint32 length_data = 2;
+    if (has_length_data()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::UInt32Size(
+          this->length_data());
+    }
+    
+    // optional uint32 status = 3;
+    if (has_status()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::UInt32Size(
+          this->status());
+    }
+    
+    // optional uint64 token = 4;
+    if (has_token()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::UInt64Size(
+          this->token());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void MsgHeader::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const MsgHeader* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const MsgHeader*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void MsgHeader::MergeFrom(const MsgHeader& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_cmd(from.cmd());
+    }
+    if (from._has_bit(1)) {
+      set_length_data(from.length_data());
+    }
+    if (from._has_bit(2)) {
+      set_status(from.status());
+    }
+    if (from._has_bit(3)) {
+      set_token(from.token());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void MsgHeader::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void MsgHeader::CopyFrom(const MsgHeader& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool MsgHeader::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
+  
+  return true;
+}
+
+void MsgHeader::Swap(MsgHeader* other) {
+  if (other != this) {
+    std::swap(cmd_, other->cmd_);
+    std::swap(length_data_, other->length_data_);
+    std::swap(status_, other->status_);
+    std::swap(token_, other->token_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata MsgHeader::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = MsgHeader_descriptor_;
+  metadata.reflection = MsgHeader_reflection_;
+  return metadata;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace communication
+
+// @@protoc_insertion_point(global_scope)
diff --git a/mock-ril/src/generated/cpp/msgheader.pb.h b/mock-ril/src/generated/cpp/msgheader.pb.h
new file mode 100644 (file)
index 0000000..a98bf3e
--- /dev/null
@@ -0,0 +1,237 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: msgheader.proto
+
+#ifndef PROTOBUF_msgheader_2eproto__INCLUDED
+#define PROTOBUF_msgheader_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 2003000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please update
+#error your headers.
+#endif
+#if 2003000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/extension_set.h>
+#include <google/protobuf/generated_message_reflection.h>
+// @@protoc_insertion_point(includes)
+
+namespace communication {
+
+// Internal implementation detail -- do not call these.
+void  protobuf_AddDesc_msgheader_2eproto();
+void protobuf_AssignDesc_msgheader_2eproto();
+void protobuf_ShutdownFile_msgheader_2eproto();
+
+class MsgHeader;
+
+// ===================================================================
+
+class MsgHeader : public ::google::protobuf::Message {
+ public:
+  MsgHeader();
+  virtual ~MsgHeader();
+  
+  MsgHeader(const MsgHeader& from);
+  
+  inline MsgHeader& operator=(const MsgHeader& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const MsgHeader& default_instance();
+  
+  void Swap(MsgHeader* other);
+  
+  // implements Message ----------------------------------------------
+  
+  MsgHeader* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const MsgHeader& from);
+  void MergeFrom(const MsgHeader& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required uint32 cmd = 1;
+  inline bool has_cmd() const;
+  inline void clear_cmd();
+  static const int kCmdFieldNumber = 1;
+  inline ::google::protobuf::uint32 cmd() const;
+  inline void set_cmd(::google::protobuf::uint32 value);
+  
+  // required uint32 length_data = 2;
+  inline bool has_length_data() const;
+  inline void clear_length_data();
+  static const int kLengthDataFieldNumber = 2;
+  inline ::google::protobuf::uint32 length_data() const;
+  inline void set_length_data(::google::protobuf::uint32 value);
+  
+  // optional uint32 status = 3;
+  inline bool has_status() const;
+  inline void clear_status();
+  static const int kStatusFieldNumber = 3;
+  inline ::google::protobuf::uint32 status() const;
+  inline void set_status(::google::protobuf::uint32 value);
+  
+  // optional uint64 token = 4;
+  inline bool has_token() const;
+  inline void clear_token();
+  static const int kTokenFieldNumber = 4;
+  inline ::google::protobuf::uint64 token() const;
+  inline void set_token(::google::protobuf::uint64 value);
+  
+  // @@protoc_insertion_point(class_scope:communication.MsgHeader)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::uint32 cmd_;
+  ::google::protobuf::uint32 length_data_;
+  ::google::protobuf::uint32 status_;
+  ::google::protobuf::uint64 token_;
+  friend void  protobuf_AddDesc_msgheader_2eproto();
+  friend void protobuf_AssignDesc_msgheader_2eproto();
+  friend void protobuf_ShutdownFile_msgheader_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static MsgHeader* default_instance_;
+};
+// ===================================================================
+
+
+// ===================================================================
+
+// MsgHeader
+
+// required uint32 cmd = 1;
+inline bool MsgHeader::has_cmd() const {
+  return _has_bit(0);
+}
+inline void MsgHeader::clear_cmd() {
+  cmd_ = 0u;
+  _clear_bit(0);
+}
+inline ::google::protobuf::uint32 MsgHeader::cmd() const {
+  return cmd_;
+}
+inline void MsgHeader::set_cmd(::google::protobuf::uint32 value) {
+  _set_bit(0);
+  cmd_ = value;
+}
+
+// required uint32 length_data = 2;
+inline bool MsgHeader::has_length_data() const {
+  return _has_bit(1);
+}
+inline void MsgHeader::clear_length_data() {
+  length_data_ = 0u;
+  _clear_bit(1);
+}
+inline ::google::protobuf::uint32 MsgHeader::length_data() const {
+  return length_data_;
+}
+inline void MsgHeader::set_length_data(::google::protobuf::uint32 value) {
+  _set_bit(1);
+  length_data_ = value;
+}
+
+// optional uint32 status = 3;
+inline bool MsgHeader::has_status() const {
+  return _has_bit(2);
+}
+inline void MsgHeader::clear_status() {
+  status_ = 0u;
+  _clear_bit(2);
+}
+inline ::google::protobuf::uint32 MsgHeader::status() const {
+  return status_;
+}
+inline void MsgHeader::set_status(::google::protobuf::uint32 value) {
+  _set_bit(2);
+  status_ = value;
+}
+
+// optional uint64 token = 4;
+inline bool MsgHeader::has_token() const {
+  return _has_bit(3);
+}
+inline void MsgHeader::clear_token() {
+  token_ = GOOGLE_ULONGLONG(0);
+  _clear_bit(3);
+}
+inline ::google::protobuf::uint64 MsgHeader::token() const {
+  return token_;
+}
+inline void MsgHeader::set_token(::google::protobuf::uint64 value) {
+  _set_bit(3);
+  token_ = value;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace communication
+
+#ifndef SWIG
+namespace google {
+namespace protobuf {
+
+
+}  // namespace google
+}  // namespace protobuf
+#endif  // SWIG
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_msgheader_2eproto__INCLUDED
diff --git a/mock-ril/src/generated/cpp/ril.pb.cpp b/mock-ril/src/generated/cpp/ril.pb.cpp
new file mode 100644 (file)
index 0000000..27f0adc
--- /dev/null
@@ -0,0 +1,6783 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
+#include "ril.pb.h"
+#include <google/protobuf/stubs/once.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/reflection_ops.h>
+#include <google/protobuf/wire_format.h>
+// @@protoc_insertion_point(includes)
+
+namespace ril_proto {
+
+namespace {
+
+const ::google::protobuf::Descriptor* RilAppStatus_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RilAppStatus_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RilCardStatus_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RilCardStatus_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RilUusInfo_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RilUusInfo_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RilCall_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RilCall_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RILGWSignalStrength_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RILGWSignalStrength_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RILCDMASignalStrength_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RILCDMASignalStrength_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RILEVDOSignalStrength_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RILEVDOSignalStrength_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RspStrings_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RspStrings_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RspIntegers_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RspIntegers_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RspGetSimStatus_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RspGetSimStatus_reflection_ = NULL;
+const ::google::protobuf::Descriptor* ReqEnterSimPin_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  ReqEnterSimPin_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RspEnterSimPin_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RspEnterSimPin_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RspGetCurrentCalls_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RspGetCurrentCalls_reflection_ = NULL;
+const ::google::protobuf::Descriptor* ReqDial_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  ReqDial_reflection_ = NULL;
+const ::google::protobuf::Descriptor* ReqHangUp_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  ReqHangUp_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RspSignalStrength_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RspSignalStrength_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RspOperator_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  RspOperator_reflection_ = NULL;
+const ::google::protobuf::Descriptor* ReqSeparateConnection_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  ReqSeparateConnection_reflection_ = NULL;
+const ::google::protobuf::Descriptor* ReqSetMute_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  ReqSetMute_reflection_ = NULL;
+const ::google::protobuf::Descriptor* ReqScreenState_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  ReqScreenState_reflection_ = NULL;
+const ::google::protobuf::EnumDescriptor* RadioState_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* RilCardState_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* RilPersoSubstate_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* RilAppState_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* RilPinState_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* RilAppType_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* RilUusType_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* RilUusDcs_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* RilCallState_descriptor_ = NULL;
+
+}  // namespace
+
+
+void protobuf_AssignDesc_ril_2eproto() {
+  protobuf_AddDesc_ril_2eproto();
+  const ::google::protobuf::FileDescriptor* file =
+    ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
+      "ril.proto");
+  GOOGLE_CHECK(file != NULL);
+  RilAppStatus_descriptor_ = file->message_type(0);
+  static const int RilAppStatus_offsets_[8] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, app_type_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, app_state_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, perso_substate_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, aid_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, app_label_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, pin1_replaced_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, pin1_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, pin2_),
+  };
+  RilAppStatus_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RilAppStatus_descriptor_,
+      RilAppStatus::default_instance_,
+      RilAppStatus_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilAppStatus, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RilAppStatus));
+  RilCardStatus_descriptor_ = file->message_type(1);
+  static const int RilCardStatus_offsets_[6] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCardStatus, card_state_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCardStatus, universal_pin_state_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCardStatus, gsm_umts_subscription_app_index_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCardStatus, cdma_subscription_app_index_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCardStatus, num_applications_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCardStatus, applications_),
+  };
+  RilCardStatus_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RilCardStatus_descriptor_,
+      RilCardStatus::default_instance_,
+      RilCardStatus_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCardStatus, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCardStatus, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RilCardStatus));
+  RilUusInfo_descriptor_ = file->message_type(2);
+  static const int RilUusInfo_offsets_[4] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilUusInfo, uus_type_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilUusInfo, uus_dcs_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilUusInfo, uus_length_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilUusInfo, uus_data_),
+  };
+  RilUusInfo_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RilUusInfo_descriptor_,
+      RilUusInfo::default_instance_,
+      RilUusInfo_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilUusInfo, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilUusInfo, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RilUusInfo));
+  RilCall_descriptor_ = file->message_type(3);
+  static const int RilCall_offsets_[13] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, state_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, index_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, toa_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, is_mpty_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, is_mt_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, als_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, is_voice_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, is_voice_privacy_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, number_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, number_presentation_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, name_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, name_presentation_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, uus_info_),
+  };
+  RilCall_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RilCall_descriptor_,
+      RilCall::default_instance_,
+      RilCall_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RilCall, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RilCall));
+  RILGWSignalStrength_descriptor_ = file->message_type(4);
+  static const int RILGWSignalStrength_offsets_[2] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILGWSignalStrength, signal_strength_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILGWSignalStrength, bit_error_rate_),
+  };
+  RILGWSignalStrength_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RILGWSignalStrength_descriptor_,
+      RILGWSignalStrength::default_instance_,
+      RILGWSignalStrength_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILGWSignalStrength, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILGWSignalStrength, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RILGWSignalStrength));
+  RILCDMASignalStrength_descriptor_ = file->message_type(5);
+  static const int RILCDMASignalStrength_offsets_[2] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILCDMASignalStrength, dbm_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILCDMASignalStrength, ecio_),
+  };
+  RILCDMASignalStrength_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RILCDMASignalStrength_descriptor_,
+      RILCDMASignalStrength::default_instance_,
+      RILCDMASignalStrength_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILCDMASignalStrength, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILCDMASignalStrength, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RILCDMASignalStrength));
+  RILEVDOSignalStrength_descriptor_ = file->message_type(6);
+  static const int RILEVDOSignalStrength_offsets_[3] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILEVDOSignalStrength, dbm_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILEVDOSignalStrength, ecio_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILEVDOSignalStrength, signal_noise_ratio_),
+  };
+  RILEVDOSignalStrength_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RILEVDOSignalStrength_descriptor_,
+      RILEVDOSignalStrength::default_instance_,
+      RILEVDOSignalStrength_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILEVDOSignalStrength, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RILEVDOSignalStrength, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RILEVDOSignalStrength));
+  RspStrings_descriptor_ = file->message_type(7);
+  static const int RspStrings_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspStrings, strings_),
+  };
+  RspStrings_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RspStrings_descriptor_,
+      RspStrings::default_instance_,
+      RspStrings_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspStrings, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspStrings, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RspStrings));
+  RspIntegers_descriptor_ = file->message_type(8);
+  static const int RspIntegers_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspIntegers, integers_),
+  };
+  RspIntegers_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RspIntegers_descriptor_,
+      RspIntegers::default_instance_,
+      RspIntegers_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspIntegers, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspIntegers, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RspIntegers));
+  RspGetSimStatus_descriptor_ = file->message_type(9);
+  static const int RspGetSimStatus_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspGetSimStatus, card_status_),
+  };
+  RspGetSimStatus_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RspGetSimStatus_descriptor_,
+      RspGetSimStatus::default_instance_,
+      RspGetSimStatus_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspGetSimStatus, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspGetSimStatus, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RspGetSimStatus));
+  ReqEnterSimPin_descriptor_ = file->message_type(10);
+  static const int ReqEnterSimPin_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqEnterSimPin, pin_),
+  };
+  ReqEnterSimPin_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      ReqEnterSimPin_descriptor_,
+      ReqEnterSimPin::default_instance_,
+      ReqEnterSimPin_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqEnterSimPin, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqEnterSimPin, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(ReqEnterSimPin));
+  RspEnterSimPin_descriptor_ = file->message_type(11);
+  static const int RspEnterSimPin_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspEnterSimPin, retries_remaining_),
+  };
+  RspEnterSimPin_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RspEnterSimPin_descriptor_,
+      RspEnterSimPin::default_instance_,
+      RspEnterSimPin_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspEnterSimPin, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspEnterSimPin, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RspEnterSimPin));
+  RspGetCurrentCalls_descriptor_ = file->message_type(12);
+  static const int RspGetCurrentCalls_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspGetCurrentCalls, calls_),
+  };
+  RspGetCurrentCalls_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RspGetCurrentCalls_descriptor_,
+      RspGetCurrentCalls::default_instance_,
+      RspGetCurrentCalls_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspGetCurrentCalls, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspGetCurrentCalls, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RspGetCurrentCalls));
+  ReqDial_descriptor_ = file->message_type(13);
+  static const int ReqDial_offsets_[3] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqDial, address_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqDial, clir_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqDial, uus_info_),
+  };
+  ReqDial_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      ReqDial_descriptor_,
+      ReqDial::default_instance_,
+      ReqDial_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqDial, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqDial, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(ReqDial));
+  ReqHangUp_descriptor_ = file->message_type(14);
+  static const int ReqHangUp_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqHangUp, connection_index_),
+  };
+  ReqHangUp_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      ReqHangUp_descriptor_,
+      ReqHangUp::default_instance_,
+      ReqHangUp_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqHangUp, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqHangUp, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(ReqHangUp));
+  RspSignalStrength_descriptor_ = file->message_type(15);
+  static const int RspSignalStrength_offsets_[3] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspSignalStrength, gw_signalstrength_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspSignalStrength, cdma_signalstrength_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspSignalStrength, evdo_signalstrength_),
+  };
+  RspSignalStrength_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RspSignalStrength_descriptor_,
+      RspSignalStrength::default_instance_,
+      RspSignalStrength_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspSignalStrength, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspSignalStrength, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RspSignalStrength));
+  RspOperator_descriptor_ = file->message_type(16);
+  static const int RspOperator_offsets_[3] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspOperator, long_alpha_ons_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspOperator, short_alpha_ons_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspOperator, mcc_mnc_),
+  };
+  RspOperator_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      RspOperator_descriptor_,
+      RspOperator::default_instance_,
+      RspOperator_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspOperator, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RspOperator, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(RspOperator));
+  ReqSeparateConnection_descriptor_ = file->message_type(17);
+  static const int ReqSeparateConnection_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqSeparateConnection, index_),
+  };
+  ReqSeparateConnection_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      ReqSeparateConnection_descriptor_,
+      ReqSeparateConnection::default_instance_,
+      ReqSeparateConnection_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqSeparateConnection, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqSeparateConnection, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(ReqSeparateConnection));
+  ReqSetMute_descriptor_ = file->message_type(18);
+  static const int ReqSetMute_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqSetMute, state_),
+  };
+  ReqSetMute_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      ReqSetMute_descriptor_,
+      ReqSetMute::default_instance_,
+      ReqSetMute_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqSetMute, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqSetMute, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(ReqSetMute));
+  ReqScreenState_descriptor_ = file->message_type(19);
+  static const int ReqScreenState_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqScreenState, state_),
+  };
+  ReqScreenState_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      ReqScreenState_descriptor_,
+      ReqScreenState::default_instance_,
+      ReqScreenState_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqScreenState, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReqScreenState, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(ReqScreenState));
+  RadioState_descriptor_ = file->enum_type(0);
+  RilCardState_descriptor_ = file->enum_type(1);
+  RilPersoSubstate_descriptor_ = file->enum_type(2);
+  RilAppState_descriptor_ = file->enum_type(3);
+  RilPinState_descriptor_ = file->enum_type(4);
+  RilAppType_descriptor_ = file->enum_type(5);
+  RilUusType_descriptor_ = file->enum_type(6);
+  RilUusDcs_descriptor_ = file->enum_type(7);
+  RilCallState_descriptor_ = file->enum_type(8);
+}
+
+namespace {
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
+inline void protobuf_AssignDescriptorsOnce() {
+  ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
+                 &protobuf_AssignDesc_ril_2eproto);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RilAppStatus_descriptor_, &RilAppStatus::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RilCardStatus_descriptor_, &RilCardStatus::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RilUusInfo_descriptor_, &RilUusInfo::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RilCall_descriptor_, &RilCall::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RILGWSignalStrength_descriptor_, &RILGWSignalStrength::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RILCDMASignalStrength_descriptor_, &RILCDMASignalStrength::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RILEVDOSignalStrength_descriptor_, &RILEVDOSignalStrength::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RspStrings_descriptor_, &RspStrings::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RspIntegers_descriptor_, &RspIntegers::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RspGetSimStatus_descriptor_, &RspGetSimStatus::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    ReqEnterSimPin_descriptor_, &ReqEnterSimPin::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RspEnterSimPin_descriptor_, &RspEnterSimPin::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RspGetCurrentCalls_descriptor_, &RspGetCurrentCalls::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    ReqDial_descriptor_, &ReqDial::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    ReqHangUp_descriptor_, &ReqHangUp::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RspSignalStrength_descriptor_, &RspSignalStrength::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    RspOperator_descriptor_, &RspOperator::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    ReqSeparateConnection_descriptor_, &ReqSeparateConnection::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    ReqSetMute_descriptor_, &ReqSetMute::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    ReqScreenState_descriptor_, &ReqScreenState::default_instance());
+}
+
+}  // namespace
+
+void protobuf_ShutdownFile_ril_2eproto() {
+  delete RilAppStatus::default_instance_;
+  delete RilAppStatus_reflection_;
+  delete RilCardStatus::default_instance_;
+  delete RilCardStatus_reflection_;
+  delete RilUusInfo::default_instance_;
+  delete RilUusInfo_reflection_;
+  delete RilCall::default_instance_;
+  delete RilCall_reflection_;
+  delete RILGWSignalStrength::default_instance_;
+  delete RILGWSignalStrength_reflection_;
+  delete RILCDMASignalStrength::default_instance_;
+  delete RILCDMASignalStrength_reflection_;
+  delete RILEVDOSignalStrength::default_instance_;
+  delete RILEVDOSignalStrength_reflection_;
+  delete RspStrings::default_instance_;
+  delete RspStrings_reflection_;
+  delete RspIntegers::default_instance_;
+  delete RspIntegers_reflection_;
+  delete RspGetSimStatus::default_instance_;
+  delete RspGetSimStatus_reflection_;
+  delete ReqEnterSimPin::default_instance_;
+  delete ReqEnterSimPin_reflection_;
+  delete RspEnterSimPin::default_instance_;
+  delete RspEnterSimPin_reflection_;
+  delete RspGetCurrentCalls::default_instance_;
+  delete RspGetCurrentCalls_reflection_;
+  delete ReqDial::default_instance_;
+  delete ReqDial_reflection_;
+  delete ReqHangUp::default_instance_;
+  delete ReqHangUp_reflection_;
+  delete RspSignalStrength::default_instance_;
+  delete RspSignalStrength_reflection_;
+  delete RspOperator::default_instance_;
+  delete RspOperator_reflection_;
+  delete ReqSeparateConnection::default_instance_;
+  delete ReqSeparateConnection_reflection_;
+  delete ReqSetMute::default_instance_;
+  delete ReqSetMute_reflection_;
+  delete ReqScreenState::default_instance_;
+  delete ReqScreenState_reflection_;
+}
+
+void protobuf_AddDesc_ril_2eproto() {
+  static bool already_here = false;
+  if (already_here) return;
+  already_here = true;
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+    "\n\tril.proto\022\tril_proto\"\232\002\n\014RilAppStatus\022"
+    "\'\n\010app_type\030\001 \001(\0162\025.ril_proto.RilAppType"
+    "\022)\n\tapp_state\030\002 \001(\0162\026.ril_proto.RilAppSt"
+    "ate\0223\n\016perso_substate\030\003 \001(\0162\033.ril_proto."
+    "RilPersoSubstate\022\013\n\003aid\030\004 \001(\t\022\021\n\tapp_lab"
+    "el\030\005 \001(\t\022\025\n\rpin1_replaced\030\006 \001(\005\022$\n\004pin1\030"
+    "\007 \001(\0162\026.ril_proto.RilPinState\022$\n\004pin2\030\010 "
+    "\001(\0162\026.ril_proto.RilPinState\"\210\002\n\rRilCardS"
+    "tatus\022+\n\ncard_state\030\001 \001(\0162\027.ril_proto.Ri"
+    "lCardState\0223\n\023universal_pin_state\030\002 \001(\0162"
+    "\026.ril_proto.RilPinState\022\'\n\037gsm_umts_subs"
+    "cription_app_index\030\003 \001(\005\022#\n\033cdma_subscri"
+    "ption_app_index\030\004 \001(\005\022\030\n\020num_application"
+    "s\030\005 \001(\005\022-\n\014applications\030\006 \003(\0132\027.ril_prot"
+    "o.RilAppStatus\"\202\001\n\nRilUusInfo\022\'\n\010uus_typ"
+    "e\030\001 \001(\0162\025.ril_proto.RilUusType\022%\n\007uus_dc"
+    "s\030\002 \001(\0162\024.ril_proto.RilUusDcs\022\022\n\nuus_len"
+    "gth\030\003 \001(\005\022\020\n\010uus_data\030\004 \001(\t\"\245\002\n\007RilCall\022"
+    "&\n\005state\030\001 \001(\0162\027.ril_proto.RilCallState\022"
+    "\r\n\005index\030\002 \001(\005\022\013\n\003toa\030\003 \001(\005\022\017\n\007is_mpty\030\004"
+    " \001(\010\022\r\n\005is_mt\030\005 \001(\010\022\013\n\003als\030\006 \001(\005\022\020\n\010is_v"
+    "oice\030\007 \001(\010\022\030\n\020is_voice_privacy\030\010 \001(\010\022\016\n\006"
+    "number\030\t \001(\t\022\033\n\023number_presentation\030\n \001("
+    "\005\022\014\n\004name\030\013 \001(\t\022\031\n\021name_presentation\030\014 \001"
+    "(\005\022\'\n\010uus_info\030\r \001(\0132\025.ril_proto.RilUusI"
+    "nfo\"F\n\023RILGWSignalStrength\022\027\n\017signal_str"
+    "ength\030\001 \001(\005\022\026\n\016bit_error_rate\030\002 \001(\005\"2\n\025R"
+    "ILCDMASignalStrength\022\013\n\003dbm\030\001 \001(\005\022\014\n\004eci"
+    "o\030\002 \001(\005\"N\n\025RILEVDOSignalStrength\022\013\n\003dbm\030"
+    "\001 \001(\005\022\014\n\004ecio\030\002 \001(\005\022\032\n\022signal_noise_rati"
+    "o\030\003 \001(\005\"\035\n\nRspStrings\022\017\n\007strings\030\001 \003(\t\"\037"
+    "\n\013RspIntegers\022\020\n\010integers\030\001 \003(\005\"@\n\017RspGe"
+    "tSimStatus\022-\n\013card_status\030\001 \002(\0132\030.ril_pr"
+    "oto.RilCardStatus\"\035\n\016ReqEnterSimPin\022\013\n\003p"
+    "in\030\001 \002(\t\"+\n\016RspEnterSimPin\022\031\n\021retries_re"
+    "maining\030\001 \002(\005\"7\n\022RspGetCurrentCalls\022!\n\005c"
+    "alls\030\001 \003(\0132\022.ril_proto.RilCall\"Q\n\007ReqDia"
+    "l\022\017\n\007address\030\001 \001(\t\022\014\n\004clir\030\002 \001(\005\022\'\n\010uus_"
+    "info\030\003 \001(\0132\025.ril_proto.RilUusInfo\"%\n\tReq"
+    "HangUp\022\030\n\020connection_index\030\001 \002(\005\"\314\001\n\021Rsp"
+    "SignalStrength\0229\n\021gw_signalstrength\030\001 \001("
+    "\0132\036.ril_proto.RILGWSignalStrength\022=\n\023cdm"
+    "a_signalstrength\030\002 \001(\0132 .ril_proto.RILCD"
+    "MASignalStrength\022=\n\023evdo_signalstrength\030"
+    "\003 \001(\0132 .ril_proto.RILEVDOSignalStrength\""
+    "O\n\013RspOperator\022\026\n\016long_alpha_ons\030\001 \001(\t\022\027"
+    "\n\017short_alpha_ons\030\002 \001(\t\022\017\n\007mcc_mnc\030\003 \001(\t"
+    "\"&\n\025ReqSeparateConnection\022\r\n\005index\030\001 \002(\005"
+    "\"\033\n\nReqSetMute\022\r\n\005state\030\001 \002(\010\"\037\n\016ReqScre"
+    "enState\022\r\n\005state\030\001 \002(\010*\257\002\n\nRadioState\022\022\n"
+    "\016RADIOSTATE_OFF\020\000\022\032\n\026RADIOSTATE_UNAVAILA"
+    "BLE\020\001\022\034\n\030RADIOSTATE_SIM_NOT_READY\020\002\022#\n\037R"
+    "ADIOSTATE_SIM_LOCKED_OR_ABSENT\020\003\022\030\n\024RADI"
+    "OSTATE_SIM_READY\020\004\022\035\n\031RADIOSTATE_RUIM_NO"
+    "T_READY\020\005\022\031\n\025RADIOSTATE_RUIM_READY\020\006\022$\n "
+    "RADIOSTATE_RUIM_LOCKED_OR_ABSENT\020\007\022\033\n\027RA"
+    "DIOSTATE_NV_NOT_READY\020\010\022\027\n\023RADIOSTATE_NV"
+    "_READY\020\t*P\n\014RilCardState\022\024\n\020CARDSTATE_AB"
+    "SENT\020\000\022\025\n\021CARDSTATE_PRESENT\020\001\022\023\n\017CARDSTA"
+    "TE_ERROR\020\002*\361\006\n\020RilPersoSubstate\022\031\n\025PERSO"
+    "SUBSTATE_UNKNOWN\020\000\022\035\n\031PERSOSUBSTATE_IN_P"
+    "ROGRESS\020\001\022\027\n\023PERSOSUBSTATE_READY\020\002\022\035\n\031PE"
+    "RSOSUBSTATE_SIM_NETWORK\020\003\022$\n PERSOSUBSTA"
+    "TE_SIM_NETWORK_SUBSET\020\004\022\037\n\033PERSOSUBSTATE"
+    "_SIM_CORPORATE\020\005\022&\n\"PERSOSUBSTATE_SIM_SE"
+    "RVICE_PROVIDER\020\006\022\031\n\025PERSOSUBSTATE_SIM_SI"
+    "M\020\007\022!\n\035PERSOSUBSTATE_SIM_NETWORK_PUK\020\010\022("
+    "\n$PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK\020\t"
+    "\022#\n\037PERSOSUBSTATE_SIM_CORPORATE_PUK\020\n\022*\n"
+    "&PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK\020"
+    "\013\022\035\n\031PERSOSUBSTATE_SIM_SIM_PUK\020\014\022\037\n\033PERS"
+    "OSUBSTATE_RUIM_NETWORK1\020\r\022\037\n\033PERSOSUBSTA"
+    "TE_RUIM_NETWORK2\020\016\022\033\n\027PERSOSUBSTATE_RUIM"
+    "_HRPD\020\017\022 \n\034PERSOSUBSTATE_RUIM_CORPORATE\020"
+    "\020\022\'\n#PERSOSUBSTATE_RUIM_SERVICE_PROVIDER"
+    "\020\021\022\033\n\027PERSOSUBSTATE_RUIM_RUIM\020\022\022#\n\037PERSO"
+    "SUBSTATE_RUIM_NETWORK1_PUK\020\023\022#\n\037PERSOSUB"
+    "STATE_RUIM_NETWORK2_PUK\020\024\022\037\n\033PERSOSUBSTA"
+    "TE_RUIM_HRPD_PUK\020\025\022$\n PERSOSUBSTATE_RUIM"
+    "_CORPORATE_PUK\020\026\022+\n\'PERSOSUBSTATE_RUIM_S"
+    "ERVICE_PROVIDER_PUK\020\027\022\037\n\033PERSOSUBSTATE_R"
+    "UIM_RUIM_PUK\020\030*\223\001\n\013RilAppState\022\024\n\020APPSTA"
+    "TE_UNKNOWN\020\000\022\025\n\021APPSTATE_DETECTED\020\001\022\020\n\014A"
+    "PPSTATE_PIN\020\002\022\020\n\014APPSTATE_PUK\020\003\022\037\n\033APPST"
+    "ATE_SUBSCRIPTION_PERSO\020\004\022\022\n\016APPSTATE_REA"
+    "DY\020\005*\275\001\n\013RilPinState\022\024\n\020PINSTATE_UNKNOWN"
+    "\020\000\022!\n\035PINSTATE_ENABLED_NOT_VERIFIED\020\001\022\035\n"
+    "\031PINSTATE_ENABLED_VERIFIED\020\002\022\025\n\021PINSTATE"
+    "_DISABLED\020\003\022\034\n\030PINSTATE_ENABLED_BLOCKED\020"
+    "\004\022!\n\035PINSTATE_ENABLED_PERM_BLOCKED\020\005*h\n\n"
+    "RilAppType\022\023\n\017APPTYPE_UNKNOWN\020\000\022\017\n\013APPTY"
+    "PE_SIM\020\001\022\020\n\014APPTYPE_USIM\020\002\022\020\n\014APPTYPE_RU"
+    "IM\020\003\022\020\n\014APPTYPE_CSIM\020\004*\316\001\n\nRilUusType\022\030\n"
+    "\024RILUUSTYPE1_IMPLICIT\020\000\022\030\n\024RILUUSTYPE1_R"
+    "EQUIRED\020\001\022\034\n\030RILUUSTYPE1_NOT_REQUIRED\020\002\022"
+    "\030\n\024RILUUSTYPE2_REQUIRED\020\003\022\034\n\030RILUUSTYPE2"
+    "_NOT_REQUIRED\020\004\022\030\n\024RILUUSTYPE3_REQUIRED\020"
+    "\005\022\034\n\030RILUUSTYPE3_NOT_REQUIRED\020\006*p\n\tRilUu"
+    "sDcs\022\021\n\rRILUUSDCS_USP\020\000\022\024\n\020RILUUSDCS_OSI"
+    "HLP\020\001\022\022\n\016RILUUSDCS_X244\020\002\022\022\n\016RILUUSDCS_R"
+    "MCF\020\003\022\022\n\016RILUUSDCS_IA5c\020\004*\231\001\n\014RilCallSta"
+    "te\022\024\n\020CALLSTATE_ACTIVE\020\000\022\025\n\021CALLSTATE_HO"
+    "LDING\020\001\022\025\n\021CALLSTATE_DIALING\020\002\022\026\n\022CALLST"
+    "ATE_ALERTING\020\003\022\026\n\022CALLSTATE_INCOMING\020\004\022\025"
+    "\n\021CALLSTATE_WAITING\020\005B3\n(com.android.int"
+    "ernal.telephony.ril_protoB\007RilCmds", 4234);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "ril.proto", &protobuf_RegisterTypes);
+  RilAppStatus::default_instance_ = new RilAppStatus();
+  RilCardStatus::default_instance_ = new RilCardStatus();
+  RilUusInfo::default_instance_ = new RilUusInfo();
+  RilCall::default_instance_ = new RilCall();
+  RILGWSignalStrength::default_instance_ = new RILGWSignalStrength();
+  RILCDMASignalStrength::default_instance_ = new RILCDMASignalStrength();
+  RILEVDOSignalStrength::default_instance_ = new RILEVDOSignalStrength();
+  RspStrings::default_instance_ = new RspStrings();
+  RspIntegers::default_instance_ = new RspIntegers();
+  RspGetSimStatus::default_instance_ = new RspGetSimStatus();
+  ReqEnterSimPin::default_instance_ = new ReqEnterSimPin();
+  RspEnterSimPin::default_instance_ = new RspEnterSimPin();
+  RspGetCurrentCalls::default_instance_ = new RspGetCurrentCalls();
+  ReqDial::default_instance_ = new ReqDial();
+  ReqHangUp::default_instance_ = new ReqHangUp();
+  RspSignalStrength::default_instance_ = new RspSignalStrength();
+  RspOperator::default_instance_ = new RspOperator();
+  ReqSeparateConnection::default_instance_ = new ReqSeparateConnection();
+  ReqSetMute::default_instance_ = new ReqSetMute();
+  ReqScreenState::default_instance_ = new ReqScreenState();
+  RilAppStatus::default_instance_->InitAsDefaultInstance();
+  RilCardStatus::default_instance_->InitAsDefaultInstance();
+  RilUusInfo::default_instance_->InitAsDefaultInstance();
+  RilCall::default_instance_->InitAsDefaultInstance();
+  RILGWSignalStrength::default_instance_->InitAsDefaultInstance();
+  RILCDMASignalStrength::default_instance_->InitAsDefaultInstance();
+  RILEVDOSignalStrength::default_instance_->InitAsDefaultInstance();
+  RspStrings::default_instance_->InitAsDefaultInstance();
+  RspIntegers::default_instance_->InitAsDefaultInstance();
+  RspGetSimStatus::default_instance_->InitAsDefaultInstance();
+  ReqEnterSimPin::default_instance_->InitAsDefaultInstance();
+  RspEnterSimPin::default_instance_->InitAsDefaultInstance();
+  RspGetCurrentCalls::default_instance_->InitAsDefaultInstance();
+  ReqDial::default_instance_->InitAsDefaultInstance();
+  ReqHangUp::default_instance_->InitAsDefaultInstance();
+  RspSignalStrength::default_instance_->InitAsDefaultInstance();
+  RspOperator::default_instance_->InitAsDefaultInstance();
+  ReqSeparateConnection::default_instance_->InitAsDefaultInstance();
+  ReqSetMute::default_instance_->InitAsDefaultInstance();
+  ReqScreenState::default_instance_->InitAsDefaultInstance();
+  ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_ril_2eproto);
+}
+
+// Force AddDescriptors() to be called at static initialization time.
+struct StaticDescriptorInitializer_ril_2eproto {
+  StaticDescriptorInitializer_ril_2eproto() {
+    protobuf_AddDesc_ril_2eproto();
+  }
+} static_descriptor_initializer_ril_2eproto_;
+
+const ::google::protobuf::EnumDescriptor* RadioState_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RadioState_descriptor_;
+}
+bool RadioState_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+    case 6:
+    case 7:
+    case 8:
+    case 9:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* RilCardState_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilCardState_descriptor_;
+}
+bool RilCardState_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* RilPersoSubstate_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilPersoSubstate_descriptor_;
+}
+bool RilPersoSubstate_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+    case 6:
+    case 7:
+    case 8:
+    case 9:
+    case 10:
+    case 11:
+    case 12:
+    case 13:
+    case 14:
+    case 15:
+    case 16:
+    case 17:
+    case 18:
+    case 19:
+    case 20:
+    case 21:
+    case 22:
+    case 23:
+    case 24:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* RilAppState_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilAppState_descriptor_;
+}
+bool RilAppState_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* RilPinState_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilPinState_descriptor_;
+}
+bool RilPinState_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* RilAppType_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilAppType_descriptor_;
+}
+bool RilAppType_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* RilUusType_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilUusType_descriptor_;
+}
+bool RilUusType_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+    case 6:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* RilUusDcs_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilUusDcs_descriptor_;
+}
+bool RilUusDcs_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* RilCallState_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilCallState_descriptor_;
+}
+bool RilCallState_IsValid(int value) {
+  switch(value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+      return true;
+    default:
+      return false;
+  }
+}
+
+
+// ===================================================================
+
+const ::std::string RilAppStatus::_default_aid_;
+const ::std::string RilAppStatus::_default_app_label_;
+#ifndef _MSC_VER
+const int RilAppStatus::kAppTypeFieldNumber;
+const int RilAppStatus::kAppStateFieldNumber;
+const int RilAppStatus::kPersoSubstateFieldNumber;
+const int RilAppStatus::kAidFieldNumber;
+const int RilAppStatus::kAppLabelFieldNumber;
+const int RilAppStatus::kPin1ReplacedFieldNumber;
+const int RilAppStatus::kPin1FieldNumber;
+const int RilAppStatus::kPin2FieldNumber;
+#endif  // !_MSC_VER
+
+RilAppStatus::RilAppStatus()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RilAppStatus::InitAsDefaultInstance() {
+}
+
+RilAppStatus::RilAppStatus(const RilAppStatus& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RilAppStatus::SharedCtor() {
+  _cached_size_ = 0;
+  app_type_ = 0;
+  app_state_ = 0;
+  perso_substate_ = 0;
+  aid_ = const_cast< ::std::string*>(&_default_aid_);
+  app_label_ = const_cast< ::std::string*>(&_default_app_label_);
+  pin1_replaced_ = 0;
+  pin1_ = 0;
+  pin2_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RilAppStatus::~RilAppStatus() {
+  SharedDtor();
+}
+
+void RilAppStatus::SharedDtor() {
+  if (aid_ != &_default_aid_) {
+    delete aid_;
+  }
+  if (app_label_ != &_default_app_label_) {
+    delete app_label_;
+  }
+  if (this != default_instance_) {
+  }
+}
+
+void RilAppStatus::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RilAppStatus::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilAppStatus_descriptor_;
+}
+
+const RilAppStatus& RilAppStatus::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RilAppStatus* RilAppStatus::default_instance_ = NULL;
+
+RilAppStatus* RilAppStatus::New() const {
+  return new RilAppStatus;
+}
+
+void RilAppStatus::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    app_type_ = 0;
+    app_state_ = 0;
+    perso_substate_ = 0;
+    if (_has_bit(3)) {
+      if (aid_ != &_default_aid_) {
+        aid_->clear();
+      }
+    }
+    if (_has_bit(4)) {
+      if (app_label_ != &_default_app_label_) {
+        app_label_->clear();
+      }
+    }
+    pin1_replaced_ = 0;
+    pin1_ = 0;
+    pin2_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RilAppStatus::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional .ril_proto.RilAppType app_type = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilAppType_IsValid(value)) {
+            set_app_type(static_cast< ril_proto::RilAppType >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(1, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_app_state;
+        break;
+      }
+      
+      // optional .ril_proto.RilAppState app_state = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_app_state:
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilAppState_IsValid(value)) {
+            set_app_state(static_cast< ril_proto::RilAppState >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(2, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(24)) goto parse_perso_substate;
+        break;
+      }
+      
+      // optional .ril_proto.RilPersoSubstate perso_substate = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_perso_substate:
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilPersoSubstate_IsValid(value)) {
+            set_perso_substate(static_cast< ril_proto::RilPersoSubstate >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(3, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(34)) goto parse_aid;
+        break;
+      }
+      
+      // optional string aid = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_aid:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_aid()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->aid().data(), this->aid().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(42)) goto parse_app_label;
+        break;
+      }
+      
+      // optional string app_label = 5;
+      case 5: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_app_label:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_app_label()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->app_label().data(), this->app_label().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(48)) goto parse_pin1_replaced;
+        break;
+      }
+      
+      // optional int32 pin1_replaced = 6;
+      case 6: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_pin1_replaced:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &pin1_replaced_)));
+          _set_bit(5);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(56)) goto parse_pin1;
+        break;
+      }
+      
+      // optional .ril_proto.RilPinState pin1 = 7;
+      case 7: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_pin1:
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilPinState_IsValid(value)) {
+            set_pin1(static_cast< ril_proto::RilPinState >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(7, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(64)) goto parse_pin2;
+        break;
+      }
+      
+      // optional .ril_proto.RilPinState pin2 = 8;
+      case 8: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_pin2:
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilPinState_IsValid(value)) {
+            set_pin2(static_cast< ril_proto::RilPinState >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(8, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RilAppStatus::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional .ril_proto.RilAppType app_type = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->app_type(), output);
+  }
+  
+  // optional .ril_proto.RilAppState app_state = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      2, this->app_state(), output);
+  }
+  
+  // optional .ril_proto.RilPersoSubstate perso_substate = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      3, this->perso_substate(), output);
+  }
+  
+  // optional string aid = 4;
+  if (_has_bit(3)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->aid().data(), this->aid().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      4, this->aid(), output);
+  }
+  
+  // optional string app_label = 5;
+  if (_has_bit(4)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->app_label().data(), this->app_label().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      5, this->app_label(), output);
+  }
+  
+  // optional int32 pin1_replaced = 6;
+  if (_has_bit(5)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->pin1_replaced(), output);
+  }
+  
+  // optional .ril_proto.RilPinState pin1 = 7;
+  if (_has_bit(6)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      7, this->pin1(), output);
+  }
+  
+  // optional .ril_proto.RilPinState pin2 = 8;
+  if (_has_bit(7)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      8, this->pin2(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RilAppStatus::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional .ril_proto.RilAppType app_type = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->app_type(), target);
+  }
+  
+  // optional .ril_proto.RilAppState app_state = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      2, this->app_state(), target);
+  }
+  
+  // optional .ril_proto.RilPersoSubstate perso_substate = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      3, this->perso_substate(), target);
+  }
+  
+  // optional string aid = 4;
+  if (_has_bit(3)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->aid().data(), this->aid().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        4, this->aid(), target);
+  }
+  
+  // optional string app_label = 5;
+  if (_has_bit(4)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->app_label().data(), this->app_label().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        5, this->app_label(), target);
+  }
+  
+  // optional int32 pin1_replaced = 6;
+  if (_has_bit(5)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(6, this->pin1_replaced(), target);
+  }
+  
+  // optional .ril_proto.RilPinState pin1 = 7;
+  if (_has_bit(6)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      7, this->pin1(), target);
+  }
+  
+  // optional .ril_proto.RilPinState pin2 = 8;
+  if (_has_bit(7)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      8, this->pin2(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RilAppStatus::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional .ril_proto.RilAppType app_type = 1;
+    if (has_app_type()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->app_type());
+    }
+    
+    // optional .ril_proto.RilAppState app_state = 2;
+    if (has_app_state()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->app_state());
+    }
+    
+    // optional .ril_proto.RilPersoSubstate perso_substate = 3;
+    if (has_perso_substate()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->perso_substate());
+    }
+    
+    // optional string aid = 4;
+    if (has_aid()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->aid());
+    }
+    
+    // optional string app_label = 5;
+    if (has_app_label()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->app_label());
+    }
+    
+    // optional int32 pin1_replaced = 6;
+    if (has_pin1_replaced()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->pin1_replaced());
+    }
+    
+    // optional .ril_proto.RilPinState pin1 = 7;
+    if (has_pin1()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->pin1());
+    }
+    
+    // optional .ril_proto.RilPinState pin2 = 8;
+    if (has_pin2()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->pin2());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RilAppStatus::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RilAppStatus* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RilAppStatus*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RilAppStatus::MergeFrom(const RilAppStatus& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_app_type(from.app_type());
+    }
+    if (from._has_bit(1)) {
+      set_app_state(from.app_state());
+    }
+    if (from._has_bit(2)) {
+      set_perso_substate(from.perso_substate());
+    }
+    if (from._has_bit(3)) {
+      set_aid(from.aid());
+    }
+    if (from._has_bit(4)) {
+      set_app_label(from.app_label());
+    }
+    if (from._has_bit(5)) {
+      set_pin1_replaced(from.pin1_replaced());
+    }
+    if (from._has_bit(6)) {
+      set_pin1(from.pin1());
+    }
+    if (from._has_bit(7)) {
+      set_pin2(from.pin2());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RilAppStatus::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RilAppStatus::CopyFrom(const RilAppStatus& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RilAppStatus::IsInitialized() const {
+  
+  return true;
+}
+
+void RilAppStatus::Swap(RilAppStatus* other) {
+  if (other != this) {
+    std::swap(app_type_, other->app_type_);
+    std::swap(app_state_, other->app_state_);
+    std::swap(perso_substate_, other->perso_substate_);
+    std::swap(aid_, other->aid_);
+    std::swap(app_label_, other->app_label_);
+    std::swap(pin1_replaced_, other->pin1_replaced_);
+    std::swap(pin1_, other->pin1_);
+    std::swap(pin2_, other->pin2_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RilAppStatus::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RilAppStatus_descriptor_;
+  metadata.reflection = RilAppStatus_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RilCardStatus::kCardStateFieldNumber;
+const int RilCardStatus::kUniversalPinStateFieldNumber;
+const int RilCardStatus::kGsmUmtsSubscriptionAppIndexFieldNumber;
+const int RilCardStatus::kCdmaSubscriptionAppIndexFieldNumber;
+const int RilCardStatus::kNumApplicationsFieldNumber;
+const int RilCardStatus::kApplicationsFieldNumber;
+#endif  // !_MSC_VER
+
+RilCardStatus::RilCardStatus()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RilCardStatus::InitAsDefaultInstance() {
+}
+
+RilCardStatus::RilCardStatus(const RilCardStatus& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RilCardStatus::SharedCtor() {
+  _cached_size_ = 0;
+  card_state_ = 0;
+  universal_pin_state_ = 0;
+  gsm_umts_subscription_app_index_ = 0;
+  cdma_subscription_app_index_ = 0;
+  num_applications_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RilCardStatus::~RilCardStatus() {
+  SharedDtor();
+}
+
+void RilCardStatus::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void RilCardStatus::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RilCardStatus::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilCardStatus_descriptor_;
+}
+
+const RilCardStatus& RilCardStatus::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RilCardStatus* RilCardStatus::default_instance_ = NULL;
+
+RilCardStatus* RilCardStatus::New() const {
+  return new RilCardStatus;
+}
+
+void RilCardStatus::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    card_state_ = 0;
+    universal_pin_state_ = 0;
+    gsm_umts_subscription_app_index_ = 0;
+    cdma_subscription_app_index_ = 0;
+    num_applications_ = 0;
+  }
+  applications_.Clear();
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RilCardStatus::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional .ril_proto.RilCardState card_state = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilCardState_IsValid(value)) {
+            set_card_state(static_cast< ril_proto::RilCardState >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(1, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_universal_pin_state;
+        break;
+      }
+      
+      // optional .ril_proto.RilPinState universal_pin_state = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_universal_pin_state:
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilPinState_IsValid(value)) {
+            set_universal_pin_state(static_cast< ril_proto::RilPinState >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(2, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(24)) goto parse_gsm_umts_subscription_app_index;
+        break;
+      }
+      
+      // optional int32 gsm_umts_subscription_app_index = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_gsm_umts_subscription_app_index:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &gsm_umts_subscription_app_index_)));
+          _set_bit(2);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(32)) goto parse_cdma_subscription_app_index;
+        break;
+      }
+      
+      // optional int32 cdma_subscription_app_index = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_cdma_subscription_app_index:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &cdma_subscription_app_index_)));
+          _set_bit(3);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(40)) goto parse_num_applications;
+        break;
+      }
+      
+      // optional int32 num_applications = 5;
+      case 5: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_num_applications:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &num_applications_)));
+          _set_bit(4);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(50)) goto parse_applications;
+        break;
+      }
+      
+      // repeated .ril_proto.RilAppStatus applications = 6;
+      case 6: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_applications:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+                input, add_applications()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(50)) goto parse_applications;
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RilCardStatus::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional .ril_proto.RilCardState card_state = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->card_state(), output);
+  }
+  
+  // optional .ril_proto.RilPinState universal_pin_state = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      2, this->universal_pin_state(), output);
+  }
+  
+  // optional int32 gsm_umts_subscription_app_index = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->gsm_umts_subscription_app_index(), output);
+  }
+  
+  // optional int32 cdma_subscription_app_index = 4;
+  if (_has_bit(3)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->cdma_subscription_app_index(), output);
+  }
+  
+  // optional int32 num_applications = 5;
+  if (_has_bit(4)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->num_applications(), output);
+  }
+  
+  // repeated .ril_proto.RilAppStatus applications = 6;
+  for (int i = 0; i < this->applications_size(); i++) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      6, this->applications(i), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RilCardStatus::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional .ril_proto.RilCardState card_state = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->card_state(), target);
+  }
+  
+  // optional .ril_proto.RilPinState universal_pin_state = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      2, this->universal_pin_state(), target);
+  }
+  
+  // optional int32 gsm_umts_subscription_app_index = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->gsm_umts_subscription_app_index(), target);
+  }
+  
+  // optional int32 cdma_subscription_app_index = 4;
+  if (_has_bit(3)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->cdma_subscription_app_index(), target);
+  }
+  
+  // optional int32 num_applications = 5;
+  if (_has_bit(4)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(5, this->num_applications(), target);
+  }
+  
+  // repeated .ril_proto.RilAppStatus applications = 6;
+  for (int i = 0; i < this->applications_size(); i++) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        6, this->applications(i), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RilCardStatus::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional .ril_proto.RilCardState card_state = 1;
+    if (has_card_state()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->card_state());
+    }
+    
+    // optional .ril_proto.RilPinState universal_pin_state = 2;
+    if (has_universal_pin_state()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->universal_pin_state());
+    }
+    
+    // optional int32 gsm_umts_subscription_app_index = 3;
+    if (has_gsm_umts_subscription_app_index()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->gsm_umts_subscription_app_index());
+    }
+    
+    // optional int32 cdma_subscription_app_index = 4;
+    if (has_cdma_subscription_app_index()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->cdma_subscription_app_index());
+    }
+    
+    // optional int32 num_applications = 5;
+    if (has_num_applications()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->num_applications());
+    }
+    
+  }
+  // repeated .ril_proto.RilAppStatus applications = 6;
+  total_size += 1 * this->applications_size();
+  for (int i = 0; i < this->applications_size(); i++) {
+    total_size +=
+      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+        this->applications(i));
+  }
+  
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RilCardStatus::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RilCardStatus* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RilCardStatus*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RilCardStatus::MergeFrom(const RilCardStatus& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  applications_.MergeFrom(from.applications_);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_card_state(from.card_state());
+    }
+    if (from._has_bit(1)) {
+      set_universal_pin_state(from.universal_pin_state());
+    }
+    if (from._has_bit(2)) {
+      set_gsm_umts_subscription_app_index(from.gsm_umts_subscription_app_index());
+    }
+    if (from._has_bit(3)) {
+      set_cdma_subscription_app_index(from.cdma_subscription_app_index());
+    }
+    if (from._has_bit(4)) {
+      set_num_applications(from.num_applications());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RilCardStatus::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RilCardStatus::CopyFrom(const RilCardStatus& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RilCardStatus::IsInitialized() const {
+  
+  return true;
+}
+
+void RilCardStatus::Swap(RilCardStatus* other) {
+  if (other != this) {
+    std::swap(card_state_, other->card_state_);
+    std::swap(universal_pin_state_, other->universal_pin_state_);
+    std::swap(gsm_umts_subscription_app_index_, other->gsm_umts_subscription_app_index_);
+    std::swap(cdma_subscription_app_index_, other->cdma_subscription_app_index_);
+    std::swap(num_applications_, other->num_applications_);
+    applications_.Swap(&other->applications_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RilCardStatus::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RilCardStatus_descriptor_;
+  metadata.reflection = RilCardStatus_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+const ::std::string RilUusInfo::_default_uus_data_;
+#ifndef _MSC_VER
+const int RilUusInfo::kUusTypeFieldNumber;
+const int RilUusInfo::kUusDcsFieldNumber;
+const int RilUusInfo::kUusLengthFieldNumber;
+const int RilUusInfo::kUusDataFieldNumber;
+#endif  // !_MSC_VER
+
+RilUusInfo::RilUusInfo()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RilUusInfo::InitAsDefaultInstance() {
+}
+
+RilUusInfo::RilUusInfo(const RilUusInfo& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RilUusInfo::SharedCtor() {
+  _cached_size_ = 0;
+  uus_type_ = 0;
+  uus_dcs_ = 0;
+  uus_length_ = 0;
+  uus_data_ = const_cast< ::std::string*>(&_default_uus_data_);
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RilUusInfo::~RilUusInfo() {
+  SharedDtor();
+}
+
+void RilUusInfo::SharedDtor() {
+  if (uus_data_ != &_default_uus_data_) {
+    delete uus_data_;
+  }
+  if (this != default_instance_) {
+  }
+}
+
+void RilUusInfo::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RilUusInfo::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilUusInfo_descriptor_;
+}
+
+const RilUusInfo& RilUusInfo::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RilUusInfo* RilUusInfo::default_instance_ = NULL;
+
+RilUusInfo* RilUusInfo::New() const {
+  return new RilUusInfo;
+}
+
+void RilUusInfo::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    uus_type_ = 0;
+    uus_dcs_ = 0;
+    uus_length_ = 0;
+    if (_has_bit(3)) {
+      if (uus_data_ != &_default_uus_data_) {
+        uus_data_->clear();
+      }
+    }
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RilUusInfo::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional .ril_proto.RilUusType uus_type = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilUusType_IsValid(value)) {
+            set_uus_type(static_cast< ril_proto::RilUusType >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(1, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_uus_dcs;
+        break;
+      }
+      
+      // optional .ril_proto.RilUusDcs uus_dcs = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_uus_dcs:
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilUusDcs_IsValid(value)) {
+            set_uus_dcs(static_cast< ril_proto::RilUusDcs >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(2, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(24)) goto parse_uus_length;
+        break;
+      }
+      
+      // optional int32 uus_length = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_uus_length:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &uus_length_)));
+          _set_bit(2);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(34)) goto parse_uus_data;
+        break;
+      }
+      
+      // optional string uus_data = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_uus_data:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_uus_data()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->uus_data().data(), this->uus_data().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RilUusInfo::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional .ril_proto.RilUusType uus_type = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->uus_type(), output);
+  }
+  
+  // optional .ril_proto.RilUusDcs uus_dcs = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      2, this->uus_dcs(), output);
+  }
+  
+  // optional int32 uus_length = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->uus_length(), output);
+  }
+  
+  // optional string uus_data = 4;
+  if (_has_bit(3)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->uus_data().data(), this->uus_data().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      4, this->uus_data(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RilUusInfo::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional .ril_proto.RilUusType uus_type = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->uus_type(), target);
+  }
+  
+  // optional .ril_proto.RilUusDcs uus_dcs = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      2, this->uus_dcs(), target);
+  }
+  
+  // optional int32 uus_length = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->uus_length(), target);
+  }
+  
+  // optional string uus_data = 4;
+  if (_has_bit(3)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->uus_data().data(), this->uus_data().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        4, this->uus_data(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RilUusInfo::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional .ril_proto.RilUusType uus_type = 1;
+    if (has_uus_type()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->uus_type());
+    }
+    
+    // optional .ril_proto.RilUusDcs uus_dcs = 2;
+    if (has_uus_dcs()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->uus_dcs());
+    }
+    
+    // optional int32 uus_length = 3;
+    if (has_uus_length()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->uus_length());
+    }
+    
+    // optional string uus_data = 4;
+    if (has_uus_data()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->uus_data());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RilUusInfo::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RilUusInfo* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RilUusInfo*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RilUusInfo::MergeFrom(const RilUusInfo& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_uus_type(from.uus_type());
+    }
+    if (from._has_bit(1)) {
+      set_uus_dcs(from.uus_dcs());
+    }
+    if (from._has_bit(2)) {
+      set_uus_length(from.uus_length());
+    }
+    if (from._has_bit(3)) {
+      set_uus_data(from.uus_data());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RilUusInfo::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RilUusInfo::CopyFrom(const RilUusInfo& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RilUusInfo::IsInitialized() const {
+  
+  return true;
+}
+
+void RilUusInfo::Swap(RilUusInfo* other) {
+  if (other != this) {
+    std::swap(uus_type_, other->uus_type_);
+    std::swap(uus_dcs_, other->uus_dcs_);
+    std::swap(uus_length_, other->uus_length_);
+    std::swap(uus_data_, other->uus_data_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RilUusInfo::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RilUusInfo_descriptor_;
+  metadata.reflection = RilUusInfo_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+const ::std::string RilCall::_default_number_;
+const ::std::string RilCall::_default_name_;
+#ifndef _MSC_VER
+const int RilCall::kStateFieldNumber;
+const int RilCall::kIndexFieldNumber;
+const int RilCall::kToaFieldNumber;
+const int RilCall::kIsMptyFieldNumber;
+const int RilCall::kIsMtFieldNumber;
+const int RilCall::kAlsFieldNumber;
+const int RilCall::kIsVoiceFieldNumber;
+const int RilCall::kIsVoicePrivacyFieldNumber;
+const int RilCall::kNumberFieldNumber;
+const int RilCall::kNumberPresentationFieldNumber;
+const int RilCall::kNameFieldNumber;
+const int RilCall::kNamePresentationFieldNumber;
+const int RilCall::kUusInfoFieldNumber;
+#endif  // !_MSC_VER
+
+RilCall::RilCall()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RilCall::InitAsDefaultInstance() {
+  uus_info_ = const_cast< ::ril_proto::RilUusInfo*>(&::ril_proto::RilUusInfo::default_instance());
+}
+
+RilCall::RilCall(const RilCall& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RilCall::SharedCtor() {
+  _cached_size_ = 0;
+  state_ = 0;
+  index_ = 0;
+  toa_ = 0;
+  is_mpty_ = false;
+  is_mt_ = false;
+  als_ = 0;
+  is_voice_ = false;
+  is_voice_privacy_ = false;
+  number_ = const_cast< ::std::string*>(&_default_number_);
+  number_presentation_ = 0;
+  name_ = const_cast< ::std::string*>(&_default_name_);
+  name_presentation_ = 0;
+  uus_info_ = NULL;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RilCall::~RilCall() {
+  SharedDtor();
+}
+
+void RilCall::SharedDtor() {
+  if (number_ != &_default_number_) {
+    delete number_;
+  }
+  if (name_ != &_default_name_) {
+    delete name_;
+  }
+  if (this != default_instance_) {
+    delete uus_info_;
+  }
+}
+
+void RilCall::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RilCall::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RilCall_descriptor_;
+}
+
+const RilCall& RilCall::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RilCall* RilCall::default_instance_ = NULL;
+
+RilCall* RilCall::New() const {
+  return new RilCall;
+}
+
+void RilCall::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    state_ = 0;
+    index_ = 0;
+    toa_ = 0;
+    is_mpty_ = false;
+    is_mt_ = false;
+    als_ = 0;
+    is_voice_ = false;
+    is_voice_privacy_ = false;
+  }
+  if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+    if (_has_bit(8)) {
+      if (number_ != &_default_number_) {
+        number_->clear();
+      }
+    }
+    number_presentation_ = 0;
+    if (_has_bit(10)) {
+      if (name_ != &_default_name_) {
+        name_->clear();
+      }
+    }
+    name_presentation_ = 0;
+    if (_has_bit(12)) {
+      if (uus_info_ != NULL) uus_info_->::ril_proto::RilUusInfo::Clear();
+    }
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RilCall::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional .ril_proto.RilCallState state = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (ril_proto::RilCallState_IsValid(value)) {
+            set_state(static_cast< ril_proto::RilCallState >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(1, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_index;
+        break;
+      }
+      
+      // optional int32 index = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_index:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &index_)));
+          _set_bit(1);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(24)) goto parse_toa;
+        break;
+      }
+      
+      // optional int32 toa = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_toa:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &toa_)));
+          _set_bit(2);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(32)) goto parse_is_mpty;
+        break;
+      }
+      
+      // optional bool is_mpty = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_is_mpty:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                 input, &is_mpty_)));
+          _set_bit(3);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(40)) goto parse_is_mt;
+        break;
+      }
+      
+      // optional bool is_mt = 5;
+      case 5: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_is_mt:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                 input, &is_mt_)));
+          _set_bit(4);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(48)) goto parse_als;
+        break;
+      }
+      
+      // optional int32 als = 6;
+      case 6: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_als:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &als_)));
+          _set_bit(5);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(56)) goto parse_is_voice;
+        break;
+      }
+      
+      // optional bool is_voice = 7;
+      case 7: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_is_voice:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                 input, &is_voice_)));
+          _set_bit(6);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(64)) goto parse_is_voice_privacy;
+        break;
+      }
+      
+      // optional bool is_voice_privacy = 8;
+      case 8: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_is_voice_privacy:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                 input, &is_voice_privacy_)));
+          _set_bit(7);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(74)) goto parse_number;
+        break;
+      }
+      
+      // optional string number = 9;
+      case 9: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_number:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_number()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->number().data(), this->number().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(80)) goto parse_number_presentation;
+        break;
+      }
+      
+      // optional int32 number_presentation = 10;
+      case 10: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_number_presentation:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &number_presentation_)));
+          _set_bit(9);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(90)) goto parse_name;
+        break;
+      }
+      
+      // optional string name = 11;
+      case 11: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_name:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_name()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->name().data(), this->name().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(96)) goto parse_name_presentation;
+        break;
+      }
+      
+      // optional int32 name_presentation = 12;
+      case 12: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_name_presentation:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &name_presentation_)));
+          _set_bit(11);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(106)) goto parse_uus_info;
+        break;
+      }
+      
+      // optional .ril_proto.RilUusInfo uus_info = 13;
+      case 13: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_uus_info:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+               input, mutable_uus_info()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RilCall::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional .ril_proto.RilCallState state = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->state(), output);
+  }
+  
+  // optional int32 index = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->index(), output);
+  }
+  
+  // optional int32 toa = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->toa(), output);
+  }
+  
+  // optional bool is_mpty = 4;
+  if (_has_bit(3)) {
+    ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->is_mpty(), output);
+  }
+  
+  // optional bool is_mt = 5;
+  if (_has_bit(4)) {
+    ::google::protobuf::internal::WireFormatLite::WriteBool(5, this->is_mt(), output);
+  }
+  
+  // optional int32 als = 6;
+  if (_has_bit(5)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->als(), output);
+  }
+  
+  // optional bool is_voice = 7;
+  if (_has_bit(6)) {
+    ::google::protobuf::internal::WireFormatLite::WriteBool(7, this->is_voice(), output);
+  }
+  
+  // optional bool is_voice_privacy = 8;
+  if (_has_bit(7)) {
+    ::google::protobuf::internal::WireFormatLite::WriteBool(8, this->is_voice_privacy(), output);
+  }
+  
+  // optional string number = 9;
+  if (_has_bit(8)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->number().data(), this->number().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      9, this->number(), output);
+  }
+  
+  // optional int32 number_presentation = 10;
+  if (_has_bit(9)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(10, this->number_presentation(), output);
+  }
+  
+  // optional string name = 11;
+  if (_has_bit(10)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->name().data(), this->name().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      11, this->name(), output);
+  }
+  
+  // optional int32 name_presentation = 12;
+  if (_has_bit(11)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(12, this->name_presentation(), output);
+  }
+  
+  // optional .ril_proto.RilUusInfo uus_info = 13;
+  if (_has_bit(12)) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      13, this->uus_info(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RilCall::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional .ril_proto.RilCallState state = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->state(), target);
+  }
+  
+  // optional int32 index = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->index(), target);
+  }
+  
+  // optional int32 toa = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->toa(), target);
+  }
+  
+  // optional bool is_mpty = 4;
+  if (_has_bit(3)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->is_mpty(), target);
+  }
+  
+  // optional bool is_mt = 5;
+  if (_has_bit(4)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->is_mt(), target);
+  }
+  
+  // optional int32 als = 6;
+  if (_has_bit(5)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(6, this->als(), target);
+  }
+  
+  // optional bool is_voice = 7;
+  if (_has_bit(6)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(7, this->is_voice(), target);
+  }
+  
+  // optional bool is_voice_privacy = 8;
+  if (_has_bit(7)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(8, this->is_voice_privacy(), target);
+  }
+  
+  // optional string number = 9;
+  if (_has_bit(8)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->number().data(), this->number().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        9, this->number(), target);
+  }
+  
+  // optional int32 number_presentation = 10;
+  if (_has_bit(9)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(10, this->number_presentation(), target);
+  }
+  
+  // optional string name = 11;
+  if (_has_bit(10)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->name().data(), this->name().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        11, this->name(), target);
+  }
+  
+  // optional int32 name_presentation = 12;
+  if (_has_bit(11)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(12, this->name_presentation(), target);
+  }
+  
+  // optional .ril_proto.RilUusInfo uus_info = 13;
+  if (_has_bit(12)) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        13, this->uus_info(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RilCall::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional .ril_proto.RilCallState state = 1;
+    if (has_state()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->state());
+    }
+    
+    // optional int32 index = 2;
+    if (has_index()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->index());
+    }
+    
+    // optional int32 toa = 3;
+    if (has_toa()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->toa());
+    }
+    
+    // optional bool is_mpty = 4;
+    if (has_is_mpty()) {
+      total_size += 1 + 1;
+    }
+    
+    // optional bool is_mt = 5;
+    if (has_is_mt()) {
+      total_size += 1 + 1;
+    }
+    
+    // optional int32 als = 6;
+    if (has_als()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->als());
+    }
+    
+    // optional bool is_voice = 7;
+    if (has_is_voice()) {
+      total_size += 1 + 1;
+    }
+    
+    // optional bool is_voice_privacy = 8;
+    if (has_is_voice_privacy()) {
+      total_size += 1 + 1;
+    }
+    
+  }
+  if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+    // optional string number = 9;
+    if (has_number()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->number());
+    }
+    
+    // optional int32 number_presentation = 10;
+    if (has_number_presentation()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->number_presentation());
+    }
+    
+    // optional string name = 11;
+    if (has_name()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->name());
+    }
+    
+    // optional int32 name_presentation = 12;
+    if (has_name_presentation()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->name_presentation());
+    }
+    
+    // optional .ril_proto.RilUusInfo uus_info = 13;
+    if (has_uus_info()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+          this->uus_info());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RilCall::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RilCall* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RilCall*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RilCall::MergeFrom(const RilCall& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_state(from.state());
+    }
+    if (from._has_bit(1)) {
+      set_index(from.index());
+    }
+    if (from._has_bit(2)) {
+      set_toa(from.toa());
+    }
+    if (from._has_bit(3)) {
+      set_is_mpty(from.is_mpty());
+    }
+    if (from._has_bit(4)) {
+      set_is_mt(from.is_mt());
+    }
+    if (from._has_bit(5)) {
+      set_als(from.als());
+    }
+    if (from._has_bit(6)) {
+      set_is_voice(from.is_voice());
+    }
+    if (from._has_bit(7)) {
+      set_is_voice_privacy(from.is_voice_privacy());
+    }
+  }
+  if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+    if (from._has_bit(8)) {
+      set_number(from.number());
+    }
+    if (from._has_bit(9)) {
+      set_number_presentation(from.number_presentation());
+    }
+    if (from._has_bit(10)) {
+      set_name(from.name());
+    }
+    if (from._has_bit(11)) {
+      set_name_presentation(from.name_presentation());
+    }
+    if (from._has_bit(12)) {
+      mutable_uus_info()->::ril_proto::RilUusInfo::MergeFrom(from.uus_info());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RilCall::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RilCall::CopyFrom(const RilCall& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RilCall::IsInitialized() const {
+  
+  return true;
+}
+
+void RilCall::Swap(RilCall* other) {
+  if (other != this) {
+    std::swap(state_, other->state_);
+    std::swap(index_, other->index_);
+    std::swap(toa_, other->toa_);
+    std::swap(is_mpty_, other->is_mpty_);
+    std::swap(is_mt_, other->is_mt_);
+    std::swap(als_, other->als_);
+    std::swap(is_voice_, other->is_voice_);
+    std::swap(is_voice_privacy_, other->is_voice_privacy_);
+    std::swap(number_, other->number_);
+    std::swap(number_presentation_, other->number_presentation_);
+    std::swap(name_, other->name_);
+    std::swap(name_presentation_, other->name_presentation_);
+    std::swap(uus_info_, other->uus_info_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RilCall::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RilCall_descriptor_;
+  metadata.reflection = RilCall_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RILGWSignalStrength::kSignalStrengthFieldNumber;
+const int RILGWSignalStrength::kBitErrorRateFieldNumber;
+#endif  // !_MSC_VER
+
+RILGWSignalStrength::RILGWSignalStrength()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RILGWSignalStrength::InitAsDefaultInstance() {
+}
+
+RILGWSignalStrength::RILGWSignalStrength(const RILGWSignalStrength& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RILGWSignalStrength::SharedCtor() {
+  _cached_size_ = 0;
+  signal_strength_ = 0;
+  bit_error_rate_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RILGWSignalStrength::~RILGWSignalStrength() {
+  SharedDtor();
+}
+
+void RILGWSignalStrength::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void RILGWSignalStrength::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RILGWSignalStrength::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RILGWSignalStrength_descriptor_;
+}
+
+const RILGWSignalStrength& RILGWSignalStrength::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RILGWSignalStrength* RILGWSignalStrength::default_instance_ = NULL;
+
+RILGWSignalStrength* RILGWSignalStrength::New() const {
+  return new RILGWSignalStrength;
+}
+
+void RILGWSignalStrength::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    signal_strength_ = 0;
+    bit_error_rate_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RILGWSignalStrength::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional int32 signal_strength = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &signal_strength_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_bit_error_rate;
+        break;
+      }
+      
+      // optional int32 bit_error_rate = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_bit_error_rate:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &bit_error_rate_)));
+          _set_bit(1);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RILGWSignalStrength::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional int32 signal_strength = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->signal_strength(), output);
+  }
+  
+  // optional int32 bit_error_rate = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->bit_error_rate(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RILGWSignalStrength::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional int32 signal_strength = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->signal_strength(), target);
+  }
+  
+  // optional int32 bit_error_rate = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->bit_error_rate(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RILGWSignalStrength::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional int32 signal_strength = 1;
+    if (has_signal_strength()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->signal_strength());
+    }
+    
+    // optional int32 bit_error_rate = 2;
+    if (has_bit_error_rate()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->bit_error_rate());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RILGWSignalStrength::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RILGWSignalStrength* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RILGWSignalStrength*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RILGWSignalStrength::MergeFrom(const RILGWSignalStrength& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_signal_strength(from.signal_strength());
+    }
+    if (from._has_bit(1)) {
+      set_bit_error_rate(from.bit_error_rate());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RILGWSignalStrength::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RILGWSignalStrength::CopyFrom(const RILGWSignalStrength& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RILGWSignalStrength::IsInitialized() const {
+  
+  return true;
+}
+
+void RILGWSignalStrength::Swap(RILGWSignalStrength* other) {
+  if (other != this) {
+    std::swap(signal_strength_, other->signal_strength_);
+    std::swap(bit_error_rate_, other->bit_error_rate_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RILGWSignalStrength::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RILGWSignalStrength_descriptor_;
+  metadata.reflection = RILGWSignalStrength_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RILCDMASignalStrength::kDbmFieldNumber;
+const int RILCDMASignalStrength::kEcioFieldNumber;
+#endif  // !_MSC_VER
+
+RILCDMASignalStrength::RILCDMASignalStrength()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RILCDMASignalStrength::InitAsDefaultInstance() {
+}
+
+RILCDMASignalStrength::RILCDMASignalStrength(const RILCDMASignalStrength& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RILCDMASignalStrength::SharedCtor() {
+  _cached_size_ = 0;
+  dbm_ = 0;
+  ecio_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RILCDMASignalStrength::~RILCDMASignalStrength() {
+  SharedDtor();
+}
+
+void RILCDMASignalStrength::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void RILCDMASignalStrength::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RILCDMASignalStrength::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RILCDMASignalStrength_descriptor_;
+}
+
+const RILCDMASignalStrength& RILCDMASignalStrength::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RILCDMASignalStrength* RILCDMASignalStrength::default_instance_ = NULL;
+
+RILCDMASignalStrength* RILCDMASignalStrength::New() const {
+  return new RILCDMASignalStrength;
+}
+
+void RILCDMASignalStrength::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    dbm_ = 0;
+    ecio_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RILCDMASignalStrength::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional int32 dbm = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &dbm_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_ecio;
+        break;
+      }
+      
+      // optional int32 ecio = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_ecio:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &ecio_)));
+          _set_bit(1);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RILCDMASignalStrength::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional int32 dbm = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->dbm(), output);
+  }
+  
+  // optional int32 ecio = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->ecio(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RILCDMASignalStrength::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional int32 dbm = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->dbm(), target);
+  }
+  
+  // optional int32 ecio = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->ecio(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RILCDMASignalStrength::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional int32 dbm = 1;
+    if (has_dbm()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->dbm());
+    }
+    
+    // optional int32 ecio = 2;
+    if (has_ecio()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->ecio());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RILCDMASignalStrength::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RILCDMASignalStrength* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RILCDMASignalStrength*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RILCDMASignalStrength::MergeFrom(const RILCDMASignalStrength& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_dbm(from.dbm());
+    }
+    if (from._has_bit(1)) {
+      set_ecio(from.ecio());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RILCDMASignalStrength::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RILCDMASignalStrength::CopyFrom(const RILCDMASignalStrength& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RILCDMASignalStrength::IsInitialized() const {
+  
+  return true;
+}
+
+void RILCDMASignalStrength::Swap(RILCDMASignalStrength* other) {
+  if (other != this) {
+    std::swap(dbm_, other->dbm_);
+    std::swap(ecio_, other->ecio_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RILCDMASignalStrength::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RILCDMASignalStrength_descriptor_;
+  metadata.reflection = RILCDMASignalStrength_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RILEVDOSignalStrength::kDbmFieldNumber;
+const int RILEVDOSignalStrength::kEcioFieldNumber;
+const int RILEVDOSignalStrength::kSignalNoiseRatioFieldNumber;
+#endif  // !_MSC_VER
+
+RILEVDOSignalStrength::RILEVDOSignalStrength()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RILEVDOSignalStrength::InitAsDefaultInstance() {
+}
+
+RILEVDOSignalStrength::RILEVDOSignalStrength(const RILEVDOSignalStrength& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RILEVDOSignalStrength::SharedCtor() {
+  _cached_size_ = 0;
+  dbm_ = 0;
+  ecio_ = 0;
+  signal_noise_ratio_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RILEVDOSignalStrength::~RILEVDOSignalStrength() {
+  SharedDtor();
+}
+
+void RILEVDOSignalStrength::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void RILEVDOSignalStrength::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RILEVDOSignalStrength::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RILEVDOSignalStrength_descriptor_;
+}
+
+const RILEVDOSignalStrength& RILEVDOSignalStrength::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RILEVDOSignalStrength* RILEVDOSignalStrength::default_instance_ = NULL;
+
+RILEVDOSignalStrength* RILEVDOSignalStrength::New() const {
+  return new RILEVDOSignalStrength;
+}
+
+void RILEVDOSignalStrength::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    dbm_ = 0;
+    ecio_ = 0;
+    signal_noise_ratio_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RILEVDOSignalStrength::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional int32 dbm = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &dbm_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_ecio;
+        break;
+      }
+      
+      // optional int32 ecio = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_ecio:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &ecio_)));
+          _set_bit(1);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(24)) goto parse_signal_noise_ratio;
+        break;
+      }
+      
+      // optional int32 signal_noise_ratio = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_signal_noise_ratio:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &signal_noise_ratio_)));
+          _set_bit(2);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RILEVDOSignalStrength::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional int32 dbm = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->dbm(), output);
+  }
+  
+  // optional int32 ecio = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->ecio(), output);
+  }
+  
+  // optional int32 signal_noise_ratio = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->signal_noise_ratio(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RILEVDOSignalStrength::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional int32 dbm = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->dbm(), target);
+  }
+  
+  // optional int32 ecio = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->ecio(), target);
+  }
+  
+  // optional int32 signal_noise_ratio = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->signal_noise_ratio(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RILEVDOSignalStrength::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional int32 dbm = 1;
+    if (has_dbm()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->dbm());
+    }
+    
+    // optional int32 ecio = 2;
+    if (has_ecio()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->ecio());
+    }
+    
+    // optional int32 signal_noise_ratio = 3;
+    if (has_signal_noise_ratio()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->signal_noise_ratio());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RILEVDOSignalStrength::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RILEVDOSignalStrength* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RILEVDOSignalStrength*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RILEVDOSignalStrength::MergeFrom(const RILEVDOSignalStrength& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_dbm(from.dbm());
+    }
+    if (from._has_bit(1)) {
+      set_ecio(from.ecio());
+    }
+    if (from._has_bit(2)) {
+      set_signal_noise_ratio(from.signal_noise_ratio());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RILEVDOSignalStrength::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RILEVDOSignalStrength::CopyFrom(const RILEVDOSignalStrength& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RILEVDOSignalStrength::IsInitialized() const {
+  
+  return true;
+}
+
+void RILEVDOSignalStrength::Swap(RILEVDOSignalStrength* other) {
+  if (other != this) {
+    std::swap(dbm_, other->dbm_);
+    std::swap(ecio_, other->ecio_);
+    std::swap(signal_noise_ratio_, other->signal_noise_ratio_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RILEVDOSignalStrength::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RILEVDOSignalStrength_descriptor_;
+  metadata.reflection = RILEVDOSignalStrength_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RspStrings::kStringsFieldNumber;
+#endif  // !_MSC_VER
+
+RspStrings::RspStrings()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RspStrings::InitAsDefaultInstance() {
+}
+
+RspStrings::RspStrings(const RspStrings& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RspStrings::SharedCtor() {
+  _cached_size_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RspStrings::~RspStrings() {
+  SharedDtor();
+}
+
+void RspStrings::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void RspStrings::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RspStrings::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RspStrings_descriptor_;
+}
+
+const RspStrings& RspStrings::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RspStrings* RspStrings::default_instance_ = NULL;
+
+RspStrings* RspStrings::New() const {
+  return new RspStrings;
+}
+
+void RspStrings::Clear() {
+  strings_.Clear();
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RspStrings::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // repeated string strings = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_strings:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->add_strings()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->strings(0).data(), this->strings(0).length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(10)) goto parse_strings;
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RspStrings::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // repeated string strings = 1;
+  for (int i = 0; i < this->strings_size(); i++) {
+  ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+    this->strings(i).data(), this->strings(i).length(),
+    ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      1, this->strings(i), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RspStrings::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // repeated string strings = 1;
+  for (int i = 0; i < this->strings_size(); i++) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->strings(i).data(), this->strings(i).length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteStringToArray(1, this->strings(i), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RspStrings::ByteSize() const {
+  int total_size = 0;
+  
+  // repeated string strings = 1;
+  total_size += 1 * this->strings_size();
+  for (int i = 0; i < this->strings_size(); i++) {
+    total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
+      this->strings(i));
+  }
+  
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RspStrings::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RspStrings* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RspStrings*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RspStrings::MergeFrom(const RspStrings& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  strings_.MergeFrom(from.strings_);
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RspStrings::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RspStrings::CopyFrom(const RspStrings& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RspStrings::IsInitialized() const {
+  
+  return true;
+}
+
+void RspStrings::Swap(RspStrings* other) {
+  if (other != this) {
+    strings_.Swap(&other->strings_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RspStrings::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RspStrings_descriptor_;
+  metadata.reflection = RspStrings_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RspIntegers::kIntegersFieldNumber;
+#endif  // !_MSC_VER
+
+RspIntegers::RspIntegers()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RspIntegers::InitAsDefaultInstance() {
+}
+
+RspIntegers::RspIntegers(const RspIntegers& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RspIntegers::SharedCtor() {
+  _cached_size_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RspIntegers::~RspIntegers() {
+  SharedDtor();
+}
+
+void RspIntegers::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void RspIntegers::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RspIntegers::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RspIntegers_descriptor_;
+}
+
+const RspIntegers& RspIntegers::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RspIntegers* RspIntegers::default_instance_ = NULL;
+
+RspIntegers* RspIntegers::New() const {
+  return new RspIntegers;
+}
+
+void RspIntegers::Clear() {
+  integers_.Clear();
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RspIntegers::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // repeated int32 integers = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_integers:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 1, 8, input, this->mutable_integers())));
+        } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+                   == ::google::protobuf::internal::WireFormatLite::
+                      WIRETYPE_LENGTH_DELIMITED) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, this->mutable_integers())));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(8)) goto parse_integers;
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RspIntegers::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // repeated int32 integers = 1;
+  for (int i = 0; i < this->integers_size(); i++) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(
+      1, this->integers(i), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RspIntegers::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // repeated int32 integers = 1;
+  for (int i = 0; i < this->integers_size(); i++) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteInt32ToArray(1, this->integers(i), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RspIntegers::ByteSize() const {
+  int total_size = 0;
+  
+  // repeated int32 integers = 1;
+  {
+    int data_size = 0;
+    for (int i = 0; i < this->integers_size(); i++) {
+      data_size += ::google::protobuf::internal::WireFormatLite::
+        Int32Size(this->integers(i));
+    }
+    total_size += 1 * this->integers_size() + data_size;
+  }
+  
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RspIntegers::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RspIntegers* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RspIntegers*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RspIntegers::MergeFrom(const RspIntegers& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  integers_.MergeFrom(from.integers_);
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RspIntegers::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RspIntegers::CopyFrom(const RspIntegers& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RspIntegers::IsInitialized() const {
+  
+  return true;
+}
+
+void RspIntegers::Swap(RspIntegers* other) {
+  if (other != this) {
+    integers_.Swap(&other->integers_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RspIntegers::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RspIntegers_descriptor_;
+  metadata.reflection = RspIntegers_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RspGetSimStatus::kCardStatusFieldNumber;
+#endif  // !_MSC_VER
+
+RspGetSimStatus::RspGetSimStatus()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RspGetSimStatus::InitAsDefaultInstance() {
+  card_status_ = const_cast< ::ril_proto::RilCardStatus*>(&::ril_proto::RilCardStatus::default_instance());
+}
+
+RspGetSimStatus::RspGetSimStatus(const RspGetSimStatus& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RspGetSimStatus::SharedCtor() {
+  _cached_size_ = 0;
+  card_status_ = NULL;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RspGetSimStatus::~RspGetSimStatus() {
+  SharedDtor();
+}
+
+void RspGetSimStatus::SharedDtor() {
+  if (this != default_instance_) {
+    delete card_status_;
+  }
+}
+
+void RspGetSimStatus::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RspGetSimStatus::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RspGetSimStatus_descriptor_;
+}
+
+const RspGetSimStatus& RspGetSimStatus::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RspGetSimStatus* RspGetSimStatus::default_instance_ = NULL;
+
+RspGetSimStatus* RspGetSimStatus::New() const {
+  return new RspGetSimStatus;
+}
+
+void RspGetSimStatus::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (_has_bit(0)) {
+      if (card_status_ != NULL) card_status_->::ril_proto::RilCardStatus::Clear();
+    }
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RspGetSimStatus::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required .ril_proto.RilCardStatus card_status = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+               input, mutable_card_status()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RspGetSimStatus::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required .ril_proto.RilCardStatus card_status = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      1, this->card_status(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RspGetSimStatus::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required .ril_proto.RilCardStatus card_status = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        1, this->card_status(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RspGetSimStatus::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required .ril_proto.RilCardStatus card_status = 1;
+    if (has_card_status()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+          this->card_status());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RspGetSimStatus::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RspGetSimStatus* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RspGetSimStatus*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RspGetSimStatus::MergeFrom(const RspGetSimStatus& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      mutable_card_status()->::ril_proto::RilCardStatus::MergeFrom(from.card_status());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RspGetSimStatus::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RspGetSimStatus::CopyFrom(const RspGetSimStatus& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RspGetSimStatus::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void RspGetSimStatus::Swap(RspGetSimStatus* other) {
+  if (other != this) {
+    std::swap(card_status_, other->card_status_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RspGetSimStatus::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RspGetSimStatus_descriptor_;
+  metadata.reflection = RspGetSimStatus_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+const ::std::string ReqEnterSimPin::_default_pin_;
+#ifndef _MSC_VER
+const int ReqEnterSimPin::kPinFieldNumber;
+#endif  // !_MSC_VER
+
+ReqEnterSimPin::ReqEnterSimPin()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void ReqEnterSimPin::InitAsDefaultInstance() {
+}
+
+ReqEnterSimPin::ReqEnterSimPin(const ReqEnterSimPin& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void ReqEnterSimPin::SharedCtor() {
+  _cached_size_ = 0;
+  pin_ = const_cast< ::std::string*>(&_default_pin_);
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+ReqEnterSimPin::~ReqEnterSimPin() {
+  SharedDtor();
+}
+
+void ReqEnterSimPin::SharedDtor() {
+  if (pin_ != &_default_pin_) {
+    delete pin_;
+  }
+  if (this != default_instance_) {
+  }
+}
+
+void ReqEnterSimPin::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* ReqEnterSimPin::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return ReqEnterSimPin_descriptor_;
+}
+
+const ReqEnterSimPin& ReqEnterSimPin::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+ReqEnterSimPin* ReqEnterSimPin::default_instance_ = NULL;
+
+ReqEnterSimPin* ReqEnterSimPin::New() const {
+  return new ReqEnterSimPin;
+}
+
+void ReqEnterSimPin::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (_has_bit(0)) {
+      if (pin_ != &_default_pin_) {
+        pin_->clear();
+      }
+    }
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool ReqEnterSimPin::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required string pin = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_pin()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->pin().data(), this->pin().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void ReqEnterSimPin::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required string pin = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->pin().data(), this->pin().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      1, this->pin(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* ReqEnterSimPin::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required string pin = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->pin().data(), this->pin().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        1, this->pin(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int ReqEnterSimPin::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required string pin = 1;
+    if (has_pin()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->pin());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void ReqEnterSimPin::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const ReqEnterSimPin* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const ReqEnterSimPin*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void ReqEnterSimPin::MergeFrom(const ReqEnterSimPin& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_pin(from.pin());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void ReqEnterSimPin::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void ReqEnterSimPin::CopyFrom(const ReqEnterSimPin& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool ReqEnterSimPin::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void ReqEnterSimPin::Swap(ReqEnterSimPin* other) {
+  if (other != this) {
+    std::swap(pin_, other->pin_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata ReqEnterSimPin::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = ReqEnterSimPin_descriptor_;
+  metadata.reflection = ReqEnterSimPin_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RspEnterSimPin::kRetriesRemainingFieldNumber;
+#endif  // !_MSC_VER
+
+RspEnterSimPin::RspEnterSimPin()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RspEnterSimPin::InitAsDefaultInstance() {
+}
+
+RspEnterSimPin::RspEnterSimPin(const RspEnterSimPin& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RspEnterSimPin::SharedCtor() {
+  _cached_size_ = 0;
+  retries_remaining_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RspEnterSimPin::~RspEnterSimPin() {
+  SharedDtor();
+}
+
+void RspEnterSimPin::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void RspEnterSimPin::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RspEnterSimPin::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RspEnterSimPin_descriptor_;
+}
+
+const RspEnterSimPin& RspEnterSimPin::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RspEnterSimPin* RspEnterSimPin::default_instance_ = NULL;
+
+RspEnterSimPin* RspEnterSimPin::New() const {
+  return new RspEnterSimPin;
+}
+
+void RspEnterSimPin::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    retries_remaining_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RspEnterSimPin::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required int32 retries_remaining = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &retries_remaining_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RspEnterSimPin::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required int32 retries_remaining = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->retries_remaining(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RspEnterSimPin::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required int32 retries_remaining = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->retries_remaining(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RspEnterSimPin::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required int32 retries_remaining = 1;
+    if (has_retries_remaining()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->retries_remaining());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RspEnterSimPin::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RspEnterSimPin* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RspEnterSimPin*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RspEnterSimPin::MergeFrom(const RspEnterSimPin& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_retries_remaining(from.retries_remaining());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RspEnterSimPin::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RspEnterSimPin::CopyFrom(const RspEnterSimPin& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RspEnterSimPin::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void RspEnterSimPin::Swap(RspEnterSimPin* other) {
+  if (other != this) {
+    std::swap(retries_remaining_, other->retries_remaining_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RspEnterSimPin::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RspEnterSimPin_descriptor_;
+  metadata.reflection = RspEnterSimPin_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RspGetCurrentCalls::kCallsFieldNumber;
+#endif  // !_MSC_VER
+
+RspGetCurrentCalls::RspGetCurrentCalls()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RspGetCurrentCalls::InitAsDefaultInstance() {
+}
+
+RspGetCurrentCalls::RspGetCurrentCalls(const RspGetCurrentCalls& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RspGetCurrentCalls::SharedCtor() {
+  _cached_size_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RspGetCurrentCalls::~RspGetCurrentCalls() {
+  SharedDtor();
+}
+
+void RspGetCurrentCalls::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void RspGetCurrentCalls::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RspGetCurrentCalls::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RspGetCurrentCalls_descriptor_;
+}
+
+const RspGetCurrentCalls& RspGetCurrentCalls::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RspGetCurrentCalls* RspGetCurrentCalls::default_instance_ = NULL;
+
+RspGetCurrentCalls* RspGetCurrentCalls::New() const {
+  return new RspGetCurrentCalls;
+}
+
+void RspGetCurrentCalls::Clear() {
+  calls_.Clear();
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RspGetCurrentCalls::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // repeated .ril_proto.RilCall calls = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_calls:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+                input, add_calls()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(10)) goto parse_calls;
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RspGetCurrentCalls::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // repeated .ril_proto.RilCall calls = 1;
+  for (int i = 0; i < this->calls_size(); i++) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      1, this->calls(i), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RspGetCurrentCalls::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // repeated .ril_proto.RilCall calls = 1;
+  for (int i = 0; i < this->calls_size(); i++) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        1, this->calls(i), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RspGetCurrentCalls::ByteSize() const {
+  int total_size = 0;
+  
+  // repeated .ril_proto.RilCall calls = 1;
+  total_size += 1 * this->calls_size();
+  for (int i = 0; i < this->calls_size(); i++) {
+    total_size +=
+      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+        this->calls(i));
+  }
+  
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RspGetCurrentCalls::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RspGetCurrentCalls* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RspGetCurrentCalls*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RspGetCurrentCalls::MergeFrom(const RspGetCurrentCalls& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  calls_.MergeFrom(from.calls_);
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RspGetCurrentCalls::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RspGetCurrentCalls::CopyFrom(const RspGetCurrentCalls& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RspGetCurrentCalls::IsInitialized() const {
+  
+  return true;
+}
+
+void RspGetCurrentCalls::Swap(RspGetCurrentCalls* other) {
+  if (other != this) {
+    calls_.Swap(&other->calls_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RspGetCurrentCalls::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RspGetCurrentCalls_descriptor_;
+  metadata.reflection = RspGetCurrentCalls_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+const ::std::string ReqDial::_default_address_;
+#ifndef _MSC_VER
+const int ReqDial::kAddressFieldNumber;
+const int ReqDial::kClirFieldNumber;
+const int ReqDial::kUusInfoFieldNumber;
+#endif  // !_MSC_VER
+
+ReqDial::ReqDial()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void ReqDial::InitAsDefaultInstance() {
+  uus_info_ = const_cast< ::ril_proto::RilUusInfo*>(&::ril_proto::RilUusInfo::default_instance());
+}
+
+ReqDial::ReqDial(const ReqDial& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void ReqDial::SharedCtor() {
+  _cached_size_ = 0;
+  address_ = const_cast< ::std::string*>(&_default_address_);
+  clir_ = 0;
+  uus_info_ = NULL;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+ReqDial::~ReqDial() {
+  SharedDtor();
+}
+
+void ReqDial::SharedDtor() {
+  if (address_ != &_default_address_) {
+    delete address_;
+  }
+  if (this != default_instance_) {
+    delete uus_info_;
+  }
+}
+
+void ReqDial::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* ReqDial::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return ReqDial_descriptor_;
+}
+
+const ReqDial& ReqDial::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+ReqDial* ReqDial::default_instance_ = NULL;
+
+ReqDial* ReqDial::New() const {
+  return new ReqDial;
+}
+
+void ReqDial::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (_has_bit(0)) {
+      if (address_ != &_default_address_) {
+        address_->clear();
+      }
+    }
+    clir_ = 0;
+    if (_has_bit(2)) {
+      if (uus_info_ != NULL) uus_info_->::ril_proto::RilUusInfo::Clear();
+    }
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool ReqDial::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional string address = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_address()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->address().data(), this->address().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(16)) goto parse_clir;
+        break;
+      }
+      
+      // optional int32 clir = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_clir:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &clir_)));
+          _set_bit(1);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(26)) goto parse_uus_info;
+        break;
+      }
+      
+      // optional .ril_proto.RilUusInfo uus_info = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_uus_info:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+               input, mutable_uus_info()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void ReqDial::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional string address = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->address().data(), this->address().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      1, this->address(), output);
+  }
+  
+  // optional int32 clir = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->clir(), output);
+  }
+  
+  // optional .ril_proto.RilUusInfo uus_info = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      3, this->uus_info(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* ReqDial::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional string address = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->address().data(), this->address().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        1, this->address(), target);
+  }
+  
+  // optional int32 clir = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->clir(), target);
+  }
+  
+  // optional .ril_proto.RilUusInfo uus_info = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        3, this->uus_info(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int ReqDial::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional string address = 1;
+    if (has_address()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->address());
+    }
+    
+    // optional int32 clir = 2;
+    if (has_clir()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->clir());
+    }
+    
+    // optional .ril_proto.RilUusInfo uus_info = 3;
+    if (has_uus_info()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+          this->uus_info());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void ReqDial::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const ReqDial* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const ReqDial*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void ReqDial::MergeFrom(const ReqDial& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_address(from.address());
+    }
+    if (from._has_bit(1)) {
+      set_clir(from.clir());
+    }
+    if (from._has_bit(2)) {
+      mutable_uus_info()->::ril_proto::RilUusInfo::MergeFrom(from.uus_info());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void ReqDial::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void ReqDial::CopyFrom(const ReqDial& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool ReqDial::IsInitialized() const {
+  
+  return true;
+}
+
+void ReqDial::Swap(ReqDial* other) {
+  if (other != this) {
+    std::swap(address_, other->address_);
+    std::swap(clir_, other->clir_);
+    std::swap(uus_info_, other->uus_info_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata ReqDial::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = ReqDial_descriptor_;
+  metadata.reflection = ReqDial_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int ReqHangUp::kConnectionIndexFieldNumber;
+#endif  // !_MSC_VER
+
+ReqHangUp::ReqHangUp()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void ReqHangUp::InitAsDefaultInstance() {
+}
+
+ReqHangUp::ReqHangUp(const ReqHangUp& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void ReqHangUp::SharedCtor() {
+  _cached_size_ = 0;
+  connection_index_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+ReqHangUp::~ReqHangUp() {
+  SharedDtor();
+}
+
+void ReqHangUp::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void ReqHangUp::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* ReqHangUp::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return ReqHangUp_descriptor_;
+}
+
+const ReqHangUp& ReqHangUp::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+ReqHangUp* ReqHangUp::default_instance_ = NULL;
+
+ReqHangUp* ReqHangUp::New() const {
+  return new ReqHangUp;
+}
+
+void ReqHangUp::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    connection_index_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool ReqHangUp::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required int32 connection_index = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &connection_index_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void ReqHangUp::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required int32 connection_index = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->connection_index(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* ReqHangUp::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required int32 connection_index = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->connection_index(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int ReqHangUp::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required int32 connection_index = 1;
+    if (has_connection_index()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->connection_index());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void ReqHangUp::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const ReqHangUp* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const ReqHangUp*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void ReqHangUp::MergeFrom(const ReqHangUp& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_connection_index(from.connection_index());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void ReqHangUp::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void ReqHangUp::CopyFrom(const ReqHangUp& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool ReqHangUp::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void ReqHangUp::Swap(ReqHangUp* other) {
+  if (other != this) {
+    std::swap(connection_index_, other->connection_index_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata ReqHangUp::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = ReqHangUp_descriptor_;
+  metadata.reflection = ReqHangUp_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int RspSignalStrength::kGwSignalstrengthFieldNumber;
+const int RspSignalStrength::kCdmaSignalstrengthFieldNumber;
+const int RspSignalStrength::kEvdoSignalstrengthFieldNumber;
+#endif  // !_MSC_VER
+
+RspSignalStrength::RspSignalStrength()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RspSignalStrength::InitAsDefaultInstance() {
+  gw_signalstrength_ = const_cast< ::ril_proto::RILGWSignalStrength*>(&::ril_proto::RILGWSignalStrength::default_instance());
+  cdma_signalstrength_ = const_cast< ::ril_proto::RILCDMASignalStrength*>(&::ril_proto::RILCDMASignalStrength::default_instance());
+  evdo_signalstrength_ = const_cast< ::ril_proto::RILEVDOSignalStrength*>(&::ril_proto::RILEVDOSignalStrength::default_instance());
+}
+
+RspSignalStrength::RspSignalStrength(const RspSignalStrength& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RspSignalStrength::SharedCtor() {
+  _cached_size_ = 0;
+  gw_signalstrength_ = NULL;
+  cdma_signalstrength_ = NULL;
+  evdo_signalstrength_ = NULL;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RspSignalStrength::~RspSignalStrength() {
+  SharedDtor();
+}
+
+void RspSignalStrength::SharedDtor() {
+  if (this != default_instance_) {
+    delete gw_signalstrength_;
+    delete cdma_signalstrength_;
+    delete evdo_signalstrength_;
+  }
+}
+
+void RspSignalStrength::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RspSignalStrength::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RspSignalStrength_descriptor_;
+}
+
+const RspSignalStrength& RspSignalStrength::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RspSignalStrength* RspSignalStrength::default_instance_ = NULL;
+
+RspSignalStrength* RspSignalStrength::New() const {
+  return new RspSignalStrength;
+}
+
+void RspSignalStrength::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (_has_bit(0)) {
+      if (gw_signalstrength_ != NULL) gw_signalstrength_->::ril_proto::RILGWSignalStrength::Clear();
+    }
+    if (_has_bit(1)) {
+      if (cdma_signalstrength_ != NULL) cdma_signalstrength_->::ril_proto::RILCDMASignalStrength::Clear();
+    }
+    if (_has_bit(2)) {
+      if (evdo_signalstrength_ != NULL) evdo_signalstrength_->::ril_proto::RILEVDOSignalStrength::Clear();
+    }
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RspSignalStrength::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional .ril_proto.RILGWSignalStrength gw_signalstrength = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+               input, mutable_gw_signalstrength()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(18)) goto parse_cdma_signalstrength;
+        break;
+      }
+      
+      // optional .ril_proto.RILCDMASignalStrength cdma_signalstrength = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_cdma_signalstrength:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+               input, mutable_cdma_signalstrength()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(26)) goto parse_evdo_signalstrength;
+        break;
+      }
+      
+      // optional .ril_proto.RILEVDOSignalStrength evdo_signalstrength = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_evdo_signalstrength:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+               input, mutable_evdo_signalstrength()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RspSignalStrength::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional .ril_proto.RILGWSignalStrength gw_signalstrength = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      1, this->gw_signalstrength(), output);
+  }
+  
+  // optional .ril_proto.RILCDMASignalStrength cdma_signalstrength = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      2, this->cdma_signalstrength(), output);
+  }
+  
+  // optional .ril_proto.RILEVDOSignalStrength evdo_signalstrength = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      3, this->evdo_signalstrength(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RspSignalStrength::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional .ril_proto.RILGWSignalStrength gw_signalstrength = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        1, this->gw_signalstrength(), target);
+  }
+  
+  // optional .ril_proto.RILCDMASignalStrength cdma_signalstrength = 2;
+  if (_has_bit(1)) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        2, this->cdma_signalstrength(), target);
+  }
+  
+  // optional .ril_proto.RILEVDOSignalStrength evdo_signalstrength = 3;
+  if (_has_bit(2)) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        3, this->evdo_signalstrength(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RspSignalStrength::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional .ril_proto.RILGWSignalStrength gw_signalstrength = 1;
+    if (has_gw_signalstrength()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+          this->gw_signalstrength());
+    }
+    
+    // optional .ril_proto.RILCDMASignalStrength cdma_signalstrength = 2;
+    if (has_cdma_signalstrength()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+          this->cdma_signalstrength());
+    }
+    
+    // optional .ril_proto.RILEVDOSignalStrength evdo_signalstrength = 3;
+    if (has_evdo_signalstrength()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+          this->evdo_signalstrength());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RspSignalStrength::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RspSignalStrength* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RspSignalStrength*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RspSignalStrength::MergeFrom(const RspSignalStrength& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      mutable_gw_signalstrength()->::ril_proto::RILGWSignalStrength::MergeFrom(from.gw_signalstrength());
+    }
+    if (from._has_bit(1)) {
+      mutable_cdma_signalstrength()->::ril_proto::RILCDMASignalStrength::MergeFrom(from.cdma_signalstrength());
+    }
+    if (from._has_bit(2)) {
+      mutable_evdo_signalstrength()->::ril_proto::RILEVDOSignalStrength::MergeFrom(from.evdo_signalstrength());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RspSignalStrength::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RspSignalStrength::CopyFrom(const RspSignalStrength& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RspSignalStrength::IsInitialized() const {
+  
+  return true;
+}
+
+void RspSignalStrength::Swap(RspSignalStrength* other) {
+  if (other != this) {
+    std::swap(gw_signalstrength_, other->gw_signalstrength_);
+    std::swap(cdma_signalstrength_, other->cdma_signalstrength_);
+    std::swap(evdo_signalstrength_, other->evdo_signalstrength_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RspSignalStrength::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RspSignalStrength_descriptor_;
+  metadata.reflection = RspSignalStrength_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+const ::std::string RspOperator::_default_long_alpha_ons_;
+const ::std::string RspOperator::_default_short_alpha_ons_;
+const ::std::string RspOperator::_default_mcc_mnc_;
+#ifndef _MSC_VER
+const int RspOperator::kLongAlphaOnsFieldNumber;
+const int RspOperator::kShortAlphaOnsFieldNumber;
+const int RspOperator::kMccMncFieldNumber;
+#endif  // !_MSC_VER
+
+RspOperator::RspOperator()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void RspOperator::InitAsDefaultInstance() {
+}
+
+RspOperator::RspOperator(const RspOperator& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void RspOperator::SharedCtor() {
+  _cached_size_ = 0;
+  long_alpha_ons_ = const_cast< ::std::string*>(&_default_long_alpha_ons_);
+  short_alpha_ons_ = const_cast< ::std::string*>(&_default_short_alpha_ons_);
+  mcc_mnc_ = const_cast< ::std::string*>(&_default_mcc_mnc_);
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+RspOperator::~RspOperator() {
+  SharedDtor();
+}
+
+void RspOperator::SharedDtor() {
+  if (long_alpha_ons_ != &_default_long_alpha_ons_) {
+    delete long_alpha_ons_;
+  }
+  if (short_alpha_ons_ != &_default_short_alpha_ons_) {
+    delete short_alpha_ons_;
+  }
+  if (mcc_mnc_ != &_default_mcc_mnc_) {
+    delete mcc_mnc_;
+  }
+  if (this != default_instance_) {
+  }
+}
+
+void RspOperator::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* RspOperator::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return RspOperator_descriptor_;
+}
+
+const RspOperator& RspOperator::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+RspOperator* RspOperator::default_instance_ = NULL;
+
+RspOperator* RspOperator::New() const {
+  return new RspOperator;
+}
+
+void RspOperator::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (_has_bit(0)) {
+      if (long_alpha_ons_ != &_default_long_alpha_ons_) {
+        long_alpha_ons_->clear();
+      }
+    }
+    if (_has_bit(1)) {
+      if (short_alpha_ons_ != &_default_short_alpha_ons_) {
+        short_alpha_ons_->clear();
+      }
+    }
+    if (_has_bit(2)) {
+      if (mcc_mnc_ != &_default_mcc_mnc_) {
+        mcc_mnc_->clear();
+      }
+    }
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool RspOperator::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional string long_alpha_ons = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_long_alpha_ons()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->long_alpha_ons().data(), this->long_alpha_ons().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(18)) goto parse_short_alpha_ons;
+        break;
+      }
+      
+      // optional string short_alpha_ons = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_short_alpha_ons:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_short_alpha_ons()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->short_alpha_ons().data(), this->short_alpha_ons().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(26)) goto parse_mcc_mnc;
+        break;
+      }
+      
+      // optional string mcc_mnc = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_mcc_mnc:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_mcc_mnc()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->mcc_mnc().data(), this->mcc_mnc().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void RspOperator::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional string long_alpha_ons = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->long_alpha_ons().data(), this->long_alpha_ons().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      1, this->long_alpha_ons(), output);
+  }
+  
+  // optional string short_alpha_ons = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->short_alpha_ons().data(), this->short_alpha_ons().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      2, this->short_alpha_ons(), output);
+  }
+  
+  // optional string mcc_mnc = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->mcc_mnc().data(), this->mcc_mnc().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      3, this->mcc_mnc(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* RspOperator::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional string long_alpha_ons = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->long_alpha_ons().data(), this->long_alpha_ons().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        1, this->long_alpha_ons(), target);
+  }
+  
+  // optional string short_alpha_ons = 2;
+  if (_has_bit(1)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->short_alpha_ons().data(), this->short_alpha_ons().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        2, this->short_alpha_ons(), target);
+  }
+  
+  // optional string mcc_mnc = 3;
+  if (_has_bit(2)) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->mcc_mnc().data(), this->mcc_mnc().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        3, this->mcc_mnc(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int RspOperator::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional string long_alpha_ons = 1;
+    if (has_long_alpha_ons()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->long_alpha_ons());
+    }
+    
+    // optional string short_alpha_ons = 2;
+    if (has_short_alpha_ons()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->short_alpha_ons());
+    }
+    
+    // optional string mcc_mnc = 3;
+    if (has_mcc_mnc()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->mcc_mnc());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void RspOperator::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const RspOperator* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const RspOperator*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void RspOperator::MergeFrom(const RspOperator& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_long_alpha_ons(from.long_alpha_ons());
+    }
+    if (from._has_bit(1)) {
+      set_short_alpha_ons(from.short_alpha_ons());
+    }
+    if (from._has_bit(2)) {
+      set_mcc_mnc(from.mcc_mnc());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void RspOperator::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void RspOperator::CopyFrom(const RspOperator& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool RspOperator::IsInitialized() const {
+  
+  return true;
+}
+
+void RspOperator::Swap(RspOperator* other) {
+  if (other != this) {
+    std::swap(long_alpha_ons_, other->long_alpha_ons_);
+    std::swap(short_alpha_ons_, other->short_alpha_ons_);
+    std::swap(mcc_mnc_, other->mcc_mnc_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata RspOperator::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = RspOperator_descriptor_;
+  metadata.reflection = RspOperator_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int ReqSeparateConnection::kIndexFieldNumber;
+#endif  // !_MSC_VER
+
+ReqSeparateConnection::ReqSeparateConnection()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void ReqSeparateConnection::InitAsDefaultInstance() {
+}
+
+ReqSeparateConnection::ReqSeparateConnection(const ReqSeparateConnection& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void ReqSeparateConnection::SharedCtor() {
+  _cached_size_ = 0;
+  index_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+ReqSeparateConnection::~ReqSeparateConnection() {
+  SharedDtor();
+}
+
+void ReqSeparateConnection::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void ReqSeparateConnection::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* ReqSeparateConnection::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return ReqSeparateConnection_descriptor_;
+}
+
+const ReqSeparateConnection& ReqSeparateConnection::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+ReqSeparateConnection* ReqSeparateConnection::default_instance_ = NULL;
+
+ReqSeparateConnection* ReqSeparateConnection::New() const {
+  return new ReqSeparateConnection;
+}
+
+void ReqSeparateConnection::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    index_ = 0;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool ReqSeparateConnection::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required int32 index = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &index_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void ReqSeparateConnection::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required int32 index = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->index(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* ReqSeparateConnection::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required int32 index = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->index(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int ReqSeparateConnection::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required int32 index = 1;
+    if (has_index()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->index());
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void ReqSeparateConnection::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const ReqSeparateConnection* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const ReqSeparateConnection*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void ReqSeparateConnection::MergeFrom(const ReqSeparateConnection& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_index(from.index());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void ReqSeparateConnection::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void ReqSeparateConnection::CopyFrom(const ReqSeparateConnection& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool ReqSeparateConnection::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void ReqSeparateConnection::Swap(ReqSeparateConnection* other) {
+  if (other != this) {
+    std::swap(index_, other->index_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata ReqSeparateConnection::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = ReqSeparateConnection_descriptor_;
+  metadata.reflection = ReqSeparateConnection_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int ReqSetMute::kStateFieldNumber;
+#endif  // !_MSC_VER
+
+ReqSetMute::ReqSetMute()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void ReqSetMute::InitAsDefaultInstance() {
+}
+
+ReqSetMute::ReqSetMute(const ReqSetMute& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void ReqSetMute::SharedCtor() {
+  _cached_size_ = 0;
+  state_ = false;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+ReqSetMute::~ReqSetMute() {
+  SharedDtor();
+}
+
+void ReqSetMute::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void ReqSetMute::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* ReqSetMute::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return ReqSetMute_descriptor_;
+}
+
+const ReqSetMute& ReqSetMute::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+ReqSetMute* ReqSetMute::default_instance_ = NULL;
+
+ReqSetMute* ReqSetMute::New() const {
+  return new ReqSetMute;
+}
+
+void ReqSetMute::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    state_ = false;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool ReqSetMute::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required bool state = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                 input, &state_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void ReqSetMute::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required bool state = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->state(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* ReqSetMute::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required bool state = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->state(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int ReqSetMute::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required bool state = 1;
+    if (has_state()) {
+      total_size += 1 + 1;
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void ReqSetMute::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const ReqSetMute* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const ReqSetMute*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void ReqSetMute::MergeFrom(const ReqSetMute& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_state(from.state());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void ReqSetMute::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void ReqSetMute::CopyFrom(const ReqSetMute& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool ReqSetMute::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void ReqSetMute::Swap(ReqSetMute* other) {
+  if (other != this) {
+    std::swap(state_, other->state_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata ReqSetMute::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = ReqSetMute_descriptor_;
+  metadata.reflection = ReqSetMute_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int ReqScreenState::kStateFieldNumber;
+#endif  // !_MSC_VER
+
+ReqScreenState::ReqScreenState()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void ReqScreenState::InitAsDefaultInstance() {
+}
+
+ReqScreenState::ReqScreenState(const ReqScreenState& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void ReqScreenState::SharedCtor() {
+  _cached_size_ = 0;
+  state_ = false;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+ReqScreenState::~ReqScreenState() {
+  SharedDtor();
+}
+
+void ReqScreenState::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void ReqScreenState::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* ReqScreenState::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return ReqScreenState_descriptor_;
+}
+
+const ReqScreenState& ReqScreenState::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_ril_2eproto();  return *default_instance_;
+}
+
+ReqScreenState* ReqScreenState::default_instance_ = NULL;
+
+ReqScreenState* ReqScreenState::New() const {
+  return new ReqScreenState;
+}
+
+void ReqScreenState::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    state_ = false;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool ReqScreenState::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required bool state = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                 input, &state_)));
+          _set_bit(0);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+      
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void ReqScreenState::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // required bool state = 1;
+  if (_has_bit(0)) {
+    ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->state(), output);
+  }
+  
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* ReqScreenState::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // required bool state = 1;
+  if (_has_bit(0)) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->state(), target);
+  }
+  
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int ReqScreenState::ByteSize() const {
+  int total_size = 0;
+  
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // required bool state = 1;
+    if (has_state()) {
+      total_size += 1 + 1;
+    }
+    
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void ReqScreenState::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const ReqScreenState* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const ReqScreenState*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void ReqScreenState::MergeFrom(const ReqScreenState& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from._has_bit(0)) {
+      set_state(from.state());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void ReqScreenState::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void ReqScreenState::CopyFrom(const ReqScreenState& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool ReqScreenState::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  
+  return true;
+}
+
+void ReqScreenState::Swap(ReqScreenState* other) {
+  if (other != this) {
+    std::swap(state_, other->state_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata ReqScreenState::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = ReqScreenState_descriptor_;
+  metadata.reflection = ReqScreenState_reflection_;
+  return metadata;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace ril_proto
+
+// @@protoc_insertion_point(global_scope)
diff --git a/mock-ril/src/generated/cpp/ril.pb.h b/mock-ril/src/generated/cpp/ril.pb.h
new file mode 100644 (file)
index 0000000..690a4dd
--- /dev/null
@@ -0,0 +1,3800 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: ril.proto
+
+#ifndef PROTOBUF_ril_2eproto__INCLUDED
+#define PROTOBUF_ril_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 2003000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please update
+#error your headers.
+#endif
+#if 2003000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/extension_set.h>
+#include <google/protobuf/generated_message_reflection.h>
+// @@protoc_insertion_point(includes)
+
+namespace ril_proto {
+
+// Internal implementation detail -- do not call these.
+void  protobuf_AddDesc_ril_2eproto();
+void protobuf_AssignDesc_ril_2eproto();
+void protobuf_ShutdownFile_ril_2eproto();
+
+class RilAppStatus;
+class RilCardStatus;
+class RilUusInfo;
+class RilCall;
+class RILGWSignalStrength;
+class RILCDMASignalStrength;
+class RILEVDOSignalStrength;
+class RspStrings;
+class RspIntegers;
+class RspGetSimStatus;
+class ReqEnterSimPin;
+class RspEnterSimPin;
+class RspGetCurrentCalls;
+class ReqDial;
+class ReqHangUp;
+class RspSignalStrength;
+class RspOperator;
+class ReqSeparateConnection;
+class ReqSetMute;
+class ReqScreenState;
+
+enum RadioState {
+  RADIOSTATE_OFF = 0,
+  RADIOSTATE_UNAVAILABLE = 1,
+  RADIOSTATE_SIM_NOT_READY = 2,
+  RADIOSTATE_SIM_LOCKED_OR_ABSENT = 3,
+  RADIOSTATE_SIM_READY = 4,
+  RADIOSTATE_RUIM_NOT_READY = 5,
+  RADIOSTATE_RUIM_READY = 6,
+  RADIOSTATE_RUIM_LOCKED_OR_ABSENT = 7,
+  RADIOSTATE_NV_NOT_READY = 8,
+  RADIOSTATE_NV_READY = 9
+};
+bool RadioState_IsValid(int value);
+const RadioState RadioState_MIN = RADIOSTATE_OFF;
+const RadioState RadioState_MAX = RADIOSTATE_NV_READY;
+const int RadioState_ARRAYSIZE = RadioState_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RadioState_descriptor();
+inline const ::std::string& RadioState_Name(RadioState value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RadioState_descriptor(), value);
+}
+inline bool RadioState_Parse(
+    const ::std::string& name, RadioState* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RadioState>(
+    RadioState_descriptor(), name, value);
+}
+enum RilCardState {
+  CARDSTATE_ABSENT = 0,
+  CARDSTATE_PRESENT = 1,
+  CARDSTATE_ERROR = 2
+};
+bool RilCardState_IsValid(int value);
+const RilCardState RilCardState_MIN = CARDSTATE_ABSENT;
+const RilCardState RilCardState_MAX = CARDSTATE_ERROR;
+const int RilCardState_ARRAYSIZE = RilCardState_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RilCardState_descriptor();
+inline const ::std::string& RilCardState_Name(RilCardState value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RilCardState_descriptor(), value);
+}
+inline bool RilCardState_Parse(
+    const ::std::string& name, RilCardState* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RilCardState>(
+    RilCardState_descriptor(), name, value);
+}
+enum RilPersoSubstate {
+  PERSOSUBSTATE_UNKNOWN = 0,
+  PERSOSUBSTATE_IN_PROGRESS = 1,
+  PERSOSUBSTATE_READY = 2,
+  PERSOSUBSTATE_SIM_NETWORK = 3,
+  PERSOSUBSTATE_SIM_NETWORK_SUBSET = 4,
+  PERSOSUBSTATE_SIM_CORPORATE = 5,
+  PERSOSUBSTATE_SIM_SERVICE_PROVIDER = 6,
+  PERSOSUBSTATE_SIM_SIM = 7,
+  PERSOSUBSTATE_SIM_NETWORK_PUK = 8,
+  PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK = 9,
+  PERSOSUBSTATE_SIM_CORPORATE_PUK = 10,
+  PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK = 11,
+  PERSOSUBSTATE_SIM_SIM_PUK = 12,
+  PERSOSUBSTATE_RUIM_NETWORK1 = 13,
+  PERSOSUBSTATE_RUIM_NETWORK2 = 14,
+  PERSOSUBSTATE_RUIM_HRPD = 15,
+  PERSOSUBSTATE_RUIM_CORPORATE = 16,
+  PERSOSUBSTATE_RUIM_SERVICE_PROVIDER = 17,
+  PERSOSUBSTATE_RUIM_RUIM = 18,
+  PERSOSUBSTATE_RUIM_NETWORK1_PUK = 19,
+  PERSOSUBSTATE_RUIM_NETWORK2_PUK = 20,
+  PERSOSUBSTATE_RUIM_HRPD_PUK = 21,
+  PERSOSUBSTATE_RUIM_CORPORATE_PUK = 22,
+  PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23,
+  PERSOSUBSTATE_RUIM_RUIM_PUK = 24
+};
+bool RilPersoSubstate_IsValid(int value);
+const RilPersoSubstate RilPersoSubstate_MIN = PERSOSUBSTATE_UNKNOWN;
+const RilPersoSubstate RilPersoSubstate_MAX = PERSOSUBSTATE_RUIM_RUIM_PUK;
+const int RilPersoSubstate_ARRAYSIZE = RilPersoSubstate_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RilPersoSubstate_descriptor();
+inline const ::std::string& RilPersoSubstate_Name(RilPersoSubstate value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RilPersoSubstate_descriptor(), value);
+}
+inline bool RilPersoSubstate_Parse(
+    const ::std::string& name, RilPersoSubstate* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RilPersoSubstate>(
+    RilPersoSubstate_descriptor(), name, value);
+}
+enum RilAppState {
+  APPSTATE_UNKNOWN = 0,
+  APPSTATE_DETECTED = 1,
+  APPSTATE_PIN = 2,
+  APPSTATE_PUK = 3,
+  APPSTATE_SUBSCRIPTION_PERSO = 4,
+  APPSTATE_READY = 5
+};
+bool RilAppState_IsValid(int value);
+const RilAppState RilAppState_MIN = APPSTATE_UNKNOWN;
+const RilAppState RilAppState_MAX = APPSTATE_READY;
+const int RilAppState_ARRAYSIZE = RilAppState_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RilAppState_descriptor();
+inline const ::std::string& RilAppState_Name(RilAppState value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RilAppState_descriptor(), value);
+}
+inline bool RilAppState_Parse(
+    const ::std::string& name, RilAppState* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RilAppState>(
+    RilAppState_descriptor(), name, value);
+}
+enum RilPinState {
+  PINSTATE_UNKNOWN = 0,
+  PINSTATE_ENABLED_NOT_VERIFIED = 1,
+  PINSTATE_ENABLED_VERIFIED = 2,
+  PINSTATE_DISABLED = 3,
+  PINSTATE_ENABLED_BLOCKED = 4,
+  PINSTATE_ENABLED_PERM_BLOCKED = 5
+};
+bool RilPinState_IsValid(int value);
+const RilPinState RilPinState_MIN = PINSTATE_UNKNOWN;
+const RilPinState RilPinState_MAX = PINSTATE_ENABLED_PERM_BLOCKED;
+const int RilPinState_ARRAYSIZE = RilPinState_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RilPinState_descriptor();
+inline const ::std::string& RilPinState_Name(RilPinState value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RilPinState_descriptor(), value);
+}
+inline bool RilPinState_Parse(
+    const ::std::string& name, RilPinState* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RilPinState>(
+    RilPinState_descriptor(), name, value);
+}
+enum RilAppType {
+  APPTYPE_UNKNOWN = 0,
+  APPTYPE_SIM = 1,
+  APPTYPE_USIM = 2,
+  APPTYPE_RUIM = 3,
+  APPTYPE_CSIM = 4
+};
+bool RilAppType_IsValid(int value);
+const RilAppType RilAppType_MIN = APPTYPE_UNKNOWN;
+const RilAppType RilAppType_MAX = APPTYPE_CSIM;
+const int RilAppType_ARRAYSIZE = RilAppType_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RilAppType_descriptor();
+inline const ::std::string& RilAppType_Name(RilAppType value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RilAppType_descriptor(), value);
+}
+inline bool RilAppType_Parse(
+    const ::std::string& name, RilAppType* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RilAppType>(
+    RilAppType_descriptor(), name, value);
+}
+enum RilUusType {
+  RILUUSTYPE1_IMPLICIT = 0,
+  RILUUSTYPE1_REQUIRED = 1,
+  RILUUSTYPE1_NOT_REQUIRED = 2,
+  RILUUSTYPE2_REQUIRED = 3,
+  RILUUSTYPE2_NOT_REQUIRED = 4,
+  RILUUSTYPE3_REQUIRED = 5,
+  RILUUSTYPE3_NOT_REQUIRED = 6
+};
+bool RilUusType_IsValid(int value);
+const RilUusType RilUusType_MIN = RILUUSTYPE1_IMPLICIT;
+const RilUusType RilUusType_MAX = RILUUSTYPE3_NOT_REQUIRED;
+const int RilUusType_ARRAYSIZE = RilUusType_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RilUusType_descriptor();
+inline const ::std::string& RilUusType_Name(RilUusType value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RilUusType_descriptor(), value);
+}
+inline bool RilUusType_Parse(
+    const ::std::string& name, RilUusType* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RilUusType>(
+    RilUusType_descriptor(), name, value);
+}
+enum RilUusDcs {
+  RILUUSDCS_USP = 0,
+  RILUUSDCS_OSIHLP = 1,
+  RILUUSDCS_X244 = 2,
+  RILUUSDCS_RMCF = 3,
+  RILUUSDCS_IA5c = 4
+};
+bool RilUusDcs_IsValid(int value);
+const RilUusDcs RilUusDcs_MIN = RILUUSDCS_USP;
+const RilUusDcs RilUusDcs_MAX = RILUUSDCS_IA5c;
+const int RilUusDcs_ARRAYSIZE = RilUusDcs_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RilUusDcs_descriptor();
+inline const ::std::string& RilUusDcs_Name(RilUusDcs value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RilUusDcs_descriptor(), value);
+}
+inline bool RilUusDcs_Parse(
+    const ::std::string& name, RilUusDcs* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RilUusDcs>(
+    RilUusDcs_descriptor(), name, value);
+}
+enum RilCallState {
+  CALLSTATE_ACTIVE = 0,
+  CALLSTATE_HOLDING = 1,
+  CALLSTATE_DIALING = 2,
+  CALLSTATE_ALERTING = 3,
+  CALLSTATE_INCOMING = 4,
+  CALLSTATE_WAITING = 5
+};
+bool RilCallState_IsValid(int value);
+const RilCallState RilCallState_MIN = CALLSTATE_ACTIVE;
+const RilCallState RilCallState_MAX = CALLSTATE_WAITING;
+const int RilCallState_ARRAYSIZE = RilCallState_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* RilCallState_descriptor();
+inline const ::std::string& RilCallState_Name(RilCallState value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    RilCallState_descriptor(), value);
+}
+inline bool RilCallState_Parse(
+    const ::std::string& name, RilCallState* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<RilCallState>(
+    RilCallState_descriptor(), name, value);
+}
+// ===================================================================
+
+class RilAppStatus : public ::google::protobuf::Message {
+ public:
+  RilAppStatus();
+  virtual ~RilAppStatus();
+  
+  RilAppStatus(const RilAppStatus& from);
+  
+  inline RilAppStatus& operator=(const RilAppStatus& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RilAppStatus& default_instance();
+  
+  void Swap(RilAppStatus* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RilAppStatus* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RilAppStatus& from);
+  void MergeFrom(const RilAppStatus& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional .ril_proto.RilAppType app_type = 1;
+  inline bool has_app_type() const;
+  inline void clear_app_type();
+  static const int kAppTypeFieldNumber = 1;
+  inline ril_proto::RilAppType app_type() const;
+  inline void set_app_type(ril_proto::RilAppType value);
+  
+  // optional .ril_proto.RilAppState app_state = 2;
+  inline bool has_app_state() const;
+  inline void clear_app_state();
+  static const int kAppStateFieldNumber = 2;
+  inline ril_proto::RilAppState app_state() const;
+  inline void set_app_state(ril_proto::RilAppState value);
+  
+  // optional .ril_proto.RilPersoSubstate perso_substate = 3;
+  inline bool has_perso_substate() const;
+  inline void clear_perso_substate();
+  static const int kPersoSubstateFieldNumber = 3;
+  inline ril_proto::RilPersoSubstate perso_substate() const;
+  inline void set_perso_substate(ril_proto::RilPersoSubstate value);
+  
+  // optional string aid = 4;
+  inline bool has_aid() const;
+  inline void clear_aid();
+  static const int kAidFieldNumber = 4;
+  inline const ::std::string& aid() const;
+  inline void set_aid(const ::std::string& value);
+  inline void set_aid(const char* value);
+  inline void set_aid(const char* value, size_t size);
+  inline ::std::string* mutable_aid();
+  
+  // optional string app_label = 5;
+  inline bool has_app_label() const;
+  inline void clear_app_label();
+  static const int kAppLabelFieldNumber = 5;
+  inline const ::std::string& app_label() const;
+  inline void set_app_label(const ::std::string& value);
+  inline void set_app_label(const char* value);
+  inline void set_app_label(const char* value, size_t size);
+  inline ::std::string* mutable_app_label();
+  
+  // optional int32 pin1_replaced = 6;
+  inline bool has_pin1_replaced() const;
+  inline void clear_pin1_replaced();
+  static const int kPin1ReplacedFieldNumber = 6;
+  inline ::google::protobuf::int32 pin1_replaced() const;
+  inline void set_pin1_replaced(::google::protobuf::int32 value);
+  
+  // optional .ril_proto.RilPinState pin1 = 7;
+  inline bool has_pin1() const;
+  inline void clear_pin1();
+  static const int kPin1FieldNumber = 7;
+  inline ril_proto::RilPinState pin1() const;
+  inline void set_pin1(ril_proto::RilPinState value);
+  
+  // optional .ril_proto.RilPinState pin2 = 8;
+  inline bool has_pin2() const;
+  inline void clear_pin2();
+  static const int kPin2FieldNumber = 8;
+  inline ril_proto::RilPinState pin2() const;
+  inline void set_pin2(ril_proto::RilPinState value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RilAppStatus)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  int app_type_;
+  int app_state_;
+  int perso_substate_;
+  ::std::string* aid_;
+  static const ::std::string _default_aid_;
+  ::std::string* app_label_;
+  static const ::std::string _default_app_label_;
+  ::google::protobuf::int32 pin1_replaced_;
+  int pin1_;
+  int pin2_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RilAppStatus* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RilCardStatus : public ::google::protobuf::Message {
+ public:
+  RilCardStatus();
+  virtual ~RilCardStatus();
+  
+  RilCardStatus(const RilCardStatus& from);
+  
+  inline RilCardStatus& operator=(const RilCardStatus& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RilCardStatus& default_instance();
+  
+  void Swap(RilCardStatus* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RilCardStatus* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RilCardStatus& from);
+  void MergeFrom(const RilCardStatus& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional .ril_proto.RilCardState card_state = 1;
+  inline bool has_card_state() const;
+  inline void clear_card_state();
+  static const int kCardStateFieldNumber = 1;
+  inline ril_proto::RilCardState card_state() const;
+  inline void set_card_state(ril_proto::RilCardState value);
+  
+  // optional .ril_proto.RilPinState universal_pin_state = 2;
+  inline bool has_universal_pin_state() const;
+  inline void clear_universal_pin_state();
+  static const int kUniversalPinStateFieldNumber = 2;
+  inline ril_proto::RilPinState universal_pin_state() const;
+  inline void set_universal_pin_state(ril_proto::RilPinState value);
+  
+  // optional int32 gsm_umts_subscription_app_index = 3;
+  inline bool has_gsm_umts_subscription_app_index() const;
+  inline void clear_gsm_umts_subscription_app_index();
+  static const int kGsmUmtsSubscriptionAppIndexFieldNumber = 3;
+  inline ::google::protobuf::int32 gsm_umts_subscription_app_index() const;
+  inline void set_gsm_umts_subscription_app_index(::google::protobuf::int32 value);
+  
+  // optional int32 cdma_subscription_app_index = 4;
+  inline bool has_cdma_subscription_app_index() const;
+  inline void clear_cdma_subscription_app_index();
+  static const int kCdmaSubscriptionAppIndexFieldNumber = 4;
+  inline ::google::protobuf::int32 cdma_subscription_app_index() const;
+  inline void set_cdma_subscription_app_index(::google::protobuf::int32 value);
+  
+  // optional int32 num_applications = 5;
+  inline bool has_num_applications() const;
+  inline void clear_num_applications();
+  static const int kNumApplicationsFieldNumber = 5;
+  inline ::google::protobuf::int32 num_applications() const;
+  inline void set_num_applications(::google::protobuf::int32 value);
+  
+  // repeated .ril_proto.RilAppStatus applications = 6;
+  inline int applications_size() const;
+  inline void clear_applications();
+  static const int kApplicationsFieldNumber = 6;
+  inline const ::ril_proto::RilAppStatus& applications(int index) const;
+  inline ::ril_proto::RilAppStatus* mutable_applications(int index);
+  inline ::ril_proto::RilAppStatus* add_applications();
+  inline const ::google::protobuf::RepeatedPtrField< ::ril_proto::RilAppStatus >&
+      applications() const;
+  inline ::google::protobuf::RepeatedPtrField< ::ril_proto::RilAppStatus >*
+      mutable_applications();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RilCardStatus)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  int card_state_;
+  int universal_pin_state_;
+  ::google::protobuf::int32 gsm_umts_subscription_app_index_;
+  ::google::protobuf::int32 cdma_subscription_app_index_;
+  ::google::protobuf::int32 num_applications_;
+  ::google::protobuf::RepeatedPtrField< ::ril_proto::RilAppStatus > applications_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(6 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RilCardStatus* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RilUusInfo : public ::google::protobuf::Message {
+ public:
+  RilUusInfo();
+  virtual ~RilUusInfo();
+  
+  RilUusInfo(const RilUusInfo& from);
+  
+  inline RilUusInfo& operator=(const RilUusInfo& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RilUusInfo& default_instance();
+  
+  void Swap(RilUusInfo* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RilUusInfo* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RilUusInfo& from);
+  void MergeFrom(const RilUusInfo& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional .ril_proto.RilUusType uus_type = 1;
+  inline bool has_uus_type() const;
+  inline void clear_uus_type();
+  static const int kUusTypeFieldNumber = 1;
+  inline ril_proto::RilUusType uus_type() const;
+  inline void set_uus_type(ril_proto::RilUusType value);
+  
+  // optional .ril_proto.RilUusDcs uus_dcs = 2;
+  inline bool has_uus_dcs() const;
+  inline void clear_uus_dcs();
+  static const int kUusDcsFieldNumber = 2;
+  inline ril_proto::RilUusDcs uus_dcs() const;
+  inline void set_uus_dcs(ril_proto::RilUusDcs value);
+  
+  // optional int32 uus_length = 3;
+  inline bool has_uus_length() const;
+  inline void clear_uus_length();
+  static const int kUusLengthFieldNumber = 3;
+  inline ::google::protobuf::int32 uus_length() const;
+  inline void set_uus_length(::google::protobuf::int32 value);
+  
+  // optional string uus_data = 4;
+  inline bool has_uus_data() const;
+  inline void clear_uus_data();
+  static const int kUusDataFieldNumber = 4;
+  inline const ::std::string& uus_data() const;
+  inline void set_uus_data(const ::std::string& value);
+  inline void set_uus_data(const char* value);
+  inline void set_uus_data(const char* value, size_t size);
+  inline ::std::string* mutable_uus_data();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RilUusInfo)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  int uus_type_;
+  int uus_dcs_;
+  ::google::protobuf::int32 uus_length_;
+  ::std::string* uus_data_;
+  static const ::std::string _default_uus_data_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RilUusInfo* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RilCall : public ::google::protobuf::Message {
+ public:
+  RilCall();
+  virtual ~RilCall();
+  
+  RilCall(const RilCall& from);
+  
+  inline RilCall& operator=(const RilCall& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RilCall& default_instance();
+  
+  void Swap(RilCall* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RilCall* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RilCall& from);
+  void MergeFrom(const RilCall& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional .ril_proto.RilCallState state = 1;
+  inline bool has_state() const;
+  inline void clear_state();
+  static const int kStateFieldNumber = 1;
+  inline ril_proto::RilCallState state() const;
+  inline void set_state(ril_proto::RilCallState value);
+  
+  // optional int32 index = 2;
+  inline bool has_index() const;
+  inline void clear_index();
+  static const int kIndexFieldNumber = 2;
+  inline ::google::protobuf::int32 index() const;
+  inline void set_index(::google::protobuf::int32 value);
+  
+  // optional int32 toa = 3;
+  inline bool has_toa() const;
+  inline void clear_toa();
+  static const int kToaFieldNumber = 3;
+  inline ::google::protobuf::int32 toa() const;
+  inline void set_toa(::google::protobuf::int32 value);
+  
+  // optional bool is_mpty = 4;
+  inline bool has_is_mpty() const;
+  inline void clear_is_mpty();
+  static const int kIsMptyFieldNumber = 4;
+  inline bool is_mpty() const;
+  inline void set_is_mpty(bool value);
+  
+  // optional bool is_mt = 5;
+  inline bool has_is_mt() const;
+  inline void clear_is_mt();
+  static const int kIsMtFieldNumber = 5;
+  inline bool is_mt() const;
+  inline void set_is_mt(bool value);
+  
+  // optional int32 als = 6;
+  inline bool has_als() const;
+  inline void clear_als();
+  static const int kAlsFieldNumber = 6;
+  inline ::google::protobuf::int32 als() const;
+  inline void set_als(::google::protobuf::int32 value);
+  
+  // optional bool is_voice = 7;
+  inline bool has_is_voice() const;
+  inline void clear_is_voice();
+  static const int kIsVoiceFieldNumber = 7;
+  inline bool is_voice() const;
+  inline void set_is_voice(bool value);
+  
+  // optional bool is_voice_privacy = 8;
+  inline bool has_is_voice_privacy() const;
+  inline void clear_is_voice_privacy();
+  static const int kIsVoicePrivacyFieldNumber = 8;
+  inline bool is_voice_privacy() const;
+  inline void set_is_voice_privacy(bool value);
+  
+  // optional string number = 9;
+  inline bool has_number() const;
+  inline void clear_number();
+  static const int kNumberFieldNumber = 9;
+  inline const ::std::string& number() const;
+  inline void set_number(const ::std::string& value);
+  inline void set_number(const char* value);
+  inline void set_number(const char* value, size_t size);
+  inline ::std::string* mutable_number();
+  
+  // optional int32 number_presentation = 10;
+  inline bool has_number_presentation() const;
+  inline void clear_number_presentation();
+  static const int kNumberPresentationFieldNumber = 10;
+  inline ::google::protobuf::int32 number_presentation() const;
+  inline void set_number_presentation(::google::protobuf::int32 value);
+  
+  // optional string name = 11;
+  inline bool has_name() const;
+  inline void clear_name();
+  static const int kNameFieldNumber = 11;
+  inline const ::std::string& name() const;
+  inline void set_name(const ::std::string& value);
+  inline void set_name(const char* value);
+  inline void set_name(const char* value, size_t size);
+  inline ::std::string* mutable_name();
+  
+  // optional int32 name_presentation = 12;
+  inline bool has_name_presentation() const;
+  inline void clear_name_presentation();
+  static const int kNamePresentationFieldNumber = 12;
+  inline ::google::protobuf::int32 name_presentation() const;
+  inline void set_name_presentation(::google::protobuf::int32 value);
+  
+  // optional .ril_proto.RilUusInfo uus_info = 13;
+  inline bool has_uus_info() const;
+  inline void clear_uus_info();
+  static const int kUusInfoFieldNumber = 13;
+  inline const ::ril_proto::RilUusInfo& uus_info() const;
+  inline ::ril_proto::RilUusInfo* mutable_uus_info();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RilCall)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  int state_;
+  ::google::protobuf::int32 index_;
+  ::google::protobuf::int32 toa_;
+  bool is_mpty_;
+  bool is_mt_;
+  ::google::protobuf::int32 als_;
+  bool is_voice_;
+  bool is_voice_privacy_;
+  ::std::string* number_;
+  static const ::std::string _default_number_;
+  ::google::protobuf::int32 number_presentation_;
+  ::std::string* name_;
+  static const ::std::string _default_name_;
+  ::google::protobuf::int32 name_presentation_;
+  ::ril_proto::RilUusInfo* uus_info_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(13 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RilCall* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RILGWSignalStrength : public ::google::protobuf::Message {
+ public:
+  RILGWSignalStrength();
+  virtual ~RILGWSignalStrength();
+  
+  RILGWSignalStrength(const RILGWSignalStrength& from);
+  
+  inline RILGWSignalStrength& operator=(const RILGWSignalStrength& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RILGWSignalStrength& default_instance();
+  
+  void Swap(RILGWSignalStrength* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RILGWSignalStrength* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RILGWSignalStrength& from);
+  void MergeFrom(const RILGWSignalStrength& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional int32 signal_strength = 1;
+  inline bool has_signal_strength() const;
+  inline void clear_signal_strength();
+  static const int kSignalStrengthFieldNumber = 1;
+  inline ::google::protobuf::int32 signal_strength() const;
+  inline void set_signal_strength(::google::protobuf::int32 value);
+  
+  // optional int32 bit_error_rate = 2;
+  inline bool has_bit_error_rate() const;
+  inline void clear_bit_error_rate();
+  static const int kBitErrorRateFieldNumber = 2;
+  inline ::google::protobuf::int32 bit_error_rate() const;
+  inline void set_bit_error_rate(::google::protobuf::int32 value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RILGWSignalStrength)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::int32 signal_strength_;
+  ::google::protobuf::int32 bit_error_rate_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RILGWSignalStrength* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RILCDMASignalStrength : public ::google::protobuf::Message {
+ public:
+  RILCDMASignalStrength();
+  virtual ~RILCDMASignalStrength();
+  
+  RILCDMASignalStrength(const RILCDMASignalStrength& from);
+  
+  inline RILCDMASignalStrength& operator=(const RILCDMASignalStrength& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RILCDMASignalStrength& default_instance();
+  
+  void Swap(RILCDMASignalStrength* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RILCDMASignalStrength* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RILCDMASignalStrength& from);
+  void MergeFrom(const RILCDMASignalStrength& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional int32 dbm = 1;
+  inline bool has_dbm() const;
+  inline void clear_dbm();
+  static const int kDbmFieldNumber = 1;
+  inline ::google::protobuf::int32 dbm() const;
+  inline void set_dbm(::google::protobuf::int32 value);
+  
+  // optional int32 ecio = 2;
+  inline bool has_ecio() const;
+  inline void clear_ecio();
+  static const int kEcioFieldNumber = 2;
+  inline ::google::protobuf::int32 ecio() const;
+  inline void set_ecio(::google::protobuf::int32 value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RILCDMASignalStrength)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::int32 dbm_;
+  ::google::protobuf::int32 ecio_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RILCDMASignalStrength* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RILEVDOSignalStrength : public ::google::protobuf::Message {
+ public:
+  RILEVDOSignalStrength();
+  virtual ~RILEVDOSignalStrength();
+  
+  RILEVDOSignalStrength(const RILEVDOSignalStrength& from);
+  
+  inline RILEVDOSignalStrength& operator=(const RILEVDOSignalStrength& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RILEVDOSignalStrength& default_instance();
+  
+  void Swap(RILEVDOSignalStrength* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RILEVDOSignalStrength* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RILEVDOSignalStrength& from);
+  void MergeFrom(const RILEVDOSignalStrength& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional int32 dbm = 1;
+  inline bool has_dbm() const;
+  inline void clear_dbm();
+  static const int kDbmFieldNumber = 1;
+  inline ::google::protobuf::int32 dbm() const;
+  inline void set_dbm(::google::protobuf::int32 value);
+  
+  // optional int32 ecio = 2;
+  inline bool has_ecio() const;
+  inline void clear_ecio();
+  static const int kEcioFieldNumber = 2;
+  inline ::google::protobuf::int32 ecio() const;
+  inline void set_ecio(::google::protobuf::int32 value);
+  
+  // optional int32 signal_noise_ratio = 3;
+  inline bool has_signal_noise_ratio() const;
+  inline void clear_signal_noise_ratio();
+  static const int kSignalNoiseRatioFieldNumber = 3;
+  inline ::google::protobuf::int32 signal_noise_ratio() const;
+  inline void set_signal_noise_ratio(::google::protobuf::int32 value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RILEVDOSignalStrength)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::int32 dbm_;
+  ::google::protobuf::int32 ecio_;
+  ::google::protobuf::int32 signal_noise_ratio_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RILEVDOSignalStrength* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RspStrings : public ::google::protobuf::Message {
+ public:
+  RspStrings();
+  virtual ~RspStrings();
+  
+  RspStrings(const RspStrings& from);
+  
+  inline RspStrings& operator=(const RspStrings& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RspStrings& default_instance();
+  
+  void Swap(RspStrings* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RspStrings* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RspStrings& from);
+  void MergeFrom(const RspStrings& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // repeated string strings = 1;
+  inline int strings_size() const;
+  inline void clear_strings();
+  static const int kStringsFieldNumber = 1;
+  inline const ::std::string& strings(int index) const;
+  inline ::std::string* mutable_strings(int index);
+  inline void set_strings(int index, const ::std::string& value);
+  inline void set_strings(int index, const char* value);
+  inline void set_strings(int index, const char* value, size_t size);
+  inline ::std::string* add_strings();
+  inline void add_strings(const ::std::string& value);
+  inline void add_strings(const char* value);
+  inline void add_strings(const char* value, size_t size);
+  inline const ::google::protobuf::RepeatedPtrField< ::std::string>& strings() const;
+  inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_strings();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RspStrings)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::RepeatedPtrField< ::std::string> strings_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RspStrings* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RspIntegers : public ::google::protobuf::Message {
+ public:
+  RspIntegers();
+  virtual ~RspIntegers();
+  
+  RspIntegers(const RspIntegers& from);
+  
+  inline RspIntegers& operator=(const RspIntegers& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RspIntegers& default_instance();
+  
+  void Swap(RspIntegers* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RspIntegers* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RspIntegers& from);
+  void MergeFrom(const RspIntegers& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // repeated int32 integers = 1;
+  inline int integers_size() const;
+  inline void clear_integers();
+  static const int kIntegersFieldNumber = 1;
+  inline ::google::protobuf::int32 integers(int index) const;
+  inline void set_integers(int index, ::google::protobuf::int32 value);
+  inline void add_integers(::google::protobuf::int32 value);
+  inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+      integers() const;
+  inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+      mutable_integers();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RspIntegers)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::RepeatedField< ::google::protobuf::int32 > integers_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RspIntegers* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RspGetSimStatus : public ::google::protobuf::Message {
+ public:
+  RspGetSimStatus();
+  virtual ~RspGetSimStatus();
+  
+  RspGetSimStatus(const RspGetSimStatus& from);
+  
+  inline RspGetSimStatus& operator=(const RspGetSimStatus& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RspGetSimStatus& default_instance();
+  
+  void Swap(RspGetSimStatus* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RspGetSimStatus* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RspGetSimStatus& from);
+  void MergeFrom(const RspGetSimStatus& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required .ril_proto.RilCardStatus card_status = 1;
+  inline bool has_card_status() const;
+  inline void clear_card_status();
+  static const int kCardStatusFieldNumber = 1;
+  inline const ::ril_proto::RilCardStatus& card_status() const;
+  inline ::ril_proto::RilCardStatus* mutable_card_status();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RspGetSimStatus)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::ril_proto::RilCardStatus* card_status_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RspGetSimStatus* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class ReqEnterSimPin : public ::google::protobuf::Message {
+ public:
+  ReqEnterSimPin();
+  virtual ~ReqEnterSimPin();
+  
+  ReqEnterSimPin(const ReqEnterSimPin& from);
+  
+  inline ReqEnterSimPin& operator=(const ReqEnterSimPin& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ReqEnterSimPin& default_instance();
+  
+  void Swap(ReqEnterSimPin* other);
+  
+  // implements Message ----------------------------------------------
+  
+  ReqEnterSimPin* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ReqEnterSimPin& from);
+  void MergeFrom(const ReqEnterSimPin& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required string pin = 1;
+  inline bool has_pin() const;
+  inline void clear_pin();
+  static const int kPinFieldNumber = 1;
+  inline const ::std::string& pin() const;
+  inline void set_pin(const ::std::string& value);
+  inline void set_pin(const char* value);
+  inline void set_pin(const char* value, size_t size);
+  inline ::std::string* mutable_pin();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.ReqEnterSimPin)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::std::string* pin_;
+  static const ::std::string _default_pin_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static ReqEnterSimPin* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RspEnterSimPin : public ::google::protobuf::Message {
+ public:
+  RspEnterSimPin();
+  virtual ~RspEnterSimPin();
+  
+  RspEnterSimPin(const RspEnterSimPin& from);
+  
+  inline RspEnterSimPin& operator=(const RspEnterSimPin& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RspEnterSimPin& default_instance();
+  
+  void Swap(RspEnterSimPin* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RspEnterSimPin* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RspEnterSimPin& from);
+  void MergeFrom(const RspEnterSimPin& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required int32 retries_remaining = 1;
+  inline bool has_retries_remaining() const;
+  inline void clear_retries_remaining();
+  static const int kRetriesRemainingFieldNumber = 1;
+  inline ::google::protobuf::int32 retries_remaining() const;
+  inline void set_retries_remaining(::google::protobuf::int32 value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RspEnterSimPin)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::int32 retries_remaining_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RspEnterSimPin* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RspGetCurrentCalls : public ::google::protobuf::Message {
+ public:
+  RspGetCurrentCalls();
+  virtual ~RspGetCurrentCalls();
+  
+  RspGetCurrentCalls(const RspGetCurrentCalls& from);
+  
+  inline RspGetCurrentCalls& operator=(const RspGetCurrentCalls& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RspGetCurrentCalls& default_instance();
+  
+  void Swap(RspGetCurrentCalls* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RspGetCurrentCalls* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RspGetCurrentCalls& from);
+  void MergeFrom(const RspGetCurrentCalls& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // repeated .ril_proto.RilCall calls = 1;
+  inline int calls_size() const;
+  inline void clear_calls();
+  static const int kCallsFieldNumber = 1;
+  inline const ::ril_proto::RilCall& calls(int index) const;
+  inline ::ril_proto::RilCall* mutable_calls(int index);
+  inline ::ril_proto::RilCall* add_calls();
+  inline const ::google::protobuf::RepeatedPtrField< ::ril_proto::RilCall >&
+      calls() const;
+  inline ::google::protobuf::RepeatedPtrField< ::ril_proto::RilCall >*
+      mutable_calls();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RspGetCurrentCalls)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::RepeatedPtrField< ::ril_proto::RilCall > calls_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RspGetCurrentCalls* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class ReqDial : public ::google::protobuf::Message {
+ public:
+  ReqDial();
+  virtual ~ReqDial();
+  
+  ReqDial(const ReqDial& from);
+  
+  inline ReqDial& operator=(const ReqDial& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ReqDial& default_instance();
+  
+  void Swap(ReqDial* other);
+  
+  // implements Message ----------------------------------------------
+  
+  ReqDial* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ReqDial& from);
+  void MergeFrom(const ReqDial& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional string address = 1;
+  inline bool has_address() const;
+  inline void clear_address();
+  static const int kAddressFieldNumber = 1;
+  inline const ::std::string& address() const;
+  inline void set_address(const ::std::string& value);
+  inline void set_address(const char* value);
+  inline void set_address(const char* value, size_t size);
+  inline ::std::string* mutable_address();
+  
+  // optional int32 clir = 2;
+  inline bool has_clir() const;
+  inline void clear_clir();
+  static const int kClirFieldNumber = 2;
+  inline ::google::protobuf::int32 clir() const;
+  inline void set_clir(::google::protobuf::int32 value);
+  
+  // optional .ril_proto.RilUusInfo uus_info = 3;
+  inline bool has_uus_info() const;
+  inline void clear_uus_info();
+  static const int kUusInfoFieldNumber = 3;
+  inline const ::ril_proto::RilUusInfo& uus_info() const;
+  inline ::ril_proto::RilUusInfo* mutable_uus_info();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.ReqDial)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::std::string* address_;
+  static const ::std::string _default_address_;
+  ::google::protobuf::int32 clir_;
+  ::ril_proto::RilUusInfo* uus_info_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static ReqDial* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class ReqHangUp : public ::google::protobuf::Message {
+ public:
+  ReqHangUp();
+  virtual ~ReqHangUp();
+  
+  ReqHangUp(const ReqHangUp& from);
+  
+  inline ReqHangUp& operator=(const ReqHangUp& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ReqHangUp& default_instance();
+  
+  void Swap(ReqHangUp* other);
+  
+  // implements Message ----------------------------------------------
+  
+  ReqHangUp* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ReqHangUp& from);
+  void MergeFrom(const ReqHangUp& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required int32 connection_index = 1;
+  inline bool has_connection_index() const;
+  inline void clear_connection_index();
+  static const int kConnectionIndexFieldNumber = 1;
+  inline ::google::protobuf::int32 connection_index() const;
+  inline void set_connection_index(::google::protobuf::int32 value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.ReqHangUp)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::int32 connection_index_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static ReqHangUp* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RspSignalStrength : public ::google::protobuf::Message {
+ public:
+  RspSignalStrength();
+  virtual ~RspSignalStrength();
+  
+  RspSignalStrength(const RspSignalStrength& from);
+  
+  inline RspSignalStrength& operator=(const RspSignalStrength& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RspSignalStrength& default_instance();
+  
+  void Swap(RspSignalStrength* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RspSignalStrength* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RspSignalStrength& from);
+  void MergeFrom(const RspSignalStrength& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional .ril_proto.RILGWSignalStrength gw_signalstrength = 1;
+  inline bool has_gw_signalstrength() const;
+  inline void clear_gw_signalstrength();
+  static const int kGwSignalstrengthFieldNumber = 1;
+  inline const ::ril_proto::RILGWSignalStrength& gw_signalstrength() const;
+  inline ::ril_proto::RILGWSignalStrength* mutable_gw_signalstrength();
+  
+  // optional .ril_proto.RILCDMASignalStrength cdma_signalstrength = 2;
+  inline bool has_cdma_signalstrength() const;
+  inline void clear_cdma_signalstrength();
+  static const int kCdmaSignalstrengthFieldNumber = 2;
+  inline const ::ril_proto::RILCDMASignalStrength& cdma_signalstrength() const;
+  inline ::ril_proto::RILCDMASignalStrength* mutable_cdma_signalstrength();
+  
+  // optional .ril_proto.RILEVDOSignalStrength evdo_signalstrength = 3;
+  inline bool has_evdo_signalstrength() const;
+  inline void clear_evdo_signalstrength();
+  static const int kEvdoSignalstrengthFieldNumber = 3;
+  inline const ::ril_proto::RILEVDOSignalStrength& evdo_signalstrength() const;
+  inline ::ril_proto::RILEVDOSignalStrength* mutable_evdo_signalstrength();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RspSignalStrength)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::ril_proto::RILGWSignalStrength* gw_signalstrength_;
+  ::ril_proto::RILCDMASignalStrength* cdma_signalstrength_;
+  ::ril_proto::RILEVDOSignalStrength* evdo_signalstrength_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RspSignalStrength* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class RspOperator : public ::google::protobuf::Message {
+ public:
+  RspOperator();
+  virtual ~RspOperator();
+  
+  RspOperator(const RspOperator& from);
+  
+  inline RspOperator& operator=(const RspOperator& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const RspOperator& default_instance();
+  
+  void Swap(RspOperator* other);
+  
+  // implements Message ----------------------------------------------
+  
+  RspOperator* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const RspOperator& from);
+  void MergeFrom(const RspOperator& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // optional string long_alpha_ons = 1;
+  inline bool has_long_alpha_ons() const;
+  inline void clear_long_alpha_ons();
+  static const int kLongAlphaOnsFieldNumber = 1;
+  inline const ::std::string& long_alpha_ons() const;
+  inline void set_long_alpha_ons(const ::std::string& value);
+  inline void set_long_alpha_ons(const char* value);
+  inline void set_long_alpha_ons(const char* value, size_t size);
+  inline ::std::string* mutable_long_alpha_ons();
+  
+  // optional string short_alpha_ons = 2;
+  inline bool has_short_alpha_ons() const;
+  inline void clear_short_alpha_ons();
+  static const int kShortAlphaOnsFieldNumber = 2;
+  inline const ::std::string& short_alpha_ons() const;
+  inline void set_short_alpha_ons(const ::std::string& value);
+  inline void set_short_alpha_ons(const char* value);
+  inline void set_short_alpha_ons(const char* value, size_t size);
+  inline ::std::string* mutable_short_alpha_ons();
+  
+  // optional string mcc_mnc = 3;
+  inline bool has_mcc_mnc() const;
+  inline void clear_mcc_mnc();
+  static const int kMccMncFieldNumber = 3;
+  inline const ::std::string& mcc_mnc() const;
+  inline void set_mcc_mnc(const ::std::string& value);
+  inline void set_mcc_mnc(const char* value);
+  inline void set_mcc_mnc(const char* value, size_t size);
+  inline ::std::string* mutable_mcc_mnc();
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.RspOperator)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::std::string* long_alpha_ons_;
+  static const ::std::string _default_long_alpha_ons_;
+  ::std::string* short_alpha_ons_;
+  static const ::std::string _default_short_alpha_ons_;
+  ::std::string* mcc_mnc_;
+  static const ::std::string _default_mcc_mnc_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static RspOperator* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class ReqSeparateConnection : public ::google::protobuf::Message {
+ public:
+  ReqSeparateConnection();
+  virtual ~ReqSeparateConnection();
+  
+  ReqSeparateConnection(const ReqSeparateConnection& from);
+  
+  inline ReqSeparateConnection& operator=(const ReqSeparateConnection& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ReqSeparateConnection& default_instance();
+  
+  void Swap(ReqSeparateConnection* other);
+  
+  // implements Message ----------------------------------------------
+  
+  ReqSeparateConnection* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ReqSeparateConnection& from);
+  void MergeFrom(const ReqSeparateConnection& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required int32 index = 1;
+  inline bool has_index() const;
+  inline void clear_index();
+  static const int kIndexFieldNumber = 1;
+  inline ::google::protobuf::int32 index() const;
+  inline void set_index(::google::protobuf::int32 value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.ReqSeparateConnection)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  ::google::protobuf::int32 index_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static ReqSeparateConnection* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class ReqSetMute : public ::google::protobuf::Message {
+ public:
+  ReqSetMute();
+  virtual ~ReqSetMute();
+  
+  ReqSetMute(const ReqSetMute& from);
+  
+  inline ReqSetMute& operator=(const ReqSetMute& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ReqSetMute& default_instance();
+  
+  void Swap(ReqSetMute* other);
+  
+  // implements Message ----------------------------------------------
+  
+  ReqSetMute* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ReqSetMute& from);
+  void MergeFrom(const ReqSetMute& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required bool state = 1;
+  inline bool has_state() const;
+  inline void clear_state();
+  static const int kStateFieldNumber = 1;
+  inline bool state() const;
+  inline void set_state(bool value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.ReqSetMute)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  bool state_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static ReqSetMute* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class ReqScreenState : public ::google::protobuf::Message {
+ public:
+  ReqScreenState();
+  virtual ~ReqScreenState();
+  
+  ReqScreenState(const ReqScreenState& from);
+  
+  inline ReqScreenState& operator=(const ReqScreenState& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+  
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+  
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ReqScreenState& default_instance();
+  
+  void Swap(ReqScreenState* other);
+  
+  // implements Message ----------------------------------------------
+  
+  ReqScreenState* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ReqScreenState& from);
+  void MergeFrom(const ReqScreenState& from);
+  void Clear();
+  bool IsInitialized() const;
+  
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+  
+  ::google::protobuf::Metadata GetMetadata() const;
+  
+  // nested types ----------------------------------------------------
+  
+  // accessors -------------------------------------------------------
+  
+  // required bool state = 1;
+  inline bool has_state() const;
+  inline void clear_state();
+  static const int kStateFieldNumber = 1;
+  inline bool state() const;
+  inline void set_state(bool value);
+  
+  // @@protoc_insertion_point(class_scope:ril_proto.ReqScreenState)
+ private:
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+  mutable int _cached_size_;
+  
+  bool state_;
+  friend void  protobuf_AddDesc_ril_2eproto();
+  friend void protobuf_AssignDesc_ril_2eproto();
+  friend void protobuf_ShutdownFile_ril_2eproto();
+  
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  
+  // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
+  inline bool _has_bit(int index) const {
+    return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
+  }
+  inline void _set_bit(int index) {
+    _has_bits_[index / 32] |= (1u << (index % 32));
+  }
+  inline void _clear_bit(int index) {
+    _has_bits_[index / 32] &= ~(1u << (index % 32));
+  }
+  
+  void InitAsDefaultInstance();
+  static ReqScreenState* default_instance_;
+};
+// ===================================================================
+
+
+// ===================================================================
+
+// RilAppStatus
+
+// optional .ril_proto.RilAppType app_type = 1;
+inline bool RilAppStatus::has_app_type() const {
+  return _has_bit(0);
+}
+inline void RilAppStatus::clear_app_type() {
+  app_type_ = 0;
+  _clear_bit(0);
+}
+inline ril_proto::RilAppType RilAppStatus::app_type() const {
+  return static_cast< ril_proto::RilAppType >(app_type_);
+}
+inline void RilAppStatus::set_app_type(ril_proto::RilAppType value) {
+  GOOGLE_DCHECK(ril_proto::RilAppType_IsValid(value));
+  _set_bit(0);
+  app_type_ = value;
+}
+
+// optional .ril_proto.RilAppState app_state = 2;
+inline bool RilAppStatus::has_app_state() const {
+  return _has_bit(1);
+}
+inline void RilAppStatus::clear_app_state() {
+  app_state_ = 0;
+  _clear_bit(1);
+}
+inline ril_proto::RilAppState RilAppStatus::app_state() const {
+  return static_cast< ril_proto::RilAppState >(app_state_);
+}
+inline void RilAppStatus::set_app_state(ril_proto::RilAppState value) {
+  GOOGLE_DCHECK(ril_proto::RilAppState_IsValid(value));
+  _set_bit(1);
+  app_state_ = value;
+}
+
+// optional .ril_proto.RilPersoSubstate perso_substate = 3;
+inline bool RilAppStatus::has_perso_substate() const {
+  return _has_bit(2);
+}
+inline void RilAppStatus::clear_perso_substate() {
+  perso_substate_ = 0;
+  _clear_bit(2);
+}
+inline ril_proto::RilPersoSubstate RilAppStatus::perso_substate() const {
+  return static_cast< ril_proto::RilPersoSubstate >(perso_substate_);
+}
+inline void RilAppStatus::set_perso_substate(ril_proto::RilPersoSubstate value) {
+  GOOGLE_DCHECK(ril_proto::RilPersoSubstate_IsValid(value));
+  _set_bit(2);
+  perso_substate_ = value;
+}
+
+// optional string aid = 4;
+inline bool RilAppStatus::has_aid() const {
+  return _has_bit(3);
+}
+inline void RilAppStatus::clear_aid() {
+  if (aid_ != &_default_aid_) {
+    aid_->clear();
+  }
+  _clear_bit(3);
+}
+inline const ::std::string& RilAppStatus::aid() const {
+  return *aid_;
+}
+inline void RilAppStatus::set_aid(const ::std::string& value) {
+  _set_bit(3);
+  if (aid_ == &_default_aid_) {
+    aid_ = new ::std::string;
+  }
+  aid_->assign(value);
+}
+inline void RilAppStatus::set_aid(const char* value) {
+  _set_bit(3);
+  if (aid_ == &_default_aid_) {
+    aid_ = new ::std::string;
+  }
+  aid_->assign(value);
+}
+inline void RilAppStatus::set_aid(const char* value, size_t size) {
+  _set_bit(3);
+  if (aid_ == &_default_aid_) {
+    aid_ = new ::std::string;
+  }
+  aid_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RilAppStatus::mutable_aid() {
+  _set_bit(3);
+  if (aid_ == &_default_aid_) {
+    aid_ = new ::std::string;
+  }
+  return aid_;
+}
+
+// optional string app_label = 5;
+inline bool RilAppStatus::has_app_label() const {
+  return _has_bit(4);
+}
+inline void RilAppStatus::clear_app_label() {
+  if (app_label_ != &_default_app_label_) {
+    app_label_->clear();
+  }
+  _clear_bit(4);
+}
+inline const ::std::string& RilAppStatus::app_label() const {
+  return *app_label_;
+}
+inline void RilAppStatus::set_app_label(const ::std::string& value) {
+  _set_bit(4);
+  if (app_label_ == &_default_app_label_) {
+    app_label_ = new ::std::string;
+  }
+  app_label_->assign(value);
+}
+inline void RilAppStatus::set_app_label(const char* value) {
+  _set_bit(4);
+  if (app_label_ == &_default_app_label_) {
+    app_label_ = new ::std::string;
+  }
+  app_label_->assign(value);
+}
+inline void RilAppStatus::set_app_label(const char* value, size_t size) {
+  _set_bit(4);
+  if (app_label_ == &_default_app_label_) {
+    app_label_ = new ::std::string;
+  }
+  app_label_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RilAppStatus::mutable_app_label() {
+  _set_bit(4);
+  if (app_label_ == &_default_app_label_) {
+    app_label_ = new ::std::string;
+  }
+  return app_label_;
+}
+
+// optional int32 pin1_replaced = 6;
+inline bool RilAppStatus::has_pin1_replaced() const {
+  return _has_bit(5);
+}
+inline void RilAppStatus::clear_pin1_replaced() {
+  pin1_replaced_ = 0;
+  _clear_bit(5);
+}
+inline ::google::protobuf::int32 RilAppStatus::pin1_replaced() const {
+  return pin1_replaced_;
+}
+inline void RilAppStatus::set_pin1_replaced(::google::protobuf::int32 value) {
+  _set_bit(5);
+  pin1_replaced_ = value;
+}
+
+// optional .ril_proto.RilPinState pin1 = 7;
+inline bool RilAppStatus::has_pin1() const {
+  return _has_bit(6);
+}
+inline void RilAppStatus::clear_pin1() {
+  pin1_ = 0;
+  _clear_bit(6);
+}
+inline ril_proto::RilPinState RilAppStatus::pin1() const {
+  return static_cast< ril_proto::RilPinState >(pin1_);
+}
+inline void RilAppStatus::set_pin1(ril_proto::RilPinState value) {
+  GOOGLE_DCHECK(ril_proto::RilPinState_IsValid(value));
+  _set_bit(6);
+  pin1_ = value;
+}
+
+// optional .ril_proto.RilPinState pin2 = 8;
+inline bool RilAppStatus::has_pin2() const {
+  return _has_bit(7);
+}
+inline void RilAppStatus::clear_pin2() {
+  pin2_ = 0;
+  _clear_bit(7);
+}
+inline ril_proto::RilPinState RilAppStatus::pin2() const {
+  return static_cast< ril_proto::RilPinState >(pin2_);
+}
+inline void RilAppStatus::set_pin2(ril_proto::RilPinState value) {
+  GOOGLE_DCHECK(ril_proto::RilPinState_IsValid(value));
+  _set_bit(7);
+  pin2_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// RilCardStatus
+
+// optional .ril_proto.RilCardState card_state = 1;
+inline bool RilCardStatus::has_card_state() const {
+  return _has_bit(0);
+}
+inline void RilCardStatus::clear_card_state() {
+  card_state_ = 0;
+  _clear_bit(0);
+}
+inline ril_proto::RilCardState RilCardStatus::card_state() const {
+  return static_cast< ril_proto::RilCardState >(card_state_);
+}
+inline void RilCardStatus::set_card_state(ril_proto::RilCardState value) {
+  GOOGLE_DCHECK(ril_proto::RilCardState_IsValid(value));
+  _set_bit(0);
+  card_state_ = value;
+}
+
+// optional .ril_proto.RilPinState universal_pin_state = 2;
+inline bool RilCardStatus::has_universal_pin_state() const {
+  return _has_bit(1);
+}
+inline void RilCardStatus::clear_universal_pin_state() {
+  universal_pin_state_ = 0;
+  _clear_bit(1);
+}
+inline ril_proto::RilPinState RilCardStatus::universal_pin_state() const {
+  return static_cast< ril_proto::RilPinState >(universal_pin_state_);
+}
+inline void RilCardStatus::set_universal_pin_state(ril_proto::RilPinState value) {
+  GOOGLE_DCHECK(ril_proto::RilPinState_IsValid(value));
+  _set_bit(1);
+  universal_pin_state_ = value;
+}
+
+// optional int32 gsm_umts_subscription_app_index = 3;
+inline bool RilCardStatus::has_gsm_umts_subscription_app_index() const {
+  return _has_bit(2);
+}
+inline void RilCardStatus::clear_gsm_umts_subscription_app_index() {
+  gsm_umts_subscription_app_index_ = 0;
+  _clear_bit(2);
+}
+inline ::google::protobuf::int32 RilCardStatus::gsm_umts_subscription_app_index() const {
+  return gsm_umts_subscription_app_index_;
+}
+inline void RilCardStatus::set_gsm_umts_subscription_app_index(::google::protobuf::int32 value) {
+  _set_bit(2);
+  gsm_umts_subscription_app_index_ = value;
+}
+
+// optional int32 cdma_subscription_app_index = 4;
+inline bool RilCardStatus::has_cdma_subscription_app_index() const {
+  return _has_bit(3);
+}
+inline void RilCardStatus::clear_cdma_subscription_app_index() {
+  cdma_subscription_app_index_ = 0;
+  _clear_bit(3);
+}
+inline ::google::protobuf::int32 RilCardStatus::cdma_subscription_app_index() const {
+  return cdma_subscription_app_index_;
+}
+inline void RilCardStatus::set_cdma_subscription_app_index(::google::protobuf::int32 value) {
+  _set_bit(3);
+  cdma_subscription_app_index_ = value;
+}
+
+// optional int32 num_applications = 5;
+inline bool RilCardStatus::has_num_applications() const {
+  return _has_bit(4);
+}
+inline void RilCardStatus::clear_num_applications() {
+  num_applications_ = 0;
+  _clear_bit(4);
+}
+inline ::google::protobuf::int32 RilCardStatus::num_applications() const {
+  return num_applications_;
+}
+inline void RilCardStatus::set_num_applications(::google::protobuf::int32 value) {
+  _set_bit(4);
+  num_applications_ = value;
+}
+
+// repeated .ril_proto.RilAppStatus applications = 6;
+inline int RilCardStatus::applications_size() const {
+  return applications_.size();
+}
+inline void RilCardStatus::clear_applications() {
+  applications_.Clear();
+}
+inline const ::ril_proto::RilAppStatus& RilCardStatus::applications(int index) const {
+  return applications_.Get(index);
+}
+inline ::ril_proto::RilAppStatus* RilCardStatus::mutable_applications(int index) {
+  return applications_.Mutable(index);
+}
+inline ::ril_proto::RilAppStatus* RilCardStatus::add_applications() {
+  return applications_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::ril_proto::RilAppStatus >&
+RilCardStatus::applications() const {
+  return applications_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::ril_proto::RilAppStatus >*
+RilCardStatus::mutable_applications() {
+  return &applications_;
+}
+
+// -------------------------------------------------------------------
+
+// RilUusInfo
+
+// optional .ril_proto.RilUusType uus_type = 1;
+inline bool RilUusInfo::has_uus_type() const {
+  return _has_bit(0);
+}
+inline void RilUusInfo::clear_uus_type() {
+  uus_type_ = 0;
+  _clear_bit(0);
+}
+inline ril_proto::RilUusType RilUusInfo::uus_type() const {
+  return static_cast< ril_proto::RilUusType >(uus_type_);
+}
+inline void RilUusInfo::set_uus_type(ril_proto::RilUusType value) {
+  GOOGLE_DCHECK(ril_proto::RilUusType_IsValid(value));
+  _set_bit(0);
+  uus_type_ = value;
+}
+
+// optional .ril_proto.RilUusDcs uus_dcs = 2;
+inline bool RilUusInfo::has_uus_dcs() const {
+  return _has_bit(1);
+}
+inline void RilUusInfo::clear_uus_dcs() {
+  uus_dcs_ = 0;
+  _clear_bit(1);
+}
+inline ril_proto::RilUusDcs RilUusInfo::uus_dcs() const {
+  return static_cast< ril_proto::RilUusDcs >(uus_dcs_);
+}
+inline void RilUusInfo::set_uus_dcs(ril_proto::RilUusDcs value) {
+  GOOGLE_DCHECK(ril_proto::RilUusDcs_IsValid(value));
+  _set_bit(1);
+  uus_dcs_ = value;
+}
+
+// optional int32 uus_length = 3;
+inline bool RilUusInfo::has_uus_length() const {
+  return _has_bit(2);
+}
+inline void RilUusInfo::clear_uus_length() {
+  uus_length_ = 0;
+  _clear_bit(2);
+}
+inline ::google::protobuf::int32 RilUusInfo::uus_length() const {
+  return uus_length_;
+}
+inline void RilUusInfo::set_uus_length(::google::protobuf::int32 value) {
+  _set_bit(2);
+  uus_length_ = value;
+}
+
+// optional string uus_data = 4;
+inline bool RilUusInfo::has_uus_data() const {
+  return _has_bit(3);
+}
+inline void RilUusInfo::clear_uus_data() {
+  if (uus_data_ != &_default_uus_data_) {
+    uus_data_->clear();
+  }
+  _clear_bit(3);
+}
+inline const ::std::string& RilUusInfo::uus_data() const {
+  return *uus_data_;
+}
+inline void RilUusInfo::set_uus_data(const ::std::string& value) {
+  _set_bit(3);
+  if (uus_data_ == &_default_uus_data_) {
+    uus_data_ = new ::std::string;
+  }
+  uus_data_->assign(value);
+}
+inline void RilUusInfo::set_uus_data(const char* value) {
+  _set_bit(3);
+  if (uus_data_ == &_default_uus_data_) {
+    uus_data_ = new ::std::string;
+  }
+  uus_data_->assign(value);
+}
+inline void RilUusInfo::set_uus_data(const char* value, size_t size) {
+  _set_bit(3);
+  if (uus_data_ == &_default_uus_data_) {
+    uus_data_ = new ::std::string;
+  }
+  uus_data_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RilUusInfo::mutable_uus_data() {
+  _set_bit(3);
+  if (uus_data_ == &_default_uus_data_) {
+    uus_data_ = new ::std::string;
+  }
+  return uus_data_;
+}
+
+// -------------------------------------------------------------------
+
+// RilCall
+
+// optional .ril_proto.RilCallState state = 1;
+inline bool RilCall::has_state() const {
+  return _has_bit(0);
+}
+inline void RilCall::clear_state() {
+  state_ = 0;
+  _clear_bit(0);
+}
+inline ril_proto::RilCallState RilCall::state() const {
+  return static_cast< ril_proto::RilCallState >(state_);
+}
+inline void RilCall::set_state(ril_proto::RilCallState value) {
+  GOOGLE_DCHECK(ril_proto::RilCallState_IsValid(value));
+  _set_bit(0);
+  state_ = value;
+}
+
+// optional int32 index = 2;
+inline bool RilCall::has_index() const {
+  return _has_bit(1);
+}
+inline void RilCall::clear_index() {
+  index_ = 0;
+  _clear_bit(1);
+}
+inline ::google::protobuf::int32 RilCall::index() const {
+  return index_;
+}
+inline void RilCall::set_index(::google::protobuf::int32 value) {
+  _set_bit(1);
+  index_ = value;
+}
+
+// optional int32 toa = 3;
+inline bool RilCall::has_toa() const {
+  return _has_bit(2);
+}
+inline void RilCall::clear_toa() {
+  toa_ = 0;
+  _clear_bit(2);
+}
+inline ::google::protobuf::int32 RilCall::toa() const {
+  return toa_;
+}
+inline void RilCall::set_toa(::google::protobuf::int32 value) {
+  _set_bit(2);
+  toa_ = value;
+}
+
+// optional bool is_mpty = 4;
+inline bool RilCall::has_is_mpty() const {
+  return _has_bit(3);
+}
+inline void RilCall::clear_is_mpty() {
+  is_mpty_ = false;
+  _clear_bit(3);
+}
+inline bool RilCall::is_mpty() const {
+  return is_mpty_;
+}
+inline void RilCall::set_is_mpty(bool value) {
+  _set_bit(3);
+  is_mpty_ = value;
+}
+
+// optional bool is_mt = 5;
+inline bool RilCall::has_is_mt() const {
+  return _has_bit(4);
+}
+inline void RilCall::clear_is_mt() {
+  is_mt_ = false;
+  _clear_bit(4);
+}
+inline bool RilCall::is_mt() const {
+  return is_mt_;
+}
+inline void RilCall::set_is_mt(bool value) {
+  _set_bit(4);
+  is_mt_ = value;
+}
+
+// optional int32 als = 6;
+inline bool RilCall::has_als() const {
+  return _has_bit(5);
+}
+inline void RilCall::clear_als() {
+  als_ = 0;
+  _clear_bit(5);
+}
+inline ::google::protobuf::int32 RilCall::als() const {
+  return als_;
+}
+inline void RilCall::set_als(::google::protobuf::int32 value) {
+  _set_bit(5);
+  als_ = value;
+}
+
+// optional bool is_voice = 7;
+inline bool RilCall::has_is_voice() const {
+  return _has_bit(6);
+}
+inline void RilCall::clear_is_voice() {
+  is_voice_ = false;
+  _clear_bit(6);
+}
+inline bool RilCall::is_voice() const {
+  return is_voice_;
+}
+inline void RilCall::set_is_voice(bool value) {
+  _set_bit(6);
+  is_voice_ = value;
+}
+
+// optional bool is_voice_privacy = 8;
+inline bool RilCall::has_is_voice_privacy() const {
+  return _has_bit(7);
+}
+inline void RilCall::clear_is_voice_privacy() {
+  is_voice_privacy_ = false;
+  _clear_bit(7);
+}
+inline bool RilCall::is_voice_privacy() const {
+  return is_voice_privacy_;
+}
+inline void RilCall::set_is_voice_privacy(bool value) {
+  _set_bit(7);
+  is_voice_privacy_ = value;
+}
+
+// optional string number = 9;
+inline bool RilCall::has_number() const {
+  return _has_bit(8);
+}
+inline void RilCall::clear_number() {
+  if (number_ != &_default_number_) {
+    number_->clear();
+  }
+  _clear_bit(8);
+}
+inline const ::std::string& RilCall::number() const {
+  return *number_;
+}
+inline void RilCall::set_number(const ::std::string& value) {
+  _set_bit(8);
+  if (number_ == &_default_number_) {
+    number_ = new ::std::string;
+  }
+  number_->assign(value);
+}
+inline void RilCall::set_number(const char* value) {
+  _set_bit(8);
+  if (number_ == &_default_number_) {
+    number_ = new ::std::string;
+  }
+  number_->assign(value);
+}
+inline void RilCall::set_number(const char* value, size_t size) {
+  _set_bit(8);
+  if (number_ == &_default_number_) {
+    number_ = new ::std::string;
+  }
+  number_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RilCall::mutable_number() {
+  _set_bit(8);
+  if (number_ == &_default_number_) {
+    number_ = new ::std::string;
+  }
+  return number_;
+}
+
+// optional int32 number_presentation = 10;
+inline bool RilCall::has_number_presentation() const {
+  return _has_bit(9);
+}
+inline void RilCall::clear_number_presentation() {
+  number_presentation_ = 0;
+  _clear_bit(9);
+}
+inline ::google::protobuf::int32 RilCall::number_presentation() const {
+  return number_presentation_;
+}
+inline void RilCall::set_number_presentation(::google::protobuf::int32 value) {
+  _set_bit(9);
+  number_presentation_ = value;
+}
+
+// optional string name = 11;
+inline bool RilCall::has_name() const {
+  return _has_bit(10);
+}
+inline void RilCall::clear_name() {
+  if (name_ != &_default_name_) {
+    name_->clear();
+  }
+  _clear_bit(10);
+}
+inline const ::std::string& RilCall::name() const {
+  return *name_;
+}
+inline void RilCall::set_name(const ::std::string& value) {
+  _set_bit(10);
+  if (name_ == &_default_name_) {
+    name_ = new ::std::string;
+  }
+  name_->assign(value);
+}
+inline void RilCall::set_name(const char* value) {
+  _set_bit(10);
+  if (name_ == &_default_name_) {
+    name_ = new ::std::string;
+  }
+  name_->assign(value);
+}
+inline void RilCall::set_name(const char* value, size_t size) {
+  _set_bit(10);
+  if (name_ == &_default_name_) {
+    name_ = new ::std::string;
+  }
+  name_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RilCall::mutable_name() {
+  _set_bit(10);
+  if (name_ == &_default_name_) {
+    name_ = new ::std::string;
+  }
+  return name_;
+}
+
+// optional int32 name_presentation = 12;
+inline bool RilCall::has_name_presentation() const {
+  return _has_bit(11);
+}
+inline void RilCall::clear_name_presentation() {
+  name_presentation_ = 0;
+  _clear_bit(11);
+}
+inline ::google::protobuf::int32 RilCall::name_presentation() const {
+  return name_presentation_;
+}
+inline void RilCall::set_name_presentation(::google::protobuf::int32 value) {
+  _set_bit(11);
+  name_presentation_ = value;
+}
+
+// optional .ril_proto.RilUusInfo uus_info = 13;
+inline bool RilCall::has_uus_info() const {
+  return _has_bit(12);
+}
+inline void RilCall::clear_uus_info() {
+  if (uus_info_ != NULL) uus_info_->::ril_proto::RilUusInfo::Clear();
+  _clear_bit(12);
+}
+inline const ::ril_proto::RilUusInfo& RilCall::uus_info() const {
+  return uus_info_ != NULL ? *uus_info_ : *default_instance_->uus_info_;
+}
+inline ::ril_proto::RilUusInfo* RilCall::mutable_uus_info() {
+  _set_bit(12);
+  if (uus_info_ == NULL) uus_info_ = new ::ril_proto::RilUusInfo;
+  return uus_info_;
+}
+
+// -------------------------------------------------------------------
+
+// RILGWSignalStrength
+
+// optional int32 signal_strength = 1;
+inline bool RILGWSignalStrength::has_signal_strength() const {
+  return _has_bit(0);
+}
+inline void RILGWSignalStrength::clear_signal_strength() {
+  signal_strength_ = 0;
+  _clear_bit(0);
+}
+inline ::google::protobuf::int32 RILGWSignalStrength::signal_strength() const {
+  return signal_strength_;
+}
+inline void RILGWSignalStrength::set_signal_strength(::google::protobuf::int32 value) {
+  _set_bit(0);
+  signal_strength_ = value;
+}
+
+// optional int32 bit_error_rate = 2;
+inline bool RILGWSignalStrength::has_bit_error_rate() const {
+  return _has_bit(1);
+}
+inline void RILGWSignalStrength::clear_bit_error_rate() {
+  bit_error_rate_ = 0;
+  _clear_bit(1);
+}
+inline ::google::protobuf::int32 RILGWSignalStrength::bit_error_rate() const {
+  return bit_error_rate_;
+}
+inline void RILGWSignalStrength::set_bit_error_rate(::google::protobuf::int32 value) {
+  _set_bit(1);
+  bit_error_rate_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// RILCDMASignalStrength
+
+// optional int32 dbm = 1;
+inline bool RILCDMASignalStrength::has_dbm() const {
+  return _has_bit(0);
+}
+inline void RILCDMASignalStrength::clear_dbm() {
+  dbm_ = 0;
+  _clear_bit(0);
+}
+inline ::google::protobuf::int32 RILCDMASignalStrength::dbm() const {
+  return dbm_;
+}
+inline void RILCDMASignalStrength::set_dbm(::google::protobuf::int32 value) {
+  _set_bit(0);
+  dbm_ = value;
+}
+
+// optional int32 ecio = 2;
+inline bool RILCDMASignalStrength::has_ecio() const {
+  return _has_bit(1);
+}
+inline void RILCDMASignalStrength::clear_ecio() {
+  ecio_ = 0;
+  _clear_bit(1);
+}
+inline ::google::protobuf::int32 RILCDMASignalStrength::ecio() const {
+  return ecio_;
+}
+inline void RILCDMASignalStrength::set_ecio(::google::protobuf::int32 value) {
+  _set_bit(1);
+  ecio_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// RILEVDOSignalStrength
+
+// optional int32 dbm = 1;
+inline bool RILEVDOSignalStrength::has_dbm() const {
+  return _has_bit(0);
+}
+inline void RILEVDOSignalStrength::clear_dbm() {
+  dbm_ = 0;
+  _clear_bit(0);
+}
+inline ::google::protobuf::int32 RILEVDOSignalStrength::dbm() const {
+  return dbm_;
+}
+inline void RILEVDOSignalStrength::set_dbm(::google::protobuf::int32 value) {
+  _set_bit(0);
+  dbm_ = value;
+}
+
+// optional int32 ecio = 2;
+inline bool RILEVDOSignalStrength::has_ecio() const {
+  return _has_bit(1);
+}
+inline void RILEVDOSignalStrength::clear_ecio() {
+  ecio_ = 0;
+  _clear_bit(1);
+}
+inline ::google::protobuf::int32 RILEVDOSignalStrength::ecio() const {
+  return ecio_;
+}
+inline void RILEVDOSignalStrength::set_ecio(::google::protobuf::int32 value) {
+  _set_bit(1);
+  ecio_ = value;
+}
+
+// optional int32 signal_noise_ratio = 3;
+inline bool RILEVDOSignalStrength::has_signal_noise_ratio() const {
+  return _has_bit(2);
+}
+inline void RILEVDOSignalStrength::clear_signal_noise_ratio() {
+  signal_noise_ratio_ = 0;
+  _clear_bit(2);
+}
+inline ::google::protobuf::int32 RILEVDOSignalStrength::signal_noise_ratio() const {
+  return signal_noise_ratio_;
+}
+inline void RILEVDOSignalStrength::set_signal_noise_ratio(::google::protobuf::int32 value) {
+  _set_bit(2);
+  signal_noise_ratio_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// RspStrings
+
+// repeated string strings = 1;
+inline int RspStrings::strings_size() const {
+  return strings_.size();
+}
+inline void RspStrings::clear_strings() {
+  strings_.Clear();
+}
+inline const ::std::string& RspStrings::strings(int index) const {
+  return strings_.Get(index);
+}
+inline ::std::string* RspStrings::mutable_strings(int index) {
+  return strings_.Mutable(index);
+}
+inline void RspStrings::set_strings(int index, const ::std::string& value) {
+  strings_.Mutable(index)->assign(value);
+}
+inline void RspStrings::set_strings(int index, const char* value) {
+  strings_.Mutable(index)->assign(value);
+}
+inline void RspStrings::set_strings(int index, const char* value, size_t size) {
+  strings_.Mutable(index)->assign(
+    reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RspStrings::add_strings() {
+  return strings_.Add();
+}
+inline void RspStrings::add_strings(const ::std::string& value) {
+  strings_.Add()->assign(value);
+}
+inline void RspStrings::add_strings(const char* value) {
+  strings_.Add()->assign(value);
+}
+inline void RspStrings::add_strings(const char* value, size_t size) {
+  strings_.Add()->assign(reinterpret_cast<const char*>(value), size);
+}
+inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
+RspStrings::strings() const {
+  return strings_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::std::string>*
+RspStrings::mutable_strings() {
+  return &strings_;
+}
+
+// -------------------------------------------------------------------
+
+// RspIntegers
+
+// repeated int32 integers = 1;
+inline int RspIntegers::integers_size() const {
+  return integers_.size();
+}
+inline void RspIntegers::clear_integers() {
+  integers_.Clear();
+}
+inline ::google::protobuf::int32 RspIntegers::integers(int index) const {
+  return integers_.Get(index);
+}
+inline void RspIntegers::set_integers(int index, ::google::protobuf::int32 value) {
+  integers_.Set(index, value);
+}
+inline void RspIntegers::add_integers(::google::protobuf::int32 value) {
+  integers_.Add(value);
+}
+inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+RspIntegers::integers() const {
+  return integers_;
+}
+inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+RspIntegers::mutable_integers() {
+  return &integers_;
+}
+
+// -------------------------------------------------------------------
+
+// RspGetSimStatus
+
+// required .ril_proto.RilCardStatus card_status = 1;
+inline bool RspGetSimStatus::has_card_status() const {
+  return _has_bit(0);
+}
+inline void RspGetSimStatus::clear_card_status() {
+  if (card_status_ != NULL) card_status_->::ril_proto::RilCardStatus::Clear();
+  _clear_bit(0);
+}
+inline const ::ril_proto::RilCardStatus& RspGetSimStatus::card_status() const {
+  return card_status_ != NULL ? *card_status_ : *default_instance_->card_status_;
+}
+inline ::ril_proto::RilCardStatus* RspGetSimStatus::mutable_card_status() {
+  _set_bit(0);
+  if (card_status_ == NULL) card_status_ = new ::ril_proto::RilCardStatus;
+  return card_status_;
+}
+
+// -------------------------------------------------------------------
+
+// ReqEnterSimPin
+
+// required string pin = 1;
+inline bool ReqEnterSimPin::has_pin() const {
+  return _has_bit(0);
+}
+inline void ReqEnterSimPin::clear_pin() {
+  if (pin_ != &_default_pin_) {
+    pin_->clear();
+  }
+  _clear_bit(0);
+}
+inline const ::std::string& ReqEnterSimPin::pin() const {
+  return *pin_;
+}
+inline void ReqEnterSimPin::set_pin(const ::std::string& value) {
+  _set_bit(0);
+  if (pin_ == &_default_pin_) {
+    pin_ = new ::std::string;
+  }
+  pin_->assign(value);
+}
+inline void ReqEnterSimPin::set_pin(const char* value) {
+  _set_bit(0);
+  if (pin_ == &_default_pin_) {
+    pin_ = new ::std::string;
+  }
+  pin_->assign(value);
+}
+inline void ReqEnterSimPin::set_pin(const char* value, size_t size) {
+  _set_bit(0);
+  if (pin_ == &_default_pin_) {
+    pin_ = new ::std::string;
+  }
+  pin_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* ReqEnterSimPin::mutable_pin() {
+  _set_bit(0);
+  if (pin_ == &_default_pin_) {
+    pin_ = new ::std::string;
+  }
+  return pin_;
+}
+
+// -------------------------------------------------------------------
+
+// RspEnterSimPin
+
+// required int32 retries_remaining = 1;
+inline bool RspEnterSimPin::has_retries_remaining() const {
+  return _has_bit(0);
+}
+inline void RspEnterSimPin::clear_retries_remaining() {
+  retries_remaining_ = 0;
+  _clear_bit(0);
+}
+inline ::google::protobuf::int32 RspEnterSimPin::retries_remaining() const {
+  return retries_remaining_;
+}
+inline void RspEnterSimPin::set_retries_remaining(::google::protobuf::int32 value) {
+  _set_bit(0);
+  retries_remaining_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// RspGetCurrentCalls
+
+// repeated .ril_proto.RilCall calls = 1;
+inline int RspGetCurrentCalls::calls_size() const {
+  return calls_.size();
+}
+inline void RspGetCurrentCalls::clear_calls() {
+  calls_.Clear();
+}
+inline const ::ril_proto::RilCall& RspGetCurrentCalls::calls(int index) const {
+  return calls_.Get(index);
+}
+inline ::ril_proto::RilCall* RspGetCurrentCalls::mutable_calls(int index) {
+  return calls_.Mutable(index);
+}
+inline ::ril_proto::RilCall* RspGetCurrentCalls::add_calls() {
+  return calls_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::ril_proto::RilCall >&
+RspGetCurrentCalls::calls() const {
+  return calls_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::ril_proto::RilCall >*
+RspGetCurrentCalls::mutable_calls() {
+  return &calls_;
+}
+
+// -------------------------------------------------------------------
+
+// ReqDial
+
+// optional string address = 1;
+inline bool ReqDial::has_address() const {
+  return _has_bit(0);
+}
+inline void ReqDial::clear_address() {
+  if (address_ != &_default_address_) {
+    address_->clear();
+  }
+  _clear_bit(0);
+}
+inline const ::std::string& ReqDial::address() const {
+  return *address_;
+}
+inline void ReqDial::set_address(const ::std::string& value) {
+  _set_bit(0);
+  if (address_ == &_default_address_) {
+    address_ = new ::std::string;
+  }
+  address_->assign(value);
+}
+inline void ReqDial::set_address(const char* value) {
+  _set_bit(0);
+  if (address_ == &_default_address_) {
+    address_ = new ::std::string;
+  }
+  address_->assign(value);
+}
+inline void ReqDial::set_address(const char* value, size_t size) {
+  _set_bit(0);
+  if (address_ == &_default_address_) {
+    address_ = new ::std::string;
+  }
+  address_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* ReqDial::mutable_address() {
+  _set_bit(0);
+  if (address_ == &_default_address_) {
+    address_ = new ::std::string;
+  }
+  return address_;
+}
+
+// optional int32 clir = 2;
+inline bool ReqDial::has_clir() const {
+  return _has_bit(1);
+}
+inline void ReqDial::clear_clir() {
+  clir_ = 0;
+  _clear_bit(1);
+}
+inline ::google::protobuf::int32 ReqDial::clir() const {
+  return clir_;
+}
+inline void ReqDial::set_clir(::google::protobuf::int32 value) {
+  _set_bit(1);
+  clir_ = value;
+}
+
+// optional .ril_proto.RilUusInfo uus_info = 3;
+inline bool ReqDial::has_uus_info() const {
+  return _has_bit(2);
+}
+inline void ReqDial::clear_uus_info() {
+  if (uus_info_ != NULL) uus_info_->::ril_proto::RilUusInfo::Clear();
+  _clear_bit(2);
+}
+inline const ::ril_proto::RilUusInfo& ReqDial::uus_info() const {
+  return uus_info_ != NULL ? *uus_info_ : *default_instance_->uus_info_;
+}
+inline ::ril_proto::RilUusInfo* ReqDial::mutable_uus_info() {
+  _set_bit(2);
+  if (uus_info_ == NULL) uus_info_ = new ::ril_proto::RilUusInfo;
+  return uus_info_;
+}
+
+// -------------------------------------------------------------------
+
+// ReqHangUp
+
+// required int32 connection_index = 1;
+inline bool ReqHangUp::has_connection_index() const {
+  return _has_bit(0);
+}
+inline void ReqHangUp::clear_connection_index() {
+  connection_index_ = 0;
+  _clear_bit(0);
+}
+inline ::google::protobuf::int32 ReqHangUp::connection_index() const {
+  return connection_index_;
+}
+inline void ReqHangUp::set_connection_index(::google::protobuf::int32 value) {
+  _set_bit(0);
+  connection_index_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// RspSignalStrength
+
+// optional .ril_proto.RILGWSignalStrength gw_signalstrength = 1;
+inline bool RspSignalStrength::has_gw_signalstrength() const {
+  return _has_bit(0);
+}
+inline void RspSignalStrength::clear_gw_signalstrength() {
+  if (gw_signalstrength_ != NULL) gw_signalstrength_->::ril_proto::RILGWSignalStrength::Clear();
+  _clear_bit(0);
+}
+inline const ::ril_proto::RILGWSignalStrength& RspSignalStrength::gw_signalstrength() const {
+  return gw_signalstrength_ != NULL ? *gw_signalstrength_ : *default_instance_->gw_signalstrength_;
+}
+inline ::ril_proto::RILGWSignalStrength* RspSignalStrength::mutable_gw_signalstrength() {
+  _set_bit(0);
+  if (gw_signalstrength_ == NULL) gw_signalstrength_ = new ::ril_proto::RILGWSignalStrength;
+  return gw_signalstrength_;
+}
+
+// optional .ril_proto.RILCDMASignalStrength cdma_signalstrength = 2;
+inline bool RspSignalStrength::has_cdma_signalstrength() const {
+  return _has_bit(1);
+}
+inline void RspSignalStrength::clear_cdma_signalstrength() {
+  if (cdma_signalstrength_ != NULL) cdma_signalstrength_->::ril_proto::RILCDMASignalStrength::Clear();
+  _clear_bit(1);
+}
+inline const ::ril_proto::RILCDMASignalStrength& RspSignalStrength::cdma_signalstrength() const {
+  return cdma_signalstrength_ != NULL ? *cdma_signalstrength_ : *default_instance_->cdma_signalstrength_;
+}
+inline ::ril_proto::RILCDMASignalStrength* RspSignalStrength::mutable_cdma_signalstrength() {
+  _set_bit(1);
+  if (cdma_signalstrength_ == NULL) cdma_signalstrength_ = new ::ril_proto::RILCDMASignalStrength;
+  return cdma_signalstrength_;
+}
+
+// optional .ril_proto.RILEVDOSignalStrength evdo_signalstrength = 3;
+inline bool RspSignalStrength::has_evdo_signalstrength() const {
+  return _has_bit(2);
+}
+inline void RspSignalStrength::clear_evdo_signalstrength() {
+  if (evdo_signalstrength_ != NULL) evdo_signalstrength_->::ril_proto::RILEVDOSignalStrength::Clear();
+  _clear_bit(2);
+}
+inline const ::ril_proto::RILEVDOSignalStrength& RspSignalStrength::evdo_signalstrength() const {
+  return evdo_signalstrength_ != NULL ? *evdo_signalstrength_ : *default_instance_->evdo_signalstrength_;
+}
+inline ::ril_proto::RILEVDOSignalStrength* RspSignalStrength::mutable_evdo_signalstrength() {
+  _set_bit(2);
+  if (evdo_signalstrength_ == NULL) evdo_signalstrength_ = new ::ril_proto::RILEVDOSignalStrength;
+  return evdo_signalstrength_;
+}
+
+// -------------------------------------------------------------------
+
+// RspOperator
+
+// optional string long_alpha_ons = 1;
+inline bool RspOperator::has_long_alpha_ons() const {
+  return _has_bit(0);
+}
+inline void RspOperator::clear_long_alpha_ons() {
+  if (long_alpha_ons_ != &_default_long_alpha_ons_) {
+    long_alpha_ons_->clear();
+  }
+  _clear_bit(0);
+}
+inline const ::std::string& RspOperator::long_alpha_ons() const {
+  return *long_alpha_ons_;
+}
+inline void RspOperator::set_long_alpha_ons(const ::std::string& value) {
+  _set_bit(0);
+  if (long_alpha_ons_ == &_default_long_alpha_ons_) {
+    long_alpha_ons_ = new ::std::string;
+  }
+  long_alpha_ons_->assign(value);
+}
+inline void RspOperator::set_long_alpha_ons(const char* value) {
+  _set_bit(0);
+  if (long_alpha_ons_ == &_default_long_alpha_ons_) {
+    long_alpha_ons_ = new ::std::string;
+  }
+  long_alpha_ons_->assign(value);
+}
+inline void RspOperator::set_long_alpha_ons(const char* value, size_t size) {
+  _set_bit(0);
+  if (long_alpha_ons_ == &_default_long_alpha_ons_) {
+    long_alpha_ons_ = new ::std::string;
+  }
+  long_alpha_ons_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RspOperator::mutable_long_alpha_ons() {
+  _set_bit(0);
+  if (long_alpha_ons_ == &_default_long_alpha_ons_) {
+    long_alpha_ons_ = new ::std::string;
+  }
+  return long_alpha_ons_;
+}
+
+// optional string short_alpha_ons = 2;
+inline bool RspOperator::has_short_alpha_ons() const {
+  return _has_bit(1);
+}
+inline void RspOperator::clear_short_alpha_ons() {
+  if (short_alpha_ons_ != &_default_short_alpha_ons_) {
+    short_alpha_ons_->clear();
+  }
+  _clear_bit(1);
+}
+inline const ::std::string& RspOperator::short_alpha_ons() const {
+  return *short_alpha_ons_;
+}
+inline void RspOperator::set_short_alpha_ons(const ::std::string& value) {
+  _set_bit(1);
+  if (short_alpha_ons_ == &_default_short_alpha_ons_) {
+    short_alpha_ons_ = new ::std::string;
+  }
+  short_alpha_ons_->assign(value);
+}
+inline void RspOperator::set_short_alpha_ons(const char* value) {
+  _set_bit(1);
+  if (short_alpha_ons_ == &_default_short_alpha_ons_) {
+    short_alpha_ons_ = new ::std::string;
+  }
+  short_alpha_ons_->assign(value);
+}
+inline void RspOperator::set_short_alpha_ons(const char* value, size_t size) {
+  _set_bit(1);
+  if (short_alpha_ons_ == &_default_short_alpha_ons_) {
+    short_alpha_ons_ = new ::std::string;
+  }
+  short_alpha_ons_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RspOperator::mutable_short_alpha_ons() {
+  _set_bit(1);
+  if (short_alpha_ons_ == &_default_short_alpha_ons_) {
+    short_alpha_ons_ = new ::std::string;
+  }
+  return short_alpha_ons_;
+}
+
+// optional string mcc_mnc = 3;
+inline bool RspOperator::has_mcc_mnc() const {
+  return _has_bit(2);
+}
+inline void RspOperator::clear_mcc_mnc() {
+  if (mcc_mnc_ != &_default_mcc_mnc_) {
+    mcc_mnc_->clear();
+  }
+  _clear_bit(2);
+}
+inline const ::std::string& RspOperator::mcc_mnc() const {
+  return *mcc_mnc_;
+}
+inline void RspOperator::set_mcc_mnc(const ::std::string& value) {
+  _set_bit(2);
+  if (mcc_mnc_ == &_default_mcc_mnc_) {
+    mcc_mnc_ = new ::std::string;
+  }
+  mcc_mnc_->assign(value);
+}
+inline void RspOperator::set_mcc_mnc(const char* value) {
+  _set_bit(2);
+  if (mcc_mnc_ == &_default_mcc_mnc_) {
+    mcc_mnc_ = new ::std::string;
+  }
+  mcc_mnc_->assign(value);
+}
+inline void RspOperator::set_mcc_mnc(const char* value, size_t size) {
+  _set_bit(2);
+  if (mcc_mnc_ == &_default_mcc_mnc_) {
+    mcc_mnc_ = new ::std::string;
+  }
+  mcc_mnc_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* RspOperator::mutable_mcc_mnc() {
+  _set_bit(2);
+  if (mcc_mnc_ == &_default_mcc_mnc_) {
+    mcc_mnc_ = new ::std::string;
+  }
+  return mcc_mnc_;
+}
+
+// -------------------------------------------------------------------
+
+// ReqSeparateConnection
+
+// required int32 index = 1;
+inline bool ReqSeparateConnection::has_index() const {
+  return _has_bit(0);
+}
+inline void ReqSeparateConnection::clear_index() {
+  index_ = 0;
+  _clear_bit(0);
+}
+inline ::google::protobuf::int32 ReqSeparateConnection::index() const {
+  return index_;
+}
+inline void ReqSeparateConnection::set_index(::google::protobuf::int32 value) {
+  _set_bit(0);
+  index_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// ReqSetMute
+
+// required bool state = 1;
+inline bool ReqSetMute::has_state() const {
+  return _has_bit(0);
+}
+inline void ReqSetMute::clear_state() {
+  state_ = false;
+  _clear_bit(0);
+}
+inline bool ReqSetMute::state() const {
+  return state_;
+}
+inline void ReqSetMute::set_state(bool value) {
+  _set_bit(0);
+  state_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// ReqScreenState
+
+// required bool state = 1;
+inline bool ReqScreenState::has_state() const {
+  return _has_bit(0);
+}
+inline void ReqScreenState::clear_state() {
+  state_ = false;
+  _clear_bit(0);
+}
+inline bool ReqScreenState::state() const {
+  return state_;
+}
+inline void ReqScreenState::set_state(bool value) {
+  _set_bit(0);
+  state_ = value;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace ril_proto
+
+#ifndef SWIG
+namespace google {
+namespace protobuf {
+
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RadioState>() {
+  return ril_proto::RadioState_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RilCardState>() {
+  return ril_proto::RilCardState_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RilPersoSubstate>() {
+  return ril_proto::RilPersoSubstate_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RilAppState>() {
+  return ril_proto::RilAppState_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RilPinState>() {
+  return ril_proto::RilPinState_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RilAppType>() {
+  return ril_proto::RilAppType_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RilUusType>() {
+  return ril_proto::RilUusType_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RilUusDcs>() {
+  return ril_proto::RilUusDcs_descriptor();
+}
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ril_proto::RilCallState>() {
+  return ril_proto::RilCallState_descriptor();
+}
+
+}  // namespace google
+}  // namespace protobuf
+#endif  // SWIG
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_ril_2eproto__INCLUDED
diff --git a/mock-ril/src/generated/desc/ctrl.desc b/mock-ril/src/generated/desc/ctrl.desc
new file mode 100644 (file)
index 0000000..b76019d
Binary files /dev/null and b/mock-ril/src/generated/desc/ctrl.desc differ
diff --git a/mock-ril/src/generated/desc/msgheader.desc b/mock-ril/src/generated/desc/msgheader.desc
new file mode 100644 (file)
index 0000000..22ea028
--- /dev/null
@@ -0,0 +1,9 @@
+
+\94\ 1
+\ fmsgheader.proto\12\rcommunication"L
+       MsgHeader\12\v
+\ 3cmd\18\ 1 \ 2(\r\12\13
+\vlength_data\18\ 2 \ 2(\r\12\ e
+\ 6status\18\ 3 \ 1(\r\12\r
+\ 5token\18\ 4 \ 1(\ 4B$
+"com.android.internal.communication
\ No newline at end of file
diff --git a/mock-ril/src/generated/desc/ril.desc b/mock-ril/src/generated/desc/ril.desc
new file mode 100644 (file)
index 0000000..4b04e45
Binary files /dev/null and b/mock-ril/src/generated/desc/ril.desc differ
diff --git a/mock-ril/src/generated/java/com/android/internal/communication/MsgHeader.java b/mock-ril/src/generated/java/com/android/internal/communication/MsgHeader.java
new file mode 100644 (file)
index 0000000..6d756d4
--- /dev/null
@@ -0,0 +1,185 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+package com.android.internal.communication;
+
+public  final class MsgHeader extends
+    com.google.protobuf.micro.MessageMicro {
+  public MsgHeader() {}
+  
+  // required uint32 cmd = 1;
+  public static final int CMD_FIELD_NUMBER = 1;
+  private boolean hasCmd;
+  private int cmd_ = 0;
+  public int getCmd() { return cmd_; }
+  public boolean hasCmd() { return hasCmd; }
+  public MsgHeader setCmd(int value) {
+    hasCmd = true;
+    cmd_ = value;
+    return this;
+  }
+  public MsgHeader clearCmd() {
+    hasCmd = false;
+    cmd_ = 0;
+    return this;
+  }
+  
+  // required uint32 length_data = 2;
+  public static final int LENGTH_DATA_FIELD_NUMBER = 2;
+  private boolean hasLengthData;
+  private int lengthData_ = 0;
+  public int getLengthData() { return lengthData_; }
+  public boolean hasLengthData() { return hasLengthData; }
+  public MsgHeader setLengthData(int value) {
+    hasLengthData = true;
+    lengthData_ = value;
+    return this;
+  }
+  public MsgHeader clearLengthData() {
+    hasLengthData = false;
+    lengthData_ = 0;
+    return this;
+  }
+  
+  // optional uint32 status = 3;
+  public static final int STATUS_FIELD_NUMBER = 3;
+  private boolean hasStatus;
+  private int status_ = 0;
+  public int getStatus() { return status_; }
+  public boolean hasStatus() { return hasStatus; }
+  public MsgHeader setStatus(int value) {
+    hasStatus = true;
+    status_ = value;
+    return this;
+  }
+  public MsgHeader clearStatus() {
+    hasStatus = false;
+    status_ = 0;
+    return this;
+  }
+  
+  // optional uint64 token = 4;
+  public static final int TOKEN_FIELD_NUMBER = 4;
+  private boolean hasToken;
+  private long token_ = 0L;
+  public long getToken() { return token_; }
+  public boolean hasToken() { return hasToken; }
+  public MsgHeader setToken(long value) {
+    hasToken = true;
+    token_ = value;
+    return this;
+  }
+  public MsgHeader clearToken() {
+    hasToken = false;
+    token_ = 0L;
+    return this;
+  }
+  
+  public final MsgHeader clear() {
+    clearCmd();
+    clearLengthData();
+    clearStatus();
+    clearToken();
+    cachedSize = -1;
+    return this;
+  }
+  
+  public final boolean isInitialized() {
+    if (!hasCmd) return false;
+    if (!hasLengthData) return false;
+    return true;
+  }
+  
+  public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                      throws java.io.IOException {
+    if (hasCmd()) {
+      output.writeUInt32(1, getCmd());
+    }
+    if (hasLengthData()) {
+      output.writeUInt32(2, getLengthData());
+    }
+    if (hasStatus()) {
+      output.writeUInt32(3, getStatus());
+    }
+    if (hasToken()) {
+      output.writeUInt64(4, getToken());
+    }
+  }
+  
+  private int cachedSize = -1;
+  public int getCachedSize() {
+    if (cachedSize < 0) {
+      // getSerializedSize sets cachedSize
+      getSerializedSize();
+    }
+    return cachedSize;
+  }
+  
+  public int getSerializedSize() {
+    int size = 0;
+    if (hasCmd()) {
+      size += com.google.protobuf.micro.CodedOutputStreamMicro
+        .computeUInt32Size(1, getCmd());
+    }
+    if (hasLengthData()) {
+      size += com.google.protobuf.micro.CodedOutputStreamMicro
+        .computeUInt32Size(2, getLengthData());
+    }
+    if (hasStatus()) {
+      size += com.google.protobuf.micro.CodedOutputStreamMicro
+        .computeUInt32Size(3, getStatus());
+    }
+    if (hasToken()) {
+      size += com.google.protobuf.micro.CodedOutputStreamMicro
+        .computeUInt64Size(4, getToken());
+    }
+    cachedSize = size;
+    return size;
+  }
+  
+  public MsgHeader mergeFrom(
+      com.google.protobuf.micro.CodedInputStreamMicro input)
+      throws java.io.IOException {
+    while (true) {
+      int tag = input.readTag();
+      switch (tag) {
+        case 0:
+          return this;
+        default: {
+          if (!parseUnknownField(input, tag)) {
+            return this;
+          }
+          break;
+        }
+        case 8: {
+          setCmd(input.readUInt32());
+          break;
+        }
+        case 16: {
+          setLengthData(input.readUInt32());
+          break;
+        }
+        case 24: {
+          setStatus(input.readUInt32());
+          break;
+        }
+        case 32: {
+          setToken(input.readUInt64());
+          break;
+        }
+      }
+    }
+  }
+  
+  public static MsgHeader parseFrom(byte[] data)
+      throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+    return (MsgHeader) (new MsgHeader().mergeFrom(data));
+  }
+  
+  public static MsgHeader parseFrom(
+          com.google.protobuf.micro.CodedInputStreamMicro input)
+      throws java.io.IOException {
+    return (MsgHeader) (new MsgHeader().mergeFrom(input));
+  }
+  
+}
+
diff --git a/mock-ril/src/generated/java/com/android/internal/telephony/ril_proto/RilCmds.java b/mock-ril/src/generated/java/com/android/internal/telephony/ril_proto/RilCmds.java
new file mode 100644 (file)
index 0000000..3872bb8
--- /dev/null
@@ -0,0 +1,3120 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+package com.android.internal.telephony.ril_proto;
+
+public final class RilCmds {
+  private RilCmds() {}
+  // enum RadioState
+  public static final int RADIOSTATE_OFF = 0;
+  public static final int RADIOSTATE_UNAVAILABLE = 1;
+  public static final int RADIOSTATE_SIM_NOT_READY = 2;
+  public static final int RADIOSTATE_SIM_LOCKED_OR_ABSENT = 3;
+  public static final int RADIOSTATE_SIM_READY = 4;
+  public static final int RADIOSTATE_RUIM_NOT_READY = 5;
+  public static final int RADIOSTATE_RUIM_READY = 6;
+  public static final int RADIOSTATE_RUIM_LOCKED_OR_ABSENT = 7;
+  public static final int RADIOSTATE_NV_NOT_READY = 8;
+  public static final int RADIOSTATE_NV_READY = 9;
+  
+  // enum RilCardState
+  public static final int CARDSTATE_ABSENT = 0;
+  public static final int CARDSTATE_PRESENT = 1;
+  public static final int CARDSTATE_ERROR = 2;
+  
+  // enum RilPersoSubstate
+  public static final int PERSOSUBSTATE_UNKNOWN = 0;
+  public static final int PERSOSUBSTATE_IN_PROGRESS = 1;
+  public static final int PERSOSUBSTATE_READY = 2;
+  public static final int PERSOSUBSTATE_SIM_NETWORK = 3;
+  public static final int PERSOSUBSTATE_SIM_NETWORK_SUBSET = 4;
+  public static final int PERSOSUBSTATE_SIM_CORPORATE = 5;
+  public static final int PERSOSUBSTATE_SIM_SERVICE_PROVIDER = 6;
+  public static final int PERSOSUBSTATE_SIM_SIM = 7;
+  public static final int PERSOSUBSTATE_SIM_NETWORK_PUK = 8;
+  public static final int PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK = 9;
+  public static final int PERSOSUBSTATE_SIM_CORPORATE_PUK = 10;
+  public static final int PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK = 11;
+  public static final int PERSOSUBSTATE_SIM_SIM_PUK = 12;
+  public static final int PERSOSUBSTATE_RUIM_NETWORK1 = 13;
+  public static final int PERSOSUBSTATE_RUIM_NETWORK2 = 14;
+  public static final int PERSOSUBSTATE_RUIM_HRPD = 15;
+  public static final int PERSOSUBSTATE_RUIM_CORPORATE = 16;
+  public static final int PERSOSUBSTATE_RUIM_SERVICE_PROVIDER = 17;
+  public static final int PERSOSUBSTATE_RUIM_RUIM = 18;
+  public static final int PERSOSUBSTATE_RUIM_NETWORK1_PUK = 19;
+  public static final int PERSOSUBSTATE_RUIM_NETWORK2_PUK = 20;
+  public static final int PERSOSUBSTATE_RUIM_HRPD_PUK = 21;
+  public static final int PERSOSUBSTATE_RUIM_CORPORATE_PUK = 22;
+  public static final int PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23;
+  public static final int PERSOSUBSTATE_RUIM_RUIM_PUK = 24;
+  
+  // enum RilAppState
+  public static final int APPSTATE_UNKNOWN = 0;
+  public static final int APPSTATE_DETECTED = 1;
+  public static final int APPSTATE_PIN = 2;
+  public static final int APPSTATE_PUK = 3;
+  public static final int APPSTATE_SUBSCRIPTION_PERSO = 4;
+  public static final int APPSTATE_READY = 5;
+  
+  // enum RilPinState
+  public static final int PINSTATE_UNKNOWN = 0;
+  public static final int PINSTATE_ENABLED_NOT_VERIFIED = 1;
+  public static final int PINSTATE_ENABLED_VERIFIED = 2;
+  public static final int PINSTATE_DISABLED = 3;
+  public static final int PINSTATE_ENABLED_BLOCKED = 4;
+  public static final int PINSTATE_ENABLED_PERM_BLOCKED = 5;
+  
+  // enum RilAppType
+  public static final int APPTYPE_UNKNOWN = 0;
+  public static final int APPTYPE_SIM = 1;
+  public static final int APPTYPE_USIM = 2;
+  public static final int APPTYPE_RUIM = 3;
+  public static final int APPTYPE_CSIM = 4;
+  
+  // enum RilUusType
+  public static final int RILUUSTYPE1_IMPLICIT = 0;
+  public static final int RILUUSTYPE1_REQUIRED = 1;
+  public static final int RILUUSTYPE1_NOT_REQUIRED = 2;
+  public static final int RILUUSTYPE2_REQUIRED = 3;
+  public static final int RILUUSTYPE2_NOT_REQUIRED = 4;
+  public static final int RILUUSTYPE3_REQUIRED = 5;
+  public static final int RILUUSTYPE3_NOT_REQUIRED = 6;
+  
+  // enum RilUusDcs
+  public static final int RILUUSDCS_USP = 0;
+  public static final int RILUUSDCS_OSIHLP = 1;
+  public static final int RILUUSDCS_X244 = 2;
+  public static final int RILUUSDCS_RMCF = 3;
+  public static final int RILUUSDCS_IA5c = 4;
+  
+  // enum RilCallState
+  public static final int CALLSTATE_ACTIVE = 0;
+  public static final int CALLSTATE_HOLDING = 1;
+  public static final int CALLSTATE_DIALING = 2;
+  public static final int CALLSTATE_ALERTING = 3;
+  public static final int CALLSTATE_INCOMING = 4;
+  public static final int CALLSTATE_WAITING = 5;
+  
+  public static final class RilAppStatus extends
+      com.google.protobuf.micro.MessageMicro {
+    public RilAppStatus() {}
+    
+    // optional .ril_proto.RilAppType app_type = 1;
+    public static final int APP_TYPE_FIELD_NUMBER = 1;
+    private boolean hasAppType;
+    private int appType_ = com.android.internal.telephony.ril_proto.RilCmds.APPTYPE_UNKNOWN;
+    public boolean hasAppType() { return hasAppType; }
+    public int getAppType() { return appType_; }
+    public RilAppStatus setAppType(int value) {
+      hasAppType = true;
+      appType_ = value;
+      return this;
+    }
+    public RilAppStatus clearAppType() {
+      hasAppType = false;
+      appType_ = com.android.internal.telephony.ril_proto.RilCmds.APPTYPE_UNKNOWN;
+      return this;
+    }
+    
+    // optional .ril_proto.RilAppState app_state = 2;
+    public static final int APP_STATE_FIELD_NUMBER = 2;
+    private boolean hasAppState;
+    private int appState_ = com.android.internal.telephony.ril_proto.RilCmds.APPSTATE_UNKNOWN;
+    public boolean hasAppState() { return hasAppState; }
+    public int getAppState() { return appState_; }
+    public RilAppStatus setAppState(int value) {
+      hasAppState = true;
+      appState_ = value;
+      return this;
+    }
+    public RilAppStatus clearAppState() {
+      hasAppState = false;
+      appState_ = com.android.internal.telephony.ril_proto.RilCmds.APPSTATE_UNKNOWN;
+      return this;
+    }
+    
+    // optional .ril_proto.RilPersoSubstate perso_substate = 3;
+    public static final int PERSO_SUBSTATE_FIELD_NUMBER = 3;
+    private boolean hasPersoSubstate;
+    private int persoSubstate_ = com.android.internal.telephony.ril_proto.RilCmds.PERSOSUBSTATE_UNKNOWN;
+    public boolean hasPersoSubstate() { return hasPersoSubstate; }
+    public int getPersoSubstate() { return persoSubstate_; }
+    public RilAppStatus setPersoSubstate(int value) {
+      hasPersoSubstate = true;
+      persoSubstate_ = value;
+      return this;
+    }
+    public RilAppStatus clearPersoSubstate() {
+      hasPersoSubstate = false;
+      persoSubstate_ = com.android.internal.telephony.ril_proto.RilCmds.PERSOSUBSTATE_UNKNOWN;
+      return this;
+    }
+    
+    // optional string aid = 4;
+    public static final int AID_FIELD_NUMBER = 4;
+    private boolean hasAid;
+    private java.lang.String aid_ = "";
+    public java.lang.String getAid() { return aid_; }
+    public boolean hasAid() { return hasAid; }
+    public RilAppStatus setAid(java.lang.String value) {
+      hasAid = true;
+      aid_ = value;
+      return this;
+    }
+    public RilAppStatus clearAid() {
+      hasAid = false;
+      aid_ = "";
+      return this;
+    }
+    
+    // optional string app_label = 5;
+    public static final int APP_LABEL_FIELD_NUMBER = 5;
+    private boolean hasAppLabel;
+    private java.lang.String appLabel_ = "";
+    public java.lang.String getAppLabel() { return appLabel_; }
+    public boolean hasAppLabel() { return hasAppLabel; }
+    public RilAppStatus setAppLabel(java.lang.String value) {
+      hasAppLabel = true;
+      appLabel_ = value;
+      return this;
+    }
+    public RilAppStatus clearAppLabel() {
+      hasAppLabel = false;
+      appLabel_ = "";
+      return this;
+    }
+    
+    // optional int32 pin1_replaced = 6;
+    public static final int PIN1_REPLACED_FIELD_NUMBER = 6;
+    private boolean hasPin1Replaced;
+    private int pin1Replaced_ = 0;
+    public int getPin1Replaced() { return pin1Replaced_; }
+    public boolean hasPin1Replaced() { return hasPin1Replaced; }
+    public RilAppStatus setPin1Replaced(int value) {
+      hasPin1Replaced = true;
+      pin1Replaced_ = value;
+      return this;
+    }
+    public RilAppStatus clearPin1Replaced() {
+      hasPin1Replaced = false;
+      pin1Replaced_ = 0;
+      return this;
+    }
+    
+    // optional .ril_proto.RilPinState pin1 = 7;
+    public static final int PIN1_FIELD_NUMBER = 7;
+    private boolean hasPin1;
+    private int pin1_ = com.android.internal.telephony.ril_proto.RilCmds.PINSTATE_UNKNOWN;
+    public boolean hasPin1() { return hasPin1; }
+    public int getPin1() { return pin1_; }
+    public RilAppStatus setPin1(int value) {
+      hasPin1 = true;
+      pin1_ = value;
+      return this;
+    }
+    public RilAppStatus clearPin1() {
+      hasPin1 = false;
+      pin1_ = com.android.internal.telephony.ril_proto.RilCmds.PINSTATE_UNKNOWN;
+      return this;
+    }
+    
+    // optional .ril_proto.RilPinState pin2 = 8;
+    public static final int PIN2_FIELD_NUMBER = 8;
+    private boolean hasPin2;
+    private int pin2_ = com.android.internal.telephony.ril_proto.RilCmds.PINSTATE_UNKNOWN;
+    public boolean hasPin2() { return hasPin2; }
+    public int getPin2() { return pin2_; }
+    public RilAppStatus setPin2(int value) {
+      hasPin2 = true;
+      pin2_ = value;
+      return this;
+    }
+    public RilAppStatus clearPin2() {
+      hasPin2 = false;
+      pin2_ = com.android.internal.telephony.ril_proto.RilCmds.PINSTATE_UNKNOWN;
+      return this;
+    }
+    
+    public final RilAppStatus clear() {
+      clearAppType();
+      clearAppState();
+      clearPersoSubstate();
+      clearAid();
+      clearAppLabel();
+      clearPin1Replaced();
+      clearPin1();
+      clearPin2();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasAppType()) {
+        output.writeInt32(1, getAppType());
+      }
+      if (hasAppState()) {
+        output.writeInt32(2, getAppState());
+      }
+      if (hasPersoSubstate()) {
+        output.writeInt32(3, getPersoSubstate());
+      }
+      if (hasAid()) {
+        output.writeString(4, getAid());
+      }
+      if (hasAppLabel()) {
+        output.writeString(5, getAppLabel());
+      }
+      if (hasPin1Replaced()) {
+        output.writeInt32(6, getPin1Replaced());
+      }
+      if (hasPin1()) {
+        output.writeInt32(7, getPin1());
+      }
+      if (hasPin2()) {
+        output.writeInt32(8, getPin2());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasAppType()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getAppType());
+      }
+      if (hasAppState()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(2, getAppState());
+      }
+      if (hasPersoSubstate()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(3, getPersoSubstate());
+      }
+      if (hasAid()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(4, getAid());
+      }
+      if (hasAppLabel()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(5, getAppLabel());
+      }
+      if (hasPin1Replaced()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(6, getPin1Replaced());
+      }
+      if (hasPin1()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(7, getPin1());
+      }
+      if (hasPin2()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(8, getPin2());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RilAppStatus mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+              setAppType(input.readInt32());
+            break;
+          }
+          case 16: {
+              setAppState(input.readInt32());
+            break;
+          }
+          case 24: {
+              setPersoSubstate(input.readInt32());
+            break;
+          }
+          case 34: {
+            setAid(input.readString());
+            break;
+          }
+          case 42: {
+            setAppLabel(input.readString());
+            break;
+          }
+          case 48: {
+            setPin1Replaced(input.readInt32());
+            break;
+          }
+          case 56: {
+              setPin1(input.readInt32());
+            break;
+          }
+          case 64: {
+              setPin2(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RilAppStatus parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RilAppStatus) (new RilAppStatus().mergeFrom(data));
+    }
+    
+    public static RilAppStatus parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RilAppStatus) (new RilAppStatus().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RilCardStatus extends
+      com.google.protobuf.micro.MessageMicro {
+    public RilCardStatus() {}
+    
+    // optional .ril_proto.RilCardState card_state = 1;
+    public static final int CARD_STATE_FIELD_NUMBER = 1;
+    private boolean hasCardState;
+    private int cardState_ = com.android.internal.telephony.ril_proto.RilCmds.CARDSTATE_ABSENT;
+    public boolean hasCardState() { return hasCardState; }
+    public int getCardState() { return cardState_; }
+    public RilCardStatus setCardState(int value) {
+      hasCardState = true;
+      cardState_ = value;
+      return this;
+    }
+    public RilCardStatus clearCardState() {
+      hasCardState = false;
+      cardState_ = com.android.internal.telephony.ril_proto.RilCmds.CARDSTATE_ABSENT;
+      return this;
+    }
+    
+    // optional .ril_proto.RilPinState universal_pin_state = 2;
+    public static final int UNIVERSAL_PIN_STATE_FIELD_NUMBER = 2;
+    private boolean hasUniversalPinState;
+    private int universalPinState_ = com.android.internal.telephony.ril_proto.RilCmds.PINSTATE_UNKNOWN;
+    public boolean hasUniversalPinState() { return hasUniversalPinState; }
+    public int getUniversalPinState() { return universalPinState_; }
+    public RilCardStatus setUniversalPinState(int value) {
+      hasUniversalPinState = true;
+      universalPinState_ = value;
+      return this;
+    }
+    public RilCardStatus clearUniversalPinState() {
+      hasUniversalPinState = false;
+      universalPinState_ = com.android.internal.telephony.ril_proto.RilCmds.PINSTATE_UNKNOWN;
+      return this;
+    }
+    
+    // optional int32 gsm_umts_subscription_app_index = 3;
+    public static final int GSM_UMTS_SUBSCRIPTION_APP_INDEX_FIELD_NUMBER = 3;
+    private boolean hasGsmUmtsSubscriptionAppIndex;
+    private int gsmUmtsSubscriptionAppIndex_ = 0;
+    public int getGsmUmtsSubscriptionAppIndex() { return gsmUmtsSubscriptionAppIndex_; }
+    public boolean hasGsmUmtsSubscriptionAppIndex() { return hasGsmUmtsSubscriptionAppIndex; }
+    public RilCardStatus setGsmUmtsSubscriptionAppIndex(int value) {
+      hasGsmUmtsSubscriptionAppIndex = true;
+      gsmUmtsSubscriptionAppIndex_ = value;
+      return this;
+    }
+    public RilCardStatus clearGsmUmtsSubscriptionAppIndex() {
+      hasGsmUmtsSubscriptionAppIndex = false;
+      gsmUmtsSubscriptionAppIndex_ = 0;
+      return this;
+    }
+    
+    // optional int32 cdma_subscription_app_index = 4;
+    public static final int CDMA_SUBSCRIPTION_APP_INDEX_FIELD_NUMBER = 4;
+    private boolean hasCdmaSubscriptionAppIndex;
+    private int cdmaSubscriptionAppIndex_ = 0;
+    public int getCdmaSubscriptionAppIndex() { return cdmaSubscriptionAppIndex_; }
+    public boolean hasCdmaSubscriptionAppIndex() { return hasCdmaSubscriptionAppIndex; }
+    public RilCardStatus setCdmaSubscriptionAppIndex(int value) {
+      hasCdmaSubscriptionAppIndex = true;
+      cdmaSubscriptionAppIndex_ = value;
+      return this;
+    }
+    public RilCardStatus clearCdmaSubscriptionAppIndex() {
+      hasCdmaSubscriptionAppIndex = false;
+      cdmaSubscriptionAppIndex_ = 0;
+      return this;
+    }
+    
+    // optional int32 num_applications = 5;
+    public static final int NUM_APPLICATIONS_FIELD_NUMBER = 5;
+    private boolean hasNumApplications;
+    private int numApplications_ = 0;
+    public int getNumApplications() { return numApplications_; }
+    public boolean hasNumApplications() { return hasNumApplications; }
+    public RilCardStatus setNumApplications(int value) {
+      hasNumApplications = true;
+      numApplications_ = value;
+      return this;
+    }
+    public RilCardStatus clearNumApplications() {
+      hasNumApplications = false;
+      numApplications_ = 0;
+      return this;
+    }
+    
+    // repeated .ril_proto.RilAppStatus applications = 6;
+    public static final int APPLICATIONS_FIELD_NUMBER = 6;
+    private java.util.List<com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus> applications_ =
+      java.util.Collections.emptyList();
+    public java.util.List<com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus> getApplicationsList() {
+      return applications_;
+    }
+    public int getApplicationsCount() { return applications_.size(); }
+    public com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus getApplications(int index) {
+      return applications_.get(index);
+    }
+    public RilCardStatus setApplications(int index, com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      applications_.set(index, value);
+      return this;
+    }
+    public RilCardStatus addApplications(com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      if (applications_.isEmpty()) {
+        applications_ = new java.util.ArrayList<com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus>();
+      }
+      applications_.add(value);
+      return this;
+    }
+    public RilCardStatus clearApplications() {
+      applications_ = java.util.Collections.emptyList();
+      return this;
+    }
+    
+    public final RilCardStatus clear() {
+      clearCardState();
+      clearUniversalPinState();
+      clearGsmUmtsSubscriptionAppIndex();
+      clearCdmaSubscriptionAppIndex();
+      clearNumApplications();
+      clearApplications();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasCardState()) {
+        output.writeInt32(1, getCardState());
+      }
+      if (hasUniversalPinState()) {
+        output.writeInt32(2, getUniversalPinState());
+      }
+      if (hasGsmUmtsSubscriptionAppIndex()) {
+        output.writeInt32(3, getGsmUmtsSubscriptionAppIndex());
+      }
+      if (hasCdmaSubscriptionAppIndex()) {
+        output.writeInt32(4, getCdmaSubscriptionAppIndex());
+      }
+      if (hasNumApplications()) {
+        output.writeInt32(5, getNumApplications());
+      }
+      for (com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus element : getApplicationsList()) {
+        output.writeMessage(6, element);
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasCardState()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getCardState());
+      }
+      if (hasUniversalPinState()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(2, getUniversalPinState());
+      }
+      if (hasGsmUmtsSubscriptionAppIndex()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(3, getGsmUmtsSubscriptionAppIndex());
+      }
+      if (hasCdmaSubscriptionAppIndex()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(4, getCdmaSubscriptionAppIndex());
+      }
+      if (hasNumApplications()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(5, getNumApplications());
+      }
+      for (com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus element : getApplicationsList()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeMessageSize(6, element);
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RilCardStatus mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+              setCardState(input.readInt32());
+            break;
+          }
+          case 16: {
+              setUniversalPinState(input.readInt32());
+            break;
+          }
+          case 24: {
+            setGsmUmtsSubscriptionAppIndex(input.readInt32());
+            break;
+          }
+          case 32: {
+            setCdmaSubscriptionAppIndex(input.readInt32());
+            break;
+          }
+          case 40: {
+            setNumApplications(input.readInt32());
+            break;
+          }
+          case 50: {
+            com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus value = new com.android.internal.telephony.ril_proto.RilCmds.RilAppStatus();
+            input.readMessage(value);
+            addApplications(value);
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RilCardStatus parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RilCardStatus) (new RilCardStatus().mergeFrom(data));
+    }
+    
+    public static RilCardStatus parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RilCardStatus) (new RilCardStatus().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RilUusInfo extends
+      com.google.protobuf.micro.MessageMicro {
+    public RilUusInfo() {}
+    
+    // optional .ril_proto.RilUusType uus_type = 1;
+    public static final int UUS_TYPE_FIELD_NUMBER = 1;
+    private boolean hasUusType;
+    private int uusType_ = com.android.internal.telephony.ril_proto.RilCmds.RILUUSTYPE1_IMPLICIT;
+    public boolean hasUusType() { return hasUusType; }
+    public int getUusType() { return uusType_; }
+    public RilUusInfo setUusType(int value) {
+      hasUusType = true;
+      uusType_ = value;
+      return this;
+    }
+    public RilUusInfo clearUusType() {
+      hasUusType = false;
+      uusType_ = com.android.internal.telephony.ril_proto.RilCmds.RILUUSTYPE1_IMPLICIT;
+      return this;
+    }
+    
+    // optional .ril_proto.RilUusDcs uus_dcs = 2;
+    public static final int UUS_DCS_FIELD_NUMBER = 2;
+    private boolean hasUusDcs;
+    private int uusDcs_ = com.android.internal.telephony.ril_proto.RilCmds.RILUUSDCS_USP;
+    public boolean hasUusDcs() { return hasUusDcs; }
+    public int getUusDcs() { return uusDcs_; }
+    public RilUusInfo setUusDcs(int value) {
+      hasUusDcs = true;
+      uusDcs_ = value;
+      return this;
+    }
+    public RilUusInfo clearUusDcs() {
+      hasUusDcs = false;
+      uusDcs_ = com.android.internal.telephony.ril_proto.RilCmds.RILUUSDCS_USP;
+      return this;
+    }
+    
+    // optional int32 uus_length = 3;
+    public static final int UUS_LENGTH_FIELD_NUMBER = 3;
+    private boolean hasUusLength;
+    private int uusLength_ = 0;
+    public int getUusLength() { return uusLength_; }
+    public boolean hasUusLength() { return hasUusLength; }
+    public RilUusInfo setUusLength(int value) {
+      hasUusLength = true;
+      uusLength_ = value;
+      return this;
+    }
+    public RilUusInfo clearUusLength() {
+      hasUusLength = false;
+      uusLength_ = 0;
+      return this;
+    }
+    
+    // optional string uus_data = 4;
+    public static final int UUS_DATA_FIELD_NUMBER = 4;
+    private boolean hasUusData;
+    private java.lang.String uusData_ = "";
+    public java.lang.String getUusData() { return uusData_; }
+    public boolean hasUusData() { return hasUusData; }
+    public RilUusInfo setUusData(java.lang.String value) {
+      hasUusData = true;
+      uusData_ = value;
+      return this;
+    }
+    public RilUusInfo clearUusData() {
+      hasUusData = false;
+      uusData_ = "";
+      return this;
+    }
+    
+    public final RilUusInfo clear() {
+      clearUusType();
+      clearUusDcs();
+      clearUusLength();
+      clearUusData();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasUusType()) {
+        output.writeInt32(1, getUusType());
+      }
+      if (hasUusDcs()) {
+        output.writeInt32(2, getUusDcs());
+      }
+      if (hasUusLength()) {
+        output.writeInt32(3, getUusLength());
+      }
+      if (hasUusData()) {
+        output.writeString(4, getUusData());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasUusType()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getUusType());
+      }
+      if (hasUusDcs()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(2, getUusDcs());
+      }
+      if (hasUusLength()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(3, getUusLength());
+      }
+      if (hasUusData()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(4, getUusData());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RilUusInfo mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+              setUusType(input.readInt32());
+            break;
+          }
+          case 16: {
+              setUusDcs(input.readInt32());
+            break;
+          }
+          case 24: {
+            setUusLength(input.readInt32());
+            break;
+          }
+          case 34: {
+            setUusData(input.readString());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RilUusInfo parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RilUusInfo) (new RilUusInfo().mergeFrom(data));
+    }
+    
+    public static RilUusInfo parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RilUusInfo) (new RilUusInfo().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RilCall extends
+      com.google.protobuf.micro.MessageMicro {
+    public RilCall() {}
+    
+    // optional .ril_proto.RilCallState state = 1;
+    public static final int STATE_FIELD_NUMBER = 1;
+    private boolean hasState;
+    private int state_ = com.android.internal.telephony.ril_proto.RilCmds.CALLSTATE_ACTIVE;
+    public boolean hasState() { return hasState; }
+    public int getState() { return state_; }
+    public RilCall setState(int value) {
+      hasState = true;
+      state_ = value;
+      return this;
+    }
+    public RilCall clearState() {
+      hasState = false;
+      state_ = com.android.internal.telephony.ril_proto.RilCmds.CALLSTATE_ACTIVE;
+      return this;
+    }
+    
+    // optional int32 index = 2;
+    public static final int INDEX_FIELD_NUMBER = 2;
+    private boolean hasIndex;
+    private int index_ = 0;
+    public int getIndex() { return index_; }
+    public boolean hasIndex() { return hasIndex; }
+    public RilCall setIndex(int value) {
+      hasIndex = true;
+      index_ = value;
+      return this;
+    }
+    public RilCall clearIndex() {
+      hasIndex = false;
+      index_ = 0;
+      return this;
+    }
+    
+    // optional int32 toa = 3;
+    public static final int TOA_FIELD_NUMBER = 3;
+    private boolean hasToa;
+    private int toa_ = 0;
+    public int getToa() { return toa_; }
+    public boolean hasToa() { return hasToa; }
+    public RilCall setToa(int value) {
+      hasToa = true;
+      toa_ = value;
+      return this;
+    }
+    public RilCall clearToa() {
+      hasToa = false;
+      toa_ = 0;
+      return this;
+    }
+    
+    // optional bool is_mpty = 4;
+    public static final int IS_MPTY_FIELD_NUMBER = 4;
+    private boolean hasIsMpty;
+    private boolean isMpty_ = false;
+    public boolean getIsMpty() { return isMpty_; }
+    public boolean hasIsMpty() { return hasIsMpty; }
+    public RilCall setIsMpty(boolean value) {
+      hasIsMpty = true;
+      isMpty_ = value;
+      return this;
+    }
+    public RilCall clearIsMpty() {
+      hasIsMpty = false;
+      isMpty_ = false;
+      return this;
+    }
+    
+    // optional bool is_mt = 5;
+    public static final int IS_MT_FIELD_NUMBER = 5;
+    private boolean hasIsMt;
+    private boolean isMt_ = false;
+    public boolean getIsMt() { return isMt_; }
+    public boolean hasIsMt() { return hasIsMt; }
+    public RilCall setIsMt(boolean value) {
+      hasIsMt = true;
+      isMt_ = value;
+      return this;
+    }
+    public RilCall clearIsMt() {
+      hasIsMt = false;
+      isMt_ = false;
+      return this;
+    }
+    
+    // optional int32 als = 6;
+    public static final int ALS_FIELD_NUMBER = 6;
+    private boolean hasAls;
+    private int als_ = 0;
+    public int getAls() { return als_; }
+    public boolean hasAls() { return hasAls; }
+    public RilCall setAls(int value) {
+      hasAls = true;
+      als_ = value;
+      return this;
+    }
+    public RilCall clearAls() {
+      hasAls = false;
+      als_ = 0;
+      return this;
+    }
+    
+    // optional bool is_voice = 7;
+    public static final int IS_VOICE_FIELD_NUMBER = 7;
+    private boolean hasIsVoice;
+    private boolean isVoice_ = false;
+    public boolean getIsVoice() { return isVoice_; }
+    public boolean hasIsVoice() { return hasIsVoice; }
+    public RilCall setIsVoice(boolean value) {
+      hasIsVoice = true;
+      isVoice_ = value;
+      return this;
+    }
+    public RilCall clearIsVoice() {
+      hasIsVoice = false;
+      isVoice_ = false;
+      return this;
+    }
+    
+    // optional bool is_voice_privacy = 8;
+    public static final int IS_VOICE_PRIVACY_FIELD_NUMBER = 8;
+    private boolean hasIsVoicePrivacy;
+    private boolean isVoicePrivacy_ = false;
+    public boolean getIsVoicePrivacy() { return isVoicePrivacy_; }
+    public boolean hasIsVoicePrivacy() { return hasIsVoicePrivacy; }
+    public RilCall setIsVoicePrivacy(boolean value) {
+      hasIsVoicePrivacy = true;
+      isVoicePrivacy_ = value;
+      return this;
+    }
+    public RilCall clearIsVoicePrivacy() {
+      hasIsVoicePrivacy = false;
+      isVoicePrivacy_ = false;
+      return this;
+    }
+    
+    // optional string number = 9;
+    public static final int NUMBER_FIELD_NUMBER = 9;
+    private boolean hasNumber;
+    private java.lang.String number_ = "";
+    public java.lang.String getNumber() { return number_; }
+    public boolean hasNumber() { return hasNumber; }
+    public RilCall setNumber(java.lang.String value) {
+      hasNumber = true;
+      number_ = value;
+      return this;
+    }
+    public RilCall clearNumber() {
+      hasNumber = false;
+      number_ = "";
+      return this;
+    }
+    
+    // optional int32 number_presentation = 10;
+    public static final int NUMBER_PRESENTATION_FIELD_NUMBER = 10;
+    private boolean hasNumberPresentation;
+    private int numberPresentation_ = 0;
+    public int getNumberPresentation() { return numberPresentation_; }
+    public boolean hasNumberPresentation() { return hasNumberPresentation; }
+    public RilCall setNumberPresentation(int value) {
+      hasNumberPresentation = true;
+      numberPresentation_ = value;
+      return this;
+    }
+    public RilCall clearNumberPresentation() {
+      hasNumberPresentation = false;
+      numberPresentation_ = 0;
+      return this;
+    }
+    
+    // optional string name = 11;
+    public static final int NAME_FIELD_NUMBER = 11;
+    private boolean hasName;
+    private java.lang.String name_ = "";
+    public java.lang.String getName() { return name_; }
+    public boolean hasName() { return hasName; }
+    public RilCall setName(java.lang.String value) {
+      hasName = true;
+      name_ = value;
+      return this;
+    }
+    public RilCall clearName() {
+      hasName = false;
+      name_ = "";
+      return this;
+    }
+    
+    // optional int32 name_presentation = 12;
+    public static final int NAME_PRESENTATION_FIELD_NUMBER = 12;
+    private boolean hasNamePresentation;
+    private int namePresentation_ = 0;
+    public int getNamePresentation() { return namePresentation_; }
+    public boolean hasNamePresentation() { return hasNamePresentation; }
+    public RilCall setNamePresentation(int value) {
+      hasNamePresentation = true;
+      namePresentation_ = value;
+      return this;
+    }
+    public RilCall clearNamePresentation() {
+      hasNamePresentation = false;
+      namePresentation_ = 0;
+      return this;
+    }
+    
+    // optional .ril_proto.RilUusInfo uus_info = 13;
+    public static final int UUS_INFO_FIELD_NUMBER = 13;
+    private boolean hasUusInfo;
+    private com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo uusInfo_ = null;
+    public boolean hasUusInfo() { return hasUusInfo; }
+    public com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo getUusInfo() { return uusInfo_; }
+    public RilCall setUusInfo(com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      hasUusInfo = true;
+      uusInfo_ = value;
+      return this;
+    }
+    public RilCall clearUusInfo() {
+      hasUusInfo = false;
+      uusInfo_ = null;
+      return this;
+    }
+    
+    public final RilCall clear() {
+      clearState();
+      clearIndex();
+      clearToa();
+      clearIsMpty();
+      clearIsMt();
+      clearAls();
+      clearIsVoice();
+      clearIsVoicePrivacy();
+      clearNumber();
+      clearNumberPresentation();
+      clearName();
+      clearNamePresentation();
+      clearUusInfo();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasState()) {
+        output.writeInt32(1, getState());
+      }
+      if (hasIndex()) {
+        output.writeInt32(2, getIndex());
+      }
+      if (hasToa()) {
+        output.writeInt32(3, getToa());
+      }
+      if (hasIsMpty()) {
+        output.writeBool(4, getIsMpty());
+      }
+      if (hasIsMt()) {
+        output.writeBool(5, getIsMt());
+      }
+      if (hasAls()) {
+        output.writeInt32(6, getAls());
+      }
+      if (hasIsVoice()) {
+        output.writeBool(7, getIsVoice());
+      }
+      if (hasIsVoicePrivacy()) {
+        output.writeBool(8, getIsVoicePrivacy());
+      }
+      if (hasNumber()) {
+        output.writeString(9, getNumber());
+      }
+      if (hasNumberPresentation()) {
+        output.writeInt32(10, getNumberPresentation());
+      }
+      if (hasName()) {
+        output.writeString(11, getName());
+      }
+      if (hasNamePresentation()) {
+        output.writeInt32(12, getNamePresentation());
+      }
+      if (hasUusInfo()) {
+        output.writeMessage(13, getUusInfo());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasState()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getState());
+      }
+      if (hasIndex()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(2, getIndex());
+      }
+      if (hasToa()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(3, getToa());
+      }
+      if (hasIsMpty()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeBoolSize(4, getIsMpty());
+      }
+      if (hasIsMt()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeBoolSize(5, getIsMt());
+      }
+      if (hasAls()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(6, getAls());
+      }
+      if (hasIsVoice()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeBoolSize(7, getIsVoice());
+      }
+      if (hasIsVoicePrivacy()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeBoolSize(8, getIsVoicePrivacy());
+      }
+      if (hasNumber()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(9, getNumber());
+      }
+      if (hasNumberPresentation()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(10, getNumberPresentation());
+      }
+      if (hasName()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(11, getName());
+      }
+      if (hasNamePresentation()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(12, getNamePresentation());
+      }
+      if (hasUusInfo()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeMessageSize(13, getUusInfo());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RilCall mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+              setState(input.readInt32());
+            break;
+          }
+          case 16: {
+            setIndex(input.readInt32());
+            break;
+          }
+          case 24: {
+            setToa(input.readInt32());
+            break;
+          }
+          case 32: {
+            setIsMpty(input.readBool());
+            break;
+          }
+          case 40: {
+            setIsMt(input.readBool());
+            break;
+          }
+          case 48: {
+            setAls(input.readInt32());
+            break;
+          }
+          case 56: {
+            setIsVoice(input.readBool());
+            break;
+          }
+          case 64: {
+            setIsVoicePrivacy(input.readBool());
+            break;
+          }
+          case 74: {
+            setNumber(input.readString());
+            break;
+          }
+          case 80: {
+            setNumberPresentation(input.readInt32());
+            break;
+          }
+          case 90: {
+            setName(input.readString());
+            break;
+          }
+          case 96: {
+            setNamePresentation(input.readInt32());
+            break;
+          }
+          case 106: {
+            com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo value = new com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo();
+            input.readMessage(value);
+            setUusInfo(value);
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RilCall parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RilCall) (new RilCall().mergeFrom(data));
+    }
+    
+    public static RilCall parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RilCall) (new RilCall().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RILGWSignalStrength extends
+      com.google.protobuf.micro.MessageMicro {
+    public RILGWSignalStrength() {}
+    
+    // optional int32 signal_strength = 1;
+    public static final int SIGNAL_STRENGTH_FIELD_NUMBER = 1;
+    private boolean hasSignalStrength;
+    private int signalStrength_ = 0;
+    public int getSignalStrength() { return signalStrength_; }
+    public boolean hasSignalStrength() { return hasSignalStrength; }
+    public RILGWSignalStrength setSignalStrength(int value) {
+      hasSignalStrength = true;
+      signalStrength_ = value;
+      return this;
+    }
+    public RILGWSignalStrength clearSignalStrength() {
+      hasSignalStrength = false;
+      signalStrength_ = 0;
+      return this;
+    }
+    
+    // optional int32 bit_error_rate = 2;
+    public static final int BIT_ERROR_RATE_FIELD_NUMBER = 2;
+    private boolean hasBitErrorRate;
+    private int bitErrorRate_ = 0;
+    public int getBitErrorRate() { return bitErrorRate_; }
+    public boolean hasBitErrorRate() { return hasBitErrorRate; }
+    public RILGWSignalStrength setBitErrorRate(int value) {
+      hasBitErrorRate = true;
+      bitErrorRate_ = value;
+      return this;
+    }
+    public RILGWSignalStrength clearBitErrorRate() {
+      hasBitErrorRate = false;
+      bitErrorRate_ = 0;
+      return this;
+    }
+    
+    public final RILGWSignalStrength clear() {
+      clearSignalStrength();
+      clearBitErrorRate();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasSignalStrength()) {
+        output.writeInt32(1, getSignalStrength());
+      }
+      if (hasBitErrorRate()) {
+        output.writeInt32(2, getBitErrorRate());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasSignalStrength()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getSignalStrength());
+      }
+      if (hasBitErrorRate()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(2, getBitErrorRate());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RILGWSignalStrength mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            setSignalStrength(input.readInt32());
+            break;
+          }
+          case 16: {
+            setBitErrorRate(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RILGWSignalStrength parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RILGWSignalStrength) (new RILGWSignalStrength().mergeFrom(data));
+    }
+    
+    public static RILGWSignalStrength parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RILGWSignalStrength) (new RILGWSignalStrength().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RILCDMASignalStrength extends
+      com.google.protobuf.micro.MessageMicro {
+    public RILCDMASignalStrength() {}
+    
+    // optional int32 dbm = 1;
+    public static final int DBM_FIELD_NUMBER = 1;
+    private boolean hasDbm;
+    private int dbm_ = 0;
+    public int getDbm() { return dbm_; }
+    public boolean hasDbm() { return hasDbm; }
+    public RILCDMASignalStrength setDbm(int value) {
+      hasDbm = true;
+      dbm_ = value;
+      return this;
+    }
+    public RILCDMASignalStrength clearDbm() {
+      hasDbm = false;
+      dbm_ = 0;
+      return this;
+    }
+    
+    // optional int32 ecio = 2;
+    public static final int ECIO_FIELD_NUMBER = 2;
+    private boolean hasEcio;
+    private int ecio_ = 0;
+    public int getEcio() { return ecio_; }
+    public boolean hasEcio() { return hasEcio; }
+    public RILCDMASignalStrength setEcio(int value) {
+      hasEcio = true;
+      ecio_ = value;
+      return this;
+    }
+    public RILCDMASignalStrength clearEcio() {
+      hasEcio = false;
+      ecio_ = 0;
+      return this;
+    }
+    
+    public final RILCDMASignalStrength clear() {
+      clearDbm();
+      clearEcio();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasDbm()) {
+        output.writeInt32(1, getDbm());
+      }
+      if (hasEcio()) {
+        output.writeInt32(2, getEcio());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasDbm()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getDbm());
+      }
+      if (hasEcio()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(2, getEcio());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RILCDMASignalStrength mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            setDbm(input.readInt32());
+            break;
+          }
+          case 16: {
+            setEcio(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RILCDMASignalStrength parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RILCDMASignalStrength) (new RILCDMASignalStrength().mergeFrom(data));
+    }
+    
+    public static RILCDMASignalStrength parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RILCDMASignalStrength) (new RILCDMASignalStrength().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RILEVDOSignalStrength extends
+      com.google.protobuf.micro.MessageMicro {
+    public RILEVDOSignalStrength() {}
+    
+    // optional int32 dbm = 1;
+    public static final int DBM_FIELD_NUMBER = 1;
+    private boolean hasDbm;
+    private int dbm_ = 0;
+    public int getDbm() { return dbm_; }
+    public boolean hasDbm() { return hasDbm; }
+    public RILEVDOSignalStrength setDbm(int value) {
+      hasDbm = true;
+      dbm_ = value;
+      return this;
+    }
+    public RILEVDOSignalStrength clearDbm() {
+      hasDbm = false;
+      dbm_ = 0;
+      return this;
+    }
+    
+    // optional int32 ecio = 2;
+    public static final int ECIO_FIELD_NUMBER = 2;
+    private boolean hasEcio;
+    private int ecio_ = 0;
+    public int getEcio() { return ecio_; }
+    public boolean hasEcio() { return hasEcio; }
+    public RILEVDOSignalStrength setEcio(int value) {
+      hasEcio = true;
+      ecio_ = value;
+      return this;
+    }
+    public RILEVDOSignalStrength clearEcio() {
+      hasEcio = false;
+      ecio_ = 0;
+      return this;
+    }
+    
+    // optional int32 signal_noise_ratio = 3;
+    public static final int SIGNAL_NOISE_RATIO_FIELD_NUMBER = 3;
+    private boolean hasSignalNoiseRatio;
+    private int signalNoiseRatio_ = 0;
+    public int getSignalNoiseRatio() { return signalNoiseRatio_; }
+    public boolean hasSignalNoiseRatio() { return hasSignalNoiseRatio; }
+    public RILEVDOSignalStrength setSignalNoiseRatio(int value) {
+      hasSignalNoiseRatio = true;
+      signalNoiseRatio_ = value;
+      return this;
+    }
+    public RILEVDOSignalStrength clearSignalNoiseRatio() {
+      hasSignalNoiseRatio = false;
+      signalNoiseRatio_ = 0;
+      return this;
+    }
+    
+    public final RILEVDOSignalStrength clear() {
+      clearDbm();
+      clearEcio();
+      clearSignalNoiseRatio();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasDbm()) {
+        output.writeInt32(1, getDbm());
+      }
+      if (hasEcio()) {
+        output.writeInt32(2, getEcio());
+      }
+      if (hasSignalNoiseRatio()) {
+        output.writeInt32(3, getSignalNoiseRatio());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasDbm()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getDbm());
+      }
+      if (hasEcio()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(2, getEcio());
+      }
+      if (hasSignalNoiseRatio()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(3, getSignalNoiseRatio());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RILEVDOSignalStrength mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            setDbm(input.readInt32());
+            break;
+          }
+          case 16: {
+            setEcio(input.readInt32());
+            break;
+          }
+          case 24: {
+            setSignalNoiseRatio(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RILEVDOSignalStrength parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RILEVDOSignalStrength) (new RILEVDOSignalStrength().mergeFrom(data));
+    }
+    
+    public static RILEVDOSignalStrength parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RILEVDOSignalStrength) (new RILEVDOSignalStrength().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RspStrings extends
+      com.google.protobuf.micro.MessageMicro {
+    public RspStrings() {}
+    
+    // repeated string strings = 1;
+    public static final int STRINGS_FIELD_NUMBER = 1;
+    private java.util.List<java.lang.String> strings_ =
+      java.util.Collections.emptyList();
+    public java.util.List<java.lang.String> getStringsList() {
+      return strings_;
+    }
+    public int getStringsCount() { return strings_.size(); }
+    public java.lang.String getStrings(int index) {
+      return strings_.get(index);
+    }
+    public RspStrings setStrings(int index, java.lang.String value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  strings_.set(index, value);
+      return this;
+    }
+    public RspStrings addStrings(java.lang.String value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  if (strings_.isEmpty()) {
+        strings_ = new java.util.ArrayList<java.lang.String>();
+      }
+      strings_.add(value);
+      return this;
+    }
+    public RspStrings clearStrings() {
+      strings_ = java.util.Collections.emptyList();
+      return this;
+    }
+    
+    public final RspStrings clear() {
+      clearStrings();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      for (java.lang.String element : getStringsList()) {
+        output.writeString(1, element);
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      {
+        int dataSize = 0;
+        for (java.lang.String element : getStringsList()) {
+          dataSize += com.google.protobuf.micro.CodedOutputStreamMicro
+            .computeStringSizeNoTag(element);
+        }
+        size += dataSize;
+        size += 1 * getStringsList().size();
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RspStrings mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 10: {
+            addStrings(input.readString());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RspStrings parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RspStrings) (new RspStrings().mergeFrom(data));
+    }
+    
+    public static RspStrings parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RspStrings) (new RspStrings().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RspIntegers extends
+      com.google.protobuf.micro.MessageMicro {
+    public RspIntegers() {}
+    
+    // repeated int32 integers = 1;
+    public static final int INTEGERS_FIELD_NUMBER = 1;
+    private java.util.List<java.lang.Integer> integers_ =
+      java.util.Collections.emptyList();
+    public java.util.List<java.lang.Integer> getIntegersList() {
+      return integers_;
+    }
+    public int getIntegersCount() { return integers_.size(); }
+    public int getIntegers(int index) {
+      return integers_.get(index);
+    }
+    public RspIntegers setIntegers(int index, int value) {
+      integers_.set(index, value);
+      return this;
+    }
+    public RspIntegers addIntegers(int value) {
+      if (integers_.isEmpty()) {
+        integers_ = new java.util.ArrayList<java.lang.Integer>();
+      }
+      integers_.add(value);
+      return this;
+    }
+    public RspIntegers clearIntegers() {
+      integers_ = java.util.Collections.emptyList();
+      return this;
+    }
+    
+    public final RspIntegers clear() {
+      clearIntegers();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      for (int element : getIntegersList()) {
+        output.writeInt32(1, element);
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      {
+        int dataSize = 0;
+        for (int element : getIntegersList()) {
+          dataSize += com.google.protobuf.micro.CodedOutputStreamMicro
+            .computeInt32SizeNoTag(element);
+        }
+        size += dataSize;
+        size += 1 * getIntegersList().size();
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RspIntegers mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            addIntegers(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RspIntegers parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RspIntegers) (new RspIntegers().mergeFrom(data));
+    }
+    
+    public static RspIntegers parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RspIntegers) (new RspIntegers().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RspGetSimStatus extends
+      com.google.protobuf.micro.MessageMicro {
+    public RspGetSimStatus() {}
+    
+    // required .ril_proto.RilCardStatus card_status = 1;
+    public static final int CARD_STATUS_FIELD_NUMBER = 1;
+    private boolean hasCardStatus;
+    private com.android.internal.telephony.ril_proto.RilCmds.RilCardStatus cardStatus_ = null;
+    public boolean hasCardStatus() { return hasCardStatus; }
+    public com.android.internal.telephony.ril_proto.RilCmds.RilCardStatus getCardStatus() { return cardStatus_; }
+    public RspGetSimStatus setCardStatus(com.android.internal.telephony.ril_proto.RilCmds.RilCardStatus value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      hasCardStatus = true;
+      cardStatus_ = value;
+      return this;
+    }
+    public RspGetSimStatus clearCardStatus() {
+      hasCardStatus = false;
+      cardStatus_ = null;
+      return this;
+    }
+    
+    public final RspGetSimStatus clear() {
+      clearCardStatus();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasCardStatus) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasCardStatus()) {
+        output.writeMessage(1, getCardStatus());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasCardStatus()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeMessageSize(1, getCardStatus());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RspGetSimStatus mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 10: {
+            com.android.internal.telephony.ril_proto.RilCmds.RilCardStatus value = new com.android.internal.telephony.ril_proto.RilCmds.RilCardStatus();
+            input.readMessage(value);
+            setCardStatus(value);
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RspGetSimStatus parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RspGetSimStatus) (new RspGetSimStatus().mergeFrom(data));
+    }
+    
+    public static RspGetSimStatus parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RspGetSimStatus) (new RspGetSimStatus().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class ReqEnterSimPin extends
+      com.google.protobuf.micro.MessageMicro {
+    public ReqEnterSimPin() {}
+    
+    // required string pin = 1;
+    public static final int PIN_FIELD_NUMBER = 1;
+    private boolean hasPin;
+    private java.lang.String pin_ = "";
+    public java.lang.String getPin() { return pin_; }
+    public boolean hasPin() { return hasPin; }
+    public ReqEnterSimPin setPin(java.lang.String value) {
+      hasPin = true;
+      pin_ = value;
+      return this;
+    }
+    public ReqEnterSimPin clearPin() {
+      hasPin = false;
+      pin_ = "";
+      return this;
+    }
+    
+    public final ReqEnterSimPin clear() {
+      clearPin();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasPin) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasPin()) {
+        output.writeString(1, getPin());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasPin()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(1, getPin());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public ReqEnterSimPin mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 10: {
+            setPin(input.readString());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static ReqEnterSimPin parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (ReqEnterSimPin) (new ReqEnterSimPin().mergeFrom(data));
+    }
+    
+    public static ReqEnterSimPin parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (ReqEnterSimPin) (new ReqEnterSimPin().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RspEnterSimPin extends
+      com.google.protobuf.micro.MessageMicro {
+    public RspEnterSimPin() {}
+    
+    // required int32 retries_remaining = 1;
+    public static final int RETRIES_REMAINING_FIELD_NUMBER = 1;
+    private boolean hasRetriesRemaining;
+    private int retriesRemaining_ = 0;
+    public int getRetriesRemaining() { return retriesRemaining_; }
+    public boolean hasRetriesRemaining() { return hasRetriesRemaining; }
+    public RspEnterSimPin setRetriesRemaining(int value) {
+      hasRetriesRemaining = true;
+      retriesRemaining_ = value;
+      return this;
+    }
+    public RspEnterSimPin clearRetriesRemaining() {
+      hasRetriesRemaining = false;
+      retriesRemaining_ = 0;
+      return this;
+    }
+    
+    public final RspEnterSimPin clear() {
+      clearRetriesRemaining();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasRetriesRemaining) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasRetriesRemaining()) {
+        output.writeInt32(1, getRetriesRemaining());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasRetriesRemaining()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getRetriesRemaining());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RspEnterSimPin mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            setRetriesRemaining(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RspEnterSimPin parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RspEnterSimPin) (new RspEnterSimPin().mergeFrom(data));
+    }
+    
+    public static RspEnterSimPin parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RspEnterSimPin) (new RspEnterSimPin().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RspGetCurrentCalls extends
+      com.google.protobuf.micro.MessageMicro {
+    public RspGetCurrentCalls() {}
+    
+    // repeated .ril_proto.RilCall calls = 1;
+    public static final int CALLS_FIELD_NUMBER = 1;
+    private java.util.List<com.android.internal.telephony.ril_proto.RilCmds.RilCall> calls_ =
+      java.util.Collections.emptyList();
+    public java.util.List<com.android.internal.telephony.ril_proto.RilCmds.RilCall> getCallsList() {
+      return calls_;
+    }
+    public int getCallsCount() { return calls_.size(); }
+    public com.android.internal.telephony.ril_proto.RilCmds.RilCall getCalls(int index) {
+      return calls_.get(index);
+    }
+    public RspGetCurrentCalls setCalls(int index, com.android.internal.telephony.ril_proto.RilCmds.RilCall value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      calls_.set(index, value);
+      return this;
+    }
+    public RspGetCurrentCalls addCalls(com.android.internal.telephony.ril_proto.RilCmds.RilCall value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      if (calls_.isEmpty()) {
+        calls_ = new java.util.ArrayList<com.android.internal.telephony.ril_proto.RilCmds.RilCall>();
+      }
+      calls_.add(value);
+      return this;
+    }
+    public RspGetCurrentCalls clearCalls() {
+      calls_ = java.util.Collections.emptyList();
+      return this;
+    }
+    
+    public final RspGetCurrentCalls clear() {
+      clearCalls();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      for (com.android.internal.telephony.ril_proto.RilCmds.RilCall element : getCallsList()) {
+        output.writeMessage(1, element);
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      for (com.android.internal.telephony.ril_proto.RilCmds.RilCall element : getCallsList()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeMessageSize(1, element);
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RspGetCurrentCalls mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 10: {
+            com.android.internal.telephony.ril_proto.RilCmds.RilCall value = new com.android.internal.telephony.ril_proto.RilCmds.RilCall();
+            input.readMessage(value);
+            addCalls(value);
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RspGetCurrentCalls parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RspGetCurrentCalls) (new RspGetCurrentCalls().mergeFrom(data));
+    }
+    
+    public static RspGetCurrentCalls parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RspGetCurrentCalls) (new RspGetCurrentCalls().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class ReqDial extends
+      com.google.protobuf.micro.MessageMicro {
+    public ReqDial() {}
+    
+    // optional string address = 1;
+    public static final int ADDRESS_FIELD_NUMBER = 1;
+    private boolean hasAddress;
+    private java.lang.String address_ = "";
+    public java.lang.String getAddress() { return address_; }
+    public boolean hasAddress() { return hasAddress; }
+    public ReqDial setAddress(java.lang.String value) {
+      hasAddress = true;
+      address_ = value;
+      return this;
+    }
+    public ReqDial clearAddress() {
+      hasAddress = false;
+      address_ = "";
+      return this;
+    }
+    
+    // optional int32 clir = 2;
+    public static final int CLIR_FIELD_NUMBER = 2;
+    private boolean hasClir;
+    private int clir_ = 0;
+    public int getClir() { return clir_; }
+    public boolean hasClir() { return hasClir; }
+    public ReqDial setClir(int value) {
+      hasClir = true;
+      clir_ = value;
+      return this;
+    }
+    public ReqDial clearClir() {
+      hasClir = false;
+      clir_ = 0;
+      return this;
+    }
+    
+    // optional .ril_proto.RilUusInfo uus_info = 3;
+    public static final int UUS_INFO_FIELD_NUMBER = 3;
+    private boolean hasUusInfo;
+    private com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo uusInfo_ = null;
+    public boolean hasUusInfo() { return hasUusInfo; }
+    public com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo getUusInfo() { return uusInfo_; }
+    public ReqDial setUusInfo(com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      hasUusInfo = true;
+      uusInfo_ = value;
+      return this;
+    }
+    public ReqDial clearUusInfo() {
+      hasUusInfo = false;
+      uusInfo_ = null;
+      return this;
+    }
+    
+    public final ReqDial clear() {
+      clearAddress();
+      clearClir();
+      clearUusInfo();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasAddress()) {
+        output.writeString(1, getAddress());
+      }
+      if (hasClir()) {
+        output.writeInt32(2, getClir());
+      }
+      if (hasUusInfo()) {
+        output.writeMessage(3, getUusInfo());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasAddress()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(1, getAddress());
+      }
+      if (hasClir()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(2, getClir());
+      }
+      if (hasUusInfo()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeMessageSize(3, getUusInfo());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public ReqDial mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 10: {
+            setAddress(input.readString());
+            break;
+          }
+          case 16: {
+            setClir(input.readInt32());
+            break;
+          }
+          case 26: {
+            com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo value = new com.android.internal.telephony.ril_proto.RilCmds.RilUusInfo();
+            input.readMessage(value);
+            setUusInfo(value);
+            break;
+          }
+        }
+      }
+    }
+    
+    public static ReqDial parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (ReqDial) (new ReqDial().mergeFrom(data));
+    }
+    
+    public static ReqDial parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (ReqDial) (new ReqDial().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class ReqHangUp extends
+      com.google.protobuf.micro.MessageMicro {
+    public ReqHangUp() {}
+    
+    // required int32 connection_index = 1;
+    public static final int CONNECTION_INDEX_FIELD_NUMBER = 1;
+    private boolean hasConnectionIndex;
+    private int connectionIndex_ = 0;
+    public int getConnectionIndex() { return connectionIndex_; }
+    public boolean hasConnectionIndex() { return hasConnectionIndex; }
+    public ReqHangUp setConnectionIndex(int value) {
+      hasConnectionIndex = true;
+      connectionIndex_ = value;
+      return this;
+    }
+    public ReqHangUp clearConnectionIndex() {
+      hasConnectionIndex = false;
+      connectionIndex_ = 0;
+      return this;
+    }
+    
+    public final ReqHangUp clear() {
+      clearConnectionIndex();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasConnectionIndex) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasConnectionIndex()) {
+        output.writeInt32(1, getConnectionIndex());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasConnectionIndex()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getConnectionIndex());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public ReqHangUp mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            setConnectionIndex(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static ReqHangUp parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (ReqHangUp) (new ReqHangUp().mergeFrom(data));
+    }
+    
+    public static ReqHangUp parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (ReqHangUp) (new ReqHangUp().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RspSignalStrength extends
+      com.google.protobuf.micro.MessageMicro {
+    public RspSignalStrength() {}
+    
+    // optional .ril_proto.RILGWSignalStrength gw_signalstrength = 1;
+    public static final int GW_SIGNALSTRENGTH_FIELD_NUMBER = 1;
+    private boolean hasGwSignalstrength;
+    private com.android.internal.telephony.ril_proto.RilCmds.RILGWSignalStrength gwSignalstrength_ = null;
+    public boolean hasGwSignalstrength() { return hasGwSignalstrength; }
+    public com.android.internal.telephony.ril_proto.RilCmds.RILGWSignalStrength getGwSignalstrength() { return gwSignalstrength_; }
+    public RspSignalStrength setGwSignalstrength(com.android.internal.telephony.ril_proto.RilCmds.RILGWSignalStrength value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      hasGwSignalstrength = true;
+      gwSignalstrength_ = value;
+      return this;
+    }
+    public RspSignalStrength clearGwSignalstrength() {
+      hasGwSignalstrength = false;
+      gwSignalstrength_ = null;
+      return this;
+    }
+    
+    // optional .ril_proto.RILCDMASignalStrength cdma_signalstrength = 2;
+    public static final int CDMA_SIGNALSTRENGTH_FIELD_NUMBER = 2;
+    private boolean hasCdmaSignalstrength;
+    private com.android.internal.telephony.ril_proto.RilCmds.RILCDMASignalStrength cdmaSignalstrength_ = null;
+    public boolean hasCdmaSignalstrength() { return hasCdmaSignalstrength; }
+    public com.android.internal.telephony.ril_proto.RilCmds.RILCDMASignalStrength getCdmaSignalstrength() { return cdmaSignalstrength_; }
+    public RspSignalStrength setCdmaSignalstrength(com.android.internal.telephony.ril_proto.RilCmds.RILCDMASignalStrength value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      hasCdmaSignalstrength = true;
+      cdmaSignalstrength_ = value;
+      return this;
+    }
+    public RspSignalStrength clearCdmaSignalstrength() {
+      hasCdmaSignalstrength = false;
+      cdmaSignalstrength_ = null;
+      return this;
+    }
+    
+    // optional .ril_proto.RILEVDOSignalStrength evdo_signalstrength = 3;
+    public static final int EVDO_SIGNALSTRENGTH_FIELD_NUMBER = 3;
+    private boolean hasEvdoSignalstrength;
+    private com.android.internal.telephony.ril_proto.RilCmds.RILEVDOSignalStrength evdoSignalstrength_ = null;
+    public boolean hasEvdoSignalstrength() { return hasEvdoSignalstrength; }
+    public com.android.internal.telephony.ril_proto.RilCmds.RILEVDOSignalStrength getEvdoSignalstrength() { return evdoSignalstrength_; }
+    public RspSignalStrength setEvdoSignalstrength(com.android.internal.telephony.ril_proto.RilCmds.RILEVDOSignalStrength value) {
+      if (value == null) {
+        throw new NullPointerException();
+      }
+      hasEvdoSignalstrength = true;
+      evdoSignalstrength_ = value;
+      return this;
+    }
+    public RspSignalStrength clearEvdoSignalstrength() {
+      hasEvdoSignalstrength = false;
+      evdoSignalstrength_ = null;
+      return this;
+    }
+    
+    public final RspSignalStrength clear() {
+      clearGwSignalstrength();
+      clearCdmaSignalstrength();
+      clearEvdoSignalstrength();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasGwSignalstrength()) {
+        output.writeMessage(1, getGwSignalstrength());
+      }
+      if (hasCdmaSignalstrength()) {
+        output.writeMessage(2, getCdmaSignalstrength());
+      }
+      if (hasEvdoSignalstrength()) {
+        output.writeMessage(3, getEvdoSignalstrength());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasGwSignalstrength()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeMessageSize(1, getGwSignalstrength());
+      }
+      if (hasCdmaSignalstrength()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeMessageSize(2, getCdmaSignalstrength());
+      }
+      if (hasEvdoSignalstrength()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeMessageSize(3, getEvdoSignalstrength());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RspSignalStrength mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 10: {
+            com.android.internal.telephony.ril_proto.RilCmds.RILGWSignalStrength value = new com.android.internal.telephony.ril_proto.RilCmds.RILGWSignalStrength();
+            input.readMessage(value);
+            setGwSignalstrength(value);
+            break;
+          }
+          case 18: {
+            com.android.internal.telephony.ril_proto.RilCmds.RILCDMASignalStrength value = new com.android.internal.telephony.ril_proto.RilCmds.RILCDMASignalStrength();
+            input.readMessage(value);
+            setCdmaSignalstrength(value);
+            break;
+          }
+          case 26: {
+            com.android.internal.telephony.ril_proto.RilCmds.RILEVDOSignalStrength value = new com.android.internal.telephony.ril_proto.RilCmds.RILEVDOSignalStrength();
+            input.readMessage(value);
+            setEvdoSignalstrength(value);
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RspSignalStrength parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RspSignalStrength) (new RspSignalStrength().mergeFrom(data));
+    }
+    
+    public static RspSignalStrength parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RspSignalStrength) (new RspSignalStrength().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class RspOperator extends
+      com.google.protobuf.micro.MessageMicro {
+    public RspOperator() {}
+    
+    // optional string long_alpha_ons = 1;
+    public static final int LONG_ALPHA_ONS_FIELD_NUMBER = 1;
+    private boolean hasLongAlphaOns;
+    private java.lang.String longAlphaOns_ = "";
+    public java.lang.String getLongAlphaOns() { return longAlphaOns_; }
+    public boolean hasLongAlphaOns() { return hasLongAlphaOns; }
+    public RspOperator setLongAlphaOns(java.lang.String value) {
+      hasLongAlphaOns = true;
+      longAlphaOns_ = value;
+      return this;
+    }
+    public RspOperator clearLongAlphaOns() {
+      hasLongAlphaOns = false;
+      longAlphaOns_ = "";
+      return this;
+    }
+    
+    // optional string short_alpha_ons = 2;
+    public static final int SHORT_ALPHA_ONS_FIELD_NUMBER = 2;
+    private boolean hasShortAlphaOns;
+    private java.lang.String shortAlphaOns_ = "";
+    public java.lang.String getShortAlphaOns() { return shortAlphaOns_; }
+    public boolean hasShortAlphaOns() { return hasShortAlphaOns; }
+    public RspOperator setShortAlphaOns(java.lang.String value) {
+      hasShortAlphaOns = true;
+      shortAlphaOns_ = value;
+      return this;
+    }
+    public RspOperator clearShortAlphaOns() {
+      hasShortAlphaOns = false;
+      shortAlphaOns_ = "";
+      return this;
+    }
+    
+    // optional string mcc_mnc = 3;
+    public static final int MCC_MNC_FIELD_NUMBER = 3;
+    private boolean hasMccMnc;
+    private java.lang.String mccMnc_ = "";
+    public java.lang.String getMccMnc() { return mccMnc_; }
+    public boolean hasMccMnc() { return hasMccMnc; }
+    public RspOperator setMccMnc(java.lang.String value) {
+      hasMccMnc = true;
+      mccMnc_ = value;
+      return this;
+    }
+    public RspOperator clearMccMnc() {
+      hasMccMnc = false;
+      mccMnc_ = "";
+      return this;
+    }
+    
+    public final RspOperator clear() {
+      clearLongAlphaOns();
+      clearShortAlphaOns();
+      clearMccMnc();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasLongAlphaOns()) {
+        output.writeString(1, getLongAlphaOns());
+      }
+      if (hasShortAlphaOns()) {
+        output.writeString(2, getShortAlphaOns());
+      }
+      if (hasMccMnc()) {
+        output.writeString(3, getMccMnc());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasLongAlphaOns()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(1, getLongAlphaOns());
+      }
+      if (hasShortAlphaOns()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(2, getShortAlphaOns());
+      }
+      if (hasMccMnc()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(3, getMccMnc());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public RspOperator mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 10: {
+            setLongAlphaOns(input.readString());
+            break;
+          }
+          case 18: {
+            setShortAlphaOns(input.readString());
+            break;
+          }
+          case 26: {
+            setMccMnc(input.readString());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static RspOperator parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (RspOperator) (new RspOperator().mergeFrom(data));
+    }
+    
+    public static RspOperator parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (RspOperator) (new RspOperator().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class ReqSeparateConnection extends
+      com.google.protobuf.micro.MessageMicro {
+    public ReqSeparateConnection() {}
+    
+    // required int32 index = 1;
+    public static final int INDEX_FIELD_NUMBER = 1;
+    private boolean hasIndex;
+    private int index_ = 0;
+    public int getIndex() { return index_; }
+    public boolean hasIndex() { return hasIndex; }
+    public ReqSeparateConnection setIndex(int value) {
+      hasIndex = true;
+      index_ = value;
+      return this;
+    }
+    public ReqSeparateConnection clearIndex() {
+      hasIndex = false;
+      index_ = 0;
+      return this;
+    }
+    
+    public final ReqSeparateConnection clear() {
+      clearIndex();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasIndex) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasIndex()) {
+        output.writeInt32(1, getIndex());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasIndex()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getIndex());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public ReqSeparateConnection mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            setIndex(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static ReqSeparateConnection parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (ReqSeparateConnection) (new ReqSeparateConnection().mergeFrom(data));
+    }
+    
+    public static ReqSeparateConnection parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (ReqSeparateConnection) (new ReqSeparateConnection().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class ReqSetMute extends
+      com.google.protobuf.micro.MessageMicro {
+    public ReqSetMute() {}
+    
+    // required bool state = 1;
+    public static final int STATE_FIELD_NUMBER = 1;
+    private boolean hasState;
+    private boolean state_ = false;
+    public boolean getState() { return state_; }
+    public boolean hasState() { return hasState; }
+    public ReqSetMute setState(boolean value) {
+      hasState = true;
+      state_ = value;
+      return this;
+    }
+    public ReqSetMute clearState() {
+      hasState = false;
+      state_ = false;
+      return this;
+    }
+    
+    public final ReqSetMute clear() {
+      clearState();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasState) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasState()) {
+        output.writeBool(1, getState());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasState()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeBoolSize(1, getState());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public ReqSetMute mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            setState(input.readBool());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static ReqSetMute parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (ReqSetMute) (new ReqSetMute().mergeFrom(data));
+    }
+    
+    public static ReqSetMute parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (ReqSetMute) (new ReqSetMute().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class ReqScreenState extends
+      com.google.protobuf.micro.MessageMicro {
+    public ReqScreenState() {}
+    
+    // required bool state = 1;
+    public static final int STATE_FIELD_NUMBER = 1;
+    private boolean hasState;
+    private boolean state_ = false;
+    public boolean getState() { return state_; }
+    public boolean hasState() { return hasState; }
+    public ReqScreenState setState(boolean value) {
+      hasState = true;
+      state_ = value;
+      return this;
+    }
+    public ReqScreenState clearState() {
+      hasState = false;
+      state_ = false;
+      return this;
+    }
+    
+    public final ReqScreenState clear() {
+      clearState();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasState) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasState()) {
+        output.writeBool(1, getState());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasState()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeBoolSize(1, getState());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public ReqScreenState mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+            setState(input.readBool());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static ReqScreenState parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (ReqScreenState) (new ReqScreenState().mergeFrom(data));
+    }
+    
+    public static ReqScreenState parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (ReqScreenState) (new ReqScreenState().mergeFrom(input));
+    }
+    
+  }
+  
+}
diff --git a/mock-ril/src/generated/java/com/android/internal/telephony/ril_proto/RilCtrlCmds.java b/mock-ril/src/generated/java/com/android/internal/telephony/ril_proto/RilCtrlCmds.java
new file mode 100644 (file)
index 0000000..1b78faa
--- /dev/null
@@ -0,0 +1,296 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+package com.android.internal.telephony.ril_proto;
+
+public final class RilCtrlCmds {
+  private RilCtrlCmds() {}
+  // enum CtrlCmd
+  public static final int CTRL_CMD_ECHO = 0;
+  public static final int CTRL_CMD_GET_RADIO_STATE = 1;
+  public static final int CTRL_CMD_SET_RADIO_STATE = 2;
+  public static final int CTRL_CMD_SET_MT_CALL = 3;
+  
+  // enum CtrlStatus
+  public static final int CTRL_STATUS_OK = 0;
+  public static final int CTRL_STATUS_ERR = 1;
+  
+  public static final class CtrlReqRadioState extends
+      com.google.protobuf.micro.MessageMicro {
+    public CtrlReqRadioState() {}
+    
+    // required .ril_proto.RadioState state = 1;
+    public static final int STATE_FIELD_NUMBER = 1;
+    private boolean hasState;
+    private int state_ = com.android.internal.telephony.ril_proto.RilCmds.RADIOSTATE_OFF;
+    public boolean hasState() { return hasState; }
+    public int getState() { return state_; }
+    public CtrlReqRadioState setState(int value) {
+      hasState = true;
+      state_ = value;
+      return this;
+    }
+    public CtrlReqRadioState clearState() {
+      hasState = false;
+      state_ = com.android.internal.telephony.ril_proto.RilCmds.RADIOSTATE_OFF;
+      return this;
+    }
+    
+    public final CtrlReqRadioState clear() {
+      clearState();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasState) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasState()) {
+        output.writeInt32(1, getState());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasState()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getState());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public CtrlReqRadioState mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+              setState(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static CtrlReqRadioState parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (CtrlReqRadioState) (new CtrlReqRadioState().mergeFrom(data));
+    }
+    
+    public static CtrlReqRadioState parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (CtrlReqRadioState) (new CtrlReqRadioState().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class CtrlRspRadioState extends
+      com.google.protobuf.micro.MessageMicro {
+    public CtrlRspRadioState() {}
+    
+    // required .ril_proto.RadioState state = 1;
+    public static final int STATE_FIELD_NUMBER = 1;
+    private boolean hasState;
+    private int state_ = com.android.internal.telephony.ril_proto.RilCmds.RADIOSTATE_OFF;
+    public boolean hasState() { return hasState; }
+    public int getState() { return state_; }
+    public CtrlRspRadioState setState(int value) {
+      hasState = true;
+      state_ = value;
+      return this;
+    }
+    public CtrlRspRadioState clearState() {
+      hasState = false;
+      state_ = com.android.internal.telephony.ril_proto.RilCmds.RADIOSTATE_OFF;
+      return this;
+    }
+    
+    public final CtrlRspRadioState clear() {
+      clearState();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasState) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasState()) {
+        output.writeInt32(1, getState());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasState()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeInt32Size(1, getState());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public CtrlRspRadioState mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 8: {
+              setState(input.readInt32());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static CtrlRspRadioState parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (CtrlRspRadioState) (new CtrlRspRadioState().mergeFrom(data));
+    }
+    
+    public static CtrlRspRadioState parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (CtrlRspRadioState) (new CtrlRspRadioState().mergeFrom(input));
+    }
+    
+  }
+  
+  public static final class CtrlReqSetMTCall extends
+      com.google.protobuf.micro.MessageMicro {
+    public CtrlReqSetMTCall() {}
+    
+    // required string phone_number = 1;
+    public static final int PHONE_NUMBER_FIELD_NUMBER = 1;
+    private boolean hasPhoneNumber;
+    private java.lang.String phoneNumber_ = "";
+    public java.lang.String getPhoneNumber() { return phoneNumber_; }
+    public boolean hasPhoneNumber() { return hasPhoneNumber; }
+    public CtrlReqSetMTCall setPhoneNumber(java.lang.String value) {
+      hasPhoneNumber = true;
+      phoneNumber_ = value;
+      return this;
+    }
+    public CtrlReqSetMTCall clearPhoneNumber() {
+      hasPhoneNumber = false;
+      phoneNumber_ = "";
+      return this;
+    }
+    
+    public final CtrlReqSetMTCall clear() {
+      clearPhoneNumber();
+      cachedSize = -1;
+      return this;
+    }
+    
+    public final boolean isInitialized() {
+      if (!hasPhoneNumber) return false;
+      return true;
+    }
+    
+    public void writeTo(com.google.protobuf.micro.CodedOutputStreamMicro output)
+                        throws java.io.IOException {
+      if (hasPhoneNumber()) {
+        output.writeString(1, getPhoneNumber());
+      }
+    }
+    
+    private int cachedSize = -1;
+    public int getCachedSize() {
+      if (cachedSize < 0) {
+        // getSerializedSize sets cachedSize
+        getSerializedSize();
+      }
+      return cachedSize;
+    }
+    
+    public int getSerializedSize() {
+      int size = 0;
+      if (hasPhoneNumber()) {
+        size += com.google.protobuf.micro.CodedOutputStreamMicro
+          .computeStringSize(1, getPhoneNumber());
+      }
+      cachedSize = size;
+      return size;
+    }
+    
+    public CtrlReqSetMTCall mergeFrom(
+        com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      while (true) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            return this;
+          default: {
+            if (!parseUnknownField(input, tag)) {
+              return this;
+            }
+            break;
+          }
+          case 10: {
+            setPhoneNumber(input.readString());
+            break;
+          }
+        }
+      }
+    }
+    
+    public static CtrlReqSetMTCall parseFrom(byte[] data)
+        throws com.google.protobuf.micro.InvalidProtocolBufferMicroException {
+      return (CtrlReqSetMTCall) (new CtrlReqSetMTCall().mergeFrom(data));
+    }
+    
+    public static CtrlReqSetMTCall parseFrom(
+            com.google.protobuf.micro.CodedInputStreamMicro input)
+        throws java.io.IOException {
+      return (CtrlReqSetMTCall) (new CtrlReqSetMTCall().mergeFrom(input));
+    }
+    
+  }
+  
+}
diff --git a/mock-ril/src/generated/python/ctrl_pb2.py b/mock-ril/src/generated/python/ctrl_pb2.py
new file mode 100644 (file)
index 0000000..807f2d1
--- /dev/null
@@ -0,0 +1,182 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+from google.protobuf import descriptor
+from google.protobuf import message
+from google.protobuf import reflection
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+
+DESCRIPTOR = descriptor.FileDescriptor(
+  name='ctrl.proto',
+  package='ril_proto',
+  serialized_pb='\n\nctrl.proto\x12\tril_proto\x1a\tril.proto\"9\n\x11\x43trlReqRadioState\x12$\n\x05state\x18\x01 \x02(\x0e\x32\x15.ril_proto.RadioState\"9\n\x11\x43trlRspRadioState\x12$\n\x05state\x18\x01 \x02(\x0e\x32\x15.ril_proto.RadioState\"(\n\x10\x43trlReqSetMTCall\x12\x14\n\x0cphone_number\x18\x01 \x02(\t*r\n\x07\x43trlCmd\x12\x11\n\rCTRL_CMD_ECHO\x10\x00\x12\x1c\n\x18\x43TRL_CMD_GET_RADIO_STATE\x10\x01\x12\x1c\n\x18\x43TRL_CMD_SET_RADIO_STATE\x10\x02\x12\x18\n\x14\x43TRL_CMD_SET_MT_CALL\x10\x03*5\n\nCtrlStatus\x12\x12\n\x0e\x43TRL_STATUS_OK\x10\x00\x12\x13\n\x0f\x43TRL_STATUS_ERR\x10\x01\x42\x37\n(com.android.internal.telephony.ril_protoB\x0bRilCtrlCmds')
+
+_CTRLCMD = descriptor.EnumDescriptor(
+  name='CtrlCmd',
+  full_name='ril_proto.CtrlCmd',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='CTRL_CMD_ECHO', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CTRL_CMD_GET_RADIO_STATE', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CTRL_CMD_SET_RADIO_STATE', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CTRL_CMD_SET_MT_CALL', index=3, number=3,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=196,
+  serialized_end=310,
+)
+
+
+_CTRLSTATUS = descriptor.EnumDescriptor(
+  name='CtrlStatus',
+  full_name='ril_proto.CtrlStatus',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='CTRL_STATUS_OK', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CTRL_STATUS_ERR', index=1, number=1,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=312,
+  serialized_end=365,
+)
+
+
+CTRL_CMD_ECHO = 0
+CTRL_CMD_GET_RADIO_STATE = 1
+CTRL_CMD_SET_RADIO_STATE = 2
+CTRL_CMD_SET_MT_CALL = 3
+CTRL_STATUS_OK = 0
+CTRL_STATUS_ERR = 1
+
+
+
+_CTRLREQRADIOSTATE = descriptor.Descriptor(
+  name='CtrlReqRadioState',
+  full_name='ril_proto.CtrlReqRadioState',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='state', full_name='ril_proto.CtrlReqRadioState.state', index=0,
+      number=1, type=14, cpp_type=8, label=2,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=36,
+  serialized_end=93,
+)
+
+
+_CTRLRSPRADIOSTATE = descriptor.Descriptor(
+  name='CtrlRspRadioState',
+  full_name='ril_proto.CtrlRspRadioState',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='state', full_name='ril_proto.CtrlRspRadioState.state', index=0,
+      number=1, type=14, cpp_type=8, label=2,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=95,
+  serialized_end=152,
+)
+
+
+_CTRLREQSETMTCALL = descriptor.Descriptor(
+  name='CtrlReqSetMTCall',
+  full_name='ril_proto.CtrlReqSetMTCall',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='phone_number', full_name='ril_proto.CtrlReqSetMTCall.phone_number', index=0,
+      number=1, type=9, cpp_type=9, label=2,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=154,
+  serialized_end=194,
+)
+
+import ril_pb2
+
+_CTRLREQRADIOSTATE.fields_by_name['state'].enum_type = ril_pb2._RADIOSTATE
+_CTRLRSPRADIOSTATE.fields_by_name['state'].enum_type = ril_pb2._RADIOSTATE
+
+class CtrlReqRadioState(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _CTRLREQRADIOSTATE
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.CtrlReqRadioState)
+
+class CtrlRspRadioState(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _CTRLRSPRADIOSTATE
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.CtrlRspRadioState)
+
+class CtrlReqSetMTCall(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _CTRLREQSETMTCALL
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.CtrlReqSetMTCall)
+
+# @@protoc_insertion_point(module_scope)
diff --git a/mock-ril/src/generated/python/msgheader_pb2.py b/mock-ril/src/generated/python/msgheader_pb2.py
new file mode 100644 (file)
index 0000000..0b70cc9
--- /dev/null
@@ -0,0 +1,74 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+from google.protobuf import descriptor
+from google.protobuf import message
+from google.protobuf import reflection
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+
+DESCRIPTOR = descriptor.FileDescriptor(
+  name='msgheader.proto',
+  package='communication',
+  serialized_pb='\n\x0fmsgheader.proto\x12\rcommunication\"L\n\tMsgHeader\x12\x0b\n\x03\x63md\x18\x01 \x02(\r\x12\x13\n\x0blength_data\x18\x02 \x02(\r\x12\x0e\n\x06status\x18\x03 \x01(\r\x12\r\n\x05token\x18\x04 \x01(\x04\x42$\n\"com.android.internal.communication')
+
+
+
+
+_MSGHEADER = descriptor.Descriptor(
+  name='MsgHeader',
+  full_name='communication.MsgHeader',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='cmd', full_name='communication.MsgHeader.cmd', index=0,
+      number=1, type=13, cpp_type=3, label=2,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='length_data', full_name='communication.MsgHeader.length_data', index=1,
+      number=2, type=13, cpp_type=3, label=2,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='status', full_name='communication.MsgHeader.status', index=2,
+      number=3, type=13, cpp_type=3, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='token', full_name='communication.MsgHeader.token', index=3,
+      number=4, type=4, cpp_type=4, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=34,
+  serialized_end=110,
+)
+
+
+
+class MsgHeader(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _MSGHEADER
+  
+  # @@protoc_insertion_point(class_scope:communication.MsgHeader)
+
+# @@protoc_insertion_point(module_scope)
diff --git a/mock-ril/src/generated/python/ril_pb2.py b/mock-ril/src/generated/python/ril_pb2.py
new file mode 100644 (file)
index 0000000..9f9d13c
--- /dev/null
@@ -0,0 +1,1467 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+
+from google.protobuf import descriptor
+from google.protobuf import message
+from google.protobuf import reflection
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+
+DESCRIPTOR = descriptor.FileDescriptor(
+  name='ril.proto',
+  package='ril_proto',
+  serialized_pb='\n\tril.proto\x12\tril_proto\"\x9a\x02\n\x0cRilAppStatus\x12\'\n\x08\x61pp_type\x18\x01 \x01(\x0e\x32\x15.ril_proto.RilAppType\x12)\n\tapp_state\x18\x02 \x01(\x0e\x32\x16.ril_proto.RilAppState\x12\x33\n\x0eperso_substate\x18\x03 \x01(\x0e\x32\x1b.ril_proto.RilPersoSubstate\x12\x0b\n\x03\x61id\x18\x04 \x01(\t\x12\x11\n\tapp_label\x18\x05 \x01(\t\x12\x15\n\rpin1_replaced\x18\x06 \x01(\x05\x12$\n\x04pin1\x18\x07 \x01(\x0e\x32\x16.ril_proto.RilPinState\x12$\n\x04pin2\x18\x08 \x01(\x0e\x32\x16.ril_proto.RilPinState\"\x88\x02\n\rRilCardStatus\x12+\n\ncard_state\x18\x01 \x01(\x0e\x32\x17.ril_proto.RilCardState\x12\x33\n\x13universal_pin_state\x18\x02 \x01(\x0e\x32\x16.ril_proto.RilPinState\x12\'\n\x1fgsm_umts_subscription_app_index\x18\x03 \x01(\x05\x12#\n\x1b\x63\x64ma_subscription_app_index\x18\x04 \x01(\x05\x12\x18\n\x10num_applications\x18\x05 \x01(\x05\x12-\n\x0c\x61pplications\x18\x06 \x03(\x0b\x32\x17.ril_proto.RilAppStatus\"\x82\x01\n\nRilUusInfo\x12\'\n\x08uus_type\x18\x01 \x01(\x0e\x32\x15.ril_proto.RilUusType\x12%\n\x07uus_dcs\x18\x02 \x01(\x0e\x32\x14.ril_proto.RilUusDcs\x12\x12\n\nuus_length\x18\x03 \x01(\x05\x12\x10\n\x08uus_data\x18\x04 \x01(\t\"\xa5\x02\n\x07RilCall\x12&\n\x05state\x18\x01 \x01(\x0e\x32\x17.ril_proto.RilCallState\x12\r\n\x05index\x18\x02 \x01(\x05\x12\x0b\n\x03toa\x18\x03 \x01(\x05\x12\x0f\n\x07is_mpty\x18\x04 \x01(\x08\x12\r\n\x05is_mt\x18\x05 \x01(\x08\x12\x0b\n\x03\x61ls\x18\x06 \x01(\x05\x12\x10\n\x08is_voice\x18\x07 \x01(\x08\x12\x18\n\x10is_voice_privacy\x18\x08 \x01(\x08\x12\x0e\n\x06number\x18\t \x01(\t\x12\x1b\n\x13number_presentation\x18\n \x01(\x05\x12\x0c\n\x04name\x18\x0b \x01(\t\x12\x19\n\x11name_presentation\x18\x0c \x01(\x05\x12\'\n\x08uus_info\x18\r \x01(\x0b\x32\x15.ril_proto.RilUusInfo\"F\n\x13RILGWSignalStrength\x12\x17\n\x0fsignal_strength\x18\x01 \x01(\x05\x12\x16\n\x0e\x62it_error_rate\x18\x02 \x01(\x05\"2\n\x15RILCDMASignalStrength\x12\x0b\n\x03\x64\x62m\x18\x01 \x01(\x05\x12\x0c\n\x04\x65\x63io\x18\x02 \x01(\x05\"N\n\x15RILEVDOSignalStrength\x12\x0b\n\x03\x64\x62m\x18\x01 \x01(\x05\x12\x0c\n\x04\x65\x63io\x18\x02 \x01(\x05\x12\x1a\n\x12signal_noise_ratio\x18\x03 \x01(\x05\"\x1d\n\nRspStrings\x12\x0f\n\x07strings\x18\x01 \x03(\t\"\x1f\n\x0bRspIntegers\x12\x10\n\x08integers\x18\x01 \x03(\x05\"@\n\x0fRspGetSimStatus\x12-\n\x0b\x63\x61rd_status\x18\x01 \x02(\x0b\x32\x18.ril_proto.RilCardStatus\"\x1d\n\x0eReqEnterSimPin\x12\x0b\n\x03pin\x18\x01 \x02(\t\"+\n\x0eRspEnterSimPin\x12\x19\n\x11retries_remaining\x18\x01 \x02(\x05\"7\n\x12RspGetCurrentCalls\x12!\n\x05\x63\x61lls\x18\x01 \x03(\x0b\x32\x12.ril_proto.RilCall\"Q\n\x07ReqDial\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x0c\n\x04\x63lir\x18\x02 \x01(\x05\x12\'\n\x08uus_info\x18\x03 \x01(\x0b\x32\x15.ril_proto.RilUusInfo\"%\n\tReqHangUp\x12\x18\n\x10\x63onnection_index\x18\x01 \x02(\x05\"\xcc\x01\n\x11RspSignalStrength\x12\x39\n\x11gw_signalstrength\x18\x01 \x01(\x0b\x32\x1e.ril_proto.RILGWSignalStrength\x12=\n\x13\x63\x64ma_signalstrength\x18\x02 \x01(\x0b\x32 .ril_proto.RILCDMASignalStrength\x12=\n\x13\x65vdo_signalstrength\x18\x03 \x01(\x0b\x32 .ril_proto.RILEVDOSignalStrength\"O\n\x0bRspOperator\x12\x16\n\x0elong_alpha_ons\x18\x01 \x01(\t\x12\x17\n\x0fshort_alpha_ons\x18\x02 \x01(\t\x12\x0f\n\x07mcc_mnc\x18\x03 \x01(\t\"&\n\x15ReqSeparateConnection\x12\r\n\x05index\x18\x01 \x02(\x05\"\x1b\n\nReqSetMute\x12\r\n\x05state\x18\x01 \x02(\x08\"\x1f\n\x0eReqScreenState\x12\r\n\x05state\x18\x01 \x02(\x08*\xaf\x02\n\nRadioState\x12\x12\n\x0eRADIOSTATE_OFF\x10\x00\x12\x1a\n\x16RADIOSTATE_UNAVAILABLE\x10\x01\x12\x1c\n\x18RADIOSTATE_SIM_NOT_READY\x10\x02\x12#\n\x1fRADIOSTATE_SIM_LOCKED_OR_ABSENT\x10\x03\x12\x18\n\x14RADIOSTATE_SIM_READY\x10\x04\x12\x1d\n\x19RADIOSTATE_RUIM_NOT_READY\x10\x05\x12\x19\n\x15RADIOSTATE_RUIM_READY\x10\x06\x12$\n RADIOSTATE_RUIM_LOCKED_OR_ABSENT\x10\x07\x12\x1b\n\x17RADIOSTATE_NV_NOT_READY\x10\x08\x12\x17\n\x13RADIOSTATE_NV_READY\x10\t*P\n\x0cRilCardState\x12\x14\n\x10\x43\x41RDSTATE_ABSENT\x10\x00\x12\x15\n\x11\x43\x41RDSTATE_PRESENT\x10\x01\x12\x13\n\x0f\x43\x41RDSTATE_ERROR\x10\x02*\xf1\x06\n\x10RilPersoSubstate\x12\x19\n\x15PERSOSUBSTATE_UNKNOWN\x10\x00\x12\x1d\n\x19PERSOSUBSTATE_IN_PROGRESS\x10\x01\x12\x17\n\x13PERSOSUBSTATE_READY\x10\x02\x12\x1d\n\x19PERSOSUBSTATE_SIM_NETWORK\x10\x03\x12$\n PERSOSUBSTATE_SIM_NETWORK_SUBSET\x10\x04\x12\x1f\n\x1bPERSOSUBSTATE_SIM_CORPORATE\x10\x05\x12&\n\"PERSOSUBSTATE_SIM_SERVICE_PROVIDER\x10\x06\x12\x19\n\x15PERSOSUBSTATE_SIM_SIM\x10\x07\x12!\n\x1dPERSOSUBSTATE_SIM_NETWORK_PUK\x10\x08\x12(\n$PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK\x10\t\x12#\n\x1fPERSOSUBSTATE_SIM_CORPORATE_PUK\x10\n\x12*\n&PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK\x10\x0b\x12\x1d\n\x19PERSOSUBSTATE_SIM_SIM_PUK\x10\x0c\x12\x1f\n\x1bPERSOSUBSTATE_RUIM_NETWORK1\x10\r\x12\x1f\n\x1bPERSOSUBSTATE_RUIM_NETWORK2\x10\x0e\x12\x1b\n\x17PERSOSUBSTATE_RUIM_HRPD\x10\x0f\x12 \n\x1cPERSOSUBSTATE_RUIM_CORPORATE\x10\x10\x12\'\n#PERSOSUBSTATE_RUIM_SERVICE_PROVIDER\x10\x11\x12\x1b\n\x17PERSOSUBSTATE_RUIM_RUIM\x10\x12\x12#\n\x1fPERSOSUBSTATE_RUIM_NETWORK1_PUK\x10\x13\x12#\n\x1fPERSOSUBSTATE_RUIM_NETWORK2_PUK\x10\x14\x12\x1f\n\x1bPERSOSUBSTATE_RUIM_HRPD_PUK\x10\x15\x12$\n PERSOSUBSTATE_RUIM_CORPORATE_PUK\x10\x16\x12+\n\'PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK\x10\x17\x12\x1f\n\x1bPERSOSUBSTATE_RUIM_RUIM_PUK\x10\x18*\x93\x01\n\x0bRilAppState\x12\x14\n\x10\x41PPSTATE_UNKNOWN\x10\x00\x12\x15\n\x11\x41PPSTATE_DETECTED\x10\x01\x12\x10\n\x0c\x41PPSTATE_PIN\x10\x02\x12\x10\n\x0c\x41PPSTATE_PUK\x10\x03\x12\x1f\n\x1b\x41PPSTATE_SUBSCRIPTION_PERSO\x10\x04\x12\x12\n\x0e\x41PPSTATE_READY\x10\x05*\xbd\x01\n\x0bRilPinState\x12\x14\n\x10PINSTATE_UNKNOWN\x10\x00\x12!\n\x1dPINSTATE_ENABLED_NOT_VERIFIED\x10\x01\x12\x1d\n\x19PINSTATE_ENABLED_VERIFIED\x10\x02\x12\x15\n\x11PINSTATE_DISABLED\x10\x03\x12\x1c\n\x18PINSTATE_ENABLED_BLOCKED\x10\x04\x12!\n\x1dPINSTATE_ENABLED_PERM_BLOCKED\x10\x05*h\n\nRilAppType\x12\x13\n\x0f\x41PPTYPE_UNKNOWN\x10\x00\x12\x0f\n\x0b\x41PPTYPE_SIM\x10\x01\x12\x10\n\x0c\x41PPTYPE_USIM\x10\x02\x12\x10\n\x0c\x41PPTYPE_RUIM\x10\x03\x12\x10\n\x0c\x41PPTYPE_CSIM\x10\x04*\xce\x01\n\nRilUusType\x12\x18\n\x14RILUUSTYPE1_IMPLICIT\x10\x00\x12\x18\n\x14RILUUSTYPE1_REQUIRED\x10\x01\x12\x1c\n\x18RILUUSTYPE1_NOT_REQUIRED\x10\x02\x12\x18\n\x14RILUUSTYPE2_REQUIRED\x10\x03\x12\x1c\n\x18RILUUSTYPE2_NOT_REQUIRED\x10\x04\x12\x18\n\x14RILUUSTYPE3_REQUIRED\x10\x05\x12\x1c\n\x18RILUUSTYPE3_NOT_REQUIRED\x10\x06*p\n\tRilUusDcs\x12\x11\n\rRILUUSDCS_USP\x10\x00\x12\x14\n\x10RILUUSDCS_OSIHLP\x10\x01\x12\x12\n\x0eRILUUSDCS_X244\x10\x02\x12\x12\n\x0eRILUUSDCS_RMCF\x10\x03\x12\x12\n\x0eRILUUSDCS_IA5c\x10\x04*\x99\x01\n\x0cRilCallState\x12\x14\n\x10\x43\x41LLSTATE_ACTIVE\x10\x00\x12\x15\n\x11\x43\x41LLSTATE_HOLDING\x10\x01\x12\x15\n\x11\x43\x41LLSTATE_DIALING\x10\x02\x12\x16\n\x12\x43\x41LLSTATE_ALERTING\x10\x03\x12\x16\n\x12\x43\x41LLSTATE_INCOMING\x10\x04\x12\x15\n\x11\x43\x41LLSTATE_WAITING\x10\x05\x42\x33\n(com.android.internal.telephony.ril_protoB\x07RilCmds')
+
+_RADIOSTATE = descriptor.EnumDescriptor(
+  name='RadioState',
+  full_name='ril_proto.RadioState',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_OFF', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_UNAVAILABLE', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_SIM_NOT_READY', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_SIM_LOCKED_OR_ABSENT', index=3, number=3,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_SIM_READY', index=4, number=4,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_RUIM_NOT_READY', index=5, number=5,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_RUIM_READY', index=6, number=6,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_RUIM_LOCKED_OR_ABSENT', index=7, number=7,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_NV_NOT_READY', index=8, number=8,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RADIOSTATE_NV_READY', index=9, number=9,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=1985,
+  serialized_end=2288,
+)
+
+
+_RILCARDSTATE = descriptor.EnumDescriptor(
+  name='RilCardState',
+  full_name='ril_proto.RilCardState',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='CARDSTATE_ABSENT', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CARDSTATE_PRESENT', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CARDSTATE_ERROR', index=2, number=2,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=2290,
+  serialized_end=2370,
+)
+
+
+_RILPERSOSUBSTATE = descriptor.EnumDescriptor(
+  name='RilPersoSubstate',
+  full_name='ril_proto.RilPersoSubstate',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_UNKNOWN', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_IN_PROGRESS', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_READY', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_NETWORK', index=3, number=3,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_NETWORK_SUBSET', index=4, number=4,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_CORPORATE', index=5, number=5,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_SERVICE_PROVIDER', index=6, number=6,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_SIM', index=7, number=7,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_NETWORK_PUK', index=8, number=8,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK', index=9, number=9,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_CORPORATE_PUK', index=10, number=10,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK', index=11, number=11,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_SIM_SIM_PUK', index=12, number=12,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_NETWORK1', index=13, number=13,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_NETWORK2', index=14, number=14,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_HRPD', index=15, number=15,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_CORPORATE', index=16, number=16,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_SERVICE_PROVIDER', index=17, number=17,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_RUIM', index=18, number=18,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_NETWORK1_PUK', index=19, number=19,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_NETWORK2_PUK', index=20, number=20,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_HRPD_PUK', index=21, number=21,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_CORPORATE_PUK', index=22, number=22,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK', index=23, number=23,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PERSOSUBSTATE_RUIM_RUIM_PUK', index=24, number=24,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=2373,
+  serialized_end=3254,
+)
+
+
+_RILAPPSTATE = descriptor.EnumDescriptor(
+  name='RilAppState',
+  full_name='ril_proto.RilAppState',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='APPSTATE_UNKNOWN', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPSTATE_DETECTED', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPSTATE_PIN', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPSTATE_PUK', index=3, number=3,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPSTATE_SUBSCRIPTION_PERSO', index=4, number=4,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPSTATE_READY', index=5, number=5,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=3257,
+  serialized_end=3404,
+)
+
+
+_RILPINSTATE = descriptor.EnumDescriptor(
+  name='RilPinState',
+  full_name='ril_proto.RilPinState',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='PINSTATE_UNKNOWN', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PINSTATE_ENABLED_NOT_VERIFIED', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PINSTATE_ENABLED_VERIFIED', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PINSTATE_DISABLED', index=3, number=3,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PINSTATE_ENABLED_BLOCKED', index=4, number=4,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='PINSTATE_ENABLED_PERM_BLOCKED', index=5, number=5,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=3407,
+  serialized_end=3596,
+)
+
+
+_RILAPPTYPE = descriptor.EnumDescriptor(
+  name='RilAppType',
+  full_name='ril_proto.RilAppType',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='APPTYPE_UNKNOWN', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPTYPE_SIM', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPTYPE_USIM', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPTYPE_RUIM', index=3, number=3,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='APPTYPE_CSIM', index=4, number=4,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=3598,
+  serialized_end=3702,
+)
+
+
+_RILUUSTYPE = descriptor.EnumDescriptor(
+  name='RilUusType',
+  full_name='ril_proto.RilUusType',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='RILUUSTYPE1_IMPLICIT', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSTYPE1_REQUIRED', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSTYPE1_NOT_REQUIRED', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSTYPE2_REQUIRED', index=3, number=3,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSTYPE2_NOT_REQUIRED', index=4, number=4,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSTYPE3_REQUIRED', index=5, number=5,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSTYPE3_NOT_REQUIRED', index=6, number=6,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=3705,
+  serialized_end=3911,
+)
+
+
+_RILUUSDCS = descriptor.EnumDescriptor(
+  name='RilUusDcs',
+  full_name='ril_proto.RilUusDcs',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='RILUUSDCS_USP', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSDCS_OSIHLP', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSDCS_X244', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSDCS_RMCF', index=3, number=3,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='RILUUSDCS_IA5c', index=4, number=4,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=3913,
+  serialized_end=4025,
+)
+
+
+_RILCALLSTATE = descriptor.EnumDescriptor(
+  name='RilCallState',
+  full_name='ril_proto.RilCallState',
+  filename=None,
+  file=DESCRIPTOR,
+  values=[
+    descriptor.EnumValueDescriptor(
+      name='CALLSTATE_ACTIVE', index=0, number=0,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CALLSTATE_HOLDING', index=1, number=1,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CALLSTATE_DIALING', index=2, number=2,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CALLSTATE_ALERTING', index=3, number=3,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CALLSTATE_INCOMING', index=4, number=4,
+      options=None,
+      type=None),
+    descriptor.EnumValueDescriptor(
+      name='CALLSTATE_WAITING', index=5, number=5,
+      options=None,
+      type=None),
+  ],
+  containing_type=None,
+  options=None,
+  serialized_start=4028,
+  serialized_end=4181,
+)
+
+
+RADIOSTATE_OFF = 0
+RADIOSTATE_UNAVAILABLE = 1
+RADIOSTATE_SIM_NOT_READY = 2
+RADIOSTATE_SIM_LOCKED_OR_ABSENT = 3
+RADIOSTATE_SIM_READY = 4
+RADIOSTATE_RUIM_NOT_READY = 5
+RADIOSTATE_RUIM_READY = 6
+RADIOSTATE_RUIM_LOCKED_OR_ABSENT = 7
+RADIOSTATE_NV_NOT_READY = 8
+RADIOSTATE_NV_READY = 9
+CARDSTATE_ABSENT = 0
+CARDSTATE_PRESENT = 1
+CARDSTATE_ERROR = 2
+PERSOSUBSTATE_UNKNOWN = 0
+PERSOSUBSTATE_IN_PROGRESS = 1
+PERSOSUBSTATE_READY = 2
+PERSOSUBSTATE_SIM_NETWORK = 3
+PERSOSUBSTATE_SIM_NETWORK_SUBSET = 4
+PERSOSUBSTATE_SIM_CORPORATE = 5
+PERSOSUBSTATE_SIM_SERVICE_PROVIDER = 6
+PERSOSUBSTATE_SIM_SIM = 7
+PERSOSUBSTATE_SIM_NETWORK_PUK = 8
+PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK = 9
+PERSOSUBSTATE_SIM_CORPORATE_PUK = 10
+PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK = 11
+PERSOSUBSTATE_SIM_SIM_PUK = 12
+PERSOSUBSTATE_RUIM_NETWORK1 = 13
+PERSOSUBSTATE_RUIM_NETWORK2 = 14
+PERSOSUBSTATE_RUIM_HRPD = 15
+PERSOSUBSTATE_RUIM_CORPORATE = 16
+PERSOSUBSTATE_RUIM_SERVICE_PROVIDER = 17
+PERSOSUBSTATE_RUIM_RUIM = 18
+PERSOSUBSTATE_RUIM_NETWORK1_PUK = 19
+PERSOSUBSTATE_RUIM_NETWORK2_PUK = 20
+PERSOSUBSTATE_RUIM_HRPD_PUK = 21
+PERSOSUBSTATE_RUIM_CORPORATE_PUK = 22
+PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23
+PERSOSUBSTATE_RUIM_RUIM_PUK = 24
+APPSTATE_UNKNOWN = 0
+APPSTATE_DETECTED = 1
+APPSTATE_PIN = 2
+APPSTATE_PUK = 3
+APPSTATE_SUBSCRIPTION_PERSO = 4
+APPSTATE_READY = 5
+PINSTATE_UNKNOWN = 0
+PINSTATE_ENABLED_NOT_VERIFIED = 1
+PINSTATE_ENABLED_VERIFIED = 2
+PINSTATE_DISABLED = 3
+PINSTATE_ENABLED_BLOCKED = 4
+PINSTATE_ENABLED_PERM_BLOCKED = 5
+APPTYPE_UNKNOWN = 0
+APPTYPE_SIM = 1
+APPTYPE_USIM = 2
+APPTYPE_RUIM = 3
+APPTYPE_CSIM = 4
+RILUUSTYPE1_IMPLICIT = 0
+RILUUSTYPE1_REQUIRED = 1
+RILUUSTYPE1_NOT_REQUIRED = 2
+RILUUSTYPE2_REQUIRED = 3
+RILUUSTYPE2_NOT_REQUIRED = 4
+RILUUSTYPE3_REQUIRED = 5
+RILUUSTYPE3_NOT_REQUIRED = 6
+RILUUSDCS_USP = 0
+RILUUSDCS_OSIHLP = 1
+RILUUSDCS_X244 = 2
+RILUUSDCS_RMCF = 3
+RILUUSDCS_IA5c = 4
+CALLSTATE_ACTIVE = 0
+CALLSTATE_HOLDING = 1
+CALLSTATE_DIALING = 2
+CALLSTATE_ALERTING = 3
+CALLSTATE_INCOMING = 4
+CALLSTATE_WAITING = 5
+
+
+
+_RILAPPSTATUS = descriptor.Descriptor(
+  name='RilAppStatus',
+  full_name='ril_proto.RilAppStatus',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='app_type', full_name='ril_proto.RilAppStatus.app_type', index=0,
+      number=1, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='app_state', full_name='ril_proto.RilAppStatus.app_state', index=1,
+      number=2, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='perso_substate', full_name='ril_proto.RilAppStatus.perso_substate', index=2,
+      number=3, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='aid', full_name='ril_proto.RilAppStatus.aid', index=3,
+      number=4, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='app_label', full_name='ril_proto.RilAppStatus.app_label', index=4,
+      number=5, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='pin1_replaced', full_name='ril_proto.RilAppStatus.pin1_replaced', index=5,
+      number=6, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='pin1', full_name='ril_proto.RilAppStatus.pin1', index=6,
+      number=7, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='pin2', full_name='ril_proto.RilAppStatus.pin2', index=7,
+      number=8, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=25,
+  serialized_end=307,
+)
+
+
+_RILCARDSTATUS = descriptor.Descriptor(
+  name='RilCardStatus',
+  full_name='ril_proto.RilCardStatus',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='card_state', full_name='ril_proto.RilCardStatus.card_state', index=0,
+      number=1, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='universal_pin_state', full_name='ril_proto.RilCardStatus.universal_pin_state', index=1,
+      number=2, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='gsm_umts_subscription_app_index', full_name='ril_proto.RilCardStatus.gsm_umts_subscription_app_index', index=2,
+      number=3, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='cdma_subscription_app_index', full_name='ril_proto.RilCardStatus.cdma_subscription_app_index', index=3,
+      number=4, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='num_applications', full_name='ril_proto.RilCardStatus.num_applications', index=4,
+      number=5, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='applications', full_name='ril_proto.RilCardStatus.applications', index=5,
+      number=6, type=11, cpp_type=10, label=3,
+      has_default_value=False, default_value=[],
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=310,
+  serialized_end=574,
+)
+
+
+_RILUUSINFO = descriptor.Descriptor(
+  name='RilUusInfo',
+  full_name='ril_proto.RilUusInfo',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='uus_type', full_name='ril_proto.RilUusInfo.uus_type', index=0,
+      number=1, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='uus_dcs', full_name='ril_proto.RilUusInfo.uus_dcs', index=1,
+      number=2, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='uus_length', full_name='ril_proto.RilUusInfo.uus_length', index=2,
+      number=3, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='uus_data', full_name='ril_proto.RilUusInfo.uus_data', index=3,
+      number=4, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=577,
+  serialized_end=707,
+)
+
+
+_RILCALL = descriptor.Descriptor(
+  name='RilCall',
+  full_name='ril_proto.RilCall',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='state', full_name='ril_proto.RilCall.state', index=0,
+      number=1, type=14, cpp_type=8, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='index', full_name='ril_proto.RilCall.index', index=1,
+      number=2, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='toa', full_name='ril_proto.RilCall.toa', index=2,
+      number=3, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='is_mpty', full_name='ril_proto.RilCall.is_mpty', index=3,
+      number=4, type=8, cpp_type=7, label=1,
+      has_default_value=False, default_value=False,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='is_mt', full_name='ril_proto.RilCall.is_mt', index=4,
+      number=5, type=8, cpp_type=7, label=1,
+      has_default_value=False, default_value=False,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='als', full_name='ril_proto.RilCall.als', index=5,
+      number=6, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='is_voice', full_name='ril_proto.RilCall.is_voice', index=6,
+      number=7, type=8, cpp_type=7, label=1,
+      has_default_value=False, default_value=False,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='is_voice_privacy', full_name='ril_proto.RilCall.is_voice_privacy', index=7,
+      number=8, type=8, cpp_type=7, label=1,
+      has_default_value=False, default_value=False,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='number', full_name='ril_proto.RilCall.number', index=8,
+      number=9, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='number_presentation', full_name='ril_proto.RilCall.number_presentation', index=9,
+      number=10, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='name', full_name='ril_proto.RilCall.name', index=10,
+      number=11, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='name_presentation', full_name='ril_proto.RilCall.name_presentation', index=11,
+      number=12, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='uus_info', full_name='ril_proto.RilCall.uus_info', index=12,
+      number=13, type=11, cpp_type=10, label=1,
+      has_default_value=False, default_value=None,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=710,
+  serialized_end=1003,
+)
+
+
+_RILGWSIGNALSTRENGTH = descriptor.Descriptor(
+  name='RILGWSignalStrength',
+  full_name='ril_proto.RILGWSignalStrength',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='signal_strength', full_name='ril_proto.RILGWSignalStrength.signal_strength', index=0,
+      number=1, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='bit_error_rate', full_name='ril_proto.RILGWSignalStrength.bit_error_rate', index=1,
+      number=2, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1005,
+  serialized_end=1075,
+)
+
+
+_RILCDMASIGNALSTRENGTH = descriptor.Descriptor(
+  name='RILCDMASignalStrength',
+  full_name='ril_proto.RILCDMASignalStrength',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='dbm', full_name='ril_proto.RILCDMASignalStrength.dbm', index=0,
+      number=1, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='ecio', full_name='ril_proto.RILCDMASignalStrength.ecio', index=1,
+      number=2, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1077,
+  serialized_end=1127,
+)
+
+
+_RILEVDOSIGNALSTRENGTH = descriptor.Descriptor(
+  name='RILEVDOSignalStrength',
+  full_name='ril_proto.RILEVDOSignalStrength',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='dbm', full_name='ril_proto.RILEVDOSignalStrength.dbm', index=0,
+      number=1, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='ecio', full_name='ril_proto.RILEVDOSignalStrength.ecio', index=1,
+      number=2, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='signal_noise_ratio', full_name='ril_proto.RILEVDOSignalStrength.signal_noise_ratio', index=2,
+      number=3, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1129,
+  serialized_end=1207,
+)
+
+
+_RSPSTRINGS = descriptor.Descriptor(
+  name='RspStrings',
+  full_name='ril_proto.RspStrings',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='strings', full_name='ril_proto.RspStrings.strings', index=0,
+      number=1, type=9, cpp_type=9, label=3,
+      has_default_value=False, default_value=[],
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1209,
+  serialized_end=1238,
+)
+
+
+_RSPINTEGERS = descriptor.Descriptor(
+  name='RspIntegers',
+  full_name='ril_proto.RspIntegers',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='integers', full_name='ril_proto.RspIntegers.integers', index=0,
+      number=1, type=5, cpp_type=1, label=3,
+      has_default_value=False, default_value=[],
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1240,
+  serialized_end=1271,
+)
+
+
+_RSPGETSIMSTATUS = descriptor.Descriptor(
+  name='RspGetSimStatus',
+  full_name='ril_proto.RspGetSimStatus',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='card_status', full_name='ril_proto.RspGetSimStatus.card_status', index=0,
+      number=1, type=11, cpp_type=10, label=2,
+      has_default_value=False, default_value=None,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1273,
+  serialized_end=1337,
+)
+
+
+_REQENTERSIMPIN = descriptor.Descriptor(
+  name='ReqEnterSimPin',
+  full_name='ril_proto.ReqEnterSimPin',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='pin', full_name='ril_proto.ReqEnterSimPin.pin', index=0,
+      number=1, type=9, cpp_type=9, label=2,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1339,
+  serialized_end=1368,
+)
+
+
+_RSPENTERSIMPIN = descriptor.Descriptor(
+  name='RspEnterSimPin',
+  full_name='ril_proto.RspEnterSimPin',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='retries_remaining', full_name='ril_proto.RspEnterSimPin.retries_remaining', index=0,
+      number=1, type=5, cpp_type=1, label=2,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1370,
+  serialized_end=1413,
+)
+
+
+_RSPGETCURRENTCALLS = descriptor.Descriptor(
+  name='RspGetCurrentCalls',
+  full_name='ril_proto.RspGetCurrentCalls',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='calls', full_name='ril_proto.RspGetCurrentCalls.calls', index=0,
+      number=1, type=11, cpp_type=10, label=3,
+      has_default_value=False, default_value=[],
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1415,
+  serialized_end=1470,
+)
+
+
+_REQDIAL = descriptor.Descriptor(
+  name='ReqDial',
+  full_name='ril_proto.ReqDial',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='address', full_name='ril_proto.ReqDial.address', index=0,
+      number=1, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='clir', full_name='ril_proto.ReqDial.clir', index=1,
+      number=2, type=5, cpp_type=1, label=1,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='uus_info', full_name='ril_proto.ReqDial.uus_info', index=2,
+      number=3, type=11, cpp_type=10, label=1,
+      has_default_value=False, default_value=None,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1472,
+  serialized_end=1553,
+)
+
+
+_REQHANGUP = descriptor.Descriptor(
+  name='ReqHangUp',
+  full_name='ril_proto.ReqHangUp',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='connection_index', full_name='ril_proto.ReqHangUp.connection_index', index=0,
+      number=1, type=5, cpp_type=1, label=2,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1555,
+  serialized_end=1592,
+)
+
+
+_RSPSIGNALSTRENGTH = descriptor.Descriptor(
+  name='RspSignalStrength',
+  full_name='ril_proto.RspSignalStrength',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='gw_signalstrength', full_name='ril_proto.RspSignalStrength.gw_signalstrength', index=0,
+      number=1, type=11, cpp_type=10, label=1,
+      has_default_value=False, default_value=None,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='cdma_signalstrength', full_name='ril_proto.RspSignalStrength.cdma_signalstrength', index=1,
+      number=2, type=11, cpp_type=10, label=1,
+      has_default_value=False, default_value=None,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='evdo_signalstrength', full_name='ril_proto.RspSignalStrength.evdo_signalstrength', index=2,
+      number=3, type=11, cpp_type=10, label=1,
+      has_default_value=False, default_value=None,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1595,
+  serialized_end=1799,
+)
+
+
+_RSPOPERATOR = descriptor.Descriptor(
+  name='RspOperator',
+  full_name='ril_proto.RspOperator',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='long_alpha_ons', full_name='ril_proto.RspOperator.long_alpha_ons', index=0,
+      number=1, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='short_alpha_ons', full_name='ril_proto.RspOperator.short_alpha_ons', index=1,
+      number=2, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    descriptor.FieldDescriptor(
+      name='mcc_mnc', full_name='ril_proto.RspOperator.mcc_mnc', index=2,
+      number=3, type=9, cpp_type=9, label=1,
+      has_default_value=False, default_value=unicode("", "utf-8"),
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1801,
+  serialized_end=1880,
+)
+
+
+_REQSEPARATECONNECTION = descriptor.Descriptor(
+  name='ReqSeparateConnection',
+  full_name='ril_proto.ReqSeparateConnection',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='index', full_name='ril_proto.ReqSeparateConnection.index', index=0,
+      number=1, type=5, cpp_type=1, label=2,
+      has_default_value=False, default_value=0,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1882,
+  serialized_end=1920,
+)
+
+
+_REQSETMUTE = descriptor.Descriptor(
+  name='ReqSetMute',
+  full_name='ril_proto.ReqSetMute',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='state', full_name='ril_proto.ReqSetMute.state', index=0,
+      number=1, type=8, cpp_type=7, label=2,
+      has_default_value=False, default_value=False,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1922,
+  serialized_end=1949,
+)
+
+
+_REQSCREENSTATE = descriptor.Descriptor(
+  name='ReqScreenState',
+  full_name='ril_proto.ReqScreenState',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  fields=[
+    descriptor.FieldDescriptor(
+      name='state', full_name='ril_proto.ReqScreenState.state', index=0,
+      number=1, type=8, cpp_type=7, label=2,
+      has_default_value=False, default_value=False,
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+  ],
+  extensions=[
+  ],
+  nested_types=[],
+  enum_types=[
+  ],
+  options=None,
+  is_extendable=False,
+  extension_ranges=[],
+  serialized_start=1951,
+  serialized_end=1982,
+)
+
+
+_RILAPPSTATUS.fields_by_name['app_type'].enum_type = _RILAPPTYPE
+_RILAPPSTATUS.fields_by_name['app_state'].enum_type = _RILAPPSTATE
+_RILAPPSTATUS.fields_by_name['perso_substate'].enum_type = _RILPERSOSUBSTATE
+_RILAPPSTATUS.fields_by_name['pin1'].enum_type = _RILPINSTATE
+_RILAPPSTATUS.fields_by_name['pin2'].enum_type = _RILPINSTATE
+_RILCARDSTATUS.fields_by_name['card_state'].enum_type = _RILCARDSTATE
+_RILCARDSTATUS.fields_by_name['universal_pin_state'].enum_type = _RILPINSTATE
+_RILCARDSTATUS.fields_by_name['applications'].message_type = _RILAPPSTATUS
+_RILUUSINFO.fields_by_name['uus_type'].enum_type = _RILUUSTYPE
+_RILUUSINFO.fields_by_name['uus_dcs'].enum_type = _RILUUSDCS
+_RILCALL.fields_by_name['state'].enum_type = _RILCALLSTATE
+_RILCALL.fields_by_name['uus_info'].message_type = _RILUUSINFO
+_RSPGETSIMSTATUS.fields_by_name['card_status'].message_type = _RILCARDSTATUS
+_RSPGETCURRENTCALLS.fields_by_name['calls'].message_type = _RILCALL
+_REQDIAL.fields_by_name['uus_info'].message_type = _RILUUSINFO
+_RSPSIGNALSTRENGTH.fields_by_name['gw_signalstrength'].message_type = _RILGWSIGNALSTRENGTH
+_RSPSIGNALSTRENGTH.fields_by_name['cdma_signalstrength'].message_type = _RILCDMASIGNALSTRENGTH
+_RSPSIGNALSTRENGTH.fields_by_name['evdo_signalstrength'].message_type = _RILEVDOSIGNALSTRENGTH
+
+class RilAppStatus(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RILAPPSTATUS
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RilAppStatus)
+
+class RilCardStatus(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RILCARDSTATUS
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RilCardStatus)
+
+class RilUusInfo(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RILUUSINFO
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RilUusInfo)
+
+class RilCall(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RILCALL
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RilCall)
+
+class RILGWSignalStrength(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RILGWSIGNALSTRENGTH
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RILGWSignalStrength)
+
+class RILCDMASignalStrength(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RILCDMASIGNALSTRENGTH
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RILCDMASignalStrength)
+
+class RILEVDOSignalStrength(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RILEVDOSIGNALSTRENGTH
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RILEVDOSignalStrength)
+
+class RspStrings(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RSPSTRINGS
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RspStrings)
+
+class RspIntegers(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RSPINTEGERS
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RspIntegers)
+
+class RspGetSimStatus(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RSPGETSIMSTATUS
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RspGetSimStatus)
+
+class ReqEnterSimPin(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _REQENTERSIMPIN
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.ReqEnterSimPin)
+
+class RspEnterSimPin(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RSPENTERSIMPIN
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RspEnterSimPin)
+
+class RspGetCurrentCalls(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RSPGETCURRENTCALLS
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RspGetCurrentCalls)
+
+class ReqDial(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _REQDIAL
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.ReqDial)
+
+class ReqHangUp(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _REQHANGUP
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.ReqHangUp)
+
+class RspSignalStrength(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RSPSIGNALSTRENGTH
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RspSignalStrength)
+
+class RspOperator(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _RSPOPERATOR
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.RspOperator)
+
+class ReqSeparateConnection(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _REQSEPARATECONNECTION
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.ReqSeparateConnection)
+
+class ReqSetMute(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _REQSETMUTE
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.ReqSetMute)
+
+class ReqScreenState(message.Message):
+  __metaclass__ = reflection.GeneratedProtocolMessageType
+  DESCRIPTOR = _REQSCREENSTATE
+  
+  # @@protoc_insertion_point(class_scope:ril_proto.ReqScreenState)
+
+# @@protoc_insertion_point(module_scope)
diff --git a/mock-ril/src/java/com/android/internal/communication/Msg.java b/mock-ril/src/java/com/android/internal/communication/Msg.java
new file mode 100644 (file)
index 0000000..6046fe7
--- /dev/null
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 2010, 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.
+ */
+
+package com.android.internal.communication;
+
+import android.util.Log;
+
+import com.android.internal.communication.MsgHeader;
+import com.android.internal.telephony.RilChannel;
+import com.google.protobuf.micro.InvalidProtocolBufferMicroException;
+import com.google.protobuf.micro.MessageMicro;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * A message
+ */
+public class Msg {
+    private MsgHeader  mHeader;
+    private ByteBuffer mData;
+
+    /**
+     * Send a message header
+     *
+     * @param mh is message header to write
+     * @throws IOException
+     */
+    private static void sendHeader(RilChannel rc, MsgHeader mh) throws IOException {
+        ByteBuffer lenBuffer = ByteBuffer.allocateDirect(4);
+        lenBuffer.order(ByteOrder.LITTLE_ENDIAN);
+        lenBuffer.putInt(mh.getSerializedSize());
+
+        ByteBuffer mhBuffer = ByteBuffer.allocateDirect(mh.getCachedSize());
+        mhBuffer.put(mh.toByteArray());
+
+        rc.rewindSendAll(lenBuffer);
+        rc.rewindSendAll(mhBuffer);
+    }
+
+    /**
+     * Read a message header
+     *
+     * @returns message header
+     * @throws IOException
+     */
+    private static MsgHeader recvHeader(RilChannel rc) throws IOException {
+        ByteBuffer lenBuffer = ByteBuffer.allocate(4);
+        lenBuffer.order(ByteOrder.LITTLE_ENDIAN);
+        int lenRead = rc.recvAllRewind(lenBuffer);
+        int lenHeader = lenBuffer.getInt();
+
+        ByteBuffer mhBuffer = ByteBuffer.allocate(lenHeader);
+        lenRead = rc.recvAllRewind(mhBuffer);
+        MsgHeader mh = MsgHeader.parseFrom(mhBuffer.array());
+        return mh;
+    }
+
+    /**
+     * Msg Constructor
+     */
+    private Msg() {
+    }
+
+    /**
+     * Get a message
+     */
+    public static Msg obtain() {
+        // TODO: Get from a free list
+        return new Msg();
+    }
+
+    /**
+     * Release a message
+     */
+    public void release() {
+        // TODO: place back on free list
+    }
+
+    /**
+     * Send a message header followed by the data if present
+     *
+     * The length data field will be filled in as appropriate
+     * @param mh header
+     * @param data if not null and length > 0 sent after header
+     * @throws IOException
+     */
+    public static final void send(RilChannel rc, MsgHeader mh, ByteBuffer data)
+            throws IOException {
+        int lenData;
+
+        if (data == null) {
+            lenData = 0;
+        } else {
+            data.rewind();
+            lenData = data.remaining();
+        }
+        mh.setLengthData(lenData);
+        sendHeader(rc, mh);
+        if (lenData > 0) {
+            rc.sendAll(data);
+        }
+    }
+
+    /**
+     * Send a message with cmd, token, status followed by the data.
+     *
+     * The length data field will be filled in as appropriate
+     * @param cmd for the header
+     * @param token for the header
+     * @param status for the header
+     * @param pb is the protobuf to send
+     * @throws IOException
+     */
+    public static final void send(RilChannel rc, int cmd, long token, int status, MessageMicro pb)
+            throws IOException {
+        MsgHeader mh = new MsgHeader();
+        mh.setCmd(cmd);
+        mh.setToken(token);
+        mh.setStatus(status);
+
+        ByteBuffer data;
+        if (pb != null) {
+            data = ByteBuffer.wrap(pb.toByteArray());
+        } else {
+            data = null;
+        }
+        send(rc, mh, data);
+    }
+
+    /**
+     * Send a message with cmd, token, status followed by the data.
+     *
+     * The length data field will be filled in as appropriate
+     * @param cmd for the header
+     * @param token for the header
+     * @param pb is the protobuf to send
+     * @throws IOException
+     */
+    public static final void send(RilChannel rc, int cmd, long token, MessageMicro pb)
+            throws IOException {
+        send(rc, cmd, token, 0, pb);
+    }
+
+    /**
+     * Send a message with cmd followed by the data.
+     *
+     * The length data field will be filled in as appropriate
+     * @param cmd for the header
+     * @param pb is the protobuf to send
+     * @throws IOException
+     */
+    public static final void send(RilChannel rc, int cmd, MessageMicro pb) throws IOException {
+        send(rc, cmd, 0, 0, pb);
+    }
+
+    /**
+     * Send a message with cmd, token and status but no data
+     *
+     * The length data field will be filled in as appropriate
+     * @param cmd for the header
+     * @param token for the header
+     * @param status for the header
+     * @throws IOException
+     */
+    public static final void send(RilChannel rc, int cmd, long token, int status)
+            throws IOException {
+        send(rc, cmd, token, status, null);
+    }
+
+    /**
+     * Send a message with cmd and token but no data
+     *
+     * The length data field will be filled in as appropriate
+     * @param cmd for the header
+     * @param token for the header
+     * @throws IOException
+     */
+    public static final void send(RilChannel rc, int cmd, long token) throws IOException {
+        send(rc, cmd, token, 0, null);
+    }
+
+    /**
+     * Send a message with cmd but no data
+     *
+     * The length data field will be filled in as appropriate
+     * @param cmd for the header
+     * @throws IOException
+     */
+    public static final void send(RilChannel rc, int cmd) throws IOException {
+        send(rc, cmd, 0, 0, null);
+    }
+
+    /**
+     * Read a message
+     *
+     * @return Msg
+     * @throws IOException
+     */
+    public static final Msg recv(RilChannel rc) throws IOException {
+        Msg msg = Msg.obtain();
+        msg.read(rc);
+        return msg;
+    }
+
+    /**
+     * Read a message header and data.
+     *
+     * @throws IOException
+     */
+    public void read(RilChannel rc) throws IOException {
+        mHeader = recvHeader(rc);
+        if (mHeader.getLengthData() > 0) {
+            ByteBuffer bb = ByteBuffer.allocate(mHeader.getLengthData());
+            rc.recvAllRewind(bb);
+            mData = bb;
+        }
+    }
+
+    /**
+     * Print the message header.
+     *
+     * @param tag for the header
+     */
+    public void printHeader(String tag) {
+        Log.d(tag, " cmd=" + mHeader.getCmd() + " token=" + mHeader.getToken() + " status="
+                        + mHeader.getStatus() + " lengthData=" + mHeader.getLengthData());
+    }
+
+    /**
+     * Set data (for testing purposes only).
+     */
+    public void setData(ByteBuffer data) {
+        mData = data;
+    }
+
+    /**
+     * Set header (for testing purposes only).
+     */
+    public void setHeader(MsgHeader header) {
+        mHeader = header;
+    }
+
+    /**
+     * @return cmd
+     */
+    public int getCmd() {
+        return mHeader.getCmd();
+    }
+
+    /**
+     * @return token
+     */
+    public long getToken() {
+        return mHeader.getToken();
+    }
+
+    /**
+     * @return status
+     */
+    public int getStatus() {
+        return mHeader.getStatus();
+    }
+
+    /**
+     * @return data ByteBuffer
+     */
+    public ByteBuffer getData() {
+        return mData;
+    }
+
+    /**
+     * @return data at index
+     */
+    public byte getData(int index) {
+        return mData.get(index);
+    }
+
+    /**
+     * Return data as a Class<T>.
+     *
+     * @param <T> a class that extends MessageMicro.
+     * @param c the T.class to create from the data.
+     * @param data is the MessageMicro protobuf to be converted.
+     * @return null if an error occurs.
+     */
+    @SuppressWarnings("unchecked")
+    public static final <T extends MessageMicro> T getAs(Class<T> c, byte[] data) {
+        Object o = null;
+        if ((data != null) && (data.length > 0)) {
+            try {
+                o = c.newInstance().mergeFrom(data);
+            } catch (InvalidProtocolBufferMicroException e) {
+                e.printStackTrace();
+            } catch (InstantiationException e) {
+                e.printStackTrace();
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+        return (T)o;
+    }
+
+    /**
+     * Return data as a Class<T>.
+     *
+     * @param <T> a class that extends MessageMicro.
+     * @param c the T.class to create from data.
+     * @return null if an error occurs
+     */
+    @SuppressWarnings("unchecked")
+    public <T extends MessageMicro> T getDataAs(Class<T> c) {
+        Object o;
+
+        if ((mData != null) && (mData.remaining() > 0)) {
+            o = getAs(c, mData.array());
+        } else {
+            o = null;
+        }
+        return (T)o;
+    }
+}
diff --git a/mock-ril/src/java/com/android/internal/telephony/RilChannel.java b/mock-ril/src/java/com/android/internal/telephony/RilChannel.java
new file mode 100644 (file)
index 0000000..abe32c7
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2010, 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.
+ */
+
+package com.android.internal.telephony;
+
+import android.util.Log;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.channels.SocketChannel;
+import java.nio.ByteBuffer;
+
+public class RilChannel {
+    private static final boolean DBG = false;
+
+    private static final String MOCKRIL_ADDR_STR = "127.0.0.1";
+    private static final int MOCKRIL_PORT = 54312;
+    private SocketChannel mChannel = null;
+
+    /**
+     * Constructor
+     */
+    private RilChannel() {
+        if (DBG) log("ctor EX");
+    }
+
+    /**
+     * Open the channel
+     *
+     * @throws IOException
+     */
+    private void open() throws IOException {
+        InetSocketAddress mockRilAddr = new InetSocketAddress(MOCKRIL_ADDR_STR, MOCKRIL_PORT);
+        mChannel= SocketChannel.open(mockRilAddr);
+    }
+
+    /**
+     * Make the channel
+     *
+     * @return the channel
+     * @throws IOException
+     */
+    public static RilChannel makeRilChannel() throws IOException {
+        if (DBG) log("makeMockRilChannel E");
+        RilChannel sm = new RilChannel();
+        sm.open();
+        if (DBG) log("makeMockRilChannel X");
+        return sm;
+    }
+
+    /**
+     * Close an open channel
+     */
+    public void close() {
+        try {
+            if (mChannel != null) {
+                mChannel.close();
+                if (DBG) log("DefaultState.enter closed socket");
+            }
+        } catch (IOException e) {
+            log("Could not close conection to mock-ril");
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * @return the channel
+     */
+    public SocketChannel getChannel() {
+        return mChannel;
+    }
+
+    /**
+     * write the bb contents to sc
+     *
+     * @param bb is the ByteBuffer to write
+     * @return number of bytes written
+     * @throws IOException
+     */
+    public final int sendAll(ByteBuffer bb) throws IOException {
+        int count = 0;
+        while (bb.remaining() != 0) {
+            count += mChannel.write(bb);
+        }
+        return count;
+    }
+
+    /**
+     * read from sc until bb is filled then rewind bb
+     *
+     * @param bb is the ByteBuffer to fill
+     * @return number of bytes read
+     * @throws IOException
+     */
+    public final int recvAll(ByteBuffer bb) throws IOException {
+        int count = 0;
+        while (bb.remaining() != 0) {
+            count += mChannel.read(bb);
+        }
+        return count;
+    }
+
+    /**
+     * Rewind bb then write the contents to sc
+     *
+     * @param bb is the ByteBuffer to write
+     * @return number of bytes written
+     * @throws IOException
+     */
+    public final int rewindSendAll(ByteBuffer bb) throws IOException {
+        bb.rewind();
+        return sendAll(bb);
+    }
+
+    /**
+     * read from sc until bb is filled then rewind bb
+     *
+     * @param bb is the ByteBuffer to fill
+     * @return number of bytes read
+     * @throws IOException
+     */
+    public final int recvAllRewind(ByteBuffer bb) throws IOException {
+        int count = recvAll(bb);
+        bb.rewind();
+        return count;
+    }
+
+    /**
+     * Write to log.
+     *
+     * @param s
+     */
+    static void log(String s) {
+        Log.v("MockRilChannel", s);
+    }
+}
diff --git a/mock-ril/src/js/ctrl_server.js b/mock-ril/src/js/ctrl_server.js
new file mode 100644 (file)
index 0000000..905b761
--- /dev/null
@@ -0,0 +1,142 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+/**
+ * Control Server
+ */
+function CtrlServer() {
+    // The result returned by the request handlers
+    var result = new Object();
+
+    this.ctrlGetRadioState = function(req) {
+        print('ctrlGetRadioState');
+
+        var rsp = new Object();
+        rsp.state = gRadioState;
+        result.responseProtobuf = ctrlSchema['ril_proto.CtrlRspRadioState'].serialize(rsp);
+
+        return result;
+    }
+
+    this.ctrlSetRadioState = function(req) {
+        print('ctrlSetRadioState');
+
+        var radioReq = new Object();
+
+        // Parse the request protobuf to an object, the returned value is a
+        // string that represents the variable name
+        radioReq = ctrlSchema['ril_proto.CtrlReqRadioState'].parse(req.protobuf);
+
+        setRadioState(radioReq.state);
+
+        // Prepare the response, return the current radio state
+        var rsp = new Object();
+        rsp.state = gRadioState;
+        result.responseProtobuf = ctrlSchema['ril_proto.CtrlRspRadioState'].serialize(rsp);
+        print('gRadioState after setting: ' + gRadioState);
+        return result;
+    }
+
+    /**
+     * Generate an MT call
+     */
+    this.ctrlSetMTCall = function(req) {
+        print('ctrlSetMTCall');
+
+        var mtReq = new Object();
+
+        mtReq = ctrlSchema['ril_proto.CtrlReqSetMTCall'].parse(req.protobuf);
+        setMTCall(mtReq.phoneNumber, mtReq.name);
+
+        result.sendResponse = false;
+        return result;
+    }
+
+    /**
+     * Process the request
+     */
+    this.process = function(req) {
+        try {
+            print('CtrlServer E: req.cmd=' + req.cmd + ' req.token=' + req.token);
+
+            // Assume the result will be true, successful and nothing to return
+            result.sendResponse = true;
+            result.ctrlStatus = 0;
+            result.responseProtobuf = emptyProtobuf;
+
+            // Default result will be success with no response protobuf
+            try {
+                result = (this.ctrlDispatchTable[req.cmd]).call(this, req);
+            } catch (err) {
+                print('ctrlServer: Unknown cmd=' + req.cmd);
+                result.ctrlStatus = 1; //ril_proto.CTRL_STATUS_ERR;
+            }
+
+            if (result.sendResponse) {
+                sendCtrlRequestComplete(result.ctrlStatus, req.cmd,
+                        req.token, result.responseProtobuf);
+            }
+
+            print('CtrlServer X: req.cmd=' + req.cmd + ' req.token=' + req.token);
+        } catch (err) {
+            print('CtrlServer X: Exception req.cmd=' +
+                    req.cmd + ' req.token=' + req.token + ' err=' + err);
+        }
+    }
+
+    print('CtrlServer() ctor E');
+    this.ctrlDispatchTable = new Array();
+    this.ctrlDispatchTable[CTRL_CMD_GET_RADIO_STATE] = this.ctrlGetRadioState;
+    this.ctrlDispatchTable[CTRL_CMD_SET_RADIO_STATE] = this.ctrlSetRadioState;
+    this.ctrlDispatchTable[CTRL_CMD_SET_MT_CALL] = this.ctrlSetMTCall;
+    print('CtrlServer() ctor X');
+}
+
+// The control server instance and its associated Worker
+var ctrlServer = new CtrlServer();
+var ctrlWorker = new Worker(function (req) {
+    ctrlServer.process(req);
+});
+ctrlWorker.run();
+
+/**
+ * Add the request to the ctrlServer Worker.
+ */
+function onCtrlServerCmd(cmd, token, protobuf) {
+    try {
+        print('onCtrlServerCmd E cmd=' + cmd + ' token=' + token);
+
+        var req = new Object();
+        req.cmd = cmd;
+        req.token = token;
+        req.protobuf = protobuf;
+
+        print('onCtrlServerCmd add the request:');
+
+        ctrlWorker.add(req);
+
+        print('onCtrlServerCmd X cmd=' + cmd + ' token=' + token);
+    } catch (err) {
+        print('onCtrlServerCmd X Exception err=' + err);
+    }
+}
+
+/**
+ * Optional tests
+ */
+if (false) {
+    include("ctrl_server_tests.js");
+}
diff --git a/mock-ril/src/js/ctrl_server_tests.js b/mock-ril/src/js/ctrl_server_tests.js
new file mode 100644 (file)
index 0000000..0ef7615
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+// TOOD: Add tests
diff --git a/mock-ril/src/js/mock_ril.js b/mock-ril/src/js/mock_ril.js
new file mode 100644 (file)
index 0000000..c3b6455
--- /dev/null
@@ -0,0 +1,314 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+/**
+ * @fileoverview Mock Radio Interface Layer (RIL) used for testing
+ *
+ * The following routines are defined in c++:
+ *
+ * Print a string to android log
+ *   print(string)
+ *
+ * Read a file to a string.
+ *   String readFileToString(String fileName)
+ *
+ * Read a file to a Buffer.
+ *   Buffer readFileToBuffer(String fileName)
+ *
+ * Send an response unsolicited response to the framework.
+ *   sendRilUnsolicitedResponse(Number responseNum, Buffer responseProtobuf)
+ *
+ * Send a completion request to the framework.
+ *   sendRilRequestComplete(Number rilErrCode, Number reqNum,
+ *                              String token, Buffer responseProtobuf)
+ *
+ * Send a complete request to the controller.
+ *   sendCtrlRequestComplete(Number ctrlStatus, Number reqNum,
+ *                              String token, Buffer responseProtobuf)
+ *
+ * Include the javascript file.
+ *   include(string)
+ *
+ * The following objects are defined in c++
+ *
+ * Buffer is defined in node_buffer and provides a wrapper
+ * for a buffer that can be shared between c++ and js.
+ *   Buffer(length)
+ *     Buffer::length()
+ *     Buffer::data()
+ *
+ * Schema is defined in protobuf_v8 and converts between
+ * a buffer and an object. A protobuf descriptor, ril.desc
+ * and ctrl.desc, is used to drive the conversation.
+ *     Object Schema::parse(Buffer protobuf)
+ *     Buffer Schema::serialize(object)
+ *
+ * Worker is a thread which receives messages to be handled.
+ * It is passed a function which is called once for each
+ * message as it arrives. Call the add method to queue up
+ * requests for the worker function to process.
+ *   Object Worker(function (req))
+ *      Worker::add(req);
+ */
+
+/**
+ * Globals
+ */
+
+include("ril_vars.js");
+
+var NULL_RESPONSE_STRING = '*magic-null*';
+
+// The state of the radio, needed by currentState()
+var gRadioState = RADIOSTATE_UNAVAILABLE;
+
+// The state of the screen
+var gScreenState = 0;
+
+// The base band version
+var gBaseBandVersion = 'mock-ril 0.1';
+
+// define a global variable to access the global object
+var globals = this;
+
+// Empty Protobuf, defined here so we don't have
+// to recreate an empty Buffer frequently
+var emptyProtobuf = new Buffer();
+
+// Get the ril description file and create a schema
+var packageNameAndSeperator = 'ril_proto.';
+var rilSchema = new Schema(readFileToBuffer('ril.desc'));
+var ctrlSchema = new Schema(readFileToBuffer('ctrl.desc'));
+
+/**
+ * Print properties of an object
+ */
+function printProperties(obj, maxDepth, depth) {
+    if (typeof maxDepth == 'undefined') {
+        maxDepth = 1;
+    }
+    if (typeof depth == 'undefined') {
+        depth = 1;
+    }
+    if (depth == 1) {
+        print('printProperties:');
+    }
+    for (var property in obj) {
+        try {
+            if ((typeof obj[property] == 'object')
+                    && (depth < maxDepth)) {
+                printProperties(obj[property], maxDepth, depth+1);
+            } else {
+                print(depth + ': ' + property + '=' + obj[property] +
+                        ' type=' + typeof obj[property]);
+            }
+        } catch (err) {
+            print('err=' + err)
+        }
+    }
+}
+
+// Test printProperties
+if (false) {
+    var myObject = { 'field1' : '1', 'field2' : '2', 'hello' : [ 'hi', 'there' ] };
+    printProperties(myObject, 3);
+}
+
+/**
+ * Include the components
+ */
+
+include("simulated_radio.js");
+include("simulated_icc.js");
+include("ctrl_server.js");
+
+/**
+ * Construct a new request which is passed to the
+ * Worker handler method.
+ */
+function Request(reqNum, token, protobuf, schema, schemaName) {
+    this.reqNum = reqNum;
+    this.token = token;
+    try {
+        this.data = schema[packageNameAndSeperator + schemaName].parse(protobuf);
+    } catch (err) {
+        // not a valid protobuf in the request
+        this.data = null;
+    }
+}
+
+/**
+ * Dispatch incoming requests from RIL to the appropriate component.
+ */
+function onRilRequest(reqNum, token, requestProtobuf) {
+    try {
+        //print('onRilRequest E: reqNum=' + reqNum + ' token=' + token);
+
+        /**
+         * Validate parameters
+         */
+        rilErrCode = RIL_E_SUCCESS;
+        if (typeof reqNum != 'number') {
+            print('onRilRequest: reqNum is not a number');
+            rilErrCode = RIL_E_GENERIC_FAILURE;
+        }
+        if (typeof token != 'number') {
+            print('onRilRequest: token is not a number');
+            rilErrCode = RIL_E_GENERIC_FAILURE;
+        }
+        if (typeof requestProtobuf != 'object') {
+            print('onRilRequest: requestProtobuf is not an object');
+            rilErrCode = RIL_E_GENERIC_FAILURE;
+        }
+        if (rilErrCode != RIL_E_SUCCESS) {
+            sendRilRequestComplete(rilErrCode, reqNum, token);
+            return 'onRilRequest X: invalid parameter';
+        }
+
+        try {
+            //print('onRilRequest: get entry from dispatchTable reqNum=' + reqNum);
+            entry = dispatchTable[reqNum];
+            if (typeof entry == 'undefined') {
+                throw ('entry = dispatchTable[' + reqNum + '] was undefined');
+            } else {
+                req = new Request(reqNum, token, requestProtobuf, rilSchema, entry.schemaName);
+                for(i = 0; i < entry.components.length; i++) {
+                    entry.components[i].add(req);
+                }
+            }
+        } catch (err) {
+            print('onRilRequest: Unknown reqNum=' + reqNum + ' err=' + err);
+            sendRilRequestComplete(RIL_E_REQUEST_NOT_SUPPORTED, reqNum, token);
+        }
+        // print('onRilRequest X: reqNum=' + reqNum + ' token=' + token);
+    } catch (err) {
+        print('onRilRequest X: Exception err=' + err);
+        return('onRilRequest X: Exception err=' + err);
+    }
+    return 'onRilRequest X';
+}
+
+function onUnsolicitedTick(tick) {
+    print('onUnsolicitedTick EX tick=' + tick);
+    return 3;
+}
+
+/**
+ * Dispatch table for requests
+ *
+ * Each table entry is index by the RIL_REQUEST_xxxx
+ * and contains an array of components this request
+ * is to be sent to and the name of the schema
+ * that converts the incoming protobuf to the
+ * appropriate request data.
+ *
+ * DispatchTable[RIL_REQUEST_xxx].components = Array of components
+ * DisptachTable[RIL_REQUEST_xxx].Entry.schemaName = 'Name-of-schema';
+ */
+var dispatchTable = new Array();
+
+dispatchTable[RIL_REQUEST_GET_SIM_STATUS] = { // 1
+    'components' : [simulatedIccWorker],
+    'schemaName' : 'ReqGetSimStatus',
+};
+dispatchTable[RIL_REQUEST_ENTER_SIM_PIN] = { // 2
+    'components' : [simulatedIccWorker],
+    'schemaName' : 'ReqEnterSimPin',
+};
+dispatchTable[RIL_REQUEST_GET_CURRENT_CALLS] = { // 9
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_DIAL] = { // 10
+    'components' : [simulatedRadioWorker],
+    'schemaName' : 'ReqDial',
+};
+dispatchTable[RIL_REQUEST_GET_IMSI] = { // 11
+    'components' : [simulatedIccWorker],
+};
+dispatchTable[RIL_REQUEST_HANGUP] = { // 12
+    'components' : [simulatedRadioWorker],
+    'schemaName' : 'ReqHangUp',
+};
+dispatchTable[RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND] =  { // 13
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND] = { // 14
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE] = { // 15
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_CONFERENCE] = { // 16
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_SIGNAL_STRENGTH]  = { // 19
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_REGISTRATION_STATE] = { // 20
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_GPRS_REGISTRATION_STATE] = { // 21
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_OPERATOR] = { // 22
+    'components' : [simulatedIccWorker],
+};
+dispatchTable[RIL_REQUEST_GET_IMEI] = { // 38
+    'components' : [simulatedIccWorker],
+};
+dispatchTable[RIL_REQUEST_GET_IMEISV] = { // 39
+    'components' : [simulatedIccWorker],
+};
+dispatchTable[RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE] = { // 45
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = { // 46
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_BASEBAND_VERSION] = { // 51
+    'components' : [simulatedRadioWorker],
+};
+dispatchTable[RIL_REQUEST_SEPARATE_CONNECTION] = { // 52
+    'components' : [simulatedRadioWorker],
+    'schemaName' : 'ReqSeparateConnection',
+};
+dispatchTable[RIL_REQUEST_SET_MUTE ] = { // 53
+    'components' : [simulatedRadioWorker],
+    'schemaName' : 'ReqSetMute',
+};
+dispatchTable[RIL_REQUEST_SCREEN_STATE] = { // 61
+    'components' : [simulatedRadioWorker],
+    'schemaName' : 'ReqScreenState',
+};
+
+/**
+ * Start the mock rill after loading
+ */
+function startMockRil() {
+    print("startMockRil E:");
+    setRadioState(RADIOSTATE_SIM_READY);
+    // send the signal strength after 5 seconds, wait until mock ril is started
+    simulatedRadioWorker.addDelayed({
+      'reqNum' : CMD_UNSOL_SIGNAL_STRENGTH}, 5000);
+    print("startMockRil X:");
+}
+
+/**
+ * Optional tests
+ */
+if (false) {
+    include("mock_ril_tests.js");
+}
diff --git a/mock-ril/src/js/mock_ril_tests.js b/mock-ril/src/js/mock_ril_tests.js
new file mode 100644 (file)
index 0000000..0ef7615
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+// TOOD: Add tests
diff --git a/mock-ril/src/js/ril_vars.js b/mock-ril/src/js/ril_vars.js
new file mode 100644 (file)
index 0000000..5a8d43b
--- /dev/null
@@ -0,0 +1,305 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+/**
+ * variables from ril.h
+ */
+
+/**
+ * RIL Error codes
+ */
+var RIL_E_SUCCESS = 0;
+var RIL_E_RADIO_NOT_AVAILABLE = 1;     /* If radio did not start or is resetting */
+var RIL_E_GENERIC_FAILURE = 2;
+var RIL_E_PASSWORD_INCORRECT = 3;      /* for PIN/PIN2 methods only! */
+var RIL_E_SIM_PIN2 = 4;                /* Operation requires SIM PIN2 to be entered */
+var RIL_E_SIM_PUK2 = 5;                /* Operation requires SIM PIN2 to be entered */
+var RIL_E_REQUEST_NOT_SUPPORTED = 6;
+var RIL_E_CANCELLED = 7;
+var RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL = 8; /* data ops are not allowed during voice
+                                                   call on a Class C GPRS device */
+var RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW = 9;  /* data ops are not allowed before device
+                                                   registers in network */
+var RIL_E_SMS_SEND_FAIL_RETRY = 10;             /* fail to send sms and need retry */
+var RIL_E_SIM_ABSENT = 11;                      /* fail to set the location where CDMA subscription
+                                                   shall be retrieved because of SIM or RUIM
+                                                   card absent */
+var RIL_E_SUBSCRIPTION_NOT_AVAILABLE = 12;      /* fail to find CDMA subscription from specified
+                                                   location */
+var RIL_E_MODE_NOT_SUPPORTED = 13;              /* HW does not support preferred network type */
+var RIL_E_FDN_CHECK_FAILURE = 14;               /* command failed because recipient is not on FDN
+                                                   list */
+var RIL_E_ILLEGAL_SIM_OR_ME = 15;               /* network selection failed due to */
+
+var CARD_MAX_APPS = 8;
+
+/**
+ * Icc card state
+ */
+var CARDSTATE_ABSENT   = 0;
+var CARDSTATE_PRESENT  = 1;
+var CARDSTATE_ERROR    = 2;
+
+/**
+ * RIL_PersoSubState
+ */
+var PERSOSUBSTATE_UNKNOWN                   = 0; /* initial state */
+var PERSOSUBSTATE_IN_PROGRESS               = 1; /* in between each lock transition */
+var PERSOSUBSTATE_READY                     = 2; /* when either SIM or RUIM Perso is finished
+                                                    since each app can only have 1 active perso
+                                                    involved */
+var PERSOSUBSTATE_SIM_NETWORK               = 3;
+var PERSOSUBSTATE_SIM_NETWORK_SUBSET        = 4;
+var PERSOSUBSTATE_SIM_CORPORATE             = 5;
+var PERSOSUBSTATE_SIM_SERVICE_PROVIDER      = 6;
+var PERSOSUBSTATE_SIM_SIM                   = 7;
+var PERSOSUBSTATE_SIM_NETWORK_PUK           = 8; /* The corresponding perso lock is blocked */
+var PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK    = 9;
+var PERSOSUBSTATE_SIM_CORPORATE_PUK         = 10;
+var PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK  = 11;
+var PERSOSUBSTATE_SIM_SIM_PUK               = 12;
+var PERSOSUBSTATE_RUIM_NETWORK1             = 13;
+var PERSOSUBSTATE_RUIM_NETWORK2             = 14;
+var PERSOSUBSTATE_RUIM_HRPD                 = 15;
+var PERSOSUBSTATE_RUIM_CORPORATE            = 16;
+var PERSOSUBSTATE_RUIM_SERVICE_PROVIDER     = 17;
+var PERSOSUBSTATE_RUIM_RUIM                 = 18;
+var PERSOSUBSTATE_RUIM_NETWORK1_PUK         = 19; /* The corresponding perso lock is blocked */
+var PERSOSUBSTATE_RUIM_NETWORK2_PUK         = 20;
+var PERSOSUBSTATE_RUIM_HRPD_PUK             = 21;
+var PERSOSUBSTATE_RUIM_CORPORATE_PUK        = 22;
+var PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23;
+var PERSOSUBSTATE_RUIM_RUIM_PUK             = 24;
+
+/**
+ * RIL_AppState
+ */
+var APPSTATE_UNKNOWN               = 0;
+var APPSTATE_DETECTED              = 1;
+var APPSTATE_PIN                   = 2; /* If PIN1 or UPin is required */
+var APPSTATE_PUK                   = 3; /* If PUK1 or Puk for UPin is required */
+var APPSTATE_SUBSCRIPTION_PERSO    = 4; /* perso_substate should be look at
+                                           when app_state is assigned to this value */
+var APPSTATE_READY                 = 5;
+
+/**
+ * RIL_PinState
+ */
+var PINSTATE_UNKNOWN              = 0;
+var PINSTATE_ENABLED_NOT_VERIFIED = 1;
+var PINSTATE_ENABLED_VERIFIED     = 2;
+var PINSTATE_DISABLED             = 3;
+var PINSTATE_ENABLED_BLOCKED      = 4;
+var PINSTATE_ENABLED_PERM_BLOCKED = 5;
+
+/**
+ * RIL_AppType
+ */
+var APPTYPE_UNKNOWN = 0;
+var APPTYPE_SIM     = 1;
+var APPTYPE_USIM    = 2;
+var APPTYPE_RUIM    = 3;
+var APPTYPE_CSIM    = 4;
+
+/**
+ * RIL_CallState
+ */
+var CALLSTATE_ACTIVE = 0;
+var CALLSTATE_HOLDING = 1;
+var CALLSTATE_DIALING = 2;                           /* MO call only */
+var CALLSTATE_ALERTING = 3;                          /* MO call only */
+var CALLSTATE_INCOMING = 4;                          /* MT call only */
+var CALLSTATE_WAITING = 5;                           /* MT call only */
+
+/**
+ * RIL_RadioState
+ */
+var RADIOSTATE_OFF = 0;                   /* Radio explictly powered off (eg CFUN=0) */
+var RADIOSTATE_UNAVAILABLE = 1;           /* Radio unavailable (eg, resetting or not booted) */
+var RADIOSTATE_SIM_NOT_READY = 2;         /* Radio is on, but the SIM interface is not ready */
+var RADIOSTATE_SIM_LOCKED_OR_ABSENT = 3;  /* SIM PIN locked, PUK required, network
+                                              personalization locked; or SIM absent */
+var RADIOSTATE_SIM_READY = 4;             /* Radio is on and SIM interface is available */
+var RADIOSTATE_RUIM_NOT_READY = 5;        /* Radio is on, but the RUIM interface is not ready */
+var RADIOSTATE_RUIM_READY = 6;            /* Radio is on and the RUIM interface is available */
+var RADIOSTATE_RUIM_LOCKED_OR_ABSENT = 7; /* RUIM PIN locked, PUK required, network
+                                              personalization locked; or RUIM absent */
+var RADIOSTATE_NV_NOT_READY = 8;          /* Radio is on, but the NV interface is not available */
+var RADIOSTATE_NV_READY = 9;              /* Radio is on and the NV interface is available */
+
+/**
+ * RIL requests
+ */
+var RIL_REQUEST_GET_SIM_STATUS = 1
+var RIL_REQUEST_ENTER_SIM_PIN = 2
+var RIL_REQUEST_ENTER_SIM_PUK = 3
+var RIL_REQUEST_ENTER_SIM_PIN2 = 4
+var RIL_REQUEST_ENTER_SIM_PUK2 = 5
+var RIL_REQUEST_CHANGE_SIM_PIN = 6
+var RIL_REQUEST_CHANGE_SIM_PIN2 = 7
+var RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION = 8
+var RIL_REQUEST_GET_CURRENT_CALLS = 9
+var RIL_REQUEST_DIAL = 10
+var RIL_REQUEST_GET_IMSI = 11
+var RIL_REQUEST_HANGUP = 12
+var RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND = 13
+var RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND = 14
+var RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE = 15
+var RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE = 15
+var RIL_REQUEST_CONFERENCE = 16
+var RIL_REQUEST_UDUB = 17
+var RIL_REQUEST_LAST_CALL_FAIL_CAUSE = 18
+var RIL_REQUEST_SIGNAL_STRENGTH = 19
+var RIL_REQUEST_REGISTRATION_STATE = 20
+var RIL_REQUEST_GPRS_REGISTRATION_STATE = 21
+var RIL_REQUEST_OPERATOR = 22
+var RIL_REQUEST_RADIO_POWER = 23
+var RIL_REQUEST_DTMF = 24
+var RIL_REQUEST_SEND_SMS = 25
+var RIL_REQUEST_SEND_SMS_EXPECT_MORE = 26
+var RIL_REQUEST_SETUP_DATA_CALL = 27
+var RIL_REQUEST_SIM_IO = 28
+var RIL_REQUEST_SEND_USSD = 29
+var RIL_REQUEST_CANCEL_USSD = 30
+var RIL_REQUEST_GET_CLIR = 31
+var RIL_REQUEST_SET_CLIR = 32
+var RIL_REQUEST_QUERY_CALL_FORWARD_STATUS = 33
+var RIL_REQUEST_SET_CALL_FORWARD = 34
+var RIL_REQUEST_QUERY_CALL_WAITING = 35
+var RIL_REQUEST_SET_CALL_WAITING = 36
+var RIL_REQUEST_SMS_ACKNOWLEDGE = 37
+var RIL_REQUEST_GET_IMEI = 38
+var RIL_REQUEST_GET_IMEISV = 39
+var RIL_REQUEST_ANSWER = 40
+var RIL_REQUEST_DEACTIVATE_DATA_CALL = 41
+var RIL_REQUEST_QUERY_FACILITY_LOCK = 42
+var RIL_REQUEST_SET_FACILITY_LOCK = 43
+var RIL_REQUEST_CHANGE_BARRING_PASSWORD = 44
+var RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE = 45
+var RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC = 46
+var RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL = 47
+var RIL_REQUEST_QUERY_AVAILABLE_NETWORKS = 48
+var RIL_REQUEST_DTMF_START = 49
+var RIL_REQUEST_DTMF_STOP = 50
+var RIL_REQUEST_BASEBAND_VERSION = 51
+var RIL_REQUEST_SEPARATE_CONNECTION = 52
+var RIL_REQUEST_SET_MUTE = 53
+var RIL_REQUEST_GET_MUTE = 54
+var RIL_REQUEST_QUERY_CLIP = 55
+var RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE = 56
+var RIL_REQUEST_DATA_CALL_LIST = 57
+var RIL_REQUEST_RESET_RADIO = 58
+var RIL_REQUEST_OEM_HOOK_RAW = 59
+var RIL_REQUEST_OEM_HOOK_STRINGS = 60
+var RIL_REQUEST_SCREEN_STATE = 61
+var RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION = 62
+var RIL_REQUEST_WRITE_SMS_TO_SIM = 63
+var RIL_REQUEST_DELETE_SMS_ON_SIM = 64
+var RIL_REQUEST_SET_BAND_MODE = 65
+var RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE = 66
+var RIL_REQUEST_STK_GET_PROFILE = 67
+var RIL_REQUEST_STK_SET_PROFILE = 68
+var RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND = 69
+var RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE = 70
+var RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM = 71
+var RIL_REQUEST_EXPLICIT_CALL_TRANSFER = 72
+var RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE = 73
+var RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE = 74
+var RIL_REQUEST_GET_NEIGHBORING_CELL_IDS = 75
+var RIL_REQUEST_SET_LOCATION_UPDATES = 76
+var RIL_REQUEST_CDMA_SET_SUBSCRIPTION = 77
+var RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE = 78
+var RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE = 79
+var RIL_REQUEST_SET_TTY_MODE = 80
+var RIL_REQUEST_QUERY_TTY_MODE = 81
+var RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE = 82
+var RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE = 83
+var RIL_REQUEST_CDMA_FLASH = 84
+var RIL_REQUEST_CDMA_BURST_DTMF = 85
+var RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY = 86
+var RIL_REQUEST_CDMA_SEND_SMS = 87
+var RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE = 88
+var RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG = 89
+var RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG = 90
+var RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION = 91
+var RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG = 92
+var RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG = 93
+var RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION = 94
+var RIL_REQUEST_CDMA_SUBSCRIPTION = 95
+var RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM = 96
+var RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM = 97
+var RIL_REQUEST_DEVICE_IDENTITY = 98
+var RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE = 99
+var RIL_REQUEST_GET_SMSC_ADDRESS = 100
+var RIL_REQUEST_SET_SMSC_ADDRESS = 101
+var RIL_REQUEST_REPORT_SMS_MEMORY_STATUS = 102
+var RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING = 103
+
+/**
+ * RIL unsolicited requests
+ */
+var RIL_UNSOL_RESPONSE_BASE = 1000
+var RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000
+var RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED = 1001
+var RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED = 1002
+var RIL_UNSOL_RESPONSE_NEW_SMS = 1003
+var RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT = 1004
+var RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM = 1005
+var RIL_UNSOL_ON_USSD = 1006
+var RIL_UNSOL_ON_USSD_REQUEST = 1007
+var RIL_UNSOL_NITZ_TIME_RECEIVED = 1008
+var RIL_UNSOL_SIGNAL_STRENGTH = 1009
+var RIL_UNSOL_DATA_CALL_LIST_CHANGED = 1010
+var RIL_UNSOL_SUPP_SVC_NOTIFICATION = 1011
+var RIL_UNSOL_STK_SESSION_END = 1012
+var RIL_UNSOL_STK_PROACTIVE_COMMAND = 1013
+var RIL_UNSOL_STK_EVENT_NOTIFY = 1014
+var RIL_UNSOL_STK_CALL_SETUP = 1015
+var RIL_UNSOL_SIM_SMS_STORAGE_FULL = 1016
+var RIL_UNSOL_SIM_REFRESH = 1017
+var RIL_UNSOL_CALL_RING = 1018
+var RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED = 1019
+var RIL_UNSOL_RESPONSE_CDMA_NEW_SMS = 1020
+var RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS = 1021
+var RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL = 1022
+var RIL_UNSOL_RESTRICTED_STATE_CHANGED = 1023
+var RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE = 1024
+var RIL_UNSOL_CDMA_CALL_WAITING = 1025
+var RIL_UNSOL_CDMA_OTA_PROVISION_STATUS = 1026
+var RIL_UNSOL_CDMA_INFO_REC = 1027
+var RIL_UNSOL_OEM_HOOK_RAW = 1028
+var RIL_UNSOL_RINGBACK_TONE = 1029
+var RIL_UNSOL_RESEND_INCALL_MUTE = 1030
+
+/**
+ * Control commands in ctrl.proto
+ */
+var CTRL_CMD_GET_RADIO_STATE = 1
+var CTRL_CMD_SET_RADIO_STATE = 2
+
+/**
+ * Local requests from simulated_radio or simulated_icc
+ */
+var CMD_DELAY_TEST = 2000
+var CMD_UNSOL_SIGNAL_STRENGTH = 2001
+var CMD_UNSOL_CALL_STATE_CHANGED = 2002    // Send RIL_UNSOL_CALL_STATE_CHANGED
+var CMD_CALL_STATE_CHANGE = 2003           // call state change: dialing->alert->active
+
+/**
+ * Other variables
+ */
+var OUTGOING = 0;       /* outgoing call */
+var INCOMING = 1;       /* incoming call */
diff --git a/mock-ril/src/js/simulated_icc.js b/mock-ril/src/js/simulated_icc.js
new file mode 100644 (file)
index 0000000..ee8e4d1
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+/**
+ * Simulated Icc
+ */
+function Icc() {
+
+    var MCC = '310';
+    var MNC = '260';
+    var MSN = '123456789';
+    var IMEI = '123456789012345';
+    var IMEISV = '00';
+
+    function RilAppStatus(type, state, persoState, aidPtr, appLabelPtr, pin1R, curPin1, curPin2) {
+        this.appType = type;
+        this.appState = state;
+        this.persoSubstate = persoState;
+        this.aid = aidPtr;
+        this.appLabel = appLabelPtr;
+        this.pin1Replaced = pin1R;
+        this.pin1 = curPin1;
+        this.pint2 = curPin2;
+    }
+
+    function RilCardStatus() {
+        this.cardState = CARDSTATE_PRESENT;
+        this.universalPinState = PINSTATE_UNKNOWN;
+        this.gsmUmtsSubscriptionAppIndex = 0;
+        this.cdmaSubscriptionAppIndex = CARD_MAX_APPS;
+        this.numApplications = 1;
+        this.applications = new Array(CARD_MAX_APPS);
+
+        // Initialize application status
+        for (i = 0; i < CARD_MAX_APPS; i++) {
+            var app = new RilAppStatus(APPTYPE_UNKNOWN, APPSTATE_UNKNOWN, PERSOSUBSTATE_UNKNOWN,
+                                       null, null, 0, PINSTATE_UNKNOWN, PINSTATE_UNKNOWN);
+            this.applications[i] = app;
+        }
+
+        // set gsm application status.
+        var gsmApp = new RilAppStatus(APPTYPE_SIM, APPSTATE_READY, PERSOSUBSTATE_READY, null, null,
+                                     0, PINSTATE_UNKNOWN, PINSTATE_UNKNOWN);
+        this.applications[this.gsmUmtsSubscriptionAppIndex] = gsmApp;
+    }
+
+    var cardStatus = new RilCardStatus();
+
+    // The result returned by the request handlers
+    var result = new Object();
+
+    this.rilRequestGetSimStatus = function(req) { // 1
+        print('Icc: rilRequestGetSimStatus');
+
+        var rsp = new Object();
+        rsp.cardStatus = cardStatus;
+
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspGetSimStatus'].serialize(rsp);
+        return result;
+    }
+
+    this.rilRequestEnterSimPin = function(req) { // 2
+        print('Icc: rilRequestEnterSimPin req.data.pin=' + req.data.pin);
+
+        var rsp = new Object();
+        rsp.retriesRemaining = 3;
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspEnterSimPin'].serialize(rsp);
+        return result;
+    }
+
+    this.rilRequestGetImsi = function(req) { // 11
+        print('Icc: rilRequestGetImsi');
+
+        var rsp = new Object();
+        rsp.strings = new Array();
+        rsp.strings[0] = MCC + MNC + MSN;
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspStrings'].serialize(rsp);
+        return result;
+    }
+
+    this.rilRequestOperator = function(req) { // 22
+        print('Icc: rilRequestOperator');
+
+        var rsp = new Object();
+        rsp.longAlphaOns = 'Mock-Ril long Alpha Ons';
+        rsp.shortAlphaOns = 'Mock-Ril';
+        rsp.mccMnc = MCC + MNC;
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspOperator'].serialize(rsp);
+        return result;
+    }
+
+    this.rilRequestGetImei = function(req) { // 38
+        print('Icc: rilRequestGetImei');
+
+        var rsp = new Object();
+        rsp.strings = new Array();
+        rsp.strings[0] = IMEI;
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspStrings'].serialize(rsp);
+        return result;
+    }
+
+    this.rilRequestGetImeisv = function(req) { // 39
+        print('Icc: rilRequestGetImeisv');
+
+        var rsp = new Object();
+        rsp.strings = new Array();
+        rsp.strings[0] = IMEISV;
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspStrings'].serialize(rsp);
+        return result;
+    }
+
+    /**
+     * Process the request
+     */
+    this.process = function(req) {
+        try {
+            // print('Icc E: req.reqNum=' + req.reqNum + ' req.token=' + req.token);
+
+            // Assume the result will be true, successful and nothing to return
+            result.sendResponse = true;
+            result.rilErrCode = RIL_E_SUCCESS;
+            result.responseProtobuf = emptyProtobuf;
+
+            try {
+                result = (this.simDispatchTable[req.reqNum]).call(this, req);
+            } catch (err) {
+                print('Icc: Unknown reqNum=' + req.reqNum);
+                result.rilErrCode = RIL_E_REQUEST_NOT_SUPPORTED;
+            }
+
+            if (result.sendResponse) {
+                sendRilRequestComplete(result.rilErrCode, req.reqNum,
+                        req.token, result.responseProtobuf);
+            }
+
+            // print('Icc X: req.reqNum=' + req.reqNum + ' req.token=' + req.token);
+        } catch (err) {
+            print('Icc X: Exception req.reqNum=' +
+                    req.reqNum + ' req.token=' + req.token + ' err=' + err);
+        }
+    }
+
+    print('Icc: constructor E');
+    this.simDispatchTable = new Array();
+    this.simDispatchTable[RIL_REQUEST_GET_SIM_STATUS] = this.rilRequestGetSimStatus; // 1
+    this.simDispatchTable[RIL_REQUEST_ENTER_SIM_PIN] = this.rilRequestEnterSimPin; // 2
+    this.simDispatchTable[RIL_REQUEST_GET_IMSI] = this.rilRequestGetImsi; // 11
+    this.simDispatchTable[RIL_REQUEST_OPERATOR] = this.rilRequestOperator; // 22
+    this.simDispatchTable[RIL_REQUEST_GET_IMEI] = this.rilRequestGetImei; // 38
+    this.simDispatchTable[RIL_REQUEST_GET_IMEISV] = this.rilRequestGetImeisv; // 39
+    print('Icc: constructor X');
+}
+
+// The simulated sim instance and its associated Worker
+var simulatedIcc = new Icc();
+var simulatedIccWorker = new Worker(function (req) {
+    simulatedIcc.process(req);
+});
+simulatedIccWorker.run();
+
+/**
+ * Optional tests
+ */
+if (false) {
+    include("simulated_icc_tests.js");
+}
diff --git a/mock-ril/src/js/simulated_icc_tests.js b/mock-ril/src/js/simulated_icc_tests.js
new file mode 100644 (file)
index 0000000..ca685fc
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+// TODO: Add tests
diff --git a/mock-ril/src/js/simulated_radio.js b/mock-ril/src/js/simulated_radio.js
new file mode 100644 (file)
index 0000000..46a8f51
--- /dev/null
@@ -0,0 +1,950 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+/**
+ * The Radio object contains a set of methods and objects to handle ril request
+ * which is passed from simulatedRadioWorker queue. The global object initialize
+ * an instance of Radio object by calling "new Radio". For each ril request,
+ * rilDispatchTable gets searched and the corresponding method is called.
+ * Extra requests are also defined to process unsolicited rerequests.
+ *
+ * The rilDispatchTable is an array indexed by RIL_REQUEST_* or REQUEST_UNSOL_*,
+ * in which each request corresponds to a functions defined in the Radio object.
+ * We need to pay attention when using "this" within those functions. When they are
+ * called in "this.process" using
+ *               result = this.radioDispatchTable[req.reqNum])(req);
+ * this scope of "this" within those functions are the radioDispatchTable, not the
+ * object that "this.process" belongs to. Using "this." to access other
+ * functions in the object may cause trouble.
+ * To avoid that, the object is passed in when those functions are called as
+ * shown in the following:
+ *                 result = (this.radioDispatchTable[req.reqNum]).call(this, req);
+ */
+
+/**
+ * Set radio state
+ */
+function setRadioState(newState) {
+    newRadioState = newState;
+    if (typeof newState == 'string') {
+        newRadioState = globals[newState];
+        if (typeof newRadioState == 'undefined') {
+            throw('setRadioState: Unknow string: ' + newState);
+        }
+    }
+    if ((newRadioState < RADIOSTATE_OFF) || (newRadioState > RADIOSTATE_NV_READY)) {
+        throw('setRadioState: newRadioState: ' + newRadioState + ' is invalid');
+    }
+    gRadioState = newRadioState;
+    sendRilUnsolicitedResponse(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED);
+}
+
+/**
+ * Create an incoming call 
+ */
+function setMTCall(phoneNumber) {
+    print('createIncomingCall, number=' + phoneNumber + ' E');
+    
+    if (simulatedRadio.numberActiveCalls <= 0) {
+        // If there is no connection in use, the call state is INCOMING
+        state = CALLSTATE_INCOMING;
+    } else {
+        // If the incoming call is a second call, the state is WAITING
+        state = CALLSTATE_WAITING;
+    }
+    
+    // Add call to the call array
+    simulatedRadio.addCall(state, phoneNumber, '');
+    
+    // Send unsolicited response of call state change
+    simulatedRadioWorker.add(
+      {'reqNum' : CMD_UNSOL_CALL_STATE_CHANGED});
+}
+
+/**
+ * Create a call.
+ *
+ * @return a RilCall
+ */
+function RilCall(state, phoneNumber, callerName) {
+    this.state = state;
+    this.index = 0;
+    this.toa = 0;
+    this.isMpty = false;
+    this.isMt = false;
+    this.als = 0;
+    this.isVoice = true;
+    this.isVoicePrivacy = false;
+    this.number = phoneNumber;
+    this.numberPresentation = 0;
+    this.name = callerName;
+}
+
+/**
+ * Simulated Radio
+ */
+function Radio() {
+    var registrationState = '1';
+    var lac = '0';
+    var cid = '0';
+    var radioTechnology = '3';
+    var baseStationId = NULL_RESPONSE_STRING;
+    var baseStationLatitude = NULL_RESPONSE_STRING;
+    var baseStationLongitude = NULL_RESPONSE_STRING;
+    var concurrentServices = NULL_RESPONSE_STRING;
+    var systemId  = NULL_RESPONSE_STRING;
+    var networkId = NULL_RESPONSE_STRING;
+    var roamingIndicator = NULL_RESPONSE_STRING;
+    var prlActive = NULL_RESPONSE_STRING;
+    var defaultRoamingIndicator = NULL_RESPONSE_STRING;
+    var registrationDeniedReason = NULL_RESPONSE_STRING;
+    var primaryScrambingCode = NULL_RESPONSE_STRING;
+
+    var NETWORK_SELECTION_MODE_AUTOMATIC = 0;
+    var NETWORK_SELECTION_MODE_MANUAL = 1;
+    var networkSelectionMode = NETWORK_SELECTION_MODE_AUTOMATIC;
+
+    var muteState = 0;   // disable mute
+
+    // Number of active calls in calls
+    var numberActiveCalls = 0;
+
+    // Maximum number of active calls
+    var maxNumberActiveCalls = 7;
+    var maxConnectionsPerCall = 5; // only 5 connections allowed per call
+
+
+    // Array of "active" calls
+    var calls = Array(maxNumberActiveCalls + 1);
+
+    // The result returned by the request handlers
+    var result = new Object();
+
+    function GWSignalStrength() {
+        this.signalStrength = 10;  // 10 * 2 + (-113) = -93dBm, make it three bars
+        this.bitErrorRate = 0;
+    }
+
+    function CDMASignalStrength() {
+        this.dbm = -1;
+        this.ecio = -1;
+    }
+
+    function EVDOSignalStrength() {
+        this.dbm = -1;
+        this.ecio = -1;
+        this.signalNoiseRatio = 0;
+    }
+
+    var gwSignalStrength = new GWSignalStrength;
+    var cdmaSignalStrength = new CDMASignalStrength();
+    var evdoSignalStrength = new EVDOSignalStrength();
+
+    /**
+     * The the array of calls, this is a sparse
+     * array and some elements maybe 'undefined'.
+     *
+     * @return Array of RilCall's
+     */
+    this.getCalls =  function() {
+        return calls;
+    }
+
+    /**
+     * @return the RilCall at calls[index] or null if undefined.
+     */
+    this.getCall = function(index) {
+        var c = null;
+        try {
+            c = calls[index];
+            if (typeof c == 'undefined') {
+                c = null;
+            }
+        } catch (err) {
+            c = null;
+        }
+        return c;
+    }
+
+    /** Add an active call
+     *
+     * @return a RilCall or null if too many active calls.
+     */
+    this.addCall = function(state, phoneNumber, callerName) {
+        print('Radio: addCall');
+        var c = null;
+        if (numberActiveCalls < maxNumberActiveCalls) {
+            numberActiveCalls += 1;
+            c = new RilCall(state, phoneNumber, callerName);
+            // call index should fall in the closure of [1, 7]
+            // Search for an "undefined" element in the array and insert the call
+            for (var i = 1; i < (maxNumberActiveCalls + 1); i++) {
+                print('Radio: addCall, i=' + i);
+                if (typeof calls[i] == 'undefined') {
+                    print('Radio: addCall, calls[' + i + '] is undefined');
+                    c.index = i;
+                    calls[i] = c;
+                    break;
+                }
+            }
+            this.printCalls(calls);
+        }
+        return c;
+    }
+
+    /**
+     * Remove the call, does nothing if the call is undefined.
+     *
+     * @param index into calls to remove.
+     * @return the call removed or null if did not exist
+     */
+    this.removeCall =  function(index) {
+        var c = null;
+        if ((numberActiveCalls > 0)
+                 && (index < calls.length)
+                 && (typeof calls[index] != 'undefined')) {
+            c = calls[index];
+            delete calls[index];
+            numberActiveCalls -= 1;
+            if (numberActiveCalls == 0) {
+                calls = new Array();
+            }
+        } else {
+            c = null;
+        }
+        return c;
+    }
+
+    /**
+     * Print the call
+     *
+     * @param c is the RilCall to print
+     */
+    this.printCall = function(c) {
+        if ((c != null) && (typeof c != 'undefined')) {
+            print('c[' + c.index + ']: index=' + c.index + ' state=' + c.state +
+                  ' number=' + c.number + ' name=' + c.name);
+        }
+    }
+
+    /**
+     * Print all the calls.
+     *
+     * @param callArray is an Array of RilCall's
+     */
+    this.printCalls = function(callArray) {
+        if (typeof callArray == 'undefined') {
+            callArray = calls;
+        }
+        print('callArray.length=' + callArray.length);
+        for (var i = 0; i < callArray.length; i++) {
+            if ((callArray[i] == null) || (typeof callArray[i] == 'undefined')) {
+                print('c[' + i + ']: undefined');
+            } else {
+                this.printCall(callArray[i]);
+            }
+        }
+    }
+
+    /**
+     * Print signal strength
+     */
+    this.printSignalStrength = function() {
+        print('rssi: '         + gwSignalStrength.signalStrength);
+        print('bitErrorRate: ' + gwSignalStrength.bitErrorRate);
+        print('cdmaDbm: '  +  cdmaSignalStrength.dbm);
+        print('cdmaEcio: ' + cdmaSignalStrength.ecio);
+        print('evdoRssi: ' + evdoSignalStrength.dbm);
+        print('evdoEcio: ' + evdoSignalStrength.ecio);
+        print('evdoSnr: '  + evdoSignalStrength.signalNoiseRatio);
+    }
+
+    /**
+     * set signal strength
+     *
+     * @param rssi and bitErrorRate are signal strength parameters for GSM
+     *        cdmaDbm, cdmaEcio, evdoRssi, evdoEcio, evdoSnr are parameters for CDMA & EVDO
+     */
+    this.setSignalStrength = function(rssi, bitErrorRate, cdmaDbm, cdmaEcio, evdoRssi,
+                                      evdoEcio, evdoSnr) {
+        print('setSignalStrength E');
+
+        if (rssi != 99) {
+            if ((rssi < 0) || (rssi > 31)) {
+                throw ('not a valid signal strength');
+            }
+        }
+        // update signal strength
+        gwSignalStrength.signalStrength = rssi;
+        gwSignalStrength.bitErrorRate = bitErrorRate;
+        cdmaSignalStrength.dbm = cdmaDbm;
+        cdmaSignalStrength.ecio = cdmaEcio;
+        evdoSignalStrength.dbm = evdoRssi;
+        evdoSignalStrength.ecio = evdoEcio;
+        evdoSignalStrength.signalNoiseRatio = evdoSnr;
+
+        // pack the signal strength into RspSignalStrength and send a unsolicited response
+        var rsp = new Object();
+
+        rsp.gwSignalstrength = gwSignalStrength;
+        rsp.cdmSignalstrength = cdmaSignalStrength;
+        rsp.evdoSignalstrength = evdoSignalStrength;
+
+        var response = rilSchema[packageNameAndSeperator +
+                             'RspSignalStrength'].serialize(rsp);
+
+        sendRilUnsolicitedResponse(RIL_UNSOL_SIGNAL_STRENGTH, response);
+
+        // send the unsolicited signal strength every 1 minute.
+        simulatedRadioWorker.addDelayed(
+            {'reqNum' : CMD_UNSOL_SIGNAL_STRENGTH}, 60000);
+        print('setSignalStrength X');
+    }
+
+    /**
+     * Handle RIL_REQUEST_GET_CURRENT_CALL
+     *
+     * @param req is the Request
+     */
+    this.rilRequestGetCurrentCalls = function(req) { // 9
+        print('Radio: rilRequestGetCurrentCalls E');
+        var rsp = new Object();
+
+        // pack calls into rsp.calls
+        rsp.calls = new Array();
+        var i;
+        var j;
+        for (i = 0, j = 0; i < calls.length; i++) {
+            if (typeof calls[i] != 'undefined') {
+                rsp.calls[j++] = calls[i];
+            }
+        }
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                            'RspGetCurrentCalls'].serialize(rsp);
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_DIAL
+     *
+     * @param req is the Request
+     */
+    this.rilRequestDial = function(req) { // 10
+        print('Radio: rilRequestDial E');
+        var newCall = new Object();
+        newCall = this.addCall(CALLSTATE_DIALING, req.data.address, '');
+        if (newCall == null) {
+            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+            return result;
+        }
+        this.printCalls(calls);
+
+        print('after add the call');
+        // Set call state to dialing
+        simulatedRadioWorker.add(
+                        {'reqNum' : CMD_CALL_STATE_CHANGE,
+                         'callType' : OUTGOING,
+                         'callIndex' : newCall.index,
+                         'nextState' : CALLSTATE_DIALING});
+        // Update call state to alerting after 1 second
+       simulatedRadioWorker.addDelayed(
+                        {'reqNum' : CMD_CALL_STATE_CHANGE,
+                         'callType' : OUTGOING,
+                         'callIndex' : newCall.index,
+                         'nextState' : CALLSTATE_ALERTING}, 1000);
+       // Update call state to active after 2 seconds
+        simulatedRadioWorker.addDelayed(
+                        {'reqNum' : CMD_CALL_STATE_CHANGE,
+                         'callType' : OUTGOING,
+                         'callIndex': newCall.index,
+                         'nextState' : CALLSTATE_ACTIVE}, 2000);
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_HANG_UP
+     *
+     * @param req is the Request
+     */
+    this.rilRequestHangUp = function(req) { // 12
+        print('Radio: rilRequestHangUp data.connection_index=' + req.data.connectionIndex);
+        if (this.removeCall(req.data.connectionIndex) == null) {
+            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+            print('no connection to hangup');
+        }
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND
+     *        Hang up waiting or held
+     *
+     * @param req is the Request
+     */
+    this.rilRequestHangupWaitingOrBackground = function(req) { // 13
+        print('Radio: rilRequestHangupWaitingOrBackground');
+        if (numberActiveCalls <= 0) {
+          result.rilErrCode = RIL_E_GENERIC_FAILURE;
+        } else {
+            for (var i = 0; i < calls.length; i++) {
+                if (typeof calls[i] != 'undefined') {
+                    switch (calls[i].state) {
+                        case CALLSTATE_HOLDING:
+                        case CALLSTATE_WAITING:
+                            this.removeCall(i);
+                            break;
+                        default:
+                            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+                            break;
+                    }
+                    this.printCalls(calls);
+                    if(result.rilErrCode == RIL_E_GENERIC_FAILURE) {
+                        return result;
+                    }
+                } // end of processing call[i]
+            } // end of for
+        }
+        // Send out RIL_UNSOL_CALL_STATE_CHANGED after the request is returned
+        simulatedRadioWorker.add(
+          {'reqNum' : CMD_UNSOL_CALL_STATE_CHANGED});
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND
+     *   release all active calls (if any exist) and resume held or waiting calls.
+     * @param req is the Request
+     */
+    this.rilRequestHangUpForegroundResumeBackground = function(req) { //14
+        print('Radio: rilRequestHangUpForegroundResumeBackground');
+        if (numberActiveCalls <= 0) {
+            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+        } else {
+            for (var i = 0; i < calls.length; i++) {
+                if (typeof calls[i] != 'undefined') {
+                    switch (calls[i].state) {
+                        case CALLSTATE_ACTIVE:
+                            this.removeCall(i);
+                            break;
+                        case CALLSTATE_HOLDING:
+                        case CALLSTATE_WAITING:
+                          calls[i].state = CALLSTATE_ACTIVE;
+                            break;
+                        default:
+                            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+                            break;
+                    }
+                    this.printCalls(calls);
+                    if(result.rilErrCode == RIL_E_GENERIC_FAILURE) {
+                        return result;
+                    }
+                } // end of processing call[i]
+            }
+        }
+        // Send out RIL_UNSOL_CALL_STATE_CHANGED after the request is returned
+        simulatedRadioWorker.add(
+          {'reqNum' : CMD_UNSOL_CALL_STATE_CHANGED});
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE
+     *
+     *     BEFORE                               AFTER
+     * Call 1   Call 2                 Call 1       Call 2
+     * ACTIVE   HOLDING                HOLDING     ACTIVE
+     * ACTIVE   WAITING                HOLDING     ACTIVE
+     * HOLDING  WAITING                HOLDING     ACTIVE
+     * ACTIVE   IDLE                   HOLDING     IDLE
+     * IDLE     IDLE                   IDLE        IDLE
+     *
+     * @param req is the Request
+     */
+    this.rilRequestSwitchWaitingOrHoldingAndActive = function(req) {  // 15
+        print('Radio: rilRequestSwitchWaitingOrHoldingAndActive');
+        print('Radio: lastReq = ' + lastReq);
+        print('Radio: req.reqNum = ' + req.reqNum);
+        if (lastReq == req.reqNum) {
+            print('Radio: called twice');
+            return result;
+        }
+
+        if (numberActiveCalls <= 0) {
+            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+        } else {
+            for (var i = 0; i < calls.length; i++) {
+                if (typeof calls[i] != 'undefined') {
+                    switch (calls[i].state) {
+                        case CALLSTATE_ACTIVE:
+                            calls[i].state = CALLSTATE_HOLDING;
+                            break;
+                        case CALLSTATE_HOLDING:
+                        case CALLSTATE_WAITING:
+                            calls[i].state = CALLSTATE_ACTIVE;
+                            break;
+                        default:
+                            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+                            break;
+                    }
+                    this.printCalls(calls);
+                    if(result.rilErrCode == RIL_E_GENERIC_FAILURE) {
+                        return result;
+                    }
+                } // end of processing call[i]
+            } // end of for
+        }
+        // Send out RIL_UNSOL_CALL_STATE_CHANGED after the request is returned
+        simulatedRadioWorker.add(
+          {'reqNum' : CMD_UNSOL_CALL_STATE_CHANGED});
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_CONFERENCE
+     * Conference holding and active
+     *
+     * @param req is the Request
+     */
+    this.rilRequestConference = function(req) {  // 16
+        print('Radio: rilRequestConference E');
+        if ((numberActiveCalls <= 0) || (numberActiveCalls > maxConnectionsPerCall)) {
+            // The maximum number of connections within a call is 5
+            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+            return result;
+        } else {
+            var numCallsInBadState = 0;
+            for (var i = 0; i < calls.length; i++) {
+                if (typeof calls[i] != 'undefined') {
+                    if ((calls[i].state != CALLSTATE_ACTIVE) &&
+                            (calls[i].state != CALLSTATE_HOLDING)) {
+                        numCallsInBadState++;
+                    }
+                }
+            }
+
+            // if there are calls not in ACITVE or HOLDING state, return error
+            if (numCallsInBadState > 0) {
+                result.rilErrCode = RIL_E_GENERIC_FAILURE;
+                return result;
+            } else { // conference ACTIVE and HOLDING calls
+                for (var i = 0; i < calls.length; i++) {
+                    if (typeof calls[i] != 'undefined') {
+                        switch (calls[i].state) {
+                            case CALLSTATE_ACTIVE:
+                                break;
+                            case CALLSTATE_HOLDING:
+                                calls[i].state = CALLSTATE_ACTIVE;
+                                break;
+                            default:
+                                result.rilErrCode = RIL_E_GENERIC_FAILURE;
+                                break;
+                        }
+                    }
+                    this.printCalls(calls);
+                    if(result.rilErrCode == RIL_E_GENERIC_FAILURE) {
+                        return result;
+                    }
+                }
+            }
+        }
+
+        // Only if conferencing is successful,
+        // Send out RIL_UNSOL_CALL_STATE_CHANGED after the request is returned
+        simulatedRadioWorker.add(
+          {'reqNum' : CMD_UNSOL_CALL_STATE_CHANGED});
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_SIGNAL_STRENGTH
+     *
+     * @param req is the Request
+     */
+    this.rilRequestSignalStrength = function(req) { // 19
+        print('Radio: rilRequestSignalStrength E');
+        var rsp = new Object();
+
+        // pack the signal strength into RspSignalStrength
+        rsp.gwSignalstrength = gwSignalStrength;
+        rsp.cdmaSignalstrength = cdmaSignalStrength;
+        rsp.evdoSignalstrength = evdoSignalStrength;
+
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                            'RspSignalStrength'].serialize(rsp);
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_REGISTRATION_STATE
+     *
+     * @param req is the Request
+     */
+    this.rilRequestRegistrationState = function(req) { // 20
+        print('Radio: rilRequestRegistrationState');
+
+        var rsp = new Object();
+        rsp.strings = Array();
+        rsp.strings[0] = registrationState;
+        rsp.strings[1] = lac;
+        rsp.strings[2] = cid;
+        rsp.strings[3] = radioTechnology;
+        rsp.strings[4] = baseStationId;
+        rsp.strings[5] = baseStationLatitude;
+        rsp.strings[6] = baseStationLongitude;
+        rsp.strings[7] = concurrentServices;
+        rsp.strings[8] = systemId;
+        rsp.strings[9] = networkId;
+        rsp.strings[10] = roamingIndicator;
+        rsp.strings[11] = prlActive;
+        rsp.strings[12] = defaultRoamingIndicator;
+        rsp.strings[13] = registrationDeniedReason;
+        rsp.strings[14] = primaryScrambingCode;
+
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspStrings'].serialize(rsp);
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_GPRS_REGISTRATION_STATE
+     *
+     * @param req is the Request
+     */
+    this.rilRequestGprsRegistrationState = function(req) { // 21
+        print('Radio: rilRequestGprsRegistrationState');
+
+        var rsp = new Object();
+        rsp.strings = Array();
+        rsp.strings[0] = registrationState;
+        rsp.strings[1] = lac;
+        rsp.strings[2] = cid;
+        rsp.strings[3] = radioTechnology;
+
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspStrings'].serialize(rsp);
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE
+     *
+     * @param req is the Request
+     */
+    this.rilRequestQueryNeworkSelectionMode = function(req) { // 45
+        print('Radio: rilRequestQueryNeworkSelectionMode');
+
+        var rsp = new Object();
+        rsp.integers = Array();
+        rsp.integers[0] = networkSelectionMode;
+
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspIntegers'].serialize(rsp);
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC
+     *
+     * @param req is the Request
+     */
+    this.rilRequestSetNeworkSelectionAutomatic = function(req) { // 46
+        print('Radio: rilRequestSetNeworkSelectionAutomatic');
+
+        networkSelectionMode = NETWORK_SELECTION_MODE_AUTOMATIC;
+
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_BASE_BAND_VERSION
+     *
+     * @param req is the Request
+     */
+    this.rilRequestBaseBandVersion = function(req) { // 51
+        print('Radio: rilRequestBaseBandVersion');
+        var rsp = new Object();
+        rsp.strings = Array();
+        rsp.strings[0] = gBaseBandVersion;
+
+        result.responseProtobuf = rilSchema[packageNameAndSeperator +
+                                 'RspStrings'].serialize(rsp);
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_SEPRATE_CONNECTION
+     * Separate a party from a multiparty call placing the multiparty call
+     * (less the specified party) on hold and leaving the specified party
+     * as the only other member of the current (active) call
+     *
+     * See TS 22.084 1.3.8.2 (iii)
+     *
+     * @param req is the Request
+     */
+    this.rilReqestSeparateConnection = function(req) {  // 52
+        print('Radio: rilReqestSeparateConnection');
+        var index = req.data.index;
+
+        if (numberActiveCalls <= 0) {
+            result.rilErrCode = RIL_E_GENERIC_FAILURE;
+            return result;
+        } else {
+            // get the connection to separate
+            var separateConn = this.getCall(req.data.index);
+            if (separateConn == null) {
+                result.rilErrCode = RIL_E_GENERIC_FAILURE;
+                return result;
+            } else {
+                if (separateConn.state != CALLSTATE_ACTIVE) {
+                    result.rilErrCode = RIL_E_GENERIC_FAILURE;
+                    return result;
+                }
+                // Put all other connections in hold.
+                for (var i = 0; i < calls.length; i++) {
+                    if (index != i) {
+                        // put all the active call to hold
+                        if (typeof calls[i] != 'undefined') {
+                            switch (calls[i].state) {
+                                case CALLSTATE_ACTIVE:
+                                    calls[i].state = CALLSTATE_HOLDING;
+                                    break;
+                                default:
+                                    result.rilErrCode = RIL_E_GENERIC_FAILURE;
+                                    break;
+                            }
+                            this.printCalls(calls);
+                            if(result.rilErrCode == RIL_E_GENERIC_FAILURE) {
+                                return result;
+                            }
+                        }  // end of processing call[i]
+                    }
+                }  // end of for
+            }
+        }
+
+        // Send out RIL_UNSOL_CALL_STATE_CHANGED after the request is returned
+        simulatedRadioWorker.add(
+          {'reqNum' : CMD_UNSOL_CALL_STATE_CHANGED});
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_SET_MUTE
+     */
+    this.rilRequestSetMute = function(req) { // 53
+        print('Radio: rilRequestSetMute: req.data.state=' + req.data.state);
+        muteState = req.data.state;
+        if (gRadioState == RADIOSTATE_UNAVAILABLE) {
+            result.rilErrCode = RIL_E_RADIO_NOT_AVAILABLE;
+        }
+        return result;
+    }
+
+    /**
+     * Handle RIL_REQUEST_SCREEN_STATE
+     *
+     * @param req is the Request
+     */
+    this.rilRequestScreenState = function(req) { // 61
+        print('Radio: rilRequestScreenState: req.data.state=' + req.data.state);
+        screenState = req.data.state;
+        return result;
+    }
+
+    /**
+     * Delay test
+     */
+     this.cmdDelayTest = function(req) { // 2000
+         print('cmdDelayTest: req.hello=' + req.hello);
+         result.sendResponse = false;
+         return result;
+     }
+
+     /**
+      * Delay for RIL_UNSOL_SIGNAL_STRENGTH
+      * TODO: Simulate signal strength changes:
+      * Method 1: provide an array for signal strength, and send the unsolicited
+      *           reponse periodically (the period can also be simulated)
+      * Method 2: Simulate signal strength randomly (within a certain range) and
+      *           send the response periodically.
+      */
+     this.cmdUnsolSignalStrength = function(req) { // 2001
+         print('cmdUnsolSignalStrength: req.reqNum=' + req.reqNum);
+         var rsp = new Object();
+
+         // pack the signal strength into RspSignalStrength
+         rsp.gwSignalstrength = gwSignalStrength;
+         rsp.cdmaSignalstrength = cdmaSignalStrength;
+         rsp.evdoSignalstrength = evdoSignalStrength;
+
+         response = rilSchema[packageNameAndSeperator +
+                              'RspSignalStrength'].serialize(rsp);
+
+         // upldate signal strength
+         sendRilUnsolicitedResponse(RIL_UNSOL_SIGNAL_STRENGTH, response);
+
+         // Send the unsolicited signal strength every 1 minute.
+         simulatedRadioWorker.addDelayed(
+             {'reqNum' : CMD_UNSOL_SIGNAL_STRENGTH}, 60000);
+
+         // this is not a request, no response is needed
+         result.sendResponse = false;
+         return result;
+     }
+
+     /**
+      * Send RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED
+      */
+     this.cmdUnsolCallStateChanged = function(req) { // 2002
+         print('cmdUnsolCallStateChanged: req.reqNum=' + req.reqNum);
+         sendRilUnsolicitedResponse(RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED);
+         result.sendResponse = false;
+         return result;
+     }
+
+     /**
+      * Simulate call state change
+      */
+     this.cmdCallStateChange = function(req) { // 2003
+         print('cmdCallStateChange: req.reqNum=' + req.reqNum);
+         print('cmdCallStateChange: req.callType=' + req.callType);
+         print('cmdCallStateChange: req.callIndex=' + req.callIndex);
+         print('cmdCallStateChange: req.nextState=' + req.nextState);
+
+         // if it is an outgoing call, update the call state of the call
+         // Send out call state changed flag
+         var curCall = this.getCall(req.callIndex);
+         this.printCall(curCall);
+
+         if (curCall != null) {
+             curCall.state = req.nextState;
+         } else {
+             this.removeCall(req.callIndex);
+         }
+
+         // TODO: if it is an incoming call, update the call state of the call
+         // Send out call state change flag
+         // Send out RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED
+         simulatedRadioWorker.add(
+           {'reqNum' : CMD_UNSOL_CALL_STATE_CHANGED});
+         result.sendResponse = false;
+         return result;
+     }
+    /**
+     * Process the request by dispatching to the request handlers
+     */
+    this.process = function(req) {
+        try {
+            //print('Radio E: req.reqNum=' + req.reqNum + ' req.token=' + req.token);
+
+            // Assume the result will be true, successful and nothing to return
+            result.sendResponse = true;
+            result.rilErrCode = RIL_E_SUCCESS;
+            result.responseProtobuf = emptyProtobuf;
+
+            try {
+                // Pass "this" object to each ril request call such that
+                // they have the same scope
+                result = (this.radioDispatchTable[req.reqNum]).call(this, req);
+            } catch (err) {
+                print('Radio:process err = ' + err);
+                print('Radio: Unknown reqNum=' + req.reqNum);
+                result.rilErrCode = RIL_E_REQUEST_NOT_SUPPORTED;
+            }
+
+            if (req.reqNum < 200) {
+                lastReq = req.reqNum;
+            }
+            if (result.sendResponse) {
+                sendRilRequestComplete(result.rilErrCode, req.reqNum,
+                        req.token, result.responseProtobuf);
+            }
+
+            //print('Radio X: req.reqNum=' + req.reqNum + ' req.token=' + req.token);
+        } catch (err) {
+            print('Radio: Exception req.reqNum=' +
+                    req.reqNum + ' req.token=' + req.token + ' err=' + err);
+        }
+    }
+
+    /**
+     * Construct the simulated radio
+     */
+    print('Radio: constructor E');
+    this.radioDispatchTable = new Array();
+    this.radioDispatchTable[RIL_REQUEST_GET_CURRENT_CALLS] = // 9
+                this.rilRequestGetCurrentCalls;
+    this.radioDispatchTable[RIL_REQUEST_DIAL] = // 10
+                this.rilRequestDial;
+    this.radioDispatchTable[RIL_REQUEST_HANGUP] =  // 12
+                this.rilRequestHangUp;
+    this.radioDispatchTable[RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND] = // 13
+                this.rilRequestHangupWaitingOrBackground;
+    this.radioDispatchTable[RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND] =  // 14
+                this.rilRequestHangUpForegroundResumeBackground;
+    this.radioDispatchTable[RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE] =  // 15
+                this.rilRequestSwitchWaitingOrHoldingAndActive;
+    this.radioDispatchTable[RIL_REQUEST_CONFERENCE] = // 16
+                this.rilRequestConference;
+    this.radioDispatchTable[RIL_REQUEST_SIGNAL_STRENGTH] = // 19
+                this.rilRequestSignalStrength;
+    this.radioDispatchTable[RIL_REQUEST_REGISTRATION_STATE] = // 20
+                this.rilRequestRegistrationState;
+    this.radioDispatchTable[RIL_REQUEST_GPRS_REGISTRATION_STATE] = // 21
+                this.rilRequestGprsRegistrationState;
+    this.radioDispatchTable[RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE] = // 45
+                this.rilRequestQueryNeworkSelectionMode;
+    this.radioDispatchTable[RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = // 46
+                this.rilRequestSetNeworkSelectionAutomatic;
+    this.radioDispatchTable[RIL_REQUEST_BASEBAND_VERSION] = // 51
+                this.rilRequestBaseBandVersion;
+    this.radioDispatchTable[RIL_REQUEST_SEPARATE_CONNECTION] = // 52
+                this.rilReqestSeparateConnection;
+    this.radioDispatchTable[RIL_REQUEST_SET_MUTE] = // 53
+                this.rilRequestSetMute;
+    this.radioDispatchTable[RIL_REQUEST_SCREEN_STATE] = // 61
+                this.rilRequestScreenState;
+
+    this.radioDispatchTable[CMD_DELAY_TEST] = // 2000
+                this.cmdDelayTest;
+    this.radioDispatchTable[CMD_UNSOL_SIGNAL_STRENGTH] =  // 2001
+                this.cmdUnsolSignalStrength;
+    this.radioDispatchTable[CMD_UNSOL_CALL_STATE_CHANGED] =  // 2002
+                this.cmdUnsolCallStateChanged;
+    this.radioDispatchTable[CMD_CALL_STATE_CHANGE] = //2003
+                this.cmdCallStateChange;
+
+    print('Radio: constructor X');
+}
+
+// The simulated radio instance and its associated Worker
+var simulatedRadio = new Radio();
+var simulatedRadioWorker = new Worker(function (req) {
+    simulatedRadio.process(req);
+});
+simulatedRadioWorker.run();
+
+// TODO: this is a workaround for bug http://b/issue?id=3001613
+// When adding a new all, two RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE
+// will be sent from the framework.
+var lastReq = 0;
+
+/**
+ * Optional tests
+ */
+if (false) {
+    include("simulated_radio_tests.js");
+}
diff --git a/mock-ril/src/js/simulated_radio_tests.js b/mock-ril/src/js/simulated_radio_tests.js
new file mode 100644 (file)
index 0000000..05106d8
--- /dev/null
@@ -0,0 +1,320 @@
+/**
+ * Copyright (C) 2010 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.
+ */
+
+
+/**
+ * A test to test set signal strength
+ */
+if (false) {
+    function testSetSignalStrength() {
+        print('testSetSignalStrength E:');
+        simulatedRadio.printSignalStrength();
+        try {
+            simulatedRadio.setSignalStrength(0, -1, -1, -1, -1, -1, -1);
+        } catch (err) {
+            print('test failed');
+        }
+        simulatedRadio.printSignalStrength();
+        try {
+            simulatedRadio.setSignalStrength(60, 30, 29 , 28, 27, 26, 25);
+        } catch (err) {
+            print('test success: ' + err);
+        }
+        simulatedRadio.printSignalStrength();
+    }
+    testSetSignalStrength();
+}
+
+/**
+ * TODO: A test for RIL_REQUEST_GET_CURRENT_CALLS,
+ *       remove when satisfied all is well.
+ */
+if (false) {
+    var calls = simulatedRadio.getCalls();
+
+    function testCalls() {
+        print('testCalls E:');
+        var c0 = simulatedRadio.addCall(CALLSTATE_ACTIVE, '16502859848', 'w');
+        simulatedRadio.printCalls();
+        var c1 = simulatedRadio.addCall(CALLSTATE_ACTIVE, '16502583456', 'm');
+        simulatedRadio.printCalls();
+        var c2 = simulatedRadio.addCall(CALLSTATE_ACTIVE, '16502345678', 'x');
+        simulatedRadio.printCalls();
+        var c3 = simulatedRadio.addCall(CALLSTATE_ACTIVE, '16502349876', 'y');
+        simulatedRadio.printCalls();
+
+        simulatedRadio.removeCall(c0.index);
+        simulatedRadio.printCalls();
+        simulatedRadio.removeCall(c1.index);
+        simulatedRadio.printCalls();
+        simulatedRadio.removeCall(c2.index);
+        simulatedRadio.printCalls();
+
+        result = simulatedRadio.rilRequestGetCurrentCalls();
+        newCalls = rilSchema[packageNameAndSeperator +
+                            'RspGetCurrentCalls'].parse(result.responseProtobuf);
+        simulatedRadio.printCalls(newCalls.calls);
+
+        // Set to false to test RIL_REQUEST_GET_CURRENT_CALLS as there will
+        // be on call still active on the first RIL_REQUEST_GET_CURRENT_CALLS
+        // request.
+        if (false) {
+            simulatedRadio.removeCall(c3.index);
+            simulatedRadio.printCalls();
+        }
+        print('testCalls X:');
+    }
+
+    testCalls();
+}
+
+/**
+ * A test for RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND
+ */
+if (false) {
+    var calls = simulatedRadio.getCalls();
+
+    function testHangUpForegroundResumeBackground() {
+        print('testHangUpForegroundResumeBackground E:');
+        var testOutput = false;
+        for (var state = CALLSTATE_ACTIVE; state <= CALLSTATE_WAITING; state++) {
+            var c0 = simulatedRadio.addCall(state, '16502849230', 'smith');
+            var req = new Object();
+            req.reqNum = RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND;
+            var testResult = simulatedRadio.rilRequestHangUpForegroundResumeBackground(req);
+            if (state == CALLSTATE_ACTIVE) {
+                var testCalls = simulatedRadio.getCalls();
+                if (testCalls.length == 0) {
+                    testOutput = true;
+                } else {
+                    testOutput = false;
+                }
+            } else if (state == CALLSTATE_WAITING) {
+                if (c0.state == CALLSTATE_ACTIVE) {
+                    testOutput = true;
+                } else {
+                    testOutput = false;
+                }
+            } else if (state == CALLSTATE_HOLDING) {
+                if (c0.state == CALLSTATE_ACTIVE) {
+                    testOutput = true;
+                } else {
+                    testOutput = false;
+                }
+            } else {
+                if (testResult.rilErrCode == RIL_E_GENERIC_FAILURE) {
+                    testOutput = true;
+                } else {
+                    testOutput = false;
+                }
+            }
+            if (testOutput == true) {
+                print('testHangUpForegroundResumeBackground, call ' + state + ' PASS \n');
+            } else {
+                print('testHangUpForegroundResumeBackground, call ' + state + ' FAIL \n');
+            }
+            simulatedRadio.removeCall(c0.index);
+            simulatedRadio.printCalls();
+        }
+    }
+
+    testHangUpForegroundResumeBackground();
+}
+
+/**
+ * Test RIL_REQUEST_CONFERENCE
+ */
+if(false) {
+    var calls = simulatedRadio.getCalls();
+
+    function testConference() {
+        print('testConference E');
+
+        // test case 1: one holding, one dialing
+        var c0 = simulatedRadio.addCall(CALLSTATE_HOLDING, '16502859848', 'w');
+        simulatedRadio.printCalls();
+        var c1 = simulatedRadio.addCall(CALLSTATE_DIALING, '16502583456', 'm');
+        simulatedRadio.printCalls();
+
+        var req = new Object();
+        req.reqNum = RIL_REQUEST_CONFERENCE;
+        var testResult = new Object();
+        testResult.rilErrCode = RIL_E_SUCCESS;
+        testResult = simulatedRadio.rilRequestConference(req);
+        if (testResult.rilErrCode == RIL_E_GENERIC_FAILURE) {
+            print('testConference: holding & dialing: pass');
+        } else {
+            print('testConference: holding & dialing: fail');
+        }
+
+        // test case 2: one holding, one alerting
+        c1.state = CALLSTATE_ALERTING;
+        testResult.rilErrCode = RIL_E_SUCCESS;
+        testResult = simulatedRadio.rilRequestConference(req);
+        if (testResult.rilErrCode == RIL_E_GENERIC_FAILURE) {
+            print('testConference: holding & alerting: pass');
+        } else {
+            print('testConference: holding & alerting: fail');
+        }
+
+        // test case 3: one holding, one active
+        c1.state = CALLSTATE_ACTIVE;
+        testResult.rilErrCode = RIL_E_SUCCESS;
+        testResult = simulatedRadio.rilRequestConference(req);
+        if (testResult.rilErrCode == RIL_E_SUCCESS) {
+            print('testConference: holding & active: pass');
+        } else {
+            print('testConference: holding & active: fail');
+        }
+
+        // test case 4: one holding, one incoming
+        c1.state = CALLSTATE_INCOMING;
+        testResult.rilErrCode = RIL_E_SUCCESS;
+        testResult = simulatedRadio.rilRequestConference(req);
+        if (testResult.rilErrCode == RIL_E_GENERIC_FAILURE) {
+            print('testConference: holding & incoming: pass');
+        } else {
+            print('testConference: holding & incoming: fail');
+        }
+
+        // test case 5: one holding, one waiting
+        c1.state = CALLSTATE_WAITING;
+        testResult.rilErrCode = RIL_E_SUCCESS;
+        testResult = simulatedRadio.rilRequestConference(req);
+        if (testResult.rilErrCode == RIL_E_GENERIC_FAILURE) {
+            print('testConference: holding & waiting: pass');
+        } else {
+            print('testConference: holding & waiting: fail');
+        }
+
+        simulatedRadio.removeCall(c0.index);
+        simulatedRadio.removeCall(c1.index);
+        print('testConference: X');
+    }
+
+    testConference();
+}
+/**
+ * Test serialization of bad numeric enum
+ */
+if (false) {
+    var c = new RilCall(1000, '11234567890', 'me');
+    rsp = new Object();
+    rsp.calls = [ c ];
+    try {
+        rilSchema[packageNameAndSeperator + 'RspGetCurrentCalls'].serialize(rsp);
+        print('test-enum a bad numeric enum value, FAILURE exception expected');
+    } catch (err) {
+        print('test-enum a bad numeric enum value, SUCCESS exception expected: ' + err);
+    }
+}
+
+/**
+ * Test serialization of bad string enum
+ */
+if (false) {
+    // The state parameter 'NOT_CALLSTATE_ACTIVE' can get corrupted in ToProto?
+    var c = new RilCall('NOT_CALLSTATE_ACTIVE', '11234567890', 'me');
+    rsp = new Object();
+    rsp.calls = [ c ];
+    try {
+        rilSchema[packageNameAndSeperator + 'RspGetCurrentCalls'].serialize(rsp);
+        print('test-enum a bad string enum value, FAILURE exception expected');
+    } catch (err) {
+        print('test-enum a bad string enum value, SUCCESS exception expected: ' + err);
+    }
+}
+
+/**
+ * Test addDelayed
+ */
+if (false) {
+    print("test addDelayed E");
+    simulatedRadioWorker.add( {
+        'reqNum' : CMD_DELAY_TEST,
+        'hello' : 'hi no delay' });
+    simulatedRadioWorker.addDelayed( {
+        'reqNum' : CMD_DELAY_TEST,
+        'hello' : 'hi not-a-number is 0 delay' }, "not-a-number");
+    simulatedRadioWorker.addDelayed( {
+        'reqNum' : CMD_DELAY_TEST,
+        'hello' : 'hi negative delay is 0 delay' }, -1000);
+    simulatedRadioWorker.addDelayed( {
+        'reqNum' : CMD_DELAY_TEST,
+        'hello' : 'hi delayed 2 seconds' }, 2000);
+    print("test addDelayed X");
+}
+
+/**
+ * A test for setRadioState, verify it can handle valid string variable,
+ * undefined varilabe, and invalid radio state correctly.
+ */
+if (false) {
+    function testSetRadioState() {
+        print('testSetRadioState E:');
+        // defined string variable
+        newState = 'RADIOSTATE_UNAVAILABLE';
+        try {
+            setRadioState(newState);
+        } catch (err) {
+            print('test failed');
+        }
+        print('Expecting gRadioState to be ' + RADIOSTATE_UNAVAILABLE +
+              ', gRadioState is: ' + gRadioState);
+
+        // undefined string variable, expecting exception
+        try {
+            setRadioState('RADIOSTATE_UNDEFINED');
+        } catch (err) {
+            if (err.indexOf('Unknow string') >= 0) {
+                print('test success');
+                print('err: ' + err);
+            } else {
+                print('test failed');
+            }
+        }
+
+        // valid radio state
+        try {
+            setRadioState(RADIOSTATE_NV_READY);
+        } catch (err) {
+            print('test failed');
+        }
+        print('Expecting gRadioState to be ' + RADIOSTATE_NV_READY +
+              ', gRadioState is: ' + gRadioState);
+
+        // invalid radio state
+        try {
+            setRadioState(-1);
+        } catch (err) {
+            if (err.indexOf('invalid') >= 0) {
+                print('test success');
+                print('err: ' + err);
+            } else {
+                print('test failed, err: ' + err);
+            }
+        }
+        print('gRadioState should not be set: ' + gRadioState);
+
+        // set radio state to be SIM_READY
+        setRadioState(RADIOSTATE_SIM_READY);
+        print('Expecting gRadioState to be ' + RADIOSTATE_SIM_READY +
+              ', gRadioState is: ' + gRadioState);
+        print('testSetRadioState X:');
+    }
+
+    testSetRadioState();
+}
diff --git a/mock-ril/src/proto/ctrl.proto b/mock-ril/src/proto/ctrl.proto
new file mode 100644 (file)
index 0000000..e835c67
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright 2010 Google Inc. All Rights Reserved.
+// Author: wink@google.com (Wink Saville)
+
+package ril_proto;
+
+option java_package='com.android.internal.telephony.ril_proto';
+option java_outer_classname='RilCtrlCmds';
+
+import "ril.proto";
+
+enum CtrlCmd {
+  CTRL_CMD_ECHO = 0;
+  CTRL_CMD_GET_RADIO_STATE      = 1;
+  CTRL_CMD_SET_RADIO_STATE      = 2;
+  CTRL_CMD_SET_MT_CALL = 3;
+}
+
+enum CtrlStatus {
+    CTRL_STATUS_OK = 0;
+    CTRL_STATUS_ERR = 1;
+}
+
+// request of setting radio state
+message CtrlReqRadioState {
+  required ril_proto.RadioState state = 1;
+}
+
+// response of set/get radio state
+message CtrlRspRadioState {
+  required ril_proto.RadioState state = 1;
+}
+
+// request of creating an incoming call
+message CtrlReqSetMTCall {
+  required string phone_number         = 1;  // Phone number to display
+}
+
diff --git a/mock-ril/src/proto/msgheader.proto b/mock-ril/src/proto/msgheader.proto
new file mode 100644 (file)
index 0000000..0886de9
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2010 Google Inc. All Rights Reserved.
+// Author: wink@google.com (Wink Saville)
+
+package communication;
+
+option java_package='com.android.internal.communication';
+
+message MsgHeader {
+  required uint32 cmd = 1;
+  required uint32 length_data = 2;
+  optional uint32 status = 3;
+  optional uint64 token = 4;
+}
diff --git a/mock-ril/src/proto/ril.proto b/mock-ril/src/proto/ril.proto
new file mode 100644 (file)
index 0000000..206b786
--- /dev/null
@@ -0,0 +1,278 @@
+// Copyright 2010 Google Inc. All Rights Reserved.
+// Author: wink@google.com (Wink Saville)
+
+package ril_proto;
+
+option java_package='com.android.internal.telephony.ril_proto';
+option java_outer_classname='RilCmds';
+
+enum RadioState {
+    RADIOSTATE_OFF                      = 0; /* Radio explictly powered off (eg CFUN=0) */
+    RADIOSTATE_UNAVAILABLE              = 1; /* Radio unavailable (eg, resetting or not booted) */
+    RADIOSTATE_SIM_NOT_READY            = 2; /* Radio is on, but the SIM interface is not ready */
+    RADIOSTATE_SIM_LOCKED_OR_ABSENT     = 3; /* SIM PIN locked, PUK required, network
+                                                personalization locked, or SIM absent */
+    RADIOSTATE_SIM_READY                = 4; /* Radio is on and SIM interface is available */
+    RADIOSTATE_RUIM_NOT_READY           = 5; /* Radio is on, but the RUIM interface is not ready */
+    RADIOSTATE_RUIM_READY               = 6; /* Radio is on and the RUIM interface is available */
+    RADIOSTATE_RUIM_LOCKED_OR_ABSENT    = 7; /* RUIM PIN locked, PUK required, network
+                                                personalization locked, or RUIM absent */
+    RADIOSTATE_NV_NOT_READY             = 8; /* Radio is on, but the NV interface is not available */
+    RADIOSTATE_NV_READY                 = 9; /* Radio is on and the NV interface is available */
+}
+
+enum RilCardState {
+    CARDSTATE_ABSENT   = 0;
+    CARDSTATE_PRESENT  = 1;
+    CARDSTATE_ERROR    = 2;
+}
+
+enum RilPersoSubstate {
+    PERSOSUBSTATE_UNKNOWN                   = 0; /* initial state */
+    PERSOSUBSTATE_IN_PROGRESS               = 1; /* in between each lock transition */
+    PERSOSUBSTATE_READY                     = 2; /* when either SIM or RUIM Perso is finished
+                                                    since each app can only have 1 active perso
+                                                    involved */
+    PERSOSUBSTATE_SIM_NETWORK               = 3;
+    PERSOSUBSTATE_SIM_NETWORK_SUBSET        = 4;
+    PERSOSUBSTATE_SIM_CORPORATE             = 5;
+    PERSOSUBSTATE_SIM_SERVICE_PROVIDER      = 6;
+    PERSOSUBSTATE_SIM_SIM                   = 7;
+    PERSOSUBSTATE_SIM_NETWORK_PUK           = 8; /* The corresponding perso lock is blocked */
+    PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK    = 9;
+    PERSOSUBSTATE_SIM_CORPORATE_PUK         = 10;
+    PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK  = 11;
+    PERSOSUBSTATE_SIM_SIM_PUK               = 12;
+    PERSOSUBSTATE_RUIM_NETWORK1             = 13;
+    PERSOSUBSTATE_RUIM_NETWORK2             = 14;
+    PERSOSUBSTATE_RUIM_HRPD                 = 15;
+    PERSOSUBSTATE_RUIM_CORPORATE            = 16;
+    PERSOSUBSTATE_RUIM_SERVICE_PROVIDER     = 17;
+    PERSOSUBSTATE_RUIM_RUIM                 = 18;
+    PERSOSUBSTATE_RUIM_NETWORK1_PUK         = 19; /* The corresponding perso lock is blocked */
+    PERSOSUBSTATE_RUIM_NETWORK2_PUK         = 20;
+    PERSOSUBSTATE_RUIM_HRPD_PUK             = 21;
+    PERSOSUBSTATE_RUIM_CORPORATE_PUK        = 22;
+    PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23;
+    PERSOSUBSTATE_RUIM_RUIM_PUK             = 24;
+}
+
+enum RilAppState {
+    APPSTATE_UNKNOWN               = 0;
+    APPSTATE_DETECTED              = 1;
+    APPSTATE_PIN                   = 2; /* If PIN1 or UPin is required */
+    APPSTATE_PUK                   = 3; /* If PUK1 or Puk for UPin is required */
+    APPSTATE_SUBSCRIPTION_PERSO    = 4; /* perso_substate should be look at
+                                           when app_state is assigned to this value */
+    APPSTATE_READY                 = 5;
+}
+
+enum RilPinState {
+    PINSTATE_UNKNOWN              = 0;
+    PINSTATE_ENABLED_NOT_VERIFIED = 1;
+    PINSTATE_ENABLED_VERIFIED     = 2;
+    PINSTATE_DISABLED             = 3;
+    PINSTATE_ENABLED_BLOCKED      = 4;
+    PINSTATE_ENABLED_PERM_BLOCKED = 5;
+}
+
+enum RilAppType {
+  APPTYPE_UNKNOWN = 0;
+  APPTYPE_SIM     = 1;
+  APPTYPE_USIM    = 2;
+  APPTYPE_RUIM    = 3;
+  APPTYPE_CSIM    = 4;
+}
+
+message RilAppStatus {
+  optional RilAppType      app_type         = 1;
+  optional RilAppState     app_state        = 2;
+  optional RilPersoSubstate perso_substate  = 3; /* applicable only if app_state ==
+                                                    APPSTATE_SUBSCRIPTION_PERSO */
+  optional string          aid              = 4; /* null terminated string, e.g., from 0xA0, 0x00 -> 0x41,
+                                                    0x30, 0x30, 0x30 */
+  optional string          app_label        = 5; /* null terminated string */
+  optional int32           pin1_replaced    = 6; /* applicable to USIM and CSIM */
+  optional RilPinState     pin1             = 7;
+  optional RilPinState     pin2             = 8;
+}
+
+
+message RilCardStatus {
+  optional RilCardState card_state                      = 1; /* current state */
+  optional RilPinState  universal_pin_state             = 2; /* applicable to USIM and CSIM: PINSTATE_xxx */
+  optional int32        gsm_umts_subscription_app_index = 3; /* value < CARD_MAX_APPS */
+  optional int32        cdma_subscription_app_index     = 4; /* value < CARD_MAX_APPS */
+  optional int32        num_applications                = 5; /* value <= CARD_MAX_APPS */
+  repeated RilAppStatus applications                    = 6; /* CARD_MAX_APPS == 8 */
+}
+
+/* User-to-User signaling Info activation types derived from 3GPP 23.087 v8.0 */
+enum RilUusType {
+    RILUUSTYPE1_IMPLICIT        = 0;
+    RILUUSTYPE1_REQUIRED        = 1;
+    RILUUSTYPE1_NOT_REQUIRED    = 2;
+    RILUUSTYPE2_REQUIRED        = 3;
+    RILUUSTYPE2_NOT_REQUIRED    = 4;
+    RILUUSTYPE3_REQUIRED        = 5;
+    RILUUSTYPE3_NOT_REQUIRED    = 6;
+};
+
+/* User-to-User Signaling Information data coding schemes. Possible values for
+ * Octet 3 (Protocol Discriminator field) in the UUIE. The values have been
+ * specified in section 10.5.4.25 of 3GPP TS 24.008 */
+enum RilUusDcs {
+    RILUUSDCS_USP               = 0;   /* User specified protocol */
+    RILUUSDCS_OSIHLP            = 1;   /* OSI higher layer protocol */
+    RILUUSDCS_X244              = 2;   /* X.244 */
+    RILUUSDCS_RMCF              = 3;   /* Reserved for system mangement
+                                          convergence function */
+    RILUUSDCS_IA5c              = 4;   /* IA5 characters */
+}
+
+/* User-to-User Signaling Information defined in 3GPP 23.087 v8.0
+ * This data is passed in RIL_ExtensionRecord and rec contains this
+ * structure when type is RIL_UUS_INFO_EXT_REC */
+message RilUusInfo {
+  optional RilUusType uus_type  = 1; /* UUS Type */
+  optional RilUusDcs uus_dcs    = 2; /* UUS Data Coding Scheme */
+  optional int32 uus_length     = 3; /* Length of UUS Data */
+  optional string uus_data      = 4; /* UUS Data */
+}
+
+enum RilCallState {
+    CALLSTATE_ACTIVE     = 0;
+    CALLSTATE_HOLDING    = 1;
+    CALLSTATE_DIALING    = 2;   /* MO call only */
+    CALLSTATE_ALERTING   = 3;   /* MO call only */
+    CALLSTATE_INCOMING   = 4;   /* MT call only */
+    CALLSTATE_WAITING    = 5;   /* MT call only */
+}
+
+message RilCall {
+    optional RilCallState    state               = 1;  /* State of the call */
+    optional int32           index               = 2;  /* Connection Index for use with,
+                                                          eg, AT+CHLD */
+    optional int32           toa                 = 3;  /* type of address, eg 145 = intl */
+    optional bool            is_mpty             = 4;  /* true if is mpty call */
+    optional bool            is_mt               = 5;  /* true if call is mobile terminated */
+    optional int32           als                 = 6;  /* ALS line indicator if available
+                                                          (0 = line 1) */
+    optional bool            is_voice            = 7;  /* true if this is is a voice call */
+    optional bool            is_voice_privacy    = 8;  /* true if CDMA voice privacy mode
+                                                          is active */
+    optional string          number              = 9;  /* Remote party number */
+    optional int32           number_presentation = 10; /* 0=Allowed, 1=Restricted,
+                                                          2=Not Specified/Unknown 3=Payphone */
+    optional string          name                = 11; /* Remote party name */
+    optional int32           name_presentation   = 12; /* 0=Allowed, 1=Restricted,
+                                                          2=Not Specified/Unknown 3=Payphone */
+    optional RilUusInfo      uus_info            = 13; /* NULL or Pointer to User-User Signaling
+                                                          Information */
+}
+
+message RILGWSignalStrength {
+    optional int32 signal_strength = 1;   /* Valid values are (0-31, 99) as defined
+                                             in TS 27.007 8.5 */
+    optional int32 bit_error_rate  = 2;   /* bit error rate (0-7, 99) as defined
+                                             in TS 27.007 8.5 */
+}
+
+message RILCDMASignalStrength {
+    optional int32 dbm  = 1; /* Valid values are positive integers. This value is the actual RSSI
+                                value multiplied by -1. Example: If the actual RSSI is -75, then
+                                this response value will be 75.  */
+    optional int32 ecio = 2; /* Valid values are positive integers. This value is the actual Ec/Io
+                                multiplied by -10.  Example: If the actual Ec/Io is -12.5 dB, then
+                                this response value will be 125. */
+}
+
+message RILEVDOSignalStrength {
+    optional int32 dbm  = 1; /* Valid values are positive integers. This value is the actual RSSI
+                                value multiplied by -1.  Example: If the actual RSSI is -75, then
+                                this response value will be 75.  */
+    optional int32 ecio = 2; /* Valid values are positive integers. This value is the actual
+                                Ec/Io multiplied by -10.  Example: If the actual Ec/Io is -12.5 dB,
+                                then this response value will be 125. */
+    optional int32 signal_noise_ratio = 3; /* Valid values are 0-8.
+                                        8 is the highest signal to noise ratio. */
+}
+
+// Response is an array of strings.
+//
+// If a strings(i) is "*magic-null*" then that value will be returned as null.
+message RspStrings{
+  repeated string strings                   = 1;
+}
+
+// Response is an array of integers
+message RspIntegers{
+  repeated int32 integers                   = 1;
+}
+
+//  1 RIL_REQUEST_GET_SIM_STATUS
+message RspGetSimStatus {
+  required RilCardStatus card_status        = 1;
+}
+
+//  2 RIL_REQUEST_ENTER_SIM_PIN
+message ReqEnterSimPin {
+  required string pin                       = 1;
+}
+//    RIL_REQUEST_ENTER_SIM_PIN response
+message RspEnterSimPin {
+  required int32 retries_remaining          = 1;
+}
+
+//  9 RIL_GET_CURRENT_CALLS response
+message RspGetCurrentCalls {
+  repeated RilCall calls                    = 1;
+}
+
+//  10 RIL_REQUEST_DIAL
+message ReqDial {
+  optional string     address  = 1;
+  optional int32      clir     = 2;
+                             /* (same as 'n' paremeter in TS 27.007 7.7 "+CLIR"
+                              * clir == 0 on "use subscription default value"
+                              * clir == 1 on "CLIR invocation" (restrict CLI presentation)
+                              * clir == 2 on "CLIR suppression" (allow CLI presentation)
+                              */
+  optional RilUusInfo uus_info = 3;    /* NULL or Pointer to User-User Signaling Information */
+}
+
+// 12 RIL_REQUEST_HANG_UP
+message ReqHangUp {
+  required int32 connection_index           = 1;
+}
+
+// 19 RIL_REQUEST_SIGNAL_STRENGTH response
+message RspSignalStrength {
+    optional RILGWSignalStrength   gw_signalstrength   = 1;
+    optional RILCDMASignalStrength cdma_signalstrength = 2;
+    optional RILEVDOSignalStrength evdo_signalstrength = 3;
+}
+
+// 22 RIL_REQUEST_OPERATOR response
+message RspOperator{
+  optional string long_alpha_ons            = 1; // The long alpha ons or eons
+  optional string short_alpha_ons           = 2; // The short alpha ons or eons
+  optional string mcc_mnc                   = 3; // The 5 or 6 digit mcc + mnc
+}
+
+// 52 RIL_REQUEST_SEPARATE_CONNECTION
+message ReqSeparateConnection{
+  required int32 index                      = 1; // Connection index to separate
+                                                 // from multiparty call
+}
+
+// 53 RIL_REQUEST_SET_MUTE
+message ReqSetMute{
+  required bool state                       = 1; // true to "enable mute", false to "disable mute"
+}
+
+// 61 RIL_REQUEST_SCREEN_STATE
+message ReqScreenState {
+  required bool state                       = 1; // true screen is on, false screen is off
+}
+
diff --git a/mock-ril/src/python/tcs.py b/mock-ril/src/python/tcs.py
new file mode 100755 (executable)
index 0000000..0b56301
--- /dev/null
@@ -0,0 +1,247 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2010 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.
+#
+
+"""Test server
+
+A detailed description of tms.
+"""
+
+__author__ = 'wink@google.com (Wink Saville)'
+
+import socket
+import struct
+import sys
+import time
+
+import ctrl_pb2
+import ril_pb2
+import msgheader_pb2
+
+def recvall(s, count):
+  """Receive all of the data otherwise return none.
+
+  Args:
+    s: socket
+    count: number of bytes
+
+  Returns:
+    data received
+    None if no data is received
+  """
+  all_data = []
+  while (count > 0):
+    data = s.recv(count)
+    if (len(data) == 0):
+      return None
+    count -= len(data)
+    all_data.append(data)
+  result = ''.join(all_data);
+  return result
+
+def sendall(s, data):
+  """Send all of the data
+
+  Args:
+    s: socket
+    count: number of bytes
+
+  Returns:
+    Nothing
+  """
+  s.sendall(data)
+
+class MsgHeader:
+  """A fixed length message header; cmd, token, status and length of protobuf."""
+  def __init__(self):
+    self.cmd = 0
+    self.token = 0
+    self.status = 0
+    self.length_protobuf = 0
+
+  def sendHeader(self, s):
+    """Send the header to the socket
+
+    Args:
+      s: socket
+
+    Returns
+      nothing
+    """
+    mh = msgheader_pb2.MsgHeader()
+    mh.cmd = self.cmd
+    mh.token = self.token
+    mh.status = self.status
+    mh.length_data = self.length_protobuf
+    mhser = mh.SerializeToString()
+    len_msg_header_raw = struct.pack('<i', len(mhser))
+    sendall(s, len_msg_header_raw)
+    sendall(s, mhser)
+
+  def recvHeader(self, s):
+    """Receive the header from the socket"""
+    len_msg_header_raw = recvall(s, 4)
+    len_msg_hdr = struct.unpack('<i', len_msg_header_raw)
+    mh = msgheader_pb2.MsgHeader()
+    mh_raw = recvall(s, len_msg_hdr[0])
+    mh.ParseFromString(mh_raw)
+    self.cmd = mh.cmd
+    self.token = mh.token
+    self.status = mh.status
+    self.length_protobuf = mh.length_data;
+
+class Msg:
+  """A message consists of a fixed length MsgHeader followed by a protobuf.
+
+  This class sends and receives messages, when sending the status
+  will be zero and when receiving the protobuf field will be an
+  empty string if there was no protobuf.
+  """
+  def __init__(self):
+    """Initialize the protobuf to None and header to an empty"""
+    self.protobuf = None
+    self.header = MsgHeader()
+
+    # Keep a local copy of header for convenience
+    self.cmd = 0
+    self.token = 0
+    self.status = 0
+
+  def sendMsg(self, s, cmd, token, protobuf=''):
+    """Send a message to a socket
+
+    Args:
+      s: socket
+      cmd: command to send
+      token: token to send, will be returned unmodified
+      protobuf: optional protobuf to send
+
+    Returns
+      nothing
+    """
+    self.cmd = cmd
+    self.token = token
+    self.status = 0
+    self.protobuf = protobuf
+
+    self.header.cmd = self.cmd
+    self.header.token = self.token
+    self.header.status = self.status
+    if (len(protobuf) > 0):
+      self.header.length_protobuf = len(protobuf)
+    else:
+      self.header.length_protobuf = 0
+      self.protobuf = ''
+    self.header.sendHeader(s)
+    if (self.header.length_protobuf > 0):
+      sendall(s, self.protobuf)
+
+  def recvMsg(self, s):
+    """Receive a message from a socket
+
+    Args:
+      s: socket
+
+    Returns:
+      nothing
+    """
+    self.header.recvHeader(s)
+    self.cmd = self.header.cmd
+    self.token = self.header.token
+    self.status = self.header.status
+    if (self.header.length_protobuf > 0):
+      self.protobuf = recvall(s, self.header.length_protobuf)
+    else:
+      self.protobuf = ''
+
+def main(argv):
+  """Create a socket and connect.
+
+  Before using you'll need to forward the port
+  used by mock_ril, 54312 to a port on the PC.
+  The following worked for me:
+
+    adb forward tcp:11111 tcp:54312.
+
+  Then you can execute this test using:
+
+    tms.py 127.0.0.1 11111
+  """
+  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+  host = sys.argv[1]        # server address
+  print "host=%s" % host
+  port = int(sys.argv[2])   # server port
+  print "port=%d" % port
+  s.connect((host, port))
+
+  # Create an object which is serializable to a protobuf
+  rrs = ctrl_pb2.CtrlRspRadioState()
+  rrs.state = ril_pb2.RADIOSTATE_UNAVAILABLE
+  print "rrs.state=%d" % (rrs.state)
+
+  # Serialize
+  rrs_ser = rrs.SerializeToString()
+  print "len(rrs_ser)=%d" % (len(rrs_ser))
+
+  # Deserialize
+  rrs_new = ctrl_pb2.CtrlRspRadioState()
+  rrs_new.ParseFromString(rrs_ser)
+  print "rrs_new.state=%d" % (rrs_new.state)
+
+
+  # Do an echo test
+  req = Msg()
+  req.sendMsg(s, 0, 1234567890123, rrs_ser)
+  resp = Msg()
+  resp.recvMsg(s)
+  response = ctrl_pb2.CtrlRspRadioState()
+  response.ParseFromString(resp.protobuf)
+
+  print "cmd=%d" % (resp.cmd)
+  print "token=%d" % (resp.token)
+  print "status=%d" % (resp.status)
+  print "len(protobuf)=%d" % (len(resp.protobuf))
+  print "response.state=%d" % (response.state)
+  if ((resp.cmd == 0) & (resp.token == 1234567890123) &
+        (resp.status == 0) & (response.state == 1)):
+    print "SUCCESS: echo ok"
+  else:
+    print "ERROR: expecting cmd=0 token=1234567890123 status=0 state=1"
+
+  # Test CTRL_GET_RADIO_STATE
+  req.sendMsg(s, ctrl_pb2.CTRL_CMD_GET_RADIO_STATE, 4)
+  resp = Msg()
+  resp.recvMsg(s)
+
+  print "cmd=%d" % (resp.cmd)
+  print "token=%d" % (resp.token)
+  print "status=%d" % (resp.status)
+  print "length_protobuf=%d" % (len(resp.protobuf))
+
+  if (resp.cmd == ctrl_pb2.CTRL_CMD_GET_RADIO_STATE):
+      response = ctrl_pb2.CtrlRspRadioState()
+      response.ParseFromString(resp.protobuf)
+      print "SUCCESS: response.state=%d" % (response.state)
+  else:
+      print "ERROR: expecting resp.cmd == ctrl_pb2.CTRL_CMD_GET_RADIO_STATE"
+
+  # Close socket
+  print "closing socket"
+  s.close()
+
+
+if __name__ == '__main__':
+  main(sys.argv)