summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-02-17 14:32:06 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-02-17 14:32:06 +0100
commitb29e4d756726e9685ad812210c5f2e5298100140 (patch)
treeb2ddbb0a9f81dbe564c01a86075e87724a23b163
add initial prototype with a few commands
-rw-r--r--CMakeLists.txt47
-rw-r--r--commands-dms.c90
-rw-r--r--commands-dms.h5
-rw-r--r--commands-wds.c47
-rw-r--r--commands-wds.h5
-rw-r--r--commands.c167
-rw-r--r--commands.h49
-rwxr-xr-xdata/gen-code.pl437
-rw-r--r--data/gen-common.pm87
-rwxr-xr-xdata/gen-header.pl116
-rw-r--r--data/lib/JSON.pm2267
-rw-r--r--data/lib/JSON/backportPP.pm2797
-rw-r--r--data/lib/JSON/backportPP/Boolean.pm26
-rw-r--r--data/lib/JSON/backportPP/Compat5005.pm131
-rw-r--r--data/lib/JSON/backportPP/Compat5006.pm173
-rw-r--r--data/qmi-service-ctl.json148
-rw-r--r--data/qmi-service-dms.json1161
-rw-r--r--data/qmi-service-nas.json2771
-rw-r--r--data/qmi-service-pds.json330
-rw-r--r--data/qmi-service-wds.json483
-rw-r--r--data/qmi-service-wms.json567
-rw-r--r--dev.c337
-rw-r--r--main.c95
-rw-r--r--qmi-enums-dms.h337
-rw-r--r--qmi-enums-nas.h835
-rw-r--r--qmi-enums-pds.h150
-rw-r--r--qmi-enums-private.h85
-rw-r--r--qmi-enums-wds.h923
-rw-r--r--qmi-enums-wms.h425
-rw-r--r--qmi-enums.h101
-rw-r--r--qmi-flags64-dms.h198
-rw-r--r--qmi-flags64-nas.h194
-rw-r--r--qmi-message.c155
-rw-r--r--qmi-message.h98
-rw-r--r--qmi-struct.h41
-rw-r--r--uqmi.h94
36 files changed, 15972 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..612cfaa
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,47 @@
+cmake_minimum_required(VERSION 2.6)
+
+PROJECT(uqmi C)
+ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-unused)
+
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
+
+SET(SOURCES main.c dev.c commands.c qmi-message.c)
+
+find_library(json NAMES json-c json)
+SET(LIBS ubox ubus ${json} blobmsg_json)
+
+IF(DEBUG_PACKET)
+ ADD_DEFINITIONS(-DDEBUG_PACKET)
+ENDIF()
+
+IF(DEBUG)
+ ADD_DEFINITIONS(-DDEBUG -g3)
+ENDIF()
+
+SET(service_headers)
+SET(service_sources)
+FOREACH(service ctl dms nas pds wds wms)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT qmi-message-${service}.h
+ COMMAND ./data/gen-header.pl ${service}_ ./data/qmi-service-${service}.json > qmi-message-${service}.h
+ DEPENDS ./data/gen-header.pl ./data/qmi-service-${service}.json ./data/gen-common.pm
+ )
+ SET(service_headers ${service_headers} qmi-message-${service}.h)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT qmi-message-${service}.c
+ COMMAND ./data/gen-code.pl ${service}_ ./data/qmi-service-${service}.json > qmi-message-${service}.c
+ DEPENDS ./data/gen-code.pl ./data/qmi-service-${service}.json ./data/gen-common.pm
+ )
+ SET(service_sources ${service_sources} qmi-message-${service}.c)
+ENDFOREACH()
+
+ADD_CUSTOM_TARGET(gen-headers DEPENDS ${service_headers})
+
+ADD_EXECUTABLE(uqmi ${SOURCES} ${service_sources})
+ADD_DEPENDENCIES(uqmi gen-headers)
+
+TARGET_LINK_LIBRARIES(uqmi ${LIBS})
+
+INSTALL(TARGETS uqmi
+ RUNTIME DESTINATION sbin
+)
diff --git a/commands-dms.c b/commands-dms.c
new file mode 100644
index 0000000..4e049b1
--- /dev/null
+++ b/commands-dms.c
@@ -0,0 +1,90 @@
+#include "qmi-message.h"
+
+static const char *get_pin_status(QmiDmsUimPinStatus status)
+{
+ static const char *pin_status[] = {
+ [QMI_DMS_UIM_PIN_STATUS_NOT_INITIALIZED] = "not_initialized",
+ [QMI_DMS_UIM_PIN_STATUS_ENABLED_NOT_VERIFIED] = "not_verified",
+ [QMI_DMS_UIM_PIN_STATUS_ENABLED_VERIFIED] = "verified",
+ [QMI_DMS_UIM_PIN_STATUS_DISABLED] = "disabled",
+ [QMI_DMS_UIM_PIN_STATUS_BLOCKED] = "blocked",
+ [QMI_DMS_UIM_PIN_STATUS_PERMANENTLY_BLOCKED] = "permanently_blocked",
+ [QMI_DMS_UIM_PIN_STATUS_UNBLOCKED] = "unblocked",
+ [QMI_DMS_UIM_PIN_STATUS_CHANGED] = "changed",
+ };
+ const char *res = "Unknown";
+
+ if (status < ARRAY_SIZE(pin_status) && pin_status[status])
+ res = pin_status[status];
+
+ return res;
+}
+
+static void cmd_dms_get_pin_status_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+ struct qmi_dms_uim_get_pin_status_response res;
+
+ qmi_parse_dms_uim_get_pin_status_response(msg, &res);
+ if (res.set.pin1_status) {
+ printf("pin1_status=%s\n"
+ "pin1_verify_tries=%d\n"
+ "pin1_unblock_tries=%d\n",
+ get_pin_status(res.data.pin1_status.current_status),
+ res.data.pin1_status.verify_retries_left,
+ res.data.pin1_status.unblock_retries_left);
+ }
+ if (res.set.pin2_status) {
+ printf("pin2_status=%s\n"
+ "pin2_verify_tries=%d\n"
+ "pin2_unblock_tries=%d\n",
+ get_pin_status(res.data.pin2_status.current_status),
+ res.data.pin2_status.verify_retries_left,
+ res.data.pin2_status.unblock_retries_left);
+ }
+}
+
+static enum qmi_cmd_result
+cmd_dms_get_pin_status_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ qmi_set_dms_uim_get_pin_status_request(msg);
+ return QMI_CMD_REQUEST;
+}
+
+static void cmd_dms_verify_pin1_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+ struct qmi_dms_uim_verify_pin_response res;
+
+ if (!msg) {
+ fprintf(stderr, "failed\n");
+ return;
+ }
+
+ printf("ok\n");
+}
+
+static enum qmi_cmd_result
+cmd_dms_verify_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ struct qmi_dms_uim_verify_pin_request data = {
+ QMI_INIT_SEQUENCE(info,
+ .pin_id = QMI_DMS_UIM_PIN_ID_PIN,
+ .pin = arg
+ )
+ };
+ qmi_set_dms_uim_verify_pin_request(msg, &data);
+ return QMI_CMD_REQUEST;
+}
+
+#define cmd_dms_verify_pin2_cb cmd_dms_verify_pin1_cb
+static enum qmi_cmd_result
+cmd_dms_verify_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ struct qmi_dms_uim_verify_pin_request data = {
+ QMI_INIT_SEQUENCE(info,
+ .pin_id = QMI_DMS_UIM_PIN_ID_PIN2,
+ .pin = arg
+ )
+ };
+ qmi_set_dms_uim_verify_pin_request(msg, &data);
+ return QMI_CMD_REQUEST;
+}
diff --git a/commands-dms.h b/commands-dms.h
new file mode 100644
index 0000000..af661bc
--- /dev/null
+++ b/commands-dms.h
@@ -0,0 +1,5 @@
+#define __uqmi_dms_commands \
+ __uqmi_command(dms_get_pin_status, dms-get-pin-status, no, QMI_SERVICE_DMS), \
+ __uqmi_command(dms_verify_pin1, dms-verify-pin1, required, QMI_SERVICE_DMS), \
+ __uqmi_command(dms_verify_pin2, dms-verify-pin2, required, QMI_SERVICE_DMS) \
+
diff --git a/commands-wds.c b/commands-wds.c
new file mode 100644
index 0000000..a5c4dcb
--- /dev/null
+++ b/commands-wds.c
@@ -0,0 +1,47 @@
+static struct qmi_wds_start_network_request wds_sn_req = {
+ QMI_INIT(authentication_preference,
+ QMI_WDS_AUTHENTICATION_PAP | QMI_WDS_AUTHENTICATION_CHAP),
+};
+
+#define cmd_wds_set_auth_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_auth_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ static const struct {
+ const char *name;
+ QmiWdsAuthentication auth;
+ } modes[] = {
+ { "pap", QMI_WDS_AUTHENTICATION_PAP },
+ { "chap", QMI_WDS_AUTHENTICATION_CHAP },
+ { "both", QMI_WDS_AUTHENTICATION_PAP | QMI_WDS_AUTHENTICATION_CHAP },
+ { "none", QMI_WDS_AUTHENTICATION_NONE },
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(modes); i++) {
+ if (strcasecmp(modes[i].name, arg) != 0)
+ continue;
+
+ qmi_set(&wds_sn_req, authentication_preference, modes[i].auth);
+ return QMI_CMD_DONE;
+ }
+
+ fprintf(stderr, "Invalid auth mode (valid: pap, chap, both, none)\n");
+ return QMI_CMD_EXIT;
+}
+
+#define cmd_wds_set_username_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_username_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ qmi_set_ptr(&wds_sn_req, username, arg);
+ return QMI_CMD_DONE;
+}
+
+#define cmd_wds_set_password_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_password_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ qmi_set_ptr(&wds_sn_req, password, arg);
+ return QMI_CMD_DONE;
+}
diff --git a/commands-wds.h b/commands-wds.h
new file mode 100644
index 0000000..3690c3f
--- /dev/null
+++ b/commands-wds.h
@@ -0,0 +1,5 @@
+#define __uqmi_wds_commands \
+ __uqmi_command(wds_set_auth, wds-set-auth, required, QMI_SERVICE_WDS), \
+ __uqmi_command(wds_set_username, wds-set-username, required, QMI_SERVICE_WDS), \
+ __uqmi_command(wds_set_password, wds-set-password, required, QMI_SERVICE_WDS)
+
diff --git a/commands.c b/commands.c
new file mode 100644
index 0000000..152b1bc
--- /dev/null
+++ b/commands.c
@@ -0,0 +1,167 @@
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "uqmi.h"
+#include "commands.h"
+
+static void no_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+}
+
+static void cmd_version_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+ struct qmi_ctl_get_version_info_response res;
+ int i;
+
+ if (!msg) {
+ printf("Request version failed: %d\n", req->ret);
+ return;
+ }
+
+ qmi_parse_ctl_get_version_info_response(msg, &res);
+
+ printf("Found %d: services:\n", res.data.service_list_n);
+ for (i = 0; i < res.data.service_list_n; i++) {
+ printf("Service %d, version: %d.%d\n",
+ res.data.service_list[i].service,
+ res.data.service_list[i].major_version,
+ res.data.service_list[i].minor_version);
+ }
+}
+
+static enum qmi_cmd_result
+cmd_version_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ qmi_set_ctl_get_version_info_request(msg);
+ return QMI_CMD_REQUEST;
+}
+
+#define cmd_get_client_id_cb no_cb
+static enum qmi_cmd_result
+cmd_get_client_id_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ QmiService svc = qmi_service_get_by_name(arg);
+
+ if (svc < 0) {
+ fprintf(stderr, "Invalid service name '%s'\n", arg);
+ return QMI_CMD_EXIT;
+ }
+
+ if (qmi_service_connect(qmi, svc, -1)) {
+ fprintf(stderr, "Failed to connect to service\n");
+ return QMI_CMD_EXIT;
+ }
+
+ printf("%d\n", qmi_service_get_client_id(qmi, svc));
+ return QMI_CMD_DONE;
+}
+
+#define cmd_set_client_id_cb no_cb
+static enum qmi_cmd_result
+cmd_set_client_id_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ QmiService svc;
+ int id;
+ char *s;
+
+ s = strchr(arg, ',');
+ if (!s) {
+ fprintf(stderr, "Invalid argument\n");
+ return QMI_CMD_EXIT;
+ }
+ *s = 0;
+ s++;
+
+ id = strtoul(s, &s, 0);
+ if (s && *s) {
+ fprintf(stderr, "Invalid argument\n");
+ return QMI_CMD_EXIT;
+ }
+
+ svc = qmi_service_get_by_name(arg);
+ if (svc < 0) {
+ fprintf(stderr, "Invalid service name '%s'\n", arg);
+ return QMI_CMD_EXIT;
+ }
+
+ if (qmi_service_connect(qmi, svc, id)) {
+ fprintf(stderr, "Failed to connect to service\n");
+ return QMI_CMD_EXIT;
+ }
+
+ return QMI_CMD_DONE;
+}
+
+#include "commands-wds.c"
+#include "commands-dms.c"
+
+#define __uqmi_command(_name, _optname, _arg, _type) \
+ [__UQMI_COMMAND_##_name] = { \
+ .name = #_optname, \
+ .type = _type, \
+ .prepare = cmd_##_name##_prepare, \
+ .cb = cmd_##_name##_cb, \
+ }
+
+const struct uqmi_cmd_handler uqmi_cmd_handler[__UQMI_COMMAND_LAST] = {
+ __uqmi_commands
+};
+#undef __uqmi_command
+
+static struct uqmi_cmd *cmds;
+static int n_cmds;
+
+void uqmi_add_command(char *arg, int cmd)
+{
+ int idx = n_cmds++;
+
+ cmds = realloc(cmds, n_cmds * sizeof(*cmds));
+ cmds[idx].handler = &uqmi_cmd_handler[cmd];
+ cmds[idx].arg = optarg;
+}
+
+static bool __uqmi_run_commands(struct qmi_dev *qmi, bool option)
+{
+ static char buf[2048];
+ static struct qmi_request req;
+ int i;
+
+ for (i = 0; i < n_cmds; i++) {
+ enum qmi_cmd_result res;
+ bool cmd_option = cmds[i].handler->type == CMD_TYPE_OPTION;
+
+ if (cmd_option != option)
+ continue;
+
+ if (cmds[i].handler->type > QMI_SERVICE_CTL &&
+ qmi_service_connect(qmi, cmds[i].handler->type, -1)) {
+ fprintf(stderr, "Error in command '%s': failed to connect to service\n",
+ cmds[i].handler->name);
+ return false;
+ }
+ res = cmds[i].handler->prepare(qmi, &req, (void *) buf, cmds[i].arg);
+ switch(res) {
+ case QMI_CMD_REQUEST:
+ qmi_request_start(qmi, &req, (void *) buf, cmds[i].handler->cb);
+ qmi_request_wait(qmi, &req);
+ break;
+ case QMI_CMD_EXIT:
+ return false;
+ case QMI_CMD_DONE:
+ default:
+ continue;
+ }
+ }
+ return true;
+}
+
+void uqmi_run_commands(struct qmi_dev *qmi)
+{
+ if (__uqmi_run_commands(qmi, true))
+ __uqmi_run_commands(qmi, false);
+ free(cmds);
+ cmds = NULL;
+ n_cmds = 0;
+}
diff --git a/commands.h b/commands.h
new file mode 100644
index 0000000..2b1562a
--- /dev/null
+++ b/commands.h
@@ -0,0 +1,49 @@
+#ifndef __UQMI_COMMANDS_H
+#define __UQMI_COMMANDS_H
+
+#include <stdbool.h>
+#include "commands-wds.h"
+#include "commands-dms.h"
+
+enum qmi_cmd_result {
+ QMI_CMD_DONE,
+ QMI_CMD_REQUEST,
+ QMI_CMD_EXIT,
+};
+
+enum {
+ CMD_TYPE_OPTION = -1,
+};
+
+struct uqmi_cmd_handler {
+ const char *name;
+ int type;
+
+ enum qmi_cmd_result (*prepare)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg);
+ void (*cb)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg);
+};
+
+struct uqmi_cmd {
+ const struct uqmi_cmd_handler *handler;
+ char *arg;
+};
+
+#define __uqmi_commands \
+ __uqmi_command(version, get-versions, no, QMI_SERVICE_CTL), \
+ __uqmi_command(set_client_id, set-client-id, required, CMD_TYPE_OPTION), \
+ __uqmi_command(get_client_id, get-client-id, required, QMI_SERVICE_CTL), \
+ __uqmi_wds_commands, \
+ __uqmi_dms_commands
+
+#define __uqmi_command(_name, _optname, _arg, _option) __UQMI_COMMAND_##_name
+enum uqmi_command {
+ __uqmi_commands,
+ __UQMI_COMMAND_LAST
+};
+#undef __uqmi_command
+
+extern const struct uqmi_cmd_handler uqmi_cmd_handler[];
+void uqmi_add_command(char *arg, int longidx);
+void uqmi_run_commands(struct qmi_dev *qmi);
+
+#endif
diff --git a/data/gen-code.pl b/data/gen-code.pl
new file mode 100755
index 0000000..d7e5079
--- /dev/null
+++ b/data/gen-code.pl
@@ -0,0 +1,437 @@
+#!/usr/bin/env perl
+use strict;
+
+use FindBin '$Bin';
+require "$Bin/gen-common.pm";
+
+our %tlv_types;
+our $ctl;
+
+my $data = get_json();
+my $varsize_field;
+
+my %tlv_get = (
+ gint8 => "*(int8_t *) get_next(1)",
+ guint8 => "*(uint8_t *) get_next(1)",
+ gint16 => "le16_to_cpu(*(uint16_t *) get_next(2))",
+ guint16 => "le16_to_cpu(*(uint16_t *) get_next(2))",
+ gint32 => "le32_to_cpu(*(uint32_t *) get_next(4))",
+ guint32 => "le32_to_cpu(*(uint32_t *) get_next(4))",
+ gint64 => "le64_to_cpu(*(uint64_t *) get_next(8))",
+ guint64 => "le64_to_cpu(*(uint64_t *) get_next(8))",
+);
+
+my %tlv_get_be = (
+ gint16 => "be16_to_cpu(*(uint16_t *) get_next(2))",
+ guint16 => "be16_to_cpu(*(uint16_t *) get_next(2))",
+ gint32 => "be32_to_cpu(*(uint32_t *) get_next(4))",
+ guint32 => "be32_to_cpu(*(uint32_t *) get_next(4))",
+ gint64 => "be64_to_cpu(*(uint64_t *) get_next(8))",
+ guint64 => "be64_to_cpu(*(uint64_t *) get_next(8))",
+);
+
+sub gen_tlv_parse_field($$$$) {
+ my $var = shift;
+ my $elem = shift;
+ my $n_indent = shift;
+ my $iterator = shift;
+ my $data = "";
+
+ my $indent = "\t" x ($n_indent + 3);
+ my $use_iterator = 0;
+ my $field = 0;
+
+ my $type = $elem->{"format"};
+
+ $varsize_field and die "Cannot place fields after a variable-sized field (var: $var, field: $varsize_field)\n";
+
+ my $val;
+ if ($elem->{endian} eq 'network') {
+ $val = $tlv_get_be{$type};
+ } else {
+ $val = $tlv_get{$type};
+ }
+
+ if ($val) {
+ return $indent."$var = $val;\n";
+ } elsif ($type eq "array") {
+ my $size;
+ my $cur_varsize_field;
+ my $var_data;
+ my $var_iterator;
+
+ if ($elem->{"fixed-size"}) {
+ $size = $elem->{"fixed-size"};
+ $data .= $indent."for ($iterator = 0; $iterator < $size; $iterator\++) {\n";
+
+ ($var_data, $var_iterator) =
+ gen_tlv_parse_field($var."[$iterator]", $elem->{"array-element"}, $n_indent + 1, "i$iterator");
+
+ } else {
+ my $prefix = $elem->{"size-prefix-format"};
+ $prefix or $prefix = 'guint8';
+
+ $size = $tlv_get{$prefix};
+ die "Unknown size element type '$prefix'" if not defined $size;
+
+ ($var_data, $var_iterator) =
+ gen_tlv_parse_field($var."[$var\_n]", $elem->{"array-element"}, $n_indent + 1, "i$iterator");
+
+ $var_data .= $indent."\t$var\_n++;\n";
+ $data .= $indent."$iterator = $size;\n";
+ $data .= $indent."$var = __qmi_alloc_static($iterator);\n";
+ $data .= $indent."while($iterator\-- > 0) {\n";
+ }
+
+ $var_iterator and $data .= $indent."\tint i$iterator;\n";
+ $data .= $var_data;
+ $data .= $indent."}\n";
+
+ $varsize_field = $cur_varsize_field;
+
+ return $data, 1;
+ } elsif ($type eq "struct" or $type eq "sequence") {
+ foreach my $field (@{$elem->{contents}}) {
+ my $field_cname = gen_cname($field->{name});
+ my ($var_data, $var_iterator) =
+ gen_tlv_parse_field("$var.$field_cname", $field, $n_indent, $iterator);
+
+ $data .= $var_data;
+ $var_iterator and $use_iterator = 1;
+ }
+ return $data, $use_iterator;
+ } elsif ($type eq "string") {
+ my $size = $elem->{"fixed-size"};
+ $size or do {
+ my $prefix = $elem->{"size-prefix-format"};
+ $prefix or do {
+ $elem->{type} eq 'TLV' or $prefix = 'guint8';
+ };
+
+ if ($prefix) {
+ $size = $tlv_get{$prefix};
+ } else {
+ $size = "cur_tlv_len - ofs";
+ $varsize_field = $var;
+ }
+ };
+
+ $data .= $indent."$iterator = $size;\n";
+ my $maxsize = $elem->{"max-size"};
+ $maxsize and do {
+ $data .= $indent."if ($iterator > $maxsize)\n";
+ $data .= $indent."\t$iterator = $maxsize;\n";
+ };
+ $data .= $indent.$var." = __qmi_copy_string(get_next($iterator), $iterator);\n";
+ return $data, 1;
+ } elsif ($type eq "guint-sized") {
+ my $size = $elem->{"guint-size"};
+ return $indent."$var = ({ uint64_t var; memcpy(&var, get_next($size), $size); le64_to_cpu(var); });\n";
+ } else {
+ die "Invalid type $type for variable $var";
+ }
+}
+
+sub gen_tlv_type($$) {
+ my $cname = shift;
+ my $elem = shift;
+
+ my $type = $elem->{"format"};
+ my $id = $elem->{"id"};
+ my $data = "";
+ undef $varsize_field;
+ my $indent = "\t\t\t";
+
+ $type or return undef;
+
+ print <<EOF;
+ case $id:
+EOF
+
+ my $val = $tlv_get{$type};
+ if ($val) {
+ print $indent."qmi_set(res, $cname, $val);\n";
+ } elsif ($type eq "string") {
+ my ($var_data, $var_iterator) =
+ gen_tlv_parse_field("res->data.$cname", $elem, 0, "i");
+ print "$var_data";
+ } elsif ($type eq "array") {
+ $elem->{"fixed-size"} and $data = $indent."res->set.$cname = 1;\n";
+ my ($var_data, $var_iterator) =
+ gen_tlv_parse_field("res->data.$cname", $elem, 0, "i");
+ print "$data$var_data\n";
+ } elsif ($type eq "sequence" or $type eq "struct") {
+ my ($var_data, $var_iterator) =
+ gen_tlv_parse_field("res->data.$cname", $elem, 0, "i");
+
+ print $indent."res->set.$cname = 1;\n".$var_data;
+ }
+ print <<EOF;
+ break;
+
+EOF
+}
+
+sub gen_parse_func($$)
+{
+ my $name = shift;
+ my $data = shift;
+
+ my $type = "svc";
+ $ctl and $type = "ctl";
+
+ print gen_tlv_parse_func($name, $data)."\n";
+ print <<EOF;
+{
+ void *tlv_buf = &msg->$type.tlv;
+ int tlv_len = le16_to_cpu(msg->$type.tlv_len);
+EOF
+
+ if (gen_has_types($data)) {
+ print <<EOF;
+ struct tlv *tlv;
+ int i;
+
+ memset(res, 0, sizeof(*res));
+
+ __qmi_alloc_reset();
+ while ((tlv = tlv_get_next(&tlv_buf, &tlv_len)) != NULL) {
+ unsigned int cur_tlv_len = le16_to_cpu(tlv->len);
+ unsigned int ofs = 0;
+
+ switch(tlv->type) {
+EOF
+ foreach my $field (@$data) {
+ my $cname = gen_cname($field->{name});
+ gen_tlv_type($cname, $field);
+ }
+
+ print <<EOF;
+ default:
+ break;
+ }
+ }
+
+ return 0;
+
+error_len:
+ fprintf(stderr, "%s: Invalid TLV length in message, tlv=0x%02x, len=%d\\n",
+ __func__, tlv->type, le16_to_cpu(tlv->len));
+ return QMI_ERROR_INVALID_DATA;
+EOF
+ } else {
+ print <<EOF;
+
+ return qmi_check_message_status(tlv_buf, tlv_len);
+EOF
+ }
+
+ print <<EOF;
+}
+
+EOF
+}
+
+my %tlv_set = (
+ guint8 => sub { my $a = shift; my $b = shift; print "*(uint8_t *) $a = $b;\n" },
+ guint16 => sub { my $a = shift; my $b = shift; print "*(uint16_t *) $a = cpu_to_le16($b);\n" },
+ guint32 => sub { my $a = shift; my $b = shift; print "*(uint32_t *) $a = cpu_to_le32($b);\n" },
+);
+
+my %tlv_put = (
+ gint8 => sub { my $a = shift; "put_tlv_var(uint8_t, $a, 1);\n" },
+ guint8 => sub { my $a = shift; "put_tlv_var(uint8_t, $a, 1);\n" },
+ gint16 => sub { my $a = shift; "put_tlv_var(uint16_t, cpu_to_le16($a), 2);\n" },
+ guint16 => sub { my $a = shift; "put_tlv_var(uint16_t, cpu_to_le16($a), 2);\n" },
+ gint32 => sub { my $a = shift; "put_tlv_var(uint32_t, cpu_to_le32($a), 4);\n" },
+ guint32 => sub { my $a = shift; "put_tlv_var(uint32_t, cpu_to_le32($a), 4);\n" },
+ gint64 => sub { my $a = shift; "put_tlv_var(uint64_t, cpu_to_le64($a), 8);\n" },
+ guint64 => sub { my $a = shift; "put_tlv_var(uint64_t, cpu_to_le64($a), 8);\n" },
+);
+
+my %tlv_put_be = (
+ gint16 => sub { my $a = shift; "put_tlv_var(uint16_t, cpu_to_be16($a), 2);\n" },
+ guint16 => sub { my $a = shift; "put_tlv_var(uint16_t, cpu_to_be16($a), 2);\n" },
+ gint32 => sub { my $a = shift; "put_tlv_var(uint32_t, cpu_to_be32($a), 4);\n" },
+ guint32 => sub { my $a = shift; "put_tlv_var(uint32_t, cpu_to_be32($a), 4);\n" },
+ gint64 => sub { my $a = shift; "put_tlv_var(uint64_t, cpu_to_be64($a), 8);\n" },
+ guint64 => sub { my $a = shift; "put_tlv_var(uint64_t, cpu_to_be64($a), 8);\n" },
+);
+
+sub gen_tlv_val_set($$$$$)
+{
+ my $cname = shift;
+ my $elem = shift;
+ my $indent = shift;
+ my $iterator = shift;
+ my $cond = shift;
+ my $prev_cond;
+
+ my $type = $elem->{format};
+ my $data = "";
+
+ my $put;
+ if ($elem->{endian} eq 'network') {
+ $put = $tlv_put_be{$type};
+ } else {
+ $put = $tlv_put{$type};
+ }
+ $put and return $indent.&$put($cname);
+
+ $type eq 'array' and do {
+ my $size = $elem->{"fixed-size"};
+
+ $size or do {
+ $cond and $$cond = $cname;
+ $size = $cname."_n";
+
+ my $prefix = $elem->{"size-prefix-format"};
+ $prefix or $prefix = 'gint8';
+
+ $put = $tlv_put{$prefix};
+ $put or die "Unknown size prefix type $prefix\n";
+
+ $data .= $indent.&$put($size);
+ };
+
+ $data .= $indent."for ($iterator = 0; $iterator < $size; $iterator++) {\n";
+ my ($var_data, $var_iterator) =
+ gen_tlv_val_set($cname."[$iterator]", $elem->{"array-element"}, "$indent\t", "i$iterator", undef);
+
+ $var_iterator and $data .= $indent."\tint i$iterator;\n";
+ $data .= $var_data;
+ $data .= $indent."}\n";
+
+ return $data, 1;
+ };
+
+ $type eq 'string' and do {
+ $cond and $$cond = $cname;
+
+ my $len = $elem->{"fixed-size"};
+ $len or $len = "strlen($cname)";
+
+ $data .= $indent."$iterator = $len;\n";
+
+ $len = $elem->{"max-size"};
+ $len and do {
+ $data .= $indent."if ($iterator > $len)\n";
+ $data .= $indent."\t$iterator = $len;\n";
+ };
+
+ my $prefix = $elem->{"size-prefix-format"};
+ $prefix or do {
+ $elem->{"type"} eq 'TLV' or $prefix = 'guint8';
+ };
+
+ $prefix and do {
+ my $put = $tlv_put{$prefix} or die "Unknown size prefix format $prefix";
+ $data .= $indent.&$put("$iterator");
+ };
+
+ $data .= $indent."strncpy(__qmi_alloc_static($iterator), $cname, $iterator);\n";
+
+ return $data, 1;
+ };
+
+ ($type eq 'sequence' or $type eq 'struct') and do {
+ my $use_iterator;
+
+ foreach my $field (@{$elem->{contents}}) {
+ my $field_cname = gen_cname($field->{name});
+ my ($var_data, $var_iterator) =
+ gen_tlv_val_set("$cname.$field_cname", $field, $indent, $iterator, undef);
+
+ $var_iterator and $use_iterator = 1;
+ $data .= $var_data;
+ }
+ return $data, $use_iterator;
+ };
+
+ die "Unknown type $type";
+}
+
+sub gen_tlv_attr_set($$)
+{
+ my $cname = shift;
+ my $elem = shift;
+ my $indent = "\t";
+ my $data = "";
+ my $iterator = "";
+ my $size_var = "";
+ my $id = $elem->{id};
+
+ my $cond = "req->set.$cname";
+ my ($var_data, $use_iterator) =
+ gen_tlv_val_set("req->data.$cname", $elem, "\t\t", "i", \$cond);
+ $use_iterator and $iterator = "\t\tint i;\n";
+
+ $data = <<EOF;
+ if ($cond) {
+ void *buf;
+ int ofs;
+$iterator$size_var
+ __qmi_alloc_reset();
+$var_data
+ buf = __qmi_get_buf(&ofs);
+ tlv_new(msg, $id, ofs, buf);
+ }
+
+EOF
+ print "$data";
+}
+
+sub gen_set_func($$)
+{
+ my $name = shift;
+ my $fields = shift;
+ my $data = shift;
+
+ my $type = "svc";
+ my $service = $data->{service};
+ my $id = $data->{id};
+
+ $service eq 'CTL' and $type = 'ctl';
+
+ print gen_tlv_set_func($name, $fields)."\n";
+ print <<EOF;
+{
+ qmi_init_request_message(msg, QMI_SERVICE_$service);
+ msg->$type.message = cpu_to_le16($id);
+
+EOF
+ foreach my $field (@$fields) {
+ my $cname = gen_cname($field->{name});
+ gen_tlv_attr_set($cname, $field);
+ }
+
+ print <<EOF;
+ return 0;
+}
+
+EOF
+}
+
+print <<EOF;
+/* generated by uqmi gen-code.pl */
+#include <stdio.h>
+#include <string.h>
+#include "qmi-message.h"
+
+#define get_next(_size) ({ void *_buf = &tlv->data[ofs]; ofs += _size; if (ofs > cur_tlv_len) goto error_len; _buf; })
+#define copy_tlv(_val, _size) \\
+ do { \\
+ int __size = _size; \\
+ if (__size > 0) \\
+ memcpy(__qmi_alloc_static(__size), _val, __size); \\
+ } while (0);
+
+#define put_tlv_var(_type, _val, _size) \\
+ do { \\
+ _type __var = _val; \\
+ copy_tlv(&__var, _size); \\
+ } while(0)
+
+EOF
+
+gen_foreach_message_type($data, \&gen_set_func, \&gen_parse_func);
diff --git a/data/gen-common.pm b/data/gen-common.pm
new file mode 100644
index 0000000..d9d281c
--- /dev/null
+++ b/data/gen-common.pm
@@ -0,0 +1,87 @@
+use lib "$Bin/lib";
+use JSON;
+
+@ARGV < 2 and die "Usage: $0 <prefix> <file>\n";
+my $prefix = shift @ARGV;
+
+our $ctl;
+our %tlv_types = (
+ gint8 => "int8_t",
+ guint8 => "uint8_t",
+ gint16 => "int16_t",
+ guint16 => "uint16_t",
+ gint32 => "int32_t",
+ guint32 => "uint32_t",
+ gint64 => "int64_t",
+ guint64 => "uint64_t",
+ gboolean => "bool",
+);
+
+$prefix eq 'ctl_' and $ctl = 1;
+
+sub get_json() {
+ local $/;
+ my $json = <>;
+ return decode_json($json);
+}
+
+sub gen_cname($) {
+ my $name = shift;
+
+ $name =~ s/[^a-zA-Z0-9_]/_/g;
+ return lc($name);
+}
+
+sub gen_has_types($) {
+ my $data = shift;
+
+ foreach my $field (@$data) {
+ my $type = $field->{"format"};
+ $type and return 1;
+ }
+ return undef
+}
+
+sub gen_tlv_set_func($$) {
+ my $name = shift;
+ my $data = shift;
+
+ $name = gen_cname($name);
+ if (gen_has_types($data)) {
+ return "int qmi_set_$name(struct qmi_msg *msg, struct qmi_$name *req)"
+ } else {
+ return "int qmi_set_$name(struct qmi_msg *msg)"
+ }
+}
+
+sub gen_tlv_parse_func($$) {
+ my $name = shift;
+ my $data = shift;
+
+ $name = gen_cname($name);
+ if (gen_has_types($data)) {
+ return "int qmi_parse_$name(struct qmi_msg *msg, struct qmi_$name *res)"
+ } else {
+ return "int qmi_parse_$name(struct qmi_msg *msg)"
+ }
+}
+
+sub gen_foreach_message_type($$$)
+{
+ my $data = shift;
+ my $req_sub = shift;
+ my $res_sub = shift;
+
+ foreach my $entry (@$data) {
+ my $args = [];
+ my $fields = [];
+
+ next if $entry->{type} ne 'Message';
+ next if not defined $entry->{input} and not defined $entry->{output};
+
+ &$req_sub($prefix.$entry->{name}." Request", $entry->{input}, $entry);
+ &$res_sub($prefix.$entry->{name}." Response", $entry->{output}, $entry);
+ }
+}
+
+1;
diff --git a/data/gen-header.pl b/data/gen-header.pl
new file mode 100755
index 0000000..f1cc1f9
--- /dev/null
+++ b/data/gen-header.pl
@@ -0,0 +1,116 @@
+#!/usr/bin/env perl
+use strict;
+
+use FindBin '$Bin';
+require "$Bin/gen-common.pm";
+
+our %tlv_types;
+
+my $data = get_json();
+
+sub gen_tlv_type($$$) {
+ my $cname = shift;
+ my $elem = shift;
+ my $indent = shift;
+
+ my $type = $elem->{"format"};
+ my $ptype = $elem->{"public-format"};
+ my $data;
+
+ $type or return undef;
+ $ptype or $ptype = $type;
+
+ if ($type eq "guint-sized") {
+ my $size = $elem->{"guint-size"};
+
+ if ($size > 4 and $size < 8) {
+ $ptype = "guint64";
+ } elsif ($size > 2) {
+ $ptype = "guint32";
+ } else {
+ die "Invalid size for guint-sized";
+ }
+ }
+
+ if ($tlv_types{$ptype}) {
+ return $indent.$tlv_types{$ptype}." $cname;";
+ } elsif ($tlv_types{$type}) {
+ return $indent."$ptype $cname;";
+ } elsif ($type eq "string") {
+ return $indent."char *$cname;", 1;
+ } elsif ($type eq "array") {
+ if ($elem->{"fixed-size"}) {
+ my $len_f = '['.$elem->{"fixed-size"}.']';
+ return gen_tlv_type("$cname$len_f", $elem->{"array-element"}, $indent);
+ }
+ my ($type, $no_set_field) = gen_tlv_type("*$cname", $elem->{"array-element"}, $indent);
+ return undef if not defined $type;
+ return $indent."int $cname\_n;$type", 1;
+ } elsif ($type eq "sequence" or $type eq "struct") {
+ my $contents = $elem->{"contents"};
+ my $data = "struct {";
+
+ foreach my $field (@$contents) {
+ my $_cname = gen_cname($field->{name});
+ my ($_data, $no_set_field) = gen_tlv_type($_cname, $field, "$indent\t");
+ $data .= $_data;
+ }
+ return $indent.$data.$indent."} $cname;";
+ } else {
+ die "Unknown type: $ptype\n";
+ }
+}
+
+sub gen_tlv_struct($$) {
+ my $name = shift;
+ my $data = shift;
+ my $_set = "";
+ my $_data = "";
+
+ foreach my $field (@$data) {
+ my $cname = gen_cname($field->{name});
+ my ($data, $no_set_field) = gen_tlv_type($cname, $field, "\n\t\t");
+
+ next if not defined $data;
+ $_data .= $data;
+
+ next if $no_set_field;
+ $_set .= "\n\t\tint $cname : 1;";
+ }
+
+ $name = gen_cname($name);
+
+ $_data or return;
+
+ $_set .= "\n\t";
+ $_data .= "\n\t";
+
+ print <<EOF
+struct qmi_$name {
+ struct {$_set} set;
+ struct {$_data} data;
+};
+
+EOF
+}
+
+sub gen_set_func_header($$)
+{
+ my $name = shift;
+ my $data = shift;
+
+ my $func = gen_tlv_set_func($name, $data);
+ $func and print "$func;\n";
+}
+
+sub gen_parse_func_header($$)
+{
+ my $name = shift;
+ my $data = shift;
+
+ my $func = gen_tlv_parse_func($name, $data);
+ $func and print "$func;\n\n";
+}
+
+gen_foreach_message_type($data, \&gen_tlv_struct, \&gen_tlv_struct);
+gen_foreach_message_type($data, \&gen_set_func_header, \&gen_parse_func_header);
diff --git a/data/lib/JSON.pm b/data/lib/JSON.pm
new file mode 100644
index 0000000..f57c555
--- /dev/null
+++ b/data/lib/JSON.pm
@@ -0,0 +1,2267 @@
+package JSON;
+
+
+use strict;
+use Carp ();
+use base qw(Exporter);
+@JSON::EXPORT = qw(from_json to_json jsonToObj objToJson encode_json decode_json);
+
+BEGIN {
+ $JSON::VERSION = '2.53';
+ $JSON::DEBUG = 0 unless (defined $JSON::DEBUG);
+ $JSON::DEBUG = $ENV{ PERL_JSON_DEBUG } if exists $ENV{ PERL_JSON_DEBUG };
+}
+
+my $Module_XS = 'JSON::XS';
+my $Module_PP = 'JSON::PP';
+my $Module_bp = 'JSON::backportPP'; # included in JSON distribution
+my $PP_Version = '2.27200';
+my $XS_Version = '2.27';
+
+
+# XS and PP common methods
+
+my @PublicMethods = qw/
+ ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref
+ allow_blessed convert_blessed filter_json_object filter_json_single_key_object
+ shrink max_depth max_size encode decode decode_prefix allow_unknown
+/;
+
+my @Properties = qw/
+ ascii latin1 utf8 indent space_before space_after relaxed canonical allow_nonref
+ allow_blessed convert_blessed shrink max_depth max_size allow_unknown
+/;
+
+my @XSOnlyMethods = qw//; # Currently nothing
+
+my @PPOnlyMethods = qw/
+ indent_length sort_by
+ allow_singlequote allow_bignum loose allow_barekey escape_slash as_nonblessed
+/; # JSON::PP specific
+
+
+# used in _load_xs and _load_pp ($INSTALL_ONLY is not used currently)
+my $_INSTALL_DONT_DIE = 1; # When _load_xs fails to load XS, don't die.
+my $_INSTALL_ONLY = 2; # Don't call _set_methods()
+my $_ALLOW_UNSUPPORTED = 0;
+my $_UNIV_CONV_BLESSED = 0;
+my $_USSING_bpPP = 0;
+
+
+# Check the environment variable to decide worker module.
+
+unless ($JSON::Backend) {
+ $JSON::DEBUG and Carp::carp("Check used worker module...");
+
+ my $backend = exists $ENV{PERL_JSON_BACKEND} ? $ENV{PERL_JSON_BACKEND} : 1;
+
+ if ($backend eq '1' or $backend =~ /JSON::XS\s*,\s*JSON::PP/) {
+ _load_xs($_INSTALL_DONT_DIE) or _load_pp();
+ }
+ elsif ($backend eq '0' or $backend eq 'JSON::PP') {
+ _load_pp();
+ }
+ elsif ($backend eq '2' or $backend eq 'JSON::XS') {
+ _load_xs();
+ }
+ elsif ($backend eq 'JSON::backportPP') {
+ $_USSING_bpPP = 1;
+ _load_pp();
+ }
+ else {
+ Carp::croak "The value of environmental variable 'PERL_JSON_BACKEND' is invalid.";
+ }
+}
+
+
+sub import {
+ my $pkg = shift;
+ my @what_to_export;
+ my $no_export;
+
+ for my $tag (@_) {
+ if ($tag eq '-support_by_pp') {
+ if (!$_ALLOW_UNSUPPORTED++) {
+ JSON::Backend::XS
+ ->support_by_pp(@PPOnlyMethods) if ($JSON::Backend eq $Module_XS);
+ }
+ next;
+ }
+ elsif ($tag eq '-no_export') {
+ $no_export++, next;
+ }
+ elsif ( $tag eq '-convert_blessed_universally' ) {
+ eval q|
+ require B;
+ *UNIVERSAL::TO_JSON = sub {
+ my $b_obj = B::svref_2object( $_[0] );
+ return $b_obj->isa('B::HV') ? { %{ $_[0] } }
+ : $b_obj->isa('B::AV') ? [ @{ $_[0] } ]
+ : undef
+ ;
+ }
+ | if ( !$_UNIV_CONV_BLESSED++ );
+ next;
+ }
+ push @what_to_export, $tag;
+ }
+
+ return if ($no_export);
+
+ __PACKAGE__->export_to_level(1, $pkg, @what_to_export);
+}
+
+
+# OBSOLETED
+
+sub jsonToObj {
+ my $alternative = 'from_json';
+ if (defined $_[0] and UNIVERSAL::isa($_[0], 'JSON')) {
+ shift @_; $alternative = 'decode';
+ }
+ Carp::carp "'jsonToObj' will be obsoleted. Please use '$alternative' instead.";
+ return JSON::from_json(@_);
+};
+
+sub objToJson {
+ my $alternative = 'to_json';
+ if (defined $_[0] and UNIVERSAL::isa($_[0], 'JSON')) {
+ shift @_; $alternative = 'encode';
+ }
+ Carp::carp "'objToJson' will be obsoleted. Please use '$alternative' instead.";
+ JSON::to_json(@_);
+};
+
+
+# INTERFACES
+
+sub to_json ($@) {
+ if (
+ ref($_[0]) eq 'JSON'
+ or (@_ > 2 and $_[0] eq 'JSON')
+ ) {
+ Carp::croak "to_json should not be called as a method.";
+ }
+ my $json = new JSON;
+
+ if (@_ == 2 and ref $_[1] eq 'HASH') {
+ my $opt = $_[1];
+ for my $method (keys %$opt) {
+ $json->$method( $opt->{$method} );
+ }
+ }
+
+ $json->encode($_[0]);
+}
+
+
+sub from_json ($@) {
+ if ( ref($_[0]) eq 'JSON' or $_[0] eq 'JSON' ) {
+ Carp::croak "from_json should not be called as a method.";
+ }
+ my $json = new JSON;
+
+ if (@_ == 2 and ref $_[1] eq 'HASH') {
+ my $opt = $_[1];
+ for my $method (keys %$opt) {
+ $json->$method( $opt->{$method} );
+ }
+ }
+
+ return $json->decode( $_[0] );
+}
+
+
+sub true { $JSON::true }
+
+sub false { $JSON::false }
+
+sub null { undef; }
+
+
+sub require_xs_version { $XS_Version; }
+
+sub backend {
+ my $proto = shift;
+ $JSON::Backend;
+}
+
+#*module = *backend;
+
+
+sub is_xs {
+ return $_[0]->module eq $Module_XS;
+}
+
+
+sub is_pp {
+ return not $_[0]->xs;
+}
+
+
+sub pureperl_only_methods { @PPOnlyMethods; }
+
+
+sub property {
+ my ($self, $name, $value) = @_;
+
+ if (@_ == 1) {
+ my %props;
+ for $name (@Properties) {
+ my $method = 'get_' . $name;
+ if ($name eq 'max_size') {
+ my $value = $self->$method();
+ $props{$name} = $value == 1 ? 0 : $value;
+ next;
+ }
+ $props{$name} = $self->$method();
+ }
+ return \%props;
+ }
+ elsif (@_ > 3) {
+ Carp::croak('property() can take only the option within 2 arguments.');
+ }
+ elsif (@_ == 2) {
+ if ( my $method = $self->can('get_' . $name) ) {
+ if ($name eq 'max_size') {
+ my $value = $self->$method();
+ return $value == 1 ? 0 : $value;
+ }
+ $self->$method();
+ }
+ }
+ else {
+ $self->$name($value);
+ }
+
+}
+
+
+
+# INTERNAL
+
+sub _load_xs {
+ my $opt = shift;
+
+ $JSON::DEBUG and Carp::carp "Load $Module_XS.";
+
+ # if called after install module, overload is disable.... why?
+ JSON::Boolean::_overrride_overload($Module_XS);
+ JSON::Boolean::_overrride_overload($Module_PP);
+
+ eval qq|
+ use $Module_XS $XS_Version ();
+ |;
+
+ if ($@) {
+ if (defined $opt and $opt & $_INSTALL_DONT_DIE) {
+ $JSON::DEBUG and Carp::carp "Can't load $Module_XS...($@)";
+ return 0;
+ }
+ Carp::croak $@;
+ }
+
+ unless (defined $opt and $opt & $_INSTALL_ONLY) {
+ _set_module( $JSON::Backend = $Module_XS );
+ my $data = join("", <DATA>); # this code is from Jcode 2.xx.
+ close(DATA);
+ eval $data;
+ JSON::Backend::XS->init;
+ }
+
+ return 1;
+};
+
+
+sub _load_pp {
+ my $opt = shift;
+ my $backend = $_USSING_bpPP ? $Module_bp : $Module_PP;
+
+ $JSON::DEBUG and Carp::carp "Load $backend.";
+
+ # if called after install module, overload is disable.... why?
+ JSON::Boolean::_overrride_overload($Module_XS);
+ JSON::Boolean::_overrride_overload($backend);
+
+ if ( $_USSING_bpPP ) {
+ eval qq| require $backend |;
+ }
+ else {
+ eval qq| use $backend $PP_Version () |;
+ }
+
+ if ($@) {
+ if ( $backend eq $Module_PP ) {
+ $JSON::DEBUG and Carp::carp "Can't load $Module_PP ($@), so try to load $Module_bp";
+ $_USSING_bpPP++;
+ $backend = $Module_bp;
+ JSON::Boolean::_overrride_overload($backend);
+ local $^W; # if PP installed but invalid version, backportPP redifines methods.
+ eval qq| require $Module_bp |;
+ }
+ Carp::croak $@ if $@;
+ }
+
+ unless (defined $opt and $opt & $_INSTALL_ONLY) {
+ _set_module( $JSON::Backend = $Module_PP ); # even if backportPP, set $Backend with 'JSON::PP'
+ JSON::Backend::PP->init;
+ }
+};
+
+
+sub _set_module {
+ return if defined $JSON::true;
+
+ my $module = shift;
+
+ local $^W;
+ no strict qw(refs);
+
+ $JSON::true = ${"$module\::true"};
+ $JSON::false = ${"$module\::false"};
+
+ push @JSON::ISA, $module;
+ push @{"$module\::Boolean::ISA"}, qw(JSON::Boolean);
+
+ *{"JSON::is_bool"} = \&{"$module\::is_bool"};
+
+ for my $method ($module eq $Module_XS ? @PPOnlyMethods : @XSOnlyMethods) {
+ *{"JSON::$method"} = sub {
+ Carp::carp("$method is not supported in $module.");
+ $_[0];
+ };
+ }
+
+ return 1;
+}
+
+
+
+#
+# JSON Boolean
+#
+
+package JSON::Boolean;
+
+my %Installed;
+
+sub _overrride_overload {
+ return if ($Installed{ $_[0] }++);
+
+ my $boolean = $_[0] . '::Boolean';
+
+ eval sprintf(q|
+ package %s;
+ use overload (
+ '""' => sub { ${$_[0]} == 1 ? 'true' : 'false' },
+ 'eq' => sub {
+ my ($obj, $op) = ref ($_[0]) ? ($_[0], $_[1]) : ($_[1], $_[0]);
+ if ($op eq 'true' or $op eq 'false') {
+ return "$obj" eq 'true' ? 'true' eq $op : 'false' eq $op;
+ }
+ else {
+ return $obj ? 1 == $op : 0 == $op;
+ }
+ },
+ );
+ |, $boolean);
+
+ if ($@) { Carp::croak $@; }
+
+ return 1;
+}
+
+
+#
+# Helper classes for Backend Module (PP)
+#
+
+package JSON::Backend::PP;
+
+sub init {
+ local $^W;
+ no strict qw(refs); # this routine may be called after JSON::Backend::XS init was called.
+ *{"JSON::decode_json"} = \&{"JSON::PP::decode_json"};
+ *{"JSON::encode_json"} = \&{"JSON::PP::encode_json"};
+ *{"JSON::PP::is_xs"} = sub { 0 };
+ *{"JSON::PP::is_pp"} = sub { 1 };
+ return 1;
+}
+
+#
+# To save memory, the below lines are read only when XS backend is used.
+#
+
+package JSON;
+
+1;
+__DATA__
+
+
+#
+# Helper classes for Backend Module (XS)
+#
+
+package JSON::Backend::XS;
+
+use constant INDENT_LENGTH_FLAG => 15 << 12;
+
+use constant UNSUPPORTED_ENCODE_FLAG => {
+ ESCAPE_SLASH => 0x00000010,
+ ALLOW_BIGNUM => 0x00000020,
+ AS_NONBLESSED => 0x00000040,
+ EXPANDED => 0x10000000, # for developer's
+};
+
+use constant UNSUPPORTED_DECODE_FLAG => {
+ LOOSE => 0x00000001,
+ ALLOW_BIGNUM => 0x00000002,
+ ALLOW_BAREKEY => 0x00000004,
+ ALLOW_SINGLEQUOTE => 0x00000008,
+ EXPANDED => 0x20000000, # for developer's
+};
+
+
+sub init {
+ local $^W;
+ no strict qw(refs);
+ *{"JSON::decode_json"} = \&{"JSON::XS::decode_json"};
+ *{"JSON::encode_json"} = \&{"JSON::XS::encode_json"};
+ *{"JSON::XS::is_xs"} = sub { 1 };
+ *{"JSON::XS::is_pp"} = sub { 0 };
+ return 1;
+}
+
+
+sub support_by_pp {
+ my ($class, @methods) = @_;
+
+ local $^W;
+ no strict qw(refs);
+
+ my $JSON_XS_encode_orignal = \&JSON::XS::encode;
+ my $JSON_XS_decode_orignal = \&JSON::XS::decode;
+ my $JSON_XS_incr_parse_orignal = \&JSON::XS::incr_parse;
+
+ *JSON::XS::decode = \&JSON::Backend::XS::Supportable::_decode;
+ *JSON::XS::encode = \&JSON::Backend::XS::Supportable::_encode;
+ *JSON::XS::incr_parse = \&JSON::Backend::XS::Supportable::_incr_parse;
+
+ *{JSON::XS::_original_decode} = $JSON_XS_decode_orignal;
+ *{JSON::XS::_original_encode} = $JSON_XS_encode_orignal;
+ *{JSON::XS::_original_incr_parse} = $JSON_XS_incr_parse_orignal;
+
+ push @JSON::Backend::XS::Supportable::ISA, 'JSON';
+
+ my $pkg = 'JSON::Backend::XS::Supportable';
+
+ *{JSON::new} = sub {
+ my $proto = new JSON::XS; $$proto = 0;
+ bless $proto, $pkg;
+ };
+
+
+ for my $method (@methods) {
+ my $flag = uc($method);
+ my $type |= (UNSUPPORTED_ENCODE_FLAG->{$flag} || 0);
+ $type |= (UNSUPPORTED_DECODE_FLAG->{$flag} || 0);
+
+ next unless($type);
+
+ $pkg->_make_unsupported_method($method => $type);
+ }
+
+ push @{"JSON::XS::Boolean::ISA"}, qw(JSON::PP::Boolean);
+ push @{"JSON::PP::Boolean::ISA"}, qw(JSON::Boolean);
+
+ $JSON::DEBUG and Carp::carp("set -support_by_pp mode.");
+
+ return 1;
+}
+
+
+
+
+#
+# Helper classes for XS
+#
+
+package JSON::Backend::XS::Supportable;
+
+$Carp::Internal{'JSON::Backend::XS::Supportable'} = 1;
+
+sub _make_unsupported_method {
+ my ($pkg, $method, $type) = @_;
+
+ local $^W;
+ no strict qw(refs);
+
+ *{"$pkg\::$method"} = sub {
+ local $^W;
+ if (defined $_[1] ? $_[1] : 1) {
+ ${$_[0]} |= $type;
+ }
+ else {
+ ${$_[0]} &= ~$type;
+ }
+ $_[0];
+ };
+
+ *{"$pkg\::get_$method"} = sub {
+ ${$_[0]} & $type ? 1 : '';
+ };
+
+}
+
+
+sub _set_for_pp {
+ JSON::_load_pp( $_INSTALL_ONLY );
+
+ my $type = shift;
+ my $pp = new JSON::PP;
+ my $prop = $_[0]->property;
+
+ for my $name (keys %$prop) {
+ $pp->$name( $prop->{$name} ? $prop->{$name} : 0 );
+ }
+
+ my $unsupported = $type eq 'encode' ? JSON::Backend::XS::UNSUPPORTED_ENCODE_FLAG
+ : JSON::Backend::XS::UNSUPPORTED_DECODE_FLAG;
+ my $flags = ${$_[0]} || 0;
+
+ for my $name (keys %$unsupported) {
+ next if ($name eq 'EXPANDED'); # for developer's
+ my $enable = ($flags & $unsupported->{$name}) ? 1 : 0;
+ my $method = lc $name;
+ $pp->$method($enable);
+ }
+
+ $pp->indent_length( $_[0]->get_indent_length );
+
+ return $pp;
+}
+
+sub _encode { # using with PP encod
+ if (${$_[0]}) {
+ _set_for_pp('encode' => @_)->encode($_[1]);
+ }
+ else {
+ $_[0]->_original_encode( $_[1] );
+ }
+}
+
+
+sub _decode { # if unsupported-flag is set, use PP
+ if (${$_[0]}) {
+ _set_for_pp('decode' => @_)->decode($_[1]);
+ }
+ else {
+ $_[0]->_original_decode( $_[1] );
+ }
+}
+
+
+sub decode_prefix { # if unsupported-flag is set, use PP
+ _set_for_pp('decode' => @_)->decode_prefix($_[1]);
+}
+
+
+sub _incr_parse {
+ if (${$_[0]}) {
+ _set_for_pp('decode' => @_)->incr_parse($_[1]);
+ }
+ else {
+ $_[0]->_original_incr_parse( $_[1] );
+ }
+}
+
+
+sub get_indent_length {
+ ${$_[0]} << 4 >> 16;
+}
+
+
+sub indent_length {
+ my $length = $_[1];
+
+ if (!defined $length or $length > 15 or $length < 0) {
+ Carp::carp "The acceptable range of indent_length() is 0 to 15.";
+ }
+ else {
+ local $^W;
+ $length <<= 12;
+ ${$_[0]} &= ~ JSON::Backend::XS::INDENT_LENGTH_FLAG;
+ ${$_[0]} |= $length;
+ *JSON::XS::encode = \&JSON::Backend::XS::Supportable::_encode;
+ }
+
+ $_[0];
+}
+
+
+1;
+__END__
+
+=head1 NAME
+
+JSON - JSON (JavaScript Object Notation) encoder/decoder
+
+=head1 SYNOPSIS
+
+ use JSON; # imports encode_json, decode_json, to_json and from_json.
+
+ # simple and fast interfaces (expect/generate UTF-8)
+
+ $utf8_encoded_json_text = encode_json $perl_hash_or_arrayref;
+ $perl_hash_or_arrayref = decode_json $utf8_encoded_json_text;
+
+ # OO-interface
+
+ $json = JSON->new->allow_nonref;
+
+ $json_text = $json->encode( $perl_scalar );
+ $perl_scalar = $json->decode( $json_text );
+
+ $pretty_printed = $json->pretty->encode( $perl_scalar ); # pretty-printing
+
+ # If you want to use PP only support features, call with '-support_by_pp'
+ # When XS unsupported feature is enable, using PP (de|en)code instead of XS ones.
+
+ use JSON -support_by_pp;
+
+ # option-acceptable interfaces (expect/generate UNICODE by default)
+
+ $json_text = to_json( $perl_scalar, { ascii => 1, pretty => 1 } );
+ $perl_scalar = from_json( $json_text, { utf8 => 1 } );
+
+ # Between (en|de)code_json and (to|from)_json, if you want to write
+ # a code which communicates to an outer world (encoded in UTF-8),
+ # recommend to use (en|de)code_json.
+
+=head1 VERSION
+
+ 2.53
+
+This version is compatible with JSON::XS B<2.27> and later.
+
+
+=head1 NOTE
+
+JSON::PP was inculded in C<JSON> distribution.
+It comes to be a perl core module in Perl 5.14.
+And L<JSON::PP> will be split away it.
+
+C<JSON> distribution will inculde yet another JSON::PP modules.
+They are JSNO::backportPP and so on. JSON.pm should work as it did at all.
+
+=head1 DESCRIPTION
+
+ ************************** CAUTION ********************************
+ * This is 'JSON module version 2' and there are many differences *
+ * to version 1.xx *
+ * Please check your applications useing old version. *
+ * See to 'INCOMPATIBLE CHANGES TO OLD VERSION' *
+ *******************************************************************
+
+JSON (JavaScript Object Notation) is a simple data format.
+See to L<http://www.json.org/> and C<RFC4627>(L<http://www.ietf.org/rfc/rfc4627.txt>).
+
+This module converts Perl data structures to JSON and vice versa using either
+L<JSON::XS> or L<JSON::PP>.
+
+JSON::XS is the fastest and most proper JSON module on CPAN which must be
+compiled and installed in your environment.
+JSON::PP is a pure-Perl module which is bundled in this distribution and
+has a strong compatibility to JSON::XS.
+
+This module try to use JSON::XS by default and fail to it, use JSON::PP instead.
+So its features completely depend on JSON::XS or JSON::PP.
+
+See to L<BACKEND MODULE DECISION>.
+
+To distinguish the module name 'JSON' and the format type JSON,
+the former is quoted by CE<lt>E<gt> (its results vary with your using media),
+and the latter is left just as it is.
+
+Module name : C<JSON>
+
+Format type : JSON
+
+=head2 FEATURES
+
+=over
+
+=item * correct unicode handling
+
+This module (i.e. backend modules) knows how to handle Unicode, documents
+how and when it does so, and even documents what "correct" means.
+
+Even though there are limitations, this feature is available since Perl version 5.6.
+
+JSON::XS requires Perl 5.8.2 (but works correctly in 5.8.8 or later), so in older versions
+C<JSON> sholud call JSON::PP as the backend which can be used since Perl 5.005.
+
+With Perl 5.8.x JSON::PP works, but from 5.8.0 to 5.8.2, because of a Perl side problem,
+JSON::PP works slower in the versions. And in 5.005, the Unicode handling is not available.
+See to L<JSON::PP/UNICODE HANDLING ON PERLS> for more information.
+
+See also to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL>
+and L<JSON::XS/ENCODING/CODESET_FLAG_NOTES>.
+
+
+=item * round-trip integrity
+
+When you serialise a perl data structure using only data types supported
+by JSON and Perl, the deserialised data structure is identical on the Perl
+level. (e.g. the string "2.0" doesn't suddenly become "2" just because
+it looks like a number). There I<are> minor exceptions to this, read the
+L</MAPPING> section below to learn about those.
+
+
+=item * strict checking of JSON correctness
+
+There is no guessing, no generating of illegal JSON texts by default,
+and only JSON is accepted as input by default (the latter is a security
+feature).
+
+See to L<JSON::XS/FEATURES> and L<JSON::PP/FEATURES>.
+
+=item * fast
+
+This module returns a JSON::XS object itself if available.
+Compared to other JSON modules and other serialisers such as Storable,
+JSON::XS usually compares favourably in terms of speed, too.
+
+If not available, C<JSON> returns a JSON::PP object instead of JSON::XS and
+it is very slow as pure-Perl.
+
+=item * simple to use
+
+This module has both a simple functional interface as well as an
+object oriented interface interface.
+
+=item * reasonably versatile output formats
+
+You can choose between the most compact guaranteed-single-line format possible
+(nice for simple line-based protocols), a pure-ASCII format (for when your transport
+is not 8-bit clean, still supports the whole Unicode range), or a pretty-printed
+format (for when you want to read that stuff). Or you can combine those features
+in whatever way you like.
+
+=back
+
+=head1 FUNCTIONAL INTERFACE
+
+Some documents are copied and modified from L<JSON::XS/FUNCTIONAL INTERFACE>.
+C<to_json> and C<from_json> are additional functions.
+
+=head2 encode_json
+
+ $json_text = encode_json $perl_scalar
+
+Converts the given Perl data structure to a UTF-8 encoded, binary string.
+
+This function call is functionally identical to:
+
+ $json_text = JSON->new->utf8->encode($perl_scalar)
+
+=head2 decode_json
+
+ $perl_scalar = decode_json $json_text
+
+The opposite of C<encode_json>: expects an UTF-8 (binary) string and tries
+to parse that as an UTF-8 encoded JSON text, returning the resulting
+reference.
+
+This function call is functionally identical to:
+
+ $perl_scalar = JSON->new->utf8->decode($json_text)
+
+
+=head2 to_json
+
+ $json_text = to_json($perl_scalar)
+
+Converts the given Perl data structure to a json string.
+
+This function call is functionally identical to:
+
+ $json_text = JSON->new->encode($perl_scalar)
+
+Takes a hash reference as the second.
+
+ $json_text = to_json($perl_scalar, $flag_hashref)
+
+So,
+
+ $json_text = to_json($perl_scalar, {utf8 => 1, pretty => 1})
+
+equivalent to:
+
+ $json_text = JSON->new->utf8(1)->pretty(1)->encode($perl_scalar)
+
+If you want to write a modern perl code which communicates to outer world,
+you should use C<encode_json> (supposed that JSON data are encoded in UTF-8).
+
+=head2 from_json
+
+ $perl_scalar = from_json($json_text)
+
+The opposite of C<to_json>: expects a json string and tries
+to parse it, returning the resulting reference.
+
+This function call is functionally identical to:
+
+ $perl_scalar = JSON->decode($json_text)
+
+Takes a hash reference as the second.
+
+ $perl_scalar = from_json($json_text, $flag_hashref)
+
+So,
+
+ $perl_scalar = from_json($json_text, {utf8 => 1})
+
+equivalent to:
+
+ $perl_scalar = JSON->new->utf8(1)->decode($json_text)
+
+If you want to write a modern perl code which communicates to outer world,
+you should use C<decode_json> (supposed that JSON data are encoded in UTF-8).
+
+=head2 JSON::is_bool
+
+ $is_boolean = JSON::is_bool($scalar)
+
+Returns true if the passed scalar represents either JSON::true or
+JSON::false, two constants that act like C<1> and C<0> respectively
+and are also used to represent JSON C<true> and C<false> in Perl strings.
+
+=head2 JSON::true
+
+Returns JSON true value which is blessed object.
+It C<isa> JSON::Boolean object.
+
+=head2 JSON::false
+
+Returns JSON false value which is blessed object.
+It C<isa> JSON::Boolean object.
+
+=head2 JSON::null
+
+Returns C<undef>.
+
+See L<MAPPING>, below, for more information on how JSON values are mapped to
+Perl.
+
+=head1 HOW DO I DECODE A DATA FROM OUTER AND ENCODE TO OUTER
+
+This section supposes that your perl vresion is 5.8 or later.
+
+If you know a JSON text from an outer world - a network, a file content, and so on,
+is encoded in UTF-8, you should use C<decode_json> or C<JSON> module object
+with C<utf8> enable. And the decoded result will contain UNICODE characters.
+
+ # from network
+ my $json = JSON->new->utf8;
+ my $json_text = CGI->new->param( 'json_data' );
+ my $perl_scalar = $json->decode( $json_text );
+
+ # from file content
+ local $/;
+ open( my $fh, '<', 'json.data' );
+ $json_text = <$fh>;
+ $perl_scalar = decode_json( $json_text );
+
+If an outer data is not encoded in UTF-8, firstly you should C<decode> it.
+
+ use Encode;
+ local $/;
+ open( my $fh, '<', 'json.data' );
+ my $encoding = 'cp932';
+ my $unicode_json_text = decode( $encoding, <$fh> ); # UNICODE
+
+ # or you can write the below code.
+ #
+ # open( my $fh, "<:encoding($encoding)", 'json.data' );
+ # $unicode_json_text = <$fh>;
+
+In this case, C<$unicode_json_text> is of course UNICODE string.
+So you B<cannot> use C<decode_json> nor C<JSON> module object with C<utf8> enable.
+Instead of them, you use C<JSON> module object with C<utf8> disable or C<from_json>.
+
+ $perl_scalar = $json->utf8(0)->decode( $unicode_json_text );
+ # or
+ $perl_scalar = from_json( $unicode_json_text );
+
+Or C<encode 'utf8'> and C<decode_json>:
+
+ $perl_scalar = decode_json( encode( 'utf8', $unicode_json_text ) );
+ # this way is not efficient.
+
+And now, you want to convert your C<$perl_scalar> into JSON data and
+send it to an outer world - a network or a file content, and so on.
+
+Your data usually contains UNICODE strings and you want the converted data to be encoded
+in UTF-8, you should use C<encode_json> or C<JSON> module object with C<utf8> enable.
+
+ print encode_json( $perl_scalar ); # to a network? file? or display?
+ # or
+ print $json->utf8->encode( $perl_scalar );
+
+If C<$perl_scalar> does not contain UNICODE but C<$encoding>-encoded strings
+for some reason, then its characters are regarded as B<latin1> for perl
+(because it does not concern with your $encoding).
+You B<cannot> use C<encode_json> nor C<JSON> module object with C<utf8> enable.
+Instead of them, you use C<JSON> module object with C<utf8> disable or C<to_json>.
+Note that the resulted text is a UNICODE string but no problem to print it.
+
+ # $perl_scalar contains $encoding encoded string values
+ $unicode_json_text = $json->utf8(0)->encode( $perl_scalar );
+ # or
+ $unicode_json_text = to_json( $perl_scalar );
+ # $unicode_json_text consists of characters less than 0x100
+ print $unicode_json_text;
+
+Or C<decode $encoding> all string values and C<encode_json>:
+
+ $perl_scalar->{ foo } = decode( $encoding, $perl_scalar->{ foo } );
+ # ... do it to each string values, then encode_json
+ $json_text = encode_json( $perl_scalar );
+
+This method is a proper way but probably not efficient.
+
+See to L<Encode>, L<perluniintro>.
+
+
+=head1 COMMON OBJECT-ORIENTED INTERFACE
+
+=head2 new
+
+ $json = new JSON
+
+Returns a new C<JSON> object inherited from either JSON::XS or JSON::PP
+that can be used to de/encode JSON strings.
+
+All boolean flags described below are by default I<disabled>.
+
+The mutators for flags all return the JSON object again and thus calls can
+be chained:
+
+ my $json = JSON->new->utf8->space_after->encode({a => [1,2]})
+ => {"a": [1, 2]}
+
+=head2 ascii
+
+ $json = $json->ascii([$enable])
+
+ $enabled = $json->get_ascii
+
+If $enable is true (or missing), then the encode method will not generate characters outside
+the code range 0..127. Any Unicode characters outside that range will be escaped using either
+a single \uXXXX or a double \uHHHH\uLLLLL escape sequence, as per RFC4627.
+
+If $enable is false, then the encode method will not escape Unicode characters unless
+required by the JSON syntax or other flags. This results in a faster and more compact format.
+
+This feature depends on the used Perl version and environment.
+
+See to L<JSON::PP/UNICODE HANDLING ON PERLS> if the backend is PP.
+
+ JSON->new->ascii(1)->encode([chr 0x10401])
+ => ["\ud801\udc01"]
+
+=head2 latin1
+
+ $json = $json->latin1([$enable])
+
+ $enabled = $json->get_latin1
+
+If $enable is true (or missing), then the encode method will encode the resulting JSON
+text as latin1 (or iso-8859-1), escaping any characters outside the code range 0..255.
+
+If $enable is false, then the encode method will not escape Unicode characters
+unless required by the JSON syntax or other flags.
+
+ JSON->new->latin1->encode (["\x{89}\x{abc}"]
+ => ["\x{89}\\u0abc"] # (perl syntax, U+abc escaped, U+89 not)
+
+=head2 utf8
+
+ $json = $json->utf8([$enable])
+
+ $enabled = $json->get_utf8
+
+If $enable is true (or missing), then the encode method will encode the JSON result
+into UTF-8, as required by many protocols, while the decode method expects to be handled
+an UTF-8-encoded string. Please note that UTF-8-encoded strings do not contain any
+characters outside the range 0..255, they are thus useful for bytewise/binary I/O.
+
+In future versions, enabling this option might enable autodetection of the UTF-16 and UTF-32
+encoding families, as described in RFC4627.
+
+If $enable is false, then the encode method will return the JSON string as a (non-encoded)
+Unicode string, while decode expects thus a Unicode string. Any decoding or encoding
+(e.g. to UTF-8 or UTF-16) needs to be done yourself, e.g. using the Encode module.
+
+
+Example, output UTF-16BE-encoded JSON:
+
+ use Encode;
+ $jsontext = encode "UTF-16BE", JSON::XS->new->encode ($object);
+
+Example, decode UTF-32LE-encoded JSON:
+
+ use Encode;
+ $object = JSON::XS->new->decode (decode "UTF-32LE", $jsontext);
+
+See to L<JSON::PP/UNICODE HANDLING ON PERLS> if the backend is PP.
+
+
+=head2 pretty
+
+ $json = $json->pretty([$enable])
+
+This enables (or disables) all of the C<indent>, C<space_before> and
+C<space_after> (and in the future possibly more) flags in one call to
+generate the most readable (or most compact) form possible.
+
+Equivalent to:
+
+ $json->indent->space_before->space_after
+
+The indent space length is three and JSON::XS cannot change the indent
+space length.
+
+=head2 indent
+
+ $json = $json->indent([$enable])
+
+ $enabled = $json->get_indent
+
+If C<$enable> is true (or missing), then the C<encode> method will use a multiline
+format as output, putting every array member or object/hash key-value pair
+into its own line, identing them properly.
+
+If C<$enable> is false, no newlines or indenting will be produced, and the
+resulting JSON text is guarenteed not to contain any C<newlines>.
+
+This setting has no effect when decoding JSON texts.
+
+The indent space length is three.
+With JSON::PP, you can also access C<indent_length> to change indent space length.
+
+
+=head2 space_before
+
+ $json = $json->space_before([$enable])
+
+ $enabled = $json->get_space_before
+
+If C<$enable> is true (or missing), then the C<encode> method will add an extra
+optional space before the C<:> separating keys from values in JSON objects.
+
+If C<$enable> is false, then the C<encode> method will not add any extra
+space at those places.
+
+This setting has no effect when decoding JSON texts.
+
+Example, space_before enabled, space_after and indent disabled:
+
+ {"key" :"value"}
+
+
+=head2 space_after
+
+ $json = $json->space_after([$enable])
+
+ $enabled = $json->get_space_after
+
+If C<$enable> is true (or missing), then the C<encode> method will add an extra
+optional space after the C<:> separating keys from values in JSON objects
+and extra whitespace after the C<,> separating key-value pairs and array
+members.
+
+If C<$enable> is false, then the C<encode> method will not add any extra
+space at those places.
+
+This setting has no effect when decoding JSON texts.
+
+Example, space_before and indent disabled, space_after enabled:
+
+ {"key": "value"}
+
+
+=head2 relaxed
+
+ $json = $json->relaxed([$enable])
+
+ $enabled = $json->get_relaxed
+
+If C<$enable> is true (or missing), then C<decode> will accept some
+extensions to normal JSON syntax (see below). C<encode> will not be
+affected in anyway. I<Be aware that this option makes you accept invalid
+JSON texts as if they were valid!>. I suggest only to use this option to
+parse application-specific files written by humans (configuration files,
+resource files etc.)
+
+If C<$enable> is false (the default), then C<decode> will only accept
+valid JSON texts.
+
+Currently accepted extensions are:
+
+=over 4
+
+=item * list items can have an end-comma
+
+JSON I<separates> array elements and key-value pairs with commas. This
+can be annoying if you write JSON texts manually and want to be able to
+quickly append elements, so this extension accepts comma at the end of
+such items not just between them:
+
+ [
+ 1,
+ 2, <- this comma not normally allowed
+ ]
+ {
+ "k1": "v1",
+ "k2": "v2", <- this comma not normally allowed
+ }
+
+=item * shell-style '#'-comments
+
+Whenever JSON allows whitespace, shell-style comments are additionally
+allowed. They are terminated by the first carriage-return or line-feed
+character, after which more white-space and comments are allowed.
+
+ [
+ 1, # this comment not allowed in JSON
+ # neither this one...
+ ]
+
+=back
+
+
+=head2 canonical
+
+ $json = $json->canonical([$enable])
+
+ $enabled = $json->get_canonical
+
+If C<$enable> is true (or missing), then the C<encode> method will output JSON objects
+by sorting their keys. This is adding a comparatively high overhead.
+
+If C<$enable> is false, then the C<encode> method will output key-value
+pairs in the order Perl stores them (which will likely change between runs
+of the same script).
+
+This option is useful if you want the same data structure to be encoded as
+the same JSON text (given the same overall settings). If it is disabled,
+the same hash might be encoded differently even if contains the same data,
+as key-value pairs have no inherent ordering in Perl.
+
+This setting has no effect when decoding JSON texts.
+
+=head2 allow_nonref
+
+ $json = $json->allow_nonref([$enable])
+
+ $enabled = $json->get_allow_nonref
+
+If C<$enable> is true (or missing), then the C<encode> method can convert a
+non-reference into its corresponding string, number or null JSON value,
+which is an extension to RFC4627. Likewise, C<decode> will accept those JSON
+values instead of croaking.
+
+If C<$enable> is false, then the C<encode> method will croak if it isn't
+passed an arrayref or hashref, as JSON texts must either be an object
+or array. Likewise, C<decode> will croak if given something that is not a
+JSON object or array.
+
+ JSON->new->allow_nonref->encode ("Hello, World!")
+ => "Hello, World!"
+
+=head2 allow_unknown
+
+ $json = $json->allow_unknown ([$enable])
+
+ $enabled = $json->get_allow_unknown
+
+If $enable is true (or missing), then "encode" will *not* throw an
+exception when it encounters values it cannot represent in JSON (for
+example, filehandles) but instead will encode a JSON "null" value.
+Note that blessed objects are not included here and are handled
+separately by c<allow_nonref>.
+
+If $enable is false (the default), then "encode" will throw an
+exception when it encounters anything it cannot encode as JSON.
+
+This option does not affect "decode" in any way, and it is
+recommended to leave it off unless you know your communications
+partner.
+
+=head2 allow_blessed
+
+ $json = $json->allow_blessed([$enable])
+
+ $enabled = $json->get_allow_blessed
+
+If C<$enable> is true (or missing), then the C<encode> method will not
+barf when it encounters a blessed reference. Instead, the value of the
+B<convert_blessed> option will decide whether C<null> (C<convert_blessed>
+disabled or no C<TO_JSON> method found) or a representation of the
+object (C<convert_blessed> enabled and C<TO_JSON> method found) is being
+encoded. Has no effect on C<decode>.
+
+If C<$enable> is false (the default), then C<encode> will throw an
+exception when it encounters a blessed object.
+
+
+=head2 convert_blessed
+
+ $json = $json->convert_blessed([$enable])
+
+ $enabled = $json->get_convert_blessed
+
+If C<$enable> is true (or missing), then C<encode>, upon encountering a
+blessed object, will check for the availability of the C<TO_JSON> method
+on the object's class. If found, it will be called in scalar context
+and the resulting scalar will be encoded instead of the object. If no
+C<TO_JSON> method is found, the value of C<allow_blessed> will decide what
+to do.
+
+The C<TO_JSON> method may safely call die if it wants. If C<TO_JSON>
+returns other blessed objects, those will be handled in the same
+way. C<TO_JSON> must take care of not causing an endless recursion cycle
+(== crash) in this case. The name of C<TO_JSON> was chosen because other
+methods called by the Perl core (== not by the user of the object) are
+usually in upper case letters and to avoid collisions with the C<to_json>
+function or method.
+
+This setting does not yet influence C<decode> in any way.
+
+If C<$enable> is false, then the C<allow_blessed> setting will decide what
+to do when a blessed object is found.
+
+=over
+
+=item convert_blessed_universally mode
+
+If use C<JSON> with C<-convert_blessed_universally>, the C<UNIVERSAL::TO_JSON>
+subroutine is defined as the below code:
+
+ *UNIVERSAL::TO_JSON = sub {
+ my $b_obj = B::svref_2object( $_[0] );
+ return $b_obj->isa('B::HV') ? { %{ $_[0] } }
+ : $b_obj->isa('B::AV') ? [ @{ $_[0] } ]
+ : undef
+ ;
+ }
+
+This will cause that C<encode> method converts simple blessed objects into
+JSON objects as non-blessed object.
+
+ JSON -convert_blessed_universally;
+ $json->allow_blessed->convert_blessed->encode( $blessed_object )
+
+This feature is experimental and may be removed in the future.
+
+=back
+
+=head2 filter_json_object
+
+ $json = $json->filter_json_object([$coderef])
+
+When C<$coderef> is specified, it will be called from C<decode> each
+time it decodes a JSON object. The only argument passed to the coderef
+is a reference to the newly-created hash. If the code references returns
+a single scalar (which need not be a reference), this value
+(i.e. a copy of that scalar to avoid aliasing) is inserted into the
+deserialised data structure. If it returns an empty list
+(NOTE: I<not> C<undef>, which is a valid scalar), the original deserialised
+hash will be inserted. This setting can slow down decoding considerably.
+
+When C<$coderef> is omitted or undefined, any existing callback will
+be removed and C<decode> will not change the deserialised hash in any
+way.
+
+Example, convert all JSON objects into the integer 5:
+
+ my $js = JSON->new->filter_json_object (sub { 5 });
+ # returns [5]
+ $js->decode ('[{}]'); # the given subroutine takes a hash reference.
+ # throw an exception because allow_nonref is not enabled
+ # so a lone 5 is not allowed.
+ $js->decode ('{"a":1, "b":2}');
+
+
+=head2 filter_json_single_key_object
+
+ $json = $json->filter_json_single_key_object($key [=> $coderef])
+
+Works remotely similar to C<filter_json_object>, but is only called for
+JSON objects having a single key named C<$key>.
+
+This C<$coderef> is called before the one specified via
+C<filter_json_object>, if any. It gets passed the single value in the JSON
+object. If it returns a single value, it will be inserted into the data
+structure. If it returns nothing (not even C<undef> but the empty list),
+the callback from C<filter_json_object> will be called next, as if no
+single-key callback were specified.
+
+If C<$coderef> is omitted or undefined, the corresponding callback will be
+disabled. There can only ever be one callback for a given key.
+
+As this callback gets called less often then the C<filter_json_object>
+one, decoding speed will not usually suffer as much. Therefore, single-key
+objects make excellent targets to serialise Perl objects into, especially
+as single-key JSON objects are as close to the type-tagged value concept
+as JSON gets (it's basically an ID/VALUE tuple). Of course, JSON does not
+support this in any way, so you need to make sure your data never looks
+like a serialised Perl hash.
+
+Typical names for the single object key are C<__class_whatever__>, or
+C<$__dollars_are_rarely_used__$> or C<}ugly_brace_placement>, or even
+things like C<__class_md5sum(classname)__>, to reduce the risk of clashing
+with real hashes.
+
+Example, decode JSON objects of the form C<< { "__widget__" => <id> } >>
+into the corresponding C<< $WIDGET{<id>} >> object:
+
+ # return whatever is in $WIDGET{5}:
+ JSON
+ ->new
+ ->filter_json_single_key_object (__widget__ => sub {
+ $WIDGET{ $_[0] }
+ })
+ ->decode ('{"__widget__": 5')
+
+ # this can be used with a TO_JSON method in some "widget" class
+ # for serialisation to json:
+ sub WidgetBase::TO_JSON {
+ my ($self) = @_;
+
+ unless ($self->{id}) {
+ $self->{id} = ..get..some..id..;
+ $WIDGET{$self->{id}} = $self;
+ }
+
+ { __widget__ => $self->{id} }
+ }
+
+
+=head2 shrink
+
+ $json = $json->shrink([$enable])
+
+ $enabled = $json->get_shrink
+
+With JSON::XS, this flag resizes strings generated by either
+C<encode> or C<decode> to their minimum size possible. This can save
+memory when your JSON texts are either very very long or you have many
+short strings. It will also try to downgrade any strings to octet-form
+if possible: perl stores strings internally either in an encoding called
+UTF-X or in octet-form. The latter cannot store everything but uses less
+space in general (and some buggy Perl or C code might even rely on that
+internal representation being used).
+
+With JSON::PP, it is noop about resizing strings but tries
+C<utf8::downgrade> to the returned string by C<encode>. See to L<utf8>.
+
+See to L<JSON::XS/OBJECT-ORIENTED INTERFACE> and L<JSON::PP/METHODS>.
+
+=head2 max_depth
+
+ $json = $json->max_depth([$maximum_nesting_depth])
+
+ $max_depth = $json->get_max_depth
+
+Sets the maximum nesting level (default C<512>) accepted while encoding
+or decoding. If a higher nesting level is detected in JSON text or a Perl
+data structure, then the encoder and decoder will stop and croak at that
+point.
+
+Nesting level is defined by number of hash- or arrayrefs that the encoder
+needs to traverse to reach a given point or the number of C<{> or C<[>
+characters without their matching closing parenthesis crossed to reach a
+given character in a string.
+
+If no argument is given, the highest possible setting will be used, which
+is rarely useful.
+
+Note that nesting is implemented by recursion in C. The default value has
+been chosen to be as large as typical operating systems allow without
+crashing. (JSON::XS)
+
+With JSON::PP as the backend, when a large value (100 or more) was set and
+it de/encodes a deep nested object/text, it may raise a warning
+'Deep recursion on subroutin' at the perl runtime phase.
+
+See L<JSON::XS/SECURITY CONSIDERATIONS> for more info on why this is useful.
+
+=head2 max_size
+
+ $json = $json->max_size([$maximum_string_size])
+
+ $max_size = $json->get_max_size
+
+Set the maximum length a JSON text may have (in bytes) where decoding is
+being attempted. The default is C<0>, meaning no limit. When C<decode>
+is called on a string that is longer then this many bytes, it will not
+attempt to decode the string but throw an exception. This setting has no
+effect on C<encode> (yet).
+
+If no argument is given, the limit check will be deactivated (same as when
+C<0> is specified).
+
+See L<JSON::XS/SECURITY CONSIDERATIONS>, below, for more info on why this is useful.
+
+=head2 encode
+
+ $json_text = $json->encode($perl_scalar)
+
+Converts the given Perl data structure (a simple scalar or a reference
+to a hash or array) to its JSON representation. Simple scalars will be
+converted into JSON string or number sequences, while references to arrays
+become JSON arrays and references to hashes become JSON objects. Undefined
+Perl values (e.g. C<undef>) become JSON C<null> values.
+References to the integers C<0> and C<1> are converted into C<true> and C<false>.
+
+=head2 decode
+
+ $perl_scalar = $json->decode($json_text)
+
+The opposite of C<encode>: expects a JSON text and tries to parse it,
+returning the resulting simple scalar or reference. Croaks on error.
+
+JSON numbers and strings become simple Perl scalars. JSON arrays become
+Perl arrayrefs and JSON objects become Perl hashrefs. C<true> becomes
+C<1> (C<JSON::true>), C<false> becomes C<0> (C<JSON::false>) and
+C<null> becomes C<undef>.
+
+=head2 decode_prefix
+
+ ($perl_scalar, $characters) = $json->decode_prefix($json_text)
+
+This works like the C<decode> method, but instead of raising an exception
+when there is trailing garbage after the first JSON object, it will
+silently stop parsing there and return the number of characters consumed
+so far.
+
+ JSON->new->decode_prefix ("[1] the tail")
+ => ([], 3)
+
+See to L<JSON::XS/OBJECT-ORIENTED INTERFACE>
+
+=head2 property
+
+ $boolean = $json->property($property_name)
+
+Returns a boolean value about above some properties.
+
+The available properties are C<ascii>, C<latin1>, C<utf8>,
+C<indent>,C<space_before>, C<space_after>, C<relaxed>, C<canonical>,
+C<allow_nonref>, C<allow_unknown>, C<allow_blessed>, C<convert_blessed>,
+C<shrink>, C<max_depth> and C<max_size>.
+
+ $boolean = $json->property('utf8');
+ => 0
+ $json->utf8;
+ $boolean = $json->property('utf8');
+ => 1
+
+Sets the property with a given boolean value.
+
+ $json = $json->property($property_name => $boolean);
+
+With no argumnt, it returns all the above properties as a hash reference.
+
+ $flag_hashref = $json->property();
+
+=head1 INCREMENTAL PARSING
+
+Most of this section are copied and modified from L<JSON::XS/INCREMENTAL PARSING>.
+
+In some cases, there is the need for incremental parsing of JSON texts.
+This module does allow you to parse a JSON stream incrementally.
+It does so by accumulating text until it has a full JSON object, which
+it then can decode. This process is similar to using C<decode_prefix>
+to see if a full JSON object is available, but is much more efficient
+(and can be implemented with a minimum of method calls).
+
+The backend module will only attempt to parse the JSON text once it is sure it
+has enough text to get a decisive result, using a very simple but
+truly incremental parser. This means that it sometimes won't stop as
+early as the full parser, for example, it doesn't detect parenthese
+mismatches. The only thing it guarantees is that it starts decoding as
+soon as a syntactically valid JSON text has been seen. This means you need
+to set resource limits (e.g. C<max_size>) to ensure the parser will stop
+parsing in the presence if syntax errors.
+
+The following methods implement this incremental parser.
+
+=head2 incr_parse
+
+ $json->incr_parse( [$string] ) # void context
+
+ $obj_or_undef = $json->incr_parse( [$string] ) # scalar context
+
+ @obj_or_empty = $json->incr_parse( [$string] ) # list context
+
+This is the central parsing function. It can both append new text and
+extract objects from the stream accumulated so far (both of these
+functions are optional).
+
+If C<$string> is given, then this string is appended to the already
+existing JSON fragment stored in the C<$json> object.
+
+After that, if the function is called in void context, it will simply
+return without doing anything further. This can be used to add more text
+in as many chunks as you want.
+
+If the method is called in scalar context, then it will try to extract
+exactly I<one> JSON object. If that is successful, it will return this
+object, otherwise it will return C<undef>. If there is a parse error,
+this method will croak just as C<decode> would do (one can then use
+C<incr_skip> to skip the errornous part). This is the most common way of
+using the method.
+
+And finally, in list context, it will try to extract as many objects
+from the stream as it can find and return them, or the empty list
+otherwise. For this to work, there must be no separators between the JSON
+objects or arrays, instead they must be concatenated back-to-back. If
+an error occurs, an exception will be raised as in the scalar context
+case. Note that in this case, any previously-parsed JSON texts will be
+lost.
+
+Example: Parse some JSON arrays/objects in a given string and return them.
+
+ my @objs = JSON->new->incr_parse ("[5][7][1,2]");
+
+=head2 incr_text
+
+ $lvalue_string = $json->incr_text
+
+This method returns the currently stored JSON fragment as an lvalue, that
+is, you can manipulate it. This I<only> works when a preceding call to
+C<incr_parse> in I<scalar context> successfully returned an object. Under
+all other circumstances you must not call this function (I mean it.
+although in simple tests it might actually work, it I<will> fail under
+real world conditions). As a special exception, you can also call this
+method before having parsed anything.
+
+This function is useful in two cases: a) finding the trailing text after a
+JSON object or b) parsing multiple JSON objects separated by non-JSON text
+(such as commas).
+
+ $json->incr_text =~ s/\s*,\s*//;
+
+In Perl 5.005, C<lvalue> attribute is not available.
+You must write codes like the below:
+
+ $string = $json->incr_text;
+ $string =~ s/\s*,\s*//;
+ $json->incr_text( $string );
+
+=head2 incr_skip
+
+ $json->incr_skip
+
+This will reset the state of the incremental parser and will remove the
+parsed text from the input buffer. This is useful after C<incr_parse>
+died, in which case the input buffer and incremental parser state is left
+unchanged, to skip the text parsed so far and to reset the parse state.
+
+=head2 incr_reset
+
+ $json->incr_reset
+
+This completely resets the incremental parser, that is, after this call,
+it will be as if the parser had never parsed anything.
+
+This is useful if you want ot repeatedly parse JSON objects and want to
+ignore any trailing data, which means you have to reset the parser after
+each successful decode.
+
+See to L<JSON::XS/INCREMENTAL PARSING> for examples.
+
+
+=head1 JSON::PP SUPPORT METHODS
+
+The below methods are JSON::PP own methods, so when C<JSON> works
+with JSON::PP (i.e. the created object is a JSON::PP object), available.
+See to L<JSON::PP/JSON::PP OWN METHODS> in detail.
+
+If you use C<JSON> with additonal C<-support_by_pp>, some methods
+are available even with JSON::XS. See to L<USE PP FEATURES EVEN THOUGH XS BACKEND>.
+
+ BEING { $ENV{PERL_JSON_BACKEND} = 'JSON::XS' }
+
+ use JSON -support_by_pp;
+
+ my $json = new JSON;
+ $json->allow_nonref->escape_slash->encode("/");
+
+ # functional interfaces too.
+ print to_json(["/"], {escape_slash => 1});
+ print from_json('["foo"]', {utf8 => 1});
+
+If you do not want to all functions but C<-support_by_pp>,
+use C<-no_export>.
+
+ use JSON -support_by_pp, -no_export;
+ # functional interfaces are not exported.
+
+=head2 allow_singlequote
+
+ $json = $json->allow_singlequote([$enable])
+
+If C<$enable> is true (or missing), then C<decode> will accept
+any JSON strings quoted by single quotations that are invalid JSON
+format.
+
+ $json->allow_singlequote->decode({"foo":'bar'});
+ $json->allow_singlequote->decode({'foo':"bar"});
+ $json->allow_singlequote->decode({'foo':'bar'});
+
+As same as the C<relaxed> option, this option may be used to parse
+application-specific files written by humans.
+
+=head2 allow_barekey
+
+ $json = $json->allow_barekey([$enable])
+
+If C<$enable> is true (or missing), then C<decode> will accept
+bare keys of JSON object that are invalid JSON format.
+
+As same as the C<relaxed> option, this option may be used to parse
+application-specific files written by humans.
+
+ $json->allow_barekey->decode('{foo:"bar"}');
+
+=head2 allow_bignum
+
+ $json = $json->allow_bignum([$enable])
+
+If C<$enable> is true (or missing), then C<decode> will convert
+the big integer Perl cannot handle as integer into a L<Math::BigInt>
+object and convert a floating number (any) into a L<Math::BigFloat>.
+
+On the contary, C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat>
+objects into JSON numbers with C<allow_blessed> enable.
+
+ $json->allow_nonref->allow_blessed->allow_bignum;
+ $bigfloat = $json->decode('2.000000000000000000000000001');
+ print $json->encode($bigfloat);
+ # => 2.000000000000000000000000001
+
+See to L<MAPPING> aboout the conversion of JSON number.
+
+=head2 loose
+
+ $json = $json->loose([$enable])
+
+The unescaped [\x00-\x1f\x22\x2f\x5c] strings are invalid in JSON strings
+and the module doesn't allow to C<decode> to these (except for \x2f).
+If C<$enable> is true (or missing), then C<decode> will accept these
+unescaped strings.
+
+ $json->loose->decode(qq|["abc
+ def"]|);
+
+See to L<JSON::PP/JSON::PP OWN METHODS>.
+
+=head2 escape_slash
+
+ $json = $json->escape_slash([$enable])
+
+According to JSON Grammar, I<slash> (U+002F) is escaped. But by default
+JSON backend modules encode strings without escaping slash.
+
+If C<$enable> is true (or missing), then C<encode> will escape slashes.
+
+=head2 indent_length
+
+ $json = $json->indent_length($length)
+
+With JSON::XS, The indent space length is 3 and cannot be changed.
+With JSON::PP, it sets the indent space length with the given $length.
+The default is 3. The acceptable range is 0 to 15.
+
+=head2 sort_by
+
+ $json = $json->sort_by($function_name)
+ $json = $json->sort_by($subroutine_ref)
+
+If $function_name or $subroutine_ref are set, its sort routine are used.
+
+ $js = $pc->sort_by(sub { $JSON::PP::a cmp $JSON::PP::b })->encode($obj);
+ # is($js, q|{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9}|);
+
+ $js = $pc->sort_by('own_sort')->encode($obj);
+ # is($js, q|{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9}|);
+
+ sub JSON::PP::own_sort { $JSON::PP::a cmp $JSON::PP::b }
+
+As the sorting routine runs in the JSON::PP scope, the given
+subroutine name and the special variables C<$a>, C<$b> will begin
+with 'JSON::PP::'.
+
+If $integer is set, then the effect is same as C<canonical> on.
+
+See to L<JSON::PP/JSON::PP OWN METHODS>.
+
+=head1 MAPPING
+
+This section is copied from JSON::XS and modified to C<JSON>.
+JSON::XS and JSON::PP mapping mechanisms are almost equivalent.
+
+See to L<JSON::XS/MAPPING>.
+
+=head2 JSON -> PERL
+
+=over 4
+
+=item object
+
+A JSON object becomes a reference to a hash in Perl. No ordering of object
+keys is preserved (JSON does not preserver object key ordering itself).
+
+=item array
+
+A JSON array becomes a reference to an array in Perl.
+
+=item string
+
+A JSON string becomes a string scalar in Perl - Unicode codepoints in JSON
+are represented by the same codepoints in the Perl string, so no manual
+decoding is necessary.
+
+=item number
+
+A JSON number becomes either an integer, numeric (floating point) or
+string scalar in perl, depending on its range and any fractional parts. On
+the Perl level, there is no difference between those as Perl handles all
+the conversion details, but an integer may take slightly less memory and
+might represent more values exactly than floating point numbers.
+
+If the number consists of digits only, C<JSON> will try to represent
+it as an integer value. If that fails, it will try to represent it as
+a numeric (floating point) value if that is possible without loss of
+precision. Otherwise it will preserve the number as a string value (in
+which case you lose roundtripping ability, as the JSON number will be
+re-encoded toa JSON string).
+
+Numbers containing a fractional or exponential part will always be
+represented as numeric (floating point) values, possibly at a loss of
+precision (in which case you might lose perfect roundtripping ability, but
+the JSON number will still be re-encoded as a JSON number).
+
+Note that precision is not accuracy - binary floating point values cannot
+represent most decimal fractions exactly, and when converting from and to
+floating point, C<JSON> only guarantees precision up to but not including
+the leats significant bit.
+
+If the backend is JSON::PP and C<allow_bignum> is enable, the big integers
+and the numeric can be optionally converted into L<Math::BigInt> and
+L<Math::BigFloat> objects.
+
+=item true, false
+
+These JSON atoms become C<JSON::true> and C<JSON::false>,
+respectively. They are overloaded to act almost exactly like the numbers
+C<1> and C<0>. You can check wether a scalar is a JSON boolean by using
+the C<JSON::is_bool> function.
+
+If C<JSON::true> and C<JSON::false> are used as strings or compared as strings,
+they represent as C<true> and C<false> respectively.
+
+ print JSON::true . "\n";
+ => true
+ print JSON::true + 1;
+ => 1
+
+ ok(JSON::true eq 'true');
+ ok(JSON::true eq '1');
+ ok(JSON::true == 1);
+
+C<JSON> will install these missing overloading features to the backend modules.
+
+
+=item null
+
+A JSON null atom becomes C<undef> in Perl.
+
+C<JSON::null> returns C<unddef>.
+
+=back
+
+
+=head2 PERL -> JSON
+
+The mapping from Perl to JSON is slightly more difficult, as Perl is a
+truly typeless language, so we can only guess which JSON type is meant by
+a Perl value.
+
+=over 4
+
+=item hash references
+
+Perl hash references become JSON objects. As there is no inherent ordering
+in hash keys (or JSON objects), they will usually be encoded in a
+pseudo-random order that can change between runs of the same program but
+stays generally the same within a single run of a program. C<JSON>
+optionally sort the hash keys (determined by the I<canonical> flag), so
+the same datastructure will serialise to the same JSON text (given same
+settings and version of JSON::XS), but this incurs a runtime overhead
+and is only rarely useful, e.g. when you want to compare some JSON text
+against another for equality.
+
+In future, the ordered object feature will be added to JSON::PP using C<tie> mechanism.
+
+
+=item array references
+
+Perl array references become JSON arrays.
+
+=item other references
+
+Other unblessed references are generally not allowed and will cause an
+exception to be thrown, except for references to the integers C<0> and
+C<1>, which get turned into C<false> and C<true> atoms in JSON. You can
+also use C<JSON::false> and C<JSON::true> to improve readability.
+
+ to_json [\0,JSON::true] # yields [false,true]
+
+=item JSON::true, JSON::false, JSON::null
+
+These special values become JSON true and JSON false values,
+respectively. You can also use C<\1> and C<\0> directly if you want.
+
+JSON::null returns C<undef>.
+
+=item blessed objects
+
+Blessed objects are not directly representable in JSON. See the
+C<allow_blessed> and C<convert_blessed> methods on various options on
+how to deal with this: basically, you can choose between throwing an
+exception, encoding the reference as if it weren't blessed, or provide
+your own serialiser method.
+
+With C<convert_blessed_universally> mode, C<encode> converts blessed
+hash references or blessed array references (contains other blessed references)
+into JSON members and arrays.
+
+ use JSON -convert_blessed_universally;
+ JSON->new->allow_blessed->convert_blessed->encode( $blessed_object );
+
+See to L<convert_blessed>.
+
+=item simple scalars
+
+Simple Perl scalars (any scalar that is not a reference) are the most
+difficult objects to encode: JSON::XS and JSON::PP will encode undefined scalars as
+JSON C<null> values, scalars that have last been used in a string context
+before encoding as JSON strings, and anything else as number value:
+
+ # dump as number
+ encode_json [2] # yields [2]
+ encode_json [-3.0e17] # yields [-3e+17]
+ my $value = 5; encode_json [$value] # yields [5]
+
+ # used as string, so dump as string
+ print $value;
+ encode_json [$value] # yields ["5"]
+
+ # undef becomes null
+ encode_json [undef] # yields [null]
+
+You can force the type to be a string by stringifying it:
+
+ my $x = 3.1; # some variable containing a number
+ "$x"; # stringified
+ $x .= ""; # another, more awkward way to stringify
+ print $x; # perl does it for you, too, quite often
+
+You can force the type to be a number by numifying it:
+
+ my $x = "3"; # some variable containing a string
+ $x += 0; # numify it, ensuring it will be dumped as a number
+ $x *= 1; # same thing, the choise is yours.
+
+You can not currently force the type in other, less obscure, ways.
+
+Note that numerical precision has the same meaning as under Perl (so
+binary to decimal conversion follows the same rules as in Perl, which
+can differ to other languages). Also, your perl interpreter might expose
+extensions to the floating point numbers of your platform, such as
+infinities or NaN's - these cannot be represented in JSON, and it is an
+error to pass those in.
+
+=item Big Number
+
+If the backend is JSON::PP and C<allow_bignum> is enable,
+C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat>
+objects into JSON numbers.
+
+
+=back
+
+=head1 JSON and ECMAscript
+
+See to L<JSON::XS/JSON and ECMAscript>.
+
+=head1 JSON and YAML
+
+JSON is not a subset of YAML.
+See to L<JSON::XS/JSON and YAML>.
+
+
+=head1 BACKEND MODULE DECISION
+
+When you use C<JSON>, C<JSON> tries to C<use> JSON::XS. If this call failed, it will
+C<uses> JSON::PP. The required JSON::XS version is I<2.2> or later.
+
+The C<JSON> constructor method returns an object inherited from the backend module,
+and JSON::XS object is a blessed scaler reference while JSON::PP is a blessed hash
+reference.
+
+So, your program should not depend on the backend module, especially
+returned objects should not be modified.
+
+ my $json = JSON->new; # XS or PP?
+ $json->{stash} = 'this is xs object'; # this code may raise an error!
+
+To check the backend module, there are some methods - C<backend>, C<is_pp> and C<is_xs>.
+
+ JSON->backend; # 'JSON::XS' or 'JSON::PP'
+
+ JSON->backend->is_pp: # 0 or 1
+
+ JSON->backend->is_xs: # 1 or 0
+
+ $json->is_xs; # 1 or 0
+
+ $json->is_pp; # 0 or 1
+
+
+If you set an enviornment variable C<PERL_JSON_BACKEND>, The calling action will be changed.
+
+=over
+
+=item PERL_JSON_BACKEND = 0 or PERL_JSON_BACKEND = 'JSON::PP'
+
+Always use JSON::PP
+
+=item PERL_JSON_BACKEND == 1 or PERL_JSON_BACKEND = 'JSON::XS,JSON::PP'
+
+(The default) Use compiled JSON::XS if it is properly compiled & installed,
+otherwise use JSON::PP.
+
+=item PERL_JSON_BACKEND == 2 or PERL_JSON_BACKEND = 'JSON::XS'
+
+Always use compiled JSON::XS, die if it isn't properly compiled & installed.
+
+=item PERL_JSON_BACKEND = 'JSON::backportPP'
+
+Always use JSON::backportPP.
+JSON::backportPP is JSON::PP back port module.
+C<JSON> includs JSON::backportPP instead of JSON::PP.
+
+=back
+
+These ideas come from L<DBI::PurePerl> mechanism.
+
+example:
+
+ BEGIN { $ENV{PERL_JSON_BACKEND} = 'JSON::PP' }
+ use JSON; # always uses JSON::PP
+
+In future, it may be able to specify another module.
+
+=head1 USE PP FEATURES EVEN THOUGH XS BACKEND
+
+Many methods are available with either JSON::XS or JSON::PP and
+when the backend module is JSON::XS, if any JSON::PP specific (i.e. JSON::XS unspported)
+method is called, it will C<warn> and be noop.
+
+But If you C<use> C<JSON> passing the optional string C<-support_by_pp>,
+it makes a part of those unupported methods available.
+This feature is achieved by using JSON::PP in C<de/encode>.
+
+ BEGIN { $ENV{PERL_JSON_BACKEND} = 2 } # with JSON::XS
+ use JSON -support_by_pp;
+ my $json = new JSON;
+ $json->allow_nonref->escape_slash->encode("/");
+
+At this time, the returned object is a C<JSON::Backend::XS::Supportable>
+object (re-blessed XS object), and by checking JSON::XS unsupported flags
+in de/encoding, can support some unsupported methods - C<loose>, C<allow_bignum>,
+C<allow_barekey>, C<allow_singlequote>, C<escape_slash> and C<indent_length>.
+
+When any unsupported methods are not enable, C<XS de/encode> will be
+used as is. The switch is achieved by changing the symbolic tables.
+
+C<-support_by_pp> is effective only when the backend module is JSON::XS
+and it makes the de/encoding speed down a bit.
+
+See to L<JSON::PP SUPPORT METHODS>.
+
+=head1 INCOMPATIBLE CHANGES TO OLD VERSION
+
+There are big incompatibility between new version (2.00) and old (1.xx).
+If you use old C<JSON> 1.xx in your code, please check it.
+
+See to L<Transition ways from 1.xx to 2.xx.>
+
+=over
+
+=item jsonToObj and objToJson are obsoleted.
+
+Non Perl-style name C<jsonToObj> and C<objToJson> are obsoleted
+(but not yet deleted from the source).
+If you use these functions in your code, please replace them
+with C<from_json> and C<to_json>.
+
+
+=item Global variables are no longer available.
+
+C<JSON> class variables - C<$JSON::AUTOCONVERT>, C<$JSON::BareKey>, etc...
+- are not available any longer.
+Instead, various features can be used through object methods.
+
+
+=item Package JSON::Converter and JSON::Parser are deleted.
+
+Now C<JSON> bundles with JSON::PP which can handle JSON more properly than them.
+
+=item Package JSON::NotString is deleted.
+
+There was C<JSON::NotString> class which represents JSON value C<true>, C<false>, C<null>
+and numbers. It was deleted and replaced by C<JSON::Boolean>.
+
+C<JSON::Boolean> represents C<true> and C<false>.
+
+C<JSON::Boolean> does not represent C<null>.
+
+C<JSON::null> returns C<undef>.
+
+C<JSON> makes L<JSON::XS::Boolean> and L<JSON::PP::Boolean> is-a relation
+to L<JSON::Boolean>.
+
+=item function JSON::Number is obsoleted.
+
+C<JSON::Number> is now needless because JSON::XS and JSON::PP have
+round-trip integrity.
+
+=item JSONRPC modules are deleted.
+
+Perl implementation of JSON-RPC protocol - C<JSONRPC >, C<JSONRPC::Transport::HTTP>
+and C<Apache::JSONRPC > are deleted in this distribution.
+Instead of them, there is L<JSON::RPC> which supports JSON-RPC protocol version 1.1.
+
+=back
+
+=head2 Transition ways from 1.xx to 2.xx.
+
+You should set C<suport_by_pp> mode firstly, because
+it is always successful for the below codes even with JSON::XS.
+
+ use JSON -support_by_pp;
+
+=over
+
+=item Exported jsonToObj (simple)
+
+ from_json($json_text);
+
+=item Exported objToJson (simple)
+
+ to_json($perl_scalar);
+
+=item Exported jsonToObj (advanced)
+
+ $flags = {allow_barekey => 1, allow_singlequote => 1};
+ from_json($json_text, $flags);
+
+equivalent to:
+
+ $JSON::BareKey = 1;
+ $JSON::QuotApos = 1;
+ jsonToObj($json_text);
+
+=item Exported objToJson (advanced)
+
+ $flags = {allow_blessed => 1, allow_barekey => 1};
+ to_json($perl_scalar, $flags);
+
+equivalent to:
+
+ $JSON::BareKey = 1;
+ objToJson($perl_scalar);
+
+=item jsonToObj as object method
+
+ $json->decode($json_text);
+
+=item objToJson as object method
+
+ $json->encode($perl_scalar);
+
+=item new method with parameters
+
+The C<new> method in 2.x takes any parameters no longer.
+You can set parameters instead;
+
+ $json = JSON->new->pretty;
+
+=item $JSON::Pretty, $JSON::Indent, $JSON::Delimiter
+
+If C<indent> is enable, that means C<$JSON::Pretty> flag set. And
+C<$JSON::Delimiter> was substituted by C<space_before> and C<space_after>.
+In conclusion:
+
+ $json->indent->space_before->space_after;
+
+Equivalent to:
+
+ $json->pretty;
+
+To change indent length, use C<indent_length>.
+
+(Only with JSON::PP, if C<-support_by_pp> is not used.)
+
+ $json->pretty->indent_length(2)->encode($perl_scalar);
+
+=item $JSON::BareKey
+
+(Only with JSON::PP, if C<-support_by_pp> is not used.)
+
+ $json->allow_barekey->decode($json_text)
+
+=item $JSON::ConvBlessed
+
+use C<-convert_blessed_universally>. See to L<convert_blessed>.
+
+=item $JSON::QuotApos
+
+(Only with JSON::PP, if C<-support_by_pp> is not used.)
+
+ $json->allow_singlequote->decode($json_text)
+
+=item $JSON::SingleQuote
+
+Disable. C<JSON> does not make such a invalid JSON string any longer.
+
+=item $JSON::KeySort
+
+ $json->canonical->encode($perl_scalar)
+
+This is the ascii sort.
+
+If you want to use with your own sort routine, check the C<sort_by> method.
+
+(Only with JSON::PP, even if C<-support_by_pp> is used currently.)
+
+ $json->sort_by($sort_routine_ref)->encode($perl_scalar)
+
+ $json->sort_by(sub { $JSON::PP::a <=> $JSON::PP::b })->encode($perl_scalar)
+
+Can't access C<$a> and C<$b> but C<$JSON::PP::a> and C<$JSON::PP::b>.
+
+=item $JSON::SkipInvalid
+
+ $json->allow_unknown
+
+=item $JSON::AUTOCONVERT
+
+Needless. C<JSON> backend modules have the round-trip integrity.
+
+=item $JSON::UTF8
+
+Needless because C<JSON> (JSON::XS/JSON::PP) sets
+the UTF8 flag on properly.
+
+ # With UTF8-flagged strings
+
+ $json->allow_nonref;
+ $str = chr(1000); # UTF8-flagged
+
+ $json_text = $json->utf8(0)->encode($str);
+ utf8::is_utf8($json_text);
+ # true
+ $json_text = $json->utf8(1)->encode($str);
+ utf8::is_utf8($json_text);
+ # false
+
+ $str = '"' . chr(1000) . '"'; # UTF8-flagged
+
+ $perl_scalar = $json->utf8(0)->decode($str);
+ utf8::is_utf8($perl_scalar);
+ # true
+ $perl_scalar = $json->utf8(1)->decode($str);
+ # died because of 'Wide character in subroutine'
+
+See to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL>.
+
+=item $JSON::UnMapping
+
+Disable. See to L<MAPPING>.
+
+=item $JSON::SelfConvert
+
+This option was deleted.
+Instead of it, if a givien blessed object has the C<TO_JSON> method,
+C<TO_JSON> will be executed with C<convert_blessed>.
+
+ $json->convert_blessed->encode($bleesed_hashref_or_arrayref)
+ # if need, call allow_blessed
+
+Note that it was C<toJson> in old version, but now not C<toJson> but C<TO_JSON>.
+
+=back
+
+=head1 TODO
+
+=over
+
+=item example programs
+
+=back
+
+=head1 THREADS
+
+No test with JSON::PP. If with JSON::XS, See to L<JSON::XS/THREADS>.
+
+
+=head1 BUGS
+
+Please report bugs relevant to C<JSON> to E<lt>makamaka[at]cpan.orgE<gt>.
+
+
+=head1 SEE ALSO
+
+Most of the document is copied and modified from JSON::XS doc.
+
+L<JSON::XS>, L<JSON::PP>
+
+C<RFC4627>(L<http://www.ietf.org/rfc/rfc4627.txt>)
+
+=head1 AUTHOR
+
+Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
+
+JSON::XS was written by Marc Lehmann <schmorp[at]schmorp.de>
+
+The relese of this new version owes to the courtesy of Marc Lehmann.
+
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2005-2011 by Makamaka Hannyaharamitu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
diff --git a/data/lib/JSON/backportPP.pm b/data/lib/JSON/backportPP.pm
new file mode 100644
index 0000000..ab37416
--- /dev/null
+++ b/data/lib/JSON/backportPP.pm
@@ -0,0 +1,2797 @@
+package # This is JSON::backportPP
+ JSON::PP;
+
+# JSON-2.0
+
+use 5.005;
+use strict;
+use base qw(Exporter);
+use overload ();
+
+use Carp ();
+use B ();
+#use Devel::Peek;
+
+$JSON::PP::VERSION = '2.27200';
+
+@JSON::PP::EXPORT = qw(encode_json decode_json from_json to_json);
+
+# instead of hash-access, i tried index-access for speed.
+# but this method is not faster than what i expected. so it will be changed.
+
+use constant P_ASCII => 0;
+use constant P_LATIN1 => 1;
+use constant P_UTF8 => 2;
+use constant P_INDENT => 3;
+use constant P_CANONICAL => 4;
+use constant P_SPACE_BEFORE => 5;
+use constant P_SPACE_AFTER => 6;
+use constant P_ALLOW_NONREF => 7;
+use constant P_SHRINK => 8;
+use constant P_ALLOW_BLESSED => 9;
+use constant P_CONVERT_BLESSED => 10;
+use constant P_RELAXED => 11;
+
+use constant P_LOOSE => 12;
+use constant P_ALLOW_BIGNUM => 13;
+use constant P_ALLOW_BAREKEY => 14;
+use constant P_ALLOW_SINGLEQUOTE => 15;
+use constant P_ESCAPE_SLASH => 16;
+use constant P_AS_NONBLESSED => 17;
+
+use constant P_ALLOW_UNKNOWN => 18;
+
+use constant OLD_PERL => $] < 5.008 ? 1 : 0;
+
+BEGIN {
+ my @xs_compati_bit_properties = qw(
+ latin1 ascii utf8 indent canonical space_before space_after allow_nonref shrink
+ allow_blessed convert_blessed relaxed allow_unknown
+ );
+ my @pp_bit_properties = qw(
+ allow_singlequote allow_bignum loose
+ allow_barekey escape_slash as_nonblessed
+ );
+
+ # Perl version check, Unicode handling is enable?
+ # Helper module sets @JSON::PP::_properties.
+ if ($] < 5.008 ) {
+ my $helper = $] >= 5.006 ? 'JSON::backportPP::Compat5006' : 'JSON::backportPP::Compat5005';
+ eval qq| require $helper |;
+ if ($@) { Carp::croak $@; }
+ }
+
+ for my $name (@xs_compati_bit_properties, @pp_bit_properties) {
+ my $flag_name = 'P_' . uc($name);
+
+ eval qq/
+ sub $name {
+ my \$enable = defined \$_[1] ? \$_[1] : 1;
+
+ if (\$enable) {
+ \$_[0]->{PROPS}->[$flag_name] = 1;
+ }
+ else {
+ \$_[0]->{PROPS}->[$flag_name] = 0;
+ }
+
+ \$_[0];
+ }
+
+ sub get_$name {
+ \$_[0]->{PROPS}->[$flag_name] ? 1 : '';
+ }
+ /;
+ }
+
+}
+
+
+
+# Functions
+
+my %encode_allow_method
+ = map {($_ => 1)} qw/utf8 pretty allow_nonref latin1 self_encode escape_slash
+ allow_blessed convert_blessed indent indent_length allow_bignum
+ as_nonblessed
+ /;
+my %decode_allow_method
+ = map {($_ => 1)} qw/utf8 allow_nonref loose allow_singlequote allow_bignum
+ allow_barekey max_size relaxed/;
+
+
+my $JSON; # cache
+
+sub encode_json ($) { # encode
+ ($JSON ||= __PACKAGE__->new->utf8)->encode(@_);
+}
+
+
+sub decode_json { # decode
+ ($JSON ||= __PACKAGE__->new->utf8)->decode(@_);
+}
+
+# Obsoleted
+
+sub to_json($) {
+ Carp::croak ("JSON::PP::to_json has been renamed to encode_json.");
+}
+
+
+sub from_json($) {
+ Carp::croak ("JSON::PP::from_json has been renamed to decode_json.");
+}
+
+
+# Methods
+
+sub new {
+ my $class = shift;
+ my $self = {
+ max_depth => 512,
+ max_size => 0,
+ indent => 0,
+ FLAGS => 0,
+ fallback => sub { encode_error('Invalid value. JSON can only reference.') },
+ indent_length => 3,
+ };
+
+ bless $self, $class;
+}
+
+
+sub encode {
+ return $_[0]->PP_encode_json($_[1]);
+}
+
+
+sub decode {
+ return $_[0]->PP_decode_json($_[1], 0x00000000);
+}
+
+
+sub decode_prefix {
+ return $_[0]->PP_decode_json($_[1], 0x00000001);
+}
+
+
+# accessor
+
+
+# pretty printing
+
+sub pretty {
+ my ($self, $v) = @_;
+ my $enable = defined $v ? $v : 1;
+
+ if ($enable) { # indent_length(3) for JSON::XS compatibility
+ $self->indent(1)->indent_length(3)->space_before(1)->space_after(1);
+ }
+ else {
+ $self->indent(0)->space_before(0)->space_after(0);
+ }
+
+ $self;
+}
+
+# etc
+
+sub max_depth {
+ my $max = defined $_[1] ? $_[1] : 0x80000000;
+ $_[0]->{max_depth} = $max;
+ $_[0];
+}
+
+
+sub get_max_depth { $_[0]->{max_depth}; }
+
+
+sub max_size {
+ my $max = defined $_[1] ? $_[1] : 0;
+ $_[0]->{max_size} = $max;
+ $_[0];
+}
+
+
+sub get_max_size { $_[0]->{max_size}; }
+
+
+sub filter_json_object {
+ $_[0]->{cb_object} = defined $_[1] ? $_[1] : 0;
+ $_[0]->{F_HOOK} = ($_[0]->{cb_object} or $_[0]->{cb_sk_object}) ? 1 : 0;
+ $_[0];
+}
+
+sub filter_json_single_key_object {
+ if (@_ > 1) {
+ $_[0]->{cb_sk_object}->{$_[1]} = $_[2];
+ }
+ $_[0]->{F_HOOK} = ($_[0]->{cb_object} or $_[0]->{cb_sk_object}) ? 1 : 0;
+ $_[0];
+}
+
+sub indent_length {
+ if (!defined $_[1] or $_[1] > 15 or $_[1] < 0) {
+ Carp::carp "The acceptable range of indent_length() is 0 to 15.";
+ }
+ else {
+ $_[0]->{indent_length} = $_[1];
+ }
+ $_[0];
+}
+
+sub get_indent_length {
+ $_[0]->{indent_length};
+}
+
+sub sort_by {
+ $_[0]->{sort_by} = defined $_[1] ? $_[1] : 1;
+ $_[0];
+}
+
+sub allow_bigint {
+ Carp::carp("allow_bigint() is obsoleted. use allow_bignum() insted.");
+}
+
+###############################
+
+###
+### Perl => JSON
+###
+
+
+{ # Convert
+
+ my $max_depth;
+ my $indent;
+ my $ascii;
+ my $latin1;
+ my $utf8;
+ my $space_before;
+ my $space_after;
+ my $canonical;
+ my $allow_blessed;
+ my $convert_blessed;
+
+ my $indent_length;
+ my $escape_slash;
+ my $bignum;
+ my $as_nonblessed;
+
+ my $depth;
+ my $indent_count;
+ my $keysort;
+
+
+ sub PP_encode_json {
+ my $self = shift;
+ my $obj = shift;
+
+ $indent_count = 0;
+ $depth = 0;
+
+ my $idx = $self->{PROPS};
+
+ ($ascii, $latin1, $utf8, $indent, $canonical, $space_before, $space_after, $allow_blessed,
+ $convert_blessed, $escape_slash, $bignum, $as_nonblessed)
+ = @{$idx}[P_ASCII .. P_SPACE_AFTER, P_ALLOW_BLESSED, P_CONVERT_BLESSED,
+ P_ESCAPE_SLASH, P_ALLOW_BIGNUM, P_AS_NONBLESSED];
+
+ ($max_depth, $indent_length) = @{$self}{qw/max_depth indent_length/};
+
+ $keysort = $canonical ? sub { $a cmp $b } : undef;
+
+ if ($self->{sort_by}) {
+ $keysort = ref($self->{sort_by}) eq 'CODE' ? $self->{sort_by}
+ : $self->{sort_by} =~ /\D+/ ? $self->{sort_by}
+ : sub { $a cmp $b };
+ }
+
+ encode_error("hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this)")
+ if(!ref $obj and !$idx->[ P_ALLOW_NONREF ]);
+
+ my $str = $self->object_to_json($obj);
+
+ $str .= "\n" if ( $indent ); # JSON::XS 2.26 compatible
+
+ unless ($ascii or $latin1 or $utf8) {
+ utf8::upgrade($str);
+ }
+
+ if ($idx->[ P_SHRINK ]) {
+ utf8::downgrade($str, 1);
+ }
+
+ return $str;
+ }
+
+
+ sub object_to_json {
+ my ($self, $obj) = @_;
+ my $type = ref($obj);
+
+ if($type eq 'HASH'){
+ return $self->hash_to_json($obj);
+ }
+ elsif($type eq 'ARRAY'){
+ return $self->array_to_json($obj);
+ }
+ elsif ($type) { # blessed object?
+ if (blessed($obj)) {
+
+ return $self->value_to_json($obj) if ( $obj->isa('JSON::PP::Boolean') );
+
+ if ( $convert_blessed and $obj->can('TO_JSON') ) {
+ my $result = $obj->TO_JSON();
+ if ( defined $result and ref( $result ) ) {
+ if ( refaddr( $obj ) eq refaddr( $result ) ) {
+ encode_error( sprintf(
+ "%s::TO_JSON method returned same object as was passed instead of a new one",
+ ref $obj
+ ) );
+ }
+ }
+
+ return $self->object_to_json( $result );
+ }
+
+ return "$obj" if ( $bignum and _is_bignum($obj) );
+ return $self->blessed_to_json($obj) if ($allow_blessed and $as_nonblessed); # will be removed.
+
+ encode_error( sprintf("encountered object '%s', but neither allow_blessed "
+ . "nor convert_blessed settings are enabled", $obj)
+ ) unless ($allow_blessed);
+
+ return 'null';
+ }
+ else {
+ return $self->value_to_json($obj);
+ }
+ }
+ else{
+ return $self->value_to_json($obj);
+ }
+ }
+
+
+ sub hash_to_json {
+ my ($self, $obj) = @_;
+ my @res;
+
+ encode_error("json text or perl structure exceeds maximum nesting level (max_depth set too low?)")
+ if (++$depth > $max_depth);
+
+ my ($pre, $post) = $indent ? $self->_up_indent() : ('', '');
+ my $del = ($space_before ? ' ' : '') . ':' . ($space_after ? ' ' : '');
+
+ for my $k ( _sort( $obj ) ) {
+ if ( OLD_PERL ) { utf8::decode($k) } # key for Perl 5.6 / be optimized
+ push @res, string_to_json( $self, $k )
+ . $del
+ . ( $self->object_to_json( $obj->{$k} ) || $self->value_to_json( $obj->{$k} ) );
+ }
+
+ --$depth;
+ $self->_down_indent() if ($indent);
+
+ return '{' . ( @res ? $pre : '' ) . ( @res ? join( ",$pre", @res ) . $post : '' ) . '}';
+ }
+
+
+ sub array_to_json {
+ my ($self, $obj) = @_;
+ my @res;
+
+ encode_error("json text or perl structure exceeds maximum nesting level (max_depth set too low?)")
+ if (++$depth > $max_depth);
+
+ my ($pre, $post) = $indent ? $self->_up_indent() : ('', '');
+
+ for my $v (@$obj){
+ push @res, $self->object_to_json($v) || $self->value_to_json($v);
+ }
+
+ --$depth;
+ $self->_down_indent() if ($indent);
+
+ return '[' . ( @res ? $pre : '' ) . ( @res ? join( ",$pre", @res ) . $post : '' ) . ']';
+ }
+
+
+ sub value_to_json {
+ my ($self, $value) = @_;
+
+ return 'null' if(!defined $value);
+
+ my $b_obj = B::svref_2object(\$value); # for round trip problem
+ my $flags = $b_obj->FLAGS;
+
+ return $value # as is
+ if $flags & ( B::SVp_IOK | B::SVp_NOK ) and !( $flags & B::SVp_POK ); # SvTYPE is IV or NV?
+
+ my $type = ref($value);
+
+ if(!$type){
+ return string_to_json($self, $value);
+ }
+ elsif( blessed($value) and $value->isa('JSON::PP::Boolean') ){
+ return $$value == 1 ? 'true' : 'false';
+ }
+ elsif ($type) {
+ if ((overload::StrVal($value) =~ /=(\w+)/)[0]) {
+ return $self->value_to_json("$value");
+ }
+
+ if ($type eq 'SCALAR' and defined $$value) {
+ return $$value eq '1' ? 'true'
+ : $$value eq '0' ? 'false'
+ : $self->{PROPS}->[ P_ALLOW_UNKNOWN ] ? 'null'
+ : encode_error("cannot encode reference to scalar");
+ }
+
+ if ( $self->{PROPS}->[ P_ALLOW_UNKNOWN ] ) {
+ return 'null';
+ }
+ else {
+ if ( $type eq 'SCALAR' or $type eq 'REF' ) {
+ encode_error("cannot encode reference to scalar");
+ }
+ else {
+ encode_error("encountered $value, but JSON can only represent references to arrays or hashes");
+ }
+ }
+
+ }
+ else {
+ return $self->{fallback}->($value)
+ if ($self->{fallback} and ref($self->{fallback}) eq 'CODE');
+ return 'null';
+ }
+
+ }
+
+
+ my %esc = (
+ "\n" => '\n',
+ "\r" => '\r',
+ "\t" => '\t',
+ "\f" => '\f',
+ "\b" => '\b',
+ "\"" => '\"',
+ "\\" => '\\\\',
+ "\'" => '\\\'',
+ );
+
+
+ sub string_to_json {
+ my ($self, $arg) = @_;
+
+ $arg =~ s/([\x22\x5c\n\r\t\f\b])/$esc{$1}/g;
+ $arg =~ s/\//\\\//g if ($escape_slash);
+ $arg =~ s/([\x00-\x08\x0b\x0e-\x1f])/'\\u00' . unpack('H2', $1)/eg;
+
+ if ($ascii) {
+ $arg = JSON_PP_encode_ascii($arg);
+ }
+
+ if ($latin1) {
+ $arg = JSON_PP_encode_latin1($arg);
+ }
+
+ if ($utf8) {
+ utf8::encode($arg);
+ }
+
+ return '"' . $arg . '"';
+ }
+
+
+ sub blessed_to_json {
+ my $reftype = reftype($_[1]) || '';
+ if ($reftype eq 'HASH') {
+ return $_[0]->hash_to_json($_[1]);
+ }
+ elsif ($reftype eq 'ARRAY') {
+ return $_[0]->array_to_json($_[1]);
+ }
+ else {
+ return 'null';
+ }
+ }
+
+
+ sub encode_error {
+ my $error = shift;
+ Carp::croak "$error";
+ }
+
+
+ sub _sort {
+ defined $keysort ? (sort $keysort (keys %{$_[0]})) : keys %{$_[0]};
+ }
+
+
+ sub _up_indent {
+ my $self = shift;
+ my $space = ' ' x $indent_length;
+
+ my ($pre,$post) = ('','');
+
+ $post = "\n" . $space x $indent_count;
+
+ $indent_count++;
+
+ $pre = "\n" . $space x $indent_count;
+
+ return ($pre,$post);
+ }
+
+
+ sub _down_indent { $indent_count--; }
+
+
+ sub PP_encode_box {
+ {
+ depth => $depth,
+ indent_count => $indent_count,
+ };
+ }
+
+} # Convert
+
+
+sub _encode_ascii {
+ join('',
+ map {
+ $_ <= 127 ?
+ chr($_) :
+ $_ <= 65535 ?
+ sprintf('\u%04x', $_) : sprintf('\u%x\u%x', _encode_surrogates($_));
+ } unpack('U*', $_[0])
+ );
+}
+
+
+sub _encode_latin1 {
+ join('',
+ map {
+ $_ <= 255 ?
+ chr($_) :
+ $_ <= 65535 ?
+ sprintf('\u%04x', $_) : sprintf('\u%x\u%x', _encode_surrogates($_));
+ } unpack('U*', $_[0])
+ );
+}
+
+
+sub _encode_surrogates { # from perlunicode
+ my $uni = $_[0] - 0x10000;
+ return ($uni / 0x400 + 0xD800, $uni % 0x400 + 0xDC00);
+}
+
+
+sub _is_bignum {
+ $_[0]->isa('Math::BigInt') or $_[0]->isa('Math::BigFloat');
+}
+
+
+
+#
+# JSON => Perl
+#
+
+my $max_intsize;
+
+BEGIN {
+ my $checkint = 1111;
+ for my $d (5..64) {
+ $checkint .= 1;
+ my $int = eval qq| $checkint |;
+ if ($int =~ /[eE]/) {
+ $max_intsize = $d - 1;
+ last;
+ }
+ }
+}
+
+{ # PARSE
+
+ my %escapes = ( # by Jeremy Muhlich <jmuhlich [at] bitflood.org>
+ b => "\x8",
+ t => "\x9",
+ n => "\xA",
+ f => "\xC",
+ r => "\xD",
+ '\\' => '\\',
+ '"' => '"',
+ '/' => '/',
+ );
+
+ my $text; # json data
+ my $at; # offset
+ my $ch; # 1chracter
+ my $len; # text length (changed according to UTF8 or NON UTF8)
+ # INTERNAL
+ my $depth; # nest counter
+ my $encoding; # json text encoding
+ my $is_valid_utf8; # temp variable
+ my $utf8_len; # utf8 byte length
+ # FLAGS
+ my $utf8; # must be utf8
+ my $max_depth; # max nest nubmer of objects and arrays
+ my $max_size;
+ my $relaxed;
+ my $cb_object;
+ my $cb_sk_object;
+
+ my $F_HOOK;
+
+ my $allow_bigint; # using Math::BigInt
+ my $singlequote; # loosely quoting
+ my $loose; #
+ my $allow_barekey; # bareKey
+
+ # $opt flag
+ # 0x00000001 .... decode_prefix
+ # 0x10000000 .... incr_parse
+
+ sub PP_decode_json {
+ my ($self, $opt); # $opt is an effective flag during this decode_json.
+
+ ($self, $text, $opt) = @_;
+
+ ($at, $ch, $depth) = (0, '', 0);
+
+ if ( !defined $text or ref $text ) {
+ decode_error("malformed JSON string, neither array, object, number, string or atom");
+ }
+
+ my $idx = $self->{PROPS};
+
+ ($utf8, $relaxed, $loose, $allow_bigint, $allow_barekey, $singlequote)
+ = @{$idx}[P_UTF8, P_RELAXED, P_LOOSE .. P_ALLOW_SINGLEQUOTE];
+
+ if ( $utf8 ) {
+ utf8::downgrade( $text, 1 ) or Carp::croak("Wide character in subroutine entry");
+ }
+ else {
+ utf8::upgrade( $text );
+ }
+
+ $len = length $text;
+
+ ($max_depth, $max_size, $cb_object, $cb_sk_object, $F_HOOK)
+ = @{$self}{qw/max_depth max_size cb_object cb_sk_object F_HOOK/};
+
+ if ($max_size > 1) {
+ use bytes;
+ my $bytes = length $text;
+ decode_error(
+ sprintf("attempted decode of JSON text of %s bytes size, but max_size is set to %s"
+ , $bytes, $max_size), 1
+ ) if ($bytes > $max_size);
+ }
+
+ # Currently no effect
+ # should use regexp
+ my @octets = unpack('C4', $text);
+ $encoding = ( $octets[0] and $octets[1]) ? 'UTF-8'
+ : (!$octets[0] and $octets[1]) ? 'UTF-16BE'
+ : (!$octets[0] and !$octets[1]) ? 'UTF-32BE'
+ : ( $octets[2] ) ? 'UTF-16LE'
+ : (!$octets[2] ) ? 'UTF-32LE'
+ : 'unknown';
+
+ white(); # remove head white space
+
+ my $valid_start = defined $ch; # Is there a first character for JSON structure?
+
+ my $result = value();
+
+ return undef if ( !$result && ( $opt & 0x10000000 ) ); # for incr_parse
+
+ decode_error("malformed JSON string, neither array, object, number, string or atom") unless $valid_start;
+
+ if ( !$idx->[ P_ALLOW_NONREF ] and !ref $result ) {
+ decode_error(
+ 'JSON text must be an object or array (but found number, string, true, false or null,'
+ . ' use allow_nonref to allow this)', 1);
+ }
+
+ Carp::croak('something wrong.') if $len < $at; # we won't arrive here.
+
+ my $consumed = defined $ch ? $at - 1 : $at; # consumed JSON text length
+
+ white(); # remove tail white space
+
+ if ( $ch ) {
+ return ( $result, $consumed ) if ($opt & 0x00000001); # all right if decode_prefix
+ decode_error("garbage after JSON object");
+ }
+
+ ( $opt & 0x00000001 ) ? ( $result, $consumed ) : $result;
+ }
+
+
+ sub next_chr {
+ return $ch = undef if($at >= $len);
+ $ch = substr($text, $at++, 1);
+ }
+
+
+ sub value {
+ white();
+ return if(!defined $ch);
+ return object() if($ch eq '{');
+ return array() if($ch eq '[');
+ return string() if($ch eq '"' or ($singlequote and $ch eq "'"));
+ return number() if($ch =~ /[0-9]/ or $ch eq '-');
+ return word();
+ }
+
+ sub string {
+ my ($i, $s, $t, $u);
+ my $utf16;
+ my $is_utf8;
+
+ ($is_valid_utf8, $utf8_len) = ('', 0);
+
+ $s = ''; # basically UTF8 flag on
+
+ if($ch eq '"' or ($singlequote and $ch eq "'")){
+ my $boundChar = $ch;
+
+ OUTER: while( defined(next_chr()) ){
+
+ if($ch eq $boundChar){
+ next_chr();
+
+ if ($utf16) {
+ decode_error("missing low surrogate character in surrogate pair");
+ }
+
+ utf8::decode($s) if($is_utf8);
+
+ return $s;
+ }
+ elsif($ch eq '\\'){
+ next_chr();
+ if(exists $escapes{$ch}){
+ $s .= $escapes{$ch};
+ }
+ elsif($ch eq 'u'){ # UNICODE handling
+ my $u = '';
+
+ for(1..4){
+ $ch = next_chr();
+ last OUTER if($ch !~ /[0-9a-fA-F]/);
+ $u .= $ch;
+ }
+
+ # U+D800 - U+DBFF
+ if ($u =~ /^[dD][89abAB][0-9a-fA-F]{2}/) { # UTF-16 high surrogate?
+ $utf16 = $u;
+ }
+ # U+DC00 - U+DFFF
+ elsif ($u =~ /^[dD][c-fC-F][0-9a-fA-F]{2}/) { # UTF-16 low surrogate?
+ unless (defined $utf16) {
+ decode_error("missing high surrogate character in surrogate pair");
+ }
+ $is_utf8 = 1;
+ $s .= JSON_PP_decode_surrogates($utf16, $u) || next;
+ $utf16 = undef;
+ }
+ else {
+ if (defined $utf16) {
+ decode_error("surrogate pair expected");
+ }
+
+ if ( ( my $hex = hex( $u ) ) > 127 ) {
+ $is_utf8 = 1;
+ $s .= JSON_PP_decode_unicode($u) || next;
+ }
+ else {
+ $s .= chr $hex;
+ }
+ }
+
+ }
+ else{
+ unless ($loose) {
+ $at -= 2;
+ decode_error('illegal backslash escape sequence in string');
+ }
+ $s .= $ch;
+ }
+ }
+ else{
+
+ if ( ord $ch > 127 ) {
+ if ( $utf8 ) {
+ unless( $ch = is_valid_utf8($ch) ) {
+ $at -= 1;
+ decode_error("malformed UTF-8 character in JSON string");
+ }
+ else {
+ $at += $utf8_len - 1;
+ }
+ }
+ else {
+ utf8::encode( $ch );
+ }
+
+ $is_utf8 = 1;
+ }
+
+ if (!$loose) {
+ if ($ch =~ /[\x00-\x1f\x22\x5c]/) { # '/' ok
+ $at--;
+ decode_error('invalid character encountered while parsing JSON string');
+ }
+ }
+
+ $s .= $ch;
+ }
+ }
+ }
+
+ decode_error("unexpected end of string while parsing JSON string");
+ }
+
+
+ sub white {
+ while( defined $ch ){
+ if($ch le ' '){
+ next_chr();
+ }
+ elsif($ch eq '/'){
+ next_chr();
+ if(defined $ch and $ch eq '/'){
+ 1 while(defined(next_chr()) and $ch ne "\n" and $ch ne "\r");
+ }
+ elsif(defined $ch and $ch eq '*'){
+ next_chr();
+ while(1){
+ if(defined $ch){
+ if($ch eq '*'){
+ if(defined(next_chr()) and $ch eq '/'){
+ next_chr();
+ last;
+ }
+ }
+ else{
+ next_chr();
+ }
+ }
+ else{
+ decode_error("Unterminated comment");
+ }
+ }
+ next;
+ }
+ else{
+ $at--;
+ decode_error("malformed JSON string, neither array, object, number, string or atom");
+ }
+ }
+ else{
+ if ($relaxed and $ch eq '#') { # correctly?
+ pos($text) = $at;
+ $text =~ /\G([^\n]*(?:\r\n|\r|\n|$))/g;
+ $at = pos($text);
+ next_chr;
+ next;
+ }
+
+ last;
+ }
+ }
+ }
+
+
+ sub array {
+ my $a = $_[0] || []; # you can use this code to use another array ref object.
+
+ decode_error('json text or perl structure exceeds maximum nesting level (max_depth set too low?)')
+ if (++$depth > $max_depth);
+
+ next_chr();
+ white();
+
+ if(defined $ch and $ch eq ']'){
+ --$depth;
+ next_chr();
+ return $a;
+ }
+ else {
+ while(defined($ch)){
+ push @$a, value();
+
+ white();
+
+ if (!defined $ch) {
+ last;
+ }
+
+ if($ch eq ']'){
+ --$depth;
+ next_chr();
+ return $a;
+ }
+
+ if($ch ne ','){
+ last;
+ }
+
+ next_chr();
+ white();
+
+ if ($relaxed and $ch eq ']') {
+ --$depth;
+ next_chr();
+ return $a;
+ }
+
+ }
+ }
+
+ decode_error(", or ] expected while parsing array");
+ }
+
+
+ sub object {
+ my $o = $_[0] || {}; # you can use this code to use another hash ref object.
+ my $k;
+
+ decode_error('json text or perl structure exceeds maximum nesting level (max_depth set too low?)')
+ if (++$depth > $max_depth);
+ next_chr();
+ white();
+
+ if(defined $ch and $ch eq '}'){
+ --$depth;
+ next_chr();
+ if ($F_HOOK) {
+ return _json_object_hook($o);
+ }
+ return $o;
+ }
+ else {
+ while (defined $ch) {
+ $k = ($allow_barekey and $ch ne '"' and $ch ne "'") ? bareKey() : string();
+ white();
+
+ if(!defined $ch or $ch ne ':'){
+ $at--;
+ decode_error("':' expected");
+ }
+
+ next_chr();
+ $o->{$k} = value();
+ white();
+
+ last if (!defined $ch);
+
+ if($ch eq '}'){
+ --$depth;
+ next_chr();
+ if ($F_HOOK) {
+ return _json_object_hook($o);
+ }
+ return $o;
+ }
+
+ if($ch ne ','){
+ last;
+ }
+
+ next_chr();
+ white();
+
+ if ($relaxed and $ch eq '}') {
+ --$depth;
+ next_chr();
+ if ($F_HOOK) {
+ return _json_object_hook($o);
+ }
+ return $o;
+ }
+
+ }
+
+ }
+
+ $at--;
+ decode_error(", or } expected while parsing object/hash");
+ }
+
+
+ sub bareKey { # doesn't strictly follow Standard ECMA-262 3rd Edition
+ my $key;
+ while($ch =~ /[^\x00-\x23\x25-\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x7F]/){
+ $key .= $ch;
+ next_chr();
+ }
+ return $key;
+ }
+
+
+ sub word {
+ my $word = substr($text,$at-1,4);
+
+ if($word eq 'true'){
+ $at += 3;
+ next_chr;
+ return $JSON::PP::true;
+ }
+ elsif($word eq 'null'){
+ $at += 3;
+ next_chr;
+ return undef;
+ }
+ elsif($word eq 'fals'){
+ $at += 3;
+ if(substr($text,$at,1) eq 'e'){
+ $at++;
+ next_chr;
+ return $JSON::PP::false;
+ }
+ }
+
+ $at--; # for decode_error report
+
+ decode_error("'null' expected") if ($word =~ /^n/);
+ decode_error("'true' expected") if ($word =~ /^t/);
+ decode_error("'false' expected") if ($word =~ /^f/);
+ decode_error("malformed JSON string, neither array, object, number, string or atom");
+ }
+
+
+ sub number {
+ my $n = '';
+ my $v;
+
+ # According to RFC4627, hex or oct digts are invalid.
+ if($ch eq '0'){
+ my $peek = substr($text,$at,1);
+ my $hex = $peek =~ /[xX]/; # 0 or 1
+
+ if($hex){
+ decode_error("malformed number (leading zero must not be followed by another digit)");
+ ($n) = ( substr($text, $at+1) =~ /^([0-9a-fA-F]+)/);
+ }
+ else{ # oct
+ ($n) = ( substr($text, $at) =~ /^([0-7]+)/);
+ if (defined $n and length $n > 1) {
+ decode_error("malformed number (leading zero must not be followed by another digit)");
+ }
+ }
+
+ if(defined $n and length($n)){
+ if (!$hex and length($n) == 1) {
+ decode_error("malformed number (leading zero must not be followed by another digit)");
+ }
+ $at += length($n) + $hex;
+ next_chr;
+ return $hex ? hex($n) : oct($n);
+ }
+ }
+
+ if($ch eq '-'){
+ $n = '-';
+ next_chr;
+ if (!defined $ch or $ch !~ /\d/) {
+ decode_error("malformed number (no digits after initial minus)");
+ }
+ }
+
+ while(defined $ch and $ch =~ /\d/){
+ $n .= $ch;
+ next_chr;
+ }
+
+ if(defined $ch and $ch eq '.'){
+ $n .= '.';
+
+ next_chr;
+ if (!defined $ch or $ch !~ /\d/) {
+ decode_error("malformed number (no digits after decimal point)");
+ }
+ else {
+ $n .= $ch;
+ }
+
+ while(defined(next_chr) and $ch =~ /\d/){
+ $n .= $ch;
+ }
+ }
+
+ if(defined $ch and ($ch eq 'e' or $ch eq 'E')){
+ $n .= $ch;
+ next_chr;
+
+ if(defined($ch) and ($ch eq '+' or $ch eq '-')){
+ $n .= $ch;
+ next_chr;
+ if (!defined $ch or $ch =~ /\D/) {
+ decode_error("malformed number (no digits after exp sign)");
+ }
+ $n .= $ch;
+ }
+ elsif(defined($ch) and $ch =~ /\d/){
+ $n .= $ch;
+ }
+ else {
+ decode_error("malformed number (no digits after exp sign)");
+ }
+
+ while(defined(next_chr) and $ch =~ /\d/){
+ $n .= $ch;
+ }
+
+ }
+
+ $v .= $n;
+
+ if ($v !~ /[.eE]/ and length $v > $max_intsize) {
+ if ($allow_bigint) { # from Adam Sussman
+ require Math::BigInt;
+ return Math::BigInt->new($v);
+ }
+ else {
+ return "$v";
+ }
+ }
+ elsif ($allow_bigint) {
+ require Math::BigFloat;
+ return Math::BigFloat->new($v);
+ }
+
+ return 0+$v;
+ }
+
+
+ sub is_valid_utf8 {
+
+ $utf8_len = $_[0] =~ /[\x00-\x7F]/ ? 1
+ : $_[0] =~ /[\xC2-\xDF]/ ? 2
+ : $_[0] =~ /[\xE0-\xEF]/ ? 3
+ : $_[0] =~ /[\xF0-\xF4]/ ? 4
+ : 0
+ ;
+
+ return unless $utf8_len;
+
+ my $is_valid_utf8 = substr($text, $at - 1, $utf8_len);
+
+ return ( $is_valid_utf8 =~ /^(?:
+ [\x00-\x7F]
+ |[\xC2-\xDF][\x80-\xBF]
+ |[\xE0][\xA0-\xBF][\x80-\xBF]
+ |[\xE1-\xEC][\x80-\xBF][\x80-\xBF]
+ |[\xED][\x80-\x9F][\x80-\xBF]
+ |[\xEE-\xEF][\x80-\xBF][\x80-\xBF]
+ |[\xF0][\x90-\xBF][\x80-\xBF][\x80-\xBF]
+ |[\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]
+ |[\xF4][\x80-\x8F][\x80-\xBF][\x80-\xBF]
+ )$/x ) ? $is_valid_utf8 : '';
+ }
+
+
+ sub decode_error {
+ my $error = shift;
+ my $no_rep = shift;
+ my $str = defined $text ? substr($text, $at) : '';
+ my $mess = '';
+ my $type = $] >= 5.008 ? 'U*'
+ : $] < 5.006 ? 'C*'
+ : utf8::is_utf8( $str ) ? 'U*' # 5.6
+ : 'C*'
+ ;
+
+ for my $c ( unpack( $type, $str ) ) { # emulate pv_uni_display() ?
+ $mess .= $c == 0x07 ? '\a'
+ : $c == 0x09 ? '\t'
+ : $c == 0x0a ? '\n'
+ : $c == 0x0d ? '\r'
+ : $c == 0x0c ? '\f'
+ : $c < 0x20 ? sprintf('\x{%x}', $c)
+ : $c == 0x5c ? '\\\\'
+ : $c < 0x80 ? chr($c)
+ : sprintf('\x{%x}', $c)
+ ;
+ if ( length $mess >= 20 ) {
+ $mess .= '...';
+ last;
+ }
+ }
+
+ unless ( length $mess ) {
+ $mess = '(end of string)';
+ }
+
+ Carp::croak (
+ $no_rep ? "$error" : "$error, at character offset $at (before \"$mess\")"
+ );
+
+ }
+
+
+ sub _json_object_hook {
+ my $o = $_[0];
+ my @ks = keys %{$o};
+
+ if ( $cb_sk_object and @ks == 1 and exists $cb_sk_object->{ $ks[0] } and ref $cb_sk_object->{ $ks[0] } ) {
+ my @val = $cb_sk_object->{ $ks[0] }->( $o->{$ks[0]} );
+ if (@val == 1) {
+ return $val[0];
+ }
+ }
+
+ my @val = $cb_object->($o) if ($cb_object);
+ if (@val == 0 or @val > 1) {
+ return $o;
+ }
+ else {
+ return $val[0];
+ }
+ }
+
+
+ sub PP_decode_box {
+ {
+ text => $text,
+ at => $at,
+ ch => $ch,
+ len => $len,
+ depth => $depth,
+ encoding => $encoding,
+ is_valid_utf8 => $is_valid_utf8,
+ };
+ }
+
+} # PARSE
+
+
+sub _decode_surrogates { # from perlunicode
+ my $uni = 0x10000 + (hex($_[0]) - 0xD800) * 0x400 + (hex($_[1]) - 0xDC00);
+ my $un = pack('U*', $uni);
+ utf8::encode( $un );
+ return $un;
+}
+
+
+sub _decode_unicode {
+ my $un = pack('U', hex shift);
+ utf8::encode( $un );
+ return $un;
+}
+
+#
+# Setup for various Perl versions (the code from JSON::PP58)
+#
+
+BEGIN {
+
+ unless ( defined &utf8::is_utf8 ) {
+ require Encode;
+ *utf8::is_utf8 = *Encode::is_utf8;
+ }
+
+ if ( $] >= 5.008 ) {
+ *JSON::PP::JSON_PP_encode_ascii = \&_encode_ascii;
+ *JSON::PP::JSON_PP_encode_latin1 = \&_encode_latin1;
+ *JSON::PP::JSON_PP_decode_surrogates = \&_decode_surrogates;
+ *JSON::PP::JSON_PP_decode_unicode = \&_decode_unicode;
+ }
+
+ if ($] >= 5.008 and $] < 5.008003) { # join() in 5.8.0 - 5.8.2 is broken.
+ package JSON::PP;
+ require subs;
+ subs->import('join');
+ eval q|
+ sub join {
+ return '' if (@_ < 2);
+ my $j = shift;
+ my $str = shift;
+ for (@_) { $str .= $j . $_; }
+ return $str;
+ }
+ |;
+ }
+
+
+ sub JSON::PP::incr_parse {
+ local $Carp::CarpLevel = 1;
+ ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_parse( @_ );
+ }
+
+
+ sub JSON::PP::incr_skip {
+ ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_skip;
+ }
+
+
+ sub JSON::PP::incr_reset {
+ ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_reset;
+ }
+
+ eval q{
+ sub JSON::PP::incr_text : lvalue {
+ $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new;
+
+ if ( $_[0]->{_incr_parser}->{incr_parsing} ) {
+ Carp::croak("incr_text can not be called when the incremental parser already started parsing");
+ }
+ $_[0]->{_incr_parser}->{incr_text};
+ }
+ } if ( $] >= 5.006 );
+
+} # Setup for various Perl versions (the code from JSON::PP58)
+
+
+###############################
+# Utilities
+#
+
+BEGIN {
+ eval 'require Scalar::Util';
+ unless($@){
+ *JSON::PP::blessed = \&Scalar::Util::blessed;
+ *JSON::PP::reftype = \&Scalar::Util::reftype;
+ *JSON::PP::refaddr = \&Scalar::Util::refaddr;
+ }
+ else{ # This code is from Sclar::Util.
+ # warn $@;
+ eval 'sub UNIVERSAL::a_sub_not_likely_to_be_here { ref($_[0]) }';
+ *JSON::PP::blessed = sub {
+ local($@, $SIG{__DIE__}, $SIG{__WARN__});
+ ref($_[0]) ? eval { $_[0]->a_sub_not_likely_to_be_here } : undef;
+ };
+ my %tmap = qw(
+ B::NULL SCALAR
+ B::HV HASH
+ B::AV ARRAY
+ B::CV CODE
+ B::IO IO
+ B::GV GLOB
+ B::REGEXP REGEXP
+ );
+ *JSON::PP::reftype = sub {
+ my $r = shift;
+
+ return undef unless length(ref($r));
+
+ my $t = ref(B::svref_2object($r));
+
+ return
+ exists $tmap{$t} ? $tmap{$t}
+ : length(ref($$r)) ? 'REF'
+ : 'SCALAR';
+ };
+ *JSON::PP::refaddr = sub {
+ return undef unless length(ref($_[0]));
+
+ my $addr;
+ if(defined(my $pkg = blessed($_[0]))) {
+ $addr .= bless $_[0], 'Scalar::Util::Fake';
+ bless $_[0], $pkg;
+ }
+ else {
+ $addr .= $_[0]
+ }
+
+ $addr =~ /0x(\w+)/;
+ local $^W;
+ #no warnings 'portable';
+ hex($1);
+ }
+ }
+}
+
+
+# shamely copied and modified from JSON::XS code.
+
+$JSON::PP::true = do { bless \(my $dummy = 1), "JSON::backportPP::Boolean" };
+$JSON::PP::false = do { bless \(my $dummy = 0), "JSON::backportPP::Boolean" };
+
+sub is_bool { defined $_[0] and UNIVERSAL::isa($_[0], "JSON::PP::Boolean"); }
+
+sub true { $JSON::PP::true }
+sub false { $JSON::PP::false }
+sub null { undef; }
+
+###############################
+
+package JSON::backportPP::Boolean;
+
+@JSON::backportPP::Boolean::ISA = ('JSON::PP::Boolean');
+use overload (
+ "0+" => sub { ${$_[0]} },
+ "++" => sub { $_[0] = ${$_[0]} + 1 },
+ "--" => sub { $_[0] = ${$_[0]} - 1 },
+ fallback => 1,
+);
+
+
+###############################
+
+package
+ JSON::PP::IncrParser;
+
+use strict;
+
+use constant INCR_M_WS => 0; # initial whitespace skipping
+use constant INCR_M_STR => 1; # inside string
+use constant INCR_M_BS => 2; # inside backslash
+use constant INCR_M_JSON => 3; # outside anything, count nesting
+use constant INCR_M_C0 => 4;
+use constant INCR_M_C1 => 5;
+
+$JSON::PP::IncrParser::VERSION = '1.01';
+
+my $unpack_format = $] < 5.006 ? 'C*' : 'U*';
+
+sub new {
+ my ( $class ) = @_;
+
+ bless {
+ incr_nest => 0,
+ incr_text => undef,
+ incr_parsing => 0,
+ incr_p => 0,
+ }, $class;
+}
+
+
+sub incr_parse {
+ my ( $self, $coder, $text ) = @_;
+
+ $self->{incr_text} = '' unless ( defined $self->{incr_text} );
+
+ if ( defined $text ) {
+ if ( utf8::is_utf8( $text ) and !utf8::is_utf8( $self->{incr_text} ) ) {
+ utf8::upgrade( $self->{incr_text} ) ;
+ utf8::decode( $self->{incr_text} ) ;
+ }
+ $self->{incr_text} .= $text;
+ }
+
+
+ my $max_size = $coder->get_max_size;
+
+ if ( defined wantarray ) {
+
+ $self->{incr_mode} = INCR_M_WS unless defined $self->{incr_mode};
+
+ if ( wantarray ) {
+ my @ret;
+
+ $self->{incr_parsing} = 1;
+
+ do {
+ push @ret, $self->_incr_parse( $coder, $self->{incr_text} );
+
+ unless ( !$self->{incr_nest} and $self->{incr_mode} == INCR_M_JSON ) {
+ $self->{incr_mode} = INCR_M_WS if $self->{incr_mode} != INCR_M_STR;
+ }
+
+ } until ( length $self->{incr_text} >= $self->{incr_p} );
+
+ $self->{incr_parsing} = 0;
+
+ return @ret;
+ }
+ else { # in scalar context
+ $self->{incr_parsing} = 1;
+ my $obj = $self->_incr_parse( $coder, $self->{incr_text} );
+ $self->{incr_parsing} = 0 if defined $obj; # pointed by Martin J. Evans
+ return $obj ? $obj : undef; # $obj is an empty string, parsing was completed.
+ }
+
+ }
+
+}
+
+
+sub _incr_parse {
+ my ( $self, $coder, $text, $skip ) = @_;
+ my $p = $self->{incr_p};
+ my $restore = $p;
+
+ my @obj;
+ my $len = length $text;
+
+ if ( $self->{incr_mode} == INCR_M_WS ) {
+ while ( $len > $p ) {
+ my $s = substr( $text, $p, 1 );
+ $p++ and next if ( 0x20 >= unpack($unpack_format, $s) );
+ $self->{incr_mode} = INCR_M_JSON;
+ last;
+ }
+ }
+
+ while ( $len > $p ) {
+ my $s = substr( $text, $p++, 1 );
+
+ if ( $s eq '"' ) {
+ if (substr( $text, $p - 2, 1 ) eq '\\' ) {
+ next;
+ }
+
+ if ( $self->{incr_mode} != INCR_M_STR ) {
+ $self->{incr_mode} = INCR_M_STR;
+ }
+ else {
+ $self->{incr_mode} = INCR_M_JSON;
+ unless ( $self->{incr_nest} ) {
+ last;
+ }
+ }
+ }
+
+ if ( $self->{incr_mode} == INCR_M_JSON ) {
+
+ if ( $s eq '[' or $s eq '{' ) {
+ if ( ++$self->{incr_nest} > $coder->get_max_depth ) {
+ Carp::croak('json text or perl structure exceeds maximum nesting level (max_depth set too low?)');
+ }
+ }
+ elsif ( $s eq ']' or $s eq '}' ) {
+ last if ( --$self->{incr_nest} <= 0 );
+ }
+ elsif ( $s eq '#' ) {
+ while ( $len > $p ) {
+ last if substr( $text, $p++, 1 ) eq "\n";
+ }
+ }
+
+ }
+
+ }
+
+ $self->{incr_p} = $p;
+
+ return if ( $self->{incr_mode} == INCR_M_STR and not $self->{incr_nest} );
+ return if ( $self->{incr_mode} == INCR_M_JSON and $self->{incr_nest} > 0 );
+
+ return '' unless ( length substr( $self->{incr_text}, 0, $p ) );
+
+ local $Carp::CarpLevel = 2;
+
+ $self->{incr_p} = $restore;
+ $self->{incr_c} = $p;
+
+ my ( $obj, $tail ) = $coder->PP_decode_json( substr( $self->{incr_text}, 0, $p ), 0x10000001 );
+
+ $self->{incr_text} = substr( $self->{incr_text}, $p );
+ $self->{incr_p} = 0;
+
+ return $obj or '';
+}
+
+
+sub incr_text {
+ if ( $_[0]->{incr_parsing} ) {
+ Carp::croak("incr_text can not be called when the incremental parser already started parsing");
+ }
+ $_[0]->{incr_text};
+}
+
+
+sub incr_skip {
+ my $self = shift;
+ $self->{incr_text} = substr( $self->{incr_text}, $self->{incr_c} );
+ $self->{incr_p} = 0;
+}
+
+
+sub incr_reset {
+ my $self = shift;
+ $self->{incr_text} = undef;
+ $self->{incr_p} = 0;
+ $self->{incr_mode} = 0;
+ $self->{incr_nest} = 0;
+ $self->{incr_parsing} = 0;
+}
+
+###############################
+
+
+1;
+__END__
+=pod
+
+=head1 NAME
+
+JSON::PP - JSON::XS compatible pure-Perl module.
+
+=head1 SYNOPSIS
+
+ use JSON::PP;
+
+ # exported functions, they croak on error
+ # and expect/generate UTF-8
+
+ $utf8_encoded_json_text = encode_json $perl_hash_or_arrayref;
+ $perl_hash_or_arrayref = decode_json $utf8_encoded_json_text;
+
+ # OO-interface
+
+ $coder = JSON::PP->new->ascii->pretty->allow_nonref;
+
+ $json_text = $json->encode( $perl_scalar );
+ $perl_scalar = $json->decode( $json_text );
+
+ $pretty_printed = $json->pretty->encode( $perl_scalar ); # pretty-printing
+
+ # Note that JSON version 2.0 and above will automatically use
+ # JSON::XS or JSON::PP, so you should be able to just:
+
+ use JSON;
+
+
+=head1 VERSION
+
+ 2.27200
+
+L<JSON::XS> 2.27 (~2.30) compatible.
+
+=head1 DESCRIPTION
+
+This module is L<JSON::XS> compatible pure Perl module.
+(Perl 5.8 or later is recommended)
+
+JSON::XS is the fastest and most proper JSON module on CPAN.
+It is written by Marc Lehmann in C, so must be compiled and
+installed in the used environment.
+
+JSON::PP is a pure-Perl module and has compatibility to JSON::XS.
+
+
+=head2 FEATURES
+
+=over
+
+=item * correct unicode handling
+
+This module knows how to handle Unicode (depending on Perl version).
+
+See to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL> and L<UNICODE HANDLING ON PERLS>.
+
+
+=item * round-trip integrity
+
+When you serialise a perl data structure using only data types supported
+by JSON and Perl, the deserialised data structure is identical on the Perl
+level. (e.g. the string "2.0" doesn't suddenly become "2" just because
+it looks like a number). There I<are> minor exceptions to this, read the
+MAPPING section below to learn about those.
+
+
+=item * strict checking of JSON correctness
+
+There is no guessing, no generating of illegal JSON texts by default,
+and only JSON is accepted as input by default (the latter is a security feature).
+But when some options are set, loose chcking features are available.
+
+=back
+
+=head1 FUNCTIONAL INTERFACE
+
+Some documents are copied and modified from L<JSON::XS/FUNCTIONAL INTERFACE>.
+
+=head2 encode_json
+
+ $json_text = encode_json $perl_scalar
+
+Converts the given Perl data structure to a UTF-8 encoded, binary string.
+
+This function call is functionally identical to:
+
+ $json_text = JSON::PP->new->utf8->encode($perl_scalar)
+
+=head2 decode_json
+
+ $perl_scalar = decode_json $json_text
+
+The opposite of C<encode_json>: expects an UTF-8 (binary) string and tries
+to parse that as an UTF-8 encoded JSON text, returning the resulting
+reference.
+
+This function call is functionally identical to:
+
+ $perl_scalar = JSON::PP->new->utf8->decode($json_text)
+
+=head2 JSON::PP::is_bool
+
+ $is_boolean = JSON::PP::is_bool($scalar)
+
+Returns true if the passed scalar represents either JSON::PP::true or
+JSON::PP::false, two constants that act like C<1> and C<0> respectively
+and are also used to represent JSON C<true> and C<false> in Perl strings.
+
+=head2 JSON::PP::true
+
+Returns JSON true value which is blessed object.
+It C<isa> JSON::PP::Boolean object.
+
+=head2 JSON::PP::false
+
+Returns JSON false value which is blessed object.
+It C<isa> JSON::PP::Boolean object.
+
+=head2 JSON::PP::null
+
+Returns C<undef>.
+
+See L<MAPPING>, below, for more information on how JSON values are mapped to
+Perl.
+
+
+=head1 HOW DO I DECODE A DATA FROM OUTER AND ENCODE TO OUTER
+
+This section supposes that your perl vresion is 5.8 or later.
+
+If you know a JSON text from an outer world - a network, a file content, and so on,
+is encoded in UTF-8, you should use C<decode_json> or C<JSON> module object
+with C<utf8> enable. And the decoded result will contain UNICODE characters.
+
+ # from network
+ my $json = JSON::PP->new->utf8;
+ my $json_text = CGI->new->param( 'json_data' );
+ my $perl_scalar = $json->decode( $json_text );
+
+ # from file content
+ local $/;
+ open( my $fh, '<', 'json.data' );
+ $json_text = <$fh>;
+ $perl_scalar = decode_json( $json_text );
+
+If an outer data is not encoded in UTF-8, firstly you should C<decode> it.
+
+ use Encode;
+ local $/;
+ open( my $fh, '<', 'json.data' );
+ my $encoding = 'cp932';
+ my $unicode_json_text = decode( $encoding, <$fh> ); # UNICODE
+
+ # or you can write the below code.
+ #
+ # open( my $fh, "<:encoding($encoding)", 'json.data' );
+ # $unicode_json_text = <$fh>;
+
+In this case, C<$unicode_json_text> is of course UNICODE string.
+So you B<cannot> use C<decode_json> nor C<JSON> module object with C<utf8> enable.
+Instead of them, you use C<JSON> module object with C<utf8> disable.
+
+ $perl_scalar = $json->utf8(0)->decode( $unicode_json_text );
+
+Or C<encode 'utf8'> and C<decode_json>:
+
+ $perl_scalar = decode_json( encode( 'utf8', $unicode_json_text ) );
+ # this way is not efficient.
+
+And now, you want to convert your C<$perl_scalar> into JSON data and
+send it to an outer world - a network or a file content, and so on.
+
+Your data usually contains UNICODE strings and you want the converted data to be encoded
+in UTF-8, you should use C<encode_json> or C<JSON> module object with C<utf8> enable.
+
+ print encode_json( $perl_scalar ); # to a network? file? or display?
+ # or
+ print $json->utf8->encode( $perl_scalar );
+
+If C<$perl_scalar> does not contain UNICODE but C<$encoding>-encoded strings
+for some reason, then its characters are regarded as B<latin1> for perl
+(because it does not concern with your $encoding).
+You B<cannot> use C<encode_json> nor C<JSON> module object with C<utf8> enable.
+Instead of them, you use C<JSON> module object with C<utf8> disable.
+Note that the resulted text is a UNICODE string but no problem to print it.
+
+ # $perl_scalar contains $encoding encoded string values
+ $unicode_json_text = $json->utf8(0)->encode( $perl_scalar );
+ # $unicode_json_text consists of characters less than 0x100
+ print $unicode_json_text;
+
+Or C<decode $encoding> all string values and C<encode_json>:
+
+ $perl_scalar->{ foo } = decode( $encoding, $perl_scalar->{ foo } );
+ # ... do it to each string values, then encode_json
+ $json_text = encode_json( $perl_scalar );
+
+This method is a proper way but probably not efficient.
+
+See to L<Encode>, L<perluniintro>.
+
+
+=head1 METHODS
+
+Basically, check to L<JSON> or L<JSON::XS>.
+
+=head2 new
+
+ $json = JSON::PP->new
+
+Rturns a new JSON::PP object that can be used to de/encode JSON
+strings.
+
+All boolean flags described below are by default I<disabled>.
+
+The mutators for flags all return the JSON object again and thus calls can
+be chained:
+
+ my $json = JSON::PP->new->utf8->space_after->encode({a => [1,2]})
+ => {"a": [1, 2]}
+
+=head2 ascii
+
+ $json = $json->ascii([$enable])
+
+ $enabled = $json->get_ascii
+
+If $enable is true (or missing), then the encode method will not generate characters outside
+the code range 0..127. Any Unicode characters outside that range will be escaped using either
+a single \uXXXX or a double \uHHHH\uLLLLL escape sequence, as per RFC4627.
+(See to L<JSON::XS/OBJECT-ORIENTED INTERFACE>).
+
+In Perl 5.005, there is no character having high value (more than 255).
+See to L<UNICODE HANDLING ON PERLS>.
+
+If $enable is false, then the encode method will not escape Unicode characters unless
+required by the JSON syntax or other flags. This results in a faster and more compact format.
+
+ JSON::PP->new->ascii(1)->encode([chr 0x10401])
+ => ["\ud801\udc01"]
+
+=head2 latin1
+
+ $json = $json->latin1([$enable])
+
+ $enabled = $json->get_latin1
+
+If $enable is true (or missing), then the encode method will encode the resulting JSON
+text as latin1 (or iso-8859-1), escaping any characters outside the code range 0..255.
+
+If $enable is false, then the encode method will not escape Unicode characters
+unless required by the JSON syntax or other flags.
+
+ JSON::XS->new->latin1->encode (["\x{89}\x{abc}"]
+ => ["\x{89}\\u0abc"] # (perl syntax, U+abc escaped, U+89 not)
+
+See to L<UNICODE HANDLING ON PERLS>.
+
+=head2 utf8
+
+ $json = $json->utf8([$enable])
+
+ $enabled = $json->get_utf8
+
+If $enable is true (or missing), then the encode method will encode the JSON result
+into UTF-8, as required by many protocols, while the decode method expects to be handled
+an UTF-8-encoded string. Please note that UTF-8-encoded strings do not contain any
+characters outside the range 0..255, they are thus useful for bytewise/binary I/O.
+
+(In Perl 5.005, any character outside the range 0..255 does not exist.
+See to L<UNICODE HANDLING ON PERLS>.)
+
+In future versions, enabling this option might enable autodetection of the UTF-16 and UTF-32
+encoding families, as described in RFC4627.
+
+If $enable is false, then the encode method will return the JSON string as a (non-encoded)
+Unicode string, while decode expects thus a Unicode string. Any decoding or encoding
+(e.g. to UTF-8 or UTF-16) needs to be done yourself, e.g. using the Encode module.
+
+Example, output UTF-16BE-encoded JSON:
+
+ use Encode;
+ $jsontext = encode "UTF-16BE", JSON::PP->new->encode ($object);
+
+Example, decode UTF-32LE-encoded JSON:
+
+ use Encode;
+ $object = JSON::PP->new->decode (decode "UTF-32LE", $jsontext);
+
+
+=head2 pretty
+
+ $json = $json->pretty([$enable])
+
+This enables (or disables) all of the C<indent>, C<space_before> and
+C<space_after> flags in one call to generate the most readable
+(or most compact) form possible.
+
+Equivalent to:
+
+ $json->indent->space_before->space_after
+
+=head2 indent
+
+ $json = $json->indent([$enable])
+
+ $enabled = $json->get_indent
+
+The default indent space length is three.
+You can use C<indent_length> to change the length.
+
+=head2 space_before
+
+ $json = $json->space_before([$enable])
+
+ $enabled = $json->get_space_before
+
+If C<$enable> is true (or missing), then the C<encode> method will add an extra
+optional space before the C<:> separating keys from values in JSON objects.
+
+If C<$enable> is false, then the C<encode> method will not add any extra
+space at those places.
+
+This setting has no effect when decoding JSON texts.
+
+Example, space_before enabled, space_after and indent disabled:
+
+ {"key" :"value"}
+
+=head2 space_after
+
+ $json = $json->space_after([$enable])
+
+ $enabled = $json->get_space_after
+
+If C<$enable> is true (or missing), then the C<encode> method will add an extra
+optional space after the C<:> separating keys from values in JSON objects
+and extra whitespace after the C<,> separating key-value pairs and array
+members.
+
+If C<$enable> is false, then the C<encode> method will not add any extra
+space at those places.
+
+This setting has no effect when decoding JSON texts.
+
+Example, space_before and indent disabled, space_after enabled:
+
+ {"key": "value"}
+
+=head2 relaxed
+
+ $json = $json->relaxed([$enable])
+
+ $enabled = $json->get_relaxed
+
+If C<$enable> is true (or missing), then C<decode> will accept some
+extensions to normal JSON syntax (see below). C<encode> will not be
+affected in anyway. I<Be aware that this option makes you accept invalid
+JSON texts as if they were valid!>. I suggest only to use this option to
+parse application-specific files written by humans (configuration files,
+resource files etc.)
+
+If C<$enable> is false (the default), then C<decode> will only accept
+valid JSON texts.
+
+Currently accepted extensions are:
+
+=over 4
+
+=item * list items can have an end-comma
+
+JSON I<separates> array elements and key-value pairs with commas. This
+can be annoying if you write JSON texts manually and want to be able to
+quickly append elements, so this extension accepts comma at the end of
+such items not just between them:
+
+ [
+ 1,
+ 2, <- this comma not normally allowed
+ ]
+ {
+ "k1": "v1",
+ "k2": "v2", <- this comma not normally allowed
+ }
+
+=item * shell-style '#'-comments
+
+Whenever JSON allows whitespace, shell-style comments are additionally
+allowed. They are terminated by the first carriage-return or line-feed
+character, after which more white-space and comments are allowed.
+
+ [
+ 1, # this comment not allowed in JSON
+ # neither this one...
+ ]
+
+=back
+
+=head2 canonical
+
+ $json = $json->canonical([$enable])
+
+ $enabled = $json->get_canonical
+
+If C<$enable> is true (or missing), then the C<encode> method will output JSON objects
+by sorting their keys. This is adding a comparatively high overhead.
+
+If C<$enable> is false, then the C<encode> method will output key-value
+pairs in the order Perl stores them (which will likely change between runs
+of the same script).
+
+This option is useful if you want the same data structure to be encoded as
+the same JSON text (given the same overall settings). If it is disabled,
+the same hash might be encoded differently even if contains the same data,
+as key-value pairs have no inherent ordering in Perl.
+
+This setting has no effect when decoding JSON texts.
+
+If you want your own sorting routine, you can give a code referece
+or a subroutine name to C<sort_by>. See to C<JSON::PP OWN METHODS>.
+
+=head2 allow_nonref
+
+ $json = $json->allow_nonref([$enable])
+
+ $enabled = $json->get_allow_nonref
+
+If C<$enable> is true (or missing), then the C<encode> method can convert a
+non-reference into its corresponding string, number or null JSON value,
+which is an extension to RFC4627. Likewise, C<decode> will accept those JSON
+values instead of croaking.
+
+If C<$enable> is false, then the C<encode> method will croak if it isn't
+passed an arrayref or hashref, as JSON texts must either be an object
+or array. Likewise, C<decode> will croak if given something that is not a
+JSON object or array.
+
+ JSON::PP->new->allow_nonref->encode ("Hello, World!")
+ => "Hello, World!"
+
+=head2 allow_unknown
+
+ $json = $json->allow_unknown ([$enable])
+
+ $enabled = $json->get_allow_unknown
+
+If $enable is true (or missing), then "encode" will *not* throw an
+exception when it encounters values it cannot represent in JSON (for
+example, filehandles) but instead will encode a JSON "null" value.
+Note that blessed objects are not included here and are handled
+separately by c<allow_nonref>.
+
+If $enable is false (the default), then "encode" will throw an
+exception when it encounters anything it cannot encode as JSON.
+
+This option does not affect "decode" in any way, and it is
+recommended to leave it off unless you know your communications
+partner.
+
+=head2 allow_blessed
+
+ $json = $json->allow_blessed([$enable])
+
+ $enabled = $json->get_allow_blessed
+
+If C<$enable> is true (or missing), then the C<encode> method will not
+barf when it encounters a blessed reference. Instead, the value of the
+B<convert_blessed> option will decide whether C<null> (C<convert_blessed>
+disabled or no C<TO_JSON> method found) or a representation of the
+object (C<convert_blessed> enabled and C<TO_JSON> method found) is being
+encoded. Has no effect on C<decode>.
+
+If C<$enable> is false (the default), then C<encode> will throw an
+exception when it encounters a blessed object.
+
+=head2 convert_blessed
+
+ $json = $json->convert_blessed([$enable])
+
+ $enabled = $json->get_convert_blessed
+
+If C<$enable> is true (or missing), then C<encode>, upon encountering a
+blessed object, will check for the availability of the C<TO_JSON> method
+on the object's class. If found, it will be called in scalar context
+and the resulting scalar will be encoded instead of the object. If no
+C<TO_JSON> method is found, the value of C<allow_blessed> will decide what
+to do.
+
+The C<TO_JSON> method may safely call die if it wants. If C<TO_JSON>
+returns other blessed objects, those will be handled in the same
+way. C<TO_JSON> must take care of not causing an endless recursion cycle
+(== crash) in this case. The name of C<TO_JSON> was chosen because other
+methods called by the Perl core (== not by the user of the object) are
+usually in upper case letters and to avoid collisions with the C<to_json>
+function or method.
+
+This setting does not yet influence C<decode> in any way.
+
+If C<$enable> is false, then the C<allow_blessed> setting will decide what
+to do when a blessed object is found.
+
+=head2 filter_json_object
+
+ $json = $json->filter_json_object([$coderef])
+
+When C<$coderef> is specified, it will be called from C<decode> each
+time it decodes a JSON object. The only argument passed to the coderef
+is a reference to the newly-created hash. If the code references returns
+a single scalar (which need not be a reference), this value
+(i.e. a copy of that scalar to avoid aliasing) is inserted into the
+deserialised data structure. If it returns an empty list
+(NOTE: I<not> C<undef>, which is a valid scalar), the original deserialised
+hash will be inserted. This setting can slow down decoding considerably.
+
+When C<$coderef> is omitted or undefined, any existing callback will
+be removed and C<decode> will not change the deserialised hash in any
+way.
+
+Example, convert all JSON objects into the integer 5:
+
+ my $js = JSON::PP->new->filter_json_object (sub { 5 });
+ # returns [5]
+ $js->decode ('[{}]'); # the given subroutine takes a hash reference.
+ # throw an exception because allow_nonref is not enabled
+ # so a lone 5 is not allowed.
+ $js->decode ('{"a":1, "b":2}');
+
+=head2 filter_json_single_key_object
+
+ $json = $json->filter_json_single_key_object($key [=> $coderef])
+
+Works remotely similar to C<filter_json_object>, but is only called for
+JSON objects having a single key named C<$key>.
+
+This C<$coderef> is called before the one specified via
+C<filter_json_object>, if any. It gets passed the single value in the JSON
+object. If it returns a single value, it will be inserted into the data
+structure. If it returns nothing (not even C<undef> but the empty list),
+the callback from C<filter_json_object> will be called next, as if no
+single-key callback were specified.
+
+If C<$coderef> is omitted or undefined, the corresponding callback will be
+disabled. There can only ever be one callback for a given key.
+
+As this callback gets called less often then the C<filter_json_object>
+one, decoding speed will not usually suffer as much. Therefore, single-key
+objects make excellent targets to serialise Perl objects into, especially
+as single-key JSON objects are as close to the type-tagged value concept
+as JSON gets (it's basically an ID/VALUE tuple). Of course, JSON does not
+support this in any way, so you need to make sure your data never looks
+like a serialised Perl hash.
+
+Typical names for the single object key are C<__class_whatever__>, or
+C<$__dollars_are_rarely_used__$> or C<}ugly_brace_placement>, or even
+things like C<__class_md5sum(classname)__>, to reduce the risk of clashing
+with real hashes.
+
+Example, decode JSON objects of the form C<< { "__widget__" => <id> } >>
+into the corresponding C<< $WIDGET{<id>} >> object:
+
+ # return whatever is in $WIDGET{5}:
+ JSON::PP
+ ->new
+ ->filter_json_single_key_object (__widget__ => sub {
+ $WIDGET{ $_[0] }
+ })
+ ->decode ('{"__widget__": 5')
+
+ # this can be used with a TO_JSON method in some "widget" class
+ # for serialisation to json:
+ sub WidgetBase::TO_JSON {
+ my ($self) = @_;
+
+ unless ($self->{id}) {
+ $self->{id} = ..get..some..id..;
+ $WIDGET{$self->{id}} = $self;
+ }
+
+ { __widget__ => $self->{id} }
+ }
+
+=head2 shrink
+
+ $json = $json->shrink([$enable])
+
+ $enabled = $json->get_shrink
+
+In JSON::XS, this flag resizes strings generated by either
+C<encode> or C<decode> to their minimum size possible.
+It will also try to downgrade any strings to octet-form if possible.
+
+In JSON::PP, it is noop about resizing strings but tries
+C<utf8::downgrade> to the returned string by C<encode>.
+See to L<utf8>.
+
+See to L<JSON::XS/OBJECT-ORIENTED INTERFACE>
+
+=head2 max_depth
+
+ $json = $json->max_depth([$maximum_nesting_depth])
+
+ $max_depth = $json->get_max_depth
+
+Sets the maximum nesting level (default C<512>) accepted while encoding
+or decoding. If a higher nesting level is detected in JSON text or a Perl
+data structure, then the encoder and decoder will stop and croak at that
+point.
+
+Nesting level is defined by number of hash- or arrayrefs that the encoder
+needs to traverse to reach a given point or the number of C<{> or C<[>
+characters without their matching closing parenthesis crossed to reach a
+given character in a string.
+
+If no argument is given, the highest possible setting will be used, which
+is rarely useful.
+
+See L<JSON::XS/SSECURITY CONSIDERATIONS> for more info on why this is useful.
+
+When a large value (100 or more) was set and it de/encodes a deep nested object/text,
+it may raise a warning 'Deep recursion on subroutin' at the perl runtime phase.
+
+=head2 max_size
+
+ $json = $json->max_size([$maximum_string_size])
+
+ $max_size = $json->get_max_size
+
+Set the maximum length a JSON text may have (in bytes) where decoding is
+being attempted. The default is C<0>, meaning no limit. When C<decode>
+is called on a string that is longer then this many bytes, it will not
+attempt to decode the string but throw an exception. This setting has no
+effect on C<encode> (yet).
+
+If no argument is given, the limit check will be deactivated (same as when
+C<0> is specified).
+
+See L<JSON::XS/SSECURITY CONSIDERATIONS> for more info on why this is useful.
+
+=head2 encode
+
+ $json_text = $json->encode($perl_scalar)
+
+Converts the given Perl data structure (a simple scalar or a reference
+to a hash or array) to its JSON representation. Simple scalars will be
+converted into JSON string or number sequences, while references to arrays
+become JSON arrays and references to hashes become JSON objects. Undefined
+Perl values (e.g. C<undef>) become JSON C<null> values.
+References to the integers C<0> and C<1> are converted into C<true> and C<false>.
+
+=head2 decode
+
+ $perl_scalar = $json->decode($json_text)
+
+The opposite of C<encode>: expects a JSON text and tries to parse it,
+returning the resulting simple scalar or reference. Croaks on error.
+
+JSON numbers and strings become simple Perl scalars. JSON arrays become
+Perl arrayrefs and JSON objects become Perl hashrefs. C<true> becomes
+C<1> (C<JSON::true>), C<false> becomes C<0> (C<JSON::false>) and
+C<null> becomes C<undef>.
+
+=head2 decode_prefix
+
+ ($perl_scalar, $characters) = $json->decode_prefix($json_text)
+
+This works like the C<decode> method, but instead of raising an exception
+when there is trailing garbage after the first JSON object, it will
+silently stop parsing there and return the number of characters consumed
+so far.
+
+ JSON->new->decode_prefix ("[1] the tail")
+ => ([], 3)
+
+=head1 INCREMENTAL PARSING
+
+Most of this section are copied and modified from L<JSON::XS/INCREMENTAL PARSING>.
+
+In some cases, there is the need for incremental parsing of JSON texts.
+This module does allow you to parse a JSON stream incrementally.
+It does so by accumulating text until it has a full JSON object, which
+it then can decode. This process is similar to using C<decode_prefix>
+to see if a full JSON object is available, but is much more efficient
+(and can be implemented with a minimum of method calls).
+
+This module will only attempt to parse the JSON text once it is sure it
+has enough text to get a decisive result, using a very simple but
+truly incremental parser. This means that it sometimes won't stop as
+early as the full parser, for example, it doesn't detect parenthese
+mismatches. The only thing it guarantees is that it starts decoding as
+soon as a syntactically valid JSON text has been seen. This means you need
+to set resource limits (e.g. C<max_size>) to ensure the parser will stop
+parsing in the presence if syntax errors.
+
+The following methods implement this incremental parser.
+
+=head2 incr_parse
+
+ $json->incr_parse( [$string] ) # void context
+
+ $obj_or_undef = $json->incr_parse( [$string] ) # scalar context
+
+ @obj_or_empty = $json->incr_parse( [$string] ) # list context
+
+This is the central parsing function. It can both append new text and
+extract objects from the stream accumulated so far (both of these
+functions are optional).
+
+If C<$string> is given, then this string is appended to the already
+existing JSON fragment stored in the C<$json> object.
+
+After that, if the function is called in void context, it will simply
+return without doing anything further. This can be used to add more text
+in as many chunks as you want.
+
+If the method is called in scalar context, then it will try to extract
+exactly I<one> JSON object. If that is successful, it will return this
+object, otherwise it will return C<undef>. If there is a parse error,
+this method will croak just as C<decode> would do (one can then use
+C<incr_skip> to skip the errornous part). This is the most common way of
+using the method.
+
+And finally, in list context, it will try to extract as many objects
+from the stream as it can find and return them, or the empty list
+otherwise. For this to work, there must be no separators between the JSON
+objects or arrays, instead they must be concatenated back-to-back. If
+an error occurs, an exception will be raised as in the scalar context
+case. Note that in this case, any previously-parsed JSON texts will be
+lost.
+
+Example: Parse some JSON arrays/objects in a given string and return them.
+
+ my @objs = JSON->new->incr_parse ("[5][7][1,2]");
+
+=head2 incr_text
+
+ $lvalue_string = $json->incr_text
+
+This method returns the currently stored JSON fragment as an lvalue, that
+is, you can manipulate it. This I<only> works when a preceding call to
+C<incr_parse> in I<scalar context> successfully returned an object. Under
+all other circumstances you must not call this function (I mean it.
+although in simple tests it might actually work, it I<will> fail under
+real world conditions). As a special exception, you can also call this
+method before having parsed anything.
+
+This function is useful in two cases: a) finding the trailing text after a
+JSON object or b) parsing multiple JSON objects separated by non-JSON text
+(such as commas).
+
+ $json->incr_text =~ s/\s*,\s*//;
+
+In Perl 5.005, C<lvalue> attribute is not available.
+You must write codes like the below:
+
+ $string = $json->incr_text;
+ $string =~ s/\s*,\s*//;
+ $json->incr_text( $string );
+
+=head2 incr_skip
+
+ $json->incr_skip
+
+This will reset the state of the incremental parser and will remove the
+parsed text from the input buffer. This is useful after C<incr_parse>
+died, in which case the input buffer and incremental parser state is left
+unchanged, to skip the text parsed so far and to reset the parse state.
+
+=head2 incr_reset
+
+ $json->incr_reset
+
+This completely resets the incremental parser, that is, after this call,
+it will be as if the parser had never parsed anything.
+
+This is useful if you want ot repeatedly parse JSON objects and want to
+ignore any trailing data, which means you have to reset the parser after
+each successful decode.
+
+See to L<JSON::XS/INCREMENTAL PARSING> for examples.
+
+
+=head1 JSON::PP OWN METHODS
+
+=head2 allow_singlequote
+
+ $json = $json->allow_singlequote([$enable])
+
+If C<$enable> is true (or missing), then C<decode> will accept
+JSON strings quoted by single quotations that are invalid JSON
+format.
+
+ $json->allow_singlequote->decode({"foo":'bar'});
+ $json->allow_singlequote->decode({'foo':"bar"});
+ $json->allow_singlequote->decode({'foo':'bar'});
+
+As same as the C<relaxed> option, this option may be used to parse
+application-specific files written by humans.
+
+
+=head2 allow_barekey
+
+ $json = $json->allow_barekey([$enable])
+
+If C<$enable> is true (or missing), then C<decode> will accept
+bare keys of JSON object that are invalid JSON format.
+
+As same as the C<relaxed> option, this option may be used to parse
+application-specific files written by humans.
+
+ $json->allow_barekey->decode('{foo:"bar"}');
+
+=head2 allow_bignum
+
+ $json = $json->allow_bignum([$enable])
+
+If C<$enable> is true (or missing), then C<decode> will convert
+the big integer Perl cannot handle as integer into a L<Math::BigInt>
+object and convert a floating number (any) into a L<Math::BigFloat>.
+
+On the contary, C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat>
+objects into JSON numbers with C<allow_blessed> enable.
+
+ $json->allow_nonref->allow_blessed->allow_bignum;
+ $bigfloat = $json->decode('2.000000000000000000000000001');
+ print $json->encode($bigfloat);
+ # => 2.000000000000000000000000001
+
+See to L<JSON::XS/MAPPING> aboout the normal conversion of JSON number.
+
+=head2 loose
+
+ $json = $json->loose([$enable])
+
+The unescaped [\x00-\x1f\x22\x2f\x5c] strings are invalid in JSON strings
+and the module doesn't allow to C<decode> to these (except for \x2f).
+If C<$enable> is true (or missing), then C<decode> will accept these
+unescaped strings.
+
+ $json->loose->decode(qq|["abc
+ def"]|);
+
+See L<JSON::XS/SSECURITY CONSIDERATIONS>.
+
+=head2 escape_slash
+
+ $json = $json->escape_slash([$enable])
+
+According to JSON Grammar, I<slash> (U+002F) is escaped. But default
+JSON::PP (as same as JSON::XS) encodes strings without escaping slash.
+
+If C<$enable> is true (or missing), then C<encode> will escape slashes.
+
+=head2 indent_length
+
+ $json = $json->indent_length($length)
+
+JSON::XS indent space length is 3 and cannot be changed.
+JSON::PP set the indent space length with the given $length.
+The default is 3. The acceptable range is 0 to 15.
+
+=head2 sort_by
+
+ $json = $json->sort_by($function_name)
+ $json = $json->sort_by($subroutine_ref)
+
+If $function_name or $subroutine_ref are set, its sort routine are used
+in encoding JSON objects.
+
+ $js = $pc->sort_by(sub { $JSON::PP::a cmp $JSON::PP::b })->encode($obj);
+ # is($js, q|{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9}|);
+
+ $js = $pc->sort_by('own_sort')->encode($obj);
+ # is($js, q|{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9}|);
+
+ sub JSON::PP::own_sort { $JSON::PP::a cmp $JSON::PP::b }
+
+As the sorting routine runs in the JSON::PP scope, the given
+subroutine name and the special variables C<$a>, C<$b> will begin
+'JSON::PP::'.
+
+If $integer is set, then the effect is same as C<canonical> on.
+
+=head1 INTERNAL
+
+For developers.
+
+=over
+
+=item PP_encode_box
+
+Returns
+
+ {
+ depth => $depth,
+ indent_count => $indent_count,
+ }
+
+
+=item PP_decode_box
+
+Returns
+
+ {
+ text => $text,
+ at => $at,
+ ch => $ch,
+ len => $len,
+ depth => $depth,
+ encoding => $encoding,
+ is_valid_utf8 => $is_valid_utf8,
+ };
+
+=back
+
+=head1 MAPPING
+
+This section is copied from JSON::XS and modified to C<JSON::PP>.
+JSON::XS and JSON::PP mapping mechanisms are almost equivalent.
+
+See to L<JSON::XS/MAPPING>.
+
+=head2 JSON -> PERL
+
+=over 4
+
+=item object
+
+A JSON object becomes a reference to a hash in Perl. No ordering of object
+keys is preserved (JSON does not preserver object key ordering itself).
+
+=item array
+
+A JSON array becomes a reference to an array in Perl.
+
+=item string
+
+A JSON string becomes a string scalar in Perl - Unicode codepoints in JSON
+are represented by the same codepoints in the Perl string, so no manual
+decoding is necessary.
+
+=item number
+
+A JSON number becomes either an integer, numeric (floating point) or
+string scalar in perl, depending on its range and any fractional parts. On
+the Perl level, there is no difference between those as Perl handles all
+the conversion details, but an integer may take slightly less memory and
+might represent more values exactly than floating point numbers.
+
+If the number consists of digits only, C<JSON> will try to represent
+it as an integer value. If that fails, it will try to represent it as
+a numeric (floating point) value if that is possible without loss of
+precision. Otherwise it will preserve the number as a string value (in
+which case you lose roundtripping ability, as the JSON number will be
+re-encoded toa JSON string).
+
+Numbers containing a fractional or exponential part will always be
+represented as numeric (floating point) values, possibly at a loss of
+precision (in which case you might lose perfect roundtripping ability, but
+the JSON number will still be re-encoded as a JSON number).
+
+Note that precision is not accuracy - binary floating point values cannot
+represent most decimal fractions exactly, and when converting from and to
+floating point, C<JSON> only guarantees precision up to but not including
+the leats significant bit.
+
+When C<allow_bignum> is enable, the big integers
+and the numeric can be optionally converted into L<Math::BigInt> and
+L<Math::BigFloat> objects.
+
+=item true, false
+
+These JSON atoms become C<JSON::PP::true> and C<JSON::PP::false>,
+respectively. They are overloaded to act almost exactly like the numbers
+C<1> and C<0>. You can check wether a scalar is a JSON boolean by using
+the C<JSON::is_bool> function.
+
+ print JSON::PP::true . "\n";
+ => true
+ print JSON::PP::true + 1;
+ => 1
+
+ ok(JSON::true eq '1');
+ ok(JSON::true == 1);
+
+C<JSON> will install these missing overloading features to the backend modules.
+
+
+=item null
+
+A JSON null atom becomes C<undef> in Perl.
+
+C<JSON::PP::null> returns C<unddef>.
+
+=back
+
+
+=head2 PERL -> JSON
+
+The mapping from Perl to JSON is slightly more difficult, as Perl is a
+truly typeless language, so we can only guess which JSON type is meant by
+a Perl value.
+
+=over 4
+
+=item hash references
+
+Perl hash references become JSON objects. As there is no inherent ordering
+in hash keys (or JSON objects), they will usually be encoded in a
+pseudo-random order that can change between runs of the same program but
+stays generally the same within a single run of a program. C<JSON>
+optionally sort the hash keys (determined by the I<canonical> flag), so
+the same datastructure will serialise to the same JSON text (given same
+settings and version of JSON::XS), but this incurs a runtime overhead
+and is only rarely useful, e.g. when you want to compare some JSON text
+against another for equality.
+
+
+=item array references
+
+Perl array references become JSON arrays.
+
+=item other references
+
+Other unblessed references are generally not allowed and will cause an
+exception to be thrown, except for references to the integers C<0> and
+C<1>, which get turned into C<false> and C<true> atoms in JSON. You can
+also use C<JSON::false> and C<JSON::true> to improve readability.
+
+ to_json [\0,JSON::PP::true] # yields [false,true]
+
+=item JSON::PP::true, JSON::PP::false, JSON::PP::null
+
+These special values become JSON true and JSON false values,
+respectively. You can also use C<\1> and C<\0> directly if you want.
+
+JSON::PP::null returns C<undef>.
+
+=item blessed objects
+
+Blessed objects are not directly representable in JSON. See the
+C<allow_blessed> and C<convert_blessed> methods on various options on
+how to deal with this: basically, you can choose between throwing an
+exception, encoding the reference as if it weren't blessed, or provide
+your own serialiser method.
+
+See to L<convert_blessed>.
+
+=item simple scalars
+
+Simple Perl scalars (any scalar that is not a reference) are the most
+difficult objects to encode: JSON::XS and JSON::PP will encode undefined scalars as
+JSON C<null> values, scalars that have last been used in a string context
+before encoding as JSON strings, and anything else as number value:
+
+ # dump as number
+ encode_json [2] # yields [2]
+ encode_json [-3.0e17] # yields [-3e+17]
+ my $value = 5; encode_json [$value] # yields [5]
+
+ # used as string, so dump as string
+ print $value;
+ encode_json [$value] # yields ["5"]
+
+ # undef becomes null
+ encode_json [undef] # yields [null]
+
+You can force the type to be a string by stringifying it:
+
+ my $x = 3.1; # some variable containing a number
+ "$x"; # stringified
+ $x .= ""; # another, more awkward way to stringify
+ print $x; # perl does it for you, too, quite often
+
+You can force the type to be a number by numifying it:
+
+ my $x = "3"; # some variable containing a string
+ $x += 0; # numify it, ensuring it will be dumped as a number
+ $x *= 1; # same thing, the choise is yours.
+
+You can not currently force the type in other, less obscure, ways.
+
+Note that numerical precision has the same meaning as under Perl (so
+binary to decimal conversion follows the same rules as in Perl, which
+can differ to other languages). Also, your perl interpreter might expose
+extensions to the floating point numbers of your platform, such as
+infinities or NaN's - these cannot be represented in JSON, and it is an
+error to pass those in.
+
+=item Big Number
+
+When C<allow_bignum> is enable,
+C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat>
+objects into JSON numbers.
+
+
+=back
+
+=head1 UNICODE HANDLING ON PERLS
+
+If you do not know about Unicode on Perl well,
+please check L<JSON::XS/A FEW NOTES ON UNICODE AND PERL>.
+
+=head2 Perl 5.8 and later
+
+Perl can handle Unicode and the JSON::PP de/encode methods also work properly.
+
+ $json->allow_nonref->encode(chr hex 3042);
+ $json->allow_nonref->encode(chr hex 12345);
+
+Reuturns C<"\u3042"> and C<"\ud808\udf45"> respectively.
+
+ $json->allow_nonref->decode('"\u3042"');
+ $json->allow_nonref->decode('"\ud808\udf45"');
+
+Returns UTF-8 encoded strings with UTF8 flag, regarded as C<U+3042> and C<U+12345>.
+
+Note that the versions from Perl 5.8.0 to 5.8.2, Perl built-in C<join> was broken,
+so JSON::PP wraps the C<join> with a subroutine. Thus JSON::PP works slow in the versions.
+
+
+=head2 Perl 5.6
+
+Perl can handle Unicode and the JSON::PP de/encode methods also work.
+
+=head2 Perl 5.005
+
+Perl 5.005 is a byte sementics world -- all strings are sequences of bytes.
+That means the unicode handling is not available.
+
+In encoding,
+
+ $json->allow_nonref->encode(chr hex 3042); # hex 3042 is 12354.
+ $json->allow_nonref->encode(chr hex 12345); # hex 12345 is 74565.
+
+Returns C<B> and C<E>, as C<chr> takes a value more than 255, it treats
+as C<$value % 256>, so the above codes are equivalent to :
+
+ $json->allow_nonref->encode(chr 66);
+ $json->allow_nonref->encode(chr 69);
+
+In decoding,
+
+ $json->decode('"\u00e3\u0081\u0082"');
+
+The returned is a byte sequence C<0xE3 0x81 0x82> for UTF-8 encoded
+japanese character (C<HIRAGANA LETTER A>).
+And if it is represented in Unicode code point, C<U+3042>.
+
+Next,
+
+ $json->decode('"\u3042"');
+
+We ordinary expect the returned value is a Unicode character C<U+3042>.
+But here is 5.005 world. This is C<0xE3 0x81 0x82>.
+
+ $json->decode('"\ud808\udf45"');
+
+This is not a character C<U+12345> but bytes - C<0xf0 0x92 0x8d 0x85>.
+
+
+=head1 TODO
+
+=over
+
+=item speed
+
+=item memory saving
+
+=back
+
+
+=head1 SEE ALSO
+
+Most of the document are copied and modified from JSON::XS doc.
+
+L<JSON::XS>
+
+RFC4627 (L<http://www.ietf.org/rfc/rfc4627.txt>)
+
+=head1 AUTHOR
+
+Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
+
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007-2011 by Makamaka Hannyaharamitu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
diff --git a/data/lib/JSON/backportPP/Boolean.pm b/data/lib/JSON/backportPP/Boolean.pm
new file mode 100644
index 0000000..2646b8e
--- /dev/null
+++ b/data/lib/JSON/backportPP/Boolean.pm
@@ -0,0 +1,26 @@
+=head1 NAME
+
+JSON::PP::Boolean - dummy module providing JSON::PP::Boolean
+
+=head1 SYNOPSIS
+
+ # do not "use" yourself
+
+=head1 DESCRIPTION
+
+This module exists only to provide overload resolution for Storable and similar modules. See
+L<JSON::PP> for more info about this class.
+
+=cut
+
+use JSON::backportPP ();
+use strict;
+
+1;
+
+=head1 AUTHOR
+
+This idea is from L<JSON::XS::Boolean> written by Marc Lehmann <schmorp[at]schmorp.de>
+
+=cut
+
diff --git a/data/lib/JSON/backportPP/Compat5005.pm b/data/lib/JSON/backportPP/Compat5005.pm
new file mode 100644
index 0000000..f51741c
--- /dev/null
+++ b/data/lib/JSON/backportPP/Compat5005.pm
@@ -0,0 +1,131 @@
+package # This is JSON::backportPP
+ JSON::backportPP5005;
+
+use 5.005;
+use strict;
+
+my @properties;
+
+$JSON::PP5005::VERSION = '1.10';
+
+BEGIN {
+
+ sub utf8::is_utf8 {
+ 0; # It is considered that UTF8 flag off for Perl 5.005.
+ }
+
+ sub utf8::upgrade {
+ }
+
+ sub utf8::downgrade {
+ 1; # must always return true.
+ }
+
+ sub utf8::encode {
+ }
+
+ sub utf8::decode {
+ }
+
+ *JSON::PP::JSON_PP_encode_ascii = \&_encode_ascii;
+ *JSON::PP::JSON_PP_encode_latin1 = \&_encode_latin1;
+ *JSON::PP::JSON_PP_decode_surrogates = \&_decode_surrogates;
+ *JSON::PP::JSON_PP_decode_unicode = \&_decode_unicode;
+
+ # missing in B module.
+ sub B::SVp_IOK () { 0x01000000; }
+ sub B::SVp_NOK () { 0x02000000; }
+ sub B::SVp_POK () { 0x04000000; }
+
+ $INC{'bytes.pm'} = 1; # dummy
+}
+
+
+
+sub _encode_ascii {
+ join('', map { $_ <= 127 ? chr($_) : sprintf('\u%04x', $_) } unpack('C*', $_[0]) );
+}
+
+
+sub _encode_latin1 {
+ join('', map { chr($_) } unpack('C*', $_[0]) );
+}
+
+
+sub _decode_surrogates { # from http://homepage1.nifty.com/nomenclator/unicode/ucs_utf.htm
+ my $uni = 0x10000 + (hex($_[0]) - 0xD800) * 0x400 + (hex($_[1]) - 0xDC00); # from perlunicode
+ my $bit = unpack('B32', pack('N', $uni));
+
+ if ( $bit =~ /^00000000000(...)(......)(......)(......)$/ ) {
+ my ($w, $x, $y, $z) = ($1, $2, $3, $4);
+ return pack('B*', sprintf('11110%s10%s10%s10%s', $w, $x, $y, $z));
+ }
+ else {
+ Carp::croak("Invalid surrogate pair");
+ }
+}
+
+
+sub _decode_unicode {
+ my ($u) = @_;
+ my ($utf8bit);
+
+ if ( $u =~ /^00([89a-f][0-9a-f])$/i ) { # 0x80-0xff
+ return pack( 'H2', $1 );
+ }
+
+ my $bit = unpack("B*", pack("H*", $u));
+
+ if ( $bit =~ /^00000(.....)(......)$/ ) {
+ $utf8bit = sprintf('110%s10%s', $1, $2);
+ }
+ elsif ( $bit =~ /^(....)(......)(......)$/ ) {
+ $utf8bit = sprintf('1110%s10%s10%s', $1, $2, $3);
+ }
+ else {
+ Carp::croak("Invalid escaped unicode");
+ }
+
+ return pack('B*', $utf8bit);
+}
+
+
+sub JSON::PP::incr_text {
+ $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new;
+
+ if ( $_[0]->{_incr_parser}->{incr_parsing} ) {
+ Carp::croak("incr_text can not be called when the incremental parser already started parsing");
+ }
+
+ $_[0]->{_incr_parser}->{incr_text} = $_[1] if ( @_ > 1 );
+ $_[0]->{_incr_parser}->{incr_text};
+}
+
+
+1;
+__END__
+
+=pod
+
+=head1 NAME
+
+JSON::PP5005 - Helper module in using JSON::PP in Perl 5.005
+
+=head1 DESCRIPTION
+
+JSON::PP calls internally.
+
+=head1 AUTHOR
+
+Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
+
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007-2010 by Makamaka Hannyaharamitu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
diff --git a/data/lib/JSON/backportPP/Compat5006.pm b/data/lib/JSON/backportPP/Compat5006.pm
new file mode 100644
index 0000000..820dc93
--- /dev/null
+++ b/data/lib/JSON/backportPP/Compat5006.pm
@@ -0,0 +1,173 @@
+package # This is JSON::backportPP
+ JSON::backportPP56;
+
+use 5.006;
+use strict;
+
+my @properties;
+
+$JSON::PP56::VERSION = '1.08';
+
+BEGIN {
+
+ sub utf8::is_utf8 {
+ my $len = length $_[0]; # char length
+ {
+ use bytes; # byte length;
+ return $len != length $_[0]; # if !=, UTF8-flagged on.
+ }
+ }
+
+
+ sub utf8::upgrade {
+ ; # noop;
+ }
+
+
+ sub utf8::downgrade ($;$) {
+ return 1 unless ( utf8::is_utf8( $_[0] ) );
+
+ if ( _is_valid_utf8( $_[0] ) ) {
+ my $downgrade;
+ for my $c ( unpack( "U*", $_[0] ) ) {
+ if ( $c < 256 ) {
+ $downgrade .= pack("C", $c);
+ }
+ else {
+ $downgrade .= pack("U", $c);
+ }
+ }
+ $_[0] = $downgrade;
+ return 1;
+ }
+ else {
+ Carp::croak("Wide character in subroutine entry") unless ( $_[1] );
+ 0;
+ }
+ }
+
+
+ sub utf8::encode ($) { # UTF8 flag off
+ if ( utf8::is_utf8( $_[0] ) ) {
+ $_[0] = pack( "C*", unpack( "C*", $_[0] ) );
+ }
+ else {
+ $_[0] = pack( "U*", unpack( "C*", $_[0] ) );
+ $_[0] = pack( "C*", unpack( "C*", $_[0] ) );
+ }
+ }
+
+
+ sub utf8::decode ($) { # UTF8 flag on
+ if ( _is_valid_utf8( $_[0] ) ) {
+ utf8::downgrade( $_[0] );
+ $_[0] = pack( "U*", unpack( "U*", $_[0] ) );
+ }
+ }
+
+
+ *JSON::PP::JSON_PP_encode_ascii = \&_encode_ascii;
+ *JSON::PP::JSON_PP_encode_latin1 = \&_encode_latin1;
+ *JSON::PP::JSON_PP_decode_surrogates = \&JSON::PP::_decode_surrogates;
+ *JSON::PP::JSON_PP_decode_unicode = \&JSON::PP::_decode_unicode;
+
+ unless ( defined &B::SVp_NOK ) { # missing in B module.
+ eval q{ sub B::SVp_NOK () { 0x02000000; } };
+ }
+
+}
+
+
+
+sub _encode_ascii {
+ join('',
+ map {
+ $_ <= 127 ?
+ chr($_) :
+ $_ <= 65535 ?
+ sprintf('\u%04x', $_) : sprintf('\u%x\u%x', JSON::PP::_encode_surrogates($_));
+ } _unpack_emu($_[0])
+ );
+}
+
+
+sub _encode_latin1 {
+ join('',
+ map {
+ $_ <= 255 ?
+ chr($_) :
+ $_ <= 65535 ?
+ sprintf('\u%04x', $_) : sprintf('\u%x\u%x', JSON::PP::_encode_surrogates($_));
+ } _unpack_emu($_[0])
+ );
+}
+
+
+sub _unpack_emu { # for Perl 5.6 unpack warnings
+ return !utf8::is_utf8($_[0]) ? unpack('C*', $_[0])
+ : _is_valid_utf8($_[0]) ? unpack('U*', $_[0])
+ : unpack('C*', $_[0]);
+}
+
+
+sub _is_valid_utf8 {
+ my $str = $_[0];
+ my $is_utf8;
+
+ while ($str =~ /(?:
+ (
+ [\x00-\x7F]
+ |[\xC2-\xDF][\x80-\xBF]
+ |[\xE0][\xA0-\xBF][\x80-\xBF]
+ |[\xE1-\xEC][\x80-\xBF][\x80-\xBF]
+ |[\xED][\x80-\x9F][\x80-\xBF]
+ |[\xEE-\xEF][\x80-\xBF][\x80-\xBF]
+ |[\xF0][\x90-\xBF][\x80-\xBF][\x80-\xBF]
+ |[\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]
+ |[\xF4][\x80-\x8F][\x80-\xBF][\x80-\xBF]
+ )
+ | (.)
+ )/xg)
+ {
+ if (defined $1) {
+ $is_utf8 = 1 if (!defined $is_utf8);
+ }
+ else {
+ $is_utf8 = 0 if (!defined $is_utf8);
+ if ($is_utf8) { # eventually, not utf8
+ return;
+ }
+ }
+ }
+
+ return $is_utf8;
+}
+
+
+1;
+__END__
+
+=pod
+
+=head1 NAME
+
+JSON::PP56 - Helper module in using JSON::PP in Perl 5.6
+
+=head1 DESCRIPTION
+
+JSON::PP calls internally.
+
+=head1 AUTHOR
+
+Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
+
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007-2009 by Makamaka Hannyaharamitu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
diff --git a/data/qmi-service-ctl.json b/data/qmi-service-ctl.json
new file mode 100644
index 0000000..1ce2ddc
--- /dev/null
+++ b/data/qmi-service-ctl.json
@@ -0,0 +1,148 @@
+
+[
+ // *********************************************************************************
+ { "name" : "CTL",
+ "type" : "Service" },
+
+ // *********************************************************************************
+ { "name" : "QMI Client CTL",
+ "type" : "Client" },
+
+ // *********************************************************************************
+ { "name" : "QMI Message CTL",
+ "type" : "Message-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "QMI Indication CTL",
+ "type" : "Indication-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "Set Instance ID",
+ "type" : "Message",
+ "service" : "CTL",
+ "id" : "0x0020",
+ "input" : [ { "name" : "ID",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Link ID",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint16",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Version Info",
+ "type" : "Message",
+ "service" : "CTL",
+ "id" : "0x0021",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Service list",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Service",
+ "format" : "struct",
+ "contents" : [ { "name" : "Service",
+ "format" : "guint8",
+ "public-format" : "QmiService" },
+ { "name" : "Major version",
+ "format" : "guint16" },
+ { "name" : "Minor version",
+ "format" : "guint16" } ] },
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Allocate CID",
+ "type" : "Message",
+ "service" : "CTL",
+ "id" : "0x0022",
+ "input" : [ { "name" : "Service",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8" ,
+ "public-format" : "QmiService" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Allocation Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service",
+ "format" : "guint8",
+ "public-format" : "QmiService" },
+ { "name" : "Cid",
+ "format" : "guint8" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Release CID",
+ "type" : "Message",
+ "service" : "CTL",
+ "id" : "0x0023",
+ "input" : [ { "name" : "Release Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service",
+ "format" : "guint8",
+ "public-format" : "QmiService" },
+ { "name" : "Cid",
+ "format" : "guint8" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Release Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service",
+ "format" : "guint8",
+ "public-format" : "QmiService" },
+ { "name" : "Cid",
+ "format" : "guint8" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Data Format",
+ "type" : "Message",
+ "service" : "CTL",
+ "id" : "0x0026",
+ "input" : [ { "name" : "Format",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiCtlDataFormat" },
+ { "name" : "Protocol",
+ "id" : "0x10",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiCtlDataLinkProtocol" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Protocol",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiCtlDataLinkProtocol" } ],
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+
+ // *********************************************************************************
+ { "name" : "Sync",
+ "type" : "Message",
+ "service" : "CTL",
+ "id" : "0x0027",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ { "name" : "Sync",
+ "type" : "Indication",
+ "service" : "CTL",
+ "id" : "0x0027" }
+]
diff --git a/data/qmi-service-dms.json b/data/qmi-service-dms.json
new file mode 100644
index 0000000..39cde82
--- /dev/null
+++ b/data/qmi-service-dms.json
@@ -0,0 +1,1161 @@
+
+[
+ // *********************************************************************************
+ { "name" : "DMS",
+ "type" : "Service" },
+
+ // *********************************************************************************
+ { "name" : "QMI Client DMS",
+ "type" : "Client" },
+
+ // *********************************************************************************
+ { "name" : "QMI Message DMS",
+ "type" : "Message-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "QMI Indication DMS",
+ "type" : "Indication-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "Reset",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0000",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Event Report",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0001",
+ "version" : "1.0",
+ "input" : [ { "name" : "Power State Reporting",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Battery Level Report Limits",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Lower Limit",
+ "format" : "guint8" },
+ { "name" : "Upper Limit",
+ "format" : "guint8" } ] },
+ { "name" : "PIN State Reporting",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Activation State Reporting",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Operating Mode Reporting",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "UIM State Reporting",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Wireless Disable State Reporting",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Init Reporting",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ { "name" : "Event Report",
+ "type" : "Indication",
+ "service" : "DMS",
+ "id" : "0x0001",
+ "output" : [ { "name" : "Power State",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Power State Flags",
+ "format" : "guint8" },
+ { "name" : "Battery Level",
+ "format" : "guint8" } ] },
+ { "name" : "PIN1 Status",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Current Status",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimPinStatus" },
+ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ] },
+ { "name" : "PIN2 Status",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Current Status",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimPinStatus" },
+ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ] },
+ { "name" : "Activation State",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiDmsActivationState" },
+ { "name" : "Operating Mode",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiDmsOperatingMode" },
+ { "name" : "UIM State",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimState" },
+ { "name" : "Wireless Disable State",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Init Notification",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Capabilities",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0020",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Max Tx Channel Rate",
+ "format" : "guint32" },
+ { "name" : "Max Rx Channel Rate",
+ "format" : "guint32" },
+ { "name" : "Data Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiDmsDataServiceCapability" },
+ { "name" : "SIM Capability",
+ "format" : "guint8",
+ "public-format" : "QmiDmsSimCapability" },
+ { "name" : "Radio Interface List",
+ "format" : "array",
+ "array-element" : { "format" : "guint8",
+ "public-format" : "QmiDmsRadioInterface" } } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Manufacturer",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0021",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Manufacturer",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Model",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0022",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Model",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Revision",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0023",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Revision",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get MSISDN",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0024",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "MSISDN",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get IDs",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0025",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Esn",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Imei",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "max-size" : "15",
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Meid",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Power State",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0026",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Power State Flags",
+ "format" : "guint8" },
+ { "name" : "Battery Level",
+ "format" : "guint8" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Set PIN Protection",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0027",
+ "version" : "1.1",
+ "input" : [ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Pin ID",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimPinId" },
+ { "name" : "Protection Enabled",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PIN",
+ "format" : "string" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Pin Retries Status",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ],
+ "prerequisites": [ { "common-ref" : "No Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Verify PIN",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0028",
+ "version" : "1.1",
+ "input" : [ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Pin ID",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimPinId" },
+ { "name" : "PIN",
+ "format" : "string" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Pin Retries Status",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ],
+ "prerequisites": [ { "common-ref" : "No Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Unblock PIN",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0029",
+ "version" : "1.1",
+ "input" : [ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Pin ID",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimPinId" },
+ { "name" : "PUK",
+ "format" : "string" },
+ { "name" : "New PIN",
+ "format" : "string" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Pin Retries Status",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ],
+ "prerequisites": [ { "common-ref" : "No Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Change PIN",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x002A",
+ "version" : "1.1",
+ "input" : [ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Pin ID",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimPinId" },
+ { "name" : "Old PIN",
+ "format" : "string" },
+ { "name" : "New PIN",
+ "format" : "string" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Pin Retries Status",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ],
+ "prerequisites": [ { "common-ref" : "No Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Get PIN Status",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x002B",
+ "version" : "1.1",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "PIN1 Status",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Current Status",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimPinStatus" },
+ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ] },
+ { "name" : "PIN2 Status",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Current Status",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimPinStatus" },
+ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Hardware Revision",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x002C",
+ "version" : "1.2",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Revision",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Operating Mode",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x002D",
+ "version" : "1.2",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Mode",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiDmsOperatingMode",
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Offline Reason",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiDmsOfflineReason",
+ "prerequisites": [ { "field" : "Mode",
+ "operation" : "==",
+ "value" : "QMI_DMS_OPERATING_MODE_OFFLINE" } ] },
+ { "name" : "Hardware Restricted Mode",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Operating Mode",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x002E",
+ "version" : "1.2",
+ "input" : [ { "name" : "Mode",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiDmsOperatingMode" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Time",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x002F",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Device Time",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Time Count",
+ "format" : "guint-sized",
+ "guint-size" : "6" },
+ { "name" : "Time Source",
+ "format" : "guint16",
+ "public-format" : "QmiDmsTimeSource" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "System Time",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "User Time",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get PRL Version",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0030",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Version",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint16",
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "PRL Only Preference",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Activation State",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0031",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiDmsActivationState",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Activate Automatic",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0032",
+ "version" : "1.3",
+ "input" : [ { "name" : "Activation Code",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Activate Manual",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0033",
+ "version" : "1.3",
+ "input" : [ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Programming Code",
+ "format" : "string",
+ "fixed-size" : "6" },
+ { "name" : "System Identification Number",
+ "format" : "string",
+ "fixed-size" : "2" },
+ { "name" : "Mobile Directory Number",
+ "format" : "string",
+ "max-size" : "15" },
+ { "name" : "Mobile Identification Number",
+ "format" : "string",
+ "max-size" : "15" } ] },
+ { "name" : "MN HA key",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "max-size" : "16" },
+ { "name" : "MN AAA key",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "max-size" : "16" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get User Lock State",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0034",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Enabled",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean",
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set User Lock State",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0035",
+ "version" : "1.3",
+ "input" : [ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Enabled",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Lock Code",
+ "format" : "string",
+ "fixed-size" : "4" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Set User Lock Code",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0036",
+ "version" : "1.3",
+ "input" : [ { "name" : "Info",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Old Code",
+ "format" : "string",
+ "fixed-size" : "4" },
+ { "name" : "New Code",
+ "format" : "string",
+ "fixed-size" : "4" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Read User Data",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0037",
+ "version" : "1.6",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "User Data",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Write User Data",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0038",
+ "version" : "1.6",
+ "input" : [ { "name" : "User Data",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Read ERI File",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0039",
+ "version" : "1.6",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "ERI File",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Restore Factory Defaults",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x003A",
+ "version" : "1.6",
+ "input" : [ { "name" : "Service Programming Code",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "fixed-size" : "6" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Validate Service Programming Code",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x003B",
+ "version" : "1.3",
+ "input" : [ { "name" : "Service Programming Code",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "fixed-size" : "6" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Get ICCID",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x003C",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "ICCID",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Get CK Status",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0040",
+ "version" : "1.3",
+ "input" : [ { "name" : "Facility",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimFacility" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "CK Status",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Facility State",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimFacilityState" },
+ { "name" : "Verify Retries Left",
+ "format" : "guint8" },
+ { "name" : "Unblock Retries Left",
+ "format" : "guint8" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Operation Blocking Facility",
+ "id" : "0x10",
+ "mandatory" : "false",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Set CK Protection",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0041",
+ "version" : "1.3",
+ "input" : [ { "name" : "Facility",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Facility",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimFacility" },
+ { "name" : "Facility State",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimFacilityState" },
+ { "name" : "Facility Depersonalization Control Key",
+ "format" : "string" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Verify Retries Left",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Unblock CK",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0042",
+ "version" : "1.3",
+ "input" : [ { "name" : "Facility",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Facility",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimFacility" },
+ { "name" : "Facility Control Key",
+ "format" : "string" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Unblock Retries Left",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Get IMSI",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0043",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "IMSI",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "UIM Get State",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0044",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "State",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiDmsUimState",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Band Capabilities",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0045",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Band Capability",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint64",
+ "public-format" : "QmiDmsBandCapability",
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "LTE Band Capability",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "public-format" : "QmiDmsLteBandCapability",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Factory SKU",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0046",
+ "version" : "1.6",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "SKU",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Firmware Preference",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0047",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "List",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Image",
+ "format" : "struct",
+ "contents" : [ { "name" : "Type",
+ "format" : "guint8",
+ "public-format" : "QmiDmsFirmwareImageType" },
+ { "name" : "Unique ID",
+ "format" : "array",
+ "fixed-size" : "16",
+ "array-element" : { "format": "guint8" } },
+ { "name" : "Build ID",
+ "format" : "string" } ] },
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Firmware Preference",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0048",
+ "version" : "1.3",
+ "input" : [ { "name" : "List",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Image",
+ "format" : "struct",
+ "contents" : [ { "name" : "Type",
+ "format" : "guint8",
+ "public-format" : "QmiDmsFirmwareImageType" },
+ { "name" : "Unique ID",
+ "format" : "array",
+ "fixed-size" : "16",
+ "array-element" : { "format": "guint8" } },
+ { "name" : "Build ID",
+ "format" : "string" } ] } },
+ { "name" : "Download Override",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Modem Storage Index",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Image Download List",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Image Type",
+ "format" : "guint8",
+ "public-format" : "QmiDmsFirmwareImageType" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "List Stored Images",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0049",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "List",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Image",
+ "format" : "struct",
+ "contents" : [ { "name" : "Type",
+ "format" : "guint8",
+ "public-format" : "QmiDmsFirmwareImageType" },
+ { "name" : "Maximum Images",
+ "format" : "guint8" },
+ { "name" : "Index Of Running Image",
+ "format" : "guint8" },
+ { "name" : "Sublist",
+ "format" : "array",
+ "array-element" : { "name" : "Sublist Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Storage Index",
+ "format" : "guint8" },
+ { "name" : "Failure Count",
+ "format" : "guint8" },
+ { "name" : "Unique ID",
+ "format" : "array",
+ "fixed-size" : "16",
+ "array-element" : { "format": "guint8" } },
+ { "name" : "Build ID",
+ "format" : "string" } ] } } ] },
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Delete Stored Image",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x004A",
+ "version" : "1.3",
+ "input" : [ { "name" : "Image",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "struct",
+ "contents" : [ { "name" : "Type",
+ "format" : "guint8",
+ "public-format" : "QmiDmsFirmwareImageType" },
+ { "name" : "Unique ID",
+ "format" : "array",
+ "fixed-size" : "16",
+ "array-element" : { "format": "guint8" } },
+ { "name" : "Build ID",
+ "format" : "string" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Time",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x004B",
+ "version" : "1.4",
+ "input" : [ { "name" : "Time Value",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint64" },
+ { "name" : "Time Reference Type",
+ "id" : "0x10",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint32",
+ "public-format" : "QmiDmsTimeReferenceType" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Stored Image Info",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x004C",
+ "version" : "1.3",
+ "input" : [ { "name" : "Image",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "struct",
+ "contents" : [ { "name" : "Type",
+ "format" : "guint8",
+ "public-format" : "QmiDmsFirmwareImageType" },
+ { "name" : "Unique ID",
+ "format" : "array",
+ "fixed-size" : "16",
+ "array-element" : { "format": "guint8" } },
+ { "name" : "Build ID",
+ "format" : "string" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Boot Version",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Major Version",
+ "format" : "guint16" },
+ { "name" : "Minor Version",
+ "format" : "guint16" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "PRI Version",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "PRI Version",
+ "format" : "guint32" },
+ { "name" : "PRI Info",
+ "format" : "string",
+ "fixed-size" : "32" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "OEM Lock ID",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Alt Net Config",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x004D",
+ "version" : "1.6",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Config",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Alt Net Config",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x004E",
+ "version" : "1.6",
+ "input" : [ { "name" : "Config",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Software Version",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0051",
+ "version" : "1.5",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Version",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Service Programming Code",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x0052",
+ "version" : "1.5",
+ "input" : [ { "name" : "Current",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "fixed-size" : "6" },
+ { "name" : "New",
+ "id" : "0x02",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "fixed-size" : "6" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] }
+
+]
diff --git a/data/qmi-service-nas.json b/data/qmi-service-nas.json
new file mode 100644
index 0000000..49d5088
--- /dev/null
+++ b/data/qmi-service-nas.json
@@ -0,0 +1,2771 @@
+
+[
+ // *********************************************************************************
+ { "name" : "NAS",
+ "type" : "Service" },
+
+ // *********************************************************************************
+ { "name" : "QMI Client NAS",
+ "type" : "Client" },
+
+ // *********************************************************************************
+ { "name" : "QMI Message NAS",
+ "type" : "Message-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "QMI Indication NAS",
+ "type" : "Indication-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "Reset",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0000",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Abort",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0001",
+ "version" : "1.0",
+ // This magic tag allows us to avoid creating a method in the client
+ "scope" : "library-only",
+ "input" : [ { "name" : "Transaction ID",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint16" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Event Report",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0002",
+ "version" : "1.0",
+ "input" : [ { "name" : "Signal Strength Indicator",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Thresholds",
+ "format" : "array",
+ "array-element" : { "format" : "gint8" } } ] },
+ { "name" : "RF Band Information",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Reason",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "RSSI Indicator",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "RSSI Delta",
+ "format" : "guint8" } ] },
+ { "name" : "ECIO Indicator",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "ECIO Delta",
+ "format" : "guint8" } ] },
+ { "name" : "IO Indicator",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "IO Delta",
+ "format" : "guint8" } ] },
+ { "name" : "SINR Indicator",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "SINR Delta",
+ "format" : "guint8" } ] },
+ { "name" : "Error Rate Indicator",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "ECIO Threshold",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Thresholds",
+ "format" : "array",
+ "array-element" : { "format" : "gint16" } } ] },
+ { "name" : "SINR Threshold",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Thresholds",
+ "format" : "array",
+ "array-element" : { "format" : "guint8" } } ] },
+ { "name" : "LTE SNR Delta",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "SNR Delta",
+ "format" : "guint8" } ] },
+ { "name" : "LTE RSRP Delta",
+ "id" : "0x1C",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "RSRP Delta",
+ "format" : "guint8" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ { "name" : "Event Report",
+ "type" : "Indication",
+ "service" : "NAS",
+ "id" : "0x0002",
+ "output" : [ { "name" : "Signal Strength",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Strength",
+ "format" : "gint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] },
+ { "name" : "RF Band Information",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" },
+ { "name" : "Active Band Class",
+ "format" : "guint16",
+ "public-format" : "QmiNasActiveBand" },
+ { "name" : "Active Channel",
+ "format" : "guint16" } ] } },
+ { "name" : "Registration Reject Reason",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Reject Cause",
+ "format" : "guint16" } ] },
+ { "name" : "RSSI",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "guint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] },
+ { "name" : "ECIO",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "ECIO",
+ "format" : "gint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] },
+ { "name" : "IO",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint32" },
+ { "name" : "SINR",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasEvdoSinrLevel" },
+ { "name" : "Error Rate",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Rate",
+ "format" : "guint16" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] },
+ { "name" : "RSRQ",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSRQ",
+ "format" : "gint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] },
+ { "name" : "LTE SNR",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint16" },
+ { "name" : "LTE RSRP",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint16" } ] },
+
+ // *********************************************************************************
+ { "name" : "Register Indications",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0003",
+ "version" : "1.1",
+ "input" : [ { "name" : "System Selection Preference",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "DDTM Events",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Serving System Events",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Dual Standby Preference",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Subscription Info",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Network Time",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "System Info",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Signal Info",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Error Rate",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HDR New UATI Assigned",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HDR Session Closed",
+ "id" : "0x1C",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Managed Roaming",
+ "id" : "0x1D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Current PLMN Name",
+ "id" : "0x1E",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "eMBMS Status",
+ "id" : "0x1F",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "RF Band Information",
+ "id" : "0x20",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Signal Strength",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0020",
+ "version" : "1.0",
+ "input" : [ { "name" : "Request Mask",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiNasSignalStrengthRequest" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Signal Strength",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Strength",
+ "format" : "gint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Strength List",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Strength",
+ "format" : "gint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] } },
+ { "name" : "RSSI List",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "guint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] } },
+ { "name" : "ECIO List",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "ECIO",
+ "format" : "gint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] } },
+ { "name" : "IO",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint32" },
+ { "name" : "SINR",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasEvdoSinrLevel" },
+ { "name" : "Error Rate List",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Rate",
+ "format" : "guint16" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] } },
+ { "name" : "RSRQ",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSRQ",
+ "format" : "gint8" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] },
+ { "name" : "LTE SNR",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint16" },
+ { "name" : "LTE RSRP",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint16" } ] },
+
+ // *********************************************************************************
+ { "name" : "Network Scan",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0021",
+ "version" : "1.0",
+ // This method may be aborted
+ "abort" : "yes",
+ "input" : [ { "name" : "Network Type",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkScanType" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Network Information",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Network Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkStatus" },
+ { "name" : "Description",
+ "format" : "string" } ] } },
+ { "name" : "Radio Access Technology",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] } },
+ { "name" : "MNC PCS Digit Include Status",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Includes PCS Digit",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] } } ] },
+
+ // *********************************************************************************
+ { "name" : "Initiate Network Register",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0022",
+ "version" : "1.0",
+ "input" : [ { "name" : "Action",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkRegisterType" },
+ { "name" : "Manual Registration Info 3GPP",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } ] },
+ { "name" : "Change Duration",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasChangeDuration" },
+ { "name" : "MNC PCS Digit Include Status",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Serving System",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0024",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Serving System",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Registration State",
+ "format" : "guint8",
+ "public-format" : "QmiNasRegistrationState" },
+ { "name" : "CS Attach State",
+ "format" : "guint8",
+ "public-format" : "QmiNasAttachState" },
+ { "name" : "PS Attach State",
+ "format" : "guint8",
+ "public-format" : "QmiNasAttachState" },
+ { "name" : "Selected Network",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkType" },
+ { "name" : "Radio Interfaces",
+ "format" : "array",
+ "array-element" : { "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Roaming Indicator",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingIndicatorStatus" },
+ { "name" : "Data Service Capability",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "guint8",
+ "public-format" : "QmiNasDataCapability" } },
+ { "name" : "Current PLMN",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Description",
+ "format" : "string" } ] },
+ { "name" : "CDMA System ID",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "SID",
+ "format" : "guint16" },
+ { "name" : "NID",
+ "format" : "guint16" } ] },
+ { "name" : "CDMA Base Station Info",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Base Station ID",
+ "format" : "guint16" },
+ { "name" : "Base Station Latitude",
+ "format" : "gint32" },
+ { "name" : "Base Station Longitude",
+ "format" : "gint32" } ] },
+ { "name" : "Roaming Indicator List",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Radio Interface",
+ "format" : "guint8",
+ "public-format" : "QmiNasRadioInterface" },
+ { "name" : "Roaming Indicator",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingIndicatorStatus" } ] } },
+ { "name" : "Default Roaming Indicator",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingIndicatorStatus" },
+ { "name" : "Time Zone 3GPP2",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Leap Seconds",
+ "format" : "guint8" },
+ { "name" : "Local Time Offset",
+ "format" : "gint8" },
+ { "name" : "Daylight Saving Time",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "CDMA P Rev",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" },
+ { "name" : "Time Zone 3GPP",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8" },
+ { "name" : "Daylight Saving Time Adjustment 3GPP",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" },
+ { "name" : "LAC 3GPP",
+ "id" : "0x1C",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16" },
+ { "name" : "CID 3GPP",
+ "id" : "0x1D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "Concurrent Service Info 3GPP2",
+ "id" : "0x1E",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean"},
+ { "name" : "PRL Indicator 3GPP2",
+ "id" : "0x1F",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean"},
+ { "name" : "DTM Support",
+ "id" : "0x20",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean"},
+ { "name" : "Detailed Service Status",
+ "id" : "0x21",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "HDR Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "HDR Hybrid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "CDMA System Info",
+ "id" : "0x22",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "IMSI_11_12",
+ "format" : "guint8" } ] },
+ { "name" : "HDR Personality",
+ "id" : "0x23",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasHdrPersonality"},
+ { "name" : "LTE TAC",
+ "id" : "0x24",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16" },
+ { "name" : "Call Barring Status",
+ "id" : "0x25",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "CS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "PS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" } ] },
+ { "name" : "UMTS Primary Scrambling Code",
+ "id" : "0x26",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16" },
+ { "name" : "MNC PCS Digit Include Status",
+ "id" : "0x27",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Includes PCS Digit",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] } ] },
+
+ { "name" : "Serving System",
+ "type" : "Indication",
+ "service" : "NAS",
+ "id" : "0x0024",
+ "version" : "1.0",
+ "output" : [ { "name" : "Serving System",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Registration State",
+ "format" : "guint8",
+ "public-format" : "QmiNasRegistrationState" },
+ { "name" : "CS Attach State",
+ "format" : "guint8",
+ "public-format" : "QmiNasAttachState" },
+ { "name" : "PS Attach State",
+ "format" : "guint8",
+ "public-format" : "QmiNasAttachState" },
+ { "name" : "Selected Network",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkType" },
+ { "name" : "Radio Interfaces",
+ "format" : "array",
+ "array-element" : { "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" } } ] },
+ { "name" : "Roaming Indicator",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingIndicatorStatus" },
+ { "name" : "Data Service Capability",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "guint8",
+ "public-format" : "QmiNasDataCapability" } },
+ { "name" : "Current PLMN",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Description",
+ "format" : "string" } ] },
+ { "name" : "CDMA System ID",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "SID",
+ "format" : "guint16" },
+ { "name" : "NID",
+ "format" : "guint16" } ] },
+ { "name" : "CDMA Base Station Info",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Base Station ID",
+ "format" : "guint16" },
+ { "name" : "Base Station Latitude",
+ "format" : "gint32" },
+ { "name" : "Base Station Longitude",
+ "format" : "gint32" } ] },
+ { "name" : "Roaming Indicator List",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Radio Interface",
+ "format" : "guint8",
+ "public-format" : "QmiNasRadioInterface" },
+ { "name" : "Roaming Indicator",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingIndicatorStatus" } ] } },
+ { "name" : "Default Roaming Indicator",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingIndicatorStatus" },
+ { "name" : "Time Zone 3GPP2",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Leap Seconds",
+ "format" : "guint8" },
+ { "name" : "Local Time Offset",
+ "format" : "gint8" },
+ { "name" : "Daylight Saving Time",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "CDMA P Rev",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" },
+ { "name" : "PLMN Name Flag 3GPP",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8",
+ "public-format" : "gboolean" },
+ { "name" : "Time Zone 3GPP",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8" },
+ { "name" : "Daylight Saving Time Adjustment 3GPP",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" },
+ { "name" : "Universal Time and Local Time Zone 3GPP",
+ "id" : "0x1C",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Year",
+ "format" : "guint16" },
+ { "name" : "Month",
+ "format" : "guint8" },
+ { "name" : "Day",
+ "format" : "guint8" },
+ { "name" : "Hour",
+ "format" : "guint8" },
+ { "name" : "Minute",
+ "format" : "guint8" },
+ { "name" : "Second",
+ "format" : "guint8" },
+ { "name" : "Time Zone",
+ "format" : "guint8" } ] },
+ { "name" : "LAC 3GPP",
+ "id" : "0x1D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16" },
+ { "name" : "CID 3GPP",
+ "id" : "0x1E",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "Concurrent Service Info 3GPP2",
+ "id" : "0x1F",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean"},
+ { "name" : "PRL Indicator 3GPP2",
+ "id" : "0x20",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean"},
+ { "name" : "DTM Support",
+ "id" : "0x21",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean"},
+ { "name" : "Detailed Service Status",
+ "id" : "0x22",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "HDR Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "HDR Hybrid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "CDMA System Info",
+ "id" : "0x23",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "IMSI_11_12",
+ "format" : "guint8" } ] },
+ { "name" : "HDR Personality",
+ "id" : "0x24",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasHdrPersonality"},
+ { "name" : "LTE TAC",
+ "id" : "0x25",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16" },
+ { "name" : "Call Barring Status",
+ "id" : "0x26",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "CS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "PS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" } ] },
+ { "name" : "PLMN Not Changed Indication",
+ "id" : "0x27",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "UMTS Primary Scrambling Code",
+ "id" : "0x28",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16" },
+ { "name" : "MNC PCS Digit Include Status",
+ "id" : "0x29",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Includes PCS Digit",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Home Network",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0025",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Home Network",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Description",
+ "format" : "string" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Home System ID",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "SID",
+ "format" : "guint16" },
+ { "name" : "NID",
+ "format" : "guint16" } ] },
+ { "name" : "Home Network 3GPP2",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Display Description",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkDescriptionDisplay" },
+ { "name" : "Description Encoding",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkDescriptionEncoding" },
+ { "name" : "Description",
+ "format" : "string" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Technology Preference",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x002A",
+ "version" : "1.0",
+ "input" : [ { "name" : "Current",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Technology Preference",
+ "format" : "guint16",
+ "public-format" : "QmiNasRadioTechnologyPreference" },
+ { "name" : "Technology Preference Duration",
+ "format" : "guint8",
+ "public-format" : "QmiNasPreferenceDuration" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Technology Preference",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x002B",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Active",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Technology Preference",
+ "format" : "guint16",
+ "public-format" : "QmiNasRadioTechnologyPreference" },
+ { "name" : "Technology Preference Duration",
+ "format" : "guint8",
+ "public-format" : "QmiNasPreferenceDuration" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Persistent",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiNasRadioTechnologyPreference" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get RF Band Information",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0031",
+ "version" : "1.1",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "List",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Radio Interface",
+ "format" : "gint8",
+ "public-format" : "QmiNasRadioInterface" },
+ { "name" : "Active Band Class",
+ "format" : "guint16",
+ "public-format" : "QmiNasActiveBand" },
+ { "name" : "Active Channel",
+ "format" : "guint16" } ] } } ] },
+
+ // *********************************************************************************
+ { "name" : "Set System Selection Preference",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0033",
+ "version" : "1.1",
+ "input" : [ { "name" : "Emergency mode",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Mode Preference",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiNasRatModePreference" },
+ { "name" : "Band Preference",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "public-format" : "QmiNasBandPreference" },
+ { "name" : "CDMA PRL Preference",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiNasCdmaPrlPreference" },
+ { "name" : "Roaming Preference",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiNasRoamingPreference" },
+ { "name" : "LTE Band Preference",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "public-format" : "QmiNasLteBandPreference" },
+ { "name" : "Network Selection Preference",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Mode",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkSelectionPreference" },
+ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" } ] },
+ { "name" : "Change Duration",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasChangeDuration" },
+ { "name" : "Service Domain Preference",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32",
+ "public-format" : "QmiNasServiceDomainPreference" },
+ { "name" : "GSM WCDMA Acquisition Order Preference",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32",
+ "public-format" : "QmiNasGsmWcdmaAcquisitionOrderPreference" },
+ { "name" : "MNC PDS Digit Include Status",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "TD SCDMA Band Preference",
+ "id" : "0x1D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "public-format" : "QmiNasTdScdmaBandPreference" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get System Selection Preference",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0034",
+ "version" : "1.1",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Emergency mode",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Mode Preference",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiNasRatModePreference" },
+ { "name" : "Band Preference",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "public-format" : "QmiNasBandPreference" },
+ { "name" : "CDMA PRL Preference",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiNasCdmaPrlPreference" },
+ { "name" : "Roaming Preference",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiNasRoamingPreference" },
+ { "name" : "LTE Band Preference",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "public-format" : "QmiNasLteBandPreference" },
+ { "name" : "Network Selection Preference",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkSelectionPreference" },
+ { "name" : "Service Domain Preference",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32",
+ "public-format" : "QmiNasServiceDomainPreference" },
+ { "name" : "GSM WCDMA Acquisition Order Preference",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32",
+ "public-format" : "QmiNasGsmWcdmaAcquisitionOrderPreference" },
+ { "name" : "TD SCDMA Band Preference",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint64",
+ "public-format" : "QmiNasTdScdmaBandPreference" },
+ { "name" : "Manual Network Selection",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" },
+ { "name" : "Includes PCS Digit",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get System Info",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x004D",
+ "version" : "1.8",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "CDMA Service Status",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "HDR Service Status",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "GSM Service Status",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "True Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "WCDMA Service Status",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "True Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "LTE Service Status",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "True Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "CDMA System Info",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Match Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Match",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "P Rev Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "P Rev",
+ "format" : "guint8" },
+ { "name" : "Base Station P Rev Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Base Station P Rev",
+ "format" : "guint8" },
+ { "name" : "Concurrent Service Support Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Concurrent Service Support",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CDMA System ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "SID",
+ "format" : "guint16" },
+ { "name" : "NID",
+ "format" : "guint16" },
+ { "name" : "Base Station Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Base Station ID",
+ "format" : "guint16" },
+ { "name" : "Base Station Latitude",
+ "format" : "gint32" },
+ { "name" : "Base Station Longitude",
+ "format" : "gint32" },
+ { "name" : "Packet Zone Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Packet Zone",
+ "format" : "guint16" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" } ] },
+ { "name" : "HDR System Info",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Match Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Match",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Personality Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Personality",
+ "format" : "guint8",
+ "public-format" : "QmiNasHdrPersonality" },
+ { "name" : "Protocol Revision Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Protocol Revision",
+ "format" : "guint8",
+ "public-format" : "QmiNasHdrProtocolRevision" },
+ { "name" : "IS 856 System ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "IS 856 System ID",
+ "format" : "string",
+ "fixed-size" : "16" } ] },
+ { "name" : "GSM System Info",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC",
+ "format" : "guint16" },
+ { "name" : "CID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CID",
+ "format" : "guint32" },
+ { "name" : "Registration Reject Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Registration Reject Cause",
+ "format" : "guint8" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "EGPRS Support Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "EGPRS Support",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "DTM Support Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "DTM Support",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "WCDMA System Info",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC",
+ "format" : "guint16" },
+ { "name" : "CID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CID",
+ "format" : "guint32" },
+ { "name" : "Registration Reject Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Registration Reject Cause",
+ "format" : "guint8" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "HS Call Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HS Call Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasWcdmaHsService" },
+ { "name" : "HS Service Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HS Service",
+ "format" : "guint8",
+ "public-format" : "QmiNasWcdmaHsService" },
+ { "name" : "Primary Scrambling Code Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Primary Scrambling Code",
+ "format" : "guint16" } ] },
+ { "name" : "LTE System Info",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC",
+ "format" : "guint16" },
+ { "name" : "CID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CID",
+ "format" : "guint32" },
+ { "name" : "Registration Reject Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Registration Reject Cause",
+ "format" : "guint8" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "TAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "TAC",
+ "format" : "guint16" } ] },
+ { "name" : "Additional CDMA System Info",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" },
+ { "name" : "Registration Period",
+ "format" : "guint16" } ] },
+ { "name" : "Additional HDR System Info",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" } ] },
+ { "name" : "Additional GSM System Info",
+ "id" : "0x1C",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" },
+ { "name" : "Cell Broadcast Support",
+ "format" : "guint32",
+ "public-format" : "QmiNasCellBroadcastCapability" } ] },
+ { "name" : "Additional WCDMA System Info",
+ "id" : "0x1D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" },
+ { "name" : "Cell Broadcast Support",
+ "format" : "guint32",
+ "public-format" : "QmiNasCellBroadcastCapability" } ] },
+ { "name" : "Additional LTE System Info",
+ "id" : "0x1E",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" } ] },
+ { "name" : "GSM Call Barring Status",
+ "id" : "0x1F",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "CS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "PS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" } ] },
+ { "name" : "WCDMA Call Barring Status",
+ "id" : "0x20",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "CS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "PS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" } ] },
+ { "name" : "LTE Voice Support",
+ "id" : "0x21",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "GSM Cipher Domain",
+ "id" : "0x22",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "WCDMA Cipher Domain",
+ "id" : "0x23",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "TD SCDMA Service Status",
+ "id" : "0x24",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "True Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "TD SCDMA System Info",
+ "id" : "0x25",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC",
+ "format" : "guint16" },
+ { "name" : "CID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CID",
+ "format" : "guint32" },
+ { "name" : "Registration Reject Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Registration Reject Cause",
+ "format" : "guint8" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "HS Call Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HS Call Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasWcdmaHsService" },
+ { "name" : "HS Service Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HS Service",
+ "format" : "guint8",
+ "public-format" : "QmiNasWcdmaHsService" },
+ { "name" : "Cell Parameter ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Cell Parameter ID",
+ "format" : "guint16" },
+ { "name" : "Cell Broadcast Support Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Cell Broadcast Support",
+ "format" : "guint32",
+ "public-format" : "QmiNasCellBroadcastCapability" },
+ { "name" : "CS Call Barring Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CS Call Barring Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "PS Call Barring Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PS Call Barring Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "Cipher Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Cipher Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" } ] },
+ { "name" : "LTE eMBMS Coverage Info Support",
+ "id" : "0x26",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "SIM Reject Info",
+ "id" : "0x27",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32",
+ "public-format" : "QmiNasSimRejectState" } ] },
+
+ // *********************************************************************************
+ { "name" : "System Info",
+ "type" : "Indication",
+ "service" : "NAS",
+ "id" : "0x004E",
+ "version" : "1.8",
+ "output" : [ { "name" : "CDMA Service Status",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "HDR Service Status",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "GSM Service Status",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "True Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "WCDMA Service Status",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "True Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "LTE Service Status",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "True Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "CDMA System Info",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Match Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Match",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "P Rev Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "P Rev",
+ "format" : "guint8" },
+ { "name" : "Base Station P Rev Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Base Station P Rev",
+ "format" : "guint8" },
+ { "name" : "Concurrent Service Support Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Concurrent Service Support",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CDMA System ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "SID",
+ "format" : "guint16" },
+ { "name" : "NID",
+ "format" : "guint16" },
+ { "name" : "Base Station Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Base Station ID",
+ "format" : "guint16" },
+ { "name" : "Base Station Latitude",
+ "format" : "gint32" },
+ { "name" : "Base Station Longitude",
+ "format" : "gint32" },
+ { "name" : "Packet Zone Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Packet Zone",
+ "format" : "guint16" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" } ] },
+ { "name" : "HDR System Info",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Match Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PRL Match",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Personality Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Personality",
+ "format" : "guint8",
+ "public-format" : "QmiNasHdrPersonality" },
+ { "name" : "Protocol Revision Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Protocol Revision",
+ "format" : "guint8",
+ "public-format" : "QmiNasHdrProtocolRevision" },
+ { "name" : "IS 856 System ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "IS 856 System ID",
+ "format" : "string",
+ "fixed-size" : "16" } ] },
+ { "name" : "GSM System Info",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC",
+ "format" : "guint16" },
+ { "name" : "CID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CID",
+ "format" : "guint32" },
+ { "name" : "Registration Reject Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Registration Reject Cause",
+ "format" : "guint8" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "EGPRS Support Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "EGPRS Support",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "DTM Support Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "DTM Support",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "WCDMA System Info",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC",
+ "format" : "guint16" },
+ { "name" : "CID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CID",
+ "format" : "guint32" },
+ { "name" : "Registration Reject Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Registration Reject Cause",
+ "format" : "guint8" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "HS Call Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HS Call Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasWcdmaHsService" },
+ { "name" : "HS Service Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HS Service",
+ "format" : "guint8",
+ "public-format" : "QmiNasWcdmaHsService" },
+ { "name" : "Primary Scrambling Code Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Primary Scrambling Code",
+ "format" : "guint16" } ] },
+ { "name" : "LTE System Info",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC",
+ "format" : "guint16" },
+ { "name" : "CID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CID",
+ "format" : "guint32" },
+ { "name" : "Registration Reject Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Registration Reject Cause",
+ "format" : "guint8" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "TAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "TAC",
+ "format" : "guint16" } ] },
+ { "name" : "Additional CDMA System Info",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" },
+ { "name" : "Registration Period",
+ "format" : "guint16" } ] },
+ { "name" : "Additional HDR System Info",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" } ] },
+ { "name" : "Additional GSM System Info",
+ "id" : "0x1C",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" },
+ { "name" : "Cell Broadcast Support",
+ "format" : "guint32",
+ "public-format" : "QmiNasCellBroadcastCapability" } ] },
+ { "name" : "Additional WCDMA System Info",
+ "id" : "0x1D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" },
+ { "name" : "Cell Broadcast Support",
+ "format" : "guint32",
+ "public-format" : "QmiNasCellBroadcastCapability" } ] },
+ { "name" : "Additional LTE System Info",
+ "id" : "0x1E",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Geo System Index",
+ "format" : "guint16" } ] },
+ { "name" : "GSM Call Barring Status",
+ "id" : "0x1F",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "CS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "PS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" } ] },
+ { "name" : "WCDMA Call Barring Status",
+ "id" : "0x20",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "CS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "PS Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" } ] },
+ { "name" : "LTE Voice Support",
+ "id" : "0x21",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "GSM Cipher Domain",
+ "id" : "0x22",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "WCDMA Cipher Domain",
+ "id" : "0x23",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "PLMN Not Changed Indication",
+ "id" : "0x24",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "TD SCDMA Service Status",
+ "id" : "0x25",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "True Service Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasServiceStatus" },
+ { "name" : "Preferred Data Path",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "TD SCMA System Info",
+ "id" : "0x26",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Service Capability Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Capability",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Roaming Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Roaming Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasRoamingStatus" },
+ { "name" : "Forbidden Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Forbidden",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "LAC",
+ "format" : "guint16" },
+ { "name" : "CID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CID",
+ "format" : "guint32" },
+ { "name" : "Registration Reject Info Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Registration Reject Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" },
+ { "name" : "Registration Reject Cause",
+ "format" : "guint8" },
+ { "name" : "Network ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "MCC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "MNC",
+ "format" : "string",
+ "fixed-size" : "3" },
+ { "name" : "HS Call Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HS Call Status",
+ "format" : "guint8",
+ "public-format" : "QmiNasWcdmaHsService" },
+ { "name" : "HS Service Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "HS Service",
+ "format" : "guint8",
+ "public-format" : "QmiNasWcdmaHsService" },
+ { "name" : "Cell Parameter ID Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Cell Parameter ID",
+ "format" : "guint16" },
+ { "name" : "Cell Broadcast Support Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Cell Broadcast Support",
+ "format" : "guint32",
+ "public-format" : "QmiNasCellBroadcastCapability" },
+ { "name" : "CS Call Barring Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "CS Call Barring Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "PS Call Barring Status Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PS Call Barring Status",
+ "format" : "gint32",
+ "public-format" : "QmiNasCallBarringStatus" },
+ { "name" : "Cipher Domain Valid",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Cipher Domain",
+ "format" : "guint8",
+ "public-format" : "QmiNasNetworkServiceDomain" } ] },
+ { "name" : "LTE eMBMS Coverage Info Support",
+ "id" : "0x27",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "SIM Reject Info",
+ "id" : "0x28",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32",
+ "public-format" : "QmiNasSimRejectState" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Signal Info",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x004F",
+ "version" : "1.8",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "CDMA Signal Strength",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "gint8" },
+ { "name" : "ECIO",
+ "format" : "gint16" } ] },
+ { "name" : "HDR Signal Strength",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "gint8" },
+ { "name" : "ECIO",
+ "format" : "gint16" },
+ { "name" : "SINR",
+ "format" : "guint8",
+ "public-format" : "QmiNasEvdoSinrLevel" },
+ { "name" : "IO",
+ "format" : "gint32" } ] },
+ { "name" : "GSM Signal Strength",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8" },
+ { "name" : "WCDMA Signal Strength",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "gint8" },
+ { "name" : "ECIO",
+ "format" : "gint16" } ] },
+ { "name" : "LTE Signal Strength",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "gint8" },
+ { "name" : "RSRQ",
+ "format" : "gint8" },
+ { "name" : "RSRP",
+ "format" : "gint16" },
+ { "name" : "SNR",
+ "format" : "gint16" } ] },
+ { "name" : "TDMA Signal Strength",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8" } ] },
+
+ // *********************************************************************************
+ { "name" : "Config Signal Info",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0050",
+ "version" : "1.8",
+ "input" : [ { "name" : "RSSI Threshold",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "gint8" } },
+ { "name" : "ECIO Threshold",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "gint16" } },
+ { "name" : "SINR Threshold",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "guint8" } },
+ { "name" : "LTE SNR Threshold",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "gint16" } },
+ { "name" : "IO Threshold",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "gint32" } },
+ { "name" : "RSRQ Threshold",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "gint8" } },
+ { "name" : "RSRP Threshold",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "gint16" } },
+ { "name" : "LTE Report",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Rate",
+ "format" : "guint8" },
+ { "name" : "Average Period",
+ "format" : "guint8" } ] },
+ { "name" : "RSCP Threshold",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "format" : "gint8" } } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Signal Info",
+ "type" : "Indication",
+ "service" : "NAS",
+ "id" : "0x0051",
+ "version" : "1.8",
+ "output" : [ { "name" : "CDMA Signal Strength",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "gint8" },
+ { "name" : "ECIO",
+ "format" : "gint16" } ] },
+ { "name" : "HDR Signal Strength",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "gint8" },
+ { "name" : "ECIO",
+ "format" : "gint16" },
+ { "name" : "SINR",
+ "format" : "guint8",
+ "public-format" : "QmiNasEvdoSinrLevel" },
+ { "name" : "IO",
+ "format" : "gint32" } ] },
+ { "name" : "GSM Signal Strength",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8" },
+ { "name" : "WCDMA Signal Strength",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "gint8" },
+ { "name" : "ECIO",
+ "format" : "gint16" } ] },
+ { "name" : "LTE Signal Strength",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RSSI",
+ "format" : "gint8" },
+ { "name" : "RSRQ",
+ "format" : "gint8" },
+ { "name" : "RSRP",
+ "format" : "gint16" },
+ { "name" : "SNR",
+ "format" : "gint16" } ] },
+ { "name" : "TDMA Signal Strength",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get CDMA Position Info",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x0065",
+ "version" : "1.3",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "CDMA Position Info",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "UI In Idle Mode",
+ "format" : "gint8" },
+ { "name" : "BaseStations",
+ "format" : "array",
+ "size-prefix-format" : "guint8",
+ "array-element" : { "name" : "BaseStation",
+ "format" : "struct",
+ "contents" : [ { "name" : "Pilot Type",
+ "format" : "guint32",
+ "public-format" : "QmiNasCdmaPilotType" },
+ { "name" : "System ID",
+ "format" : "guint16" },
+ { "name" : "Network ID",
+ "format" : "guint16" },
+ { "name" : "Base Station ID",
+ "format" : "guint16" },
+ { "name" : "Pilot PN",
+ "format" : "guint16" },
+ { "name" : "Pilot Strength",
+ "format" : "guint16" },
+ { "name" : "Latitude",
+ "format" : "gint32" },
+ { "name" : "Longitude",
+ "format" : "gint32" },
+ { "name" : "GPS Time In Milliseconds",
+ "format" : "guint64" } ] } } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] } ] }
+]
diff --git a/data/qmi-service-pds.json b/data/qmi-service-pds.json
new file mode 100644
index 0000000..c87ce7a
--- /dev/null
+++ b/data/qmi-service-pds.json
@@ -0,0 +1,330 @@
+
+[
+ // *********************************************************************************
+ { "name" : "PDS",
+ "type" : "Service" },
+
+ // *********************************************************************************
+ { "name" : "QMI Client PDS",
+ "type" : "Client" },
+
+ // *********************************************************************************
+ { "name" : "QMI Message PDS",
+ "type" : "Message-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "QMI Indication PDS",
+ "type" : "Indication-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "Reset",
+ "type" : "Message",
+ "service" : "PDS",
+ "id" : "0x0000",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Event Report",
+ "type" : "Message",
+ "service" : "PDS",
+ "id" : "0x0001",
+ "version" : "1.0",
+ "input" : [ { "name" : "NMEA Position Reporting",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Extended NMEA Position Reporting",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Parsed Position Reporting",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "External XTRA Data Request Reporting",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "External Time Injection Request Reporting",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "External WIFI Position Request Reporting",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Satellite Information Reporting",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "VX Network Initiated Request Reporting",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "SUPL Network Initiated Prompt Reporting",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "UMTS CP Network Initiated Prompt Reporting",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "PDS Comm Event Reporting",
+ "id" : "0x1A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Accelerometer Data Streaming Ready Reporting",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Gyro Data Streaming Ready Reporting",
+ "id" : "0x1C",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Time Sync Request Reporting",
+ "id" : "0x1D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Position Reliability Indicator Reporting",
+ "id" : "0x1E",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Sensor Data Usage Indicator Reporting",
+ "id" : "0x1F",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Time Source Information Reporting",
+ "id" : "0x20",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Heading Uncertainty Reporting",
+ "id" : "0x21",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "NMEA Debug Strings Reporting",
+ "id" : "0x22",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Extended External XTRA Data Request Reporting",
+ "id" : "0x23",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ { "name" : "Event Report",
+ "type" : "Indication",
+ "service" : "PDS",
+ "id" : "0x0001",
+ "output" : [ { "name" : "NMEA Position",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "max-size" : "200" },
+ { "name" : "Extended NMEA Position",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Operation Mode",
+ "format" : "gint8",
+ "public-format" : "QmiPdsOperationMode" },
+ { "name" : "NMEA",
+ "format" : "string",
+ // This was supposed to be only 1 byte for length, but it seems it's not
+ "size-prefix-format" : "guint16",
+ "max-size" : "200" } ] },
+ { "name" : "Position Session Status",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiPdsPositionSessionStatus" } ] },
+
+ // TODO: parse all TLVs of this indication
+ // Reading gfloat/gdouble is still missing
+ //{ "name" : "Parsed Position",
+ // "id" : "0x13",
+ // "mandatory" : "no",
+ // "type" : "TLV",
+ // "format" : "sequence",
+ // "contents" : [ { "name" : "Valid Mask",
+ // "format" : "gint8" },
+ // { "name" : "Timestamp Calendar",
+ // "format" : "struct",
+ // "contents" : [ { "name" : "Year",
+ // "format" : "guint16" },
+ // { "name" : "Month",
+ // "format" : "guint8" },
+ // { "name" : "Day Of Week",
+ // "format" : "guint8" },
+ // { "name" : "Day of Month",
+ // "format" : "guint8" },
+ // { "name" : "Hour",
+ // "format" : "guint8" },
+ // { "name" : "Minute",
+ // "format" : "guint8" },
+ // { "name" : "Second",
+ // "format" : "guint8" },
+ // { "name" : "Millisecond",
+ // "format" : "guint16" } ] },
+ // { "name" : "Leap Seconds",
+ // "format" : "guint8" },
+ // { "name" : "Timestamp UTC",
+ // "format" : "guint64" },
+ // { "name" : "Time Uncertainty",
+ // "format" : "guint32" },
+ // { "name" : "Latitude",
+ // "format" : "gdouble" },
+ // { "name" : "Longitude",
+ // "format" : "gdouble" },
+ // { "name" : "Altitude Ellipsoid",
+ // "format" : "gfloat" },
+ // { "name" : "Altitude Sea Level",
+ // "format" : "gfloat" },
+ // { "name" : "Horizontal Speed",
+ // "format" : "gfloat" },
+ // { "name" : "Vertical Speed",
+ // "format" : "gfloat" },
+ // { "name" : "Heading",
+ // "format" : "gfloat" },
+ // { "name" : "Horizontal Uncertainty Circular",
+ // "format" : "gfloat" },
+ // { "name" : "Horizontal Uncertainty Ellipse Semi Major",
+ // "format" : "gfloat" },
+ // { "name" : "Horizontal Uncertainty Ellipse Semi Minor",
+ // "format" : "gfloat" },
+ // { "name" : "Horizontal Uncertainty Ellipse Orient Azimuth",
+ // "format" : "gfloat" },
+ // { "name" : "Vertical Uncertainty",
+ // "format" : "gfloat" },
+ // { "name" : "Horizontal Velocity Uncertainty",
+ // "format" : "gfloat" },
+ // { "name" : "Vertical Velocity Uncertainty",
+ // "format" : "gfloat" },
+ // { "name" : "Horizontal confidence",
+ // "format" : "guint8" },
+ // { "name" : "Position DOP",
+ // "format" : "gfloat" },
+ // { "name" : "Horizontal DOP",
+ // "format" : "gfloat" },
+ // { "name" : "Vertical DOP",
+ // "format" : "gfloat" },
+ // { "name" : "Operation Mode",
+ // "format" : "gint8",
+ // "public-format" : "QmiPdsOperationMode" } ],
+ // "prerequisites": [ { "field" : "Position Session Status",
+ // "operation" : "<=",
+ // "value" : "QMI_PDS_POSITION_SESSION_STATUS_IN_PROGRESS" } ] } ] }
+
+ // *********************************************************************************
+ { "name" : "Get GPS Service State",
+ "type" : "Message",
+ "service" : "PDS",
+ "id" : "0x0020",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "State",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "GPS Service State",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Tracking Session State",
+ "format" : "guint8",
+ "public-format" : "QmiPdsTrackingSessionState" } ],
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set GPS Service State",
+ "type" : "Message",
+ "service" : "PDS",
+ "id" : "0x0021",
+ "version" : "1.0",
+ "input" : [ { "name" : "State",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "GPS Service State",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Auto Tracking State",
+ "type" : "Message",
+ "service" : "PDS",
+ "id" : "0x0030",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "State",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Auto Tracking State",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Auto Tracking State",
+ "type" : "Message",
+ "service" : "PDS",
+ "id" : "0x0031",
+ "version" : "1.0",
+ "input" : [ { "name" : "State",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Auto Tracking State",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] }
+
+]
diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json
new file mode 100644
index 0000000..3ed12ca
--- /dev/null
+++ b/data/qmi-service-wds.json
@@ -0,0 +1,483 @@
+
+[
+ // *********************************************************************************
+ { "name" : "WDS",
+ "type" : "Service" },
+
+ // *********************************************************************************
+ { "name" : "QMI Client WDS",
+ "type" : "Client" },
+
+ // *********************************************************************************
+ { "name" : "QMI Message WDS",
+ "type" : "Message-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "Reset",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0000",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Abort",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0002",
+ "version" : "1.0",
+ // This magic tag allows us to avoid creating a method in the client
+ "scope" : "library-only",
+ "input" : [ { "name" : "Transaction ID",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint16" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Start Network",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0020",
+ "version" : "1.0",
+ // This method may be aborted
+ "abort" : "yes",
+ "input" : [ { "name" : "Primary DNS Address Preference",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "Secondary DNS Address Preference",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "Primary NBNS Address Preference",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "Secondary NBNS Address Preference",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "APN",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string" },
+ { "name" : "IPv4 Address Preference",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "Authentication Preference",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsAuthentication" },
+ { "name" : "Username",
+ "id" : "0x17",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string" },
+ { "name" : "Password",
+ "id" : "0x18",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string" },
+ { "name" : "IP Family Preference",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsIpFamily" },
+ { "name" : "Technology Preference",
+ "id" : "0x30",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsTechnologyPreference" },
+ { "name" : "Profile Index 3GPP",
+ "id" : "0x31",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" },
+ { "name" : "Profile Index 3GPP2",
+ "id" : "0x32",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" },
+ { "name" : "Enable Autoconnect",
+ "id" : "0x33",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Extended Technology Preference",
+ "id" : "0x34",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiWdsExtendedTechnologyPreference" },
+ { "name" : "Call Type",
+ "id" : "0x35",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsCallType" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Packet Data Handle",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint32",
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Call End Reason",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiWdsCallEndReason",
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_CALL_FAILED" } ] },
+ { "name" : "Verbose Call End Reason",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Type",
+ "format" : "guint16",
+ "public-format" : "QmiWdsVerboseCallEndReasonType" },
+ { "name" : "Reason",
+ "format" : "gint16" } ],
+ "prerequisites": [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_CALL_FAILED" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Stop Network",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0021",
+ "version" : "1.0",
+ "input" : [ { "name" : "Packet Data Handle",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "Disable Autoconnect",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Packet Service Status",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0022",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Connection Status",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsConnectionStatus",
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Current Settings",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x002D",
+ "version" : "1.2",
+ "input" : [ { "name" : "Requested Settings",
+ "id" : "0x10",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint32",
+ "public-format" : "QmiWdsGetCurrentSettingsRequestedSettings" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Profile Name",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "PDP Type",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsPdpType",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "APN Name",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Primary IPv4 DNS Address",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "endian" : "little",
+ "format" : "guint32",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Secondary IPv4 DNS Address",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "endian" : "little",
+ "format" : "guint32",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "GPRS Granted QoS",
+ "id" : "0x19",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Precedence Class",
+ "format" : "guint32" },
+ { "name" : "Delay Class",
+ "format" : "guint32" },
+ { "name" : "Reliability Class",
+ "format" : "guint32" },
+ { "name" : "Peak Throughput Class",
+ "format" : "guint32" },
+ { "name" : "Mean Throughput Class",
+ "format" : "guint32" } ],
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Username",
+ "id" : "0x1B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Authentication",
+ "id" : "0x1D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsAuthentication",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IPv4 Address",
+ "id" : "0x1E",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "endian" : "little",
+ "format" : "guint32",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Profile ID",
+ "id" : "0x1F",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Profile Type",
+ "format" : "guint8",
+ "public-format" : "QmiWdsProfileType" },
+ { "name" : "Profile Index",
+ "format" : "guint8" } ],
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IPv4 Gateway Address",
+ "id" : "0x20",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "endian" : "little",
+ "format" : "guint32",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IPv4 Gateway Subnet Mask",
+ "id" : "0x21",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "endian" : "little",
+ "format" : "guint32",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "PCSCF Address Using PCO",
+ "id" : "0x22",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "PCSCF Server Address List",
+ "id" : "0x23",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "IPv4 Address",
+ "endian" : "little",
+ "format" : "guint32" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "PCSCF Domain Name List",
+ "id" : "0x24",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "FQDN",
+ "format" : "string",
+ "size-prefix-format" : "guint16" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IPv6 Address",
+ "id" : "0x25",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Address",
+ "format" : "array",
+ "fixed-size" : "8",
+ "array-element" : { "format": "guint16", "endian": "network" } },
+ { "name" : "Prefix Length",
+ "format" : "guint8" } ],
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IPv6 Gateway Address",
+ "id" : "0x26",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Address",
+ "format" : "array",
+ "fixed-size" : "8",
+ "array-element" : { "format": "guint16", "endian": "network" } },
+ { "name" : "Prefix Length",
+ "format" : "guint8" } ],
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IPv6 Primary DNS Address",
+ "id" : "0x27",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "fixed-size": "8",
+ "array-element" : { "format": "guint16", "endian": "network" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IPv6 Secondary DNS Address",
+ "id" : "0x28",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "fixed-size": "8",
+ "array-element" : { "format": "guint16", "endian": "network" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "MTU",
+ "id" : "0x29",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Domain Name List",
+ "id" : "0x2A",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "array-element" : { "name" : "Domain Name",
+ "format" : "string",
+ "size-prefix-format" : "guint16" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IP Family",
+ "id" : "0x2B",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsIpFamily",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "IMCN Flag",
+ "id" : "0x2C",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Extended Technology Preference",
+ "id" : "0x2D",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiWdsExtendedTechnologyPreference",
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Data Bearer Technology",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0037",
+ "version" : "1.12",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Current",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "gint8",
+ "public-format" : "QmiWdsDataBearerTechnology",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Last",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8",
+ "public-format" : "QmiWdsDataBearerTechnology",
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_OUT_OF_CALL" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Current Data Bearer Technology",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0044",
+ "version" : "1.4",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Current",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Network Type",
+ "format" : "guint8",
+ "public-format" : "QmiWdsNetworkType" },
+ { "name" : "RAT Mask",
+ "format" : "guint32" },
+ { "name" : "SO Mask",
+ "format" : "guint32" } ],
+ "prerequisites": [ { "common-ref" : "Success" } ] },
+ { "name" : "Last",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Network Type",
+ "format" : "guint8",
+ "public-format" : "QmiWdsNetworkType" },
+ { "name" : "RAT Mask",
+ "format" : "guint32" },
+ { "name" : "SO Mask",
+ "format" : "guint32" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set IP Family",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x004D",
+ "version" : "1.9",
+ "input" : [ { "name" : "Preference",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsIpFamily" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] }
+
+]
diff --git a/data/qmi-service-wms.json b/data/qmi-service-wms.json
new file mode 100644
index 0000000..75accd4
--- /dev/null
+++ b/data/qmi-service-wms.json
@@ -0,0 +1,567 @@
+
+[
+ // *********************************************************************************
+ { "name" : "WMS",
+ "type" : "Service" },
+
+ // *********************************************************************************
+ { "name" : "QMI Client WMS",
+ "type" : "Client" },
+
+ // *********************************************************************************
+ { "name" : "QMI Message WMS",
+ "type" : "Message-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "QMI Indication WMS",
+ "type" : "Indication-ID-Enum" },
+
+ // *********************************************************************************
+ { "name" : "Reset",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0000",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Event Report",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0001",
+ "version" : "1.0",
+ "input" : [ { "name" : "New MT Message Indicator",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Report",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ { "name" : "Event Report",
+ "type" : "Indication",
+ "service" : "WMS",
+ "id" : "0x0001",
+ "output" : [ { "name" : "MT Message",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Storage Type",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Memory Index",
+ "format" : "guint32" } ] },
+ { "name" : "Transfer Route MT Message",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Ack Indicator",
+ "format" : "guint8",
+ "public-format" : "QmiWmsAckIndicator" },
+ { "name" : "Transaction ID",
+ "format" : "guint32" },
+ { "name" : "Format",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageFormat" },
+ { "name" : "Raw Data",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" } } ] },
+ { "name" : "Message Mode",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageMode" },
+ { "name" : "ETWS Message",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Notification Type",
+ "format" : "guint8",
+ "public-format" : "QmiWmsNotificationType" },
+ { "name" : "Raw Data",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" } } ] },
+ { "name" : "ETWS PLMN Information",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "MCC",
+ "format" : "guint16" },
+ { "name" : "MNC",
+ "format" : "guint16" } ] },
+ { "name" : "SMSC Address",
+ "id" : "0x15",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "string" },
+ { "name" : "SMS on IMS",
+ "id" : "0x16",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+
+ // *********************************************************************************
+ { "name" : "Raw Send",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0020",
+ "version" : "1.0",
+ "input" : [ { "name" : "Raw Message Data",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Format",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageFormat" },
+ { "name" : "Raw Data",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" } } ] },
+ { "name" : "CDMA Force On DC",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Force",
+ "format" : "guint8",
+ "public-format" : "gboolean" },
+ { "name" : "Service Option",
+ "format" : "guint8",
+ "public-format" : "QmiWmsCdmaServiceOption" } ] },
+ { "name" : "CDMA Follow On DC",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Follow",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ] },
+ { "name" : "GSM WCDMA Link Timer",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8" },
+ { "name" : "SMS on IMS",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Message ID",
+ "id" : "0x01",
+ // Even if we have this TLV as mandatory, it seems it really isn't
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "CDMA Cause Code",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiWmsCdmaCauseCode",
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_WMS_CAUSE_CODE" } ] },
+ { "name" : "CDMA Error Class",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsCdmaErrorClass",
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_WMS_CAUSE_CODE" } ] },
+ { "name" : "GSM WCDMA Cause Info",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RP Cause",
+ "format" : "guint16",
+ "public-format" : "QmiWmsGsmUmtsRpCause" },
+ { "name" : "TP Cause",
+ "format" : "guint8",
+ "public-format" : "QmiWmsGsmUmtsTpCause" } ],
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_WMS_CAUSE_CODE" } ] },
+ { "name" : "Message Delivery Failure Type",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageDeliveryFailureType",
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_WMS_CAUSE_CODE" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Raw Write",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0021",
+ "version" : "1.0",
+ "input" : [ { "name" : "Raw Message Data",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Storage Type",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Format",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageFormat" },
+ { "name" : "Raw Data",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" } } ] } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Memory Index",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint32",
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Raw Read",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0022",
+ "version" : "1.0",
+ "input" : [ { "name" : "Message Memory Storage ID",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Storage Type",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Memory Index",
+ "format" : "guint32" } ] },
+ { "name" : "Message Mode",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageMode" },
+ { "name" : "SMS on IMS",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Raw Message Data",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Message Tag",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageTagType" },
+ { "name" : "Format",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageFormat" },
+ { "name" : "Raw Data",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" } } ],
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Modify Tag",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0023",
+ "version" : "1.0",
+ "input" : [ { "name" : "Message Tag",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Storage Type",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Memory Index",
+ "format" : "guint32" },
+ { "name" : "Message Tag",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageTagType" } ] },
+ { "name" : "Message Mode",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageMode" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Delete",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0024",
+ "version" : "1.0",
+ "input" : [ { "name" : "Memory Storage",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Memory Index",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint32" },
+ { "name" : "Message Tag",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageTagType" },
+ { "name" : "Message Mode",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageMode" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Message Protocol",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0030",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Message Protocol",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageProtocol",
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "List Messages",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0031",
+ "version" : "1.0",
+ "input" : [ { "name" : "Storage Type",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Message Tag",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageTagType" },
+ { "name" : "Message Mode",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageMode" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Message List",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint32" ,
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Memory Index",
+ "format" : "guint32" },
+ { "name" : "Message Tag",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageTagType" } ] },
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Set Routes",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0032",
+ "version" : "1.0",
+ "input" : [ { "name" : "Route List",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Message Type",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageType" },
+ { "name" : "Message Class",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageClass" },
+ { "name" : "Storage",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Receipt Action",
+ "format" : "guint8",
+ "public-format" : "QmiWmsReceiptAction" } ] } },
+ { "name" : "Transfer Status Report",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsTransferIndication" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Get Routes",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0033",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Route List",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "name" : "Element",
+ "format" : "struct",
+ "contents" : [ { "name" : "Message Type",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageType" },
+ { "name" : "Message Class",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageClass" },
+ { "name" : "Storage",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Receipt Action",
+ "format" : "guint8",
+ "public-format" : "QmiWmsReceiptAction" } ] },
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Transfer Status Report",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsTransferIndication",
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
+ { "name" : "Send From Memory Storage",
+ "type" : "Message",
+ "service" : "WMS",
+ "id" : "0x0042",
+ "version" : "1.2",
+ "input" : [ { "name" : "Information",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Storage Type",
+ "format" : "guint8",
+ "public-format" : "QmiWmsStorageType" },
+ { "name" : "Memory Index",
+ "format" : "guint32" },
+ { "name" : "Message Mode",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageMode" } ] },
+ { "name" : "SMS on IMS",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Message ID",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "CDMA Cause Code",
+ "id" : "0x11",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint16",
+ "public-format" : "QmiWmsCdmaCauseCode",
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_WMS_CAUSE_CODE" } ] },
+ { "name" : "CDMA Error Class",
+ "id" : "0x12",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsCdmaErrorClass",
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_WMS_CAUSE_CODE" } ] },
+ { "name" : "GSM WCDMA Cause Info",
+ "id" : "0x13",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "sequence",
+ "contents" : [ { "name" : "RP Cause",
+ "format" : "guint16",
+ "public-format" : "QmiWmsGsmUmtsRpCause" },
+ { "name" : "TP Cause",
+ "format" : "guint8",
+ "public-format" : "QmiWmsGsmUmtsTpCause" } ],
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_WMS_CAUSE_CODE" } ] },
+ { "name" : "Message Delivery Failure Type",
+ "id" : "0x14",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWmsMessageDeliveryFailureType",
+ "prerequisites" : [ { "field" : "Result.Error Status",
+ "operation" : "!=",
+ "value" : "QMI_STATUS_SUCCESS" },
+ { "field" : "Result.Error Code",
+ "operation" : "==",
+ "value" : "QMI_PROTOCOL_ERROR_WMS_CAUSE_CODE" } ] } ] }
+
+]
diff --git a/dev.c b/dev.c
new file mode 100644
index 0000000..486230a
--- /dev/null
+++ b/dev.c
@@ -0,0 +1,337 @@
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "uqmi.h"
+
+#define __qmi_service(_n) [__##_n] = _n
+static const uint8_t qmi_services[__QMI_SERVICE_LAST] = {
+ __qmi_services
+};
+#undef __qmi_service
+
+static union {
+ char buf[512];
+ struct qmi_msg msg;
+} msgbuf;
+
+#ifdef DEBUG_PACKET
+void dump_packet(const char *prefix, void *ptr, int len)
+{
+ unsigned char *data = ptr;
+ int i;
+
+ fprintf(stderr, "%s:", prefix);
+ for (i = 0; i < len; i++)
+ fprintf(stderr, " %02x", data[i]);
+ fprintf(stderr, "\n");
+}
+#endif
+
+static int
+qmi_get_service_idx(QmiService svc)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(qmi_services); i++)
+ if (qmi_services[i] == svc)
+ return i;
+
+ return -1;
+}
+
+static void __qmi_request_complete(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+ void *tlv_buf;
+ int tlv_len;
+ int ret;
+
+ if (!req->pending)
+ return;
+
+ req->pending = false;
+ list_del(&req->list);
+
+ tlv_buf = qmi_msg_get_tlv_buf(msg, &tlv_len);
+ req->ret = qmi_check_message_status(tlv_buf, tlv_len);
+ if (req->ret)
+ msg = NULL;
+
+ if (req->cb)
+ req->cb(qmi, req, msg);
+
+ if (req->complete) {
+ *req->complete = true;
+ uloop_cancelled = true;
+ }
+}
+
+static void qmi_process_msg(struct qmi_dev *qmi, struct qmi_msg *msg)
+{
+ struct qmi_request *req;
+ uint16_t tid;
+
+ if (msg->qmux.service == QMI_SERVICE_CTL)
+ tid = msg->ctl.transaction;
+ else
+ tid = le16_to_cpu(msg->svc.transaction);
+
+ list_for_each_entry(req, &qmi->req, list) {
+ if (req->service != msg->qmux.service)
+ continue;
+
+ if (req->tid != tid)
+ continue;
+
+ __qmi_request_complete(qmi, req, msg);
+ return;
+ }
+}
+
+static void qmi_notify_read(struct ustream *us, int bytes)
+{
+ struct qmi_dev *qmi = container_of(us, struct qmi_dev, sf.stream);
+ struct qmi_msg *msg;
+ char *buf;
+ int len, msg_len;
+ int i;
+
+ while (1) {
+ buf = ustream_get_read_buf(us, &len);
+ if (!buf || !len)
+ return;
+
+ if (len < offsetof(struct qmi_msg, flags))
+ return;
+
+ msg = (struct qmi_msg *) buf;
+ msg_len = le16_to_cpu(msg->qmux.len) + 1;
+ if (len < msg_len)
+ return;
+
+ dump_packet("Received packet", msg, msg_len);
+ qmi_process_msg(qmi, msg);
+ ustream_consume(us, msg_len);
+ }
+}
+
+int qmi_request_start(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, request_cb cb)
+{
+ int len = qmi_complete_request_message(msg);
+ uint16_t tid;
+ int ret;
+ int i;
+
+ memset(req, 0, sizeof(*req));
+ req->ret = -1;
+ req->service = msg->qmux.service;
+ if (req->service == QMI_SERVICE_CTL) {
+ tid = qmi->ctl_tid++;
+ msg->ctl.transaction = tid;
+ } else {
+ int idx = qmi_get_service_idx(req->service);
+
+ if (idx < 0)
+ return -1;
+
+ tid = qmi->service_data[idx].tid++;
+ msg->svc.transaction = cpu_to_le16(tid);
+ msg->qmux.client = qmi->service_data[idx].client_id;
+ }
+
+ req->tid = tid;
+ req->cb = cb;
+ req->pending = true;
+ list_add(&req->list, &qmi->req);
+
+ dump_packet("Send packet", msg, len);
+ ustream_write(&qmi->sf.stream, (void *) msg, len, false);
+ return 0;
+}
+
+void qmi_request_cancel(struct qmi_dev *qmi, struct qmi_request *req)
+{
+ req->cb = NULL;
+ __qmi_request_complete(qmi, req, NULL);
+}
+
+int qmi_request_wait(struct qmi_dev *qmi, struct qmi_request *req)
+{
+ bool complete = false;
+ bool cancelled;
+
+ if (!req->pending)
+ return req->ret;
+
+ if (req->complete)
+ *req->complete = true;
+
+ req->complete = &complete;
+ while (!complete) {
+ cancelled = uloop_cancelled;
+ uloop_cancelled = false;
+ uloop_run();
+ uloop_cancelled = cancelled;
+ }
+
+ if (req->complete == &complete)
+ req->complete = NULL;
+
+ return req->ret;
+}
+
+struct qmi_connect_request {
+ struct qmi_request req;
+ int cid;
+};
+
+static void qmi_connect_service_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+ struct qmi_ctl_allocate_cid_response res;
+ struct qmi_connect_request *creq = container_of(req, struct qmi_connect_request, req);
+
+ if (!msg)
+ return;
+
+ qmi_parse_ctl_allocate_cid_response(msg, &res);
+ creq->cid = res.data.allocation_info.cid;
+}
+
+int qmi_service_connect(struct qmi_dev *qmi, QmiService svc, int client_id)
+{
+ struct qmi_ctl_allocate_cid_request creq = {
+ QMI_INIT(service, svc)
+ };
+ struct qmi_connect_request req;
+ int idx = qmi_get_service_idx(svc);
+ struct qmi_msg *msg = &msgbuf.msg;
+
+ if (idx < 0)
+ return -1;
+
+ if (qmi->service_connected & (1 << idx))
+ return 0;
+
+ if (client_id < 0) {
+ qmi_set_ctl_allocate_cid_request(msg, &creq);
+ qmi_request_start(qmi, &req.req, msg, qmi_connect_service_cb);
+ qmi_request_wait(qmi, &req.req);
+
+ if (req.req.ret)
+ return req.req.ret;
+
+ client_id = req.cid;
+ }
+
+ qmi->service_data[idx].connected = true;
+ qmi->service_data[idx].client_id = client_id;
+ qmi->service_data[idx].tid = 1;
+ qmi->service_connected |= (1 << idx);
+
+ return 0;
+}
+
+static void __qmi_service_disconnect(struct qmi_dev *qmi, int idx)
+{
+ int client_id = qmi->service_data[idx].client_id;
+ struct qmi_ctl_release_cid_request creq = {
+ QMI_INIT_SEQUENCE(release_info,
+ .service = qmi_services[idx],
+ .cid = client_id,
+ )
+ };
+ struct qmi_request req;
+ struct qmi_msg *msg = &msgbuf.msg;
+
+ qmi->service_connected &= ~(1 << idx);
+ qmi->service_data[idx].client_id = -1;
+ qmi->service_data[idx].tid = 0;
+
+ qmi_set_ctl_release_cid_request(msg, &creq);
+ qmi_request_start(qmi, &req, msg, NULL);
+ qmi_request_wait(qmi, &req);
+}
+
+static void qmi_close_all_services(struct qmi_dev *qmi)
+{
+ uint32_t connected = qmi->service_connected;
+ int idx;
+
+ for (idx = 0; connected; idx++, connected >>= 1) {
+ if (!(connected & 1))
+ continue;
+
+ if (qmi->service_keep_cid & (1 << idx))
+ continue;
+
+ __qmi_service_disconnect(qmi, idx);
+ }
+}
+
+int qmi_service_get_client_id(struct qmi_dev *qmi, QmiService svc)
+{
+ int idx = qmi_get_service_idx(svc);
+
+ if (idx < 0)
+ return -1;
+
+ qmi->service_keep_cid |= (1 << idx);
+ return qmi->service_data[idx].client_id;
+}
+
+int qmi_device_open(struct qmi_dev *qmi, const char *path)
+{
+ struct ustream *us = &qmi->sf.stream;
+ int fd;
+
+ uloop_init();
+
+ fd = open(path, O_RDWR | O_EXCL | O_NONBLOCK | O_NOCTTY);
+ if (fd < 0)
+ return -1;
+
+ us->notify_read = qmi_notify_read;
+ ustream_fd_init(&qmi->sf, fd);
+ INIT_LIST_HEAD(&qmi->req);
+ qmi->ctl_tid = 1;
+
+ return 0;
+}
+
+void qmi_device_close(struct qmi_dev *qmi)
+{
+ struct qmi_request *req;
+ int idx;
+
+ qmi_close_all_services(qmi);
+ ustream_free(&qmi->sf.stream);
+ close(qmi->sf.fd.fd);
+
+ while (!list_empty(&qmi->req)) {
+ req = list_first_entry(&qmi->req, struct qmi_request, list);
+ qmi_request_cancel(qmi, req);
+ }
+}
+
+QmiService qmi_service_get_by_name(const char *str)
+{
+ static const struct {
+ const char *name;
+ QmiService svc;
+ } services[] = {
+ { "dms", QMI_SERVICE_DMS },
+ { "nas", QMI_SERVICE_NAS },
+ { "pds", QMI_SERVICE_PDS },
+ { "wds", QMI_SERVICE_WDS },
+ { "wms", QMI_SERVICE_WMS },
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(services); i++) {
+ if (!strcasecmp(str, services[i].name))
+ return services[i].svc;
+ }
+
+ return -1;
+}
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..47e0ff2
--- /dev/null
+++ b/main.c
@@ -0,0 +1,95 @@
+#include <libubox/uloop.h>
+#include <libubox/utils.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <getopt.h>
+
+#include "uqmi.h"
+#include "commands.h"
+
+static const char *device;
+
+#define CMD_OPT(_arg) (-2 - _arg)
+
+#define __uqmi_command(_name, _optname, _arg, _option) { #_optname, _arg##_argument, NULL, CMD_OPT(__UQMI_COMMAND_##_name) }
+static const struct option uqmi_getopt[] = {
+ __uqmi_commands,
+ { "device", required_argument, NULL, 'd' },
+ { "keep-client-id", required_argument, NULL, 'K' },
+ { NULL, 0, NULL, 0 }
+};
+#undef __uqmi_command
+
+static int usage(const char *progname)
+{
+ fprintf(stderr, "Usage: %s <options|actions>\n"
+ "Options:\n"
+ " --device=NAME, -d NAME: Set device name to NAME (required)\n"
+ " --keep-client-id <name>: Keep Client ID for service <name>\n"
+ " (implies --keep-client-id)\n"
+ "\n"
+ "Services: dms, nas, pds, wds, wms\n"
+ "\n"
+ "Actions:\n"
+ " --get-versions: Get service versions\n"
+ " --set-client-id <name>,<id>: Set Client ID for service <name> to <id>\n"
+ " --get-client-id <name>: Connect and get Client ID for service <name>\n"
+ " (implies --keep-client-id)\n"
+ "\n", progname);
+ return 1;
+}
+
+static void keep_client_id(struct qmi_dev *qmi, const char *optarg)
+{
+ QmiService svc = qmi_service_get_by_name(optarg);
+ if (svc < 0) {
+ fprintf(stderr, "Invalid service %s\n", optarg);
+ exit(1);
+ }
+ qmi_service_get_client_id(qmi, svc);
+}
+
+int main(int argc, char **argv)
+{
+ static struct qmi_dev dev;
+ int ch;
+
+ while ((ch = getopt_long(argc, argv, "d:k:", uqmi_getopt, NULL)) != -1) {
+ int cmd_opt = CMD_OPT(ch);
+
+ if (ch < 0 && cmd_opt >= 0 && cmd_opt < __UQMI_COMMAND_LAST) {
+ uqmi_add_command(optarg, cmd_opt);
+ continue;
+ }
+
+ switch(ch) {
+ case 'k':
+ keep_client_id(&dev, optarg);
+ break;
+ case 'd':
+ device = optarg;
+ break;
+ default:
+ return usage(argv[0]);
+ }
+ }
+
+ if (!device) {
+ fprintf(stderr, "No device given\n");
+ return usage(argv[0]);
+ }
+
+ if (qmi_device_open(&dev, device)) {
+ fprintf(stderr, "Failed to open device\n");
+ return 2;
+ }
+
+ uqmi_run_commands(&dev);
+
+ qmi_device_close(&dev);
+
+ return 0;
+}
diff --git a/qmi-enums-dms.h b/qmi-enums-dms.h
new file mode 100644
index 0000000..62c31da
--- /dev/null
+++ b/qmi-enums-dms.h
@@ -0,0 +1,337 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Lanedo GmbH <aleksander@lanedo.com>
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_ENUMS_DMS_H_
+#define _LIBQMI_GLIB_QMI_ENUMS_DMS_H_
+
+/**
+ * SECTION: qmi-enums-dms
+ * @title: DMS enumerations and flags
+ *
+ * This section defines enumerations and flags used in the DMS service
+ * interface.
+ */
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS Get Capabilities' message */
+
+/**
+ * QmiDmsDataServiceCapability:
+ * @QMI_DMS_DATA_SERVICE_CAPABILITY_NONE: No data services supported.
+ * @QMI_DMS_DATA_SERVICE_CAPABILITY_CS: Only CS supported.
+ * @QMI_DMS_DATA_SERVICE_CAPABILITY_PS: Only PS supported.
+ * @QMI_DMS_DATA_SERVICE_CAPABILITY_SIMULTANEOUS_CS_PS: Simultaneous CS and PS supported.
+ * @QMI_DMS_DATA_SERVICE_CAPABILITY_NON_SIMULTANEOUS_CS_PS: Non simultaneous CS and PS supported.
+ *
+ * Data service capability.
+ */
+typedef enum {
+ QMI_DMS_DATA_SERVICE_CAPABILITY_NONE = 0,
+ QMI_DMS_DATA_SERVICE_CAPABILITY_CS = 1,
+ QMI_DMS_DATA_SERVICE_CAPABILITY_PS = 2,
+ QMI_DMS_DATA_SERVICE_CAPABILITY_SIMULTANEOUS_CS_PS = 3,
+ QMI_DMS_DATA_SERVICE_CAPABILITY_NON_SIMULTANEOUS_CS_PS = 4
+} QmiDmsDataServiceCapability;
+
+/**
+ * QmiDmsSimCapability:
+ * @QMI_DMS_SIM_CAPABILITY_NOT_SUPPORTED: SIM not supported.
+ * @QMI_DMS_SIM_CAPABILITY_SUPPORTED: SIM is supported.
+ *
+ * SIM capability.
+ */
+typedef enum {
+ QMI_DMS_SIM_CAPABILITY_NOT_SUPPORTED = 1,
+ QMI_DMS_SIM_CAPABILITY_SUPPORTED = 2
+} QmiDmsSimCapability;
+
+/**
+ * QmiDmsRadioInterface:
+ * @QMI_DMS_RADIO_INTERFACE_CDMA20001X: CDMA2000 1x.
+ * @QMI_DMS_RADIO_INTERFACE_EVDO: CDMA2000 HRPD (1xEV-DO)
+ * @QMI_DMS_RADIO_INTERFACE_GSM: GSM.
+ * @QMI_DMS_RADIO_INTERFACE_UMTS: UMTS.
+ * @QMI_DMS_RADIO_INTERFACE_LTE: LTE.
+ *
+ * Radio interface type.
+ */
+typedef enum {
+ QMI_DMS_RADIO_INTERFACE_CDMA20001X = 1,
+ QMI_DMS_RADIO_INTERFACE_EVDO = 2,
+ QMI_DMS_RADIO_INTERFACE_GSM = 4,
+ QMI_DMS_RADIO_INTERFACE_UMTS = 5,
+ QMI_DMS_RADIO_INTERFACE_LTE = 8
+} QmiDmsRadioInterface;
+
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS Get Power State' message */
+
+/**
+ * QmiDmsPowerState:
+ * @QMI_DMS_POWER_STATE_EXTERNAL_SOURCE: Powered by an external source.
+ * @QMI_DMS_POWER_STATE_BATTERY_CONNECTED: Battery is connected.
+ * @QMI_DMS_POWER_STATE_BATTERY_CHARGING: Battery is currently being charged.
+ * @QMI_DMS_POWER_STATE_FAULT: Recognized power fault.
+ *
+ * Flags specifying the current power state.
+ *
+ * If @QMI_DMS_POWER_STATE_EXTERNAL_SOURCE is set, the device is powerered by an
+ * external source; otherwise it is powered by a battery.
+ *
+ * If @QMI_DMS_POWER_STATE_BATTERY_CONNECTED is set, the battery is connected;
+ * otherwise the battery is not connected.
+ *
+ * If @QMI_DMS_POWER_STATE_BATTERY_CHARGING is set, the battery is being charged;
+ * otherwise the battery is not being charged.
+ *
+ * If @QMI_DMS_POWER_STATE_FAULT is set, a power fault has been detected.
+ */
+typedef enum {
+ QMI_DMS_POWER_STATE_EXTERNAL_SOURCE = 1 << 0,
+ QMI_DMS_POWER_STATE_BATTERY_CONNECTED = 1 << 1,
+ QMI_DMS_POWER_STATE_BATTERY_CHARGING = 1 << 2,
+ QMI_DMS_POWER_STATE_FAULT = 1 << 3,
+} QmiDmsPowerState;
+
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS UIM Set PIN Protection' message */
+
+/**
+ * QmiDmsUimPinId:
+ * @QMI_DMS_UIM_PIN_ID_PIN: PIN.
+ * @QMI_DMS_UIM_PIN_ID_PIN2: PIN2.
+ *
+ * The PIN identifier.
+ */
+typedef enum {
+ QMI_DMS_UIM_PIN_ID_PIN = 1,
+ QMI_DMS_UIM_PIN_ID_PIN2 = 2
+} QmiDmsUimPinId;
+
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS UIM Get PIN Status' message */
+
+/**
+ * QmiDmsUimPinStatus:
+ * @QMI_DMS_UIM_PIN_STATUS_NOT_INITIALIZED: Not initialized.
+ * @QMI_DMS_UIM_PIN_STATUS_ENABLED_NOT_VERIFIED: Enabled, not verified.
+ * @QMI_DMS_UIM_PIN_STATUS_ENABLED_VERIFIED: Enabled, verified.
+ * @QMI_DMS_UIM_PIN_STATUS_DISABLED: Disabled.
+ * @QMI_DMS_UIM_PIN_STATUS_BLOCKED: Blocked.
+ * @QMI_DMS_UIM_PIN_STATUS_PERMANENTLY_BLOCKED: Permanently Blocked.
+ * @QMI_DMS_UIM_PIN_STATUS_UNBLOCKED: Unblocked.
+ * @QMI_DMS_UIM_PIN_STATUS_CHANGED: Changed.
+ *
+ * The PIN status.
+ */
+typedef enum {
+ QMI_DMS_UIM_PIN_STATUS_NOT_INITIALIZED = 0,
+ QMI_DMS_UIM_PIN_STATUS_ENABLED_NOT_VERIFIED = 1,
+ QMI_DMS_UIM_PIN_STATUS_ENABLED_VERIFIED = 2,
+ QMI_DMS_UIM_PIN_STATUS_DISABLED = 3,
+ QMI_DMS_UIM_PIN_STATUS_BLOCKED = 4,
+ QMI_DMS_UIM_PIN_STATUS_PERMANENTLY_BLOCKED = 5,
+ QMI_DMS_UIM_PIN_STATUS_UNBLOCKED = 6,
+ QMI_DMS_UIM_PIN_STATUS_CHANGED = 7,
+} QmiDmsUimPinStatus;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS Get Operating Mode' message */
+
+/**
+ * QmiDmsOperatingMode:
+ * @QMI_DMS_OPERATING_MODE_ONLINE: Device can acquire a system and make calls.
+ * @QMI_DMS_OPERATING_MODE_LOW_POWER: Device has temporarily disabled RF.
+ * @QMI_DMS_OPERATING_MODE_PERSISTENT_LOW_POWER: Device has disabled RF and state persists even after a reset.
+ * @QMI_DMS_OPERATING_MODE_FACTORY_TEST: Special mode for manufacturer tests.
+ * @QMI_DMS_OPERATING_MODE_OFFLINE: Device has deactivated RF and is partially shutdown.
+ * @QMI_DMS_OPERATING_MODE_RESET: Device is in the process of power cycling.
+ * @QMI_DMS_OPERATING_MODE_SHUTTING_DOWN: Device is in the process of shutting down.
+ * @QMI_DMS_OPERATING_MODE_MODE_ONLY_LOW_POWER: Mode-only Low Power.
+ * @QMI_DMS_OPERATING_MODE_UNKNOWN: Unknown.
+ *
+ * Operating mode of the device.
+ */
+typedef enum {
+ QMI_DMS_OPERATING_MODE_ONLINE = 0,
+ QMI_DMS_OPERATING_MODE_LOW_POWER = 1,
+ QMI_DMS_OPERATING_MODE_FACTORY_TEST = 2,
+ QMI_DMS_OPERATING_MODE_OFFLINE = 3,
+ QMI_DMS_OPERATING_MODE_RESET = 4,
+ QMI_DMS_OPERATING_MODE_SHUTTING_DOWN = 5,
+ QMI_DMS_OPERATING_MODE_PERSISTENT_LOW_POWER = 6,
+ QMI_DMS_OPERATING_MODE_MODE_ONLY_LOW_POWER = 7,
+ QMI_DMS_OPERATING_MODE_UNKNOWN = 0xFF
+} QmiDmsOperatingMode;
+
+/**
+ * QmiDmsOfflineReason:
+ * @QMI_DMS_OFFLINE_REASON_HOST_IMAGE_MISCONFIGURATION: Host image misconfiguration.
+ * @QMI_DMS_OFFLINE_REASON_PRI_IMAGE_MISCONFIGURATION: PRI image misconfiguration.
+ * @QMI_DMS_OFFLINE_REASON_PRI_VERSION_INCOMPATIBLE: PRI version incompatible.
+ * @QMI_DMS_OFFLINE_REASON_DEVICE_MEMORY_FULL: Memory full, cannot copy PRI information.
+ *
+ * Reasons for being in Offline (@QMI_DMS_OPERATING_MODE_OFFLINE) state.
+ */
+typedef enum {
+ QMI_DMS_OFFLINE_REASON_HOST_IMAGE_MISCONFIGURATION = 1 << 0,
+ QMI_DMS_OFFLINE_REASON_PRI_IMAGE_MISCONFIGURATION = 1 << 1,
+ QMI_DMS_OFFLINE_REASON_PRI_VERSION_INCOMPATIBLE = 1 << 2,
+ QMI_DMS_OFFLINE_REASON_DEVICE_MEMORY_FULL = 1 << 3
+} QmiDmsOfflineReason;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS Get Time' message */
+
+/**
+ * QmiDmsTimeSource:
+ * @QMI_DMS_TIME_SOURCE_DEVICE: 32 kHz device clock.
+ * @QMI_DMS_TIME_SOURCE_CDMA_NETWORK: CDMA network.
+ * @QMI_DMS_TIME_SOURCE_HDR_NETWORK: HDR network.
+ *
+ * Source of the timestamp.
+ */
+typedef enum {
+ QMI_DMS_TIME_SOURCE_DEVICE = 0,
+ QMI_DMS_TIME_SOURCE_CDMA_NETWORK = 1,
+ QMI_DMS_TIME_SOURCE_HDR_NETWORK = 2,
+} QmiDmsTimeSource;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS Get Activation State' message */
+
+/**
+ * QmiDmsActivationState:
+ * @QMI_DMS_ACTIVATION_STATE_NOT_ACTIVATED: Service not activated.
+ * @QMI_DMS_ACTIVATION_STATE_ACTIVATED: Service is activated.
+ * @QMI_DMS_ACTIVATION_STATE_CONNECTING: Connection in progress for automatic activation.
+ * @QMI_DMS_ACTIVATION_STATE_CONNECTED: Connection connected for automatic activation.
+ * @QMI_DMS_ACTIVATION_STATE_OTASP_AUTHENTICATED: OTASP security authenticated.
+ * @QMI_DMS_ACTIVATION_STATE_OTASP_NAM: OTASP NAM downloaded.
+ * @QMI_DMS_ACTIVATION_STATE_OTASP_MDN: OTASP MDN downloaded.
+ * @QMI_DMS_ACTIVATION_STATE_OTASP_IMSI: OTASP IMSI downloaded.
+ * @QMI_DMS_ACTIVATION_STATE_OTASP_PRL: OTASP PRL downloaded.
+ * @QMI_DMS_ACTIVATION_STATE_OTASP_SPC: OTASP SPC downloaded.
+ * @QMI_DMS_ACTIVATION_STATE_OTASP_COMMITED: OTASP settings committed.
+ *
+ * State of the service activation.
+ */
+typedef enum {
+ QMI_DMS_ACTIVATION_STATE_NOT_ACTIVATED = 0x00,
+ QMI_DMS_ACTIVATION_STATE_ACTIVATED = 0x01,
+ QMI_DMS_ACTIVATION_STATE_CONNECTING = 0x02,
+ QMI_DMS_ACTIVATION_STATE_CONNECTED = 0x03,
+ QMI_DMS_ACTIVATION_STATE_OTASP_AUTHENTICATED = 0x04,
+ QMI_DMS_ACTIVATION_STATE_OTASP_NAM = 0x05,
+ QMI_DMS_ACTIVATION_STATE_OTASP_MDN = 0x06,
+ QMI_DMS_ACTIVATION_STATE_OTASP_IMSI = 0x07,
+ QMI_DMS_ACTIVATION_STATE_OTASP_PRL = 0x08,
+ QMI_DMS_ACTIVATION_STATE_OTASP_SPC = 0x09,
+ QMI_DMS_ACTIVATION_STATE_OTASP_COMMITED = 0x0A
+} QmiDmsActivationState;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS UIM Get CK Status' message */
+
+/**
+ * QmiDmsUimFacility:
+ * @QMI_DMS_UIM_FACILITY_PN: Network personalization facility.
+ * @QMI_DMS_UIM_FACILITY_PU: Network subset personalization facility.
+ * @QMI_DMS_UIM_FACILITY_PP: Service provider facility.
+ * @QMI_DMS_UIM_FACILITY_PC: Corporate personalization facility.
+ * @QMI_DMS_UIM_FACILITY_PF: UIM personalization facility.
+ *
+ * UIM personalization facilities.
+ */
+typedef enum {
+ QMI_DMS_UIM_FACILITY_PN = 0,
+ QMI_DMS_UIM_FACILITY_PU = 1,
+ QMI_DMS_UIM_FACILITY_PP = 2,
+ QMI_DMS_UIM_FACILITY_PC = 3,
+ QMI_DMS_UIM_FACILITY_PF = 4
+} QmiDmsUimFacility;
+
+/**
+ * QmiDmsUimFacilityState:
+ * @QMI_DMS_UIM_FACILITY_STATE_DEACTIVATED: Facility is deactivated.
+ * @QMI_DMS_UIM_FACILITY_STATE_ACTIVATED: Facility is activated.
+ * @QMI_DMS_UIM_FACILITY_STATE_BLOCKED: Facility is blocked.
+ */
+typedef enum {
+ QMI_DMS_UIM_FACILITY_STATE_DEACTIVATED = 0,
+ QMI_DMS_UIM_FACILITY_STATE_ACTIVATED = 1,
+ QMI_DMS_UIM_FACILITY_STATE_BLOCKED = 2
+} QmiDmsUimFacilityState;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS UIM Get State' message */
+
+/**
+ * QmiDmsUimState:
+ * @QMI_DMS_UIM_STATE_INITIALIZATION_COMPLETED: UIM initialization completed.
+ * @QMI_DMS_UIM_STATE_LOCKED_OR_FAILED: UIM is locked or failed.
+ * @QMI_DMS_UIM_STATE_NOT_PRESENT: No UIM in the device.
+ * @QMI_DMS_UIM_STATE_RESERVED: Reserved, unknown.
+ * @QMI_DMS_UIM_STATE_UNKNOWN: UIM state currently unavailable.
+ *
+ * State of the UIM.
+ */
+typedef enum {
+ QMI_DMS_UIM_STATE_INITIALIZATION_COMPLETED = 0x00,
+ QMI_DMS_UIM_STATE_LOCKED_OR_FAILED = 0x01,
+ QMI_DMS_UIM_STATE_NOT_PRESENT = 0x02,
+ QMI_DMS_UIM_STATE_RESERVED = 0x03,
+ QMI_DMS_UIM_STATE_UNKNOWN = 0xFF
+} QmiDmsUimState;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS Set Time' message */
+
+/**
+ * QmiDmsTimeReferenceType:
+ * @QMI_DMS_TIME_REFERENCE_TYPE_USER: User time.
+ *
+ * Time reference type.
+ */
+typedef enum {
+ QMI_DMS_TIME_REFERENCE_TYPE_USER = 0
+} QmiDmsTimeReferenceType;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS Get Firmware Preference' message */
+
+/**
+ * QmiDmsFirmwareImageType:
+ * @QMI_DMS_FIRMWARE_IMAGE_TYPE_MODEM: Modem image.
+ * @QMI_DMS_FIRMWARE_IMAGE_TYPE_PRI: PRI image.
+ *
+ * Type of firmware image.
+ */
+typedef enum {
+ QMI_DMS_FIRMWARE_IMAGE_TYPE_MODEM = 0,
+ QMI_DMS_FIRMWARE_IMAGE_TYPE_PRI = 1
+} QmiDmsFirmwareImageType;
+
+#endif /* _LIBQMI_GLIB_QMI_ENUMS_DMS_H_ */
diff --git a/qmi-enums-nas.h b/qmi-enums-nas.h
new file mode 100644
index 0000000..6307311
--- /dev/null
+++ b/qmi-enums-nas.h
@@ -0,0 +1,835 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Google Inc.
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_ENUMS_NAS_H_
+#define _LIBQMI_GLIB_QMI_ENUMS_NAS_H_
+
+/**
+ * SECTION: qmi-enums-nas
+ * @title: NAS enumerations and flags
+ *
+ * This section defines enumerations and flags used in the NAS service
+ * interface.
+ */
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Event Report' indication */
+
+/**
+ * QmiNasRadioInterface:
+ * @QMI_NAS_RADIO_INTERFACE_UNKNOWN: Not known or not needed.
+ * @QMI_NAS_RADIO_INTERFACE_NONE: None, no service.
+ * @QMI_NAS_RADIO_INTERFACE_CDMA_1X: CDMA2000 1X.
+ * @QMI_NAS_RADIO_INTERFACE_CDMA_1XEVDO: CDMA2000 HRPD (1xEV-DO).
+ * @QMI_NAS_RADIO_INTERFACE_AMPS: AMPS.
+ * @QMI_NAS_RADIO_INTERFACE_GSM: GSM.
+ * @QMI_NAS_RADIO_INTERFACE_UMTS: UMTS.
+ * @QMI_NAS_RADIO_INTERFACE_LTE: LTE.
+ * @QMI_NAS_RADIO_INTERFACE_TD_SCDMA: TD-SCDMA.
+ *
+ * Radio interface technology.
+ */
+typedef enum {
+ QMI_NAS_RADIO_INTERFACE_UNKNOWN = -1,
+ QMI_NAS_RADIO_INTERFACE_NONE = 0x00,
+ QMI_NAS_RADIO_INTERFACE_CDMA_1X = 0x01,
+ QMI_NAS_RADIO_INTERFACE_CDMA_1XEVDO = 0x02,
+ QMI_NAS_RADIO_INTERFACE_AMPS = 0x03,
+ QMI_NAS_RADIO_INTERFACE_GSM = 0x04,
+ QMI_NAS_RADIO_INTERFACE_UMTS = 0x05,
+ QMI_NAS_RADIO_INTERFACE_LTE = 0x08,
+ QMI_NAS_RADIO_INTERFACE_TD_SCDMA = 0x09
+} QmiNasRadioInterface;
+
+/**
+ * QmiNasActiveBand:
+ * @QMI_NAS_ACTIVE_BAND_BC_0: Band class 0.
+ * @QMI_NAS_ACTIVE_BAND_BC_1: Band class 1.
+ * @QMI_NAS_ACTIVE_BAND_BC_2: Band class 2.
+ * @QMI_NAS_ACTIVE_BAND_BC_3: Band class 3.
+ * @QMI_NAS_ACTIVE_BAND_BC_4: Band class 4.
+ * @QMI_NAS_ACTIVE_BAND_BC_5: Band class 5.
+ * @QMI_NAS_ACTIVE_BAND_BC_6: Band class 6.
+ * @QMI_NAS_ACTIVE_BAND_BC_7: Band class 7.
+ * @QMI_NAS_ACTIVE_BAND_BC_8: Band class 8.
+ * @QMI_NAS_ACTIVE_BAND_BC_9: Band class 9.
+ * @QMI_NAS_ACTIVE_BAND_BC_10: Band class 10.
+ * @QMI_NAS_ACTIVE_BAND_BC_11: Band class 11.
+ * @QMI_NAS_ACTIVE_BAND_BC_12: Band class 12.
+ * @QMI_NAS_ACTIVE_BAND_BC_13: Band class 13.
+ * @QMI_NAS_ACTIVE_BAND_BC_14: Band class 14.
+ * @QMI_NAS_ACTIVE_BAND_BC_15: Band class 15.
+ * @QMI_NAS_ACTIVE_BAND_BC_16: Band class 16.
+ * @QMI_NAS_ACTIVE_BAND_BC_17: Band class 17.
+ * @QMI_NAS_ACTIVE_BAND_BC_18: Band class 18.
+ * @QMI_NAS_ACTIVE_BAND_BC_19: Band class 19.
+ * @QMI_NAS_ACTIVE_BAND_GSM_450: GSM 450.
+ * @QMI_NAS_ACTIVE_BAND_GSM_480: GSM 480.
+ * @QMI_NAS_ACTIVE_BAND_GSM_750: GSM 750.
+ * @QMI_NAS_ACTIVE_BAND_GSM_850: GSM 850.
+ * @QMI_NAS_ACTIVE_BAND_GSM_900_EXTENDED: GSM 900 (Extended).
+ * @QMI_NAS_ACTIVE_BAND_GSM_900_PRIMARY: GSM 900 (Primary).
+ * @QMI_NAS_ACTIVE_BAND_GSM_900_RAILWAYS: GSM 900 (Railways).
+ * @QMI_NAS_ACTIVE_BAND_GSM_DCS_1800: GSM 1800.
+ * @QMI_NAS_ACTIVE_BAND_GSM_PCS_1900: GSM 1900.
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_2100: WCDMA 2100.
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_PCS_1900: WCDMA PCS 1900.
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_DCS_1800: WCDMA DCS 1800.
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_1700_US: WCDMA 1700 (U.S.).
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_850: WCDMA 850.
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_800: WCDMA 800.
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_2600: WCDMA 2600.
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_900: WCDMA 900.
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_1700_JAPAN: WCDMA 1700 (Japan).
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_1500_JAPAN: WCDMA 1500 (Japan).
+ * @QMI_NAS_ACTIVE_BAND_WCDMA_850_JAPAN: WCDMA 850 (Japan).
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_1: EUTRAN band 1.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_2: EUTRAN band 2.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_3: EUTRAN band 3.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_4: EUTRAN band 4.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_5: EUTRAN band 5.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_6: EUTRAN band 6.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_7: EUTRAN band 7.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_8: EUTRAN band 8.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_9: EUTRAN band 9.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_10: EUTRAN band 10.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_11: EUTRAN band 11.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_12: EUTRAN band 12.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_13: EUTRAN band 13.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_14: EUTRAN band 14.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_17: EUTRAN band 17.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_18: EUTRAN band 18.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_19: EUTRAN band 19.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_20: EUTRAN band 20.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_21: EUTRAN band 21.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_24: EUTRAN band 24.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_25: EUTRAN band 25.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_33: EUTRAN band 33.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_34: EUTRAN band 34.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_35: EUTRAN band 35.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_36: EUTRAN band 36.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_37: EUTRAN band 37.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_38: EUTRAN band 38.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_39: EUTRAN band 39.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_40: EUTRAN band 40.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_41: EUTRAN band 41.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_42: EUTRAN band 42.
+ * @QMI_NAS_ACTIVE_BAND_EUTRAN_43: EUTRAN band 43.
+ * @QMI_NAS_ACTIVE_BAND_TDSCDMA_A: TD-SCDMA Band A.
+ * @QMI_NAS_ACTIVE_BAND_TDSCDMA_B: TD-SCDMA Band B.
+ * @QMI_NAS_ACTIVE_BAND_TDSCDMA_C: TD-SCDMA Band C.
+ * @QMI_NAS_ACTIVE_BAND_TDSCDMA_D: TD-SCDMA Band D.
+ * @QMI_NAS_ACTIVE_BAND_TDSCDMA_E: TD-SCDMA Band E.
+ * @QMI_NAS_ACTIVE_BAND_TDSCDMA_F: TD-SCDMA Band F.
+ *
+ * Band classes.
+ */
+typedef enum {
+ QMI_NAS_ACTIVE_BAND_BC_0 = 0,
+ QMI_NAS_ACTIVE_BAND_BC_1 = 1,
+ QMI_NAS_ACTIVE_BAND_BC_2 = 2,
+ QMI_NAS_ACTIVE_BAND_BC_3 = 3,
+ QMI_NAS_ACTIVE_BAND_BC_4 = 4,
+ QMI_NAS_ACTIVE_BAND_BC_5 = 5,
+ QMI_NAS_ACTIVE_BAND_BC_6 = 6,
+ QMI_NAS_ACTIVE_BAND_BC_7 = 7,
+ QMI_NAS_ACTIVE_BAND_BC_8 = 8,
+ QMI_NAS_ACTIVE_BAND_BC_9 = 9,
+ QMI_NAS_ACTIVE_BAND_BC_10 = 10,
+ QMI_NAS_ACTIVE_BAND_BC_11 = 11,
+ QMI_NAS_ACTIVE_BAND_BC_12 = 12,
+ QMI_NAS_ACTIVE_BAND_BC_13 = 13,
+ QMI_NAS_ACTIVE_BAND_BC_14 = 14,
+ QMI_NAS_ACTIVE_BAND_BC_15 = 15,
+ QMI_NAS_ACTIVE_BAND_BC_16 = 16,
+ QMI_NAS_ACTIVE_BAND_BC_17 = 17,
+ QMI_NAS_ACTIVE_BAND_BC_18 = 18,
+ QMI_NAS_ACTIVE_BAND_BC_19 = 19,
+ QMI_NAS_ACTIVE_BAND_GSM_450 = 40,
+ QMI_NAS_ACTIVE_BAND_GSM_480 = 41,
+ QMI_NAS_ACTIVE_BAND_GSM_750 = 42,
+ QMI_NAS_ACTIVE_BAND_GSM_850 = 43,
+ QMI_NAS_ACTIVE_BAND_GSM_900_EXTENDED = 44,
+ QMI_NAS_ACTIVE_BAND_GSM_900_PRIMARY = 45,
+ QMI_NAS_ACTIVE_BAND_GSM_900_RAILWAYS = 46,
+ QMI_NAS_ACTIVE_BAND_GSM_DCS_1800 = 47,
+ QMI_NAS_ACTIVE_BAND_GSM_PCS_1900 = 48,
+ QMI_NAS_ACTIVE_BAND_WCDMA_2100 = 80,
+ QMI_NAS_ACTIVE_BAND_WCDMA_PCS_1900 = 81,
+ QMI_NAS_ACTIVE_BAND_WCDMA_DCS_1800 = 82,
+ QMI_NAS_ACTIVE_BAND_WCDMA_1700_US = 83,
+ QMI_NAS_ACTIVE_BAND_WCDMA_850 = 84,
+ QMI_NAS_ACTIVE_BAND_WCDMA_800 = 85,
+ QMI_NAS_ACTIVE_BAND_WCDMA_2600 = 86,
+ QMI_NAS_ACTIVE_BAND_WCDMA_900 = 87,
+ QMI_NAS_ACTIVE_BAND_WCDMA_1700_JAPAN = 88,
+ QMI_NAS_ACTIVE_BAND_WCDMA_1500_JAPAN = 90,
+ QMI_NAS_ACTIVE_BAND_WCDMA_850_JAPAN = 91,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_1 = 120,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_2 = 121,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_3 = 122,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_4 = 123,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_5 = 124,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_6 = 125,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_7 = 126,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_8 = 127,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_9 = 128,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_10 = 129,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_11 = 130,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_12 = 131,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_13 = 132,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_14 = 133,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_17 = 134,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_18 = 143,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_19 = 144,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_20 = 145,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_21 = 146,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_24 = 147,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_25 = 148,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_33 = 135,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_34 = 136,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_35 = 137,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_36 = 138,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_37 = 139,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_38 = 140,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_39 = 141,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_40 = 142,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_41 = 149,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_42 = 150,
+ QMI_NAS_ACTIVE_BAND_EUTRAN_43 = 151,
+ QMI_NAS_ACTIVE_BAND_TDSCDMA_A = 200,
+ QMI_NAS_ACTIVE_BAND_TDSCDMA_B = 201,
+ QMI_NAS_ACTIVE_BAND_TDSCDMA_C = 202,
+ QMI_NAS_ACTIVE_BAND_TDSCDMA_D = 203,
+ QMI_NAS_ACTIVE_BAND_TDSCDMA_E = 204,
+ QMI_NAS_ACTIVE_BAND_TDSCDMA_F = 205
+} QmiNasActiveBand;
+
+/**
+ * QmiNasNetworkServiceDomain:
+ * @QMI_NAS_NETWORK_SERVICE_DOMAIN_NONE: No service.
+ * @QMI_NAS_NETWORK_SERVICE_DOMAIN_CS: Circuit switched.
+ * @QMI_NAS_NETWORK_SERVICE_DOMAIN_PS: Packet switched.
+ * @QMI_NAS_NETWORK_SERVICE_DOMAIN_CS_PS: Circuit and packet switched.
+ * @QMI_NAS_NETWORK_SERVICE_DOMAIN_UNKNOWN: Unknown service.
+ *
+ * Network Service Domain.
+ */
+typedef enum {
+ QMI_NAS_NETWORK_SERVICE_DOMAIN_NONE = 0x00,
+ QMI_NAS_NETWORK_SERVICE_DOMAIN_CS = 0x01,
+ QMI_NAS_NETWORK_SERVICE_DOMAIN_PS = 0x02,
+ QMI_NAS_NETWORK_SERVICE_DOMAIN_CS_PS = 0x03,
+ QMI_NAS_NETWORK_SERVICE_DOMAIN_UNKNOWN = 0x04,
+} QmiNasNetworkServiceDomain;
+
+/**
+ * QmiNasEvdoSinrLevel:
+ * @QMI_NAS_EVDO_SINR_LEVEL_0: -9 dB.
+ * @QMI_NAS_EVDO_SINR_LEVEL_1: -6 dB.
+ * @QMI_NAS_EVDO_SINR_LEVEL_2: -4.5 dB.
+ * @QMI_NAS_EVDO_SINR_LEVEL_3: -3 dB.
+ * @QMI_NAS_EVDO_SINR_LEVEL_4: -2 dB.
+ * @QMI_NAS_EVDO_SINR_LEVEL_5: +1 dB.
+ * @QMI_NAS_EVDO_SINR_LEVEL_6: +3 dB.
+ * @QMI_NAS_EVDO_SINR_LEVEL_7: +6 dB.
+ * @QMI_NAS_EVDO_SINR_LEVEL_8: +9 dB.
+ *
+ * EV-DO SINR level.
+ */
+typedef enum {
+ QMI_NAS_EVDO_SINR_LEVEL_0 = 0,
+ QMI_NAS_EVDO_SINR_LEVEL_1 = 1,
+ QMI_NAS_EVDO_SINR_LEVEL_2 = 2,
+ QMI_NAS_EVDO_SINR_LEVEL_3 = 3,
+ QMI_NAS_EVDO_SINR_LEVEL_4 = 4,
+ QMI_NAS_EVDO_SINR_LEVEL_5 = 5,
+ QMI_NAS_EVDO_SINR_LEVEL_6 = 6,
+ QMI_NAS_EVDO_SINR_LEVEL_7 = 7,
+ QMI_NAS_EVDO_SINR_LEVEL_8 = 8
+} QmiNasEvdoSinrLevel;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Get Signal Strength' request/response */
+
+/**
+ * QmiNasSignalStrengthRequest:
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_NONE: None.
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_RSSI: Request RSSI information.
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_ECIO: Request ECIO information.
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_IO: Request IO information.
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_SINR: Request SINR information.
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_ERROR_RATE: Request error rate information.
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_RSRQ: Request RSRQ information.
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_LTE_SNR: Request LTE SNR information.
+ * @QMI_NAS_SIGNAL_STRENGTH_REQUEST_LTE_RSRP: Request LTE RSRP information.
+ *
+ * Extra information to request when gathering Signal Strength.
+ */
+typedef enum {
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_NONE = 0,
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_RSSI = 1 << 0,
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_ECIO = 1 << 1,
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_IO = 1 << 2,
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_SINR = 1 << 3,
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_ERROR_RATE = 1 << 4,
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_RSRQ = 1 << 5,
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_LTE_SNR = 1 << 6,
+ QMI_NAS_SIGNAL_STRENGTH_REQUEST_LTE_RSRP = 1 << 7
+} QmiNasSignalStrengthRequest;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Network Scan' request/response */
+
+/**
+ * QmiNasNetworkScanType:
+ * @QMI_NAS_NETWORK_SCAN_TYPE_GSM: GSM network.
+ * @QMI_NAS_NETWORK_SCAN_TYPE_UMTS: UMTS network.
+ * @QMI_NAS_NETWORK_SCAN_TYPE_LTE: LTE network.
+ * @QMI_NAS_NETWORK_SCAN_TYPE_TD_SCDMA: TD-SCDMA network.
+ *
+ * Flags to use when specifying which networks to scan.
+ */
+typedef enum {
+ QMI_NAS_NETWORK_SCAN_TYPE_GSM = 1 << 0,
+ QMI_NAS_NETWORK_SCAN_TYPE_UMTS = 1 << 1,
+ QMI_NAS_NETWORK_SCAN_TYPE_LTE = 1 << 2,
+ QMI_NAS_NETWORK_SCAN_TYPE_TD_SCDMA = 1 << 3
+} QmiNasNetworkScanType;
+
+/**
+ * QmiNasNetworkStatus:
+ * @QMI_NAS_NETWORK_STATUS_CURRENT_SERVING: Network is in use, current serving.
+ * @QMI_NAS_NETWORK_STATUS_AVAILABLE: Network is vailable.
+ * @QMI_NAS_NETWORK_STATUS_HOME: Network is home network.
+ * @QMI_NAS_NETWORK_STATUS_ROAMING: Network is a roaming network.
+ * @QMI_NAS_NETWORK_STATUS_FORBIDDEN: Network is forbidden.
+ * @QMI_NAS_NETWORK_STATUS_NOT_FORBIDDEN: Network is not forbidden.
+ * @QMI_NAS_NETWORK_STATUS_PREFERRED: Network is preferred.
+ * @QMI_NAS_NETWORK_STATUS_NOT_PREFERRED: Network is not preferred.
+ *
+ * Flags to specify the status of a given network.
+ */
+typedef enum {
+ QMI_NAS_NETWORK_STATUS_CURRENT_SERVING = 1 << 0,
+ QMI_NAS_NETWORK_STATUS_AVAILABLE = 1 << 1,
+ QMI_NAS_NETWORK_STATUS_HOME = 1 << 2,
+ QMI_NAS_NETWORK_STATUS_ROAMING = 1 << 3,
+ QMI_NAS_NETWORK_STATUS_FORBIDDEN = 1 << 4,
+ QMI_NAS_NETWORK_STATUS_NOT_FORBIDDEN = 1 << 5,
+ QMI_NAS_NETWORK_STATUS_PREFERRED = 1 << 6,
+ QMI_NAS_NETWORK_STATUS_NOT_PREFERRED = 1 << 7
+} QmiNasNetworkStatus;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Initiate Network Register' request/response */
+
+/**
+ * QmiNasNetworkRegisterType:
+ * @QMI_NAS_NETWORK_REGISTER_TYPE_AUTOMATIC: Automatic network registration.
+ * @QMI_NAS_NETWORK_REGISTER_TYPE_MANUAL: Manual network registration.
+ *
+ * Type of network registration.
+ */
+typedef enum {
+ QMI_NAS_NETWORK_REGISTER_TYPE_AUTOMATIC = 0x01,
+ QMI_NAS_NETWORK_REGISTER_TYPE_MANUAL = 0x02
+} QmiNasNetworkRegisterType;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Get Serving System' request/response */
+
+/**
+ * QmiNasRegistrationState:
+ * @QMI_NAS_REGISTRATION_STATE_NOT_REGISTERED: Not registered.
+ * @QMI_NAS_REGISTRATION_STATE_REGISTERED: Registered.
+ * @QMI_NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING: Searching.
+ * @QMI_NAS_REGISTRATION_STATE_REGISTRATION_DENIED: Registration denied.
+ * @QMI_NAS_REGISTRATION_STATE_UNKNOWN: Unknown.
+ *
+ * Status of the network registration.
+ */
+typedef enum {
+ QMI_NAS_REGISTRATION_STATE_NOT_REGISTERED = 0x00,
+ QMI_NAS_REGISTRATION_STATE_REGISTERED = 0x01,
+ QMI_NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 0x02,
+ QMI_NAS_REGISTRATION_STATE_REGISTRATION_DENIED = 0x03,
+ QMI_NAS_REGISTRATION_STATE_UNKNOWN = 0x04
+} QmiNasRegistrationState;
+
+/**
+ * QmiNasAttachState:
+ * @QMI_NAS_ATTACH_STATE_UNKNOWN: Unknown attach state.
+ * @QMI_NAS_ATTACH_STATE_ATTACHED: Attached.
+ * @QMI_NAS_ATTACH_STATE_DETACHED: Detached.
+ *
+ * Domain attach state.
+ */
+typedef enum {
+ QMI_NAS_ATTACH_STATE_UNKNOWN = 0x00,
+ QMI_NAS_ATTACH_STATE_ATTACHED = 0x01,
+ QMI_NAS_ATTACH_STATE_DETACHED = 0x02,
+} QmiNasAttachState;
+
+/**
+ * QmiNasNetworkType:
+ * @QMI_NAS_NETWORK_TYPE_UNKNOWN: Unknown.
+ * @QMI_NAS_NETWORK_TYPE_3GPP2: 3GPP2 network.
+ * @QMI_NAS_NETWORK_TYPE_3GPP: 3GPP network.
+ *
+ * Type of network.
+ */
+typedef enum {
+ QMI_NAS_NETWORK_TYPE_UNKNOWN = 0x00,
+ QMI_NAS_NETWORK_TYPE_3GPP2 = 0x01,
+ QMI_NAS_NETWORK_TYPE_3GPP = 0x02,
+} QmiNasNetworkType;
+
+/**
+ * QmiNasRoamingIndicatorStatus:
+ * @QMI_NAS_ROAMING_INDICATOR_STATUS_ON: Roaming.
+ * @QMI_NAS_ROAMING_INDICATOR_STATUS_OFF: Home.
+ *
+ * Status of the roaming indication.
+ */
+typedef enum {
+ QMI_NAS_ROAMING_INDICATOR_STATUS_ON = 0x00,
+ QMI_NAS_ROAMING_INDICATOR_STATUS_OFF = 0x01,
+ /* next values only for 3GPP2 */
+} QmiNasRoamingIndicatorStatus;
+
+/**
+ * QmiNasDataCapability:
+ * @QMI_NAS_DATA_CAPABILITY_NONE: None or unknown.
+ * @QMI_NAS_DATA_CAPABILITY_GPRS: GPRS.
+ * @QMI_NAS_DATA_CAPABILITY_EDGE: EDGE.
+ * @QMI_NAS_DATA_CAPABILITY_HSDPA: HSDPA.
+ * @QMI_NAS_DATA_CAPABILITY_HSUPA: HSUPA.
+ * @QMI_NAS_DATA_CAPABILITY_WCDMA: WCDMA.
+ * @QMI_NAS_DATA_CAPABILITY_CDMA: CDMA.
+ * @QMI_NAS_DATA_CAPABILITY_EVDO_REV_0: EV-DO revision 0.
+ * @QMI_NAS_DATA_CAPABILITY_EVDO_REV_A: EV-DO revision A.
+ * @QMI_NAS_DATA_CAPABILITY_GSM: GSM.
+ * @QMI_NAS_DATA_CAPABILITY_EVDO_REV_B: EV-DO revision B.
+ * @QMI_NAS_DATA_CAPABILITY_LTE: LTE.
+ * @QMI_NAS_DATA_CAPABILITY_HSDPA_PLUS: HSDPA+.
+ * @QMI_NAS_DATA_CAPABILITY_DC_HSDPA_PLUS: DC-HSDPA+.
+ *
+ * Data capability of the network.
+ */
+typedef enum {
+ QMI_NAS_DATA_CAPABILITY_NONE = 0x00,
+ QMI_NAS_DATA_CAPABILITY_GPRS = 0x01,
+ QMI_NAS_DATA_CAPABILITY_EDGE = 0x02,
+ QMI_NAS_DATA_CAPABILITY_HSDPA = 0x03,
+ QMI_NAS_DATA_CAPABILITY_HSUPA = 0x04,
+ QMI_NAS_DATA_CAPABILITY_WCDMA = 0x05,
+ QMI_NAS_DATA_CAPABILITY_CDMA = 0x06,
+ QMI_NAS_DATA_CAPABILITY_EVDO_REV_0 = 0x07,
+ QMI_NAS_DATA_CAPABILITY_EVDO_REV_A = 0x08,
+ QMI_NAS_DATA_CAPABILITY_GSM = 0x09,
+ QMI_NAS_DATA_CAPABILITY_EVDO_REV_B = 0x0A,
+ QMI_NAS_DATA_CAPABILITY_LTE = 0x0B,
+ QMI_NAS_DATA_CAPABILITY_HSDPA_PLUS = 0x0C,
+ QMI_NAS_DATA_CAPABILITY_DC_HSDPA_PLUS = 0x0D
+} QmiNasDataCapability;
+
+/**
+ * QmiNasServiceStatus:
+ * @QMI_NAS_SERVICE_STATUS_NONE: No service.
+ * @QMI_NAS_SERVICE_STATUS_LIMITED: Limited service.
+ * @QMI_NAS_SERVICE_STATUS_AVAILABLE: Service available.
+ * @QMI_NAS_SERVICE_STATUS_LIMITED_REGIONAL: Limited regional service.
+ * @QMI_NAS_SERVICE_STATUS_POWER_SAVE: Device in power save mode.
+ *
+ * Status of the service.
+ */
+typedef enum {
+ QMI_NAS_SERVICE_STATUS_NONE = 0x00,
+ QMI_NAS_SERVICE_STATUS_LIMITED = 0x01,
+ QMI_NAS_SERVICE_STATUS_AVAILABLE = 0x02,
+ QMI_NAS_SERVICE_STATUS_LIMITED_REGIONAL = 0x03,
+ QMI_NAS_SERVICE_STATUS_POWER_SAVE = 0x04
+} QmiNasServiceStatus;
+
+/**
+ * QmiNasHdrPersonality:
+ * @QMI_NAS_HDR_PERSONALITY_UNKNOWN: Unknown.
+ * @QMI_NAS_HDR_PERSONALITY_HRPD: HRPD.
+ * @QMI_NAS_HDR_PERSONALITY_EHRPD: eHRPD.
+ *
+ * HDR personality type.
+ */
+typedef enum {
+ QMI_NAS_HDR_PERSONALITY_UNKNOWN = 0x00,
+ QMI_NAS_HDR_PERSONALITY_HRPD = 0x01,
+ QMI_NAS_HDR_PERSONALITY_EHRPD = 0x02,
+} QmiNasHdrPersonality;
+
+/**
+ * QmiNasCallBarringStatus:
+ * @QMI_NAS_CALL_BARRING_STATUS_NORMAL_ONLY: Normal calls only.
+ * @QMI_NAS_CALL_BARRING_STATUS_EMERGENCY_ONLY: Emergency calls only.
+ * @QMI_NAS_CALL_BARRING_STATUS_NO_CALLS: No calls allowed.
+ * @QMI_NAS_CALL_BARRING_STATUS_ALL_CALLS: All calls allowed.
+ * @QMI_NAS_CALL_BARRING_STATUS_UNKNOWN: Unknown.
+ *
+ * Status of the call barring functionality.
+ */
+typedef enum {
+ QMI_NAS_CALL_BARRING_STATUS_NORMAL_ONLY = 0x00,
+ QMI_NAS_CALL_BARRING_STATUS_EMERGENCY_ONLY = 0x01,
+ QMI_NAS_CALL_BARRING_STATUS_NO_CALLS = 0x02,
+ QMI_NAS_CALL_BARRING_STATUS_ALL_CALLS = 0x03,
+ QMI_NAS_CALL_BARRING_STATUS_UNKNOWN = -1
+} QmiNasCallBarringStatus;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Get Home Network' request/response */
+
+/**
+ * QmiNasNetworkDescriptionDisplay:
+ * @QMI_NAS_NETWORK_DESCRIPTION_DISPLAY_NO: Don't display.
+ * @QMI_NAS_NETWORK_DESCRIPTION_DISPLAY_YES: Display.
+ * @QMI_NAS_NETWORK_DESCRIPTION_DISPLAY_UNKNOWN: Unknown.
+ *
+ * Setup to define whether the network description should be displayed.
+ */
+typedef enum {
+ QMI_NAS_NETWORK_DESCRIPTION_DISPLAY_NO = 0x00,
+ QMI_NAS_NETWORK_DESCRIPTION_DISPLAY_YES = 0x01,
+ QMI_NAS_NETWORK_DESCRIPTION_DISPLAY_UNKNOWN = 0xFF
+} QmiNasNetworkDescriptionDisplay;
+
+/**
+ * QmiNasNetworkDescriptionEncoding:
+ * @QMI_NAS_NETWORK_DESCRIPTION_ENCODING_UNSPECIFIED: Unspecified.
+ * @QMI_NAS_NETWORK_DESCRIPTION_ENCODING_ASCII7: ASCII-7.
+ * @QMI_NAS_NETWORK_DESCRIPTION_ENCODING_UNICODE: Unicode.
+ * @QMI_NAS_NETWORK_DESCRIPTION_ENCODING_GSM: GSM 7-bit.
+ *
+ * Type of encoding used in the network description.
+ */
+typedef enum {
+ QMI_NAS_NETWORK_DESCRIPTION_ENCODING_UNSPECIFIED = 0x00,
+ QMI_NAS_NETWORK_DESCRIPTION_ENCODING_ASCII7 = 0x01,
+ QMI_NAS_NETWORK_DESCRIPTION_ENCODING_UNICODE = 0x04,
+ QMI_NAS_NETWORK_DESCRIPTION_ENCODING_GSM = 0x09
+} QmiNasNetworkDescriptionEncoding;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Get Technology Preference' request/response */
+
+/**
+ * QmiNasRadioTechnologyPreference:
+ * @QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_AUTO: Automatic selection.
+ * @QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_3GPP2: 3GPP2 technology.
+ * @QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_3GPP: 3GPP technology.
+ * @QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_AMPS_OR_GSM: AMPS if 3GPP2, GSM if 3GPP.
+ * @QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_CDMA_OR_WCDMA: CDMA if 3GPP2, WCDMA if 3GPP.
+ * @QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_HDR: CDMA EV-DO.
+ * @QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_LTE: LTE.
+ *
+ * Flags to specify the radio technology preference.
+ */
+typedef enum {
+ QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_AUTO = 0,
+ QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_3GPP2 = 1 << 0,
+ QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_3GPP = 1 << 1,
+ QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_AMPS_OR_GSM = 1 << 2,
+ QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_CDMA_OR_WCDMA = 1 << 3,
+ QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_HDR = 1 << 4,
+ QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_LTE = 1 << 5
+} QmiNasRadioTechnologyPreference;
+
+/**
+ * QmiNasPreferenceDuration:
+ * @QMI_NAS_PREFERENCE_DURATION_PERMANENT: Permanent.
+ * @QMI_NAS_PREFERENCE_DURATION_POWER_CYCLE: Until the next power cycle.
+ * @QMI_NAS_PREFERENCE_DURATION_ONE_CALL: Until end of call.
+ * @QMI_NAS_PREFERENCE_DURATION_ONE_CALL_OR_TIME: Until end of call or a specified time.
+ * @QMI_NAS_PREFERENCE_DURATION_INTERNAL_ONE_CALL_1: Internal reason 1, one call.
+ * @QMI_NAS_PREFERENCE_DURATION_INTERNAL_ONE_CALL_2: Internal reason 2, one call.
+ * @QMI_NAS_PREFERENCE_DURATION_INTERNAL_ONE_CALL_3: Internal reason 3, one call.
+ *
+ * Duration of the preference setting.
+ */
+typedef enum {
+ QMI_NAS_PREFERENCE_DURATION_PERMANENT = 0x00,
+ QMI_NAS_PREFERENCE_DURATION_POWER_CYCLE = 0x01,
+ QMI_NAS_PREFERENCE_DURATION_ONE_CALL = 0x02,
+ QMI_NAS_PREFERENCE_DURATION_ONE_CALL_OR_TIME = 0x03,
+ QMI_NAS_PREFERENCE_DURATION_INTERNAL_ONE_CALL_1 = 0x04,
+ QMI_NAS_PREFERENCE_DURATION_INTERNAL_ONE_CALL_2 = 0x05,
+ QMI_NAS_PREFERENCE_DURATION_INTERNAL_ONE_CALL_3 = 0x06
+} QmiNasPreferenceDuration;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Get/Set System Selection Preference'
+ * requests/responses */
+
+/**
+ * QmiNasRatModePreference:
+ * @QMI_NAS_RAT_MODE_PREFERENCE_CDMA_1X: CDMA2000 1X.
+ * @QMI_NAS_RAT_MODE_PREFERENCE_CDMA_1XEVDO: CDMA2000 HRPD (1xEV-DO).
+ * @QMI_NAS_RAT_MODE_PREFERENCE_GSM: GSM.
+ * @QMI_NAS_RAT_MODE_PREFERENCE_UMTS: UMTS.
+ * @QMI_NAS_RAT_MODE_PREFERENCE_LTE: LTE.
+ * @QMI_NAS_RAT_MODE_PREFERENCE_TD_SCDMA: TD-SCDMA.
+ *
+ * Flags specifying radio access technology mode preference.
+ */
+typedef enum {
+ QMI_NAS_RAT_MODE_PREFERENCE_CDMA_1X = 1 << 0,
+ QMI_NAS_RAT_MODE_PREFERENCE_CDMA_1XEVDO = 1 << 1,
+ QMI_NAS_RAT_MODE_PREFERENCE_GSM = 1 << 2,
+ QMI_NAS_RAT_MODE_PREFERENCE_UMTS = 1 << 3,
+ QMI_NAS_RAT_MODE_PREFERENCE_LTE = 1 << 4,
+ QMI_NAS_RAT_MODE_PREFERENCE_TD_SCDMA = 1 << 5
+} QmiNasRatModePreference;
+
+/**
+ * QmiNasCdmaPrlPreference:
+ * @QMI_NAS_CDMA_PRL_PREFERENCE_A_SIDE_ONLY: System A only.
+ * @QMI_NAS_CDMA_PRL_PREFERENCE_B_SIDE_ONLY: System B only.
+ * @QMI_NAS_CDMA_PRL_PREFERENCE_ANY: Any system.
+ *
+ * Flags specifying the preference when using CDMA Band Class 0.
+ */
+typedef enum {
+ QMI_NAS_CDMA_PRL_PREFERENCE_A_SIDE_ONLY = 0x0001,
+ QMI_NAS_CDMA_PRL_PREFERENCE_B_SIDE_ONLY = 0x0002,
+ QMI_NAS_CDMA_PRL_PREFERENCE_ANY = 0x3FFF
+} QmiNasCdmaPrlPreference;
+
+/**
+ * QmiNasRoamingPreference:
+ * @QMI_NAS_ROAMING_PREFERENCE_OFF: Only non-roaming networks.
+ * @QMI_NAS_ROAMING_PREFERENCE_NOT_OFF: Only roaming networks.
+ * @QMI_NAS_ROAMING_PREFERENCE_NOT_FLASHING: Only non-roaming networks or not flashing.
+ * @QMI_NAS_ROAMING_PREFERENCE_ANY: Don't filter by roaming when acquiring networks.
+ *
+ * Roaming preference.
+ */
+typedef enum {
+ QMI_NAS_ROAMING_PREFERENCE_OFF = 0x01,
+ QMI_NAS_ROAMING_PREFERENCE_NOT_OFF = 0x02,
+ QMI_NAS_ROAMING_PREFERENCE_NOT_FLASHING = 0x03,
+ QMI_NAS_ROAMING_PREFERENCE_ANY = 0xFF
+} QmiNasRoamingPreference;
+
+/**
+ * QmiNasNetworkSelectionPreference:
+ * @QMI_NAS_NETWORK_SELECTION_PREFERENCE_AUTOMATIC: Automatic.
+ * @QMI_NAS_NETWORK_SELECTION_PREFERENCE_MANUAL: Manual.
+ *
+ * Network selection preference.
+ */
+typedef enum {
+ QMI_NAS_NETWORK_SELECTION_PREFERENCE_AUTOMATIC = 0x00,
+ QMI_NAS_NETWORK_SELECTION_PREFERENCE_MANUAL = 0x01
+} QmiNasNetworkSelectionPreference;
+
+/**
+ * QmiNasChangeDuration:
+ * @QMI_NAS_CHANGE_DURATION_PERMANENT: Permanent.
+ * @QMI_NAS_CHANGE_DURATION_POWER_CYCLE: Until the next power cycle.
+ *
+ * Duration of the change setting.
+ */
+typedef enum {
+ QMI_NAS_CHANGE_DURATION_POWER_CYCLE = 0x00,
+ QMI_NAS_CHANGE_DURATION_PERMANENT = 0x01
+} QmiNasChangeDuration;
+
+/**
+ * QmiNasServiceDomainPreference:
+ * @QMI_NAS_SERVICE_DOMAIN_PREFERENCE_CS_ONLY: Circuit-switched only.
+ * @QMI_NAS_SERVICE_DOMAIN_PREFERENCE_PS_ONLY: Packet-switched only.
+ * @QMI_NAS_SERVICE_DOMAIN_PREFERENCE_CS_PS: Circuit-switched and packet-switched.
+ * @QMI_NAS_SERVICE_DOMAIN_PREFERENCE_PS_ATTACH: Packet-switched attach.
+ * @QMI_NAS_SERVICE_DOMAIN_PREFERENCE_PS_DETACH:Packet-switched dettach.
+ *
+ * Service domain preference.
+ */
+typedef enum {
+ QMI_NAS_SERVICE_DOMAIN_PREFERENCE_CS_ONLY = 0x00,
+ QMI_NAS_SERVICE_DOMAIN_PREFERENCE_PS_ONLY = 0x01,
+ QMI_NAS_SERVICE_DOMAIN_PREFERENCE_CS_PS = 0x02,
+ QMI_NAS_SERVICE_DOMAIN_PREFERENCE_PS_ATTACH = 0x03,
+ QMI_NAS_SERVICE_DOMAIN_PREFERENCE_PS_DETACH = 0x04,
+} QmiNasServiceDomainPreference;
+
+/**
+ * QmiNasGsmWcdmaAcquisitionOrderPreference:
+ * @QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_AUTOMATIC: Automatic.
+ * @QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_GSM: GSM first, then WCDMA.
+ * @QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_WCDMA: WCDMA first, then GSM.
+ *
+ * GSM/WCDMA acquisition order preference.
+ */
+typedef enum {
+ QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_AUTOMATIC = 0x00,
+ QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_GSM = 0x01,
+ QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_WCDMA = 0x02
+} QmiNasGsmWcdmaAcquisitionOrderPreference;
+
+/**
+ * QmiNasTdScdmaBandPreference:
+ * @QMI_NAS_TD_SCDMA_BAND_PREFERENCE_A: Band A.
+ * @QMI_NAS_TD_SCDMA_BAND_PREFERENCE_B: Band B.
+ * @QMI_NAS_TD_SCDMA_BAND_PREFERENCE_C: Band C.
+ * @QMI_NAS_TD_SCDMA_BAND_PREFERENCE_D: Band D.
+ * @QMI_NAS_TD_SCDMA_BAND_PREFERENCE_E: Band E.
+ * @QMI_NAS_TD_SCDMA_BAND_PREFERENCE_F: Band F.
+ *
+ * Flags to specify TD-SCDMA-specific frequency band preferences.
+ */
+typedef enum {
+ QMI_NAS_TD_SCDMA_BAND_PREFERENCE_A = 1 << 0,
+ QMI_NAS_TD_SCDMA_BAND_PREFERENCE_B = 1 << 1,
+ QMI_NAS_TD_SCDMA_BAND_PREFERENCE_C = 1 << 2,
+ QMI_NAS_TD_SCDMA_BAND_PREFERENCE_D = 1 << 3,
+ QMI_NAS_TD_SCDMA_BAND_PREFERENCE_E = 1 << 4,
+ QMI_NAS_TD_SCDMA_BAND_PREFERENCE_F = 1 << 5
+} QmiNasTdScdmaBandPreference;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Get System Info' request/response */
+
+/**
+ * QmiNasRoamingStatus:
+ * @QMI_NAS_ROAMING_STATUS_OFF: Off.
+ * @QMI_NAS_ROAMING_STATUS_ON: On.
+ * @QMI_NAS_ROAMING_STATUS_BLINK: Blinking.
+ * @QMI_NAS_ROAMING_STATUS_OUT_OF_NEIGHBORHOOD: Out of neighborhood.
+ * @QMI_NAS_ROAMING_STATUS_OUT_OF_BUILDING: Out of building.
+ * @QMI_NAS_ROAMING_STATUS_PREFERRED_SYSTEM: Preferred system.
+ * @QMI_NAS_ROAMING_STATUS_AVAILABLE_SYSTEM: Available system.
+ * @QMI_NAS_ROAMING_STATUS_ALLIANCE_PARTNER: Alliance partner.
+ * @QMI_NAS_ROAMING_STATUS_PREMIUM_PARTNER: Premium partner.
+ * @QMI_NAS_ROAMING_STATUS_FULL_SERVICE: Full service.
+ * @QMI_NAS_ROAMING_STATUS_PARTIAL_SERVICE: Partial service.
+ * @QMI_NAS_ROAMING_STATUS_BANNER_ON: Banner on.
+ * @QMI_NAS_ROAMING_STATUS_BANNER_OFF: Banner off.
+*/
+typedef enum {
+ QMI_NAS_ROAMING_STATUS_OFF = 0x00,
+ QMI_NAS_ROAMING_STATUS_ON = 0x01,
+ /* Next ones only for 3GPP2 */
+ QMI_NAS_ROAMING_STATUS_BLINK = 0x02,
+ QMI_NAS_ROAMING_STATUS_OUT_OF_NEIGHBORHOOD = 0x03,
+ QMI_NAS_ROAMING_STATUS_OUT_OF_BUILDING = 0x04,
+ QMI_NAS_ROAMING_STATUS_PREFERRED_SYSTEM = 0x05,
+ QMI_NAS_ROAMING_STATUS_AVAILABLE_SYSTEM = 0x06,
+ QMI_NAS_ROAMING_STATUS_ALLIANCE_PARTNER = 0x07,
+ QMI_NAS_ROAMING_STATUS_PREMIUM_PARTNER = 0x08,
+ QMI_NAS_ROAMING_STATUS_FULL_SERVICE = 0x09,
+ QMI_NAS_ROAMING_STATUS_PARTIAL_SERVICE = 0x0A,
+ QMI_NAS_ROAMING_STATUS_BANNER_ON = 0x0B,
+ QMI_NAS_ROAMING_STATUS_BANNER_OFF = 0x0C
+} QmiNasRoamingStatus;
+
+/**
+ * QmiNasHdrProtocolRevision:
+ * @QMI_NAS_HDR_PROTOCOL_REVISION_NONE: None.
+ * @QMI_NAS_HDR_PROTOCOL_REVISION_REL_0: HDR Rel 0.
+ * @QMI_NAS_HDR_PROTOCOL_REVISION_REL_A: HDR Rel A.
+ * @QMI_NAS_HDR_PROTOCOL_REVISION_REL_B: HDR Rel B.
+ *
+ * HDR protocol revision.
+ */
+typedef enum {
+ QMI_NAS_HDR_PROTOCOL_REVISION_NONE = 0x00,
+ QMI_NAS_HDR_PROTOCOL_REVISION_REL_0 = 0x01,
+ QMI_NAS_HDR_PROTOCOL_REVISION_REL_A = 0x02,
+ QMI_NAS_HDR_PROTOCOL_REVISION_REL_B = 0x03
+} QmiNasHdrProtocolRevision;
+
+/**
+ * QmiNasWcdmaHsService:
+ * @QMI_NAS_WCDMA_HS_SERVICE_HSDPA_HSUPA_UNSUPPORTED: HSDPA and HSUPA not supported.
+ * @QMI_NAS_WCDMA_HS_SERVICE_HSDPA_SUPPORTED: HSDPA supported.
+ * @QMI_NAS_WCDMA_HS_SERVICE_HSUPA_SUPPORTED: HSUPA supported.
+ * @QMI_NAS_WCDMA_HS_SERVICE_HSDPA_HSUPA_SUPPORTED: HSDPA and HSUPA supported.
+ * @QMI_NAS_WCDMA_HS_SERVICE_HSDPA_PLUS_SUPPORTED: HSDPA+ supported.
+ * @QMI_NAS_WCDMA_HS_SERVICE_HSDPA_PLUS_HSUPA_SUPPORTED: HSDPA+ and HSUPA supported.
+ * @QMI_NAS_WCDMA_HS_SERVICE_DC_HSDPA_PLUS_SUPPORTED: DC-HSDPA+ supported.
+ * @QMI_NAS_WCDMA_HS_SERVICE_DC_HSDPA_PLUS_HSUPA_SUPPORTED: DC-HSDPA+ and HSUPA supported.
+ * Call status on high speed.
+ */
+typedef enum {
+ QMI_NAS_WCDMA_HS_SERVICE_HSDPA_HSUPA_UNSUPPORTED = 0x00,
+ QMI_NAS_WCDMA_HS_SERVICE_HSDPA_SUPPORTED = 0x01,
+ QMI_NAS_WCDMA_HS_SERVICE_HSUPA_SUPPORTED = 0x02,
+ QMI_NAS_WCDMA_HS_SERVICE_HSDPA_HSUPA_SUPPORTED = 0x03,
+ QMI_NAS_WCDMA_HS_SERVICE_HSDPA_PLUS_SUPPORTED = 0x04,
+ QMI_NAS_WCDMA_HS_SERVICE_HSDPA_PLUS_HSUPA_SUPPORTED = 0x05,
+ QMI_NAS_WCDMA_HS_SERVICE_DC_HSDPA_PLUS_SUPPORTED = 0x06,
+ QMI_NAS_WCDMA_HS_SERVICE_DC_HSDPA_PLUS_HSUPA_SUPPORTED = 0x07
+} QmiNasWcdmaHsService;
+
+/**
+ * QmiNasCellBroadcastCapability:
+ * @QMI_NAS_CELL_BROADCAST_CAPABILITY_UNKNOWN: Unknown.
+ * @QMI_NAS_CELL_BROADCAST_CAPABILITY_OFF: Cell broadcast not supported.
+ * @QMI_NAS_CELL_BROADCAST_CAPABILITY_ON: Cell broadcast supported.
+ *
+ * Cell broadcast support.
+ */
+typedef enum {
+ QMI_NAS_CELL_BROADCAST_CAPABILITY_UNKNOWN = 0x00,
+ QMI_NAS_CELL_BROADCAST_CAPABILITY_OFF = 0x01,
+ QMI_NAS_CELL_BROADCAST_CAPABILITY_ON = 0x02
+} QmiNasCellBroadcastCapability;
+
+/**
+ * QmiNasSimRejectState:
+ * @QMI_NAS_SIM_REJECT_STATE_SIM_UNAVAILABLE: SIM not available.
+ * @QMI_NAS_SIM_REJECT_STATE_SIM_VAILABLE: SIM available.
+ * @QMI_NAS_SIM_REJECT_STATE_SIM_CS_INVALID: SIM invalid for circuit-switched connections.
+ * @QMI_NAS_SIM_REJECT_STATE_SIM_PS_INVALID: SIM invalid for packet-switched connections.
+ * @QMI_NAS_SIM_REJECT_STATE_SIM_CS_PS_INVALID: SIM invalid for circuit-switched and packet-switched connections.
+ *
+ * Reject information of the SIM.
+ */
+typedef enum {
+ QMI_NAS_SIM_REJECT_STATE_SIM_UNAVAILABLE = 0,
+ QMI_NAS_SIM_REJECT_STATE_SIM_VAILABLE = 1,
+ QMI_NAS_SIM_REJECT_STATE_SIM_CS_INVALID = 2,
+ QMI_NAS_SIM_REJECT_STATE_SIM_PS_INVALID = 3,
+ QMI_NAS_SIM_REJECT_STATE_SIM_CS_PS_INVALID = 4
+} QmiNasSimRejectState;
+
+/**
+ * QmiNasCdmaPilotType:
+ * @QMI_NAS_CDMA_PILOT_TYPE_ACTIVE: the pilot is part of the active set.
+ * @QMI_NAS_CDMA_PILOT_TYPE_NEIGHBOR: the pilot is part of the neighbor set.
+ *
+ * The pilot set the pilot belongs to.
+ */
+typedef enum {
+ QMI_NAS_CDMA_PILOT_TYPE_ACTIVE = 0,
+ QMI_NAS_CDMA_PILOT_TYPE_NEIGHBOR = 1,
+} QmiNasCdmaPilotType;
+
+#endif /* _LIBQMI_GLIB_QMI_ENUMS_NAS_H_ */
diff --git a/qmi-enums-pds.h b/qmi-enums-pds.h
new file mode 100644
index 0000000..258911c
--- /dev/null
+++ b/qmi-enums-pds.h
@@ -0,0 +1,150 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Google Inc.
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_ENUMS_PDS_H_
+#define _LIBQMI_GLIB_QMI_ENUMS_PDS_H_
+
+/**
+ * SECTION: qmi-enums-pds
+ * @title: PDS enumerations and flags
+ *
+ * This section defines enumerations and flags used in the PDS service
+ * interface.
+ */
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI PDS Event Report' indication */
+
+/**
+ * QmiPdsOperationMode:
+ * @QMI_PDS_OPERATION_MODE_UNKNOWN: Unknown (position not fixed yet).
+ * @QMI_PDS_OPERATION_MODE_STANDALONE: Standalone.
+ * @QMI_PDS_OPERATION_MODE_MS_BASED: MS based.
+ * @QMI_PDS_OPERATION_MODE_MS_ASSISTED: MS assisted.
+ *
+ * Operation mode used to compute the position.
+ */
+typedef enum {
+ QMI_PDS_OPERATION_MODE_UNKNOWN = -1,
+ QMI_PDS_OPERATION_MODE_STANDALONE = 0,
+ QMI_PDS_OPERATION_MODE_MS_BASED = 1,
+ QMI_PDS_OPERATION_MODE_MS_ASSISTED = 2
+} QmiPdsOperationMode;
+
+/**
+ * QmiPdsPositionSessionStatus:
+ * @QMI_PDS_POSITION_SESSION_STATUS_SUCCESS: Success.
+ * @QMI_PDS_POSITION_SESSION_STATUS_IN_PROGRESS: In progress.
+ * @QMI_PDS_POSITION_SESSION_STATUS_GENERAL_FAILURE: General failure.
+ * @QMI_PDS_POSITION_SESSION_STATUS_TIMEOUT: Timeout.
+ * @QMI_PDS_POSITION_SESSION_STATUS_USER_ENDED_SESSION: User ended session.
+ * @QMI_PDS_POSITION_SESSION_STATUS_BAD_PARAMETER: Bad parameter.
+ * @QMI_PDS_POSITION_SESSION_STATUS_PHONE_OFFLINE: Phone is offline.
+ * @QMI_PDS_POSITION_SESSION_STATUS_ENGINE_LOCKED: Engine locked.
+ * @QMI_PDS_POSITION_SESSION_STATUS_E911_SESSION_IN_PROGRESS: Emergency call in progress.
+ *
+ * Status of the positioning session.
+ */
+typedef enum {
+ QMI_PDS_POSITION_SESSION_STATUS_SUCCESS = 0x00,
+ QMI_PDS_POSITION_SESSION_STATUS_IN_PROGRESS = 0x01,
+ QMI_PDS_POSITION_SESSION_STATUS_GENERAL_FAILURE = 0x02,
+ QMI_PDS_POSITION_SESSION_STATUS_TIMEOUT = 0x03,
+ QMI_PDS_POSITION_SESSION_STATUS_USER_ENDED_SESSION = 0x04,
+ QMI_PDS_POSITION_SESSION_STATUS_BAD_PARAMETER = 0x05,
+ QMI_PDS_POSITION_SESSION_STATUS_PHONE_OFFLINE = 0x06,
+ QMI_PDS_POSITION_SESSION_STATUS_ENGINE_LOCKED = 0x07,
+ QMI_PDS_POSITION_SESSION_STATUS_E911_SESSION_IN_PROGRESS = 0x08
+} QmiPdsPositionSessionStatus;
+
+/**
+ * QmiPdsDataValid:
+ * @QMI_PDS_DATA_VALID_TIMESTAMP_CALENDAR: Timestamp calendar (GPS time).
+ * @QMI_PDS_DATA_VALID_TIMESTAMP_UTC: Timestamp (UTC).
+ * @QMI_PDS_DATA_VALID_LEAP_SECONDS: Leap seconds.
+ * @QMI_PDS_DATA_VALID_TIME_UNCERTAINTY: Time uncertainty.
+ * @QMI_PDS_DATA_VALID_LATITUDE: Latitude.
+ * @QMI_PDS_DATA_VALID_LONGITUDE: Longitude.
+ * @QMI_PDS_DATA_VALID_ELLIPSOID_ALTITUDE: Ellipsoid altitude.
+ * @QMI_PDS_DATA_VALID_MEAN_SEA_LEVEL_ALTITUDE: Mean sea level altitude.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_SPEED: Horizontal speed.
+ * @QMI_PDS_DATA_VALID_VERTICAL_SPEED: Vertical speed.
+ * @QMI_PDS_DATA_VALID_HEADING: Heading.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_CIRCULAR: Horizontal uncertainty circular.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_SEMI_MAJOR: Horizontal uncertainty ellipse semi-major.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_SEMI_MINOR: Horizontal uncertainty ellipse semi-minor.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_ORIENT_AZIMUTH: Horizontal uncertainty ellipse orient azimuth.
+ * @QMI_PDS_DATA_VALID_VERTICAL_UNCERTAINTY: Vertical uncertainty.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_VELOCITY_UNCERTAINTY: Horizontal velocity uncertainty.
+ * @QMI_PDS_DATA_VALID_VERTICAL_VELOCITY_UNCERTAINTY: Vertical velocity uncertainty.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_CONFIDENCE: Horizontal confidence.
+ * @QMI_PDS_DATA_VALID_POSITION_DOP: Position dillution of precision.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_DOP: Horizontal dillution of precision.
+ * @QMI_PDS_DATA_VALID_VERTICAL_DOP: Vertical dillution of precision.
+ * @QMI_PDS_DATA_VALID_OPERATING_MODE: Operating mode.
+ *
+ * Flags to indicate which position data parameters are valid.
+ */
+typedef enum {
+ QMI_PDS_DATA_VALID_TIMESTAMP_CALENDAR = 1 << 0,
+ QMI_PDS_DATA_VALID_TIMESTAMP_UTC = 1 << 1,
+ QMI_PDS_DATA_VALID_LEAP_SECONDS = 1 << 2,
+ QMI_PDS_DATA_VALID_TIME_UNCERTAINTY = 1 << 3,
+ QMI_PDS_DATA_VALID_LATITUDE = 1 << 4,
+ QMI_PDS_DATA_VALID_LONGITUDE = 1 << 5,
+ QMI_PDS_DATA_VALID_ELLIPSOID_ALTITUDE = 1 << 6,
+ QMI_PDS_DATA_VALID_MEAN_SEA_LEVEL_ALTITUDE = 1 << 7,
+ QMI_PDS_DATA_VALID_HORIZONTAL_SPEED = 1 << 8,
+ QMI_PDS_DATA_VALID_VERTICAL_SPEED = 1 << 9,
+ QMI_PDS_DATA_VALID_HEADING = 1 << 10,
+ QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_CIRCULAR = 1 << 11,
+ QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_SEMI_MAJOR = 1 << 12,
+ QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_SEMI_MINOR = 1 << 13,
+ QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_ORIENT_AZIMUTH = 1 << 14,
+ QMI_PDS_DATA_VALID_VERTICAL_UNCERTAINTY = 1 << 15,
+ QMI_PDS_DATA_VALID_HORIZONTAL_VELOCITY_UNCERTAINTY = 1 << 16,
+ QMI_PDS_DATA_VALID_VERTICAL_VELOCITY_UNCERTAINTY = 1 << 17,
+ QMI_PDS_DATA_VALID_HORIZONTAL_CONFIDENCE = 1 << 18,
+ QMI_PDS_DATA_VALID_POSITION_DOP = 1 << 19,
+ QMI_PDS_DATA_VALID_HORIZONTAL_DOP = 1 << 20,
+ QMI_PDS_DATA_VALID_VERTICAL_DOP = 1 << 21,
+ QMI_PDS_DATA_VALID_OPERATING_MODE = 1 << 22
+} QmiPdsDataValid;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI PDS Get GPS Service State' request/response */
+
+/**
+ * QmiPdsTrackingSessionState:
+ * @QMI_PDS_TRACKING_SESSION_STATE_UNKNOWN: Unknown state.
+ * @QMI_PDS_TRACKING_SESSION_STATE_INACTIVE: Session inactive.
+ * @QMI_PDS_TRACKING_SESSION_STATE_ACTIVE: Session active.
+ *
+ * State of the tracking session.
+ */
+typedef enum {
+ QMI_PDS_TRACKING_SESSION_STATE_UNKNOWN = 0,
+ QMI_PDS_TRACKING_SESSION_STATE_INACTIVE = 1,
+ QMI_PDS_TRACKING_SESSION_STATE_ACTIVE = 2
+} QmiPdsTrackingSessionState;
+
+#endif /* _LIBQMI_GLIB_QMI_ENUMS_PDS_H_ */
diff --git a/qmi-enums-private.h b/qmi-enums-private.h
new file mode 100644
index 0000000..d383f56
--- /dev/null
+++ b/qmi-enums-private.h
@@ -0,0 +1,85 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Google Inc.
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_ENUMS_PRIVATE_H_
+#define _LIBQMI_GLIB_QMI_ENUMS_PRIVATE_H_
+
+/*****************************************************************************/
+/* QMI Control */
+
+/**
+ * QmiCtlDataFormat:
+ * @QMI_CTL_DATA_FORMAT_QOS_FLOW_HEADER_ABSENT: QoS header absent
+ * @QMI_CTL_DATA_FORMAT_QOS_FLOW_HEADER_PRESENT: QoS header present
+ *
+ * Controls whether the network port data format includes a QoS header or not.
+ * Should normally be set to ABSENT.
+ */
+typedef enum {
+ QMI_CTL_DATA_FORMAT_QOS_FLOW_HEADER_ABSENT = 0,
+ QMI_CTL_DATA_FORMAT_QOS_FLOW_HEADER_PRESENT = 1,
+} QmiCtlDataFormat;
+
+/**
+ * QmiCtlDataLinkProtocol:
+ * @QMI_CTL_DATA_LINK_PROTOCOL_802_3: data frames formatted as 802.3 Ethernet
+ * @QMI_CTL_DATA_LINK_PROTOCOL_RAW_IP: data frames are raw IP packets
+ *
+ * Determines the network port data format.
+ */
+typedef enum {
+ QMI_CTL_DATA_LINK_PROTOCOL_UNKNOWN = 0,
+ QMI_CTL_DATA_LINK_PROTOCOL_802_3 = 1,
+ QMI_CTL_DATA_LINK_PROTOCOL_RAW_IP = 2,
+} QmiCtlDataLinkProtocol;
+
+/**
+ * QmiCtlFlag:
+ * @QMI_CTL_FLAG_NONE: None.
+ * @QMI_CTL_FLAG_RESPONSE: Message is a response.
+ * @QMI_CTL_FLAG_INDICATION: Message is an indication.
+ *
+ * QMI flags in messages of the %QMI_SERVICE_CTL service.
+ */
+typedef enum {
+ QMI_CTL_FLAG_NONE = 0,
+ QMI_CTL_FLAG_RESPONSE = 1 << 0,
+ QMI_CTL_FLAG_INDICATION = 1 << 1
+} QmiCtlFlag;
+
+/**
+ * QmiServiceFlag:
+ * @QMI_SERVICE_FLAG_NONE: None.
+ * @QMI_SERVICE_FLAG_COMPOUND: Message is compound.
+ * @QMI_SERVICE_FLAG_RESPONSE: Message is a response.
+ * @QMI_SERVICE_FLAG_INDICATION: Message is an indication.
+ *
+ * QMI flags in messages which are not of the %QMI_SERVICE_CTL service.
+ */
+typedef enum {
+ QMI_SERVICE_FLAG_NONE = 0,
+ QMI_SERVICE_FLAG_COMPOUND = 1 << 0,
+ QMI_SERVICE_FLAG_RESPONSE = 1 << 1,
+ QMI_SERVICE_FLAG_INDICATION = 1 << 2
+} QmiServiceFlag;
+
+#endif /* _LIBQMI_GLIB_QMI_ENUMS_PRIVATE_H_ */
diff --git a/qmi-enums-wds.h b/qmi-enums-wds.h
new file mode 100644
index 0000000..7666d0c
--- /dev/null
+++ b/qmi-enums-wds.h
@@ -0,0 +1,923 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Lanedo GmbH <aleksander@lanedo.com>
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_ENUMS_WDS_H_
+#define _LIBQMI_GLIB_QMI_ENUMS_WDS_H_
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WDS Start Network' message */
+
+/**
+ * QmiWdsIpFamily:
+ * @QMI_WDS_IP_FAMILY_IPV4: IPv4.
+ * @QMI_WDS_IP_FAMILY_IPV6: IPv6.
+ * @QMI_WDS_IP_FAMILY_UNSPECIFIED: None specified.
+ *
+ * Type of IP family preference.
+ */
+typedef enum {
+ QMI_WDS_IP_FAMILY_IPV4 = 4,
+ QMI_WDS_IP_FAMILY_IPV6 = 6,
+ QMI_WDS_IP_FAMILY_UNSPECIFIED = 8
+} QmiWdsIpFamily;
+
+/**
+ * QmiWdsTechnologyPreference:
+ * @QMI_WDS_TECHNOLOGY_PREFERENCE_ALLOW_3GPP: 3GPP allowed.
+ * @QMI_WDS_TECHNOLOGY_PREFERENCE_ALLOW_3GPP2: 3GPP2 allowed.
+ *
+ * Type of network allowed when trying to connect.
+ */
+typedef enum {
+ QMI_WDS_TECHNOLOGY_PREFERENCE_ALLOW_3GPP = 1 << 0,
+ QMI_WDS_TECHNOLOGY_PREFERENCE_ALLOW_3GPP2 = 1 << 1
+} QmiWdsTechnologyPreference;
+
+/**
+ * QmiWdsExtendedTechnologyPreference:
+ * @QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_CDMA: Use CDMA.
+ * @QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_UMTS: Use UMTS.
+ * @QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_EPC: Use EPC (LTE).
+ * @QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_EMBMS: Use eMBMS.
+ * @QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_MODEM_LINK_LOCAL: Use modem link-local.
+ *
+ * Type of network allowed when trying to connect.
+ */
+typedef enum {
+ QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_CDMA = 32769,
+ QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_UMTS = 32772,
+ QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_EPC = 34944,
+ QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_EMBMS = 34946,
+ QMI_WDS_EXTENDED_TECHNOLOGY_PREFERENCE_MODEM_LINK_LOCAL = 34952,
+} QmiWdsExtendedTechnologyPreference;
+
+/**
+ * QmiWdsCallType:
+ * @QMI_WDS_CALL_TYPE_LAPTOP: Laptop call.
+ * @QMI_WDS_CALL_TYPE_EMBEDDED: Embedded call.
+ *
+ * Type of call to originate.
+ */
+typedef enum {
+ QMI_WDS_CALL_TYPE_LAPTOP = 0,
+ QMI_WDS_CALL_TYPE_EMBEDDED = 1
+} QmiWdsCallType;
+
+/**
+ * QmiWdsCallEndReason:
+ * @QMI_WDS_CALL_END_REASON_GENERIC_UNSPECIFIED: Unspecified reason.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_CLIENT_END: Client end.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_NO_SERVICE: No service.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_FADE: Fade.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_RELEASE_NORMAL: Release normal.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_ACCESS_ATTEMPT_IN_PROGRESS: Access attempt in progress.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_ACCESS_FAILURE: Access Failure.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_REDIRECTION_OR_HANDOFF: Redirection or handoff.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_CLOSE_IN_PROGRESS: Close in progress.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_AUTHENTICATION_FAILED: Authentication failed.
+ * @QMI_WDS_CALL_END_REASON_GENERIC_INTERNAL_ERROR: Internal error.
+ * @QMI_WDS_CALL_END_REASON_CDMA_LOCK: (CDMA) Phone is CDMA-locked.
+ * @QMI_WDS_CALL_END_REASON_CDMA_INTERCEPT: (CDMA) Received intercept from the BS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_REORDER: (CDMA) Received reorder from the BS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_RELEASE_SO_REJECT: (CDMA) Received release from the BS, SO reject.
+ * @QMI_WDS_CALL_END_REASON_CDMA_INCOMING_CALL: (CDMA) Received incoming call from the BS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_ALERT_STOP: (CDMA) Received alert stop from the BS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_ACTIVATION: (CDMA) Received end activation.
+ * @QMI_WDS_CALL_END_REASON_CDMA_MAX_ACCESS_PROBES: (CDMA) Maximum access probes transmitted.
+ * @QMI_WDS_CALL_END_REASON_CDMA_CCS_NOT_SUPPORTED_BY_BS: (CDMA) Concurrent service not supported by the BS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_NO_RESPONSE_FROM_BS: (CDMA) No response received from the BS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_REJECTED_BY_BS: (CDMA) Rejected by the BS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_INCOMPATIBLE: (CDMA) Concurrent services requested are incompatible.
+ * @QMI_WDS_CALL_END_REASON_CDMA_ALREADY_IN_TC: (CDMA) Already in TC.
+ * @QMI_WDS_CALL_END_REASON_CDMA_USER_CALL_ORIGINATED_DURING_GPS: (CDMA) Call originated during GPS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_USER_CALL_ORIGINATED_DURING_SMS: (CDMA) Call originated during SMS.
+ * @QMI_WDS_CALL_END_REASON_CDMA_NO_SERVICE: (CDMA) No service.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_CONFERENCE_FAILED: (GSM/WCDMA) Call origination request failed.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_INCOMING_REJECTED: (GSM/WCDMA) Client rejected incoming call.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_NO_SERVICE: (GSM/WCDMA) No service.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_NETWORK_END: (GSM/WCDMA) Network ended the call.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_LLC_SNDCP_FAILURE: (GSM/WCDMA) LLC or SNDCP failure.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_INSUFFICIENT_RESOURCES: (GSM/WCDMA) Insufficient resources.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_OPTION_TEMPORARILY_OUT_OF_ORDER: (GSM/WCDMA) Service option temporarily out of order.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_NSAPI_ALREADY_USED: (GSM/WCDMA) NSAPI already used.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_REGULAR_DEACTIVATION: (GSM/WCDMA) Regular PDP context deactivation.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_NETWORK_FAILURE: (GSM/WCDMA) Network failure.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_REATTACH_REQUIRED: (GSM/WCDMA) Reattach required.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_PROTOCOL_ERROR: (GSM/WCDMA) Protocol error.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_OPERATOR_DETERMINED_BARRING: (GSM/WCDMA) Operator-determined barring.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_UNKNOWN_APN: (GSM/WCDMA) Unknown or missing APN.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_UNKNOWN_PDP: (GSM/WCDMA) Unknown PDP address or type.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_GGSN_REJECT: (GSM/WCDMA) Activation rejected by GGSN.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_ACTIVATION_REJECT: (GSM/WCDMA) Activation rejected.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_OPTION_NOT_SUPPORTED: (GSM/WCDMA) Service option not supported.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_OPTION_UNSUBSCRIBED: (GSM/WCDMA) Service option not subscribed.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_QOS_NOT_ACCEPTED: (GSM/WCDMA) QoS not accepted.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_TFT_SEMANTIC_ERROR: (GSM/WCDMA) Semantic error in TFT operation.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_TFT_SYNTAX_ERROR: (GSM/WCDMA) Syntax error in TFT operation.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_UNKNOWN_PDP_CONTEXT: (GSM/WCDMA) Unknown PDP context.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_FILTER_SEMANTIC_ERROR: (GSM/WCDMA) Semantic error in packet filters.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_FILTER_SYNTAX_ERROR: (GSM/WCDMA) Syntax error in packet filters.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_PDP_WITHOUT_ACTIVE_TFT: (GSM/WCDMA) PDP context without TFT activated.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_INVALID_TRANSACTION_ID: (GSM/WCDMA) Invalid transaction ID.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_MESSAGE_INCORRECT_SEMANTIC: (GSM/WCDMA) Message incorrect semantically.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_INVALID_MANDATORY_INFO: (GSM/WCDMA) Invalid mandatory information.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_MESSAGE_TYPE_UNSUPPORTED: (GSM/WCDMA) Message type not implemented.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_MESSAGE_TYPE_NONCOMPATIBLE_STATE: (GSM/WCDMA) Message not compatible with state.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_UNKNOWN_INFO_ELEMENT: (GSM/WCDMA) Information element unknown.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_CONDITIONAL_IE_ERROR: (GSM/WCDMA) Conditional IE error.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_MESSAGE_AND_PROTOCOL_STATE_UNCOMPATIBLE: (GSM/WCDMA) Message and protocol state uncompatible.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_APN_TYPE_CONFLICT: (GSM/WCDMA) APN type conflict.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_NO_GPRS_CONTEXT: (GSM/WCDMA) No GPRS context.
+ * @QMI_WDS_CALL_END_REASON_GSM_WCDMA_FEATURE_NOT_SUPPORTED: (GSM/WCDMA) Feature not supported.
+ * @QMI_WDS_CALL_END_REASON_EVDO_CONNECTION_DENY_GENERAL_OR_BUSY: (EV-DO) Received Connection Deny (General or Network busy).
+ * @QMI_WDS_CALL_END_REASON_EVDO_CONNECTION_DENY_BILLING_OR_AUTHENTICATION_FAILURE: (EV-DO) Received Connection Deny (Billing or Authentication failure).
+ * @QMI_WDS_CALL_END_REASON_EVDO_HDR_CHANGE: (EV-DO) Change HDR.
+ * @QMI_WDS_CALL_END_REASON_EVDO_HDR_EXIT: (EV-DO) Exit HDR.
+ * @QMI_WDS_CALL_END_REASON_EVDO_HDR_NO_SESSION: (EV-DO) No HDR session.
+ * @QMI_WDS_CALL_END_REASON_EVDO_HDR_ORIGINATION_DURING_GPS_FIX: (EV-DO) HDR call ended in favor of a GPS fix.
+ * @QMI_WDS_CALL_END_REASON_EVDO_HDR_CONNECTION_SETUP_TIMEOUT: (EV-DO) Connection setup timeout.
+ * @QMI_WDS_CALL_END_REASON_EVDO_HDR_RELEASED_BY_CM: (EV-DO) Released HDR call by call manager.
+ *
+ * Reason for ending the call.
+ */
+typedef enum {
+ /* Generic reasons */
+ QMI_WDS_CALL_END_REASON_GENERIC_UNSPECIFIED = 1,
+ QMI_WDS_CALL_END_REASON_GENERIC_CLIENT_END = 2,
+ QMI_WDS_CALL_END_REASON_GENERIC_NO_SERVICE = 3,
+ QMI_WDS_CALL_END_REASON_GENERIC_FADE = 4,
+ QMI_WDS_CALL_END_REASON_GENERIC_RELEASE_NORMAL = 5,
+ QMI_WDS_CALL_END_REASON_GENERIC_ACCESS_ATTEMPT_IN_PROGRESS = 6,
+ QMI_WDS_CALL_END_REASON_GENERIC_ACCESS_FAILURE = 7,
+ QMI_WDS_CALL_END_REASON_GENERIC_REDIRECTION_OR_HANDOFF = 8,
+ QMI_WDS_CALL_END_REASON_GENERIC_CLOSE_IN_PROGRESS = 9,
+ QMI_WDS_CALL_END_REASON_GENERIC_AUTHENTICATION_FAILED = 10,
+ QMI_WDS_CALL_END_REASON_GENERIC_INTERNAL_ERROR = 11,
+
+ /* CDMA specific reasons */
+ QMI_WDS_CALL_END_REASON_CDMA_LOCK = 500,
+ QMI_WDS_CALL_END_REASON_CDMA_INTERCEPT = 501,
+ QMI_WDS_CALL_END_REASON_CDMA_REORDER = 502,
+ QMI_WDS_CALL_END_REASON_CDMA_RELEASE_SO_REJECT = 503,
+ QMI_WDS_CALL_END_REASON_CDMA_INCOMING_CALL = 504,
+ QMI_WDS_CALL_END_REASON_CDMA_ALERT_STOP = 505,
+ QMI_WDS_CALL_END_REASON_CDMA_ACTIVATION = 506,
+ QMI_WDS_CALL_END_REASON_CDMA_MAX_ACCESS_PROBES = 507,
+ QMI_WDS_CALL_END_REASON_CDMA_CCS_NOT_SUPPORTED_BY_BS = 508,
+ QMI_WDS_CALL_END_REASON_CDMA_NO_RESPONSE_FROM_BS = 509,
+ QMI_WDS_CALL_END_REASON_CDMA_REJECTED_BY_BS = 510,
+ QMI_WDS_CALL_END_REASON_CDMA_INCOMPATIBLE = 511,
+ QMI_WDS_CALL_END_REASON_CDMA_ALREADY_IN_TC = 512,
+ QMI_WDS_CALL_END_REASON_CDMA_USER_CALL_ORIGINATED_DURING_GPS = 513,
+ QMI_WDS_CALL_END_REASON_CDMA_USER_CALL_ORIGINATED_DURING_SMS = 514,
+ QMI_WDS_CALL_END_REASON_CDMA_NO_SERVICE = 515,
+
+ /* GSM/WCDMA specific reasons */
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_CONFERENCE_FAILED = 1000,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_INCOMING_REJECTED = 1001,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_NO_SERVICE = 1002,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_NETWORK_END = 1003,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_LLC_SNDCP_FAILURE = 1004,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_INSUFFICIENT_RESOURCES = 1005,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_OPTION_TEMPORARILY_OUT_OF_ORDER = 1006,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_NSAPI_ALREADY_USED = 1007,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_REGULAR_DEACTIVATION = 1008,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_NETWORK_FAILURE = 1009,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_REATTACH_REQUIRED = 1010,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_PROTOCOL_ERROR = 1011,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_OPERATOR_DETERMINED_BARRING = 1012,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_UNKNOWN_APN = 1013,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_UNKNOWN_PDP = 1014,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_GGSN_REJECT = 1015,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_ACTIVATION_REJECT = 1016,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_OPTION_NOT_SUPPORTED = 1017,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_OPTION_UNSUBSCRIBED = 1018,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_QOS_NOT_ACCEPTED = 1019,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_TFT_SEMANTIC_ERROR = 1020,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_TFT_SYNTAX_ERROR = 1021,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_UNKNOWN_PDP_CONTEXT = 1022,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_FILTER_SEMANTIC_ERROR = 1023,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_FILTER_SYNTAX_ERROR = 1024,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_PDP_WITHOUT_ACTIVE_TFT = 1025,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_INVALID_TRANSACTION_ID = 1026,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_MESSAGE_INCORRECT_SEMANTIC = 1027,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_INVALID_MANDATORY_INFO = 1028,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_MESSAGE_TYPE_UNSUPPORTED = 1029,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_MESSAGE_TYPE_NONCOMPATIBLE_STATE = 1030,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_UNKNOWN_INFO_ELEMENT = 1031,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_CONDITIONAL_IE_ERROR = 1032,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_MESSAGE_AND_PROTOCOL_STATE_UNCOMPATIBLE = 1033,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_APN_TYPE_CONFLICT = 1034,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_NO_GPRS_CONTEXT = 1035,
+ QMI_WDS_CALL_END_REASON_GSM_WCDMA_FEATURE_NOT_SUPPORTED = 1036,
+
+ /* EV-DO specific reasons */
+ QMI_WDS_CALL_END_REASON_EVDO_CONNECTION_DENY_GENERAL_OR_BUSY = 1500,
+ QMI_WDS_CALL_END_REASON_EVDO_CONNECTION_DENY_BILLING_OR_AUTHENTICATION_FAILURE = 1501,
+ QMI_WDS_CALL_END_REASON_EVDO_HDR_CHANGE = 1502,
+ QMI_WDS_CALL_END_REASON_EVDO_HDR_EXIT = 1503,
+ QMI_WDS_CALL_END_REASON_EVDO_HDR_NO_SESSION = 1504,
+ QMI_WDS_CALL_END_REASON_EVDO_HDR_ORIGINATION_DURING_GPS_FIX = 1505,
+ QMI_WDS_CALL_END_REASON_EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 1506,
+ QMI_WDS_CALL_END_REASON_EVDO_HDR_RELEASED_BY_CM = 1507
+} QmiWdsCallEndReason;
+
+/**
+ * QmiWdsVerboseCallEndReasonType:
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_MIP: Mobile IP.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_INTERNAL: Internal.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_CM: Call manager.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_3GPP: 3GPP.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_PPP: PPP.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_EHRPD: eHRPD.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_IPV6: IPv6.
+ *
+ * Type of verbose call end reason.
+ */
+typedef enum {
+ QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_MIP = 1,
+ QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_INTERNAL = 2,
+ QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_CM = 3,
+ QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_3GPP = 6,
+ QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_PPP = 7,
+ QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_EHRPD = 8,
+ QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_IPV6 = 9
+} QmiWdsVerboseCallEndReasonType;
+
+/**
+ * QmiWdsVerboseCallEndReasonMip:
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_ERROR_REASON_UNKNOWN: Unknown reason.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_REASON_UNSPECIFIED: (FA error) Reason unspecified.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_ADMINISTRATIVELY_PROHIBITED: (FA error) Administratively prohibited.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_INSUFFICIENT_RESOURCES: (FA error) Insufficient resources.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MOBILE_NODE_AUTHENTICATION_FAILURE: (FA error) Mobile node authenticatin failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_HA_AUTHENTICATION_FAILURE: (FA error) HA authentication failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_REQUESTED_LIFETIME_TOO_LONG: (FA error) Requested lifetime too long.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MALFORMED_REQUEST: (FA error) Malformed request.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MALFORMED_REPLY: (FA error) Malformed reply.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_ENCAPSULATION_UNAVAILABLE: (FA error) Encapsulation unavailable.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_VJHC_UNAVAILABLE: (FA error) VJHC unavailable.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_REVERSE_TUNNEL_UNAVAILABLE: (FA error) Reverse tunnel unavailable.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_REVERSE_TUNNEL_MANDATORY_AND_T_BIT_NOT_SET: (FA error) Reverse tunnel mandatory and T bit not set.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_DELIVERY_STYLE_NOT_SUPPORTED: (FA error) Delivery style not supported.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MISSING_NAI: (FA error) Missing NAI.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MISSING_HA: (FA error) Missing HA.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MISSING_HOME_ADDRESS: (FA error) Missing home address.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_UNKNOWN_CHALLENGE: (FA error) Unknown challenge.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MISSING_CHALLENGE: (FA error) Missing challenge.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_STALE_CHALLENGE: (FA error) Stale challenge.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_REASON_UNSPECIFIED: (HA error) Reason unspecified.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_ADMINISTRATIVELY_PROHIBITED: (HA error) Administratively prohibited.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_INSUFFICIENT_RESOURCES: (HA error) Insufficient resources.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_MOBILE_NODE_AUTHENTICATION_FAILURE: (HA error) Mobile node authentication failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_FA_AUTHENTICATION_FAILURE: (HA error) FA authentication failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_REGISTRATION_ID_MISMATCH: (HA error) Registration ID mismatch.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_MALFORMED_REQUEST: (HA error) Malformed request.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_UNKNOWN_HA_ADDRESS: (HA error) Unknown HA address.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_REVERSE_TUNNEL_UNAVAILABLE: (HA error) Reverse tunnel unavailable.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_REVERSE_TUNNEL_MANDATORY_AND_T_BIT_NOT_SET: (HA error) Reverse tunnel mandatory and T bit not set.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_ENCAPSULATION_UNAVAILABLE: (HA error) Encapsulation unavailable.
+ *
+ * Mobile IP specific call end reasons, given when the @QmiWdsVerboseCallEndReasonType is #QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_MIP.
+ */
+typedef enum {
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_ERROR_REASON_UNKNOWN = -1,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_REASON_UNSPECIFIED = 64,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_ADMINISTRATIVELY_PROHIBITED = 65,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_INSUFFICIENT_RESOURCES = 66,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MOBILE_NODE_AUTHENTICATION_FAILURE = 67,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_HA_AUTHENTICATION_FAILURE = 68,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_REQUESTED_LIFETIME_TOO_LONG = 69,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MALFORMED_REQUEST = 70,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MALFORMED_REPLY = 71,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_ENCAPSULATION_UNAVAILABLE = 72,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_VJHC_UNAVAILABLE = 73,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_REVERSE_TUNNEL_UNAVAILABLE = 74,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_REVERSE_TUNNEL_MANDATORY_AND_T_BIT_NOT_SET = 75,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_DELIVERY_STYLE_NOT_SUPPORTED = 79,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MISSING_NAI = 97,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MISSING_HA = 98,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MISSING_HOME_ADDRESS = 99,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_UNKNOWN_CHALLENGE = 104,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_MISSING_CHALLENGE = 105,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_FA_ERROR_STALE_CHALLENGE = 106,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_REASON_UNSPECIFIED = 128,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_ADMINISTRATIVELY_PROHIBITED = 129,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_INSUFFICIENT_RESOURCES = 130,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_MOBILE_NODE_AUTHENTICATION_FAILURE = 131,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_FA_AUTHENTICATION_FAILURE = 132,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_REGISTRATION_ID_MISMATCH = 133,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_MALFORMED_REQUEST = 134,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_UNKNOWN_HA_ADDRESS = 136,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_REVERSE_TUNNEL_UNAVAILABLE = 137,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_REVERSE_TUNNEL_MANDATORY_AND_T_BIT_NOT_SET = 138,
+ QMI_WDS_VERBOSE_CALL_END_REASON_MIP_HA_ERROR_ENCAPSULATION_UNAVAILABLE = 139
+} QmiWdsVerboseCallEndReasonMip;
+
+/**
+ * QmiWdsVerboseCallEndReasonInternal:
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_ERROR: Internal error.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_CALL_ENDED: Call ended.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_UNKNOWN_INTERNAL_CAUSE: Unknown internal cause.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_UNKNOWN_CAUSE: Unknown cause.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_CLOSE_IN_PROGRESS: Close in progress.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_NETWORK_INITIATED_TERMINATION: Network initiated termination.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_APP_PREEMPTED: App preempted.
+ *
+ * Internal call end reasons, given when the @QmiWdsVerboseCallEndReasonType is #QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_INTERNAL.
+ */
+typedef enum {
+ QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_ERROR = 201,
+ QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_CALL_ENDED = 202,
+ QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_UNKNOWN_INTERNAL_CAUSE = 203,
+ QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_UNKNOWN_CAUSE = 204,
+ QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_CLOSE_IN_PROGRESS = 205,
+ QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_NETWORK_INITIATED_TERMINATION = 206,
+ QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_APP_PREEMPTED = 207
+} QmiWdsVerboseCallEndReasonInternal;
+
+/**
+ * QmiWdsVerboseCallEndReasonCm:
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_CDMA_LOCK: (CDMA) Phone is CDMA-locked.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_INTERCEPT: (CDMA) Received intercept from the BS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_REORDER: (CDMA) Received reorder from the BS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_RELEASE_SO_REJECT: (CDMA) Received release from the BS, SO reject.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_INCOMING_CALL: (CDMA) Received incoming call from the BS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_ALERT_STOP: (CDMA) Received alert stop from the BS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_ACTIVATION: (CDMA) Received end activation.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_MAX_ACCESS_PROBES: (CDMA) Maximum access probes transmitted.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_CCS_NOT_SUPPORTED_BY_BS: (CDMA) Concurrent service not supported by the BS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_RESPONSE_FROM_BS: (CDMA) No response received from the BS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_REJECTED_BY_BS: (CDMA) Rejected by the BS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_INCOMPATIBLE: (CDMA) Concurrent services requested are incompatible.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_ALREADY_IN_TC: (CDMA) Already in TC.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_USER_CALL_ORIGINATED_DURING_GPS: (CDMA) Call originated during GPS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_USER_CALL_ORIGINATED_DURING_SMS: (CDMA) Call originated during SMS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_CDMA_SERVICE: (CDMA) No service.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_RETRY_ORDER: Retry order.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_CONFIGURATION_FAILED: Configuration failed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_INCOMING_REJECTED: Incoming rejected.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_GATEWAY_SERVICE: No gateway service.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_GPRS_CONTEXT: No GPRS context.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_ILLEGAL_MS: Illegal MS.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_ILLEGAL_ME: Illegal ME.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_GPRS_AND_NON_GPRS_SERVICES_NOT_ALLOWED: GPRS and non GPRS services not allowed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_GPRS_SERVICES_NOT_ALLOWED: GPRS services not allowed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_MS_IDENTITY_NOT_DERIVED_BY_THE_NETWORK: MS identity not derived by the network.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_IMPLICITLY_DETACHED: Implicitly detached.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_PLMN_NOT_ALLOWED: PLMN not allowed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_LA_NOT_ALLOWED: LA not allowed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_GPRS_SERVICES_NOT_ALLOWED_IN_PLMN: GPRS services not allowed in PLMN.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_PDP_DUPLICATE: PDP duplicate.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_UE_RAT_CHANGE: UE radio access technology change.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_CONGESTION: Congestion.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_PDP_CONTEXT_ACTIVATED: No PDP context activated.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_ACCESS_CLASS_DSAC_REJECTION: Access class DSAC rejection.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_CONNECTION_DENY_GENERAL_OR_BUSY: (EV-DO) Received Connection Deny (General or Network busy).
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_CONNECTION_DENY_BILLING_OR_AUTHENTICATION_FAILURE: (EV-DO) Received Connection Deny (Billing or Authentication failure).
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_CHANGE: (EV-DO) Change HDR.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_EXIT: (EV-DO) Exit HDR.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_NO_SESSION: (EV-DO) No HDR session.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_ORIGINATION_DURING_GPS_FIX: (EV-DO) HDR call ended in favor of a GPS fix.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_CONNECTION_SETUP_TIMEOUT: (EV-DO) Connection setup timeout.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_RELEASED_BY_CM: (EV-DO) Released HDR call by call manager.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_HYBRID_HDR_SERVICE: (EV-DO) No hybrid HDR service.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_CLIENT_END: Client end.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_SERVICE: No service.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_FADE: Fade.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_RELEASE_NORMAL: Release normal.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_ACCESS_ATTEMPT_IN_PROGRESS: Access attempt in progress.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_ACCESS_FAILURE: Access Failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_CM_REDIRECTION_OR_HANDOFF: Redirection or handoff.
+ *
+ * Call manager specific call end reasons, given when the @QmiWdsVerboseCallEndReasonType is #QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_CM.
+ */
+typedef enum {
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_CDMA_LOCK = 500,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_INTERCEPT = 501,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_REORDER = 502,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_RELEASE_SO_REJECT = 503,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_INCOMING_CALL = 504,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_ALERT_STOP = 505,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_ACTIVATION = 506,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_MAX_ACCESS_PROBES = 507,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_CCS_NOT_SUPPORTED_BY_BS = 508,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_RESPONSE_FROM_BS = 509,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_REJECTED_BY_BS = 510,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_INCOMPATIBLE = 511,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_ALREADY_IN_TC = 512,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_USER_CALL_ORIGINATED_DURING_GPS = 513,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_USER_CALL_ORIGINATED_DURING_SMS = 514,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_CDMA_SERVICE = 515,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_RETRY_ORDER = 519,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_CONFIGURATION_FAILED = 1000,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_INCOMING_REJECTED = 1001,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_GATEWAY_SERVICE = 1002,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_GPRS_CONTEXT = 1003,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_ILLEGAL_MS = 1004,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_ILLEGAL_ME = 1005,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_GPRS_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 1006,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_GPRS_SERVICES_NOT_ALLOWED = 1007,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_MS_IDENTITY_NOT_DERIVED_BY_THE_NETWORK = 1008,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_IMPLICITLY_DETACHED = 1009,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_PLMN_NOT_ALLOWED = 1010,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_LA_NOT_ALLOWED = 1011,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_GPRS_SERVICES_NOT_ALLOWED_IN_PLMN = 1012,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_PDP_DUPLICATE = 1013,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_UE_RAT_CHANGE = 1014,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_CONGESTION = 1015,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_PDP_CONTEXT_ACTIVATED = 1016,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_ACCESS_CLASS_DSAC_REJECTION = 1017,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_CONNECTION_DENY_GENERAL_OR_BUSY = 1500,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_CONNECTION_DENY_BILLING_OR_AUTHENTICATION_FAILURE = 1501,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_CHANGE = 1502,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_EXIT = 1503,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_NO_SESSION = 1504,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_ORIGINATION_DURING_GPS_FIX = 1505,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_CONNECTION_SETUP_TIMEOUT = 1506,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_HDR_RELEASED_BY_CM = 1507,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_HYBRID_HDR_SERVICE = 1510,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_CLIENT_END = 2000,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_NO_SERVICE = 2001,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_FADE = 2002,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_RELEASE_NORMAL = 2003,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_ACCESS_ATTEMPT_IN_PROGRESS = 2004,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_ACCESS_FAILURE = 2005,
+ QMI_WDS_VERBOSE_CALL_END_REASON_CM_REDIRECTION_OR_HANDOFF = 2006
+} QmiWdsVerboseCallEndReasonCm;
+
+/**
+ * QmiWdsVerboseCallEndReason3gpp:
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_OPERATOR_DETERMINED_BARRING: Operator-determined barring.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_LLC_SNDCP_FAILURE: LLC or SNDCP failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_INSUFFICIENT_RESOURCES: Insufficient resources.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_UNKNOWN_APN: Unknown or missing APN.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_UNKNOWN_PDP: Unknown PDP address or type.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_AUTHENTICATION_FAILED: Authentication failed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_GGSN_REJECT: Activation rejected by GGSN.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_ACTIVATION_REJECT: Activation rejected.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_OPTION_NOT_SUPPORTED: Service option not supported.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_OPTION_UNSUBSCRIBED: Service option not subscribed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_OPTION_TEMPORARILY_OUT_OF_ORDER: Service option temporarily out of order.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_NSAPI_ALREADY_USED: NSAPI already used.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_REGULAR_DEACTIVATION: Regular PDP context deactivation.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_QOS_NOT_ACCEPTED: QoS not accepted.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_NETWORK_FAILURE: Network failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_REATTACH_REQUIRED: Reattach required.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_FEATURE_NOT_SUPPORTED: Feature not supported.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_TFT_SEMANTIC_ERROR: Semantic error in TFT operation.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_TFT_SYNTAX_ERROR: Syntax error in TFT operation.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_UNKNOWN_PDP_CONTEXT: Unknown PDP context.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_FILTER_SEMANTIC_ERROR: Semantic error in packet filters.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_FILTER_SYNTAX_ERROR: Syntax error in packet filters.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_PDP_WITHOUT_ACTIVE_TFT: PDP context without TFT activated.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_IPV4_ONLY_ALLOWED: IPv4 only allowed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_IPV6_ONLY_ALLOWED: IPv6 only allowed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_SINGLE_ADDRESS_BEARER_ONLY: Single address bearer only.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_ESM_INFO_NOT_RECEIVED: ESM information not received.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_PDN_CONNECTION_DOES_NOT_EXIST: PDN connection does not exist.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MULTIPLE_CONNECTION_TO_SAME_PDN_NOT_ALLOWED: Multiple connection to same PDN not allowed.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_INVALID_TRANSACTION_ID: Invalid transaction ID.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MESSAGE_INCORRECT_SEMANTIC: Message incorrect semantically.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_INVALID_MANDATORY_INFO: Invalid mandatory information.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MESSAGE_TYPE_UNSUPPORTED: Message type not implemented.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MESSAGE_TYPE_NONCOMPATIBLE_STATE: Message not compatible with state.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_UNKNOWN_INFO_ELEMENT: Information element unknown.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_CONDITIONAL_IE_ERROR: Conditional IE error.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MESSAGE_AND_PROTOCOL_STATE_UNCOMPATIBLE: Message and protocol state uncompatible.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_PROTOCOL_ERROR: Protocol error.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_APN_TYPE_CONFLICT: APN type conflict.
+ *
+ * 3GPP-specific call end reasons, given when the @QmiWdsVerboseCallEndReasonType is #QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_3GPP.
+ */
+typedef enum { /*< underscore_name=qmi_wds_verbose_call_end_reason_3gpp >*/
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_OPERATOR_DETERMINED_BARRING = 8,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_LLC_SNDCP_FAILURE = 25,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_INSUFFICIENT_RESOURCES = 26,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_UNKNOWN_APN = 27,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_UNKNOWN_PDP = 28,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_AUTHENTICATION_FAILED = 29,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_GGSN_REJECT = 30,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_ACTIVATION_REJECT = 31,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_OPTION_NOT_SUPPORTED = 32,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_OPTION_UNSUBSCRIBED = 33,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_OPTION_TEMPORARILY_OUT_OF_ORDER = 34,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_NSAPI_ALREADY_USED = 35,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_REGULAR_DEACTIVATION = 36,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_QOS_NOT_ACCEPTED = 37,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_NETWORK_FAILURE = 38,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_REATTACH_REQUIRED = 39,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_FEATURE_NOT_SUPPORTED = 40,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_TFT_SEMANTIC_ERROR = 41,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_TFT_SYNTAX_ERROR = 42,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_UNKNOWN_PDP_CONTEXT = 43,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_FILTER_SEMANTIC_ERROR = 44,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_FILTER_SYNTAX_ERROR = 45,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_PDP_WITHOUT_ACTIVE_TFT = 46,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_IPV4_ONLY_ALLOWED = 50,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_IPV6_ONLY_ALLOWED = 51,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_SINGLE_ADDRESS_BEARER_ONLY = 52,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_ESM_INFO_NOT_RECEIVED = 53,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_PDN_CONNECTION_DOES_NOT_EXIST = 54,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MULTIPLE_CONNECTION_TO_SAME_PDN_NOT_ALLOWED = 55,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_INVALID_TRANSACTION_ID = 81,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MESSAGE_INCORRECT_SEMANTIC = 95,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_INVALID_MANDATORY_INFO = 96,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MESSAGE_TYPE_UNSUPPORTED = 97,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MESSAGE_TYPE_NONCOMPATIBLE_STATE = 98,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_UNKNOWN_INFO_ELEMENT = 99,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_CONDITIONAL_IE_ERROR = 100,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_MESSAGE_AND_PROTOCOL_STATE_UNCOMPATIBLE = 101,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_PROTOCOL_ERROR = 111,
+ QMI_WDS_VERBOSE_CALL_END_REASON_3GPP_APN_TYPE_CONFLICT = 112
+} QmiWdsVerboseCallEndReason3gpp;
+
+/**
+ * QmiWdsVerboseCallEndReasonPpp:
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_PPP_UNKNOWN: Unknown error.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_PPP_TIMEOUT: Timeout.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_PPP_AUTHENTICATION_FAILURE: Authentication failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_PPP_OPTION_MISMATCH: Option mismatch.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_PPP_PAP_FAILURE: PAP failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_PPP_CHAP_FAILURE: CHAP failure.
+ *
+ * PPP-specific call end reasons, given when the @QmiWdsVerboseCallEndReasonType is #QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_PPP.
+ */
+typedef enum {
+ QMI_WDS_VERBOSE_CALL_END_REASON_PPP_UNKNOWN = -1,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_PPP_TIMEOUT = 1,
+ QMI_WDS_VERBOSE_CALL_END_REASON_PPP_AUTHENTICATION_FAILURE = 2,
+ QMI_WDS_VERBOSE_CALL_END_REASON_PPP_OPTION_MISMATCH = 3,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_PPP_PAP_FAILURE = 31,
+ QMI_WDS_VERBOSE_CALL_END_REASON_PPP_CHAP_FAILURE = 32
+} QmiWdsVerboseCallEndReasonPpp;
+
+/**
+ * QmiWdsVerboseCallEndReasonEhrpd:
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_SUBSCRIPTION_LIMITED_TO_IPV4: Subscription limited to IPv4.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_SUBSCRIPTION_LIMITED_TO_IPV6: Subscription limited to IPv6.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_TIMEOUT: (VSNCP) timeout.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_FAILURE: (VSNCP) failure.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_GENERAL_ERROR: (VSCNP) 3GPP2 general error.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_UNAUTHENTICATED_APN: (VSCNP) 3GPP2 unauthenticated APN.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_LIMIT_EXCEEDED: (VSCNP) 3GPP2 PDN limit exceeded.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_NO_PDN_GATEWAY: (VSCNP) 3GPP2 no PDN gateway.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_GATEWAY_UNREACHABLE: (VSCNP) 3GPP2 PDN gateway unreachable.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_GATEWAY_REJECTED: (VSCNP) 3GPP2 PDN gateway rejected.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_INSUFFICIENT_PARAMETERS: (VSCNP) 3GPP2 insufficient parameters.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_RESOURCE_UNAVAILABLE: (VSCNP) 3GPP2 resource unavailable.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_ADMINISTRATIVELY_PROHIBITED: (VSCNP) 3GPP2 administratively prohibited.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_ID_IN_USE: (VSCNP) 3GPP2 PDN ID in use.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_SUBSCRIPTION_LIMITATION: (VSCNP) 3GPP2 subscription limitation.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_EXISTS_FOR_THIS_APN: (VSCNP) 3GPP2 PDN exists for this APN.
+ *
+ * eHRPD-specific call end reasons, given when the @QmiWdsVerboseCallEndReasonType is #QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_EHRPD.
+ */
+typedef enum {
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_SUBSCRIPTION_LIMITED_TO_IPV4 = 1,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_SUBSCRIPTION_LIMITED_TO_IPV6 = 2,
+
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_TIMEOUT = 4,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_FAILURE = 5,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_GENERAL_ERROR = 6,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_UNAUTHENTICATED_APN = 7,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_LIMIT_EXCEEDED = 8,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_NO_PDN_GATEWAY = 9,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_GATEWAY_UNREACHABLE = 10,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_GATEWAY_REJECTED = 11,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_INSUFFICIENT_PARAMETERS = 12,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_RESOURCE_UNAVAILABLE = 13,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_ADMINISTRATIVELY_PROHIBITED = 14,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_ID_IN_USE = 15,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_SUBSCRIPTION_LIMITATION = 16,
+ QMI_WDS_VERBOSE_CALL_END_REASON_EHRPD_VSNCP_3GPP2_PDN_EXISTS_FOR_THIS_APN = 17
+} QmiWdsVerboseCallEndReasonEhrpd;
+
+/**
+ * QmiWdsVerboseCallEndReasonIpv6:
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_IPV6_PREFIX_UNAVAILABLE: Prefix unavailable.
+ * @QMI_WDS_VERBOSE_CALL_END_REASON_IPV6_HRPD_IPV6_DISABLED: HRDP IPv6 disabled.
+ *
+ * IPv6-specific call end reasons, given when the @QmiWdsVerboseCallEndReasonType is #QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_IPV6.
+ */
+typedef enum {
+ QMI_WDS_VERBOSE_CALL_END_REASON_IPV6_PREFIX_UNAVAILABLE = 1,
+ QMI_WDS_VERBOSE_CALL_END_REASON_IPV6_HRPD_IPV6_DISABLED = 2
+} QmiWdsVerboseCallEndReasonIpv6;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WDS Get Packet Service Status' message */
+
+/**
+ * QmiWdsConnectionStatus:
+ * @QMI_WDS_CONNECTION_STATUS_UNKNOWN: Unknown status.
+ * @QMI_WDS_CONNECTION_STATUS_DISCONNECTED: Network is disconnected
+ * @QMI_WDS_CONNECTION_STATUS_CONNECTED: Network is connected.
+ * @QMI_WDS_CONNECTION_STATUS_SUSPENDED: Network connection is suspended.
+ * @QMI_WDS_CONNECTION_STATUS_AUTHENTICATING: Network authentication is ongoing.
+ *
+ * Status of the network connection.
+ */
+typedef enum {
+ QMI_WDS_CONNECTION_STATUS_UNKNOWN = 0,
+ QMI_WDS_CONNECTION_STATUS_DISCONNECTED = 1,
+ QMI_WDS_CONNECTION_STATUS_CONNECTED = 2,
+ QMI_WDS_CONNECTION_STATUS_SUSPENDED = 3,
+ QMI_WDS_CONNECTION_STATUS_AUTHENTICATING = 4
+} QmiWdsConnectionStatus;
+
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WDS Get Data Bearer Technology' message */
+
+/**
+ * QmiWdsDataBearerTechnology:
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_UNKNOWN: Unknown.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_CDMA20001X: CDMA2000 1x.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_1xEVDO: CDMA2000 HRPD 1xEV-DO.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_GSM: GSM.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_UMTS: UMTS.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_1xEVDO_REVA: CDMA2000 HRPD 1xEV-DO RevA.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_EDGE: EDGE.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPA: HSDPA and WCDMA.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_HSUPA: WCDMA and HSUPA.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPA_HSUPDA: HSDPA and HSUPA.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_LTE: LTE.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_EHRPD: CDMA2000 eHRPD.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPAPLUS: HSDPA+ and WCDMA.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPAPLUS_HSUPA: HSDPA+ and HSUPA.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_DCHSDPAPLUS: DC-HSDPA+ and WCDMA.
+ * @QMI_WDS_DATA_BEARER_TECHNOLOGY_DCHSDPAPLUS_HSUPA: DC-HSDPA+ and HSUPA.
+ *
+ * Data bearer technology.
+ */
+typedef enum {
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_UNKNOWN = -1,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_CDMA20001X = 0x01,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_1xEVDO = 0x02,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_GSM = 0x03,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_UMTS = 0x04,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_1xEVDO_REVA = 0x05,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_EDGE = 0x06,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPA = 0x07,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_HSUPA = 0x08,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPA_HSUPDA = 0x09,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_LTE = 0x0A,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_EHRPD = 0x0B,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPAPLUS = 0x0C,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPAPLUS_HSUPA = 0x0D,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_DCHSDPAPLUS = 0x0E,
+ QMI_WDS_DATA_BEARER_TECHNOLOGY_DCHSDPAPLUS_HSUPA = 0x0F
+} QmiWdsDataBearerTechnology;
+
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WDS Get Current Data Bearer Technology' message */
+
+/**
+ * QmiWdsNetworkType:
+ * @QMI_WDS_NETWORK_TYPE_UNKNOWN: Unknown.
+ * @QMI_WDS_NETWORK_TYPE_3GPP2: 3GPP2 network type.
+ * @QMI_WDS_NETWORK_TYPE_3GPP: 3GPP network type.
+ *
+ * Network type of the data bearer.
+ */
+typedef enum {
+ QMI_WDS_NETWORK_TYPE_UNKNOWN = 0,
+ QMI_WDS_NETWORK_TYPE_3GPP2 = 1,
+ QMI_WDS_NETWORK_TYPE_3GPP = 2
+} QmiWdsNetworkType;
+
+/**
+ * QmiWdsRat3gpp2:
+ * @QMI_WDS_RAT_3GPP2_NONE: Unknown, to be ignored.
+ * @QMI_WDS_RAT_3GPP2_CDMA1X: CDMA 1x.
+ * @QMI_WDS_RAT_3GPP2_EVDO_REV0: EVDO Rev0.
+ * @QMI_WDS_RAT_3GPP2_EVDO_REVA: EVDO RevA.
+ * @QMI_WDS_RAT_3GPP2_EVDO_REVB: EVDO RevB.
+ * @QMI_WDS_RAT_3GPP2_NULL_BEARER: No bearer.
+ *
+ * Flags specifying the 3GPP2-specific Radio Access Technology, when the data
+ * bearer network type is @QMI_WDS_NETWORK_TYPE_3GPP2.
+ */
+typedef enum { /*< underscore_name=qmi_wds_rat_3gpp2 >*/
+ QMI_WDS_RAT_3GPP2_NONE = 0,
+ QMI_WDS_RAT_3GPP2_CDMA1X = 1 << 0,
+ QMI_WDS_RAT_3GPP2_EVDO_REV0 = 1 << 1,
+ QMI_WDS_RAT_3GPP2_EVDO_REVA = 1 << 2,
+ QMI_WDS_RAT_3GPP2_EVDO_REVB = 1 << 3,
+ QMI_WDS_RAT_3GPP2_NULL_BEARER = 1 << 15
+} QmiWdsRat3gpp2;
+
+/**
+ * QmiWdsRat3gpp:
+ * @QMI_WDS_RAT_3GPP_NONE: Unknown, to be ignored.
+ * @QMI_WDS_RAT_3GPP_WCDMA: WCDMA.
+ * @QMI_WDS_RAT_3GPP_GPRS: GPRS.
+ * @QMI_WDS_RAT_3GPP_HSDPA: HSDPA.
+ * @QMI_WDS_RAT_3GPP_HSUPA: HSUPA.
+ * @QMI_WDS_RAT_3GPP_EDGE: EDGE.
+ * @QMI_WDS_RAT_3GPP_LTE: LTE.
+ * @QMI_WDS_RAT_3GPP_HSDPAPLUS: HSDPA+.
+ * @QMI_WDS_RAT_3GPP_DCHSDPAPLUS: DC-HSDPA+
+ * @QMI_WDS_RAT_3GPP_NULL_BEARER: No bearer.
+ *
+ * Flags specifying the 3GPP-specific Radio Access Technology, when the data
+ * bearer network type is @QMI_WDS_NETWORK_TYPE_3GPP.
+ */
+typedef enum { /*< underscore_name=qmi_wds_rat_3gpp >*/
+ QMI_WDS_RAT_3GPP_NONE = 0,
+ QMI_WDS_RAT_3GPP_WCDMA = 1 << 0,
+ QMI_WDS_RAT_3GPP_GPRS = 1 << 1,
+ QMI_WDS_RAT_3GPP_HSDPA = 1 << 2,
+ QMI_WDS_RAT_3GPP_HSUPA = 1 << 3,
+ QMI_WDS_RAT_3GPP_EDGE = 1 << 4,
+ QMI_WDS_RAT_3GPP_LTE = 1 << 5,
+ QMI_WDS_RAT_3GPP_HSDPAPLUS = 1 << 6,
+ QMI_WDS_RAT_3GPP_DCHSDPAPLUS = 1 << 7,
+ QMI_WDS_RAT_3GPP_NULL_BEARER = 1 << 15
+} QmiWdsRat3gpp;
+
+/**
+ * QmiWdsSoCdma1x:
+ * @QMI_WDS_SO_CDMA1X_NONE: Unknown, to be ignored.
+ * @QMI_WDS_SO_CDMA1X_IS95: IS95.
+ * @QMI_WDS_SO_CDMA1X_IS2000: IS2000.
+ * @QMI_WDS_SO_CDMA1X_IS2000_REL_A: IS2000 RelA.
+ *
+ * Flags specifying the Service Option when the bearer network type is
+ * @QMI_WDS_NETWORK_TYPE_3GPP2 and when the Radio Access Technology mask
+ * contains @QMI_WDS_RAT_3GPP2_CDMA1X.
+ */
+typedef enum {
+ QMI_WDS_SO_CDMA1X_NONE = 0,
+ QMI_WDS_SO_CDMA1X_IS95 = 1 << 0,
+ QMI_WDS_SO_CDMA1X_IS2000 = 1 << 1,
+ QMI_WDS_SO_CDMA1X_IS2000_REL_A = 1 << 2
+} QmiWdsSoCdma1x;
+
+/**
+ * QmiWdsSoEvdoRevA:
+ * @QMI_WDS_SO_EVDO_REVA_NONE: Unknown, to be ignored.
+ * @QMI_WDS_SO_EVDO_REVA_DPA: DPA.
+ * @QMI_WDS_SO_EVDO_REVA_MFPA: MFPA.
+ * @QMI_WDS_SO_EVDO_REVA_EMPA: EMPA.
+ * @QMI_WDS_SO_EVDO_REVA_EMPA_EHRPD: EMPA EHRPD.
+ *
+ * Flags specifying the Service Option when the bearer network type is
+ * @QMI_WDS_NETWORK_TYPE_3GPP2 and when the Radio Access Technology mask
+ * contains @QMI_WDS_RAT_3GPP2_EVDO_REVA.
+ */
+typedef enum { /*< underscore_name=qmi_wds_so_evdo_reva >*/
+ QMI_WDS_SO_EVDO_REVA_NONE = 0,
+ QMI_WDS_SO_EVDO_REVA_DPA = 1 << 0,
+ QMI_WDS_SO_EVDO_REVA_MFPA = 1 << 1,
+ QMI_WDS_SO_EVDO_REVA_EMPA = 1 << 2,
+ QMI_WDS_SO_EVDO_REVA_EMPA_EHRPD = 1 << 3
+} QmiWdsSoEvdoRevA;
+
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WDS Get Current Settings' message */
+
+/**
+ * QmiWdsGetCurrentSettingsRequestedSettings:
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_NONE: no settings requested
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PROFILE_ID: request profile ID
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PROFILE_NAME: request profile name
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PDP_TYPE: request PDP context type
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_APN_NAME: request APN name
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_DNS_ADDRESS: request DNS server addresses
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_GRANTED_QOS: request granted QoS
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_USERNAME: request username
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_AUTH_PROTOCOL: request authentication protocol (ie PAP/CHAP/none)
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_IP_ADDRESS: request IP address
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_GATEWAY_INFO: request gateway address
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PCSCF_ADDRESS: request PCSCF address
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PCSCF_SERVER_ADDRESS_LIST: request PCSCF server address list
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PCSCF_DOMAIN_NAME_LIST: request PCSCF domain name list
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_MTU: request MTU
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_DOMAIN_NAME_LIST: request domain name list
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_IP_FAMILY: request IP family (ie IPv4 or IPv6)
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_IMCN_FLAG: request IMCN flag
+ * @QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_EXTENDED_TECHNOLOGY: request extended technology info
+ *
+ * Flags specifying which specific settings to return when requesting the
+ * current WDS bearer settings.
+ */
+typedef enum { /*< underscore_name=qmi_wds_get_current_settings_requested_settings >*/
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_NONE = 0,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PROFILE_ID = 1 << 0,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PROFILE_NAME = 1 << 1,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PDP_TYPE = 1 << 2,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_APN_NAME = 1 << 3,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_DNS_ADDRESS = 1 << 4,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_GRANTED_QOS = 1 << 5,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_USERNAME = 1 << 6,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_AUTH_PROTOCOL = 1 << 7,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_IP_ADDRESS = 1 << 8,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_GATEWAY_INFO = 1 << 9,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PCSCF_ADDRESS = 1 << 10,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PCSCF_SERVER_ADDRESS_LIST = 1 << 11,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_PCSCF_DOMAIN_NAME_LIST = 1 << 12,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_MTU = 1 << 13,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_DOMAIN_NAME_LIST = 1 << 14,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_IP_FAMILY = 1 << 15,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_IMCN_FLAG = 1 << 16,
+ QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_EXTENDED_TECHNOLOGY = 1 << 17,
+} QmiWdsGetCurrentSettingsRequestedSettings;
+
+/**
+ * QmiWdsPdpType:
+ * @QMI_WDS_PDP_TYPE_IPV4: IPv4
+ * @QMI_WDS_PDP_TYPE_PPP: PPP
+ * @QMI_WDS_PDP_TYPE_IPV6: IPv6
+ * @QMI_WDS_PDP_TYPE_IPV4_OR_IPV6: IPv4 and IPv6 combined context
+ *
+ * PDP context type.
+ */
+typedef enum { /*< underscore_name=qmi_wds_pdp_type >*/
+ QMI_WDS_PDP_TYPE_IPV4 = 0,
+ QMI_WDS_PDP_TYPE_PPP = 1,
+ QMI_WDS_PDP_TYPE_IPV6 = 2,
+ QMI_WDS_PDP_TYPE_IPV4_OR_IPV6 = 3
+} QmiWdsPdpType;
+
+/**
+ * QmiWdsTrafficClass:
+ * @QMI_WDS_TRAFFIC_CLASS_SUBSCRIBED: default (?) class, best-effort
+ * @QMI_WDS_TRAFFIC_CLASS_CONVERSATIONAL: two-way video/voice, most delay sensitive
+ * @QMI_WDS_TRAFFIC_CLASS_STREAMING: one-way video/audio, delay sensitive
+ * @QMI_WDS_TRAFFIC_CLASS_INTERACTIVE: delay-insensitive (browsing, SSH)
+ * @QMI_WDS_TRAFFIC_CLASS_BACKGROUND: delay-insensitive (downloads, email)
+ *
+ * QoS Traffic Classes.
+ */
+typedef enum { /*< underscore_name=qmi_wds_traffic_class >*/
+ QMI_WDS_TRAFFIC_CLASS_SUBSCRIBED = 0,
+ QMI_WDS_TRAFFIC_CLASS_CONVERSATIONAL = 1,
+ QMI_WDS_TRAFFIC_CLASS_STREAMING = 2,
+ QMI_WDS_TRAFFIC_CLASS_INTERACTIVE = 3,
+ QMI_WDS_TRAFFIC_CLASS_BACKGROUND = 4
+} QmiWdsTrafficClass;
+
+/**
+ * QmiWdsAuthentication:
+ * @QMI_WDS_AUTHENTICATION_NONE: no authentication
+ * @QMI_WDS_AUTHENTICATION_PAP: PAP authentication
+ * @QMI_WDS_AUTHENTICATION_CHAP: CHAP authentication
+ *
+ * PDP context authentication protocols.
+ */
+typedef enum { /*< underscore_name=qmi_wds_authentication >*/
+ QMI_WDS_AUTHENTICATION_NONE = 0,
+ QMI_WDS_AUTHENTICATION_PAP = 1 << 0,
+ QMI_WDS_AUTHENTICATION_CHAP = 1 << 1
+} QmiWdsAuthentication;
+
+/**
+ * QmiWdsProfileType:
+ * @QMI_WDS_PROFILE_TYPE_3GPP: 3GPP profile type.
+ * @QMI_WDS_PROFILE_TYPE_3GPP2: 3GPP2 profile type.
+ *
+ * Profile network type family.
+ */
+typedef enum {
+ QMI_WDS_PROFILE_TYPE_3GPP = 0,
+ QMI_WDS_PROFILE_TYPE_3GPP2 = 1
+} QmiWdsProfileType;
+
+#endif /* _LIBQMI_GLIB_QMI_ENUMS_WDS_H_ */
diff --git a/qmi-enums-wms.h b/qmi-enums-wms.h
new file mode 100644
index 0000000..5b54ac9
--- /dev/null
+++ b/qmi-enums-wms.h
@@ -0,0 +1,425 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Google Inc.
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_ENUMS_WMS_H_
+#define _LIBQMI_GLIB_QMI_ENUMS_WMS_H_
+
+/**
+ * SECTION: qmi-enums-wms
+ * @title: WMS enumerations and flags
+ *
+ * This section defines enumerations and flags used in the WMS service
+ * interface.
+ */
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WMS Event Report' indication */
+
+/**
+ * QmiWmsStorageType:
+ * @QMI_WMS_STORAGE_TYPE_UIM: Message stored in UIM.
+ * @QMI_WMS_STORAGE_TYPE_NV: Message stored in non-volatile memory.
+ * @QMI_WMS_STORAGE_TYPE_NONE: None.
+ *
+ * Type of messaging storage
+ */
+typedef enum {
+ QMI_WMS_STORAGE_TYPE_UIM = 0x00,
+ QMI_WMS_STORAGE_TYPE_NV = 0x01,
+ QMI_WMS_STORAGE_TYPE_NONE = 0xFF
+} QmiWmsStorageType;
+
+/**
+ * QmiWmsAckIndicator:
+ * @QMI_WMS_ACK_INDICATOR_SEND: ACK needs to be sent.
+ * @QMI_WMS_ACK_INDICATOR_DO_NOT_SEND: ACK doesn't need to be sent.
+ *
+ * Indication of whether ACK needs to be sent or not.
+ */
+typedef enum {
+ QMI_WMS_ACK_INDICATOR_SEND = 0x00,
+ QMI_WMS_ACK_INDICATOR_DO_NOT_SEND = 0x01
+} QmiWmsAckIndicator;
+
+/**
+ * QmiWmsMessageFormat:
+ * @QMI_WMS_MESSAGE_FORMAT_CDMA: CDMA message.
+ * @QMI_WMS_MESSAGE_FORMAT_GSM_WCDMA_POINT_TO_POINT: Point-to-point 3GPP message.
+ * @QMI_WMS_MESSAGE_FORMAT_GSM_WCDMA_BROADCAST: Broadcast 3GPP message.
+ * @QMI_WMS_MESSAGE_FORMAT_MWI: Message Waiting Indicator.
+ *
+ * Type of message.
+ */
+typedef enum {
+ QMI_WMS_MESSAGE_FORMAT_CDMA = 0x00,
+ QMI_WMS_MESSAGE_FORMAT_GSM_WCDMA_POINT_TO_POINT = 0x06,
+ QMI_WMS_MESSAGE_FORMAT_GSM_WCDMA_BROADCAST = 0x07,
+ QMI_WMS_MESSAGE_FORMAT_MWI = 0x08
+} QmiWmsMessageFormat;
+
+/**
+ * QmiWmsMessageMode:
+ * @QMI_WMS_MESSAGE_MODE_CDMA: Message sent using 3GPP2 technologies.
+ * @QMI_WMS_MESSAGE_MODE_GSM_WCDMA: Message sent using 3GPP technologies.
+ *
+ * Message mode.
+ */
+typedef enum {
+ QMI_WMS_MESSAGE_MODE_CDMA = 0x00,
+ QMI_WMS_MESSAGE_MODE_GSM_WCDMA = 0x01
+} QmiWmsMessageMode;
+
+/**
+ * QmiWmsNotificationType:
+ * @QMI_WMS_NOTIFICATION_TYPE_PRIMARY: Primary.
+ * @QMI_WMS_NOTIFICATION_TYPE_SECONDARY_GSM: Secondary GSM.
+ * @QMI_WMS_NOTIFICATION_TYPE_SECONDARY_UMTS: Secondary UMTS.
+ *
+ * Type of notification.
+ */
+typedef enum {
+ QMI_WMS_NOTIFICATION_TYPE_PRIMARY = 0x00,
+ QMI_WMS_NOTIFICATION_TYPE_SECONDARY_GSM = 0x01,
+ QMI_WMS_NOTIFICATION_TYPE_SECONDARY_UMTS = 0x02
+} QmiWmsNotificationType;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WMS Raw Send' request/response */
+
+/**
+ * QmiWmsCdmaServiceOption:
+ * @QMI_WMS_CDMA_SERVICE_OPTION_AUTO: Automatic selection of service option.
+ * @QMI_WMS_CDMA_SERVICE_OPTION_6: Use service option 6.
+ * @QMI_WMS_CDMA_SERVICE_OPTION_14: Use service option 14.
+ *
+ * CDMA service option selection.
+ */
+typedef enum {
+ QMI_WMS_CDMA_SERVICE_OPTION_AUTO = 0x00,
+ QMI_WMS_CDMA_SERVICE_OPTION_6 = 0x06,
+ QMI_WMS_CDMA_SERVICE_OPTION_14 = 0x0E
+} QmiWmsCdmaServiceOption;
+
+/**
+ * QmiWmsCdmaCauseCode:
+ * @QMI_WDS_CDMA_CAUSE_CODE_NETWORK_ADDRESS_VACANT: Address is valid but not yet allocated.
+ * @QMI_WDS_CDMA_CAUSE_CODE_NETWORK_ADDRESS_TRANSLATION_FAILURE: Address is invalid.
+ * @QMI_WDS_CDMA_CAUSE_CODE_NETWORK_RESOURCE_SHORTAGE: Network resource shortage.
+ * @QMI_WDS_CDMA_CAUSE_CODE_NETWORK_FAILURE: Network failed.
+ * @QMI_WDS_CDMA_CAUSE_CODE_NETWORK_INVALID_TELESERVICE_ID: SMS teleservice ID is invalid.
+ * @QMI_WDS_CDMA_CAUSE_CODE_NETWORK_OTHER: Other network error.
+ * @QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_NO_PAGE_RESPONSE: No page response from destination.
+ * @QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_BUSY: Destination is busy.
+ * @QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_NO_ACK: No acknowledge from destination.
+ * @QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_RESOURCE_SHORTAGE: Destination resource shortage.
+ * @QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_SMS_DELIVERY_POSTPONED: SMS deliver postponed.
+ * @QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_OUT_OF_SERVICE: Destination out of service.
+ * @QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_NOT_AT_ADDRESS: Destination not at address.
+ * @QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_OTHER: Other destination error.
+ * @QMI_WDS_CDMA_CAUSE_CODE_RADIO_INTERFACE_RESOURCE_SHORTAGE: Radio interface resource shortage.
+ * @QMI_WDS_CDMA_CAUSE_CODE_RADIO_INTERFACE_INCOMPATIBILITY: Radio interface incompatibility.
+ * @QMI_WDS_CDMA_CAUSE_CODE_RADIO_INTERFACE_OTHER: Other radio interface error.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_ENCODING: Encoding error.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_SMS_ORIGIN_DENIED: SMS origin denied.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_SMS_DESTINATION_DENIED: SMS destination denied.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_SUPPLEMENTARY_SERVICE_NOT_SUPPORTED: Supplementary service not supported.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_SMS_NOT_SUPPORTED: SMS not supported.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_MISSING_EXPECTED_PARAMETER: Missing optional expected parameter.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_MISSING_MANDATORY_PARAMETER: Missing mandatory parameter.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_UNRECOGNIZED_PARAMETER_VALUE: Unrecognized parameter value.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_UNEXPECTED_PARAMETER_VALUE: Unexpected parameter value.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_USER_DATA_SIZE_ERROR: user data size error.
+ * @QMI_WDS_CDMA_CAUSE_CODE_GENERAL_OTHER: Other general error.
+ *
+ * Cause codes when failed to send an SMS in CDMA.
+ */
+typedef enum {
+ /* Network errors */
+ QMI_WDS_CDMA_CAUSE_CODE_NETWORK_ADDRESS_VACANT = 0x00,
+ QMI_WDS_CDMA_CAUSE_CODE_NETWORK_ADDRESS_TRANSLATION_FAILURE = 0x01,
+ QMI_WDS_CDMA_CAUSE_CODE_NETWORK_RESOURCE_SHORTAGE = 0x02,
+ QMI_WDS_CDMA_CAUSE_CODE_NETWORK_FAILURE = 0x03,
+ QMI_WDS_CDMA_CAUSE_CODE_NETWORK_INVALID_TELESERVICE_ID = 0x04,
+ QMI_WDS_CDMA_CAUSE_CODE_NETWORK_OTHER = 0x05,
+
+ /* Destination errors */
+ QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_NO_PAGE_RESPONSE = 0x20,
+ QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_BUSY = 0x21,
+ QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_NO_ACK = 0x22,
+ QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_RESOURCE_SHORTAGE = 0x23,
+ QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_SMS_DELIVERY_POSTPONED = 0x24,
+ QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_OUT_OF_SERVICE = 0x25,
+ QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_NOT_AT_ADDRESS = 0x26,
+ QMI_WDS_CDMA_CAUSE_CODE_DESTINATION_OTHER = 0x27,
+
+ /* Radio Interface errors */
+ QMI_WDS_CDMA_CAUSE_CODE_RADIO_INTERFACE_RESOURCE_SHORTAGE = 0x40,
+ QMI_WDS_CDMA_CAUSE_CODE_RADIO_INTERFACE_INCOMPATIBILITY = 0x41,
+ QMI_WDS_CDMA_CAUSE_CODE_RADIO_INTERFACE_OTHER = 0x42,
+
+ /* General errors */
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_ENCODING = 0x60,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_SMS_ORIGIN_DENIED = 0x61,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_SMS_DESTINATION_DENIED = 0x62,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_SUPPLEMENTARY_SERVICE_NOT_SUPPORTED = 0x63,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_SMS_NOT_SUPPORTED = 0x64,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_MISSING_EXPECTED_PARAMETER = 0x65,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_MISSING_MANDATORY_PARAMETER = 0x66,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_UNRECOGNIZED_PARAMETER_VALUE = 0x67,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_UNEXPECTED_PARAMETER_VALUE = 0x68,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_USER_DATA_SIZE_ERROR = 0x69,
+ QMI_WDS_CDMA_CAUSE_CODE_GENERAL_OTHER = 0x6A
+} QmiWmsCdmaCauseCode;
+
+/**
+ * QmiWmsCdmaErrorClass:
+ * @QMI_WMS_CDMA_ERROR_CLASS_TEMPORARY: Temporary error.
+ * @QMI_WMS_CDMA_ERROR_CLASS_PERMANENT: Permanent error.
+ *
+ * Error class when failed to send an SMS in CDMA.
+ */
+typedef enum {
+ QMI_WMS_CDMA_ERROR_CLASS_TEMPORARY = 0x00,
+ QMI_WMS_CDMA_ERROR_CLASS_PERMANENT = 0x01
+} QmiWmsCdmaErrorClass;
+
+/**
+ * QmiWmsGsmUmtsRpCause:
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_UNASSIGNED_NUMBER: Unassigned number.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_OPERATOR_DETERMINED_BARRING: Operator determined barring.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_CALL_BARRED: Call barred.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_RESERVED: Reserved.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_SMS_TRANSFER_REJECTED: SMS transfer rejected.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_MEMORY_CAPACITY_EXCEEDED: Memory capacity exceeded.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_DESTINATION_OUT_OF_ORDER: Destination out of order.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_UNIDENTIFIED_SUBSCRIBER: Unidentified subscriber.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_FACILITY_REJECTED: Facility rejected.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_UNKNOWN_SUBSCRIBER: Unknown subscriber.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_NETWORK_OUF_OF_ORDER: Network out of order.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_TEMPORARY_FAILURE: Temporary failure.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_CONGESTION: Congestion.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_RESOURCES_UNAVAILABLE: Resources unavailable.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_FACILITY_NOT_SUBSCRIBED: Facility not subscribed.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_FACILITY_NOT_IMPLEMENTED: Facility not implemented.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_INVALID_SMS_TRANSFER_REFERENCE_VALUE: Invalid SMS transfer reference value.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE: Semantically incorrect message.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_INVALID_MANDATORY_INFO: Invalid mandatory info.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED: Message type not implemented.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_SMS: Message not compatible with SMS.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_INFORMATION_ELEMENT_NOT_IMPLEMENTED: Information element not implemented.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_PROTOCOL_ERROR: Protocol error.
+ * @QMI_WMS_GSM_UMTS_RP_CAUSE_INTERWORKING: Interworking error.
+ *
+ * RP cause codes when failed to send an SMS in GSM/WCDMA.
+ */
+typedef enum {
+ QMI_WMS_GSM_UMTS_RP_CAUSE_UNASSIGNED_NUMBER = 0x01,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_OPERATOR_DETERMINED_BARRING = 0x08,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_CALL_BARRED = 0x0A,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_RESERVED = 0x0B,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_SMS_TRANSFER_REJECTED = 0x15,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_MEMORY_CAPACITY_EXCEEDED = 0x16,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_DESTINATION_OUT_OF_ORDER = 0x1B,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_UNIDENTIFIED_SUBSCRIBER = 0x1C,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_FACILITY_REJECTED = 0x1D,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_UNKNOWN_SUBSCRIBER = 0x1E,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_NETWORK_OUF_OF_ORDER = 0x20,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_TEMPORARY_FAILURE = 0x21,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_CONGESTION = 0x2A,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_RESOURCES_UNAVAILABLE = 0x2F,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_FACILITY_NOT_SUBSCRIBED = 0x32,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_FACILITY_NOT_IMPLEMENTED = 0x45,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_INVALID_SMS_TRANSFER_REFERENCE_VALUE = 0x51,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE = 0x5F,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_INVALID_MANDATORY_INFO = 0x60,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED = 0x61,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_SMS = 0x62,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_INFORMATION_ELEMENT_NOT_IMPLEMENTED = 0x63,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_PROTOCOL_ERROR = 0x6F,
+ QMI_WMS_GSM_UMTS_RP_CAUSE_INTERWORKING = 0x7F
+} QmiWmsGsmUmtsRpCause;
+
+/**
+ * QmiWmsGsmUmtsTpCause:
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_TELE_INTERWORKING_NOT_SUPPORTED: Tele interworking not supported.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_SHORT_MESSAGE_TYPE_0_NOT_SUPPORTED: Short message type 0 not supported.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_SHORT_MESSAGE_CANNOT_BE_REPLACED: Short message cannot be replaced.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_UNSPECIFIED_PID_ERROR: Unspecified TP-PID error.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_DCS_NOT_SUPPORTED: Data coding scheme not supported.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_MESSAGE_CLASS_NOT_SUPPORTED: Message class not supported.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_UNSPECIFIED_DCS_ERROR: Unspecified data coding scheme error.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_COMMAND_CANNOT_BE_ACTIONED: Command cannot be actioned.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_COMMAND_UNSUPPORTED: Command unsupported.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_UNSPECIFIED_COMMAND_ERROR: Unspecified command error.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_TPDU_NOT_SUPPORTED: TPDU not supported.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_SC_BUSY: SC busy.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_NO_SC_SUBSCRIPTION: No SC subscription.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_SC_SYSTEM_FAILURE: SC system failure.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_INVALID_SME_ADDRESS: Invalid SME address.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_DESTINATION_SME_BARRED: Destination SME barred.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_SM_REJECTED_OR_DUPLICATE: SM rejected or duplicate.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_VPF_NOT_SUPPORTED: TP-VPF not supported.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_VP_NOT_SUPPORTED: TP-VP not supported.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_SIM_SMS_STORAGE_FULL: SIM SMS storage full.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_NO_SMS_STORAGE_CAPABILITY_IN_SIM: No SMS storage capability in SIM.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_MS_ERROR: MS error.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_MEMORY_CAPACITY_EXCEEDED: Memory capacity exceeded.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_SIM_APPLICATION_TOOLKIT_BUSY: SIM application toolkit busy.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_SIM_DATA_DOWNLOAD_ERROR: SIM data download error.
+ * @QMI_WMS_GSM_UMTS_TP_CAUSE_UNSPECIFIED_ERROR: Unspecified error.
+ *
+ * RT cause codes when failed to send an SMS in GSM/WCDMA.
+ */
+typedef enum {
+ QMI_WMS_GSM_UMTS_TP_CAUSE_TELE_INTERWORKING_NOT_SUPPORTED = 0x80,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_SHORT_MESSAGE_TYPE_0_NOT_SUPPORTED = 0x81,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_SHORT_MESSAGE_CANNOT_BE_REPLACED = 0x82,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_UNSPECIFIED_PID_ERROR = 0x8F,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_DCS_NOT_SUPPORTED = 0x90,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_MESSAGE_CLASS_NOT_SUPPORTED = 0x91,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_UNSPECIFIED_DCS_ERROR = 0x9F,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_COMMAND_CANNOT_BE_ACTIONED = 0xA0,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_COMMAND_UNSUPPORTED = 0xA1,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_UNSPECIFIED_COMMAND_ERROR = 0xAF,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_TPDU_NOT_SUPPORTED = 0xB0,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_SC_BUSY = 0xC0,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_NO_SC_SUBSCRIPTION = 0xC1,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_SC_SYSTEM_FAILURE = 0xC2,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_INVALID_SME_ADDRESS = 0xC3,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_DESTINATION_SME_BARRED = 0xC4,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_SM_REJECTED_OR_DUPLICATE = 0xC5,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_VPF_NOT_SUPPORTED = 0xC6,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_VP_NOT_SUPPORTED = 0xC7,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_SIM_SMS_STORAGE_FULL = 0xD0,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_NO_SMS_STORAGE_CAPABILITY_IN_SIM = 0xD1,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_MS_ERROR = 0xD2,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_MEMORY_CAPACITY_EXCEEDED = 0xD3,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_SIM_APPLICATION_TOOLKIT_BUSY = 0xD4,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_SIM_DATA_DOWNLOAD_ERROR = 0xD5,
+ QMI_WMS_GSM_UMTS_TP_CAUSE_UNSPECIFIED_ERROR = 0xFF
+} QmiWmsGsmUmtsTpCause;
+
+/**
+ * QmiWmsMessageDeliveryFailureType:
+ * @QMI_WMS_MESSAGE_DELIVERY_FAILURE_TYPE_TEMPORARY: Temporary failure.
+ * @QMI_WMS_MESSAGE_DELIVERY_FAILURE_TYPE_PERMANENT: Permanent failure.
+ *
+ * Type of message delivery failure.
+ */
+typedef enum {
+ QMI_WMS_MESSAGE_DELIVERY_FAILURE_TYPE_TEMPORARY = 0x00,
+ QMI_WMS_MESSAGE_DELIVERY_FAILURE_TYPE_PERMANENT = 0x01
+} QmiWmsMessageDeliveryFailureType;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WMS Read Raw' request/response */
+
+/**
+ * QmiWmsMessageTagType:
+ * @QMI_WMS_MESSAGE_TAG_TYPE_MT_READ: Received SMS, already read.
+ * @QMI_WMS_MESSAGE_TAG_TYPE_MT_NOT_READ: Received SMS, not read.
+ * @QMI_WMS_MESSAGE_TAG_TYPE_MO_SENT: Sent SMS.
+ * @QMI_WMS_MESSAGE_TAG_TYPE_MO_NOT_SENT: Not yet sent SMS.
+ *
+ * Type of message tag.
+ */
+typedef enum {
+ QMI_WMS_MESSAGE_TAG_TYPE_MT_READ = 0x00,
+ QMI_WMS_MESSAGE_TAG_TYPE_MT_NOT_READ = 0x01,
+ QMI_WMS_MESSAGE_TAG_TYPE_MO_SENT = 0x02,
+ QMI_WMS_MESSAGE_TAG_TYPE_MO_NOT_SENT = 0x03
+} QmiWmsMessageTagType;
+
+/**
+ * QmiWmsMessageProtocol:
+ * @QMI_WMS_MESSAGE_PROTOCOL_CDMA: CDMA.
+ * @QMI_WMS_MESSAGE_PROTOCOL_WCDMA: WCDMA.
+ *
+ * Type of message protocol.
+ */
+typedef enum {
+ QMI_WMS_MESSAGE_PROTOCOL_CDMA = 0x00,
+ QMI_WMS_MESSAGE_PROTOCOL_WCDMA = 0x01
+} QmiWmsMessageProtocol;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI WMS Set Routes' request/response */
+
+/**
+ * QmiWmsMessageType:
+ * @QMI_WMS_MESSAGE_TYPE_POINT_TO_POINT: Point to point message.
+ *
+ * Type of message.
+ */
+typedef enum {
+ QMI_WMS_MESSAGE_TYPE_POINT_TO_POINT = 0x00
+} QmiWmsMessageType;
+
+/**
+ * QmiWmsMessageClass:
+ * @QMI_WMS_MESSAGE_CLASS_0: Class 0.
+ * @QMI_WMS_MESSAGE_CLASS_1: Class 1.
+ * @QMI_WMS_MESSAGE_CLASS_2: Class 2.
+ * @QMI_WMS_MESSAGE_CLASS_3: Class 3.
+ * @QMI_WMS_MESSAGE_CLASS_NONE: Class none.
+ * @QMI_WMS_MESSAGE_CLASS_CDMA: Class CDMA.
+ *
+ * Message class.
+ */
+typedef enum {
+ QMI_WMS_MESSAGE_CLASS_0 = 0x00,
+ QMI_WMS_MESSAGE_CLASS_1 = 0x01,
+ QMI_WMS_MESSAGE_CLASS_2 = 0x02,
+ QMI_WMS_MESSAGE_CLASS_3 = 0x03,
+ QMI_WMS_MESSAGE_CLASS_NONE = 0x04,
+ QMI_WMS_MESSAGE_CLASS_CDMA = 0x05
+} QmiWmsMessageClass;
+
+/**
+ * QmiWmsReceiptAction:
+ * @QMI_WMS_RECEIPT_ACTION_DISCARD: Discard message.
+ * @QMI_WMS_RECEIPT_ACTION_STORE_AND_NOTIFY: Store and notify to client.
+ * @QMI_WMS_RECEIPT_ACTION_TRANSFER_ONLY: Notify to client, which should send back ACK.
+ * @QMI_WMS_RECEIPT_ACTION_TRANSFER_AND_ACK: Notify to client and send back ACK.
+ * @QMI_WMS_RECEIPT_ACTION_UNKNOWN: Unknown action.
+ *
+ * Action to perform when a message is received.
+ */
+typedef enum {
+ QMI_WMS_RECEIPT_ACTION_DISCARD = 0x00,
+ QMI_WMS_RECEIPT_ACTION_STORE_AND_NOTIFY = 0x01,
+ QMI_WMS_RECEIPT_ACTION_TRANSFER_ONLY = 0x02,
+ QMI_WMS_RECEIPT_ACTION_TRANSFER_AND_ACK = 0x03,
+ QMI_WMS_RECEIPT_ACTION_UNKNOWN = 0xFF
+} QmiWmsReceiptAction;
+
+/**
+ * QmiWmsTransferIndication:
+ * @QMI_WMS_TRANSFER_INDICATION_CLIENT: Status reports transferred to the client.
+ *
+ * Transfer indication actions.
+ */
+typedef enum {
+ QMI_WMS_TRANSFER_INDICATION_CLIENT = 0x01
+} QmiWmsTransferIndication;
+
+#endif /* _LIBQMI_GLIB_QMI_ENUMS_WMS_H_ */
diff --git a/qmi-enums.h b/qmi-enums.h
new file mode 100644
index 0000000..565c8db
--- /dev/null
+++ b/qmi-enums.h
@@ -0,0 +1,101 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Google, Inc.
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_ENUMS_H_
+#define _LIBQMI_GLIB_QMI_ENUMS_H_
+
+/**
+ * SECTION: qmi-enums
+ * @title: Common enumerations and flags
+ *
+ * This section defines common enumerations and flags used in the interface.
+ */
+
+/**
+ * QmiService:
+ * @QMI_SERVICE_UNKNOWN: Unknown service.
+ * @QMI_SERVICE_CTL: Control service.
+ * @QMI_SERVICE_WDS: Wireless Data Service.
+ * @QMI_SERVICE_DMS: Device Management Service.
+ * @QMI_SERVICE_NAS: Network Access Service.
+ * @QMI_SERVICE_QOS: Quality Of Service service.
+ * @QMI_SERVICE_WMS: Wireless Messaging Service.
+ * @QMI_SERVICE_PDS: Position Determination Service.
+ * @QMI_SERVICE_AUTH: Authentication service.
+ * @QMI_SERVICE_AT: AT service.
+ * @QMI_SERVICE_VOICE: Voice service.
+ * @QMI_SERVICE_CAT2: Card Application Toolkit service (v2).
+ * @QMI_SERVICE_UIM: User Identity Module service.
+ * @QMI_SERVICE_PBM: Phonebook Management service.
+ * @QMI_SERVICE_LOC: Location service (~ PDS v2).
+ * @QMI_SERVICE_SAR: SAR.
+ * @QMI_SERVICE_RMTFS: Remote Filesystem service.
+ * @QMI_SERVICE_CAT: Card Application Toolkit service (v1).
+ * @QMI_SERVICE_RMS: Remote Management Service.
+ * @QMI_SERVICE_OMA: Open Mobile Alliance device management service.
+ *
+ * QMI services.
+ */
+typedef enum {
+ /* Unknown service */
+ QMI_SERVICE_UNKNOWN = -1,
+ /* Control service */
+ QMI_SERVICE_CTL = 0x00,
+ /* Wireless Data Service */
+ QMI_SERVICE_WDS = 0x01,
+ /* Device Management Service */
+ QMI_SERVICE_DMS = 0x02,
+ /* Network Access Service */
+ QMI_SERVICE_NAS = 0x03,
+ /* Quality Of Service service */
+ QMI_SERVICE_QOS = 0x04,
+ /* Wireless Messaging Service */
+ QMI_SERVICE_WMS = 0x05,
+ /* Position Determination Service */
+ QMI_SERVICE_PDS = 0x06,
+ /* Authentication service */
+ QMI_SERVICE_AUTH = 0x07,
+ /* AT service */
+ QMI_SERVICE_AT = 0x08,
+ /* Voice service */
+ QMI_SERVICE_VOICE = 0x09,
+ /* Card Application Toolkit service (major version 2) */
+ QMI_SERVICE_CAT2 = 0x0A,
+ /* User Identity Module service */
+ QMI_SERVICE_UIM = 0x0B,
+ /* Phonebook Management service */
+ QMI_SERVICE_PBM = 0x0C,
+ /* Location service (~ PDS major version 2) */
+ QMI_SERVICE_LOC = 0x10,
+ /* No idea what this one means.. Search And Rescue? */
+ QMI_SERVICE_SAR = 0x11,
+ /* Remote Filesystem service */
+ QMI_SERVICE_RMTFS = 0x14,
+ /* Card Application Toolkit service */
+ QMI_SERVICE_CAT = 0xE0,
+ /* Remote Management Service */
+ QMI_SERVICE_RMS = 0xE1,
+ /* Open Mobile Alliance device management service */
+ QMI_SERVICE_OMA = 0xE2
+} QmiService;
+
+#endif /* _LIBQMI_GLIB_QMI_ENUMS_H_ */
diff --git a/qmi-flags64-dms.h b/qmi-flags64-dms.h
new file mode 100644
index 0000000..b51b5cf
--- /dev/null
+++ b/qmi-flags64-dms.h
@@ -0,0 +1,198 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * libqmi-glib -- GLib/GIO based library to control QMI devices
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Lanedo GmbH <aleksander@lanedo.com>
+ * Copyright (C) 2012 Google, Inc.
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_FLAGS64_DMS_H_
+#define _LIBQMI_GLIB_QMI_FLAGS64_DMS_H_
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI DMS Get Band Capability' message */
+
+/**
+ * QmiDmsBandCapability:
+ * @QMI_DMS_BAND_CAPABILITY_BC_0_A_SYSTEM: Band class 0, A-system.
+ * @QMI_DMS_BAND_CAPABILITY_BC_0_B_SYSTEM: Band class 0, B-system.
+ * @QMI_DMS_BAND_CAPABILITY_BC_1_ALL_BLOCKS: Band class 1, all blocks.
+ * @QMI_DMS_BAND_CAPABILITY_BC_2: Band class 2.
+ * @QMI_DMS_BAND_CAPABILITY_BC_3_A_SYSTEM: Band class 3, A-system.
+ * @QMI_DMS_BAND_CAPABILITY_BC_4_ALL_BLOCKS: Band class 4, all blocks.
+ * @QMI_DMS_BAND_CAPABILITY_BC_5_ALL_BLOCKS: Band class 5, all blocks.
+ * @QMI_DMS_BAND_CAPABILITY_BC_6: Band class 6.
+ * @QMI_DMS_BAND_CAPABILITY_BC_7: Band class 7.
+ * @QMI_DMS_BAND_CAPABILITY_BC_8: Band class 8.
+ * @QMI_DMS_BAND_CAPABILITY_BC_9: Band class 9.
+ * @QMI_DMS_BAND_CAPABILITY_BC_10: Band class 10.
+ * @QMI_DMS_BAND_CAPABILITY_BC_11: Band class 11.
+ * @QMI_DMS_BAND_CAPABILITY_BC_12: Band class 12.
+ * @QMI_DMS_BAND_CAPABILITY_BC_14: Band class 14.
+ * @QMI_DMS_BAND_CAPABILITY_BC_15: Band class 15.
+ * @QMI_DMS_BAND_CAPABILITY_BC_16: Band class 16.
+ * @QMI_DMS_BAND_CAPABILITY_BC_17: Band class 17.
+ * @QMI_DMS_BAND_CAPABILITY_BC_18: Band class 18.
+ * @QMI_DMS_BAND_CAPABILITY_BC_19: Band class 19.
+ * @QMI_DMS_BAND_CAPABILITY_GSM_DCS_1800: GSM DCS band.
+ * @QMI_DMS_BAND_CAPABILITY_GSM_900_EXTENDED: GSM Extended GSM band (900).
+ * @QMI_DMS_BAND_CAPABILITY_GSM_900_PRIMARY: GSM Primary GSM band (900).
+ * @QMI_DMS_BAND_CAPABILITY_GSM_450: GSM 450 band.
+ * @QMI_DMS_BAND_CAPABILITY_GSM_480: GSM 480 band.
+ * @QMI_DMS_BAND_CAPABILITY_GSM_750: GSM 750 band.
+ * @QMI_DMS_BAND_CAPABILITY_GSM_850: GSM 850 band.
+ * @QMI_DMS_BAND_CAPABILITY_GSM_900_RAILWAYS: GSM railways band (900).
+ * @QMI_DMS_BAND_CAPABILITY_GSM_PCS_1900: GSM PCS band (1900).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_2100: WCDMA 2100 band (Europe, Japan, China).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_PCS_1900: WCDMA PCS 1900 band (US).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_DCS_1800: WCDMA DCS 1800 band (Europe, China).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_1700_US: WCDMA 1700 band (US).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_850_US: WCDMA 850 band (US).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_800: QWCDMA 850 band (Japan).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_2600: WCDMA 2600 band (Europe).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_900: WCDMA 900 band (Europe, Japan).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_1700_JAPAN: WCDMA 1700 band (Japan).
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_850_JAPAN: WCDMA 850 band (Japan)
+ * @QMI_DMS_BAND_CAPABILITY_WCDMA_1500: WCDMA 1500 band.
+ *
+ * Frequency band capabilities.
+ */
+typedef enum {
+ QMI_DMS_BAND_CAPABILITY_BC_0_A_SYSTEM = 1 << 0,
+ QMI_DMS_BAND_CAPABILITY_BC_0_B_SYSTEM = 1 << 1,
+ QMI_DMS_BAND_CAPABILITY_BC_1_ALL_BLOCKS = 1 << 2,
+ QMI_DMS_BAND_CAPABILITY_BC_2 = 1 << 3,
+ QMI_DMS_BAND_CAPABILITY_BC_3_A_SYSTEM = 1 << 4,
+ QMI_DMS_BAND_CAPABILITY_BC_4_ALL_BLOCKS = 1 << 5,
+ QMI_DMS_BAND_CAPABILITY_BC_5_ALL_BLOCKS = 1 << 6,
+ QMI_DMS_BAND_CAPABILITY_GSM_DCS_1800 = 1 << 7,
+ QMI_DMS_BAND_CAPABILITY_GSM_900_EXTENDED = 1 << 8,
+ QMI_DMS_BAND_CAPABILITY_GSM_900_PRIMARY = 1 << 9,
+ QMI_DMS_BAND_CAPABILITY_BC_6 = 1 << 10,
+ QMI_DMS_BAND_CAPABILITY_BC_7 = 1 << 11,
+ QMI_DMS_BAND_CAPABILITY_BC_8 = 1 << 12,
+ QMI_DMS_BAND_CAPABILITY_BC_9 = 1 << 13,
+ QMI_DMS_BAND_CAPABILITY_BC_10 = 1 << 14,
+ QMI_DMS_BAND_CAPABILITY_BC_11 = 1 << 15,
+ QMI_DMS_BAND_CAPABILITY_GSM_450 = 1 << 16,
+ QMI_DMS_BAND_CAPABILITY_GSM_480 = 1 << 17,
+ QMI_DMS_BAND_CAPABILITY_GSM_750 = 1 << 18,
+ QMI_DMS_BAND_CAPABILITY_GSM_850 = 1 << 19,
+ QMI_DMS_BAND_CAPABILITY_GSM_900_RAILWAYS = 1 << 20,
+ QMI_DMS_BAND_CAPABILITY_GSM_PCS_1900 = 1 << 21,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_2100 = 1 << 22,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_PCS_1900 = 1 << 23,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_DCS_1800 = 1 << 24,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_1700_US = 1 << 25,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_850_US = 1 << 26,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_800 = 1 << 27,
+ QMI_DMS_BAND_CAPABILITY_BC_12 = 1 << 28,
+ QMI_DMS_BAND_CAPABILITY_BC_14 = 1 << 29,
+ /* Bit 30 reserved */
+ QMI_DMS_BAND_CAPABILITY_BC_15 = 1 << 31,
+ /* Bits 32-47 reserved */
+ QMI_DMS_BAND_CAPABILITY_WCDMA_2600 = ((uint64_t) 1) << 48,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_900 = ((uint64_t) 1) << 49,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_1700_JAPAN = ((uint64_t) 1) << 50,
+ /* Bits 51-55 reserved */
+ QMI_DMS_BAND_CAPABILITY_BC_16 = ((uint64_t) 1) << 56,
+ QMI_DMS_BAND_CAPABILITY_BC_17 = ((uint64_t) 1) << 57,
+ QMI_DMS_BAND_CAPABILITY_BC_18 = ((uint64_t) 1) << 58,
+ QMI_DMS_BAND_CAPABILITY_BC_19 = ((uint64_t) 1) << 59,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_850_JAPAN = ((uint64_t) 1) << 60,
+ QMI_DMS_BAND_CAPABILITY_WCDMA_1500 = ((uint64_t) 1) << 61
+ /* Bits 62-63 reserved */
+} QmiDmsBandCapability;
+
+/**
+ * QmiDmsLteBandCapability:
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_1: LTE EUTRAN Band 1
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_2: LTE EUTRAN Band 2.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_3: LTE EUTRAN Band 3.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_4: LTE EUTRAN Band 4.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_5: LTE EUTRAN Band 5.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_6: LTE EUTRAN Band 6.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_7: LTE EUTRAN Band 7.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_8: LTE EUTRAN Band 8.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_9: LTE EUTRAN Band 9.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_10: LTE EUTRAN Band 10.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_11: LTE EUTRAN Band 11.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_12: LTE EUTRAN Band 12.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_13: LTE EUTRAN Band 13.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_14: LTE EUTRAN Band 14.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_17: LTE EUTRAN Band 17.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_18: LTE EUTRAN Band 18.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_19: LTE EUTRAN Band 19.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_20: LTE EUTRAN Band 20.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_21: LTE EUTRAN Band 21.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_24: LTE EUTRAN Band 24.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_25: LTE EUTRAN Band 25.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_33: LTE EUTRAN Band 33.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_34: LTE EUTRAN Band 34.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_35: LTE EUTRAN Band 35.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_36: LTE EUTRAN Band 36.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_37: LTE EUTRAN Band 37.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_38: LTE EUTRAN Band 38.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_39: LTE EUTRAN Band 39.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_40: LTE EUTRAN Band 40.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_41: LTE EUTRAN Band 41.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_42: LTE EUTRAN Band 42.
+ * @QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_43: LTE EUTRAN Band 43.
+ *
+ * LTE-specific Frequency bands.
+ */
+typedef enum {
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_1 = 1 << 0,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_2 = 1 << 1,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_3 = 1 << 2,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_4 = 1 << 3,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_5 = 1 << 4,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_6 = 1 << 5,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_7 = 1 << 6,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_8 = 1 << 7,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_9 = 1 << 8,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_10 = 1 << 9,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_11 = 1 << 10,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_12 = 1 << 11,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_13 = 1 << 12,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_14 = 1 << 13,
+ /* Bit 14-15 reserved */
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_17 = 1 << 16,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_18 = 1 << 17,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_19 = 1 << 18,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_20 = 1 << 19,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_21 = 1 << 20,
+ /* Bit 21-22 reserved */
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_24 = 1 << 23,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_25 = 1 << 24,
+ /* Bit 25-31 reserved */
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_33 = ((uint64_t) 1) << 32,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_34 = ((uint64_t) 1) << 33,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_35 = ((uint64_t) 1) << 34,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_36 = ((uint64_t) 1) << 35,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_37 = ((uint64_t) 1) << 36,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_38 = ((uint64_t) 1) << 37,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_39 = ((uint64_t) 1) << 38,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_40 = ((uint64_t) 1) << 39,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_41 = ((uint64_t) 1) << 40,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_42 = ((uint64_t) 1) << 41,
+ QMI_DMS_LTE_BAND_CAPABILITY_EUTRAN_43 = ((uint64_t) 1) << 42
+ /* Bit 43-64 reserved */
+} QmiDmsLteBandCapability;
+
+#endif /* _LIBQMI_GLIB_QMI_FLAGS64_DMS_H_ */
diff --git a/qmi-flags64-nas.h b/qmi-flags64-nas.h
new file mode 100644
index 0000000..1820adb
--- /dev/null
+++ b/qmi-flags64-nas.h
@@ -0,0 +1,194 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * libqmi-glib -- GLib/GIO based library to control QMI devices
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Google Inc.
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_FLAGS64_NAS_H_
+#define _LIBQMI_GLIB_QMI_FLAGS64_NAS_H_
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI NAS Get System Selection Preference'
+ * request/response */
+
+/**
+ * QmiNasBandPreference:
+ * @QMI_NAS_BAND_PREFERENCE_BC_0_A_SYSTEM: Band class 0, A system.
+ * @QMI_NAS_BAND_PREFERENCE_BC_0_B_SYSTEM: Band class 0, B system.
+ * @QMI_NAS_BAND_PREFERENCE_BC_1_ALL_BLOCKS: Band class 1.
+ * @QMI_NAS_BAND_PREFERENCE_BC_2: Band class 2.
+ * @QMI_NAS_BAND_PREFERENCE_BC_3_A_SYSTEM: Band class 3, A system.
+ * @QMI_NAS_BAND_PREFERENCE_BC_4_ALL_BLOCKS: Band class 4, all blocks.
+ * @QMI_NAS_BAND_PREFERENCE_BC_5_ALL_BLOCKS: Band class 5, all blocks.
+ * @QMI_NAS_BAND_PREFERENCE_BC_6: Band class 6.
+ * @QMI_NAS_BAND_PREFERENCE_BC_7: Band class 7.
+ * @QMI_NAS_BAND_PREFERENCE_BC_8: Band class 8.
+ * @QMI_NAS_BAND_PREFERENCE_BC_9: Band class 9.
+ * @QMI_NAS_BAND_PREFERENCE_BC_10: Band class 10.
+ * @QMI_NAS_BAND_PREFERENCE_BC_11: Band class 11.
+ * @QMI_NAS_BAND_PREFERENCE_BC_12: Band class 12.
+ * @QMI_NAS_BAND_PREFERENCE_BC_14: Band class 14.
+ * @QMI_NAS_BAND_PREFERENCE_BC_15: Band class 15.
+ * @QMI_NAS_BAND_PREFERENCE_BC_16: Band class 16.
+ * @QMI_NAS_BAND_PREFERENCE_BC_17: Band class 17.
+ * @QMI_NAS_BAND_PREFERENCE_BC_18: Band class 18.
+ * @QMI_NAS_BAND_PREFERENCE_BC_19: Band class 19.
+ * @QMI_NAS_BAND_PREFERENCE_GSM_DCS_1800: GSM DCS 1800 band.
+ * @QMI_NAS_BAND_PREFERENCE_GSM_900_EXTENDED: Extended GSM 900 band.
+ * @QMI_NAS_BAND_PREFERENCE_GSM_900_PRIMARY: Primary GSM 900 band.
+ * @QMI_NAS_BAND_PREFERENCE_GSM_450: GSM 450.
+ * @QMI_NAS_BAND_PREFERENCE_GSM_480: GSM 480.
+ * @QMI_NAS_BAND_PREFERENCE_GSM_750: GSM 750.
+ * @QMI_NAS_BAND_PREFERENCE_GSM_850: GSM 850.
+ * @QMI_NAS_BAND_PREFERENCE_GSM_900_RAILWAYS: GSM 900 (Railways).
+ * @QMI_NAS_BAND_PREFERENCE_GSM_PCS_1900: GSM 1900.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_2100: WCDMA 2100.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_PCS_1900: WCDMA PCS 1900.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_DCS_1800: WCDMA DCS 1800.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_1700_US: WCDMA 1700 (U.S.).
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_850_US: WCDMA 850.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_800: WCDMA 800.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_2600: WCDMA 2600.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_900: WCDMA 900.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_1700_JAPAN: WCDMA 1700 (Japan).
+ *
+ * Flags to specify frequency band preferences.
+ */
+typedef enum {
+ QMI_NAS_BAND_PREFERENCE_BC_0_A_SYSTEM = 1 << 0,
+ QMI_NAS_BAND_PREFERENCE_BC_0_B_SYSTEM = 1 << 1,
+ QMI_NAS_BAND_PREFERENCE_BC_1_ALL_BLOCKS = 1 << 2,
+ QMI_NAS_BAND_PREFERENCE_BC_2 = 1 << 3,
+ QMI_NAS_BAND_PREFERENCE_BC_3_A_SYSTEM = 1 << 4,
+ QMI_NAS_BAND_PREFERENCE_BC_4_ALL_BLOCKS = 1 << 5,
+ QMI_NAS_BAND_PREFERENCE_BC_5_ALL_BLOCKS = 1 << 6,
+ QMI_NAS_BAND_PREFERENCE_GSM_DCS_1800 = 1 << 7,
+ QMI_NAS_BAND_PREFERENCE_GSM_900_EXTENDED = 1 << 8,
+ QMI_NAS_BAND_PREFERENCE_GSM_900_PRIMARY = 1 << 9,
+ QMI_NAS_BAND_PREFERENCE_BC_6 = 1 << 10,
+ QMI_NAS_BAND_PREFERENCE_BC_7 = 1 << 11,
+ QMI_NAS_BAND_PREFERENCE_BC_8 = 1 << 12,
+ QMI_NAS_BAND_PREFERENCE_BC_9 = 1 << 13,
+ QMI_NAS_BAND_PREFERENCE_BC_10 = 1 << 14,
+ QMI_NAS_BAND_PREFERENCE_BC_11 = 1 << 15,
+ QMI_NAS_BAND_PREFERENCE_GSM_450 = 1 << 16,
+ QMI_NAS_BAND_PREFERENCE_GSM_480 = 1 << 17,
+ QMI_NAS_BAND_PREFERENCE_GSM_750 = 1 << 18,
+ QMI_NAS_BAND_PREFERENCE_GSM_850 = 1 << 19,
+ QMI_NAS_BAND_PREFERENCE_GSM_900_RAILWAYS = 1 << 20,
+ QMI_NAS_BAND_PREFERENCE_GSM_PCS_1900 = 1 << 21,
+ QMI_NAS_BAND_PREFERENCE_WCDMA_2100 = 1 << 22,
+ QMI_NAS_BAND_PREFERENCE_WCDMA_PCS_1900 = 1 << 23,
+ QMI_NAS_BAND_PREFERENCE_WCDMA_DCS_1800 = 1 << 24,
+ QMI_NAS_BAND_PREFERENCE_WCDMA_1700_US = 1 << 25,
+ QMI_NAS_BAND_PREFERENCE_WCDMA_850_US = 1 << 26,
+ QMI_NAS_BAND_PREFERENCE_WCDMA_800 = 1 << 27,
+ QMI_NAS_BAND_PREFERENCE_BC_12 = 1 << 28,
+ QMI_NAS_BAND_PREFERENCE_BC_14 = 1 << 29,
+ /* Bit 30 reserved */
+ QMI_NAS_BAND_PREFERENCE_BC_15 = 1 << 31,
+ /* Bits 32-47 reserved */
+ QMI_NAS_BAND_PREFERENCE_WCDMA_2600 = ((uint64_t) 1) << 48,
+ QMI_NAS_BAND_PREFERENCE_WCDMA_900 = ((uint64_t) 1) << 49,
+ QMI_NAS_BAND_PREFERENCE_WCDMA_1700_JAPAN = ((uint64_t) 1) << 50,
+ /* Bits 51-55 reserved */
+ QMI_NAS_BAND_PREFERENCE_BC_16 = ((uint64_t) 1) << 56,
+ QMI_NAS_BAND_PREFERENCE_BC_17 = ((uint64_t) 1) << 57,
+ QMI_NAS_BAND_PREFERENCE_BC_18 = ((uint64_t) 1) << 58,
+ QMI_NAS_BAND_PREFERENCE_BC_19 = ((uint64_t) 1) << 59
+ /* Bits 60-63 reserved */
+} QmiNasBandPreference;
+
+/**
+ * QmiNasLteBandPreference:
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_1: LTE EUTRAN Band 1
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_2: LTE EUTRAN Band 2.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_3: LTE EUTRAN Band 3.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_4: LTE EUTRAN Band 4.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_5: LTE EUTRAN Band 5.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_6: LTE EUTRAN Band 6.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_7: LTE EUTRAN Band 7.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_8: LTE EUTRAN Band 8.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_9: LTE EUTRAN Band 9.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_10: LTE EUTRAN Band 10.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_11: LTE EUTRAN Band 11.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_12: LTE EUTRAN Band 12.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_13: LTE EUTRAN Band 13.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_14: LTE EUTRAN Band 14.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_17: LTE EUTRAN Band 17.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_18: LTE EUTRAN Band 18.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_19: LTE EUTRAN Band 19.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_20: LTE EUTRAN Band 20.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_21: LTE EUTRAN Band 21.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_24: LTE EUTRAN Band 24.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_25: LTE EUTRAN Band 25.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_33: LTE EUTRAN Band 33.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_34: LTE EUTRAN Band 34.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_35: LTE EUTRAN Band 35.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_36: LTE EUTRAN Band 36.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_37: LTE EUTRAN Band 37.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_38: LTE EUTRAN Band 38.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_39: LTE EUTRAN Band 39.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_40: LTE EUTRAN Band 40.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_41: LTE EUTRAN Band 41.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_42: LTE EUTRAN Band 42.
+ * @QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_43: LTE EUTRAN Band 43.
+ *
+ * Flags to specify LTE-specific frequency band preferences.
+ */
+typedef enum {
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_1 = 1 << 0,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_2 = 1 << 1,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_3 = 1 << 2,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_4 = 1 << 3,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_5 = 1 << 4,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_6 = 1 << 5,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_7 = 1 << 6,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_8 = 1 << 7,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_9 = 1 << 8,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_10 = 1 << 9,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_11 = 1 << 10,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_12 = 1 << 11,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_13 = 1 << 12,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_14 = 1 << 13,
+ /* Bit 14-15 reserved */
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_17 = 1 << 16,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_18 = 1 << 17,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_19 = 1 << 18,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_20 = 1 << 19,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_21 = 1 << 20,
+ /* Bit 21-22 reserved */
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_24 = 1 << 23,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_25 = 1 << 24,
+ /* Bit 25-31 reserved */
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_33 = ((uint64_t) 1) << 32,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_34 = ((uint64_t) 1) << 33,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_35 = ((uint64_t) 1) << 34,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_36 = ((uint64_t) 1) << 35,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_37 = ((uint64_t) 1) << 36,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_38 = ((uint64_t) 1) << 37,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_39 = ((uint64_t) 1) << 38,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_40 = ((uint64_t) 1) << 39,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_41 = ((uint64_t) 1) << 40,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_42 = ((uint64_t) 1) << 41,
+ QMI_NAS_LTE_BAND_PREFERENCE_EUTRAN_43 = ((uint64_t) 1) << 42
+ /* Bit 43-64 reserved */
+} QmiNasLteBandPreference;
+
+#endif /* _LIBQMI_GLIB_QMI_FLAGS64_NAS_H_ */
diff --git a/qmi-message.c b/qmi-message.c
new file mode 100644
index 0000000..450f39c
--- /dev/null
+++ b/qmi-message.c
@@ -0,0 +1,155 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "qmi-message.h"
+
+static uint8_t buf[QMI_BUFFER_LEN];
+static int buf_ofs;
+
+uint8_t *__qmi_get_buf(int *ofs)
+{
+ *ofs = buf_ofs;
+ return buf;
+}
+
+void __qmi_alloc_reset(void)
+{
+ buf_ofs = 0;
+}
+
+void *__qmi_alloc_static(int len)
+{
+ void *ret;
+
+ if (buf_ofs + len > sizeof(buf)) {
+ fprintf(stderr, "ERROR: static buffer for message data too small\n");
+ abort();
+ }
+
+ ret = &buf[buf_ofs];
+ buf_ofs += len;
+ memset(ret, 0, len);
+ return ret;
+}
+
+char *__qmi_copy_string(void *data, int len)
+{
+ char *res;
+
+ res = (char *) &buf[buf_ofs];
+ buf_ofs += len + 1;
+ memcpy(res, data, len);
+ res[len] = 0;
+ return res;
+}
+
+struct tlv *tlv_get_next(void **buf, int *buflen)
+{
+ struct tlv *tlv = NULL;
+ unsigned int tlv_len;
+
+ if (*buflen < sizeof(*tlv))
+ return NULL;
+
+ tlv = *buf;
+ tlv_len = le16_to_cpu(tlv->len) + sizeof(*tlv);
+ if (tlv_len > *buflen)
+ return NULL;
+
+ *buflen -= tlv_len;
+ *buf += tlv_len;
+ return tlv;
+}
+
+static struct tlv *qmi_msg_next_tlv(struct qmi_msg *qm, int add)
+{
+ int tlv_len;
+ void *tlv;
+
+ if (qm->qmux.service == QMI_SERVICE_CTL) {
+ tlv = qm->ctl.tlv;
+ tlv_len = le16_to_cpu(qm->ctl.tlv_len);
+ qm->ctl.tlv_len = cpu_to_le16(tlv_len + add);
+ } else {
+ tlv = qm->svc.tlv;
+ tlv_len = le16_to_cpu(qm->svc.tlv_len);
+ qm->svc.tlv_len = cpu_to_le16(tlv_len + add);
+ }
+
+ tlv += tlv_len;
+
+ return tlv;
+}
+
+void tlv_new(struct qmi_msg *qm, uint8_t type, uint16_t len, void *data)
+{
+ struct tlv *tlv;
+
+ tlv = qmi_msg_next_tlv(qm, sizeof(*tlv) + len);
+ tlv->type = type;
+ tlv->len = cpu_to_le16(len);
+ memcpy(tlv->data, data, len);
+}
+
+void qmi_init_request_message(struct qmi_msg *qm, QmiService service)
+{
+ memset(qm, 0, sizeof(*qm));
+ qm->marker = 1;
+ qm->qmux.service = service;
+}
+
+int qmi_complete_request_message(struct qmi_msg *qm)
+{
+ void *tlv_end = qmi_msg_next_tlv(qm, 0);
+ void *msg_start = &qm->qmux;
+
+ qm->qmux.len = cpu_to_le16(tlv_end - msg_start);
+ return tlv_end - msg_start + 1;
+}
+
+int qmi_check_message_status(void *tlv_buf, int len)
+{
+ struct tlv *tlv;
+ struct {
+ uint16_t status;
+ uint16_t code;
+ } __packed *status;
+
+ while ((tlv = tlv_get_next(&tlv_buf, &len)) != NULL) {
+ if (tlv->type != 2)
+ continue;
+
+ if (tlv_data_len(tlv) != sizeof(*status))
+ return QMI_ERROR_INVALID_DATA;
+
+ status = (void *) tlv->data;
+ if (!status->status)
+ return 0;
+
+ return le16_to_cpu(status->code);
+ }
+
+ return QMI_ERROR_NO_DATA;
+}
+
+void *qmi_msg_get_tlv_buf(struct qmi_msg *qm, int *tlv_len)
+{
+ void *ptr;
+ int len;
+
+ if (qm->qmux.service == QMI_SERVICE_CTL) {
+ ptr = qm->ctl.tlv;
+ len = qm->ctl.tlv_len;
+ } else {
+ ptr = qm->svc.tlv;
+ len = qm->svc.tlv_len;
+ }
+
+ if (tlv_len)
+ *tlv_len = len;
+
+ return ptr;
+}
+
+
diff --git a/qmi-message.h b/qmi-message.h
new file mode 100644
index 0000000..35838b3
--- /dev/null
+++ b/qmi-message.h
@@ -0,0 +1,98 @@
+#ifndef __UQMI_MESSAGE_H
+#define __UQMI_MESSAGE_H
+
+#include <libubox/utils.h>
+#include <stdbool.h>
+
+#include "qmi-struct.h"
+#include "qmi-enums.h"
+
+#include "qmi-enums-private.h"
+#include "qmi-message-ctl.h"
+
+#include "qmi-enums-dms.h"
+#include "qmi-flags64-dms.h"
+#include "qmi-message-dms.h"
+
+#include "qmi-enums-nas.h"
+#include "qmi-flags64-nas.h"
+#include "qmi-message-nas.h"
+
+#include "qmi-enums-pds.h"
+#include "qmi-message-pds.h"
+
+#include "qmi-enums-wds.h"
+#include "qmi-message-wds.h"
+
+#include "qmi-enums-wms.h"
+#include "qmi-message-wms.h"
+
+#define qmi_set(_data, _field, _val) \
+ do { \
+ (_data)->set._field = 1; \
+ (_data)->data._field = _val; \
+ } while (0)
+
+#define qmi_set_ptr(_data, _field, _val) \
+ do { \
+ (_data)->data._field = _val; \
+ } while (0)
+
+#define qmi_set_static_array(_data, _field, _val) \
+ do { \
+ (_data)->data._field##_n = ARRAY_SIZE(_val); \
+ (_data)->data._field = _val; \
+ } while (0);
+
+#define qmi_set_array(_data, _field, _val, _n) \
+ do { \
+ (_data)->data.n_##_field = _n; \
+ (_data)->data._field = _val; \
+ } while (0);
+
+#define QMI_INIT(_field, _val) \
+ .set._field = 1, \
+ .data._field = (_val)
+
+#define QMI_INIT_SEQUENCE(_field, ...) \
+ .set._field = 1, \
+ .data._field = { __VA_ARGS__ }
+
+#define QMI_INIT_PTR(_field, _val) \
+ .data._field = (_val)
+
+#define QMI_INIT_STATIC_ARRAY(_field, _val) \
+ .data._field##_n = ARRAY_SIZE(_val), \
+ .data._field = (_val)
+
+#define QMI_INIT_ARRAY(_field, _val, _n) \
+ .data._field##_n = (_n), \
+ .data._field = (_val)
+
+
+enum {
+ QMI_ERROR_NO_DATA = -1,
+ QMI_ERROR_INVALID_DATA = -2,
+};
+
+#define QMI_BUFFER_LEN 2048
+
+void __qmi_alloc_reset(void);
+void *__qmi_alloc_static(int len);
+char *__qmi_copy_string(void *data, int len);
+uint8_t *__qmi_get_buf(int *ofs);
+
+static inline int tlv_data_len(struct tlv *tlv)
+{
+ return le16_to_cpu(tlv->len);
+}
+
+struct tlv *tlv_get_next(void **buf, int *buflen);
+void tlv_new(struct qmi_msg *qm, uint8_t type, uint16_t len, void *data);
+
+void qmi_init_request_message(struct qmi_msg *qm, QmiService service);
+int qmi_complete_request_message(struct qmi_msg *qm);
+int qmi_check_message_status(void *buf, int len);
+void *qmi_msg_get_tlv_buf(struct qmi_msg *qm, int *len);
+
+#endif
diff --git a/qmi-struct.h b/qmi-struct.h
new file mode 100644
index 0000000..1deef7e
--- /dev/null
+++ b/qmi-struct.h
@@ -0,0 +1,41 @@
+#ifndef __QMI_STRUCT_H
+#define __QMI_STRUCT_H
+
+struct qmux {
+ uint16_t len;
+ uint8_t flags;
+ uint8_t service;
+ uint8_t client;
+} __packed;
+
+struct tlv {
+ uint8_t type;
+ uint16_t len;
+ uint8_t data[];
+} __packed;
+
+struct qmi_ctl {
+ uint8_t transaction;
+ uint16_t message;
+ uint16_t tlv_len;
+ struct tlv tlv[];
+} __packed;
+
+struct qmi_svc {
+ uint16_t transaction;
+ uint16_t message;
+ uint16_t tlv_len;
+ struct tlv tlv[];
+} __packed;
+
+struct qmi_msg {
+ uint8_t marker;
+ struct qmux qmux;
+ uint8_t flags;
+ union {
+ struct qmi_ctl ctl;
+ struct qmi_svc svc;
+ };
+} __packed;
+
+#endif
diff --git a/uqmi.h b/uqmi.h
new file mode 100644
index 0000000..a404da5
--- /dev/null
+++ b/uqmi.h
@@ -0,0 +1,94 @@
+#ifndef __UQMI_H
+#define __UQMI_H
+
+#include <libubox/uloop.h>
+#include <libubox/ustream.h>
+#include "qmi-message.h"
+
+#ifdef DEBUG_PACKET
+void dump_packet(const char *prefix, void *ptr, int len);
+#else
+static inline void dump_packet(const char *prefix, void *ptr, int len)
+{
+}
+#endif
+
+#define __qmi_services \
+ __qmi_service(QMI_SERVICE_WDS), \
+ __qmi_service(QMI_SERVICE_DMS), \
+ __qmi_service(QMI_SERVICE_NAS), \
+ __qmi_service(QMI_SERVICE_QOS), \
+ __qmi_service(QMI_SERVICE_WMS), \
+ __qmi_service(QMI_SERVICE_PDS), \
+ __qmi_service(QMI_SERVICE_AUTH), \
+ __qmi_service(QMI_SERVICE_AT), \
+ __qmi_service(QMI_SERVICE_VOICE), \
+ __qmi_service(QMI_SERVICE_CAT2), \
+ __qmi_service(QMI_SERVICE_UIM), \
+ __qmi_service(QMI_SERVICE_PBM), \
+ __qmi_service(QMI_SERVICE_LOC), \
+ __qmi_service(QMI_SERVICE_SAR), \
+ __qmi_service(QMI_SERVICE_RMTFS), \
+ __qmi_service(QMI_SERVICE_CAT), \
+ __qmi_service(QMI_SERVICE_RMS), \
+ __qmi_service(QMI_SERVICE_OMA)
+
+#define __qmi_service(_n) __##_n
+enum {
+ __qmi_services,
+ __QMI_SERVICE_LAST
+};
+#undef __qmi_service
+
+struct qmi_dev;
+struct qmi_request;
+struct qmi_msg;
+
+typedef void (*request_cb)(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg);
+
+struct qmi_dev {
+ struct ustream_fd sf;
+
+ struct list_head req;
+
+ struct {
+ bool connected;
+ uint8_t client_id;
+ uint16_t tid;
+ } service_data[__QMI_SERVICE_LAST];
+
+ uint32_t service_connected;
+ uint32_t service_keep_cid;
+
+ uint8_t ctl_tid;
+};
+
+struct qmi_request {
+ struct list_head list;
+
+ request_cb cb;
+
+ bool *complete;
+ bool pending;
+ uint8_t service;
+ uint16_t tid;
+ int ret;
+};
+
+int qmi_device_open(struct qmi_dev *qmi, const char *path);
+void qmi_device_close(struct qmi_dev *qmi);
+
+int qmi_request_start(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, request_cb cb);
+void qmi_request_cancel(struct qmi_dev *qmi, struct qmi_request *req);
+int qmi_request_wait(struct qmi_dev *qmi, struct qmi_request *req);
+
+static inline bool qmi_request_pending(struct qmi_request *req)
+{
+ return req->pending;
+}
+
+int qmi_service_connect(struct qmi_dev *qmi, QmiService svc, int client_id);
+int qmi_service_get_client_id(struct qmi_dev *qmi, QmiService svc);
+QmiService qmi_service_get_by_name(const char *str);
+
+#endif