app_tethering is for communicating with App on target.
This module is a client side to connect App that creates sensor or touch point data
and it deliveries received data to each device.
ecs_tethering is for communicating with ECP. This module handles messages from ECP.
The messages consist of connect, disconnect, connection status and etc..
Change-Id: I2c31f785fe824fd578fafb08e9f9efe423f26ea6
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
# ECS
include $(SRC_PATH)/tizen/src/ecs/Makefile.tizen
+# tethering
+include $(SRC_PATH)/tizen/src/tethering/Makefile.tizen
+
# maru hardware
include $(SRC_PATH)/tizen/src/Makefile.tizen.$(TARGET_BASE_ARCH)
obj-y += ecs.pb-c.o ecs_ids.pb-c.o protobuf-c.o
obj-y += ecs_msg.o ecs.o ecs_sensor.o
obj-y += ecs_mon.o ecs-json-streamer.o
-
+obj-y += ecs_tethering.o
goto fail;
msgproc_keepalive_ans(cli, msg);
}
+ else if (master->type == ECS__MASTER__TYPE__TETHERING_REQ)
+ {
+ ECS__TetheringReq* msg = master->tethering_req;
+ if (!msg)
+ goto fail;
+ msgproc_tethering_req(cli, msg);
+ }
ecs__master__free_unpacked(master, NULL);
return true;
ecs__master__free_unpacked(master, NULL);
return false;
}
-
#define COMMAND_TYPE_MONITOR "monitor"
#define COMMAND_TYPE_DEVICE "device"
+//
+#define COMMAND_TYPE_TETHERING "tethering"
+
#define ECS_MSG_STARTINFO_REQ "startinfo_req"
#define ECS_MSG_STARTINFO_ANS "startinfo_ans"
bool msgproc_nfc_req(ECS_Client* ccli, ECS__NfcReq* msg);
void msgproc_checkversion_req(ECS_Client* ccli, ECS__CheckVersionReq* msg);
void msgproc_keepalive_ans(ECS_Client* ccli, ECS__KeepAliveAns* msg);
+bool msgproc_tethering_req(ECS_Client* ccli, ECS__TetheringReq* msg);
/* version check */
//void send_ecs_version_check(ECS_Client* ccli);
#endif
#include "qemu-common.h"
-//#include "qemu_socket.h"
#include "sdb.h"
#include "ecs-json-streamer.h"
#include "qmp-commands.h"
if (!strncmp(cmd, MSG_TYPE_SENSOR, 6)) {
if (group == MSG_GROUP_STATUS) {
- if (action ==MSG_ACTION_ACCEL) {
+ if (action == MSG_ACTION_ACCEL) {
get_sensor_accel();
} else if (action == MSG_ACTION_GYRO) {
get_sensor_gyro();
return true;
}
+
--- /dev/null
+/*
+ * Emulator Control Server - Device Tethering Handler
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ * KiTae Kim <kt920.kim@samsung.com>
+ * JiHey Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "qemu-common.h"
+#include "qemu/sockets.h"
+
+#include "ecs.h"
+#include "ecs_tethering.h"
+#include "../tethering/app_tethering.h"
+
+#include "../debug_ch.h"
+
+MULTI_DEBUG_CHANNEL(tizen, ecs_tethering);
+
+#define MSG_BUF_SIZE 255
+#define MSG_LEN_SIZE 4
+
+// ecs <-> ecp messages
+#define ECS_TETHERING_MSG_CATEGORY "tethering"
+
+#define ECS_TETHERING_MSG_GROUP_ECP 1
+// #define TETHERING_MSG_GROUP_USB
+// #define TETHERING_MSG_GROUP_WIFI
+
+#define ECS_TETHERING_MSG_ACTION_CONNECT 1
+#define ECS_TETHERING_MSG_ACTION_DISCONNECT 2
+#define ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS 3
+#define ECS_TETHERING_MSG_ACTION_SENSOR_STATUS 4
+#define ECS_TETHERING_MSG_ACTION_TOUCH_STATUS 5
+
+// ecs <-> ecp
+static bool send_tethering_ntf(const char *data, const int len);
+static void send_tethering_status_ntf(type_group group, type_action action);
+
+void send_tethering_sensor_status_ecp(void)
+{
+ LOG(">> send tethering_event_status to ecp");
+ send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP,
+ ECS_TETHERING_MSG_ACTION_SENSOR_STATUS);
+}
+
+void send_tethering_multitouch_status_ecp(void)
+{
+ send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP,
+ ECS_TETHERING_MSG_ACTION_TOUCH_STATUS);
+}
+
+void send_tethering_connection_status_ecp(void)
+{
+ LOG(">> send tethering_connection_status to ecp");
+ send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP,
+ ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS);
+}
+
+static void send_tethering_status_ntf(type_group group, type_action action)
+{
+ type_length length = 1;
+ int status = 0;
+ uint8_t *msg = NULL;
+ gchar data[2];
+
+ switch (action) {
+ case ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS:
+ status = get_tethering_connection_status();
+ break;
+ case ECS_TETHERING_MSG_ACTION_SENSOR_STATUS:
+ status = get_tethering_sensor_status();
+ break;
+ case ECS_TETHERING_MSG_ACTION_TOUCH_STATUS:
+ status = get_tethering_multitouch_status();
+ break;
+ default:
+ break;
+ }
+
+ msg = g_malloc(MSG_BUF_SIZE);
+ if (!msg) {
+ return;
+ }
+
+ g_snprintf(data, sizeof(data), "%d", status);
+
+ memcpy(msg, ECS_TETHERING_MSG_CATEGORY, 10);
+ memcpy(msg + 10, &length, sizeof(unsigned short));
+ memcpy(msg + 12, &group, sizeof(unsigned char));
+ memcpy(msg + 13, &action, sizeof(unsigned char));
+ memcpy(msg + 14, data, 1);
+
+ LOG(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s",
+ action, group, data);
+
+ send_tethering_ntf((const char *)msg, MSG_BUF_SIZE);
+
+ if (msg) {
+ g_free(msg);
+ }
+}
+
+static bool send_tethering_ntf(const char *data, const int len)
+{
+ type_length length = 0;
+ type_group group = 0;
+ type_action action = 0;
+
+ const int catsize = 10;
+ char cat[catsize + 1];
+ memset(cat, 0, catsize + 1);
+
+ read_val_str(data, cat, catsize);
+ read_val_short(data + catsize, &length);
+ read_val_char(data + catsize + 2, &group);
+ read_val_char(data + catsize + 2 + 1, &action);
+
+ const char* ijdata = (data + catsize + 2 + 1 + 1);
+
+ LOG("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
+
+ ECS__Master master = ECS__MASTER__INIT;
+ ECS__TetheringNtf ntf = ECS__TETHERING_NTF__INIT;
+
+ ntf.category = (char*) g_malloc(catsize + 1);
+ strncpy(ntf.category, cat, 10);
+
+ ntf.length = length;
+ ntf.group = group;
+ ntf.action = action;
+
+ if (length > 0) {
+ ntf.has_data = 1;
+
+ ntf.data.data = g_malloc(length);
+ ntf.data.len = length;
+ memcpy(ntf.data.data, ijdata, length);
+
+ LOG("data = %s, length = %hu", ijdata, length);
+ }
+
+ master.type = ECS__MASTER__TYPE__TETHERING_NTF;
+ master.tethering_ntf = &ntf;
+
+ send_to_ecp(&master);
+
+ if (ntf.data.data && ntf.data.len > 0) {
+ g_free(ntf.data.data);
+ }
+
+ if (ntf.category) {
+ g_free(ntf.category);
+ }
+
+ return true;
+}
+
+
+// handle tethering_req message
+bool msgproc_tethering_req(ECS_Client* ccli, ECS__TetheringReq* msg)
+{
+ gchar cmd[10] = {0};
+
+ g_strlcpy(cmd, msg->category, sizeof(cmd));
+ type_length length = (type_length) msg->length;
+ type_group group = (type_group) (msg->group & 0xff);
+ type_action action = (type_action) (msg->action & 0xff);
+
+ LOG(">> header = cmd = %s, length = %d, action=%d, group=%d",
+ cmd, length, action, group);
+
+ if (group == ECS_TETHERING_MSG_GROUP_ECP) {
+ switch(action) {
+ case ECS_TETHERING_MSG_ACTION_CONNECT:
+ {
+ if (msg->data.data && msg->data.len > 0) {
+ const gchar *data = (const gchar *)msg->data.data;
+ gint port = 0;
+
+ port = g_ascii_strtoull(data, NULL, 10);
+
+ LOG(">> MSG_ACTION_CONNECT");
+ LOG(">> port_num: %d", port);
+ LOG(">> len = %zd, data\" %s\"", strlen(data), data);
+
+ connect_tethering_app(port);
+ }
+ }
+ break;
+ case ECS_TETHERING_MSG_ACTION_DISCONNECT:
+ LOG(">> MSG_ACTION_DISCONNECT");
+ // end_tethering_socket(tethering_sock);
+ disconnect_tethering_app();
+ break;
+ case ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS:
+ case ECS_TETHERING_MSG_ACTION_SENSOR_STATUS:
+ case ECS_TETHERING_MSG_ACTION_TOUCH_STATUS:
+ LOG(">> get_status_action");
+ send_tethering_status_ntf(group, action);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
--- /dev/null
+/*
+ * Emulator Control Server - Device Tethering Handler
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ * KiTae Kim <kt920.kim@samsung.com>
+ * JiHey Kim <jihye1128.kim@samsung.com>
+ * DaiYoung Kim <daiyoung777.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+void send_tethering_sensor_status_ecp(void);
+void send_tethering_multitouch_status_ecp(void);
+void send_tethering_connection_status_ecp(void);
PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
+void ecs__tethering_req__init
+ (ECS__TetheringReq *message)
+{
+ static ECS__TetheringReq init_value = ECS__TETHERING_REQ__INIT;
+ *message = init_value;
+}
+size_t ecs__tethering_req__get_packed_size
+ (const ECS__TetheringReq *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t ecs__tethering_req__pack
+ (const ECS__TetheringReq *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t ecs__tethering_req__pack_to_buffer
+ (const ECS__TetheringReq *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ECS__TetheringReq *
+ ecs__tethering_req__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ECS__TetheringReq *)
+ protobuf_c_message_unpack (&ecs__tethering_req__descriptor,
+ allocator, len, data);
+}
+void ecs__tethering_req__free_unpacked
+ (ECS__TetheringReq *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void ecs__tethering_ans__init
+ (ECS__TetheringAns *message)
+{
+ static ECS__TetheringAns init_value = ECS__TETHERING_ANS__INIT;
+ *message = init_value;
+}
+size_t ecs__tethering_ans__get_packed_size
+ (const ECS__TetheringAns *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t ecs__tethering_ans__pack
+ (const ECS__TetheringAns *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t ecs__tethering_ans__pack_to_buffer
+ (const ECS__TetheringAns *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ECS__TetheringAns *
+ ecs__tethering_ans__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ECS__TetheringAns *)
+ protobuf_c_message_unpack (&ecs__tethering_ans__descriptor,
+ allocator, len, data);
+}
+void ecs__tethering_ans__free_unpacked
+ (ECS__TetheringAns *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void ecs__tethering_ntf__init
+ (ECS__TetheringNtf *message)
+{
+ static ECS__TetheringNtf init_value = ECS__TETHERING_NTF__INIT;
+ *message = init_value;
+}
+size_t ecs__tethering_ntf__get_packed_size
+ (const ECS__TetheringNtf *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t ecs__tethering_ntf__pack
+ (const ECS__TetheringNtf *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t ecs__tethering_ntf__pack_to_buffer
+ (const ECS__TetheringNtf *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ECS__TetheringNtf *
+ ecs__tethering_ntf__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ECS__TetheringNtf *)
+ protobuf_c_message_unpack (&ecs__tethering_ntf__descriptor,
+ allocator, len, data);
+}
+void ecs__tethering_ntf__free_unpacked
+ (ECS__TetheringNtf *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
void ecs__master__init
(ECS__Master *message)
{
(ProtobufCMessageInit) ecs__nfc_ntf__init,
NULL,NULL,NULL /* reserved[123] */
};
-static const ProtobufCFieldDescriptor ecs__master__field_descriptors[16] =
+static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] =
+{
+ {
+ "category",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_STRING,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringReq, category),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "length",
+ 2,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringReq, length),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "group",
+ 3,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringReq, group),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "action",
+ 4,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringReq, action),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "data",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_BYTES,
+ PROTOBUF_C_OFFSETOF(ECS__TetheringReq, has_data),
+ PROTOBUF_C_OFFSETOF(ECS__TetheringReq, data),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned ecs__tethering_req__field_indices_by_name[] = {
+ 3, /* field[3] = action */
+ 0, /* field[0] = category */
+ 4, /* field[4] = data */
+ 2, /* field[2] = group */
+ 1, /* field[1] = length */
+};
+static const ProtobufCIntRange ecs__tethering_req__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 5 }
+};
+const ProtobufCMessageDescriptor ecs__tethering_req__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "ECS.TetheringReq",
+ "TetheringReq",
+ "ECS__TetheringReq",
+ "ECS",
+ sizeof(ECS__TetheringReq),
+ 5,
+ ecs__tethering_req__field_descriptors,
+ ecs__tethering_req__field_indices_by_name,
+ 1, ecs__tethering_req__number_ranges,
+ (ProtobufCMessageInit) ecs__tethering_req__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
+{
+ {
+ "errcode",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringAns, errcode),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "errstr",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_STRING,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringAns, errstr),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "category",
+ 3,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_STRING,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringAns, category),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "length",
+ 4,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringAns, length),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "group",
+ 5,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringAns, group),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "action",
+ 6,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringAns, action),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "data",
+ 7,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_BYTES,
+ PROTOBUF_C_OFFSETOF(ECS__TetheringAns, has_data),
+ PROTOBUF_C_OFFSETOF(ECS__TetheringAns, data),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned ecs__tethering_ans__field_indices_by_name[] = {
+ 5, /* field[5] = action */
+ 2, /* field[2] = category */
+ 6, /* field[6] = data */
+ 0, /* field[0] = errcode */
+ 1, /* field[1] = errstr */
+ 4, /* field[4] = group */
+ 3, /* field[3] = length */
+};
+static const ProtobufCIntRange ecs__tethering_ans__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 7 }
+};
+const ProtobufCMessageDescriptor ecs__tethering_ans__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "ECS.TetheringAns",
+ "TetheringAns",
+ "ECS__TetheringAns",
+ "ECS",
+ sizeof(ECS__TetheringAns),
+ 7,
+ ecs__tethering_ans__field_descriptors,
+ ecs__tethering_ans__field_indices_by_name,
+ 1, ecs__tethering_ans__number_ranges,
+ (ProtobufCMessageInit) ecs__tethering_ans__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] =
+{
+ {
+ "category",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_STRING,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, category),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "length",
+ 2,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, length),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "group",
+ 3,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, group),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "action",
+ 4,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, action),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "data",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_BYTES,
+ PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, has_data),
+ PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, data),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned ecs__tethering_ntf__field_indices_by_name[] = {
+ 3, /* field[3] = action */
+ 0, /* field[0] = category */
+ 4, /* field[4] = data */
+ 2, /* field[2] = group */
+ 1, /* field[1] = length */
+};
+static const ProtobufCIntRange ecs__tethering_ntf__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 5 }
+};
+const ProtobufCMessageDescriptor ecs__tethering_ntf__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "ECS.TetheringNtf",
+ "TetheringNtf",
+ "ECS__TetheringNtf",
+ "ECS",
+ sizeof(ECS__TetheringNtf),
+ 5,
+ ecs__tethering_ntf__field_descriptors,
+ ecs__tethering_ntf__field_indices_by_name,
+ 1, ecs__tethering_ntf__number_ranges,
+ (ProtobufCMessageInit) ecs__tethering_ntf__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor ecs__master__field_descriptors[19] =
{
{
"type",
0, /* packed */
0,NULL,NULL /* reserved1,reserved2, etc */
},
+ {
+ "tethering_req",
+ 103,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__Master, tethering_req),
+ &ecs__tethering_req__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "tethering_ans",
+ 104,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__Master, tethering_ans),
+ &ecs__tethering_ans__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "tethering_ntf",
+ 105,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(ECS__Master, tethering_ntf),
+ &ecs__tethering_ntf__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
};
static const unsigned ecs__master__field_indices_by_name[] = {
2, /* field[2] = checkversion_ans */
11, /* field[11] = monitor_req */
15, /* field[15] = nfc_ntf */
14, /* field[14] = nfc_req */
+ 17, /* field[17] = tethering_ans */
+ 18, /* field[18] = tethering_ntf */
+ 16, /* field[16] = tethering_req */
0, /* field[0] = type */
};
static const ProtobufCIntRange ecs__master__number_ranges[2 + 1] =
{
{ 1, 0 },
{ 101, 14 },
- { 0, 16 }
+ { 0, 19 }
};
const ProtobufCMessageDescriptor ecs__master__descriptor =
{
"ECS__Master",
"ECS",
sizeof(ECS__Master),
- 16,
+ 19,
ecs__master__field_descriptors,
ecs__master__field_indices_by_name,
2, ecs__master__number_ranges,
#ifndef PROTOBUF_C_ecs_2eproto__INCLUDED
#define PROTOBUF_C_ecs_2eproto__INCLUDED
-//#include <google/protobuf-c/protobuf-c.h>
#include "../../../distrib/protobuf/protobuf-c.h"
PROTOBUF_C_BEGIN_DECLS
typedef struct _ECS__MonitorNtf ECS__MonitorNtf;
typedef struct _ECS__NfcReq ECS__NfcReq;
typedef struct _ECS__NfcNtf ECS__NfcNtf;
+typedef struct _ECS__TetheringReq ECS__TetheringReq;
+typedef struct _ECS__TetheringAns ECS__TetheringAns;
+typedef struct _ECS__TetheringNtf ECS__TetheringNtf;
typedef struct _ECS__Master ECS__Master;
, NULL, 0,{0,NULL} }
+struct _ECS__TetheringReq
+{
+ ProtobufCMessage base;
+ char *category;
+ int32_t length;
+ int32_t group;
+ int32_t action;
+ protobuf_c_boolean has_data;
+ ProtobufCBinaryData data;
+};
+#define ECS__TETHERING_REQ__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_req__descriptor) \
+ , NULL, 0, 0, 0, 0,{0,NULL} }
+
+
+struct _ECS__TetheringAns
+{
+ ProtobufCMessage base;
+ int32_t errcode;
+ char *errstr;
+ char *category;
+ int32_t length;
+ int32_t group;
+ int32_t action;
+ protobuf_c_boolean has_data;
+ ProtobufCBinaryData data;
+};
+#define ECS__TETHERING_ANS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_ans__descriptor) \
+ , 0, NULL, NULL, 0, 0, 0, 0,{0,NULL} }
+
+
+struct _ECS__TetheringNtf
+{
+ ProtobufCMessage base;
+ char *category;
+ int32_t length;
+ int32_t group;
+ int32_t action;
+ protobuf_c_boolean has_data;
+ ProtobufCBinaryData data;
+};
+#define ECS__TETHERING_NTF__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_ntf__descriptor) \
+ , NULL, 0, 0, 0, 0,{0,NULL} }
+
+
struct _ECS__Master
{
ProtobufCMessage base;
ECS__MonitorNtf *monitor_ntf;
ECS__NfcReq *nfc_req;
ECS__NfcNtf *nfc_ntf;
+ ECS__TetheringReq *tethering_req;
+ ECS__TetheringAns *tethering_ans;
+ ECS__TetheringNtf *tethering_ntf;
};
#define ECS__MASTER__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&ecs__master__descriptor) \
- , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+ , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
/* ECS__CheckVersionReq methods */
void ecs__nfc_ntf__free_unpacked
(ECS__NfcNtf *message,
ProtobufCAllocator *allocator);
+/* ECS__TetheringReq methods */
+void ecs__tethering_req__init
+ (ECS__TetheringReq *message);
+size_t ecs__tethering_req__get_packed_size
+ (const ECS__TetheringReq *message);
+size_t ecs__tethering_req__pack
+ (const ECS__TetheringReq *message,
+ uint8_t *out);
+size_t ecs__tethering_req__pack_to_buffer
+ (const ECS__TetheringReq *message,
+ ProtobufCBuffer *buffer);
+ECS__TetheringReq *
+ ecs__tethering_req__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void ecs__tethering_req__free_unpacked
+ (ECS__TetheringReq *message,
+ ProtobufCAllocator *allocator);
+/* ECS__TetheringAns methods */
+void ecs__tethering_ans__init
+ (ECS__TetheringAns *message);
+size_t ecs__tethering_ans__get_packed_size
+ (const ECS__TetheringAns *message);
+size_t ecs__tethering_ans__pack
+ (const ECS__TetheringAns *message,
+ uint8_t *out);
+size_t ecs__tethering_ans__pack_to_buffer
+ (const ECS__TetheringAns *message,
+ ProtobufCBuffer *buffer);
+ECS__TetheringAns *
+ ecs__tethering_ans__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void ecs__tethering_ans__free_unpacked
+ (ECS__TetheringAns *message,
+ ProtobufCAllocator *allocator);
+/* ECS__TetheringNtf methods */
+void ecs__tethering_ntf__init
+ (ECS__TetheringNtf *message);
+size_t ecs__tethering_ntf__get_packed_size
+ (const ECS__TetheringNtf *message);
+size_t ecs__tethering_ntf__pack
+ (const ECS__TetheringNtf *message,
+ uint8_t *out);
+size_t ecs__tethering_ntf__pack_to_buffer
+ (const ECS__TetheringNtf *message,
+ ProtobufCBuffer *buffer);
+ECS__TetheringNtf *
+ ecs__tethering_ntf__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void ecs__tethering_ntf__free_unpacked
+ (ECS__TetheringNtf *message,
+ ProtobufCAllocator *allocator);
/* ECS__Master methods */
void ecs__master__init
(ECS__Master *message);
typedef void (*ECS__NfcNtf_Closure)
(const ECS__NfcNtf *message,
void *closure_data);
+typedef void (*ECS__TetheringReq_Closure)
+ (const ECS__TetheringReq *message,
+ void *closure_data);
+typedef void (*ECS__TetheringAns_Closure)
+ (const ECS__TetheringAns *message,
+ void *closure_data);
+typedef void (*ECS__TetheringNtf_Closure)
+ (const ECS__TetheringNtf *message,
+ void *closure_data);
typedef void (*ECS__Master_Closure)
(const ECS__Master *message,
void *closure_data);
extern const ProtobufCMessageDescriptor ecs__monitor_ntf__descriptor;
extern const ProtobufCMessageDescriptor ecs__nfc_req__descriptor;
extern const ProtobufCMessageDescriptor ecs__nfc_ntf__descriptor;
+extern const ProtobufCMessageDescriptor ecs__tethering_req__descriptor;
+extern const ProtobufCMessageDescriptor ecs__tethering_ans__descriptor;
+extern const ProtobufCMessageDescriptor ecs__tethering_ntf__descriptor;
extern const ProtobufCMessageDescriptor ecs__master__descriptor;
PROTOBUF_C_END_DECLS
#endif
#include "ecs_ids.pb-c.h"
-const ProtobufCEnumValue ecs__master__type__enum_values_by_number[15] =
+const ProtobufCEnumValue ecs__master__type__enum_values_by_number[18] =
{
{ "CHECKVERSION_REQ", "ECS__MASTER__TYPE__CHECKVERSION_REQ", 2 },
{ "CHECKVERSION_ANS", "ECS__MASTER__TYPE__CHECKVERSION_ANS", 3 },
{ "MONITOR_NTF", "ECS__MASTER__TYPE__MONITOR_NTF", 14 },
{ "NFC_REQ", "ECS__MASTER__TYPE__NFC_REQ", 101 },
{ "NFC_NTF", "ECS__MASTER__TYPE__NFC_NTF", 102 },
+ { "TETHERING_REQ", "ECS__MASTER__TYPE__TETHERING_REQ", 103 },
+ { "TETHERING_ANS", "ECS__MASTER__TYPE__TETHERING_ANS", 104 },
+ { "TETHERING_NTF", "ECS__MASTER__TYPE__TETHERING_NTF", 105 },
};
static const ProtobufCIntRange ecs__master__type__value_ranges[] = {
-{2, 0},{101, 13},{0, 15}
+{2, 0},{101, 13},{0, 18}
};
-const ProtobufCEnumValueIndex ecs__master__type__enum_values_by_name[15] =
+const ProtobufCEnumValueIndex ecs__master__type__enum_values_by_name[18] =
{
{ "CHECKVERSION_ANS", 1 },
{ "CHECKVERSION_REQ", 0 },
{ "MONITOR_REQ", 10 },
{ "NFC_NTF", 14 },
{ "NFC_REQ", 13 },
+ { "TETHERING_ANS", 16 },
+ { "TETHERING_NTF", 17 },
+ { "TETHERING_REQ", 15 },
};
const ProtobufCEnumDescriptor ecs__master__type__descriptor =
{
"Master_Type",
"ECS__MasterType",
"ECS",
- 15,
+ 18,
ecs__master__type__enum_values_by_number,
- 15,
+ 18,
ecs__master__type__enum_values_by_name,
2,
ecs__master__type__value_ranges,
ECS__MASTER__TYPE__MONITOR_ANS = 13,
ECS__MASTER__TYPE__MONITOR_NTF = 14,
ECS__MASTER__TYPE__NFC_REQ = 101,
- ECS__MASTER__TYPE__NFC_NTF = 102
+ ECS__MASTER__TYPE__NFC_NTF = 102,
+ ECS__MASTER__TYPE__TETHERING_REQ = 103,
+ ECS__MASTER__TYPE__TETHERING_ANS = 104,
+ ECS__MASTER__TYPE__TETHERING_NTF = 105
} ECS__MasterType;
/* --- messages --- */
required string category = 1;
required int32 length = 2;
required int32 group = 3;
- required int32 action = 4;
+ required int32 action = 4;
optional bytes data = 5;
}
required string category = 1;
required int32 length = 2;
required int32 group = 3;
- required int32 action = 4;
+ required int32 action = 4;
optional bytes data = 5;
}
required string category = 1;
required int32 length = 2;
required int32 group = 3;
- required int32 action = 4;
+ required int32 action = 4;
optional bytes data = 5;
}
required string category = 3;
required int32 length = 4;
required int32 group = 5;
- required int32 action = 6;
+ required int32 action = 6;
optional bytes data = 7;
}
required string category = 1;
required int32 length = 2;
required int32 group = 3;
- required int32 action = 4;
+ required int32 action = 4;
optional bytes data = 5;
}
optional bytes data = 2;
}
+message TetheringReq {
+ required string category = 1;
+ required int32 length = 2;
+ required int32 group = 3;
+ required int32 action = 4;
+ optional bytes data = 5;
+}
+
+message TetheringAns {
+ required int32 errcode = 1;
+ optional string errstr = 2;
+ required string category = 3;
+ required int32 length = 4;
+ required int32 group = 5;
+ required int32 action = 6;
+ optional bytes data = 7;
+}
+
+message TetheringNtf {
+ required string category = 1;
+ required int32 length = 2;
+ required int32 group = 3;
+ required int32 action = 4;
+ optional bytes data = 5;
+}
+
// ======= Main master message =======
message Master {
// Extensions 101 to 150;
optional NfcReq nfc_req = 101;
optional NfcNtf nfc_ntf = 102;
+
+ optional TetheringReq tethering_req = 103;
+ optional TetheringAns tethering_ans = 104;
+ optional TetheringNtf tethering_ntf = 105;
}
// extension from 101 to 150
NFC_REQ = 101;
NFC_NTF = 102;
+
+ TETHERING_REQ = 103;
+ TETHERING_ANS = 104;
+ TETHERING_NTF = 105;
}
#include "skin/maruskin_client.h"
#include "debug_ch.h"
#include "ecs/ecs.h"
+#include "tethering/app_tethering.h"
#ifdef CONFIG_SDL
#include <SDL.h>
shutdown_skin_server();
shutdown_guest_server();
stop_ecs();
+ disconnect_tethering_app();
#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN)
if (shmctl(g_shmid, IPC_RMID, 0) == -1) {
--- /dev/null
+# tethering Makefile.tizen
+
+$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/tizen/src/tethering:$(SRC_PATH)/tizen/src/tethering/genmsg:$(SRC_PATH)/tizen/distrib/protobuf)
+
+QEMU_CFLAGS += -I$(SRC_PATH)/tizen/distrib/protobuf
+QEMU_CFLAGS += -I$(SRC_PATH)/tizen/src/tethering/genmsg
+
+obj-y += tethering.pb-c.o # protobuf-c.o
+obj-y += app_tethering.o
--- /dev/null
+/*
+ * emulator controller client
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ * Kitae Kim <kt920.kim@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+#include <sys/ioctl.h>
+
+#include "qemu-common.h"
+#include "qemu/main-loop.h"
+#include "qemu/sockets.h"
+#include "ui/console.h"
+
+#include "emul_state.h"
+#include "app_tethering.h"
+#include "../ecs/ecs_tethering.h"
+#include "genmsg/tethering.pb-c.h"
+#include "../hw/maru_virtio_sensor.h"
+
+#include "../debug_ch.h"
+MULTI_DEBUG_CHANNEL(tizen, app_tethering);
+
+#define TETHERING_MSG_HANDSHAKE_KEY 100
+#define MSG_BUF_SIZE 255
+#define MSG_LEN_SIZE 4
+
+#ifndef min
+#define min(a,b) ((a)<(b)?(a):(b))
+#endif
+
+typedef struct tethering_recv_buf {
+ uint32_t len;
+ uint32_t stack_size;
+ char data[MSG_BUF_SIZE];
+} tethering_recv_buf;
+
+typedef struct _TetheringState {
+ int sock_fd;
+ int connection_status;
+ tethering_recv_buf recv_buf;
+} TetheringState;
+
+enum connection_status {
+ CONNECTED = 1,
+ DISCONNECTED,
+ CONNECTING,
+};
+
+enum device_status {
+ ENABLED = 1,
+ DISABLED,
+};
+
+#ifndef DEBUG
+const char *connection_status_str[3] = {"CONNECTED", "DISCONNECTED",
+ "CONNECTING"};
+#endif
+
+static tethering_recv_buf recv_buf;
+
+static int connection_status = DISCONNECTED;
+static int tethering_sock = -1;
+// static bool app_state = false;
+static int sensor_device_status = DISABLED;
+static int mt_device_status = DISABLED;
+
+static void end_tethering_socket(int sockfd);
+static void set_tethering_connection_status(int status);
+static void set_tethering_sensor_status(int status);
+static void set_tethering_multitouch_status(int status);
+#if 0
+static void set_tethering_app_state(bool state);
+static bool get_tethering_app_state(void);
+#endif
+
+static void *build_injector_msg(Injector__InjectorMsg* msg, int *payloadsize)
+{
+ void *buf = NULL;
+ int msg_packed_size = 0;
+
+ msg_packed_size = injector__injector_msg__get_packed_size(msg);
+ *payloadsize = msg_packed_size + MSG_LEN_SIZE;
+
+ buf = g_malloc(*payloadsize);
+ if (!buf) {
+ ERR("failed to allocate memory\n");
+ return NULL;
+ }
+
+ injector__injector_msg__pack(msg, buf + MSG_LEN_SIZE);
+
+ msg_packed_size = htonl(msg_packed_size);
+ memcpy(buf, &msg_packed_size, MSG_LEN_SIZE);
+
+ return buf;
+}
+
+static bool send_msg_to_controller(Injector__InjectorMsg *msg)
+{
+ void *buf = NULL;
+ int payloadsize = 0, err = 0;
+ int sockfd = 0;
+ bool ret = true;
+
+ buf = build_injector_msg(msg, &payloadsize);
+ if (!buf) {
+ return false;
+ }
+
+ sockfd = tethering_sock;
+ err = qemu_sendto(sockfd, buf, payloadsize, 0, NULL, 0);
+ if (err < 0) {
+ ERR("failed to send a message. err: %d\n", err);
+ ret = false;
+ }
+
+ if (buf) {
+ g_free(buf);
+ }
+
+ return ret;
+}
+
+static bool send_handshake_req_msg(void)
+{
+ Injector__InjectorMsg msg = INJECTOR__INJECTOR_MSG__INIT;
+ Injector__HandShakeReq req = INJECTOR__HAND_SHAKE_REQ__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ req.key = TETHERING_MSG_HANDSHAKE_KEY;
+
+ msg.type = INJECTOR__INJECTOR_MSG__TYPE__HANDSHAKE_REQ;
+ msg.handshakereq = &req;
+
+ TRACE("send handshake_req message\n");
+ send_msg_to_controller(&msg);
+
+ TRACE("leave: %s\n", __func__);
+
+ return true;
+}
+
+#if 0
+static bool send_emul_state_msg(void)
+{
+ Injector__InjectorMsg msg = INJECTOR__INJECTOR_MSG__INIT;
+ Injector__EmulatorState emul_state = INJECTOR__EMULATOR_STATE__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ emul_state.state = INJECTOR__CONNECTION_STATE__TERMINATE;
+
+ msg.type = INJECTOR__INJECTOR_MSG__TYPE__EMUL_STATE;
+ msg.emulstate = &emul_state;
+
+ INFO("send emulator_state message\n");
+ send_msg_to_controller(&msg);
+
+ TRACE("leave: %s\n", __func__);
+
+ return true;
+}
+#endif
+
+static bool build_event_msg(Injector__EventMsg *event)
+{
+ bool ret = false;
+ Injector__InjectorMsg msg = INJECTOR__INJECTOR_MSG__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ msg.type = INJECTOR__INJECTOR_MSG__TYPE__EVENT_MSG;
+ msg.eventmsg = event;
+
+ ret = send_msg_to_controller(&msg);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+static bool send_event_start_ans_msg(Injector__Result result)
+{
+ bool ret = false;
+ Injector__EventMsg event = INJECTOR__EVENT_MSG__INIT;
+ Injector__StartAns start_ans = INJECTOR__START_ANS__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ start_ans.result = result;
+
+ event.type = INJECTOR__EVENT_MSG__TYPE__START_ANS;
+ event.startans = &start_ans;
+
+ TRACE("send event_start_ans message\n");
+ ret = build_event_msg(&event);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+static bool send_set_event_status_msg(Injector__Event event_type,
+ Injector__Status status)
+{
+ bool ret = false;
+ Injector__EventMsg event = INJECTOR__EVENT_MSG__INIT;
+ Injector__SetEventStatus event_status = INJECTOR__SET_EVENT_STATUS__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ event_status.event = event_type;
+ event_status.status = status;
+
+ event.type = INJECTOR__EVENT_MSG__TYPE__EVENT_STATUS;
+ event.setstatus = &event_status;
+
+ TRACE("send event_set_event_status message\n");
+ ret = build_event_msg(&event);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+
+// create a sensor message.
+static bool build_sensor_msg(Injector__SensorMsg *sensor)
+{
+ bool ret = false;
+ Injector__InjectorMsg msg = INJECTOR__INJECTOR_MSG__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ msg.type = INJECTOR__INJECTOR_MSG__TYPE__SENSOR_MSG;
+ msg.sensormsg = sensor;
+
+ ret = send_msg_to_controller(&msg);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+static bool send_sensor_start_ans_msg(Injector__Result result)
+{
+ bool ret = false;
+ Injector__SensorMsg event = INJECTOR__SENSOR_MSG__INIT;
+ Injector__StartAns start_ans = INJECTOR__START_ANS__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ start_ans.result = result;
+
+ event.type = INJECTOR__SENSOR_MSG__TYPE__START_ANS;
+ event.startans = &start_ans;
+
+ TRACE("send sensor_start_ans message\n");
+ ret = build_sensor_msg(&event);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+static bool send_set_sensor_status_msg(Injector__SensorType sensor_type,
+ Injector__Status status)
+{
+ bool ret = false;
+
+ Injector__SensorMsg sensor = INJECTOR__SENSOR_MSG__INIT;
+ Injector__SetSensorStatus sensor_status =
+ INJECTOR__SET_SENSOR_STATUS__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ sensor_status.sensor = sensor_type;
+ sensor_status.status = status;
+
+ sensor.type = INJECTOR__SENSOR_MSG__TYPE__SENSOR_STATUS;
+ sensor.setstatus = &sensor_status;
+
+ TRACE("send sensor_set_event_status message\n");
+ ret = build_sensor_msg(&sensor);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+static void set_sensor_data(Injector__SensorData *data)
+{
+ switch(data->sensor) {
+ case INJECTOR__SENSOR_TYPE__ACCEL:
+ {
+ char tmp[255] = {0};
+
+ sprintf(tmp, "%s, %s, %s", data->x, data->y, data->z);
+ set_sensor_accel(tmp, strlen(tmp));
+
+ INFO("sensor_accel x: %s, y: %s, z: %s\n", data->x, data->y, data->z);
+ }
+ break;
+ case INJECTOR__SENSOR_TYPE__MAGNETIC:
+ {
+ char tmp[255] = {0};
+
+ sprintf(tmp, "%s %s %s", data->x, data->y, data->z);
+ set_sensor_mag(tmp, strlen(tmp));
+
+ INFO("sensor_mag x: %s, y: %s, z: %s\n", data->x, data->y, data->z);
+ }
+ break;
+ case INJECTOR__SENSOR_TYPE__GYROSCOPE:
+ {
+ char tmp[255] = {0};
+
+ sprintf(tmp, "%s %s %s", data->x, data->y, data->z);
+ set_sensor_gyro(tmp, strlen(tmp));
+
+ INFO("sensor_gyro x: %s, y: %s, z: %s\n", data->x, data->y, data->z);
+ }
+ break;
+ case INJECTOR__SENSOR_TYPE__PROXIMITY:
+ {
+ char tmp[255] = {0};
+
+ sprintf(tmp, "%s", data->x);
+ set_sensor_proxi(tmp, strlen(tmp));
+ INFO("sensor_proxi x: %s\n", data->x);
+ }
+ break;
+ case INJECTOR__SENSOR_TYPE__LIGHT:
+ {
+ char tmp[255] = {0};
+
+ sprintf(tmp, "%s", data->x);
+ set_sensor_light(tmp, strlen(tmp));
+ INFO("sensor_light x: %s\n", data->x);
+ }
+ break;
+ default:
+ TRACE("invalid sensor data\n");
+ break;
+ }
+
+ // set ecs_sensor
+}
+
+static bool build_mulitouch_msg(Injector__MultiTouchMsg *multitouch)
+{
+ bool ret = false;
+ Injector__InjectorMsg msg = INJECTOR__INJECTOR_MSG__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ msg.type = INJECTOR__INJECTOR_MSG__TYPE__TOUCH_MSG;
+ msg.touchmsg = multitouch;
+
+ ret = send_msg_to_controller(&msg);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+static bool send_mulitouch_start_ans_msg(Injector__Result result)
+{
+ bool ret = false;
+
+ Injector__MultiTouchMsg mt = INJECTOR__MULTI_TOUCH_MSG__INIT;
+ Injector__StartAns start_ans = INJECTOR__START_ANS__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ start_ans.result = result;
+
+ mt.type = INJECTOR__MULTI_TOUCH_MSG__TYPE__START_ANS;
+ mt.startans = &start_ans;
+
+ ret = build_mulitouch_msg(&mt);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+static bool send_multitouch_max_count(void)
+{
+ bool ret = false;
+
+ Injector__MultiTouchMsg mt = INJECTOR__MULTI_TOUCH_MSG__INIT;
+ Injector__MultiTouchMaxCount touch_cnt =
+ INJECTOR__MULTI_TOUCH_MAX_COUNT__INIT;
+
+ TRACE("enter: %s\n", __func__);
+
+ touch_cnt.max = get_emul_max_touch_point();
+
+ mt.type = INJECTOR__MULTI_TOUCH_MSG__TYPE__MAX_COUNT;
+ mt.maxcount = &touch_cnt;
+
+ INFO("send multi-touch max count: %d\n", touch_cnt.max);
+ ret = build_mulitouch_msg(&mt);
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+
+static void set_multitouch_data(Injector__MultiTouchData *data)
+{
+ float x = 0.0, y = 0.0;
+ int32_t index = 0;
+
+ switch(data->status) {
+ case INJECTOR__TOUCH_STATUS__PRESS:
+ TRACE("touch pressed\n");
+
+ index = data->index;
+ x = data->xpoint;
+ y = data->ypoint;
+ break;
+ case INJECTOR__TOUCH_STATUS__RELEASE:
+ TRACE("touch released\n");
+
+ index = data->index;
+ x = data->xpoint;
+ y = data->ypoint;
+ break;
+ default:
+ TRACE("invalid multitouch data\n");
+ break;
+ }
+
+ INFO("MT. index: %d, x: %f, y: %f\n", index, x, y);
+
+ // set ecs_multitouch
+ kbd_mouse_event(x, y, index, data->status);
+}
+
+static void msgproc_tethering_handshake_ans(Injector__HandShakeAns *msg)
+{
+// ans = msg->result;
+}
+
+static void msgproc_app_state_msg(Injector__AppState *msg)
+{
+ if (msg->state == INJECTOR__CONNECTION_STATE__TERMINATE) {
+ INFO("App is terminated\n");
+
+// set_tethering_app_state(false);
+ set_tethering_sensor_status(DISABLED);
+ set_tethering_multitouch_status(DISABLED);
+
+ disconnect_tethering_app();
+ } else {
+ // does nothing
+ }
+}
+
+
+static bool msgproc_tethering_event_msg(Injector__EventMsg *msg)
+{
+ bool ret = true;
+
+ switch(msg->type) {
+ case INJECTOR__EVENT_MSG__TYPE__START_REQ:
+ {
+ int touch_status = 0;
+
+ TRACE("EVENT_MSG_TYPE_START_REQ\n");
+ send_set_event_status_msg(INJECTOR__EVENT__SENSOR,
+ INJECTOR__STATUS__ENABLE);
+
+ // TODO: check sensor device whether it exists or not
+ set_tethering_sensor_status(ENABLED);
+
+ if (is_emul_input_touch_enable()) {
+ touch_status = INJECTOR__STATUS__ENABLE;
+ set_tethering_multitouch_status(ENABLED);
+ } else {
+ touch_status = INJECTOR__STATUS__DISABLE;
+ set_tethering_multitouch_status(DISABLED);
+ }
+
+ TRACE("send multi-touch event_status msg: %d\n", touch_status);
+ send_set_event_status_msg(INJECTOR__EVENT__MULTITOUCH, touch_status);
+
+ TRACE("send event_start_ans msg: %d\n", touch_status);
+ send_event_start_ans_msg(INJECTOR__RESULT__SUCCESS);
+ }
+ break;
+#if 0
+ case INJECTOR__EVENT_MSG__TYPE__START_ANS:
+ break;
+ case INJECTOR__EVENT_MSG__TYPE__EVENT_STATUS:
+ break;
+#endif
+ case INJECTOR__EVENT_MSG__TYPE__TERMINATE:
+ break;
+ default:
+ TRACE("invalid event_msg type\n");
+ ret = false;
+ break;
+ }
+
+ return ret;
+}
+
+static bool msgproc_tethering_sensor_msg(Injector__SensorMsg *msg)
+{
+ bool ret = true;
+
+ switch(msg->type) {
+ case INJECTOR__SENSOR_MSG__TYPE__START_REQ:
+ TRACE("SENSOR_MSG_TYPE_START_REQ\n");
+
+ // set sensor type.
+ send_set_sensor_status_msg(INJECTOR__SENSOR_TYPE__ACCEL,
+ INJECTOR__STATUS__ENABLE);
+ send_set_sensor_status_msg(INJECTOR__SENSOR_TYPE__MAGNETIC,
+ INJECTOR__STATUS__ENABLE);
+ send_set_sensor_status_msg(INJECTOR__SENSOR_TYPE__GYROSCOPE,
+ INJECTOR__STATUS__ENABLE);
+ send_set_sensor_status_msg(INJECTOR__SENSOR_TYPE__PROXIMITY,
+ INJECTOR__STATUS__ENABLE);
+ send_set_sensor_status_msg(INJECTOR__SENSOR_TYPE__LIGHT,
+ INJECTOR__STATUS__ENABLE);
+
+ TRACE("SENSOR_MSG_TYPE_START_ANS\n");
+ send_sensor_start_ans_msg(INJECTOR__RESULT__SUCCESS);
+
+ break;
+#if 0
+ case INJECTOR__SENSOR_MSG__TYPE__START_ANS:
+ break;
+ case INJECTOR__SENSOR_MSG__TYPE__SENSOR_STATUS:
+ break;
+#endif
+ case INJECTOR__SENSOR_MSG__TYPE__TERMINATE:
+ TRACE("SENSOR_MSG_TYPE_TERMINATE\n");
+ break;
+
+ case INJECTOR__SENSOR_MSG__TYPE__SENSOR_DATA:
+ TRACE("SENSOR_MSG_TYPE_SENSOR_DATA\n");
+ set_sensor_data(msg->data);
+ break;
+ default:
+ TRACE("invalid sensor_msg type");
+ ret = false;
+ break;
+ }
+
+ return ret;
+}
+
+static bool msgproc_tethering_mt_msg(Injector__MultiTouchMsg *msg)
+{
+ bool ret = true;
+
+ switch(msg->type) {
+ case INJECTOR__MULTI_TOUCH_MSG__TYPE__START_REQ:
+ TRACE("MULTITOUCH_MSG_TYPE_START\n");
+ ret = send_mulitouch_start_ans_msg(INJECTOR__RESULT__SUCCESS);
+ break;
+#if 0
+ case INJECTOR__MULTI_TOUCH_MSG__TYPE__START_ANS:
+ break;
+#endif
+ case INJECTOR__MULTI_TOUCH_MSG__TYPE__TERMINATE:
+ TRACE("MULTITOUCH_MSG_TYPE_TERMINATE\n");
+ break;
+ case INJECTOR__MULTI_TOUCH_MSG__TYPE__MAX_COUNT:
+ ret = send_multitouch_max_count();
+ TRACE("MULTITOUCH_MSG_TYPE_TERMINATE\n");
+ break;
+ case INJECTOR__MULTI_TOUCH_MSG__TYPE__TOUCH_DATA:
+ set_multitouch_data(msg->touchdata);
+ break;
+ default:
+ TRACE("invalid multitouch_msg\n");
+ ret = false;
+ break;
+ }
+
+ return ret;
+}
+
+static bool handle_injector_msg_from_controller(char *data, int len)
+{
+ Injector__InjectorMsg *injector = NULL;
+ bool ret = true;
+
+ injector = injector__injector_msg__unpack(NULL, (size_t)len,
+ (const uint8_t *)data);
+
+ if (!injector) {
+ // error message
+ ERR("no injector massage\n");
+ return false;
+ }
+
+ switch (injector->type) {
+ case INJECTOR__INJECTOR_MSG__TYPE__HANDSHAKE_ANS:
+ {
+ // TODO: set the result of handshake_ans to
+ Injector__HandShakeAns *msg = injector->handshakeans;
+ if (!msg) {
+ ret = false;
+ } else {
+ msgproc_tethering_handshake_ans(msg);
+ INFO("receive handshake answer\n");
+
+ set_tethering_connection_status(CONNECTED);
+ }
+ }
+ break;
+ case INJECTOR__INJECTOR_MSG__TYPE__APP_STATE:
+ {
+ Injector__AppState *msg = injector->appstate;
+
+ INFO("receive app_state msg\n");
+ if (!msg) {
+ ret = false;
+ } else {
+ msgproc_app_state_msg(msg);
+ }
+ }
+ break;
+ case INJECTOR__INJECTOR_MSG__TYPE__EVENT_MSG:
+ {
+ Injector__EventMsg *msg = injector->eventmsg;
+
+ INFO("receive event_msg\n");
+ if (!msg) {
+ ret = false;
+ } else {
+ msgproc_tethering_event_msg(msg);
+ }
+ }
+ break;
+ case INJECTOR__INJECTOR_MSG__TYPE__SENSOR_MSG:
+ {
+ Injector__SensorMsg *msg = injector->sensormsg;
+
+ INFO("receive sensor_msg\n");
+ if (!msg) {
+ ret = false;
+ } else {
+ msgproc_tethering_sensor_msg(msg);
+ }
+ }
+ break;
+ case INJECTOR__INJECTOR_MSG__TYPE__TOUCH_MSG:
+ {
+ Injector__MultiTouchMsg *msg = injector->touchmsg;
+
+ INFO("receive multitouch_msg\n");
+ if (!msg) {
+ ret = false;
+ } else {
+ msgproc_tethering_mt_msg(msg);
+ }
+ }
+ break;
+ default:
+ TRACE("invalid type message\n");
+ ret = false;
+ break;
+ }
+
+#if 1
+ if (data) {
+ g_free(data);
+ }
+#endif
+
+ injector__injector_msg__free_unpacked(injector, NULL);
+ return ret;
+}
+
+static void reset_tethering_recv_buf(void *opaque)
+{
+ memset(opaque, 0x00, sizeof(tethering_recv_buf));
+}
+
+// tethering client socket
+static void tethering_io_handler(void *opaque)
+{
+ int ret = 0;
+ int payloadsize = 0, read_size = 0;
+ int to_read_bytes = 0;
+
+#ifndef CONFIG_WIN32
+ ret = ioctl(tethering_sock, FIONREAD, &to_read_bytes);
+ if (ret < 0) {
+ ERR("invalid ioctl opertion\n");
+ }
+#else
+ unsigned long to_read_bytes_long = 0;
+ ret = ioctlsocket(tethering_sock. FIONREAD, &to_read_bytes_long);
+ if (ret < 0) {
+ }
+ to_read_bytes = (int)to_read_bytes_long;
+#endif
+ TRACE("ioctl: ret: %d, FIONREAD: %d\n", ret, to_read_bytes);
+
+ if (to_read_bytes == 0) {
+ INFO("there is no read data\n");
+ disconnect_tethering_app();
+ return;
+ }
+
+ if (recv_buf.len == 0) {
+ ret = qemu_recv(tethering_sock, &payloadsize, sizeof(payloadsize), 0);
+ if (ret < sizeof(payloadsize)) {
+ return;
+ }
+
+ payloadsize = ntohl(payloadsize);
+ TRACE("payload size: %d\n", payloadsize);
+
+#if 0
+ if (payloadsize > to_read_bytes) {
+ TRACE("invalid payload size: %d\n", payloadsize);
+ return;
+ }
+#endif
+
+ recv_buf.len = payloadsize;
+
+ to_read_bytes -= sizeof(payloadsize);
+ }
+
+ if (to_read_bytes == 0) {
+ return;
+ }
+
+ to_read_bytes = min(to_read_bytes, (recv_buf.len - recv_buf.stack_size));
+
+ read_size =
+ qemu_recv(tethering_sock, (char *)(recv_buf.data + recv_buf.stack_size),
+ to_read_bytes, 0);
+ if (read_size == 0) {
+ ERR("failed to read data\n");
+ disconnect_tethering_app();
+ return;
+ } else {
+ recv_buf.stack_size += read_size;
+ }
+
+ if (recv_buf.len == recv_buf.stack_size) {
+ char *snd_buf = NULL;
+
+ snd_buf = g_malloc(recv_buf.stack_size);
+ memcpy(snd_buf, recv_buf.data, recv_buf.stack_size);
+
+ handle_injector_msg_from_controller(snd_buf,
+ recv_buf.stack_size);
+ reset_tethering_recv_buf(&recv_buf);
+ }
+}
+
+static int register_tethering_io_handler(int fd)
+{
+ int ret = 0, err = 0;
+
+ TRACE("enter: %s\n", __func__);
+
+ /* register callbackfn for read */
+ err = qemu_set_fd_handler(fd, tethering_io_handler, NULL, NULL);
+ if (err) {
+ ERR("failed to set event handler. fd: %d, err: %d\n", fd, err);
+ ret = -1;
+ }
+
+ TRACE("leave: %s\n", __func__);
+
+ return ret;
+}
+
+static int destroy_tethering_io_handler(int fd)
+{
+ int ret = 0, err = 0;
+
+ TRACE("enter: %s\n", __func__);
+
+ err = qemu_set_fd_handler(fd, NULL, NULL, NULL);
+
+ if (err) {
+ ERR("failed to set event handler. fd: %d, err: %d\n", fd, err);
+ ret = -1;
+ }
+
+ TRACE("leave: %s, ret: %d\n", __func__, ret);
+
+ return ret;
+}
+
+static int start_tethering_socket(int port)
+{
+ struct sockaddr_in addr;
+
+ int sock = -1, opt = 0;
+ int ret = 0;
+
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port); // i.e. 1234
+ inet_aton("127.0.0.1", &addr.sin_addr);
+
+ sock = qemu_socket(PF_INET, SOCK_STREAM, 0);
+ if (sock < 0) {
+ // handle error, print message
+ set_tethering_connection_status(DISCONNECTED);
+ return -1;
+ }
+ INFO("tethering socket is created: %d\n", sock);
+
+ ret =
+ qemu_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+ if (ret < 0) {
+ // handle error,
+ ERR("setsockopt failure\n");
+ end_tethering_socket(sock);
+ return -1;
+ }
+
+ // set nonblock mode
+ qemu_set_nonblock(sock);
+
+ set_tethering_connection_status(CONNECTING);
+ do {
+ if (connect(sock, &addr, sizeof(addr)) < 0) {
+ INFO("tethering socket is connecting.\n");
+ ret = -socket_error();
+ } else {
+ INFO("tethering socket is connected.\n");
+ ret = 0;
+// set_tethering_app_state(true);
+ break;
+ }
+ INFO("ret: %d\n", ret);
+// } while (ret == -EINTR);
+ } while (ret == -EINPROGRESS);
+
+ if (ret < 0) {
+ end_tethering_socket(sock);
+ sock = -1;
+ INFO("tethering_sock: %d\n", sock);
+ }
+
+ return sock;
+}
+
+static void end_tethering_socket(int sockfd)
+{
+ if (closesocket(sockfd) < 0) {
+ perror("closesocket failure");
+ return;
+ }
+
+ INFO("tethering socket is closed: %d\n", sockfd);
+ set_tethering_connection_status(DISCONNECTED);
+ set_tethering_sensor_status(DISABLED);
+ set_tethering_multitouch_status(DISABLED);
+}
+
+#if 0
+static void set_tethering_app_state(bool state)
+{
+ TRACE("set tethering_app state: %d", state);
+ app_state = state;
+}
+
+static bool get_tethering_app_state(void)
+{
+ return app_state;
+}
+#endif
+
+// ecs <-> tethering
+int get_tethering_connection_status(void)
+{
+ return connection_status;
+}
+
+static void set_tethering_connection_status(int status)
+{
+ connection_status = status;
+ if (status) {
+ INFO("connection status: %s\n", connection_status_str[status - 1]);
+ }
+
+ send_tethering_connection_status_ecp();
+}
+
+int get_tethering_sensor_status(void)
+{
+ return sensor_device_status;
+}
+
+static void set_tethering_sensor_status(int status)
+{
+ sensor_device_status = status;
+ send_tethering_sensor_status_ecp();
+}
+
+int get_tethering_multitouch_status(void)
+{
+ return mt_device_status;
+}
+
+static void set_tethering_multitouch_status(int status)
+{
+ mt_device_status = status;
+ send_tethering_multitouch_status_ecp();
+}
+
+int connect_tethering_app(int port)
+{
+ int sock = 0, ret = 0;
+
+ TRACE("connect ecp to app\n");
+
+ sock = start_tethering_socket(port);
+ if (sock < 0) {
+ ERR("failed to start tethering_socket\n");
+ tethering_sock = -1;
+ return -1;
+ }
+
+ tethering_sock = sock;
+
+ reset_tethering_recv_buf(&recv_buf);
+ ret = register_tethering_io_handler(sock);
+ send_handshake_req_msg();
+
+ return ret;
+}
+
+int disconnect_tethering_app(void)
+{
+ int sock = 0;
+
+ INFO("disconnect app from ecp\n");
+
+ sock = tethering_sock;
+ if (sock < 0) {
+ ERR("tethering socket is terminated or not ready\n");
+ } else {
+ destroy_tethering_io_handler(sock);
+#if 0
+ if (get_tethering_app_state()) {
+ send_emul_state_msg();
+ }
+#endif
+ end_tethering_socket(sock);
+ }
+
+ return 0;
+}
--- /dev/null
+/*
+ * emulator controller client
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ * Kitae Kim <kt920.kim@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+int connect_tethering_app(int port);
+
+int disconnect_tethering_app(void);
+
+int get_tethering_connection_status(void);
+
+int get_tethering_sensor_status(void);
+
+int get_tethering_multitouch_status(void);
--- /dev/null
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+
+/* Do not generate deprecated warnings for self */
+#ifndef PROTOBUF_C_NO_DEPRECATED
+#define PROTOBUF_C_NO_DEPRECATED
+#endif
+
+#include "tethering.pb-c.h"
+void injector__hand_shake_req__init
+ (Injector__HandShakeReq *message)
+{
+ static Injector__HandShakeReq init_value = INJECTOR__HAND_SHAKE_REQ__INIT;
+ *message = init_value;
+}
+size_t injector__hand_shake_req__get_packed_size
+ (const Injector__HandShakeReq *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__hand_shake_req__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__hand_shake_req__pack
+ (const Injector__HandShakeReq *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__hand_shake_req__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__hand_shake_req__pack_to_buffer
+ (const Injector__HandShakeReq *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__hand_shake_req__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__HandShakeReq *
+ injector__hand_shake_req__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__HandShakeReq *)
+ protobuf_c_message_unpack (&injector__hand_shake_req__descriptor,
+ allocator, len, data);
+}
+void injector__hand_shake_req__free_unpacked
+ (Injector__HandShakeReq *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__hand_shake_req__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__hand_shake_ans__init
+ (Injector__HandShakeAns *message)
+{
+ static Injector__HandShakeAns init_value = INJECTOR__HAND_SHAKE_ANS__INIT;
+ *message = init_value;
+}
+size_t injector__hand_shake_ans__get_packed_size
+ (const Injector__HandShakeAns *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__hand_shake_ans__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__hand_shake_ans__pack
+ (const Injector__HandShakeAns *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__hand_shake_ans__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__hand_shake_ans__pack_to_buffer
+ (const Injector__HandShakeAns *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__hand_shake_ans__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__HandShakeAns *
+ injector__hand_shake_ans__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__HandShakeAns *)
+ protobuf_c_message_unpack (&injector__hand_shake_ans__descriptor,
+ allocator, len, data);
+}
+void injector__hand_shake_ans__free_unpacked
+ (Injector__HandShakeAns *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__hand_shake_ans__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__emulator_state__init
+ (Injector__EmulatorState *message)
+{
+ static Injector__EmulatorState init_value = INJECTOR__EMULATOR_STATE__INIT;
+ *message = init_value;
+}
+size_t injector__emulator_state__get_packed_size
+ (const Injector__EmulatorState *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__emulator_state__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__emulator_state__pack
+ (const Injector__EmulatorState *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__emulator_state__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__emulator_state__pack_to_buffer
+ (const Injector__EmulatorState *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__emulator_state__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__EmulatorState *
+ injector__emulator_state__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__EmulatorState *)
+ protobuf_c_message_unpack (&injector__emulator_state__descriptor,
+ allocator, len, data);
+}
+void injector__emulator_state__free_unpacked
+ (Injector__EmulatorState *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__emulator_state__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__app_state__init
+ (Injector__AppState *message)
+{
+ static Injector__AppState init_value = INJECTOR__APP_STATE__INIT;
+ *message = init_value;
+}
+size_t injector__app_state__get_packed_size
+ (const Injector__AppState *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__app_state__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__app_state__pack
+ (const Injector__AppState *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__app_state__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__app_state__pack_to_buffer
+ (const Injector__AppState *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__app_state__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__AppState *
+ injector__app_state__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__AppState *)
+ protobuf_c_message_unpack (&injector__app_state__descriptor,
+ allocator, len, data);
+}
+void injector__app_state__free_unpacked
+ (Injector__AppState *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__app_state__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__start_req__init
+ (Injector__StartReq *message)
+{
+ static Injector__StartReq init_value = INJECTOR__START_REQ__INIT;
+ *message = init_value;
+}
+size_t injector__start_req__get_packed_size
+ (const Injector__StartReq *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__start_req__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__start_req__pack
+ (const Injector__StartReq *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__start_req__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__start_req__pack_to_buffer
+ (const Injector__StartReq *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__start_req__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__StartReq *
+ injector__start_req__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__StartReq *)
+ protobuf_c_message_unpack (&injector__start_req__descriptor,
+ allocator, len, data);
+}
+void injector__start_req__free_unpacked
+ (Injector__StartReq *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__start_req__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__start_ans__init
+ (Injector__StartAns *message)
+{
+ static Injector__StartAns init_value = INJECTOR__START_ANS__INIT;
+ *message = init_value;
+}
+size_t injector__start_ans__get_packed_size
+ (const Injector__StartAns *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__start_ans__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__start_ans__pack
+ (const Injector__StartAns *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__start_ans__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__start_ans__pack_to_buffer
+ (const Injector__StartAns *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__start_ans__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__StartAns *
+ injector__start_ans__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__StartAns *)
+ protobuf_c_message_unpack (&injector__start_ans__descriptor,
+ allocator, len, data);
+}
+void injector__start_ans__free_unpacked
+ (Injector__StartAns *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__start_ans__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__set_event_status__init
+ (Injector__SetEventStatus *message)
+{
+ static Injector__SetEventStatus init_value = INJECTOR__SET_EVENT_STATUS__INIT;
+ *message = init_value;
+}
+size_t injector__set_event_status__get_packed_size
+ (const Injector__SetEventStatus *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__set_event_status__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__set_event_status__pack
+ (const Injector__SetEventStatus *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__set_event_status__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__set_event_status__pack_to_buffer
+ (const Injector__SetEventStatus *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__set_event_status__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__SetEventStatus *
+ injector__set_event_status__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__SetEventStatus *)
+ protobuf_c_message_unpack (&injector__set_event_status__descriptor,
+ allocator, len, data);
+}
+void injector__set_event_status__free_unpacked
+ (Injector__SetEventStatus *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__set_event_status__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__event_msg__init
+ (Injector__EventMsg *message)
+{
+ static Injector__EventMsg init_value = INJECTOR__EVENT_MSG__INIT;
+ *message = init_value;
+}
+size_t injector__event_msg__get_packed_size
+ (const Injector__EventMsg *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__event_msg__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__event_msg__pack
+ (const Injector__EventMsg *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__event_msg__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__event_msg__pack_to_buffer
+ (const Injector__EventMsg *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__event_msg__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__EventMsg *
+ injector__event_msg__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__EventMsg *)
+ protobuf_c_message_unpack (&injector__event_msg__descriptor,
+ allocator, len, data);
+}
+void injector__event_msg__free_unpacked
+ (Injector__EventMsg *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__event_msg__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__event_terminate__init
+ (Injector__EventTerminate *message)
+{
+ static Injector__EventTerminate init_value = INJECTOR__EVENT_TERMINATE__INIT;
+ *message = init_value;
+}
+size_t injector__event_terminate__get_packed_size
+ (const Injector__EventTerminate *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__event_terminate__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__event_terminate__pack
+ (const Injector__EventTerminate *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__event_terminate__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__event_terminate__pack_to_buffer
+ (const Injector__EventTerminate *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__event_terminate__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__EventTerminate *
+ injector__event_terminate__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__EventTerminate *)
+ protobuf_c_message_unpack (&injector__event_terminate__descriptor,
+ allocator, len, data);
+}
+void injector__event_terminate__free_unpacked
+ (Injector__EventTerminate *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__event_terminate__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__set_sensor_status__init
+ (Injector__SetSensorStatus *message)
+{
+ static Injector__SetSensorStatus init_value = INJECTOR__SET_SENSOR_STATUS__INIT;
+ *message = init_value;
+}
+size_t injector__set_sensor_status__get_packed_size
+ (const Injector__SetSensorStatus *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__set_sensor_status__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__set_sensor_status__pack
+ (const Injector__SetSensorStatus *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__set_sensor_status__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__set_sensor_status__pack_to_buffer
+ (const Injector__SetSensorStatus *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__set_sensor_status__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__SetSensorStatus *
+ injector__set_sensor_status__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__SetSensorStatus *)
+ protobuf_c_message_unpack (&injector__set_sensor_status__descriptor,
+ allocator, len, data);
+}
+void injector__set_sensor_status__free_unpacked
+ (Injector__SetSensorStatus *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__set_sensor_status__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__sensor_data__init
+ (Injector__SensorData *message)
+{
+ static Injector__SensorData init_value = INJECTOR__SENSOR_DATA__INIT;
+ *message = init_value;
+}
+size_t injector__sensor_data__get_packed_size
+ (const Injector__SensorData *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_data__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__sensor_data__pack
+ (const Injector__SensorData *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_data__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__sensor_data__pack_to_buffer
+ (const Injector__SensorData *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_data__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__SensorData *
+ injector__sensor_data__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__SensorData *)
+ protobuf_c_message_unpack (&injector__sensor_data__descriptor,
+ allocator, len, data);
+}
+void injector__sensor_data__free_unpacked
+ (Injector__SensorData *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_data__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__sensor_msg__init
+ (Injector__SensorMsg *message)
+{
+ static Injector__SensorMsg init_value = INJECTOR__SENSOR_MSG__INIT;
+ *message = init_value;
+}
+size_t injector__sensor_msg__get_packed_size
+ (const Injector__SensorMsg *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_msg__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__sensor_msg__pack
+ (const Injector__SensorMsg *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_msg__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__sensor_msg__pack_to_buffer
+ (const Injector__SensorMsg *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_msg__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__SensorMsg *
+ injector__sensor_msg__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__SensorMsg *)
+ protobuf_c_message_unpack (&injector__sensor_msg__descriptor,
+ allocator, len, data);
+}
+void injector__sensor_msg__free_unpacked
+ (Injector__SensorMsg *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_msg__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__multi_touch_max_count__init
+ (Injector__MultiTouchMaxCount *message)
+{
+ static Injector__MultiTouchMaxCount init_value = INJECTOR__MULTI_TOUCH_MAX_COUNT__INIT;
+ *message = init_value;
+}
+size_t injector__multi_touch_max_count__get_packed_size
+ (const Injector__MultiTouchMaxCount *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_max_count__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__multi_touch_max_count__pack
+ (const Injector__MultiTouchMaxCount *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_max_count__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__multi_touch_max_count__pack_to_buffer
+ (const Injector__MultiTouchMaxCount *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_max_count__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__MultiTouchMaxCount *
+ injector__multi_touch_max_count__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__MultiTouchMaxCount *)
+ protobuf_c_message_unpack (&injector__multi_touch_max_count__descriptor,
+ allocator, len, data);
+}
+void injector__multi_touch_max_count__free_unpacked
+ (Injector__MultiTouchMaxCount *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_max_count__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__multi_touch_data__init
+ (Injector__MultiTouchData *message)
+{
+ static Injector__MultiTouchData init_value = INJECTOR__MULTI_TOUCH_DATA__INIT;
+ *message = init_value;
+}
+size_t injector__multi_touch_data__get_packed_size
+ (const Injector__MultiTouchData *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_data__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__multi_touch_data__pack
+ (const Injector__MultiTouchData *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_data__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__multi_touch_data__pack_to_buffer
+ (const Injector__MultiTouchData *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_data__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__MultiTouchData *
+ injector__multi_touch_data__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__MultiTouchData *)
+ protobuf_c_message_unpack (&injector__multi_touch_data__descriptor,
+ allocator, len, data);
+}
+void injector__multi_touch_data__free_unpacked
+ (Injector__MultiTouchData *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_data__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__multi_touch_msg__init
+ (Injector__MultiTouchMsg *message)
+{
+ static Injector__MultiTouchMsg init_value = INJECTOR__MULTI_TOUCH_MSG__INIT;
+ *message = init_value;
+}
+size_t injector__multi_touch_msg__get_packed_size
+ (const Injector__MultiTouchMsg *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_msg__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__multi_touch_msg__pack
+ (const Injector__MultiTouchMsg *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_msg__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__multi_touch_msg__pack_to_buffer
+ (const Injector__MultiTouchMsg *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_msg__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__MultiTouchMsg *
+ injector__multi_touch_msg__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__MultiTouchMsg *)
+ protobuf_c_message_unpack (&injector__multi_touch_msg__descriptor,
+ allocator, len, data);
+}
+void injector__multi_touch_msg__free_unpacked
+ (Injector__MultiTouchMsg *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__multi_touch_msg__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void injector__injector_msg__init
+ (Injector__InjectorMsg *message)
+{
+ static Injector__InjectorMsg init_value = INJECTOR__INJECTOR_MSG__INIT;
+ *message = init_value;
+}
+size_t injector__injector_msg__get_packed_size
+ (const Injector__InjectorMsg *message)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__injector_msg__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t injector__injector_msg__pack
+ (const Injector__InjectorMsg *message,
+ uint8_t *out)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__injector_msg__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t injector__injector_msg__pack_to_buffer
+ (const Injector__InjectorMsg *message,
+ ProtobufCBuffer *buffer)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__injector_msg__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Injector__InjectorMsg *
+ injector__injector_msg__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Injector__InjectorMsg *)
+ protobuf_c_message_unpack (&injector__injector_msg__descriptor,
+ allocator, len, data);
+}
+void injector__injector_msg__free_unpacked
+ (Injector__InjectorMsg *message,
+ ProtobufCAllocator *allocator)
+{
+ PROTOBUF_C_ASSERT (message->base.descriptor == &injector__injector_msg__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+static const ProtobufCFieldDescriptor injector__hand_shake_req__field_descriptors[1] =
+{
+ {
+ "key",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__HandShakeReq, key),
+ NULL,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__hand_shake_req__field_indices_by_name[] = {
+ 0, /* field[0] = key */
+};
+static const ProtobufCIntRange injector__hand_shake_req__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 1 }
+};
+const ProtobufCMessageDescriptor injector__hand_shake_req__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.HandShakeReq",
+ "HandShakeReq",
+ "Injector__HandShakeReq",
+ "injector",
+ sizeof(Injector__HandShakeReq),
+ 1,
+ injector__hand_shake_req__field_descriptors,
+ injector__hand_shake_req__field_indices_by_name,
+ 1, injector__hand_shake_req__number_ranges,
+ (ProtobufCMessageInit) injector__hand_shake_req__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor injector__hand_shake_ans__field_descriptors[1] =
+{
+ {
+ "result",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__HandShakeAns, result),
+ &injector__result__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__hand_shake_ans__field_indices_by_name[] = {
+ 0, /* field[0] = result */
+};
+static const ProtobufCIntRange injector__hand_shake_ans__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 1 }
+};
+const ProtobufCMessageDescriptor injector__hand_shake_ans__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.HandShakeAns",
+ "HandShakeAns",
+ "Injector__HandShakeAns",
+ "injector",
+ sizeof(Injector__HandShakeAns),
+ 1,
+ injector__hand_shake_ans__field_descriptors,
+ injector__hand_shake_ans__field_indices_by_name,
+ 1, injector__hand_shake_ans__number_ranges,
+ (ProtobufCMessageInit) injector__hand_shake_ans__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor injector__emulator_state__field_descriptors[1] =
+{
+ {
+ "state",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__EmulatorState, state),
+ &injector__connection_state__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__emulator_state__field_indices_by_name[] = {
+ 0, /* field[0] = state */
+};
+static const ProtobufCIntRange injector__emulator_state__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 1 }
+};
+const ProtobufCMessageDescriptor injector__emulator_state__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.EmulatorState",
+ "EmulatorState",
+ "Injector__EmulatorState",
+ "injector",
+ sizeof(Injector__EmulatorState),
+ 1,
+ injector__emulator_state__field_descriptors,
+ injector__emulator_state__field_indices_by_name,
+ 1, injector__emulator_state__number_ranges,
+ (ProtobufCMessageInit) injector__emulator_state__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor injector__app_state__field_descriptors[1] =
+{
+ {
+ "state",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__AppState, state),
+ &injector__connection_state__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__app_state__field_indices_by_name[] = {
+ 0, /* field[0] = state */
+};
+static const ProtobufCIntRange injector__app_state__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 1 }
+};
+const ProtobufCMessageDescriptor injector__app_state__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.AppState",
+ "AppState",
+ "Injector__AppState",
+ "injector",
+ sizeof(Injector__AppState),
+ 1,
+ injector__app_state__field_descriptors,
+ injector__app_state__field_indices_by_name,
+ 1, injector__app_state__number_ranges,
+ (ProtobufCMessageInit) injector__app_state__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+#define injector__start_req__field_descriptors NULL
+#define injector__start_req__field_indices_by_name NULL
+#define injector__start_req__number_ranges NULL
+const ProtobufCMessageDescriptor injector__start_req__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.StartReq",
+ "StartReq",
+ "Injector__StartReq",
+ "injector",
+ sizeof(Injector__StartReq),
+ 0,
+ injector__start_req__field_descriptors,
+ injector__start_req__field_indices_by_name,
+ 0, injector__start_req__number_ranges,
+ (ProtobufCMessageInit) injector__start_req__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor injector__start_ans__field_descriptors[1] =
+{
+ {
+ "result",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__StartAns, result),
+ &injector__result__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__start_ans__field_indices_by_name[] = {
+ 0, /* field[0] = result */
+};
+static const ProtobufCIntRange injector__start_ans__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 1 }
+};
+const ProtobufCMessageDescriptor injector__start_ans__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.StartAns",
+ "StartAns",
+ "Injector__StartAns",
+ "injector",
+ sizeof(Injector__StartAns),
+ 1,
+ injector__start_ans__field_descriptors,
+ injector__start_ans__field_indices_by_name,
+ 1, injector__start_ans__number_ranges,
+ (ProtobufCMessageInit) injector__start_ans__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor injector__set_event_status__field_descriptors[2] =
+{
+ {
+ "event",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SetEventStatus, event),
+ &injector__event__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "status",
+ 2,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SetEventStatus, status),
+ &injector__status__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__set_event_status__field_indices_by_name[] = {
+ 0, /* field[0] = event */
+ 1, /* field[1] = status */
+};
+static const ProtobufCIntRange injector__set_event_status__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 2 }
+};
+const ProtobufCMessageDescriptor injector__set_event_status__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.SetEventStatus",
+ "SetEventStatus",
+ "Injector__SetEventStatus",
+ "injector",
+ sizeof(Injector__SetEventStatus),
+ 2,
+ injector__set_event_status__field_descriptors,
+ injector__set_event_status__field_indices_by_name,
+ 1, injector__set_event_status__number_ranges,
+ (ProtobufCMessageInit) injector__set_event_status__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+const ProtobufCEnumValue injector__event_msg__type__enum_values_by_number[4] =
+{
+ { "START_REQ", "INJECTOR__EVENT_MSG__TYPE__START_REQ", 2 },
+ { "START_ANS", "INJECTOR__EVENT_MSG__TYPE__START_ANS", 3 },
+ { "TERMINATE", "INJECTOR__EVENT_MSG__TYPE__TERMINATE", 4 },
+ { "EVENT_STATUS", "INJECTOR__EVENT_MSG__TYPE__EVENT_STATUS", 5 },
+};
+static const ProtobufCIntRange injector__event_msg__type__value_ranges[] = {
+{2, 0},{0, 4}
+};
+const ProtobufCEnumValueIndex injector__event_msg__type__enum_values_by_name[4] =
+{
+ { "EVENT_STATUS", 3 },
+ { "START_ANS", 1 },
+ { "START_REQ", 0 },
+ { "TERMINATE", 2 },
+};
+const ProtobufCEnumDescriptor injector__event_msg__type__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.EventMsg.TYPE",
+ "TYPE",
+ "Injector__EventMsg__TYPE",
+ "injector",
+ 4,
+ injector__event_msg__type__enum_values_by_number,
+ 4,
+ injector__event_msg__type__enum_values_by_name,
+ 1,
+ injector__event_msg__type__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+static const ProtobufCFieldDescriptor injector__event_msg__field_descriptors[5] =
+{
+ {
+ "type",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__EventMsg, type),
+ &injector__event_msg__type__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "startReq",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__EventMsg, startreq),
+ &injector__start_req__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "startAns",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__EventMsg, startans),
+ &injector__start_ans__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "terminate",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__EventMsg, terminate),
+ &injector__event_terminate__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "setStatus",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__EventMsg, setstatus),
+ &injector__set_event_status__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__event_msg__field_indices_by_name[] = {
+ 4, /* field[4] = setStatus */
+ 2, /* field[2] = startAns */
+ 1, /* field[1] = startReq */
+ 3, /* field[3] = terminate */
+ 0, /* field[0] = type */
+};
+static const ProtobufCIntRange injector__event_msg__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 5 }
+};
+const ProtobufCMessageDescriptor injector__event_msg__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.EventMsg",
+ "EventMsg",
+ "Injector__EventMsg",
+ "injector",
+ sizeof(Injector__EventMsg),
+ 5,
+ injector__event_msg__field_descriptors,
+ injector__event_msg__field_indices_by_name,
+ 1, injector__event_msg__number_ranges,
+ (ProtobufCMessageInit) injector__event_msg__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+#define injector__event_terminate__field_descriptors NULL
+#define injector__event_terminate__field_indices_by_name NULL
+#define injector__event_terminate__number_ranges NULL
+const ProtobufCMessageDescriptor injector__event_terminate__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.EventTerminate",
+ "EventTerminate",
+ "Injector__EventTerminate",
+ "injector",
+ sizeof(Injector__EventTerminate),
+ 0,
+ injector__event_terminate__field_descriptors,
+ injector__event_terminate__field_indices_by_name,
+ 0, injector__event_terminate__number_ranges,
+ (ProtobufCMessageInit) injector__event_terminate__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor injector__set_sensor_status__field_descriptors[2] =
+{
+ {
+ "sensor",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SetSensorStatus, sensor),
+ &injector__sensor_type__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "status",
+ 2,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SetSensorStatus, status),
+ &injector__status__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__set_sensor_status__field_indices_by_name[] = {
+ 0, /* field[0] = sensor */
+ 1, /* field[1] = status */
+};
+static const ProtobufCIntRange injector__set_sensor_status__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 2 }
+};
+const ProtobufCMessageDescriptor injector__set_sensor_status__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.SetSensorStatus",
+ "SetSensorStatus",
+ "Injector__SetSensorStatus",
+ "injector",
+ sizeof(Injector__SetSensorStatus),
+ 2,
+ injector__set_sensor_status__field_descriptors,
+ injector__set_sensor_status__field_indices_by_name,
+ 1, injector__set_sensor_status__number_ranges,
+ (ProtobufCMessageInit) injector__set_sensor_status__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+char injector__sensor_data__x__default_value[] = "0";
+char injector__sensor_data__y__default_value[] = "0";
+char injector__sensor_data__z__default_value[] = "0";
+static const ProtobufCFieldDescriptor injector__sensor_data__field_descriptors[4] =
+{
+ {
+ "sensor",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorData, sensor),
+ &injector__sensor_type__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "x",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_STRING,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorData, x),
+ NULL,
+ &injector__sensor_data__x__default_value,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "y",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_STRING,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorData, y),
+ NULL,
+ &injector__sensor_data__y__default_value,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "z",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_STRING,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorData, z),
+ NULL,
+ &injector__sensor_data__z__default_value,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__sensor_data__field_indices_by_name[] = {
+ 0, /* field[0] = sensor */
+ 1, /* field[1] = x */
+ 2, /* field[2] = y */
+ 3, /* field[3] = z */
+};
+static const ProtobufCIntRange injector__sensor_data__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 4 }
+};
+const ProtobufCMessageDescriptor injector__sensor_data__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.SensorData",
+ "SensorData",
+ "Injector__SensorData",
+ "injector",
+ sizeof(Injector__SensorData),
+ 4,
+ injector__sensor_data__field_descriptors,
+ injector__sensor_data__field_indices_by_name,
+ 1, injector__sensor_data__number_ranges,
+ (ProtobufCMessageInit) injector__sensor_data__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+const ProtobufCEnumValue injector__sensor_msg__type__enum_values_by_number[5] =
+{
+ { "START_REQ", "INJECTOR__SENSOR_MSG__TYPE__START_REQ", 2 },
+ { "START_ANS", "INJECTOR__SENSOR_MSG__TYPE__START_ANS", 3 },
+ { "TERMINATE", "INJECTOR__SENSOR_MSG__TYPE__TERMINATE", 4 },
+ { "SENSOR_STATUS", "INJECTOR__SENSOR_MSG__TYPE__SENSOR_STATUS", 5 },
+ { "SENSOR_DATA", "INJECTOR__SENSOR_MSG__TYPE__SENSOR_DATA", 6 },
+};
+static const ProtobufCIntRange injector__sensor_msg__type__value_ranges[] = {
+{2, 0},{0, 5}
+};
+const ProtobufCEnumValueIndex injector__sensor_msg__type__enum_values_by_name[5] =
+{
+ { "SENSOR_DATA", 4 },
+ { "SENSOR_STATUS", 3 },
+ { "START_ANS", 1 },
+ { "START_REQ", 0 },
+ { "TERMINATE", 2 },
+};
+const ProtobufCEnumDescriptor injector__sensor_msg__type__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.SensorMsg.Type",
+ "Type",
+ "Injector__SensorMsg__Type",
+ "injector",
+ 5,
+ injector__sensor_msg__type__enum_values_by_number,
+ 5,
+ injector__sensor_msg__type__enum_values_by_name,
+ 1,
+ injector__sensor_msg__type__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+static const ProtobufCFieldDescriptor injector__sensor_msg__field_descriptors[6] =
+{
+ {
+ "type",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorMsg, type),
+ &injector__sensor_msg__type__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "startReq",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorMsg, startreq),
+ &injector__start_req__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "startAns",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorMsg, startans),
+ &injector__start_ans__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "terminate",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorMsg, terminate),
+ &injector__event_terminate__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "setStatus",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorMsg, setstatus),
+ &injector__set_sensor_status__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "data",
+ 6,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__SensorMsg, data),
+ &injector__sensor_data__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__sensor_msg__field_indices_by_name[] = {
+ 5, /* field[5] = data */
+ 4, /* field[4] = setStatus */
+ 2, /* field[2] = startAns */
+ 1, /* field[1] = startReq */
+ 3, /* field[3] = terminate */
+ 0, /* field[0] = type */
+};
+static const ProtobufCIntRange injector__sensor_msg__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 6 }
+};
+const ProtobufCMessageDescriptor injector__sensor_msg__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.SensorMsg",
+ "SensorMsg",
+ "Injector__SensorMsg",
+ "injector",
+ sizeof(Injector__SensorMsg),
+ 6,
+ injector__sensor_msg__field_descriptors,
+ injector__sensor_msg__field_indices_by_name,
+ 1, injector__sensor_msg__number_ranges,
+ (ProtobufCMessageInit) injector__sensor_msg__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const int32_t injector__multi_touch_max_count__max__default_value = 10;
+static const ProtobufCFieldDescriptor injector__multi_touch_max_count__field_descriptors[1] =
+{
+ {
+ "max",
+ 1,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_INT32,
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchMaxCount, has_max),
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchMaxCount, max),
+ NULL,
+ &injector__multi_touch_max_count__max__default_value,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__multi_touch_max_count__field_indices_by_name[] = {
+ 0, /* field[0] = max */
+};
+static const ProtobufCIntRange injector__multi_touch_max_count__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 1 }
+};
+const ProtobufCMessageDescriptor injector__multi_touch_max_count__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.MultiTouchMaxCount",
+ "MultiTouchMaxCount",
+ "Injector__MultiTouchMaxCount",
+ "injector",
+ sizeof(Injector__MultiTouchMaxCount),
+ 1,
+ injector__multi_touch_max_count__field_descriptors,
+ injector__multi_touch_max_count__field_indices_by_name,
+ 1, injector__multi_touch_max_count__number_ranges,
+ (ProtobufCMessageInit) injector__multi_touch_max_count__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const int32_t injector__multi_touch_data__index__default_value = 0;
+static const float injector__multi_touch_data__x_point__default_value = 0;
+static const float injector__multi_touch_data__y_point__default_value = 0;
+static const ProtobufCFieldDescriptor injector__multi_touch_data__field_descriptors[4] =
+{
+ {
+ "index",
+ 1,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_INT32,
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchData, has_index),
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchData, index),
+ NULL,
+ &injector__multi_touch_data__index__default_value,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "xPoint",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_FLOAT,
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchData, has_xpoint),
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchData, xpoint),
+ NULL,
+ &injector__multi_touch_data__x_point__default_value,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "yPoint",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_FLOAT,
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchData, has_ypoint),
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchData, ypoint),
+ NULL,
+ &injector__multi_touch_data__y_point__default_value,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "status",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_ENUM,
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchData, has_status),
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchData, status),
+ &injector__touch_status__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__multi_touch_data__field_indices_by_name[] = {
+ 0, /* field[0] = index */
+ 3, /* field[3] = status */
+ 1, /* field[1] = xPoint */
+ 2, /* field[2] = yPoint */
+};
+static const ProtobufCIntRange injector__multi_touch_data__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 4 }
+};
+const ProtobufCMessageDescriptor injector__multi_touch_data__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.MultiTouchData",
+ "MultiTouchData",
+ "Injector__MultiTouchData",
+ "injector",
+ sizeof(Injector__MultiTouchData),
+ 4,
+ injector__multi_touch_data__field_descriptors,
+ injector__multi_touch_data__field_indices_by_name,
+ 1, injector__multi_touch_data__number_ranges,
+ (ProtobufCMessageInit) injector__multi_touch_data__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+const ProtobufCEnumValue injector__multi_touch_msg__type__enum_values_by_number[5] =
+{
+ { "START_REQ", "INJECTOR__MULTI_TOUCH_MSG__TYPE__START_REQ", 2 },
+ { "START_ANS", "INJECTOR__MULTI_TOUCH_MSG__TYPE__START_ANS", 3 },
+ { "TERMINATE", "INJECTOR__MULTI_TOUCH_MSG__TYPE__TERMINATE", 4 },
+ { "MAX_COUNT", "INJECTOR__MULTI_TOUCH_MSG__TYPE__MAX_COUNT", 5 },
+ { "TOUCH_DATA", "INJECTOR__MULTI_TOUCH_MSG__TYPE__TOUCH_DATA", 6 },
+};
+static const ProtobufCIntRange injector__multi_touch_msg__type__value_ranges[] = {
+{2, 0},{0, 5}
+};
+const ProtobufCEnumValueIndex injector__multi_touch_msg__type__enum_values_by_name[5] =
+{
+ { "MAX_COUNT", 3 },
+ { "START_ANS", 1 },
+ { "START_REQ", 0 },
+ { "TERMINATE", 2 },
+ { "TOUCH_DATA", 4 },
+};
+const ProtobufCEnumDescriptor injector__multi_touch_msg__type__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.MultiTouchMsg.Type",
+ "Type",
+ "Injector__MultiTouchMsg__Type",
+ "injector",
+ 5,
+ injector__multi_touch_msg__type__enum_values_by_number,
+ 5,
+ injector__multi_touch_msg__type__enum_values_by_name,
+ 1,
+ injector__multi_touch_msg__type__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+static const ProtobufCFieldDescriptor injector__multi_touch_msg__field_descriptors[6] =
+{
+ {
+ "type",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchMsg, type),
+ &injector__multi_touch_msg__type__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "startReq",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchMsg, startreq),
+ &injector__start_req__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "startAns",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchMsg, startans),
+ &injector__start_ans__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "terminate",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchMsg, terminate),
+ &injector__event_terminate__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "maxCount",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchMsg, maxcount),
+ &injector__multi_touch_max_count__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "touchData",
+ 6,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__MultiTouchMsg, touchdata),
+ &injector__multi_touch_data__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__multi_touch_msg__field_indices_by_name[] = {
+ 4, /* field[4] = maxCount */
+ 2, /* field[2] = startAns */
+ 1, /* field[1] = startReq */
+ 3, /* field[3] = terminate */
+ 5, /* field[5] = touchData */
+ 0, /* field[0] = type */
+};
+static const ProtobufCIntRange injector__multi_touch_msg__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 6 }
+};
+const ProtobufCMessageDescriptor injector__multi_touch_msg__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.MultiTouchMsg",
+ "MultiTouchMsg",
+ "Injector__MultiTouchMsg",
+ "injector",
+ sizeof(Injector__MultiTouchMsg),
+ 6,
+ injector__multi_touch_msg__field_descriptors,
+ injector__multi_touch_msg__field_indices_by_name,
+ 1, injector__multi_touch_msg__number_ranges,
+ (ProtobufCMessageInit) injector__multi_touch_msg__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+const ProtobufCEnumValue injector__injector_msg__type__enum_values_by_number[7] =
+{
+ { "HANDSHAKE_REQ", "INJECTOR__INJECTOR_MSG__TYPE__HANDSHAKE_REQ", 2 },
+ { "HANDSHAKE_ANS", "INJECTOR__INJECTOR_MSG__TYPE__HANDSHAKE_ANS", 3 },
+ { "EMUL_STATE", "INJECTOR__INJECTOR_MSG__TYPE__EMUL_STATE", 4 },
+ { "APP_STATE", "INJECTOR__INJECTOR_MSG__TYPE__APP_STATE", 5 },
+ { "EVENT_MSG", "INJECTOR__INJECTOR_MSG__TYPE__EVENT_MSG", 6 },
+ { "SENSOR_MSG", "INJECTOR__INJECTOR_MSG__TYPE__SENSOR_MSG", 7 },
+ { "TOUCH_MSG", "INJECTOR__INJECTOR_MSG__TYPE__TOUCH_MSG", 8 },
+};
+static const ProtobufCIntRange injector__injector_msg__type__value_ranges[] = {
+{2, 0},{0, 7}
+};
+const ProtobufCEnumValueIndex injector__injector_msg__type__enum_values_by_name[7] =
+{
+ { "APP_STATE", 3 },
+ { "EMUL_STATE", 2 },
+ { "EVENT_MSG", 4 },
+ { "HANDSHAKE_ANS", 1 },
+ { "HANDSHAKE_REQ", 0 },
+ { "SENSOR_MSG", 5 },
+ { "TOUCH_MSG", 6 },
+};
+const ProtobufCEnumDescriptor injector__injector_msg__type__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.InjectorMsg.Type",
+ "Type",
+ "Injector__InjectorMsg__Type",
+ "injector",
+ 7,
+ injector__injector_msg__type__enum_values_by_number,
+ 7,
+ injector__injector_msg__type__enum_values_by_name,
+ 1,
+ injector__injector_msg__type__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+static const ProtobufCFieldDescriptor injector__injector_msg__field_descriptors[8] =
+{
+ {
+ "type",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_ENUM,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__InjectorMsg, type),
+ &injector__injector_msg__type__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "handShakeReq",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__InjectorMsg, handshakereq),
+ &injector__hand_shake_req__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "handShakeAns",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__InjectorMsg, handshakeans),
+ &injector__hand_shake_ans__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "emulState",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__InjectorMsg, emulstate),
+ &injector__emulator_state__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "appState",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__InjectorMsg, appstate),
+ &injector__app_state__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "eventMsg",
+ 6,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__InjectorMsg, eventmsg),
+ &injector__event_msg__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "sensorMsg",
+ 7,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__InjectorMsg, sensormsg),
+ &injector__sensor_msg__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "touchMsg",
+ 8,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_MESSAGE,
+ 0, /* quantifier_offset */
+ PROTOBUF_C_OFFSETOF(Injector__InjectorMsg, touchmsg),
+ &injector__multi_touch_msg__descriptor,
+ NULL,
+ 0, /* packed */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned injector__injector_msg__field_indices_by_name[] = {
+ 4, /* field[4] = appState */
+ 3, /* field[3] = emulState */
+ 5, /* field[5] = eventMsg */
+ 2, /* field[2] = handShakeAns */
+ 1, /* field[1] = handShakeReq */
+ 6, /* field[6] = sensorMsg */
+ 7, /* field[7] = touchMsg */
+ 0, /* field[0] = type */
+};
+static const ProtobufCIntRange injector__injector_msg__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 8 }
+};
+const ProtobufCMessageDescriptor injector__injector_msg__descriptor =
+{
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+ "injector.InjectorMsg",
+ "InjectorMsg",
+ "Injector__InjectorMsg",
+ "injector",
+ sizeof(Injector__InjectorMsg),
+ 8,
+ injector__injector_msg__field_descriptors,
+ injector__injector_msg__field_indices_by_name,
+ 1, injector__injector_msg__number_ranges,
+ (ProtobufCMessageInit) injector__injector_msg__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+const ProtobufCEnumValue injector__result__enum_values_by_number[3] =
+{
+ { "SUCCESS", "INJECTOR__RESULT__SUCCESS", 1 },
+ { "FAILURE", "INJECTOR__RESULT__FAILURE", 2 },
+ { "CANCEL", "INJECTOR__RESULT__CANCEL", 3 },
+};
+static const ProtobufCIntRange injector__result__value_ranges[] = {
+{1, 0},{0, 3}
+};
+const ProtobufCEnumValueIndex injector__result__enum_values_by_name[3] =
+{
+ { "CANCEL", 2 },
+ { "FAILURE", 1 },
+ { "SUCCESS", 0 },
+};
+const ProtobufCEnumDescriptor injector__result__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.Result",
+ "Result",
+ "Injector__Result",
+ "injector",
+ 3,
+ injector__result__enum_values_by_number,
+ 3,
+ injector__result__enum_values_by_name,
+ 1,
+ injector__result__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+const ProtobufCEnumValue injector__connection_state__enum_values_by_number[3] =
+{
+ { "CONNECT", "INJECTOR__CONNECTION_STATE__CONNECT", 1 },
+ { "DISCONNECT", "INJECTOR__CONNECTION_STATE__DISCONNECT", 2 },
+ { "TERMINATE", "INJECTOR__CONNECTION_STATE__TERMINATE", 3 },
+};
+static const ProtobufCIntRange injector__connection_state__value_ranges[] = {
+{1, 0},{0, 3}
+};
+const ProtobufCEnumValueIndex injector__connection_state__enum_values_by_name[3] =
+{
+ { "CONNECT", 0 },
+ { "DISCONNECT", 1 },
+ { "TERMINATE", 2 },
+};
+const ProtobufCEnumDescriptor injector__connection_state__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.ConnectionState",
+ "ConnectionState",
+ "Injector__ConnectionState",
+ "injector",
+ 3,
+ injector__connection_state__enum_values_by_number,
+ 3,
+ injector__connection_state__enum_values_by_name,
+ 1,
+ injector__connection_state__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+const ProtobufCEnumValue injector__event__enum_values_by_number[2] =
+{
+ { "SENSOR", "INJECTOR__EVENT__SENSOR", 1 },
+ { "MULTITOUCH", "INJECTOR__EVENT__MULTITOUCH", 2 },
+};
+static const ProtobufCIntRange injector__event__value_ranges[] = {
+{1, 0},{0, 2}
+};
+const ProtobufCEnumValueIndex injector__event__enum_values_by_name[2] =
+{
+ { "MULTITOUCH", 1 },
+ { "SENSOR", 0 },
+};
+const ProtobufCEnumDescriptor injector__event__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.Event",
+ "Event",
+ "Injector__Event",
+ "injector",
+ 2,
+ injector__event__enum_values_by_number,
+ 2,
+ injector__event__enum_values_by_name,
+ 1,
+ injector__event__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+const ProtobufCEnumValue injector__status__enum_values_by_number[2] =
+{
+ { "ENABLE", "INJECTOR__STATUS__ENABLE", 1 },
+ { "DISABLE", "INJECTOR__STATUS__DISABLE", 2 },
+};
+static const ProtobufCIntRange injector__status__value_ranges[] = {
+{1, 0},{0, 2}
+};
+const ProtobufCEnumValueIndex injector__status__enum_values_by_name[2] =
+{
+ { "DISABLE", 1 },
+ { "ENABLE", 0 },
+};
+const ProtobufCEnumDescriptor injector__status__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.Status",
+ "Status",
+ "Injector__Status",
+ "injector",
+ 2,
+ injector__status__enum_values_by_number,
+ 2,
+ injector__status__enum_values_by_name,
+ 1,
+ injector__status__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+const ProtobufCEnumValue injector__sensor_type__enum_values_by_number[5] =
+{
+ { "ACCEL", "INJECTOR__SENSOR_TYPE__ACCEL", 1 },
+ { "MAGNETIC", "INJECTOR__SENSOR_TYPE__MAGNETIC", 2 },
+ { "GYROSCOPE", "INJECTOR__SENSOR_TYPE__GYROSCOPE", 3 },
+ { "PROXIMITY", "INJECTOR__SENSOR_TYPE__PROXIMITY", 4 },
+ { "LIGHT", "INJECTOR__SENSOR_TYPE__LIGHT", 5 },
+};
+static const ProtobufCIntRange injector__sensor_type__value_ranges[] = {
+{1, 0},{0, 5}
+};
+const ProtobufCEnumValueIndex injector__sensor_type__enum_values_by_name[5] =
+{
+ { "ACCEL", 0 },
+ { "GYROSCOPE", 2 },
+ { "LIGHT", 4 },
+ { "MAGNETIC", 1 },
+ { "PROXIMITY", 3 },
+};
+const ProtobufCEnumDescriptor injector__sensor_type__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.SensorType",
+ "SensorType",
+ "Injector__SensorType",
+ "injector",
+ 5,
+ injector__sensor_type__enum_values_by_number,
+ 5,
+ injector__sensor_type__enum_values_by_name,
+ 1,
+ injector__sensor_type__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
+const ProtobufCEnumValue injector__touch_status__enum_values_by_number[2] =
+{
+ { "PRESS", "INJECTOR__TOUCH_STATUS__PRESS", 1 },
+ { "RELEASE", "INJECTOR__TOUCH_STATUS__RELEASE", 2 },
+};
+static const ProtobufCIntRange injector__touch_status__value_ranges[] = {
+{1, 0},{0, 2}
+};
+const ProtobufCEnumValueIndex injector__touch_status__enum_values_by_name[2] =
+{
+ { "PRESS", 0 },
+ { "RELEASE", 1 },
+};
+const ProtobufCEnumDescriptor injector__touch_status__descriptor =
+{
+ PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+ "injector.TouchStatus",
+ "TouchStatus",
+ "Injector__TouchStatus",
+ "injector",
+ 2,
+ injector__touch_status__enum_values_by_number,
+ 2,
+ injector__touch_status__enum_values_by_name,
+ 1,
+ injector__touch_status__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
--- /dev/null
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+
+#ifndef PROTOBUF_C_tethering_2eproto__INCLUDED
+#define PROTOBUF_C_tethering_2eproto__INCLUDED
+
+#include "../../../distrib/protobuf/protobuf-c.h"
+
+PROTOBUF_C_BEGIN_DECLS
+
+
+typedef struct _Injector__HandShakeReq Injector__HandShakeReq;
+typedef struct _Injector__HandShakeAns Injector__HandShakeAns;
+typedef struct _Injector__EmulatorState Injector__EmulatorState;
+typedef struct _Injector__AppState Injector__AppState;
+typedef struct _Injector__StartReq Injector__StartReq;
+typedef struct _Injector__StartAns Injector__StartAns;
+typedef struct _Injector__SetEventStatus Injector__SetEventStatus;
+typedef struct _Injector__EventMsg Injector__EventMsg;
+typedef struct _Injector__EventTerminate Injector__EventTerminate;
+typedef struct _Injector__SetSensorStatus Injector__SetSensorStatus;
+typedef struct _Injector__SensorData Injector__SensorData;
+typedef struct _Injector__SensorMsg Injector__SensorMsg;
+typedef struct _Injector__MultiTouchMaxCount Injector__MultiTouchMaxCount;
+typedef struct _Injector__MultiTouchData Injector__MultiTouchData;
+typedef struct _Injector__MultiTouchMsg Injector__MultiTouchMsg;
+typedef struct _Injector__InjectorMsg Injector__InjectorMsg;
+
+
+/* --- enums --- */
+
+typedef enum _Injector__EventMsg__TYPE {
+ INJECTOR__EVENT_MSG__TYPE__START_REQ = 2,
+ INJECTOR__EVENT_MSG__TYPE__START_ANS = 3,
+ INJECTOR__EVENT_MSG__TYPE__TERMINATE = 4,
+ INJECTOR__EVENT_MSG__TYPE__EVENT_STATUS = 5
+} Injector__EventMsg__TYPE;
+typedef enum _Injector__SensorMsg__Type {
+ INJECTOR__SENSOR_MSG__TYPE__START_REQ = 2,
+ INJECTOR__SENSOR_MSG__TYPE__START_ANS = 3,
+ INJECTOR__SENSOR_MSG__TYPE__TERMINATE = 4,
+ INJECTOR__SENSOR_MSG__TYPE__SENSOR_STATUS = 5,
+ INJECTOR__SENSOR_MSG__TYPE__SENSOR_DATA = 6
+} Injector__SensorMsg__Type;
+typedef enum _Injector__MultiTouchMsg__Type {
+ INJECTOR__MULTI_TOUCH_MSG__TYPE__START_REQ = 2,
+ INJECTOR__MULTI_TOUCH_MSG__TYPE__START_ANS = 3,
+ INJECTOR__MULTI_TOUCH_MSG__TYPE__TERMINATE = 4,
+ INJECTOR__MULTI_TOUCH_MSG__TYPE__MAX_COUNT = 5,
+ INJECTOR__MULTI_TOUCH_MSG__TYPE__TOUCH_DATA = 6
+} Injector__MultiTouchMsg__Type;
+typedef enum _Injector__InjectorMsg__Type {
+ INJECTOR__INJECTOR_MSG__TYPE__HANDSHAKE_REQ = 2,
+ INJECTOR__INJECTOR_MSG__TYPE__HANDSHAKE_ANS = 3,
+ INJECTOR__INJECTOR_MSG__TYPE__EMUL_STATE = 4,
+ INJECTOR__INJECTOR_MSG__TYPE__APP_STATE = 5,
+ INJECTOR__INJECTOR_MSG__TYPE__EVENT_MSG = 6,
+ INJECTOR__INJECTOR_MSG__TYPE__SENSOR_MSG = 7,
+ INJECTOR__INJECTOR_MSG__TYPE__TOUCH_MSG = 8
+} Injector__InjectorMsg__Type;
+typedef enum _Injector__Result {
+ INJECTOR__RESULT__SUCCESS = 1,
+ INJECTOR__RESULT__FAILURE = 2,
+ INJECTOR__RESULT__CANCEL = 3
+} Injector__Result;
+typedef enum _Injector__ConnectionState {
+ INJECTOR__CONNECTION_STATE__CONNECT = 1,
+ INJECTOR__CONNECTION_STATE__DISCONNECT = 2,
+ INJECTOR__CONNECTION_STATE__TERMINATE = 3
+} Injector__ConnectionState;
+typedef enum _Injector__Event {
+ INJECTOR__EVENT__SENSOR = 1,
+ INJECTOR__EVENT__MULTITOUCH = 2
+} Injector__Event;
+typedef enum _Injector__Status {
+ INJECTOR__STATUS__ENABLE = 1,
+ INJECTOR__STATUS__DISABLE = 2
+} Injector__Status;
+typedef enum _Injector__SensorType {
+ INJECTOR__SENSOR_TYPE__ACCEL = 1,
+ INJECTOR__SENSOR_TYPE__MAGNETIC = 2,
+ INJECTOR__SENSOR_TYPE__GYROSCOPE = 3,
+ INJECTOR__SENSOR_TYPE__PROXIMITY = 4,
+ INJECTOR__SENSOR_TYPE__LIGHT = 5
+} Injector__SensorType;
+typedef enum _Injector__TouchStatus {
+ INJECTOR__TOUCH_STATUS__PRESS = 1,
+ INJECTOR__TOUCH_STATUS__RELEASE = 2
+} Injector__TouchStatus;
+
+/* --- messages --- */
+
+struct _Injector__HandShakeReq
+{
+ ProtobufCMessage base;
+ int32_t key;
+};
+#define INJECTOR__HAND_SHAKE_REQ__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__hand_shake_req__descriptor) \
+ , 0 }
+
+
+struct _Injector__HandShakeAns
+{
+ ProtobufCMessage base;
+ Injector__Result result;
+};
+#define INJECTOR__HAND_SHAKE_ANS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__hand_shake_ans__descriptor) \
+ , 0 }
+
+
+struct _Injector__EmulatorState
+{
+ ProtobufCMessage base;
+ Injector__ConnectionState state;
+};
+#define INJECTOR__EMULATOR_STATE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__emulator_state__descriptor) \
+ , 0 }
+
+
+struct _Injector__AppState
+{
+ ProtobufCMessage base;
+ Injector__ConnectionState state;
+};
+#define INJECTOR__APP_STATE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__app_state__descriptor) \
+ , 0 }
+
+
+struct _Injector__StartReq
+{
+ ProtobufCMessage base;
+};
+#define INJECTOR__START_REQ__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__start_req__descriptor) \
+ }
+
+
+struct _Injector__StartAns
+{
+ ProtobufCMessage base;
+ Injector__Result result;
+};
+#define INJECTOR__START_ANS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__start_ans__descriptor) \
+ , 0 }
+
+
+struct _Injector__SetEventStatus
+{
+ ProtobufCMessage base;
+ Injector__Event event;
+ Injector__Status status;
+};
+#define INJECTOR__SET_EVENT_STATUS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__set_event_status__descriptor) \
+ , 0, 0 }
+
+
+struct _Injector__EventMsg
+{
+ ProtobufCMessage base;
+ Injector__EventMsg__TYPE type;
+ Injector__StartReq *startreq;
+ Injector__StartAns *startans;
+ Injector__EventTerminate *terminate;
+ Injector__SetEventStatus *setstatus;
+};
+#define INJECTOR__EVENT_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__event_msg__descriptor) \
+ , 0, NULL, NULL, NULL, NULL }
+
+
+struct _Injector__EventTerminate
+{
+ ProtobufCMessage base;
+};
+#define INJECTOR__EVENT_TERMINATE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__event_terminate__descriptor) \
+ }
+
+
+struct _Injector__SetSensorStatus
+{
+ ProtobufCMessage base;
+ Injector__SensorType sensor;
+ Injector__Status status;
+};
+#define INJECTOR__SET_SENSOR_STATUS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__set_sensor_status__descriptor) \
+ , 0, 0 }
+
+
+struct _Injector__SensorData
+{
+ ProtobufCMessage base;
+ Injector__SensorType sensor;
+ char *x;
+ char *y;
+ char *z;
+};
+extern char injector__sensor_data__x__default_value[];
+extern char injector__sensor_data__y__default_value[];
+extern char injector__sensor_data__z__default_value[];
+#define INJECTOR__SENSOR_DATA__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__sensor_data__descriptor) \
+ , 0, injector__sensor_data__x__default_value, injector__sensor_data__y__default_value, injector__sensor_data__z__default_value }
+
+
+struct _Injector__SensorMsg
+{
+ ProtobufCMessage base;
+ Injector__SensorMsg__Type type;
+ Injector__StartReq *startreq;
+ Injector__StartAns *startans;
+ Injector__EventTerminate *terminate;
+ Injector__SetSensorStatus *setstatus;
+ Injector__SensorData *data;
+};
+#define INJECTOR__SENSOR_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__sensor_msg__descriptor) \
+ , 0, NULL, NULL, NULL, NULL, NULL }
+
+
+struct _Injector__MultiTouchMaxCount
+{
+ ProtobufCMessage base;
+ protobuf_c_boolean has_max;
+ int32_t max;
+};
+#define INJECTOR__MULTI_TOUCH_MAX_COUNT__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__multi_touch_max_count__descriptor) \
+ , 0,10 }
+
+
+struct _Injector__MultiTouchData
+{
+ ProtobufCMessage base;
+ protobuf_c_boolean has_index;
+ int32_t index;
+ protobuf_c_boolean has_xpoint;
+ float xpoint;
+ protobuf_c_boolean has_ypoint;
+ float ypoint;
+ protobuf_c_boolean has_status;
+ Injector__TouchStatus status;
+};
+#define INJECTOR__MULTI_TOUCH_DATA__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__multi_touch_data__descriptor) \
+ , 0,0, 0,0, 0,0, 0,0 }
+
+
+struct _Injector__MultiTouchMsg
+{
+ ProtobufCMessage base;
+ Injector__MultiTouchMsg__Type type;
+ Injector__StartReq *startreq;
+ Injector__StartAns *startans;
+ Injector__EventTerminate *terminate;
+ Injector__MultiTouchMaxCount *maxcount;
+ Injector__MultiTouchData *touchdata;
+};
+#define INJECTOR__MULTI_TOUCH_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__multi_touch_msg__descriptor) \
+ , 0, NULL, NULL, NULL, NULL, NULL }
+
+
+struct _Injector__InjectorMsg
+{
+ ProtobufCMessage base;
+ Injector__InjectorMsg__Type type;
+ Injector__HandShakeReq *handshakereq;
+ Injector__HandShakeAns *handshakeans;
+ Injector__EmulatorState *emulstate;
+ Injector__AppState *appstate;
+ Injector__EventMsg *eventmsg;
+ Injector__SensorMsg *sensormsg;
+ Injector__MultiTouchMsg *touchmsg;
+};
+#define INJECTOR__INJECTOR_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&injector__injector_msg__descriptor) \
+ , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+
+
+/* Injector__HandShakeReq methods */
+void injector__hand_shake_req__init
+ (Injector__HandShakeReq *message);
+size_t injector__hand_shake_req__get_packed_size
+ (const Injector__HandShakeReq *message);
+size_t injector__hand_shake_req__pack
+ (const Injector__HandShakeReq *message,
+ uint8_t *out);
+size_t injector__hand_shake_req__pack_to_buffer
+ (const Injector__HandShakeReq *message,
+ ProtobufCBuffer *buffer);
+Injector__HandShakeReq *
+ injector__hand_shake_req__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__hand_shake_req__free_unpacked
+ (Injector__HandShakeReq *message,
+ ProtobufCAllocator *allocator);
+/* Injector__HandShakeAns methods */
+void injector__hand_shake_ans__init
+ (Injector__HandShakeAns *message);
+size_t injector__hand_shake_ans__get_packed_size
+ (const Injector__HandShakeAns *message);
+size_t injector__hand_shake_ans__pack
+ (const Injector__HandShakeAns *message,
+ uint8_t *out);
+size_t injector__hand_shake_ans__pack_to_buffer
+ (const Injector__HandShakeAns *message,
+ ProtobufCBuffer *buffer);
+Injector__HandShakeAns *
+ injector__hand_shake_ans__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__hand_shake_ans__free_unpacked
+ (Injector__HandShakeAns *message,
+ ProtobufCAllocator *allocator);
+/* Injector__EmulatorState methods */
+void injector__emulator_state__init
+ (Injector__EmulatorState *message);
+size_t injector__emulator_state__get_packed_size
+ (const Injector__EmulatorState *message);
+size_t injector__emulator_state__pack
+ (const Injector__EmulatorState *message,
+ uint8_t *out);
+size_t injector__emulator_state__pack_to_buffer
+ (const Injector__EmulatorState *message,
+ ProtobufCBuffer *buffer);
+Injector__EmulatorState *
+ injector__emulator_state__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__emulator_state__free_unpacked
+ (Injector__EmulatorState *message,
+ ProtobufCAllocator *allocator);
+/* Injector__AppState methods */
+void injector__app_state__init
+ (Injector__AppState *message);
+size_t injector__app_state__get_packed_size
+ (const Injector__AppState *message);
+size_t injector__app_state__pack
+ (const Injector__AppState *message,
+ uint8_t *out);
+size_t injector__app_state__pack_to_buffer
+ (const Injector__AppState *message,
+ ProtobufCBuffer *buffer);
+Injector__AppState *
+ injector__app_state__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__app_state__free_unpacked
+ (Injector__AppState *message,
+ ProtobufCAllocator *allocator);
+/* Injector__StartReq methods */
+void injector__start_req__init
+ (Injector__StartReq *message);
+size_t injector__start_req__get_packed_size
+ (const Injector__StartReq *message);
+size_t injector__start_req__pack
+ (const Injector__StartReq *message,
+ uint8_t *out);
+size_t injector__start_req__pack_to_buffer
+ (const Injector__StartReq *message,
+ ProtobufCBuffer *buffer);
+Injector__StartReq *
+ injector__start_req__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__start_req__free_unpacked
+ (Injector__StartReq *message,
+ ProtobufCAllocator *allocator);
+/* Injector__StartAns methods */
+void injector__start_ans__init
+ (Injector__StartAns *message);
+size_t injector__start_ans__get_packed_size
+ (const Injector__StartAns *message);
+size_t injector__start_ans__pack
+ (const Injector__StartAns *message,
+ uint8_t *out);
+size_t injector__start_ans__pack_to_buffer
+ (const Injector__StartAns *message,
+ ProtobufCBuffer *buffer);
+Injector__StartAns *
+ injector__start_ans__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__start_ans__free_unpacked
+ (Injector__StartAns *message,
+ ProtobufCAllocator *allocator);
+/* Injector__SetEventStatus methods */
+void injector__set_event_status__init
+ (Injector__SetEventStatus *message);
+size_t injector__set_event_status__get_packed_size
+ (const Injector__SetEventStatus *message);
+size_t injector__set_event_status__pack
+ (const Injector__SetEventStatus *message,
+ uint8_t *out);
+size_t injector__set_event_status__pack_to_buffer
+ (const Injector__SetEventStatus *message,
+ ProtobufCBuffer *buffer);
+Injector__SetEventStatus *
+ injector__set_event_status__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__set_event_status__free_unpacked
+ (Injector__SetEventStatus *message,
+ ProtobufCAllocator *allocator);
+/* Injector__EventMsg methods */
+void injector__event_msg__init
+ (Injector__EventMsg *message);
+size_t injector__event_msg__get_packed_size
+ (const Injector__EventMsg *message);
+size_t injector__event_msg__pack
+ (const Injector__EventMsg *message,
+ uint8_t *out);
+size_t injector__event_msg__pack_to_buffer
+ (const Injector__EventMsg *message,
+ ProtobufCBuffer *buffer);
+Injector__EventMsg *
+ injector__event_msg__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__event_msg__free_unpacked
+ (Injector__EventMsg *message,
+ ProtobufCAllocator *allocator);
+/* Injector__EventTerminate methods */
+void injector__event_terminate__init
+ (Injector__EventTerminate *message);
+size_t injector__event_terminate__get_packed_size
+ (const Injector__EventTerminate *message);
+size_t injector__event_terminate__pack
+ (const Injector__EventTerminate *message,
+ uint8_t *out);
+size_t injector__event_terminate__pack_to_buffer
+ (const Injector__EventTerminate *message,
+ ProtobufCBuffer *buffer);
+Injector__EventTerminate *
+ injector__event_terminate__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__event_terminate__free_unpacked
+ (Injector__EventTerminate *message,
+ ProtobufCAllocator *allocator);
+/* Injector__SetSensorStatus methods */
+void injector__set_sensor_status__init
+ (Injector__SetSensorStatus *message);
+size_t injector__set_sensor_status__get_packed_size
+ (const Injector__SetSensorStatus *message);
+size_t injector__set_sensor_status__pack
+ (const Injector__SetSensorStatus *message,
+ uint8_t *out);
+size_t injector__set_sensor_status__pack_to_buffer
+ (const Injector__SetSensorStatus *message,
+ ProtobufCBuffer *buffer);
+Injector__SetSensorStatus *
+ injector__set_sensor_status__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__set_sensor_status__free_unpacked
+ (Injector__SetSensorStatus *message,
+ ProtobufCAllocator *allocator);
+/* Injector__SensorData methods */
+void injector__sensor_data__init
+ (Injector__SensorData *message);
+size_t injector__sensor_data__get_packed_size
+ (const Injector__SensorData *message);
+size_t injector__sensor_data__pack
+ (const Injector__SensorData *message,
+ uint8_t *out);
+size_t injector__sensor_data__pack_to_buffer
+ (const Injector__SensorData *message,
+ ProtobufCBuffer *buffer);
+Injector__SensorData *
+ injector__sensor_data__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__sensor_data__free_unpacked
+ (Injector__SensorData *message,
+ ProtobufCAllocator *allocator);
+/* Injector__SensorMsg methods */
+void injector__sensor_msg__init
+ (Injector__SensorMsg *message);
+size_t injector__sensor_msg__get_packed_size
+ (const Injector__SensorMsg *message);
+size_t injector__sensor_msg__pack
+ (const Injector__SensorMsg *message,
+ uint8_t *out);
+size_t injector__sensor_msg__pack_to_buffer
+ (const Injector__SensorMsg *message,
+ ProtobufCBuffer *buffer);
+Injector__SensorMsg *
+ injector__sensor_msg__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__sensor_msg__free_unpacked
+ (Injector__SensorMsg *message,
+ ProtobufCAllocator *allocator);
+/* Injector__MultiTouchMaxCount methods */
+void injector__multi_touch_max_count__init
+ (Injector__MultiTouchMaxCount *message);
+size_t injector__multi_touch_max_count__get_packed_size
+ (const Injector__MultiTouchMaxCount *message);
+size_t injector__multi_touch_max_count__pack
+ (const Injector__MultiTouchMaxCount *message,
+ uint8_t *out);
+size_t injector__multi_touch_max_count__pack_to_buffer
+ (const Injector__MultiTouchMaxCount *message,
+ ProtobufCBuffer *buffer);
+Injector__MultiTouchMaxCount *
+ injector__multi_touch_max_count__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__multi_touch_max_count__free_unpacked
+ (Injector__MultiTouchMaxCount *message,
+ ProtobufCAllocator *allocator);
+/* Injector__MultiTouchData methods */
+void injector__multi_touch_data__init
+ (Injector__MultiTouchData *message);
+size_t injector__multi_touch_data__get_packed_size
+ (const Injector__MultiTouchData *message);
+size_t injector__multi_touch_data__pack
+ (const Injector__MultiTouchData *message,
+ uint8_t *out);
+size_t injector__multi_touch_data__pack_to_buffer
+ (const Injector__MultiTouchData *message,
+ ProtobufCBuffer *buffer);
+Injector__MultiTouchData *
+ injector__multi_touch_data__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__multi_touch_data__free_unpacked
+ (Injector__MultiTouchData *message,
+ ProtobufCAllocator *allocator);
+/* Injector__MultiTouchMsg methods */
+void injector__multi_touch_msg__init
+ (Injector__MultiTouchMsg *message);
+size_t injector__multi_touch_msg__get_packed_size
+ (const Injector__MultiTouchMsg *message);
+size_t injector__multi_touch_msg__pack
+ (const Injector__MultiTouchMsg *message,
+ uint8_t *out);
+size_t injector__multi_touch_msg__pack_to_buffer
+ (const Injector__MultiTouchMsg *message,
+ ProtobufCBuffer *buffer);
+Injector__MultiTouchMsg *
+ injector__multi_touch_msg__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__multi_touch_msg__free_unpacked
+ (Injector__MultiTouchMsg *message,
+ ProtobufCAllocator *allocator);
+/* Injector__InjectorMsg methods */
+void injector__injector_msg__init
+ (Injector__InjectorMsg *message);
+size_t injector__injector_msg__get_packed_size
+ (const Injector__InjectorMsg *message);
+size_t injector__injector_msg__pack
+ (const Injector__InjectorMsg *message,
+ uint8_t *out);
+size_t injector__injector_msg__pack_to_buffer
+ (const Injector__InjectorMsg *message,
+ ProtobufCBuffer *buffer);
+Injector__InjectorMsg *
+ injector__injector_msg__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void injector__injector_msg__free_unpacked
+ (Injector__InjectorMsg *message,
+ ProtobufCAllocator *allocator);
+/* --- per-message closures --- */
+
+typedef void (*Injector__HandShakeReq_Closure)
+ (const Injector__HandShakeReq *message,
+ void *closure_data);
+typedef void (*Injector__HandShakeAns_Closure)
+ (const Injector__HandShakeAns *message,
+ void *closure_data);
+typedef void (*Injector__EmulatorState_Closure)
+ (const Injector__EmulatorState *message,
+ void *closure_data);
+typedef void (*Injector__AppState_Closure)
+ (const Injector__AppState *message,
+ void *closure_data);
+typedef void (*Injector__StartReq_Closure)
+ (const Injector__StartReq *message,
+ void *closure_data);
+typedef void (*Injector__StartAns_Closure)
+ (const Injector__StartAns *message,
+ void *closure_data);
+typedef void (*Injector__SetEventStatus_Closure)
+ (const Injector__SetEventStatus *message,
+ void *closure_data);
+typedef void (*Injector__EventMsg_Closure)
+ (const Injector__EventMsg *message,
+ void *closure_data);
+typedef void (*Injector__EventTerminate_Closure)
+ (const Injector__EventTerminate *message,
+ void *closure_data);
+typedef void (*Injector__SetSensorStatus_Closure)
+ (const Injector__SetSensorStatus *message,
+ void *closure_data);
+typedef void (*Injector__SensorData_Closure)
+ (const Injector__SensorData *message,
+ void *closure_data);
+typedef void (*Injector__SensorMsg_Closure)
+ (const Injector__SensorMsg *message,
+ void *closure_data);
+typedef void (*Injector__MultiTouchMaxCount_Closure)
+ (const Injector__MultiTouchMaxCount *message,
+ void *closure_data);
+typedef void (*Injector__MultiTouchData_Closure)
+ (const Injector__MultiTouchData *message,
+ void *closure_data);
+typedef void (*Injector__MultiTouchMsg_Closure)
+ (const Injector__MultiTouchMsg *message,
+ void *closure_data);
+typedef void (*Injector__InjectorMsg_Closure)
+ (const Injector__InjectorMsg *message,
+ void *closure_data);
+
+/* --- services --- */
+
+
+/* --- descriptors --- */
+
+extern const ProtobufCEnumDescriptor injector__result__descriptor;
+extern const ProtobufCEnumDescriptor injector__connection_state__descriptor;
+extern const ProtobufCEnumDescriptor injector__event__descriptor;
+extern const ProtobufCEnumDescriptor injector__status__descriptor;
+extern const ProtobufCEnumDescriptor injector__sensor_type__descriptor;
+extern const ProtobufCEnumDescriptor injector__touch_status__descriptor;
+extern const ProtobufCMessageDescriptor injector__hand_shake_req__descriptor;
+extern const ProtobufCMessageDescriptor injector__hand_shake_ans__descriptor;
+extern const ProtobufCMessageDescriptor injector__emulator_state__descriptor;
+extern const ProtobufCMessageDescriptor injector__app_state__descriptor;
+extern const ProtobufCMessageDescriptor injector__start_req__descriptor;
+extern const ProtobufCMessageDescriptor injector__start_ans__descriptor;
+extern const ProtobufCMessageDescriptor injector__set_event_status__descriptor;
+extern const ProtobufCMessageDescriptor injector__event_msg__descriptor;
+extern const ProtobufCEnumDescriptor injector__event_msg__type__descriptor;
+extern const ProtobufCMessageDescriptor injector__event_terminate__descriptor;
+extern const ProtobufCMessageDescriptor injector__set_sensor_status__descriptor;
+extern const ProtobufCMessageDescriptor injector__sensor_data__descriptor;
+extern const ProtobufCMessageDescriptor injector__sensor_msg__descriptor;
+extern const ProtobufCEnumDescriptor injector__sensor_msg__type__descriptor;
+extern const ProtobufCMessageDescriptor injector__multi_touch_max_count__descriptor;
+extern const ProtobufCMessageDescriptor injector__multi_touch_data__descriptor;
+extern const ProtobufCMessageDescriptor injector__multi_touch_msg__descriptor;
+extern const ProtobufCEnumDescriptor injector__multi_touch_msg__type__descriptor;
+extern const ProtobufCMessageDescriptor injector__injector_msg__descriptor;
+extern const ProtobufCEnumDescriptor injector__injector_msg__type__descriptor;
+
+PROTOBUF_C_END_DECLS
+
+
+#endif /* PROTOBUF_tethering_2eproto__INCLUDED */
--- /dev/null
+package injector;
+
+option java_package = "event.injector.genmsg";
+
+enum Result {
+ SUCCESS = 1;
+ FAILURE = 2;
+ CANCEL = 3;
+}
+
+message HandShakeReq {
+ required int32 key = 1;
+}
+
+message HandShakeAns {
+ required Result result = 1;
+}
+
+enum ConnectionState {
+ CONNECT = 1;
+ DISCONNECT = 2;
+ TERMINATE = 3;
+}
+message EmulatorState {
+ required ConnectionState state = 1;
+}
+
+message AppState {
+ required ConnectionState state =1;
+}
+
+message StartReq {
+
+}
+
+message StartAns {
+ required Result result = 1;
+}
+
+enum Event {
+ SENSOR = 1;
+ MULTITOUCH = 2;
+}
+
+enum Status {
+ ENABLE = 1;
+ DISABLE = 2;
+}
+
+message SetEventStatus {
+ required Event event = 1;
+ required Status status = 2;
+}
+
+message EventMsg {
+ enum TYPE {
+ START_REQ = 2;
+ START_ANS = 3;
+ TERMINATE = 4;
+ EVENT_STATUS = 5;
+ }
+
+ required TYPE type = 1;
+ optional StartReq startReq= 2;
+ optional StartAns startAns= 3;
+ optional EventTerminate terminate = 4;
+ optional SetEventStatus setStatus= 5;
+}
+
+message EventTerminate {
+
+}
+
+enum SensorType{
+ ACCEL = 1;
+ MAGNETIC = 2;
+ GYROSCOPE = 3;
+ PROXIMITY = 4;
+ LIGHT = 5;
+}
+
+message SetSensorStatus {
+ required SensorType sensor = 1;
+ required Status status = 2;
+}
+
+message SensorData {
+ required SensorType sensor = 1;
+ optional string x = 2 [default = "0"];
+ optional string y = 3 [default = "0"];
+ optional string z = 4 [default = "0"];
+}
+
+message SensorMsg {
+ enum Type {
+ START_REQ = 2;
+ START_ANS = 3;
+ TERMINATE = 4;
+ SENSOR_STATUS = 5;
+ SENSOR_DATA = 6;
+ }
+
+ required Type type = 1;
+ optional StartReq startReq= 2;
+ optional StartAns startAns= 3;
+ optional EventTerminate terminate= 4;
+ optional SetSensorStatus setStatus= 5;
+ optional SensorData data = 6;
+}
+
+message MultiTouchMaxCount {
+ optional int32 max = 1 [default = 10];
+}
+
+enum TouchStatus {
+ PRESS = 1;
+ RELEASE = 2;
+}
+
+message MultiTouchData {
+ optional int32 index = 1 [default = 0];
+ optional float xPoint = 2 [default = 0.0];
+ optional float yPoint = 3 [default = 0.0];
+ optional TouchStatus status = 4;
+}
+
+message MultiTouchMsg {
+ enum Type {
+ START_REQ = 2;
+ START_ANS = 3;
+ TERMINATE = 4;
+ MAX_COUNT = 5;
+ TOUCH_DATA = 6;
+ }
+ required Type type = 1;
+ optional StartReq startReq= 2;
+ optional StartAns startAns= 3;
+ optional EventTerminate terminate= 4;
+ optional MultiTouchMaxCount maxCount = 5;
+ optional MultiTouchData touchData = 6;
+}
+
+message InjectorMsg {
+ enum Type {
+ HANDSHAKE_REQ = 2;
+ HANDSHAKE_ANS = 3;
+ EMUL_STATE = 4;
+ APP_STATE = 5;
+ EVENT_MSG = 6;
+ SENSOR_MSG = 7;
+ TOUCH_MSG = 8;
+ }
+ required Type type = 1;
+ optional HandShakeReq handShakeReq = 2;
+ optional HandShakeAns handShakeAns = 3;
+ optional EmulatorState emulState = 4;
+ optional AppState appState = 5;
+ optional EventMsg eventMsg = 6;
+ optional SensorMsg sensorMsg = 7;
+ optional MultiTouchMsg touchMsg = 8;
+}
+