* soon as possible
*/
- void* (*RequestTimedCallback) (RIL_TimedCallback callback,
+ void (*RequestTimedCallback) (RIL_TimedCallback callback,
void *param, const struct timeval *relativeTime);
-
-
- /**
- * Remove user-specified callback function
- */
- void (*RemoveTimedCallback) (void *callbackInfo);
};
* @param relativeTime a relative time value at which the callback is invoked
*/
-void* RIL_requestTimedCallback (RIL_TimedCallback callback,
- void *param, const struct timeval *relativeTime);
-
-/**
- * Remove user-specified callback function
- * @param callbackInfo Pointer returned to the caller when timer was scheduled
- */
-
-void RIL_removeTimedCallback(void *callbackInfo);
+void RIL_requestTimedCallback (RIL_TimedCallback callback,
+ void *param, const struct timeval *relativeTime);
#endif /* RIL_SHLIB */
struct UserCallbackInfo *p_next;
} UserCallbackInfo;
+
/*******************************************************************/
RIL_RadioFunctions s_callbacks = {0, NULL, NULL, NULL, NULL, NULL};
#endif
static UserCallbackInfo * internalRequestTimedCallback
- (RIL_TimedCallback callback, void *param, const struct timeval *relativeTime);
-
-static void internalRemoveTimedCallback(void *callbackInfo);
+ (RIL_TimedCallback callback, void *param,
+ const struct timeval *relativeTime);
/** Index == requestNumber */
static CommandInfo s_commands[] = {
*/
static UserCallbackInfo *
internalRequestTimedCallback (RIL_TimedCallback callback, void *param,
- const struct timeval *relativeTime)
+ const struct timeval *relativeTime)
{
struct timeval myRelativeTime;
UserCallbackInfo *p_info;
p_info->p_callback = callback;
p_info->userParam = param;
+
if (relativeTime == NULL) {
/* treat null parameter as a 0 relative time */
memset (&myRelativeTime, 0, sizeof(myRelativeTime));
return p_info;
}
-static void
-internalRemoveTimedCallback(void *callbackInfo)
-{
- UserCallbackInfo *p_info;
- p_info = (UserCallbackInfo *)callbackInfo;
- LOGI("remove timer callback event");
- if(p_info) {
- ril_timer_delete(&(p_info->event));
- free(p_info);
- }
-}
-extern "C" void *
+extern "C" void
RIL_requestTimedCallback (RIL_TimedCallback callback, void *param,
const struct timeval *relativeTime) {
- return internalRequestTimedCallback (callback, param, relativeTime);
-}
-
-extern "C" void
-RIL_removeTimedCallback (void *callbackInfo) {
- internalRemoveTimedCallback(callbackInfo);
+ internalRequestTimedCallback (callback, param, relativeTime);
}
const char *
dlog("~~~~ -ril_timer_add ~~~~");
}
-// Remove event from timer list
-void ril_timer_delete(struct ril_event *tev)
-{
- dlog("~~~~timer event delete=%x",(unsigned int)tev);
- MUTEX_ACQUIRE();
- removeFromList(tev);
- MUTEX_RELEASE();
-}
-
// Remove event from watch or timer list
void ril_event_del(struct ril_event * ev)
{
- dlog("~~~~ +ril_event_del event= %x ~~~~", (unsigned int)ev);
+ dlog("~~~~ +ril_event_del ~~~~");
MUTEX_ACQUIRE();
if (ev->index < 0 || ev->index >= MAX_FD_EVENTS) {
- MUTEX_RELEASE();
return;
}
// Remove event from watch list
void ril_event_del(struct ril_event * ev);
-// Remove event from timer list
-void ril_timer_delete(struct ril_event * ev);
-
// Event loop
void ril_event_loop();
--- /dev/null
+*.pyc
+.*.swp
--- /dev/null
+# 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 := optional
+LOCAL_MODULE:= libmock_ril
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif
+
+endif
+
+# Java librilproto
+# =======================================================
+include $(CLEAR_VARS)
+
+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)
+# =======================================================
--- /dev/null
+# 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)/simulated_radio.js /sdcard/data/
+ adb push $(src_js)/simulated_icc.js /sdcard/data/
+ adb push $(src_js)/ctrl_server.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)
--- /dev/null
+
+ 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.
+-------------------------------------------------------------------------
--- /dev/null
+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.
--- /dev/null
+/**
+ * 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
+}
--- /dev/null
+/**
+ * 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_
--- /dev/null
+/**
+ * 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");
+}
--- /dev/null
+/**
+ * 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_
--- /dev/null
+/**
+ * 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");
+}
--- /dev/null
+/**
+ * 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
+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_
-/*
- * Copyright (C) 2008 The Android Open Source Project
+/**
+ * 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.
* limitations under the License.
*/
+#ifndef _LOGGING_H
+#define _LOGGING_H
-#include "reference-cdma-sms.h"
+// The LOG_TAG should start with "RIL" so it shows up in the radio log
+#define LOG_TAG "RIL-MOCK"
-#undef LOG_TAG
-#define LOG_TAG "CDMA"
#include <utils/Log.h>
-RIL_Errno wmsts_ril_cdma_decode_sms( RIL_CDMA_Encoded_SMS * encoded_sms,
- RIL_CDMA_SMS_ClientBd * client_bd) {
- LOGE("ril_cdma_decode_sms function not implemented\n");
- return RIL_E_GENERIC_FAILURE;
- }
-
-RIL_Errno wmsts_ril_cdma_encode_sms(RIL_CDMA_SMS_ClientBd * client_bd,
- RIL_CDMA_Encoded_SMS * encoded_sms) {
-
- LOGE("ril_cdma_encode_sms function not implemented\n");
- return RIL_E_GENERIC_FAILURE;
- }
+#endif
--- /dev/null
+/**
+ * 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;
+
+ // 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);
+
+ start->Call(context->Global(), 0, NULL);
+}
+
+
+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;
+
+#if 0
+ LOGD("RIL_Init run tests #####################");
+ testJsSupport(context);
+ testRequests(context);
+ experiments(context);
+ testWorker();
+ testWorkerV8(context);
+ testJs(context);
+ LOGD("RIL_Init tests completed ###############");
+#endif
+
+ // 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);
+
+ // 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;
+}
--- /dev/null
+/**
+ * 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_
--- /dev/null
+// 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)
--- /dev/null
+// 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
--- /dev/null
+/**
+ * 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 (unsigned int i = 0; i < a->Length(); i++) {
+ 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(char_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, String::HINT_MANY_WRITES_EXPECTED);
+ 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:");
+}
--- /dev/null
+/**
+ * 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_
--- /dev/null
+/**
+ * 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_
--- /dev/null
+/**
+ * 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, NULL, v8::String::HINT_MANY_WRITES_EXPECTED);
+ return buflen;
+ }
+
+ if (encoding == ASCII) {
+ str->WriteAscii(buf, 0, buflen, v8::String::HINT_MANY_WRITES_EXPECTED);
+ return buflen;
+ }
+
+ // THIS IS AWFUL!!! FIXME
+
+ assert(encoding == BINARY);
+
+ uint16_t * twobytebuf = new uint16_t[buflen];
+
+ str->Write(twobytebuf, 0, buflen, v8::String::HINT_MANY_WRITES_EXPECTED);
+
+ 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;
+}
--- /dev/null
+/**
+ * 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_
--- /dev/null
+// 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 "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_->GetInternalField(2).As<Function>();
+ }
+
+ 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 =
+ Script::Compile(String::New(from.str().c_str()))->Run().As<Function>();
+ constructor->SetHiddenValue(String::New("type"), self);
+
+ Handle<Function> bind =
+ Script::Compile(String::New(
+ "(function(self) {"
+ " var f = this;"
+ " return function(arg) {"
+ " return f.call(self, arg);"
+ " };"
+ "})"))->Run().As<Function>();
+ 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++) {
+ array->Set(j, 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));
+ properties->Set(i, 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 void ToProto(Message* instance,
+ const FieldDescriptor* field,
+ Handle<Value> value,
+ const Type* type,
+ bool repeated) {
+ DBG("Type::ToProto(instance, field, value, type, repeated) E:");
+ 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");
+ type->ToProto(repeated ?
+ reflection->AddMessage(instance, field) :
+ reflection->MutableMessage(instance, field),
+ value.As<Object>());
+ 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");
+ SET(Enum,
+ value->IsNumber() ?
+ field->enum_type()->FindValueByNumber(value->Int32Value()) :
+ field->enum_type()->FindValueByName(*String::AsciiValue(value)));
+ break;
+ }
+ DBG("Type::ToProto(instance, field, value, type, repeated) X:");
+ }
+#undef SET
+
+ void ToProto(Message* instance, Handle<Object> src) const {
+ DBG("ToProto(Message *, Handle<Object>) E:");
+ Handle<Function> to_array = handle_->GetInternalField(3).As<Function>();
+ Handle<Array> properties = to_array->Call(src, 0, NULL).As<Array>();
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ Handle<Value> value = properties->Get(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()) {
+ ToProto(instance, field, value, child_type, true);
+ } else {
+ Handle<Array> array = value.As<Array>();
+ int length = array->Length();
+ for (int j = 0; j < length; j++) {
+ ToProto(instance, field, array->Get(j), child_type, true);
+ }
+ }
+ } else {
+ ToProto(instance, field, value, child_type, false);
+ }
+ }
+ DBG("ToProto(Message *, Handle<Object>) X:");
+ }
+
+ static Handle<Value> Serialize(const Arguments& args) {
+ 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();
+ type->ToProto(message, args[0].As<Object>());
+ int length = message->ByteSize();
+ Buffer* buffer = Buffer::New(length);
+ message->SerializeWithCachedSizesToArray((google::protobuf::uint8*)buffer->data());
+ delete message;
+
+ DBG("Serialize(Arguments&) X");
+ return buffer->handle_;
+ }
+
+ 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_->GetInternalField(1).As<Array>();
+ types->Set(types->Length(), 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);
+}
--- /dev/null
+// 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);
--- /dev/null
+/**
+ * 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;
+}
+
+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();
+ 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;
+}
+
+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();
+ 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;
+}
+
+int ReqScreenState(Buffer **pBuffer,
+ const void *data, const size_t datalen, const RIL_Token t) {
+ int status;
+ Buffer *buffer;
+ v8::HandleScope handle_scope;
+ v8::TryCatch try_catch;
+
+ 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();
+ req->set_state(((int *)data)[0]);
+ if (try_catch.HasCaught()) {
+ ReportException(&try_catch);
+ }
+ 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** protobuf, 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 *data, size_t datalen, 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));
+
+ // Convert the data to a protobuf Buffer
+ Buffer *buffer = NULL;
+ ReqConversionMap::iterator itr;
+ itr = rilReqConversionMap.find(cmd);
+ if (itr != rilReqConversionMap.end()) {
+ status = itr->second(&buffer, data, datalen, t);
+ } else {
+ LOGE("callOnRilRequest X unknown request %d", cmd);
+ status = STATUS_UNSUPPORTED_REQUEST;
+ }
+
+ if (status == STATUS_OK) {
+ // Invoke onRilRequest
+ const int argc = 3;
+ v8::Handle<v8::Value> argv[argc] = {
+ v8RequestValue, v8TokenValue, 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;
+ }
+ }
+
+ if (status != STATUS_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(t, rilErrCode, NULL, 0);
+ }
+
+ 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:");
+}
+
+void RilRequestWorkerQueue::AddRequest (const int request,
+ const void *data, const size_t datalen, const RIL_Token token) {
+ Request *req;
+ pthread_mutex_lock(&free_list_mutex_);
+ if (free_list_.size() == 0) {
+ req = new Request(request, data, datalen, token);
+ pthread_mutex_unlock(&free_list_mutex_);
+ } else {
+ req = free_list_.front();
+ free_list_.pop();
+ pthread_mutex_unlock(&free_list_mutex_);
+ req->Set(request, data, datalen, token);
+ }
+ Add(req);
+ 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 data=%p datalen=%d t=%p",
+ req->request_, req->data_, req->datalen_, req->token_);
+
+ v8::Locker locker;
+ v8::HandleScope handle_scope;
+ v8::Context::Scope context_scope(context_);
+ callOnRilRequest(context_, req->request_,
+ req->data_, req->datalen_, req->token_);
+
+ DBG("RilRequestWorkerQueue::Process: X"
+ " request=%d data=%p datalen=%d t=%p",
+ req->request_, req->data_, req->datalen_, 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_IMSI] = ReqWithNoData; // 11
+ rilReqConversionMap[RIL_REQUEST_HANGUP] = ReqHangUp; // 12
+ 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_SCREEN_STATE] = ReqScreenState; // 61
+
+ *rwq = new RilRequestWorkerQueue(context);
+ int status = (*rwq)->Run();
+
+ LOGD("requestsInit X: status=%d", status);
+ return status;
+}
+
+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);
+ if (!try_catch.HasCaught()) {
+ {
+ const char *data[1] = { "winks-pin" };
+ callOnRilRequest(context, RIL_REQUEST_ENTER_SIM_PIN, data,
+ sizeof(data), (void *)0x12345678);
+ }
+ {
+ const int data[1] = { 1 };
+ callOnRilRequest(context, RIL_REQUEST_HANGUP, data,
+ sizeof(data), (void *)0x12345679);
+ }
+ {
+ const int data[1] = { 1 };
+ callOnRilRequest(context, RIL_REQUEST_SCREEN_STATE, data,
+ sizeof(data), (void *)0x1234567A);
+ }
+
+ {
+ 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);
+ // Sleep to let it be processed
+ v8::Unlocker unlocker;
+ sleep(3);
+ v8::Locker locker;
+ }
+ delete rwq;
+ }
+ }
+ }
+
+ LOGD("testRequests X: ********\n");
+}
--- /dev/null
+/**
+ * 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"
+
+
+/**
+ * A request
+ */
+struct Request {
+ int request_;
+ char *data_;
+ size_t datalen_;
+ size_t maxlen_;
+ RIL_Token token_;
+
+ Request(const int request, const void *data,
+ const size_t datalen, const RIL_Token token) :
+ request_(0),
+ data_(NULL),
+ datalen_(0),
+ maxlen_(0),
+ token_(0) {
+ Set(request, data, datalen, token);
+ }
+
+ ~Request() {
+ delete [] data_;
+ }
+
+ void Set(const int request,
+ const void *data, const size_t datalen, const RIL_Token token) {
+ request_ = request;
+ token_ = token;
+ if (datalen > maxlen_) {
+ // TODO: MAKE A POOL ?
+ delete [] data_;
+ data_ = new char[datalen];
+ maxlen_ = datalen;
+ }
+ datalen_ = datalen;
+ memmove(data_, data, datalen);
+ }
+};
+
+/**
+ * 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 t);
+
+ /**
+ * 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_
--- /dev/null
+/**
+ * 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) {
+ 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) {
+ 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_OPERATOR response
+ */
+RIL_Errno RspOperator(
+ int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
+ 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;
+}
+
+/**
+ * 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* protobuf);
+typedef std::map<int, RspConversion> RspConversionMap;
+RspConversionMap rilRspConversionMap;
+
+typedef void (*UnsolRspConversion)(int cmd, Buffer* protobuf);
+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;
+ }
+
+ 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 resonse 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_IMSI] = RspString; // 11
+ rilRspConversionMap[RIL_REQUEST_HANGUP] = RspWithNoData; // 12
+ 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_SCREEN_STATE] = RspWithNoData; // 61
+
+ LOGD("responsesInit X: status=%d", status);
+ return STATUS_OK;
+}
--- /dev/null
+/**
+ * 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_
--- /dev/null
+/**
+ * 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_
--- /dev/null
+/**
+ * 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 Utf8Value.
+const char* ToCString(v8::Handle<v8::Value> value) {
+ v8::String::Utf8Value strUtf8Value(value);
+ return ToCString(strUtf8Value);
+}
+
+// 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));
+}
--- /dev/null
+/**
+ * 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(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_
--- /dev/null
+/**
+ * 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"
+
+//#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();
+ 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)) {
+ pthread_cond_wait(&cond_, &mutex_);
+ }
+ if (isRunning()) {
+ void *p = wq->q_.front();
+ wq->q_.pop();
+ pthread_mutex_unlock(&mutex_);
+ wq->Process(p);
+ } else {
+ pthread_mutex_unlock(&mutex_);
+ }
+ }
+ DBG("WorkerQueueThread::Worker X");
+ return NULL;
+ }
+};
+
+WorkerQueue::WorkerQueue() {
+ wqt_ = new WorkerQueueThread();
+}
+
+WorkerQueue::~WorkerQueue() {
+ Stop();
+ delete wqt_;
+}
+
+int WorkerQueue::Run() {
+ return wqt_->Run(this);
+}
+
+void WorkerQueue::Stop() {
+ wqt_->Stop();
+}
+
+void WorkerQueue::Add(void *p) {
+ DBG("WorkerQueue::Add E:");
+ pthread_mutex_lock(&wqt_->mutex_);
+ q_.push(p);
+ if (q_.size() == 1) {
+ pthread_cond_signal(&wqt_->cond_);
+ }
+ pthread_mutex_unlock(&wqt_->mutex_);
+ DBG("WorkerQueue::Add 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;
+
+ for (int i = 0; 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");
+}
--- /dev/null
+/**
+ * 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 <pthread.h>
+#include <cutils/atomic.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;
+
+ std::queue<void *> q_;
+
+ class WorkerQueueThread *wqt_;
+
+ public:
+ WorkerQueue();
+
+ virtual ~WorkerQueue();
+
+ int Run();
+
+ void Stop();
+
+ void Add(void *p);
+
+ virtual void Process(void *) = 0;
+};
+
+extern void testWorker();
+
+#endif // MOCK_RIL_WORKER_H_
--- /dev/null
+/**
+ * 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> 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);
+
+ 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.add('one');\n"
+ "w1.add('two');\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");
+}
--- /dev/null
+/**
+ * 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_
--- /dev/null
+// 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* CtrlRspRadioState_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+ CtrlRspRadioState_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);
+ CtrlRspRadioState_descriptor_ = file->message_type(0);
+ 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));
+ 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(
+ CtrlRspRadioState_descriptor_, &CtrlRspRadioState::default_instance());
+}
+
+} // namespace
+
+void protobuf_ShutdownFile_ctrl_2eproto() {
+ delete CtrlRspRadioState::default_instance_;
+ delete CtrlRspRadioState_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"
+ "rlRspRadioState\022$\n\005state\030\001 \002(\0162\025.ril_pro"
+ "to.RadioState*:\n\007CtrlCmd\022\021\n\rCTRL_CMD_ECH"
+ "O\020\000\022\034\n\030CTRL_CMD_GET_RADIO_STATE\020\001*5\n\nCtr"
+ "lStatus\022\022\n\016CTRL_STATUS_OK\020\000\022\023\n\017CTRL_STAT"
+ "US_ERR\020\001B7\n(com.android.internal.telepho"
+ "ny.ril_protoB\013RilCtrlCmds", 265);
+ ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+ "ctrl.proto", &protobuf_RegisterTypes);
+ CtrlRspRadioState::default_instance_ = new CtrlRspRadioState();
+ CtrlRspRadioState::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:
+ 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 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;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+} // namespace ril_proto
+
+// @@protoc_insertion_point(global_scope)
--- /dev/null
+// 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 CtrlRspRadioState;
+
+enum CtrlCmd {
+ CTRL_CMD_ECHO = 0,
+ CTRL_CMD_GET_RADIO_STATE = 1
+};
+bool CtrlCmd_IsValid(int value);
+const CtrlCmd CtrlCmd_MIN = CTRL_CMD_ECHO;
+const CtrlCmd CtrlCmd_MAX = CTRL_CMD_GET_RADIO_STATE;
+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 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_;
+};
+// ===================================================================
+
+
+// ===================================================================
+
+// 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;
+}
+
+
+// @@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
--- /dev/null
+// 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)
--- /dev/null
+// 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
--- /dev/null
+// 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* 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* ReqHangUp_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+ ReqHangUp_reflection_ = NULL;
+const ::google::protobuf::Descriptor* RspOperator_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+ RspOperator_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;
+
+} // 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));
+ RspStrings_descriptor_ = file->message_type(2);
+ 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(3);
+ 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(4);
+ 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(5);
+ 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(6);
+ 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));
+ ReqHangUp_descriptor_ = file->message_type(7);
+ 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));
+ RspOperator_descriptor_ = file->message_type(8);
+ 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));
+ ReqScreenState_descriptor_ = file->message_type(9);
+ 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);
+}
+
+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(
+ 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(
+ ReqHangUp_descriptor_, &ReqHangUp::default_instance());
+ ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+ RspOperator_descriptor_, &RspOperator::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 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 ReqHangUp::default_instance_;
+ delete ReqHangUp_reflection_;
+ delete RspOperator::default_instance_;
+ delete RspOperator_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\"\035\n\nRspStrings\022\017\n\007strings\030"
+ "\001 \003(\t\"\037\n\013RspIntegers\022\020\n\010integers\030\001 \003(\005\"@"
+ "\n\017RspGetSimStatus\022-\n\013card_status\030\001 \002(\0132\030"
+ ".ril_proto.RilCardStatus\"\035\n\016ReqEnterSimP"
+ "in\022\013\n\003pin\030\001 \002(\t\"+\n\016RspEnterSimPin\022\031\n\021ret"
+ "ries_remaining\030\001 \002(\005\"%\n\tReqHangUp\022\030\n\020con"
+ "nection_index\030\001 \002(\005\"O\n\013RspOperator\022\026\n\016lo"
+ "ng_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\"\037\n\016ReqScreenState\022\r"
+ "\n\005state\030\001 \002(\010*\257\002\n\nRadioState\022\022\n\016RADIOSTA"
+ "TE_OFF\020\000\022\032\n\026RADIOSTATE_UNAVAILABLE\020\001\022\034\n\030"
+ "RADIOSTATE_SIM_NOT_READY\020\002\022#\n\037RADIOSTATE"
+ "_SIM_LOCKED_OR_ABSENT\020\003\022\030\n\024RADIOSTATE_SI"
+ "M_READY\020\004\022\035\n\031RADIOSTATE_RUIM_NOT_READY\020\005"
+ "\022\031\n\025RADIOSTATE_RUIM_READY\020\006\022$\n RADIOSTAT"
+ "E_RUIM_LOCKED_OR_ABSENT\020\007\022\033\n\027RADIOSTATE_"
+ "NV_NOT_READY\020\010\022\027\n\023RADIOSTATE_NV_READY\020\t*"
+ "P\n\014RilCardState\022\024\n\020CARDSTATE_ABSENT\020\000\022\025\n"
+ "\021CARDSTATE_PRESENT\020\001\022\023\n\017CARDSTATE_ERROR\020"
+ "\002*\361\006\n\020RilPersoSubstate\022\031\n\025PERSOSUBSTATE_"
+ "UNKNOWN\020\000\022\035\n\031PERSOSUBSTATE_IN_PROGRESS\020\001"
+ "\022\027\n\023PERSOSUBSTATE_READY\020\002\022\035\n\031PERSOSUBSTA"
+ "TE_SIM_NETWORK\020\003\022$\n PERSOSUBSTATE_SIM_NE"
+ "TWORK_SUBSET\020\004\022\037\n\033PERSOSUBSTATE_SIM_CORP"
+ "ORATE\020\005\022&\n\"PERSOSUBSTATE_SIM_SERVICE_PRO"
+ "VIDER\020\006\022\031\n\025PERSOSUBSTATE_SIM_SIM\020\007\022!\n\035PE"
+ "RSOSUBSTATE_SIM_NETWORK_PUK\020\010\022(\n$PERSOSU"
+ "BSTATE_SIM_NETWORK_SUBSET_PUK\020\t\022#\n\037PERSO"
+ "SUBSTATE_SIM_CORPORATE_PUK\020\n\022*\n&PERSOSUB"
+ "STATE_SIM_SERVICE_PROVIDER_PUK\020\013\022\035\n\031PERS"
+ "OSUBSTATE_SIM_SIM_PUK\020\014\022\037\n\033PERSOSUBSTATE"
+ "_RUIM_NETWORK1\020\r\022\037\n\033PERSOSUBSTATE_RUIM_N"
+ "ETWORK2\020\016\022\033\n\027PERSOSUBSTATE_RUIM_HRPD\020\017\022 "
+ "\n\034PERSOSUBSTATE_RUIM_CORPORATE\020\020\022\'\n#PERS"
+ "OSUBSTATE_RUIM_SERVICE_PROVIDER\020\021\022\033\n\027PER"
+ "SOSUBSTATE_RUIM_RUIM\020\022\022#\n\037PERSOSUBSTATE_"
+ "RUIM_NETWORK1_PUK\020\023\022#\n\037PERSOSUBSTATE_RUI"
+ "M_NETWORK2_PUK\020\024\022\037\n\033PERSOSUBSTATE_RUIM_H"
+ "RPD_PUK\020\025\022$\n PERSOSUBSTATE_RUIM_CORPORAT"
+ "E_PUK\020\026\022+\n\'PERSOSUBSTATE_RUIM_SERVICE_PR"
+ "OVIDER_PUK\020\027\022\037\n\033PERSOSUBSTATE_RUIM_RUIM_"
+ "PUK\020\030*\223\001\n\013RilAppState\022\024\n\020APPSTATE_UNKNOW"
+ "N\020\000\022\025\n\021APPSTATE_DETECTED\020\001\022\020\n\014APPSTATE_P"
+ "IN\020\002\022\020\n\014APPSTATE_PUK\020\003\022\037\n\033APPSTATE_SUBSC"
+ "RIPTION_PERSO\020\004\022\022\n\016APPSTATE_READY\020\005*\275\001\n\013"
+ "RilPinState\022\024\n\020PINSTATE_UNKNOWN\020\000\022!\n\035PIN"
+ "STATE_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\035PINS"
+ "TATE_ENABLED_PERM_BLOCKED\020\005*h\n\nRilAppTyp"
+ "e\022\023\n\017APPTYPE_UNKNOWN\020\000\022\017\n\013APPTYPE_SIM\020\001\022"
+ "\020\n\014APPTYPE_USIM\020\002\022\020\n\014APPTYPE_RUIM\020\003\022\020\n\014A"
+ "PPTYPE_CSIM\020\004B3\n(com.android.internal.te"
+ "lephony.ril_protoB\007RilCmds", 2706);
+ ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+ "ril.proto", &protobuf_RegisterTypes);
+ RilAppStatus::default_instance_ = new RilAppStatus();
+ RilCardStatus::default_instance_ = new RilCardStatus();
+ 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();
+ ReqHangUp::default_instance_ = new ReqHangUp();
+ RspOperator::default_instance_ = new RspOperator();
+ ReqScreenState::default_instance_ = new ReqScreenState();
+ RilAppStatus::default_instance_->InitAsDefaultInstance();
+ RilCardStatus::default_instance_->InitAsDefaultInstance();
+ RspStrings::default_instance_->InitAsDefaultInstance();
+ RspIntegers::default_instance_->InitAsDefaultInstance();
+ RspGetSimStatus::default_instance_->InitAsDefaultInstance();
+ ReqEnterSimPin::default_instance_->InitAsDefaultInstance();
+ RspEnterSimPin::default_instance_->InitAsDefaultInstance();
+ ReqHangUp::default_instance_->InitAsDefaultInstance();
+ RspOperator::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 ::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;
+}
+
+
+// ===================================================================
+
+#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 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;
+}
+
+
+// ===================================================================
+
+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 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)
--- /dev/null
+// 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 RspStrings;
+class RspIntegers;
+class RspGetSimStatus;
+class ReqEnterSimPin;
+class RspEnterSimPin;
+class ReqHangUp;
+class RspOperator;
+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);
+}
+// ===================================================================
+
+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 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 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 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 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_;
+}
+
+// -------------------------------------------------------------------
+
+// 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;
+}
+
+// -------------------------------------------------------------------
+
+// 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;
+}
+
+// -------------------------------------------------------------------
+
+// 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_;
+}
+
+// -------------------------------------------------------------------
+
+// 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();
+}
+
+} // namespace google
+} // namespace protobuf
+#endif // SWIG
+
+// @@protoc_insertion_point(global_scope)
+
+#endif // PROTOBUF_ril_2eproto__INCLUDED
--- /dev/null
+
+\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
--- /dev/null
+// 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));
+ }
+
+}
+
--- /dev/null
+// 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;
+
+ 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 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 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 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 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));
+ }
+
+ }
+
+}
--- /dev/null
+// 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;
+
+ // enum CtrlStatus
+ public static final int CTRL_STATUS_OK = 0;
+ public static final int CTRL_STATUS_ERR = 1;
+
+ 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));
+ }
+
+ }
+
+}
--- /dev/null
+# 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\x43trlRspRadioState\x12$\n\x05state\x18\x01 \x02(\x0e\x32\x15.ril_proto.RadioState*:\n\x07\x43trlCmd\x12\x11\n\rCTRL_CMD_ECHO\x10\x00\x12\x1c\n\x18\x43TRL_CMD_GET_RADIO_STATE\x10\x01*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),
+ ],
+ containing_type=None,
+ options=None,
+ serialized_start=95,
+ serialized_end=153,
+)
+
+
+_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=155,
+ serialized_end=208,
+)
+
+
+CTRL_CMD_ECHO = 0
+CTRL_CMD_GET_RADIO_STATE = 1
+CTRL_STATUS_OK = 0
+CTRL_STATUS_ERR = 1
+
+
+
+_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=36,
+ serialized_end=93,
+)
+
+import ril_pb2
+
+_CTRLRSPRADIOSTATE.fields_by_name['state'].enum_type = ril_pb2._RADIOSTATE
+
+class CtrlRspRadioState(message.Message):
+ __metaclass__ = reflection.GeneratedProtocolMessageType
+ DESCRIPTOR = _CTRLRSPRADIOSTATE
+
+ # @@protoc_insertion_point(class_scope:ril_proto.CtrlRspRadioState)
+
+# @@protoc_insertion_point(module_scope)
--- /dev/null
+# 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)
--- /dev/null
+# 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\"\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\"%\n\tReqHangUp\x12\x18\n\x10\x63onnection_index\x18\x01 \x02(\x05\"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\"\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\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=936,
+ serialized_end=1239,
+)
+
+
+_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=1241,
+ serialized_end=1321,
+)
+
+
+_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=1324,
+ serialized_end=2205,
+)
+
+
+_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=2208,
+ serialized_end=2355,
+)
+
+
+_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=2358,
+ serialized_end=2547,
+)
+
+
+_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=2549,
+ serialized_end=2653,
+)
+
+
+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
+
+
+
+_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,
+)
+
+
+_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=576,
+ serialized_end=605,
+)
+
+
+_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=607,
+ serialized_end=638,
+)
+
+
+_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=640,
+ serialized_end=704,
+)
+
+
+_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=706,
+ serialized_end=735,
+)
+
+
+_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=737,
+ serialized_end=780,
+)
+
+
+_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=782,
+ serialized_end=819,
+)
+
+
+_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=821,
+ serialized_end=900,
+)
+
+
+_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=902,
+ serialized_end=933,
+)
+
+
+_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
+_RSPGETSIMSTATUS.fields_by_name['card_status'].message_type = _RILCARDSTATUS
+
+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 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 ReqHangUp(message.Message):
+ __metaclass__ = reflection.GeneratedProtocolMessageType
+ DESCRIPTOR = _REQHANGUP
+
+ # @@protoc_insertion_point(class_scope:ril_proto.ReqHangUp)
+
+class RspOperator(message.Message):
+ __metaclass__ = reflection.GeneratedProtocolMessageType
+ DESCRIPTOR = _RSPOPERATOR
+
+ # @@protoc_insertion_point(class_scope:ril_proto.RspOperator)
+
+class ReqScreenState(message.Message):
+ __metaclass__ = reflection.GeneratedProtocolMessageType
+ DESCRIPTOR = _REQSCREENSTATE
+
+ # @@protoc_insertion_point(class_scope:ril_proto.ReqScreenState)
+
+# @@protoc_insertion_point(module_scope)
--- /dev/null
+/*
+ * 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;
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/**
+ * 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');
+
+ rsp = Object();
+ rsp.state = gRadioState;
+ result.responseProtobuf = ctrlSchema['ril_proto.CtrlRspRadioState'].serialize(rsp);
+
+ 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](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[1] = this.ctrlGetRadioState;
+ 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);
+
+ req = new Object();
+ req.cmd = cmd;
+ req.token = token;
+ req.protobuf = protobuf;
+ ctrlWorker.add(req);
+
+ //print('onCtrlServerCmd X cmd=' + cmd + ' token=' + token);
+ } catch (err) {
+ print('onCtrlServerCmd X Exception err=' + err);
+ }
+}
+
--- /dev/null
+/**
+ * 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 = RADIO_STATE_UNAVAILABLE;
+
+// The state of the screen
+var gScreenState = 0;
+
+// The base band version
+var gBaseBandVersion = 'mock-ril 0.1';
+
+// 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;
+}
+
+function setRadioState(newRadioState) {
+ gRadioState = newRadioState;
+ sendRilUnsolicitedResponse(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED);
+}
+
+/**
+ * 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_IMSI] = { // 11
+ 'components' : [simulatedIccWorker],
+};
+dispatchTable[RIL_REQUEST_HANGUP] = { // 12
+ 'components' : [simulatedRadioWorker],
+ 'schemaName' : 'ReqHangUp',
+};
+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_SCREEN_STATE] = { // 61
+ 'components' : [simulatedRadioWorker],
+ 'schemaName' : 'ReqScreenState',
+};
+
+/**
+ * Start the mock rill after loading
+ */
+function startMockRil() {
+ print("startMockRil E:");
+ setRadioState(RADIO_STATE_SIM_READY);
+ print("startMockRil X:");
+}
--- /dev/null
+/**
+ * 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 */
+
+/**
+ * RIL_RadioState
+ */
+var RADIO_STATE_OFF = 0; /* Radio explictly powered off (eg CFUN=0) */
+var RADIO_STATE_UNAVAILABLE = 1; /* Radio unavailable (eg, resetting or not booted) */
+var RADIO_STATE_SIM_NOT_READY = 2; /* Radio is on, but the SIM interface is not ready */
+var RADIO_STATE_SIM_LOCKED_OR_ABSENT = 3; /* SIM PIN locked, PUK required, network
+ personalization locked; or SIM absent */
+var RADIO_STATE_SIM_READY = 4; /* Radio is on and SIM interface is available */
+var RADIO_STATE_RUIM_NOT_READY = 5; /* Radio is on, but the RUIM interface is not ready */
+var RADIO_STATE_RUIM_READY = 6; /* Radio is on and the RUIM interface is available */
+var RADIO_STATE_RUIM_LOCKED_OR_ABSENT = 7; /* RUIM PIN locked, PUK required, network
+ personalization locked; or RUIM absent */
+var RADIO_STATE_NV_NOT_READY = 8; /* Radio is on, but the NV interface is not available */
+var RADIO_STATE_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
--- /dev/null
+/**
+ * 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 RilCardStatus() {
+ this.cardState = 0;
+ this.universalPinState = 0;
+ this.gsmUmtsSubscriptionAppIndex = 0;
+ this.cdmaSubscriptionAppIndex = 0;
+ this.numApplications = 0;
+ }
+
+ 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 = Object();
+ rsp.retriesRemaining = 3;
+ result.responseProtobuf = rilSchema[packageNameAndSeperator +
+ 'RspEnterSimPin'].serialize(rsp);
+ return result;
+ }
+
+ this.rilRequestGetImsi = function(req) { // 11
+ print('Icc: rilRequestGetImsi');
+
+ var rsp = Object();
+ rsp.strings = 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 = 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 = Object();
+ rsp.strings = Array();
+ rsp.strings[0] = IMEI;
+ result.responseProtobuf = rilSchema[packageNameAndSeperator +
+ 'RspStrings'].serialize(rsp);
+ return result;
+ }
+
+ this.rilRequestGetImeisv = function(req) { // 39
+ print('Icc: rilRequestGetImeisv');
+
+ var rsp = Object();
+ rsp.strings = 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](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();
+
--- /dev/null
+/**
+ * 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 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;
+
+ // The result returned by the request handlers
+ var result = new Object();
+
+ this.rilRequestHangUp = function(req) { // 12
+ print('Radio: rilRequestHangUp data.connection_index=' + req.data.connectionIndex);
+ return result;
+ }
+
+ this.rilRequestRegistrationState = function(req) { // 20
+ print('Radio: rilRequestRegistrationState');
+
+ var rsp = 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;
+ }
+
+ this.rilRequestGprsRegistrationState = function(req) { // 21
+ print('Radio: rilRequestGprsRegistrationState');
+
+ var rsp = 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;
+ }
+
+ this.rilRequestQueryNeworkSelectionMode = function(req) { // 45
+ print('Radio: rilRequestQueryNeworkSelectionMode');
+
+ var rsp = Object();
+ rsp.integers = Array();
+ rsp.integers[0] = networkSelectionMode;
+
+ result.responseProtobuf = rilSchema[packageNameAndSeperator +
+ 'RspIntegers'].serialize(rsp);
+ return result;
+ }
+
+ this.rilRequestSetNeworkSelectionAutomatic = function(req) { // 46
+ print('Radio: rilRequestSetNeworkSelectionAutomatic');
+
+ networkSelectionMode = NETWORK_SELECTION_MODE_AUTOMATIC;
+
+ return result;
+ }
+
+ this.rilRequestBaseBandVersion = function (req) { // 51
+ print('Radio: rilRequestBaseBandVersion');
+ var rsp = Object();
+ rsp.strings = Array();
+ rsp.strings[0] = gBaseBandVersion;
+
+ result.responseProtobuf = rilSchema[packageNameAndSeperator +
+ 'RspStrings'].serialize(rsp);
+ return result;
+ }
+
+ this.rilRequestScreenState = function (req) { // 61
+ print('Radio: rilRequestScreenState: req.data.state=' + req.data.state);
+ screenState = req.data.state;
+ return result;
+ }
+ /**
+ * Process the request
+ */
+ 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 {
+ result = this.radioDispatchTable[req.reqNum](req);
+ } catch (err) {
+ print('Radio: Unknown reqNum=' + req.reqNum);
+ result.rilErrCode = RIL_E_REQUEST_NOT_SUPPORTED;
+ }
+
+ 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);
+ }
+ }
+
+ print('Radio: constructor E');
+ this.radioDispatchTable = new Array();
+ this.radioDispatchTable[RIL_REQUEST_HANGUP] = // 12
+ this.rilRequestHangUp;
+ 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_SCREEN_STATE] = // 61
+ this.rilRequestScreenState;
+ 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();
+
--- /dev/null
+// 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;
+}
+
+enum CtrlStatus {
+ CTRL_STATUS_OK = 0;
+ CTRL_STATUS_ERR = 1;
+}
+
+message CtrlRspRadioState {
+ required ril_proto.RadioState state = 1;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 */
+}
+
+// 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;
+}
+
+// 12 RIL_REQUEST_HANG_UP
+message ReqHangUp {
+ required int32 connection_index = 1;
+}
+
+// 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
+}
+
+// 61 RIL_REQUEST_SCREEN_STATE
+message ReqScreenState {
+ required bool state = 1; // true screen is on, false screen is off
+}
+
--- /dev/null
+#!/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)
+++ /dev/null
-# Copyright 2008 The Android Open Source Project
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- reference-cdma-sms.c
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils libutils libril
-
-# for asprinf
-LOCAL_CFLAGS := -D_GNU_SOURCE
-
-LOCAL_C_INCLUDES := $(KERNEL_HEADERS)
-
-LOCAL_SHARED_LIBRARIES += \
- libcutils libutils
-LOCAL_LDLIBS += -lpthread
-LOCAL_MODULE:= libreference-cdma-sms
-include $(BUILD_SHARED_LIBRARY)
+++ /dev/null
-/*
- * Copyright (C) 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.
- * 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 REFERENCE_CDMA_SMS_H
-#define REFERENCE_CDMA_SMS_H 1
-
-#include <telephony/ril.h>
-#include <telephony/ril_cdma_sms.h>
-
-/**
- * TODO T:
- * check if Bearer data subparameter mask values (CDMS_SMA_MASK_*) have to be moved to ril_cdma_sms.h
- * vendor implementation needs to use ril_cdma_decode_sms and ril_cdma_encode_sms as function names
- */
-
-/** Bearer data subparameter mask values: */
-// TODO T: use enum from vendor .h
-#define WMS_MASK_BD_NULL 0x00000000
-#define WMS_MASK_BD_MSG_ID 0x00000001
-#define WMS_MASK_BD_USER_DATA 0x00000002
-#define WMS_MASK_BD_USER_RESP 0x00000004
-#define WMS_MASK_BD_MC_TIME 0x00000008
-#define WMS_MASK_BD_VALID_ABS 0x00000010
-#define WMS_MASK_BD_VALID_REL 0x00000020
-#define WMS_MASK_BD_DEFER_ABS 0x00000040
-#define WMS_MASK_BD_DEFER_REL 0x00000080
-#define WMS_MASK_BD_PRIORITY 0x00000100
-#define WMS_MASK_BD_PRIVACY 0x00000200
-#define WMS_MASK_BD_REPLY_OPTION 0x00000400
-#define WMS_MASK_BD_NUM_OF_MSGS 0x00000800
-#define WMS_MASK_BD_ALERT 0x00001000
-#define WMS_MASK_BD_LANGUAGE 0x00002000
-#define WMS_MASK_BD_CALLBACK 0x00004000
-#define WMS_MASK_BD_DISPLAY_MODE 0x00008000
-#define WMS_MASK_BD_SCPT_DATA 0x00010000
-#define WMS_MASK_BD_SCPT_RESULT 0x00020000
-#define WMS_MASK_BD_DEPOSIT_INDEX 0x00040000
-#define WMS_MASK_BD_DELIVERY_STATUS 0x00080000
-#define WMS_MASK_BD_IP_ADDRESS 0x10000000
-#define WMS_MASK_BD_RSN_NO_NOTIFY 0x20000000
-#define WMS_MASK_BD_OTHER 0x40000000
-
-
-/** Decode a CDMA SMS Message. */
-RIL_Errno wmsts_ril_cdma_decode_sms (
- RIL_CDMA_Encoded_SMS * encoded_sms, /* Input */
- RIL_CDMA_SMS_ClientBd * client_bd /* Output */
-);
-
-/** Encode a CDMA SMS Message. */
-RIL_Errno wmsts_ril_cdma_encode_sms (
- RIL_CDMA_SMS_ClientBd * client_bd, /* Input */
- RIL_CDMA_Encoded_SMS * encoded_sms /* Output */
-);
-
-#endif /*REFERENCE_CDMA_SMS_H*/
-
#define MAX_AT_RESPONSE 0x1000
/* pathname returned from RIL_REQUEST_SETUP_DATA_CALL / RIL_REQUEST_SETUP_DEFAULT_PDP */
-#define PPP_TTY_PATH "/dev/omap_csmi_tty1"
+#define PPP_TTY_PATH "eth0"
#ifdef USE_TI_COMMANDS
extern void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
size_t datalen);
-extern void* RIL_requestTimedCallback (RIL_TimedCallback callback,
+extern void RIL_requestTimedCallback (RIL_TimedCallback callback,
void *param, const struct timeval *relativeTime);
-extern void RIL_removeTimedCallback(void *callbackInfo);
static struct RIL_Env s_rilEnv = {
RIL_onRequestComplete,
RIL_onUnsolicitedResponse,
- RIL_requestTimedCallback,
- RIL_removeTimedCallback
+ RIL_requestTimedCallback
};
extern void RIL_startEventLoop();