From: Kitae Kim Date: Wed, 8 Oct 2014 08:13:45 +0000 (+0900) Subject: eventcast: rename tethering to eventcast X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~228^2^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=79ff6ecee9d59b4ecb2b37f9136d6fc91970022e;p=sdk%2Femulator%2Fqemu.git eventcast: rename tethering to eventcast naming tethering might be confusing to users. Change-Id: I154e59aefd932728cb3b73ece6c14d4223cc03de Signed-off-by: Kitae Kim --- diff --git a/tizen/src/Makefile.objs b/tizen/src/Makefile.objs index 508e120e7e..c3127b7e92 100644 --- a/tizen/src/Makefile.objs +++ b/tizen/src/Makefile.objs @@ -15,7 +15,7 @@ obj-y += display/ obj-y += ecs/ # tethering -obj-y += tethering/ +obj-y += eventcast/ # maru skin obj-y += skin/ diff --git a/tizen/src/display/maru_sdl.c b/tizen/src/display/maru_sdl.c index e0c177e0da..ac4ab296dd 100644 --- a/tizen/src/display/maru_sdl.c +++ b/tizen/src/display/maru_sdl.c @@ -39,7 +39,7 @@ #include "hw/pci/maru_brightness.h" #include "debug_ch.h" -#include "tethering/encode_fb.h" +#include "eventcast/encode_fb.h" #include #ifndef CONFIG_WIN32 diff --git a/tizen/src/display/maru_shm.c b/tizen/src/display/maru_shm.c index e2c00bae60..d7e1782297 100644 --- a/tizen/src/display/maru_shm.c +++ b/tizen/src/display/maru_shm.c @@ -41,7 +41,7 @@ #include "util/maru_err_table.h" #include "debug_ch.h" -#include "tethering/encode_fb.h" +#include "eventcast/encode_fb.h" MULTI_DEBUG_CHANNEL(tizen, maru_shm); diff --git a/tizen/src/ecs/Makefile.objs b/tizen/src/ecs/Makefile.objs index 6f68dfbc1c..658659cc62 100644 --- a/tizen/src/ecs/Makefile.objs +++ b/tizen/src/ecs/Makefile.objs @@ -1,4 +1,4 @@ obj-y += genmsg/ecs.pb-c.o genmsg/ecs_ids.pb-c.o ../../distrib/protobuf/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 +obj-y += ecs_eventcast.o diff --git a/tizen/src/ecs/ecs.c b/tizen/src/ecs/ecs.c index 11824323c1..85cf5b4761 100644 --- a/tizen/src/ecs/ecs.c +++ b/tizen/src/ecs/ecs.c @@ -845,12 +845,12 @@ bool handle_protobuf_msg(ECS_Client* cli, char* data, int len) goto fail; msgproc_keepalive_ans(cli, msg); } - else if (master->type == ECS__MASTER__TYPE__TETHERING_REQ) + else if (master->type == ECS__MASTER__TYPE__EVENTCAST_REQ) { - ECS__TetheringReq* msg = master->tethering_req; + ECS__EventCastReq* msg = master->eventcast_req; if (!msg) goto fail; - msgproc_tethering_req(cli, msg); + msgproc_eventcast_req(cli, msg); } ecs__master__free_unpacked(master, NULL); diff --git a/tizen/src/ecs/ecs.h b/tizen/src/ecs/ecs.h index abd4fd4275..46fbffd9a1 100644 --- a/tizen/src/ecs/ecs.h +++ b/tizen/src/ecs/ecs.h @@ -202,7 +202,7 @@ bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg); 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); +bool msgproc_eventcast_req(ECS_Client* ccli, ECS__EventCastReq* msg); char *get_tizen_sdk_data_path(void); diff --git a/tizen/src/ecs/ecs_eventcast.c b/tizen/src/ecs/ecs_eventcast.c new file mode 100644 index 0000000000..385a5f5222 --- /dev/null +++ b/tizen/src/ecs/ecs_eventcast.c @@ -0,0 +1,348 @@ +/* + * Emulator Control Server - Device Tethering Handler + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * KiTae Kim + * JiHye Kim + * YeongKyoon Lee + * + * 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 "ui/console.h" + +#include "ecs.h" +#include "ecs_eventcast.h" +#include "eventcast/common.h" +#include "eventcast/sensor.h" +#include "eventcast/touch.h" +#include "hw/virtio/maru_virtio_touchscreen.h" +#include "hw/virtio/maru_virtio_hwkey.h" + +#include "util/new_debug_ch.h" + +DECLARE_DEBUG_CHANNEL(ecs_eventcast); + +#define MSG_BUF_SIZE 255 +#define MSG_LEN_SIZE 4 + +#define PRESSED 1 +#define RELEASED 2 + +static bool send_eventcast_ntf(const char *data); +static void send_eventcast_status_ntf(type_group group, type_action action); + +static int eventcast_port = 0; + +void send_eventcast_sensor_status_ecp(void) +{ + LOG_INFO(">> send eventcast_event_status to ecp\n"); + send_eventcast_status_ntf(ECS_EVENTCAST_MSG_GROUP_ECP, + ECS_EVENTCAST_MSG_ACTION_SENSOR_STATUS); +} + +void send_eventcast_touch_status_ecp(void) +{ + send_eventcast_status_ntf(ECS_EVENTCAST_MSG_GROUP_ECP, + ECS_EVENTCAST_MSG_ACTION_TOUCH_STATUS); +} + +void send_eventcast_connection_status_ecp(void) +{ + LOG_INFO(">> send eventcast_connection_status to ecp\n"); + send_eventcast_status_ntf(ECS_EVENTCAST_MSG_GROUP_ECP, + ECS_EVENTCAST_MSG_ACTION_CONNECTION_STATUS); +} + +#if 0 +static void send_eventcast_port_ecp(void) +{ + type_length length; + type_group group = ECS_EVENTCAST_MSG_GROUP_ECP; + type_action action = ECS_EVENTCAST_MSG_ACTION_CONNECT; + uint8_t *msg = NULL; + gchar data[12]; + + msg = g_malloc(MSG_BUF_SIZE); + if (!msg) { + return; + } + + LOG_TRACE(">> send port_num: %d\n", eventcast_port); + g_snprintf(data, sizeof(data) - 1, "%d", eventcast_port); + length = strlen(data); + + memcpy(msg, ECS_EVENTCAST_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, length); + + LOG_TRACE(">> send eventcast_ntf to ecp. action=%d, group=%d, data=%s\n", + action, group, data); + + send_eventcast_ntf((const char *)msg); + + if (msg) { + g_free(msg); + } +} +#endif + +static void send_eventcast_connection_info(void) +{ + type_length length; + type_group group = ECS_EVENTCAST_MSG_GROUP_ECP; + type_action action = ECS_EVENTCAST_MSG_ACTION_CONNECT; + uint8_t *msg = NULL; + gchar data[64]; + + msg = g_malloc(MSG_BUF_SIZE); + if (!msg) { + LOG_SEVERE("failed to allocate memory\n"); + return; + } + + LOG_INFO(">> send port_num: %d\n", eventcast_port); + { + const char *ip = get_eventcast_connected_ipaddr(); + int port = get_eventcast_connected_port(); + + if (!ip) { + LOG_SEVERE("invalid connected ip\n"); + return; + } + + if (!port) { + LOG_SEVERE("invalid connected port\n"); + return; + } + g_snprintf(data, sizeof(data) - 1, "%s:%d", ip, port); + length = strlen(data); + data[length] = '\0'; + } + + memcpy(msg, ECS_EVENTCAST_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, length); + + LOG_INFO(">> send connection msg to ecp. " + "action=%d, group=%d, data=%s length=%d\n", + action, group, data, length); + + send_eventcast_ntf((const char *)msg); + + g_free(msg); +} + +static void send_eventcast_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_EVENTCAST_MSG_ACTION_CONNECTION_STATUS: + status = get_eventcast_connection_status(); + if (status == CONNECTED) { + send_eventcast_connection_info(); + } + break; + case ECS_EVENTCAST_MSG_ACTION_SENSOR_STATUS: + status = get_eventcast_sensor_status(); + break; + case ECS_EVENTCAST_MSG_ACTION_TOUCH_STATUS: + status = get_eventcast_touch_status(); + break; + default: + break; + } + + msg = g_malloc(MSG_BUF_SIZE); + if (!msg) { + return; + } + + g_snprintf(data, sizeof(data), "%d", status); + + memcpy(msg, ECS_EVENTCAST_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_TRACE(">> send eventcast_ntf to ecp. action=%d, group=%d, data=%s\n", + action, group, data); + + send_eventcast_ntf((const char *)msg); + + if (msg) { + g_free(msg); + } +} + +static bool send_eventcast_ntf(const char *data) +{ + 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_TRACE(">> header cat = %s, length = %d, action=%d, group=%d\n", cat, length,action, group); + + ECS__Master master = ECS__MASTER__INIT; + ECS__EventCastNtf ntf = ECS__EVENT_CAST_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_TRACE("data = %s, length = %hu\n", ijdata, length); + } + + master.type = ECS__MASTER__TYPE__EVENTCAST_NTF; + master.eventcast_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; +} + +void send_eventcast_sensor_data(const char *data, int len) +{ + set_injector_data(data); +} + +void send_eventcast_touch_data(int x, int y, int index, int status) +{ + virtio_touchscreen_event(x, y, index, status); +} + +void send_eventcast_hwkey_data(int keycode) +{ + maru_hwkey_event(PRESSED, keycode); + maru_hwkey_event(RELEASED, keycode); +} + +// handle eventcast_req message +bool msgproc_eventcast_req(ECS_Client* ccli, ECS__EventCastReq* msg) +{ + gchar cmd[10] = {0}; + gchar **server_addr = NULL; + + LOG_TRACE("enter %s\n", __func__); + + 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_TRACE("<< header = cmd = %s, length = %d, action=%d, group=%d\n", + cmd, length, action, group); + + switch(action) { + case ECS_EVENTCAST_MSG_ACTION_CONNECT: + LOG_INFO("MSG_ACTION_CONNECT\n"); + + if (msg->data.data && msg->data.len > 0) { + const gchar *data = (const gchar *)msg->data.data; + gchar *ip_address = NULL; + guint64 port = 0; + + server_addr = g_strsplit(data, ":", 0); + if (server_addr && server_addr[0]) { + int len = strlen(server_addr[0]); + + if (len) { + ip_address = g_malloc(len + 1); + g_strlcpy(ip_address, server_addr[0], len + 1); + } + LOG_INFO("IP address: %s, length: %d\n", ip_address, len); + } + + if (server_addr && server_addr[1]) { + port = g_ascii_strtoull(server_addr[1], NULL, 10); + LOG_INFO("port number: %d\n", port); + } else { + LOG_SEVERE("failed to parse port number\n"); + } + LOG_TRACE("len = %zd, data\" %s\"", strlen(data), data); + + connect_eventcast_app(ip_address, port); + eventcast_port = port; + + LOG_TRACE(">> port_num: %d, %d\n", port, eventcast_port); + g_free(ip_address); + g_strfreev(server_addr); + } else { + LOG_INFO("ip address and port value are null\n"); + } + break; + case ECS_EVENTCAST_MSG_ACTION_DISCONNECT: + LOG_INFO(">> MSG_ACTION_DISCONNECT\n"); + disconnect_eventcast_app(); + eventcast_port = 0; + break; + case ECS_EVENTCAST_MSG_ACTION_CONNECTION_STATUS: + case ECS_EVENTCAST_MSG_ACTION_SENSOR_STATUS: + case ECS_EVENTCAST_MSG_ACTION_TOUCH_STATUS: + LOG_TRACE(">> get_status_action\n"); + send_eventcast_status_ntf(group, action); + break; + default: + break; + } + + LOG_TRACE("leave %s\n", __func__); + + return true; +} diff --git a/tizen/src/ecs/ecs_eventcast.h b/tizen/src/ecs/ecs_eventcast.h new file mode 100644 index 0000000000..a94f3f35cc --- /dev/null +++ b/tizen/src/ecs/ecs_eventcast.h @@ -0,0 +1,55 @@ +/* + * Emulator Control Server - Device Tethering Handler + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * KiTae Kim + * JiHey Kim + * DaiYoung Kim + * YeongKyoon Lee + * + * 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 + * + */ + +/* + * define eventcast messages between ecs and ecp + */ +#define ECS_EVENTCAST_MSG_CATEGORY "eventcast" +#define ECS_EVENTCAST_MSG_GROUP_ECP 1 + +enum ECS_EVENTCAST_MSG_ACTION { + ECS_EVENTCAST_MSG_ACTION_CONNECT = 1, + ECS_EVENTCAST_MSG_ACTION_DISCONNECT, + ECS_EVENTCAST_MSG_ACTION_CONNECTION_STATUS, + ECS_EVENTCAST_MSG_ACTION_SENSOR_STATUS, + ECS_EVENTCAST_MSG_ACTION_TOUCH_STATUS, +}; + +void send_eventcast_sensor_status_ecp(void); + +void send_eventcast_touch_status_ecp(void); + +void send_eventcast_connection_status_ecp(void); + +void send_eventcast_sensor_data(const char *data, int len); + +void send_eventcast_touch_data(int x, int y, int index, int status); + +void send_eventcast_hwkey_data(int keycode); diff --git a/tizen/src/ecs/ecs_tethering.c b/tizen/src/ecs/ecs_tethering.c deleted file mode 100644 index cff88433db..0000000000 --- a/tizen/src/ecs/ecs_tethering.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Emulator Control Server - Device Tethering Handler - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * KiTae Kim - * JiHye Kim - * YeongKyoon Lee - * - * 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 "ui/console.h" - -#include "ecs.h" -#include "ecs_tethering.h" -#include "tethering/common.h" -#include "tethering/sensor.h" -#include "tethering/touch.h" -#include "hw/virtio/maru_virtio_touchscreen.h" -#include "hw/virtio/maru_virtio_hwkey.h" - -#include "util/new_debug_ch.h" - -DECLARE_DEBUG_CHANNEL(ecs_tethering); - -#define MSG_BUF_SIZE 255 -#define MSG_LEN_SIZE 4 - -#define PRESSED 1 -#define RELEASED 2 - -static bool send_tethering_ntf(const char *data); -static void send_tethering_status_ntf(type_group group, type_action action); - -static int tethering_port = 0; - -void send_tethering_sensor_status_ecp(void) -{ - LOG_INFO(">> send tethering_event_status to ecp\n"); - send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP, - ECS_TETHERING_MSG_ACTION_SENSOR_STATUS); -} - -void send_tethering_touch_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_INFO(">> send tethering_connection_status to ecp\n"); - send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP, - ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS); -} - -#if 0 -static void send_tethering_port_ecp(void) -{ - type_length length; - type_group group = ECS_TETHERING_MSG_GROUP_ECP; - type_action action = ECS_TETHERING_MSG_ACTION_CONNECT; - uint8_t *msg = NULL; - gchar data[12]; - - msg = g_malloc(MSG_BUF_SIZE); - if (!msg) { - return; - } - - LOG_INFO(">> send port_num: %d\n", tethering_port); - g_snprintf(data, sizeof(data) - 1, "%d", tethering_port); - length = strlen(data); - - 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, length); - - LOG_INFO(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s\n", - action, group, data); - - send_tethering_ntf((const char *)msg); - - if (msg) { - g_free(msg); - } -} -#endif - -static void send_tethering_connection_info(void) -{ - type_length length; - type_group group = ECS_TETHERING_MSG_GROUP_ECP; - type_action action = ECS_TETHERING_MSG_ACTION_CONNECT; - uint8_t *msg = NULL; - gchar data[64]; - - msg = g_malloc(MSG_BUF_SIZE); - if (!msg) { - LOG_SEVERE("failed to allocate memory\n"); - return; - } - - LOG_INFO(">> send port_num: %d\n", tethering_port); - { - const char *ip = get_tethering_connected_ipaddr(); - int port = get_tethering_connected_port(); - - if (!ip) { - LOG_SEVERE("invalid connected ip\n"); - return; - } - - if (!port) { - LOG_SEVERE("invalid connected port\n"); - return; - } - g_snprintf(data, sizeof(data) - 1, "%s:%d", ip, port); - length = strlen(data); - data[length] = '\0'; - } - - 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, length); - - LOG_INFO(">> send connection msg to ecp. " - "action=%d, group=%d, data=%s length=%d\n", - action, group, data, length); - - send_tethering_ntf((const char *)msg); - - g_free(msg); -} - -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(); - if (status == CONNECTED) { - send_tethering_connection_info(); - } - break; - case ECS_TETHERING_MSG_ACTION_SENSOR_STATUS: - status = get_tethering_sensor_status(); - break; - case ECS_TETHERING_MSG_ACTION_TOUCH_STATUS: - status = get_tethering_touch_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_INFO(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s\n", - action, group, data); - - send_tethering_ntf((const char *)msg); - - if (msg) { - g_free(msg); - } -} - -static bool send_tethering_ntf(const char *data) -{ - 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_INFO(">> header cat = %s, length = %d, action=%d, group=%d\n", 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_INFO("data = %s, length = %hu\n", 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; -} - -void send_tethering_sensor_data(const char *data, int len) -{ - set_injector_data(data); -} - -void send_tethering_touch_data(int x, int y, int index, int status) -{ - virtio_touchscreen_event(x, y, index, status); -} - -void send_tethering_hwkey_data(int keycode) -{ - maru_hwkey_event(PRESSED, keycode); - maru_hwkey_event(RELEASED, keycode); -} - -// handle tethering_req message -bool msgproc_tethering_req(ECS_Client* ccli, ECS__TetheringReq* msg) -{ - gchar cmd[10] = {0}; - gchar **server_addr = NULL; - - LOG_TRACE("enter %s\n", __func__); - - 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_INFO("<< header = cmd = %s, length = %d, action = %d, group = %d\n", - cmd, length, action, group); - - switch(action) { - case ECS_TETHERING_MSG_ACTION_CONNECT: - LOG_INFO("MSG_ACTION_CONNECT\n"); - - if (msg->data.data && msg->data.len > 0) { - const gchar *data = (const gchar *)msg->data.data; - gchar *ip_address = NULL; - guint64 port = 0; - - server_addr = g_strsplit(data, ":", 0); - if (server_addr && server_addr[0]) { - int len = strlen(server_addr[0]); - - if (len) { - ip_address = g_malloc(len + 1); - g_strlcpy(ip_address, server_addr[0], len + 1); - } - LOG_INFO("IP address: %s, length: %d\n", ip_address, len); - } - - if (server_addr && server_addr[1]) { - port = g_ascii_strtoull(server_addr[1], NULL, 10); - LOG_INFO("port number: %d\n", port); - } else { - LOG_SEVERE("failed to parse port number\n"); - } - LOG_INFO("len = %zd, data\" %s\"", strlen(data), data); - - connect_tethering_app(ip_address, port); - tethering_port = port; - - LOG_INFO(">> port_num: %d, %d\n", port, tethering_port); - g_free(ip_address); - g_strfreev(server_addr); - } else { - LOG_INFO("ip address and port value are null\n"); - } - break; - case ECS_TETHERING_MSG_ACTION_DISCONNECT: - LOG_INFO(">> MSG_ACTION_DISCONNECT\n"); - disconnect_tethering_app(); - tethering_port = 0; - break; - case ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS: - case ECS_TETHERING_MSG_ACTION_SENSOR_STATUS: - case ECS_TETHERING_MSG_ACTION_TOUCH_STATUS: - LOG_INFO(">> get_status_action\n"); - send_tethering_status_ntf(group, action); - break; - default: - break; - } - - LOG_TRACE("leave %s\n", __func__); - - return true; -} diff --git a/tizen/src/ecs/ecs_tethering.h b/tizen/src/ecs/ecs_tethering.h deleted file mode 100644 index 3d1b3afc98..0000000000 --- a/tizen/src/ecs/ecs_tethering.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Emulator Control Server - Device Tethering Handler - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * KiTae Kim - * JiHey Kim - * DaiYoung Kim - * YeongKyoon Lee - * - * 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 - * - */ - -/* - * define tethering messages between ecs and ecp - */ -#define ECS_TETHERING_MSG_CATEGORY "tethering" -#define ECS_TETHERING_MSG_GROUP_ECP 1 - -enum ECS_TETHERING_MSG_ACTION { - ECS_TETHERING_MSG_ACTION_CONNECT = 1, - ECS_TETHERING_MSG_ACTION_DISCONNECT, - ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS, - ECS_TETHERING_MSG_ACTION_SENSOR_STATUS, - ECS_TETHERING_MSG_ACTION_TOUCH_STATUS, -}; - -void send_tethering_sensor_status_ecp(void); - -void send_tethering_touch_status_ecp(void); - -void send_tethering_connection_status_ecp(void); - -void send_tethering_sensor_data(const char *data, int len); - -void send_tethering_touch_data(int x, int y, int index, int status); - -void send_tethering_hwkey_data(int keycode); \ No newline at end of file diff --git a/tizen/src/ecs/genmsg/ecs.pb-c.c b/tizen/src/ecs/genmsg/ecs.pb-c.c index 0871aecc43..a91167e4c1 100644 --- a/tizen/src/ecs/genmsg/ecs.pb-c.c +++ b/tizen/src/ecs/genmsg/ecs.pb-c.c @@ -651,133 +651,133 @@ void ecs__nfc_ntf__free_unpacked 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) +void ecs__event_cast_req__init + (ECS__EventCastReq *message) { - static ECS__TetheringReq init_value = ECS__TETHERING_REQ__INIT; + static ECS__EventCastReq init_value = ECS__EVENT_CAST_REQ__INIT; *message = init_value; } -size_t ecs__tethering_req__get_packed_size - (const ECS__TetheringReq *message) +size_t ecs__event_cast_req__get_packed_size + (const ECS__EventCastReq *message) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_req__descriptor); return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); } -size_t ecs__tethering_req__pack - (const ECS__TetheringReq *message, +size_t ecs__event_cast_req__pack + (const ECS__EventCastReq *message, uint8_t *out) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_req__descriptor); return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); } -size_t ecs__tethering_req__pack_to_buffer - (const ECS__TetheringReq *message, +size_t ecs__event_cast_req__pack_to_buffer + (const ECS__EventCastReq *message, ProtobufCBuffer *buffer) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_req__descriptor); return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); } -ECS__TetheringReq * - ecs__tethering_req__unpack +ECS__EventCastReq * + ecs__event_cast_req__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { - return (ECS__TetheringReq *) - protobuf_c_message_unpack (&ecs__tethering_req__descriptor, + return (ECS__EventCastReq *) + protobuf_c_message_unpack (&ecs__event_cast_req__descriptor, allocator, len, data); } -void ecs__tethering_req__free_unpacked - (ECS__TetheringReq *message, +void ecs__event_cast_req__free_unpacked + (ECS__EventCastReq *message, ProtobufCAllocator *allocator) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_req__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } -void ecs__tethering_ans__init - (ECS__TetheringAns *message) +void ecs__event_cast_ans__init + (ECS__EventCastAns *message) { - static ECS__TetheringAns init_value = ECS__TETHERING_ANS__INIT; + static ECS__EventCastAns init_value = ECS__EVENT_CAST_ANS__INIT; *message = init_value; } -size_t ecs__tethering_ans__get_packed_size - (const ECS__TetheringAns *message) +size_t ecs__event_cast_ans__get_packed_size + (const ECS__EventCastAns *message) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ans__descriptor); return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); } -size_t ecs__tethering_ans__pack - (const ECS__TetheringAns *message, +size_t ecs__event_cast_ans__pack + (const ECS__EventCastAns *message, uint8_t *out) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ans__descriptor); return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); } -size_t ecs__tethering_ans__pack_to_buffer - (const ECS__TetheringAns *message, +size_t ecs__event_cast_ans__pack_to_buffer + (const ECS__EventCastAns *message, ProtobufCBuffer *buffer) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ans__descriptor); return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); } -ECS__TetheringAns * - ecs__tethering_ans__unpack +ECS__EventCastAns * + ecs__event_cast_ans__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { - return (ECS__TetheringAns *) - protobuf_c_message_unpack (&ecs__tethering_ans__descriptor, + return (ECS__EventCastAns *) + protobuf_c_message_unpack (&ecs__event_cast_ans__descriptor, allocator, len, data); } -void ecs__tethering_ans__free_unpacked - (ECS__TetheringAns *message, +void ecs__event_cast_ans__free_unpacked + (ECS__EventCastAns *message, ProtobufCAllocator *allocator) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ans__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } -void ecs__tethering_ntf__init - (ECS__TetheringNtf *message) +void ecs__event_cast_ntf__init + (ECS__EventCastNtf *message) { - static ECS__TetheringNtf init_value = ECS__TETHERING_NTF__INIT; + static ECS__EventCastNtf init_value = ECS__EVENT_CAST_NTF__INIT; *message = init_value; } -size_t ecs__tethering_ntf__get_packed_size - (const ECS__TetheringNtf *message) +size_t ecs__event_cast_ntf__get_packed_size + (const ECS__EventCastNtf *message) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ntf__descriptor); return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); } -size_t ecs__tethering_ntf__pack - (const ECS__TetheringNtf *message, +size_t ecs__event_cast_ntf__pack + (const ECS__EventCastNtf *message, uint8_t *out) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ntf__descriptor); return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); } -size_t ecs__tethering_ntf__pack_to_buffer - (const ECS__TetheringNtf *message, +size_t ecs__event_cast_ntf__pack_to_buffer + (const ECS__EventCastNtf *message, ProtobufCBuffer *buffer) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ntf__descriptor); return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); } -ECS__TetheringNtf * - ecs__tethering_ntf__unpack +ECS__EventCastNtf * + ecs__event_cast_ntf__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { - return (ECS__TetheringNtf *) - protobuf_c_message_unpack (&ecs__tethering_ntf__descriptor, + return (ECS__EventCastNtf *) + protobuf_c_message_unpack (&ecs__event_cast_ntf__descriptor, allocator, len, data); } -void ecs__tethering_ntf__free_unpacked - (ECS__TetheringNtf *message, +void ecs__event_cast_ntf__free_unpacked + (ECS__EventCastNtf *message, ProtobufCAllocator *allocator) { - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor); + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ntf__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } void ecs__master__init @@ -1796,7 +1796,7 @@ const ProtobufCMessageDescriptor ecs__nfc_ntf__descriptor = (ProtobufCMessageInit) ecs__nfc_ntf__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] = +static const ProtobufCFieldDescriptor ecs__event_cast_req__field_descriptors[5] = { { "category", @@ -1804,7 +1804,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringReq, category), + PROTOBUF_C_OFFSETOF(ECS__EventCastReq, category), NULL, NULL, 0, /* packed */ @@ -1816,7 +1816,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringReq, length), + PROTOBUF_C_OFFSETOF(ECS__EventCastReq, length), NULL, NULL, 0, /* packed */ @@ -1828,7 +1828,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringReq, group), + PROTOBUF_C_OFFSETOF(ECS__EventCastReq, group), NULL, NULL, 0, /* packed */ @@ -1840,7 +1840,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringReq, action), + PROTOBUF_C_OFFSETOF(ECS__EventCastReq, action), NULL, NULL, 0, /* packed */ @@ -1851,42 +1851,42 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] = 5, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BYTES, - PROTOBUF_C_OFFSETOF(ECS__TetheringReq, has_data), - PROTOBUF_C_OFFSETOF(ECS__TetheringReq, data), + PROTOBUF_C_OFFSETOF(ECS__EventCastReq, has_data), + PROTOBUF_C_OFFSETOF(ECS__EventCastReq, data), NULL, NULL, 0, /* packed */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, }; -static const unsigned ecs__tethering_req__field_indices_by_name[] = { +static const unsigned ecs__event_cast_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] = +static const ProtobufCIntRange ecs__event_cast_req__number_ranges[1 + 1] = { { 1, 0 }, { 0, 5 } }; -const ProtobufCMessageDescriptor ecs__tethering_req__descriptor = +const ProtobufCMessageDescriptor ecs__event_cast_req__descriptor = { PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "ECS.TetheringReq", - "TetheringReq", - "ECS__TetheringReq", + "ECS.EventCastReq", + "EventCastReq", + "ECS__EventCastReq", "ECS", - sizeof(ECS__TetheringReq), + sizeof(ECS__EventCastReq), 5, - ecs__tethering_req__field_descriptors, - ecs__tethering_req__field_indices_by_name, - 1, ecs__tethering_req__number_ranges, - (ProtobufCMessageInit) ecs__tethering_req__init, + ecs__event_cast_req__field_descriptors, + ecs__event_cast_req__field_indices_by_name, + 1, ecs__event_cast_req__number_ranges, + (ProtobufCMessageInit) ecs__event_cast_req__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] = +static const ProtobufCFieldDescriptor ecs__event_cast_ans__field_descriptors[7] = { { "errcode", @@ -1894,7 +1894,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringAns, errcode), + PROTOBUF_C_OFFSETOF(ECS__EventCastAns, errcode), NULL, NULL, 0, /* packed */ @@ -1906,7 +1906,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] = PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringAns, errstr), + PROTOBUF_C_OFFSETOF(ECS__EventCastAns, errstr), NULL, NULL, 0, /* packed */ @@ -1918,7 +1918,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringAns, category), + PROTOBUF_C_OFFSETOF(ECS__EventCastAns, category), NULL, NULL, 0, /* packed */ @@ -1930,7 +1930,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringAns, length), + PROTOBUF_C_OFFSETOF(ECS__EventCastAns, length), NULL, NULL, 0, /* packed */ @@ -1942,7 +1942,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringAns, group), + PROTOBUF_C_OFFSETOF(ECS__EventCastAns, group), NULL, NULL, 0, /* packed */ @@ -1954,7 +1954,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringAns, action), + PROTOBUF_C_OFFSETOF(ECS__EventCastAns, action), NULL, NULL, 0, /* packed */ @@ -1965,15 +1965,15 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] = 7, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BYTES, - PROTOBUF_C_OFFSETOF(ECS__TetheringAns, has_data), - PROTOBUF_C_OFFSETOF(ECS__TetheringAns, data), + PROTOBUF_C_OFFSETOF(ECS__EventCastAns, has_data), + PROTOBUF_C_OFFSETOF(ECS__EventCastAns, data), NULL, NULL, 0, /* packed */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, }; -static const unsigned ecs__tethering_ans__field_indices_by_name[] = { +static const unsigned ecs__event_cast_ans__field_indices_by_name[] = { 5, /* field[5] = action */ 2, /* field[2] = category */ 6, /* field[6] = data */ @@ -1982,27 +1982,27 @@ static const unsigned ecs__tethering_ans__field_indices_by_name[] = { 4, /* field[4] = group */ 3, /* field[3] = length */ }; -static const ProtobufCIntRange ecs__tethering_ans__number_ranges[1 + 1] = +static const ProtobufCIntRange ecs__event_cast_ans__number_ranges[1 + 1] = { { 1, 0 }, { 0, 7 } }; -const ProtobufCMessageDescriptor ecs__tethering_ans__descriptor = +const ProtobufCMessageDescriptor ecs__event_cast_ans__descriptor = { PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "ECS.TetheringAns", - "TetheringAns", - "ECS__TetheringAns", + "ECS.EventCastAns", + "EventCastAns", + "ECS__EventCastAns", "ECS", - sizeof(ECS__TetheringAns), + sizeof(ECS__EventCastAns), 7, - ecs__tethering_ans__field_descriptors, - ecs__tethering_ans__field_indices_by_name, - 1, ecs__tethering_ans__number_ranges, - (ProtobufCMessageInit) ecs__tethering_ans__init, + ecs__event_cast_ans__field_descriptors, + ecs__event_cast_ans__field_indices_by_name, + 1, ecs__event_cast_ans__number_ranges, + (ProtobufCMessageInit) ecs__event_cast_ans__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] = +static const ProtobufCFieldDescriptor ecs__event_cast_ntf__field_descriptors[5] = { { "category", @@ -2010,7 +2010,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, category), + PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, category), NULL, NULL, 0, /* packed */ @@ -2022,7 +2022,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, length), + PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, length), NULL, NULL, 0, /* packed */ @@ -2034,7 +2034,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, group), + PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, group), NULL, NULL, 0, /* packed */ @@ -2046,7 +2046,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] = PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, action), + PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, action), NULL, NULL, 0, /* packed */ @@ -2057,39 +2057,39 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] = 5, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BYTES, - PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, has_data), - PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, data), + PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, has_data), + PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, data), NULL, NULL, 0, /* packed */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, }; -static const unsigned ecs__tethering_ntf__field_indices_by_name[] = { +static const unsigned ecs__event_cast_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] = +static const ProtobufCIntRange ecs__event_cast_ntf__number_ranges[1 + 1] = { { 1, 0 }, { 0, 5 } }; -const ProtobufCMessageDescriptor ecs__tethering_ntf__descriptor = +const ProtobufCMessageDescriptor ecs__event_cast_ntf__descriptor = { PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "ECS.TetheringNtf", - "TetheringNtf", - "ECS__TetheringNtf", + "ECS.EventCastNtf", + "EventCastNtf", + "ECS__EventCastNtf", "ECS", - sizeof(ECS__TetheringNtf), + sizeof(ECS__EventCastNtf), 5, - ecs__tethering_ntf__field_descriptors, - ecs__tethering_ntf__field_indices_by_name, - 1, ecs__tethering_ntf__number_ranges, - (ProtobufCMessageInit) ecs__tethering_ntf__init, + ecs__event_cast_ntf__field_descriptors, + ecs__event_cast_ntf__field_indices_by_name, + 1, ecs__event_cast_ntf__number_ranges, + (ProtobufCMessageInit) ecs__event_cast_ntf__init, NULL,NULL,NULL /* reserved[123] */ }; static const ProtobufCFieldDescriptor ecs__master__field_descriptors[19] = @@ -2287,37 +2287,37 @@ static const ProtobufCFieldDescriptor ecs__master__field_descriptors[19] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "tethering_req", + "eventcast_req", 103, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_MESSAGE, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__Master, tethering_req), - &ecs__tethering_req__descriptor, + PROTOBUF_C_OFFSETOF(ECS__Master, eventcast_req), + &ecs__event_cast_req__descriptor, NULL, 0, /* packed */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "tethering_ans", + "eventcast_ans", 104, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_MESSAGE, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__Master, tethering_ans), - &ecs__tethering_ans__descriptor, + PROTOBUF_C_OFFSETOF(ECS__Master, eventcast_ans), + &ecs__event_cast_ans__descriptor, NULL, 0, /* packed */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "tethering_ntf", + "eventcast_ntf", 105, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_MESSAGE, 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__Master, tethering_ntf), - &ecs__tethering_ntf__descriptor, + PROTOBUF_C_OFFSETOF(ECS__Master, eventcast_ntf), + &ecs__event_cast_ntf__descriptor, NULL, 0, /* packed */ 0,NULL,NULL /* reserved1,reserved2, etc */ @@ -2329,6 +2329,9 @@ static const unsigned ecs__master__field_indices_by_name[] = { 9, /* field[9] = device_ans */ 10, /* field[10] = device_ntf */ 8, /* field[8] = device_req */ + 17, /* field[17] = eventcast_ans */ + 18, /* field[18] = eventcast_ntf */ + 16, /* field[16] = eventcast_req */ 6, /* field[6] = injector_ans */ 7, /* field[7] = injector_ntf */ 5, /* field[5] = injector_req */ @@ -2339,9 +2342,6 @@ static const unsigned ecs__master__field_indices_by_name[] = { 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] = diff --git a/tizen/src/ecs/genmsg/ecs.pb-c.h b/tizen/src/ecs/genmsg/ecs.pb-c.h index c81f5d3584..a809b64afc 100644 --- a/tizen/src/ecs/genmsg/ecs.pb-c.h +++ b/tizen/src/ecs/genmsg/ecs.pb-c.h @@ -3,7 +3,7 @@ #ifndef PROTOBUF_C_ecs_2eproto__INCLUDED #define PROTOBUF_C_ecs_2eproto__INCLUDED -#include "../../../distrib/protobuf/protobuf-c.h" +#include PROTOBUF_C_BEGIN_DECLS @@ -24,9 +24,9 @@ typedef struct _ECS__MonitorAns ECS__MonitorAns; 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__EventCastReq ECS__EventCastReq; +typedef struct _ECS__EventCastAns ECS__EventCastAns; +typedef struct _ECS__EventCastNtf ECS__EventCastNtf; typedef struct _ECS__Master ECS__Master; @@ -225,7 +225,7 @@ struct _ECS__NfcNtf , NULL, 0,{0,NULL} } -struct _ECS__TetheringReq +struct _ECS__EventCastReq { ProtobufCMessage base; char *category; @@ -235,12 +235,12 @@ struct _ECS__TetheringReq protobuf_c_boolean has_data; ProtobufCBinaryData data; }; -#define ECS__TETHERING_REQ__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_req__descriptor) \ +#define ECS__EVENT_CAST_REQ__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&ecs__event_cast_req__descriptor) \ , NULL, 0, 0, 0, 0,{0,NULL} } -struct _ECS__TetheringAns +struct _ECS__EventCastAns { ProtobufCMessage base; int32_t errcode; @@ -252,12 +252,12 @@ struct _ECS__TetheringAns protobuf_c_boolean has_data; ProtobufCBinaryData data; }; -#define ECS__TETHERING_ANS__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_ans__descriptor) \ +#define ECS__EVENT_CAST_ANS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&ecs__event_cast_ans__descriptor) \ , 0, NULL, NULL, 0, 0, 0, 0,{0,NULL} } -struct _ECS__TetheringNtf +struct _ECS__EventCastNtf { ProtobufCMessage base; char *category; @@ -267,8 +267,8 @@ struct _ECS__TetheringNtf protobuf_c_boolean has_data; ProtobufCBinaryData data; }; -#define ECS__TETHERING_NTF__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_ntf__descriptor) \ +#define ECS__EVENT_CAST_NTF__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&ecs__event_cast_ntf__descriptor) \ , NULL, 0, 0, 0, 0,{0,NULL} } @@ -291,9 +291,9 @@ struct _ECS__Master ECS__MonitorNtf *monitor_ntf; ECS__NfcReq *nfc_req; ECS__NfcNtf *nfc_ntf; - ECS__TetheringReq *tethering_req; - ECS__TetheringAns *tethering_ans; - ECS__TetheringNtf *tethering_ntf; + ECS__EventCastReq *eventcast_req; + ECS__EventCastAns *eventcast_ans; + ECS__EventCastNtf *eventcast_ntf; }; #define ECS__MASTER__INIT \ { PROTOBUF_C_MESSAGE_INIT (&ecs__master__descriptor) \ @@ -585,62 +585,62 @@ ECS__NfcNtf * 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, +/* ECS__EventCastReq methods */ +void ecs__event_cast_req__init + (ECS__EventCastReq *message); +size_t ecs__event_cast_req__get_packed_size + (const ECS__EventCastReq *message); +size_t ecs__event_cast_req__pack + (const ECS__EventCastReq *message, uint8_t *out); -size_t ecs__tethering_req__pack_to_buffer - (const ECS__TetheringReq *message, +size_t ecs__event_cast_req__pack_to_buffer + (const ECS__EventCastReq *message, ProtobufCBuffer *buffer); -ECS__TetheringReq * - ecs__tethering_req__unpack +ECS__EventCastReq * + ecs__event_cast_req__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); -void ecs__tethering_req__free_unpacked - (ECS__TetheringReq *message, +void ecs__event_cast_req__free_unpacked + (ECS__EventCastReq *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, +/* ECS__EventCastAns methods */ +void ecs__event_cast_ans__init + (ECS__EventCastAns *message); +size_t ecs__event_cast_ans__get_packed_size + (const ECS__EventCastAns *message); +size_t ecs__event_cast_ans__pack + (const ECS__EventCastAns *message, uint8_t *out); -size_t ecs__tethering_ans__pack_to_buffer - (const ECS__TetheringAns *message, +size_t ecs__event_cast_ans__pack_to_buffer + (const ECS__EventCastAns *message, ProtobufCBuffer *buffer); -ECS__TetheringAns * - ecs__tethering_ans__unpack +ECS__EventCastAns * + ecs__event_cast_ans__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); -void ecs__tethering_ans__free_unpacked - (ECS__TetheringAns *message, +void ecs__event_cast_ans__free_unpacked + (ECS__EventCastAns *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, +/* ECS__EventCastNtf methods */ +void ecs__event_cast_ntf__init + (ECS__EventCastNtf *message); +size_t ecs__event_cast_ntf__get_packed_size + (const ECS__EventCastNtf *message); +size_t ecs__event_cast_ntf__pack + (const ECS__EventCastNtf *message, uint8_t *out); -size_t ecs__tethering_ntf__pack_to_buffer - (const ECS__TetheringNtf *message, +size_t ecs__event_cast_ntf__pack_to_buffer + (const ECS__EventCastNtf *message, ProtobufCBuffer *buffer); -ECS__TetheringNtf * - ecs__tethering_ntf__unpack +ECS__EventCastNtf * + ecs__event_cast_ntf__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); -void ecs__tethering_ntf__free_unpacked - (ECS__TetheringNtf *message, +void ecs__event_cast_ntf__free_unpacked + (ECS__EventCastNtf *message, ProtobufCAllocator *allocator); /* ECS__Master methods */ void ecs__master__init @@ -708,14 +708,14 @@ typedef void (*ECS__NfcReq_Closure) typedef void (*ECS__NfcNtf_Closure) (const ECS__NfcNtf *message, void *closure_data); -typedef void (*ECS__TetheringReq_Closure) - (const ECS__TetheringReq *message, +typedef void (*ECS__EventCastReq_Closure) + (const ECS__EventCastReq *message, void *closure_data); -typedef void (*ECS__TetheringAns_Closure) - (const ECS__TetheringAns *message, +typedef void (*ECS__EventCastAns_Closure) + (const ECS__EventCastAns *message, void *closure_data); -typedef void (*ECS__TetheringNtf_Closure) - (const ECS__TetheringNtf *message, +typedef void (*ECS__EventCastNtf_Closure) + (const ECS__EventCastNtf *message, void *closure_data); typedef void (*ECS__Master_Closure) (const ECS__Master *message, @@ -741,9 +741,9 @@ extern const ProtobufCMessageDescriptor ecs__monitor_ans__descriptor; 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__event_cast_req__descriptor; +extern const ProtobufCMessageDescriptor ecs__event_cast_ans__descriptor; +extern const ProtobufCMessageDescriptor ecs__event_cast_ntf__descriptor; extern const ProtobufCMessageDescriptor ecs__master__descriptor; PROTOBUF_C_END_DECLS diff --git a/tizen/src/ecs/genmsg/ecs_ids.pb-c.c b/tizen/src/ecs/genmsg/ecs_ids.pb-c.c index 5f6451f794..97977afb23 100644 --- a/tizen/src/ecs/genmsg/ecs_ids.pb-c.c +++ b/tizen/src/ecs/genmsg/ecs_ids.pb-c.c @@ -23,9 +23,9 @@ const ProtobufCEnumValue ecs__master__type__enum_values_by_number[18] = { "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 }, + { "EVENTCAST_REQ", "ECS__MASTER__TYPE__EVENTCAST_REQ", 103 }, + { "EVENTCAST_ANS", "ECS__MASTER__TYPE__EVENTCAST_ANS", 104 }, + { "EVENTCAST_NTF", "ECS__MASTER__TYPE__EVENTCAST_NTF", 105 }, }; static const ProtobufCIntRange ecs__master__type__value_ranges[] = { {2, 0},{101, 13},{0, 18} @@ -37,6 +37,9 @@ const ProtobufCEnumValueIndex ecs__master__type__enum_values_by_name[18] = { "DEVICE_ANS", 8 }, { "DEVICE_NTF", 9 }, { "DEVICE_REQ", 7 }, + { "EVENTCAST_ANS", 16 }, + { "EVENTCAST_NTF", 17 }, + { "EVENTCAST_REQ", 15 }, { "INJECTOR_ANS", 5 }, { "INJECTOR_NTF", 6 }, { "INJECTOR_REQ", 4 }, @@ -47,9 +50,6 @@ const ProtobufCEnumValueIndex ecs__master__type__enum_values_by_name[18] = { "MONITOR_REQ", 10 }, { "NFC_NTF", 14 }, { "NFC_REQ", 13 }, - { "TETHERING_ANS", 16 }, - { "TETHERING_NTF", 17 }, - { "TETHERING_REQ", 15 }, }; const ProtobufCEnumDescriptor ecs__master__type__descriptor = { diff --git a/tizen/src/ecs/genmsg/ecs_ids.pb-c.h b/tizen/src/ecs/genmsg/ecs_ids.pb-c.h index 5a11824060..59c0dec10c 100644 --- a/tizen/src/ecs/genmsg/ecs_ids.pb-c.h +++ b/tizen/src/ecs/genmsg/ecs_ids.pb-c.h @@ -3,7 +3,7 @@ #ifndef PROTOBUF_C_ecs_5fids_2eproto__INCLUDED #define PROTOBUF_C_ecs_5fids_2eproto__INCLUDED -#include "../../../distrib/protobuf/protobuf-c.h" +#include PROTOBUF_C_BEGIN_DECLS @@ -28,9 +28,9 @@ typedef enum _ECS__MasterType { ECS__MASTER__TYPE__MONITOR_NTF = 14, ECS__MASTER__TYPE__NFC_REQ = 101, 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__MASTER__TYPE__EVENTCAST_REQ = 103, + ECS__MASTER__TYPE__EVENTCAST_ANS = 104, + ECS__MASTER__TYPE__EVENTCAST_NTF = 105 } ECS__MasterType; /* --- messages --- */ diff --git a/tizen/src/ecs/msg/ecs.proto b/tizen/src/ecs/msg/ecs.proto index 0f37f39960..dbeabab991 100644 --- a/tizen/src/ecs/msg/ecs.proto +++ b/tizen/src/ecs/msg/ecs.proto @@ -99,7 +99,7 @@ message NfcNtf { optional bytes data = 2; } -message TetheringReq { +message EventCastReq { required string category = 1; required int32 length = 2; required int32 group = 3; @@ -107,7 +107,7 @@ message TetheringReq { optional bytes data = 5; } -message TetheringAns { +message EventCastAns { required int32 errcode = 1; optional string errstr = 2; required string category = 3; @@ -117,7 +117,7 @@ message TetheringAns { optional bytes data = 7; } -message TetheringNtf { +message EventCastNtf { required string category = 1; required int32 length = 2; required int32 group = 3; @@ -152,9 +152,9 @@ message Master { 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; + optional EventCastReq eventcast_req = 103; + optional EventCastAns eventcast_ans = 104; + optional EventCastNtf eventcast_ntf = 105; } diff --git a/tizen/src/ecs/msg/ecs_ids.proto b/tizen/src/ecs/msg/ecs_ids.proto index c4b563c4c2..4b55f7c718 100644 --- a/tizen/src/ecs/msg/ecs_ids.proto +++ b/tizen/src/ecs/msg/ecs_ids.proto @@ -3,8 +3,8 @@ package ECS; option java_package = "org.tizen.ecp.msg.genmsg.ecs"; enum Master_Type { - CHECKVERSION_REQ = 2; - CHECKVERSION_ANS = 3; + CHECKVERSION_REQ = 2; + CHECKVERSION_ANS = 3; KEEPALIVE_REQ = 4; KEEPALIVE_ANS = 5; INJECTOR_REQ = 6; @@ -21,7 +21,7 @@ enum Master_Type { NFC_REQ = 101; NFC_NTF = 102; - TETHERING_REQ = 103; - TETHERING_ANS = 104; - TETHERING_NTF = 105; + EVENTCAST_REQ = 103; + EVENTCAST_ANS = 104; + EVENTCAST_NTF = 105; } diff --git a/tizen/src/eventcast/common.c b/tizen/src/eventcast/common.c new file mode 100644 index 0000000000..f938c30114 --- /dev/null +++ b/tizen/src/eventcast/common.c @@ -0,0 +1,866 @@ +/* + * emulator controller client + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * Kitae Kim + * JiHye Kim + * YeongKyoon Lee + * + * 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 + * + */ + +#ifndef __WIN32 +#include +#else +#define EISCONN WSAEISCONN +#define EALREADY WSAEALREADY +#endif + +#include "qemu-common.h" +#include "qemu/main-loop.h" +#include "qemu/sockets.h" +#include "ui/console.h" + +#include "emulator.h" +#include "common.h" +#include "sensor.h" +#include "touch.h" +#include "emul_state.h" +#include "ecs/ecs_eventcast.h" +#include "genmsg/eventcast.pb-c.h" + +#include "util/new_debug_ch.h" + +DECLARE_DEBUG_CHANNEL(app_tethering); + +#define EVENTCAST_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 + +#define SEND_BUF_MAX_SIZE 4096 +static const char *loopback = "127.0.0.1"; + +enum connection_type { + NONE = 0, + USB, + WIFI, +}; + +typedef struct eventcast_recv_buf { + uint32_t len; + uint32_t stack_size; + char data[MSG_BUF_SIZE]; +} eventcast_recv_buf; + +typedef struct _EventcastState { + int fd; + + // server address + int port; + gchar *ipaddress; + + // connection state + int status; + int type; + + // receiver handling thread + QemuThread thread; + QemuMutex mutex; + + eventcast_recv_buf recv_buf; + + // device state + QTAILQ_HEAD(device, input_device_list) device; + int device_node_cnt; + +} EventcastState; + +static EventcastState *eventcast_client = NULL; +static eventcast_recv_buf recv_buf; + +static void end_eventcast_socket(int sockfd); +static void set_eventcast_connection_status(int status); +#if 0 +static void set_eventcast_app_state(bool state); +static bool get_eventcast_app_state(void); +#endif + +// create master message +static void *build_eventcast_msg(Eventcast__EventCastMsg* msg, int *payloadsize) +{ + void *buf = NULL; + int msg_packed_size = 0; + + msg_packed_size = eventcast__event_cast_msg__get_packed_size(msg); + *payloadsize = msg_packed_size + MSG_LEN_SIZE; + + LOG_TRACE("create eventcast_msg. msg_packed_size %d, payloadsize %d\n", msg_packed_size, *payloadsize); + + buf = g_malloc(*payloadsize); + if (!buf) { + LOG_SEVERE("failed to allocate memory\n"); + return NULL; + } + + eventcast__event_cast_msg__pack(msg, buf + MSG_LEN_SIZE); + + LOG_TRACE("msg_packed_size 1 %x\n", msg_packed_size); + msg_packed_size = htonl(msg_packed_size); + LOG_TRACE("msg_packed_size 2 %x\n", msg_packed_size); + + memcpy(buf, &msg_packed_size, MSG_LEN_SIZE); + + return buf; +} + +bool send_msg_to_controller(void *msg) +{ + Eventcast__EventCastMsg * eventcastMsg = (Eventcast__EventCastMsg *)msg; + + void *buf = NULL; + int payload_size = 0, sent_size = 0; + int total_buf_size = 0; + int sockfd = 0; + bool ret = true; + uint32_t buf_offset = 0; + + buf = build_eventcast_msg(eventcastMsg, &payload_size); + if (!buf) { + return false; + } + + if (!eventcast_client) { + LOG_SEVERE("EventcastState is NULL\n"); + g_free(buf); + return false; + } + sockfd = eventcast_client->fd; + + total_buf_size = payload_size; + do { + LOG_TRACE("sending a buffer as many as this size: %d\n", total_buf_size); + + sent_size = + qemu_sendto(sockfd, buf + buf_offset, total_buf_size, 0, NULL, 0); + if (sent_size < 0) { + perror("failed to send a packet"); + if (errno == EAGAIN) { + fd_set writefds; + struct timeval timeout; + int result = 0; + + FD_ZERO(&writefds); + FD_SET(sockfd, &writefds); + + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + result = select(sockfd + 1, NULL, &writefds, NULL, &timeout); + if (result < 0) { + LOG_INFO("not possible to send data\n"); + ret = false; + break; + } + LOG_TRACE("possible to send data\n"); + continue; + } + + LOG_SEVERE("failed to send a message. sent_size: %d\n", sent_size); + ret = false; + break; + } + + LOG_TRACE("sent size: %d\n", sent_size); + buf_offset += sent_size; + total_buf_size -= sent_size; + } while (total_buf_size > 0); + + LOG_TRACE("sent packets: %d, payload_size %d\n", (payload_size - total_buf_size), payload_size); + g_free(buf); + + return ret; +} + +static bool send_handshake_req_msg(void) +{ + Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT; + Eventcast__HandShakeReq req = EVENTCAST__HAND_SHAKE_REQ__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + req.key = EVENTCAST_MSG_HANDSHAKE_KEY; + + msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_REQ; + msg.handshakereq = &req; + + LOG_TRACE("send handshake_req message\n"); + send_msg_to_controller(&msg); + + LOG_TRACE("leave: %s\n", __func__); + + return true; +} + +static bool send_emul_state_msg(void) +{ + Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT; + Eventcast__EmulatorState emul_state = EVENTCAST__EMULATOR_STATE__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + emul_state.state = EVENTCAST__CONNECTION_STATE__DISCONNECTED; + + msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__EMUL_STATE; + msg.emulstate = &emul_state; + + LOG_INFO("send emulator_state message\n"); + send_msg_to_controller(&msg); + + LOG_TRACE("leave: %s\n", __func__); + + return true; +} + +// event messages +static bool build_event_msg(Eventcast__EventMsg *event) +{ + bool ret = false; + Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__EVENT_MSG; + msg.eventmsg = event; + + ret = send_msg_to_controller(&msg); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static bool send_event_start_ans_msg(Eventcast__MessageResult result) +{ + bool ret = false; + Eventcast__EventMsg event = EVENTCAST__EVENT_MSG__INIT; + Eventcast__StartAns start_ans = EVENTCAST__START_ANS__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + start_ans.result = result; + + event.type = EVENTCAST__EVENT_MSG__TYPE__START_ANS; + event.startans = &start_ans; + + LOG_TRACE("send event_start_ans message\n"); + ret = build_event_msg(&event); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static bool send_set_event_status_msg(Eventcast__EventType event_type, + Eventcast__State status) +{ + bool ret = false; + Eventcast__EventMsg event = EVENTCAST__EVENT_MSG__INIT; + Eventcast__SetEventStatus event_status = EVENTCAST__SET_EVENT_STATUS__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + event_status.type = event_type; + event_status.state = status; + + event.type = EVENTCAST__EVENT_MSG__TYPE__EVENT_STATUS; + event.setstatus = &event_status; + + LOG_TRACE("send event_set_event_status message\n"); + ret = build_event_msg(&event); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +// message handlers +static void msgproc_eventcast_handshake_ans(Eventcast__HandShakeAns *msg) +{ + // handle handshake answer +} + +static void msgproc_app_state_msg(Eventcast__AppState *msg) +{ + int status = EVENTCAST__STATE__DISABLED; + + if (msg->state == EVENTCAST__CONNECTION_STATE__TERMINATED) { + LOG_INFO("app is terminated\n"); + + // set_eventcast_app_state(false); + set_eventcast_sensor_status(status); + set_eventcast_touch_status(status); + + disconnect_eventcast_app(); + } +} + +static bool msgproc_eventcast_event_msg(Eventcast__EventMsg *msg) +{ + bool ret = true; + + switch(msg->type) { + case EVENTCAST__EVENT_MSG__TYPE__START_REQ: + { + int touch_status = 0; + + LOG_TRACE("EVENT_MSG_TYPE_START_REQ\n"); + send_set_event_status_msg(EVENTCAST__EVENT_TYPE__SENSOR, + EVENTCAST__STATE__ENABLED); + + // TODO: check sensor device whether it exists or not + set_eventcast_sensor_status(EVENTCAST__STATE__ENABLED); + + if (is_emul_input_touch_enable()) { + touch_status = EVENTCAST__STATE__ENABLED; + } else { + touch_status = EVENTCAST__STATE__DISABLED; + } + set_eventcast_touch_status(touch_status); + + LOG_TRACE("send touch event_status msg: %d\n", touch_status); + send_set_event_status_msg(EVENTCAST__EVENT_TYPE__TOUCH, touch_status); + + LOG_TRACE("send event_start_ans msg: %d\n", touch_status); + send_event_start_ans_msg(EVENTCAST__MESSAGE_RESULT__SUCCESS); + } + break; + case EVENTCAST__EVENT_MSG__TYPE__TERMINATE: + break; + + default: + LOG_TRACE("invalid event_msg type\n"); + ret = false; + break; + } + + return ret; +} + +static bool handle_eventcast_msg_from_controller(char *data, int len) +{ + Eventcast__EventCastMsg *eventcast = NULL; + bool ret = true; + + eventcast = eventcast__event_cast_msg__unpack(NULL, (size_t)len, + (const uint8_t *)data); + + if (!eventcast) { + LOG_SEVERE("no eventcast massage\n"); + return false; + } + + switch (eventcast->type) { + case EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_ANS: + { + // TODO: set the result of handshake_ans to + Eventcast__HandShakeAns *msg = eventcast->handshakeans; + if (!msg) { + ret = false; + } else { + msgproc_eventcast_handshake_ans(msg); + LOG_TRACE("receive handshake answer\n"); + + set_eventcast_connection_status(CONNECTED); + } + } + break; + case EVENTCAST__EVENT_CAST_MSG__TYPE__APP_STATE: + { + Eventcast__AppState *msg = eventcast->appstate; + + LOG_TRACE("receive app_state msg\n"); + if (!msg) { + ret = false; + } else { + msgproc_app_state_msg(msg); + } + } + break; + case EVENTCAST__EVENT_CAST_MSG__TYPE__EVENT_MSG: + { + Eventcast__EventMsg *msg = eventcast->eventmsg; + + LOG_TRACE("receive event_msg\n"); + if (!msg) { + ret = false; + } else { + msgproc_eventcast_event_msg(msg); + } + } + break; + case EVENTCAST__EVENT_CAST_MSG__TYPE__SENSOR_MSG: + { + Eventcast__SensorMsg *msg = eventcast->sensormsg; + + LOG_TRACE("receive sensor_msg\n"); + if (!msg) { + ret = false; + } else { + msgproc_eventcast_sensor_msg(msg); + } + } + break; + case EVENTCAST__EVENT_CAST_MSG__TYPE__TOUCH_MSG: + { + Eventcast__TouchMsg *msg = eventcast->touchmsg; + + LOG_TRACE("receive touch_msg\n"); + if (!msg) { + ret = false; + } else { + msgproc_eventcast_touch_msg(msg); + } + } + break; + + default: + LOG_WARNING("invalid type message\n"); + ret = false; + break; + } + + eventcast__event_cast_msg__free_unpacked(eventcast, NULL); + return ret; +} + +static void reset_eventcast_recv_buf(void *opaque) +{ + memset(opaque, 0x00, sizeof(eventcast_recv_buf)); +} + +// eventcast client socket +static void eventcast_io_handler(void *opaque) +{ + int payloadsize = 0, read_size = 0; + int to_read_bytes = 0; + int sockfd = 0, ret = 0; + + if (!eventcast_client) { + return; + } + sockfd = eventcast_client->fd; + +#ifndef CONFIG_WIN32 + ret = ioctl(sockfd, FIONREAD, &to_read_bytes); + if (ret < 0) { + perror("invalid ioctl opertion\n"); + disconnect_eventcast_app(); + return; + } + +#else + unsigned long to_read_bytes_long = 0; + ret = ioctlsocket(sockfd, FIONREAD, &to_read_bytes_long); + if (ret < 0) { + perror("invalid ioctl opertion\n"); + disconnect_eventcast_app(); + return; + } + + to_read_bytes = (int)to_read_bytes_long; +#endif + + LOG_TRACE("ioctl: ret: %d, FIONREAD: %d\n", ret, to_read_bytes); + if (to_read_bytes == 0) { + LOG_INFO("there is no read data\n"); + disconnect_eventcast_app(); + return; + } + + // TODO: why this conditional is used?? + if (recv_buf.len == 0) { + ret = qemu_recv(sockfd, &payloadsize, sizeof(payloadsize), 0); + if (ret < sizeof(payloadsize)) { + return; + } + + payloadsize = ntohl(payloadsize); + LOG_TRACE("payload size: %d\n", payloadsize); + +#if 0 + if (payloadsize > to_read_bytes) { + LOG_INFO("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(sockfd, (char *)(recv_buf.data + recv_buf.stack_size), + to_read_bytes, 0); + if (read_size == 0) { + LOG_SEVERE("failed to read data\n"); + disconnect_eventcast_app(); + return; + } + + 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); + if (!snd_buf) { + return; + } else { + memcpy(snd_buf, recv_buf.data, recv_buf.stack_size); + handle_eventcast_msg_from_controller(snd_buf, recv_buf.stack_size); + g_free(snd_buf); + reset_eventcast_recv_buf(&recv_buf); + } + } +} + +// socket functions +static int start_eventcast_socket(const char *ipaddress, int port) +{ + struct sockaddr_in addr; + int sock = -1, ret = 0; + + addr.sin_family = AF_INET; + addr.sin_port = htons(port); // i.e. 1234 + + LOG_INFO("server ip address: %s, port: %d\n", ipaddress, port); + ret = inet_aton(ipaddress, &addr.sin_addr); + if (ret == 0) { + LOG_SEVERE("inet_aton failure\n"); + return -1; + } + + sock = qemu_socket(PF_INET, SOCK_STREAM, 0); + if (sock < 0) { + // set_eventcast_connection_status(DISCONNECTED); + LOG_SEVERE("eventcast socket creation is failed\n", sock); + return -1; + } + LOG_INFO("eventcast socket is created: %d\n", sock); + + qemu_set_nonblock(sock); + + set_eventcast_connection_status(CONNECTING); + + while (1) { + ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr)); + + if (ret == 0) { + LOG_INFO("eventcast socket is connected.\n"); + break; + } else { + int connection_errno = socket_error(); + + if (connection_errno == EINPROGRESS) { + fd_set writefds; + struct timeval timeout; + + LOG_INFO("connection is progressing\n"); + + FD_ZERO(&writefds); + FD_SET(sock, &writefds); + + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + if (select(sock + 1, NULL, &writefds, NULL, &timeout) > 0) { + int opt; + socklen_t opt_size = sizeof(opt); + + qemu_getsockopt(sock, SOL_SOCKET, SO_ERROR, &opt, &opt_size); + if (opt) { + LOG_SEVERE("error in connection %d - %s\n", opt, strerror(opt)); + } else { + LOG_INFO("timeout or error is %d - %s\n", opt, strerror(opt)); + } + } else { + LOG_INFO("error connection %d - %s\n", errno, strerror(errno)); + } + continue; + } else if (connection_errno == EALREADY) { + LOG_INFO("a previous connection has not yet been completed\n"); + ret = 0; + continue; + } else if (connection_errno == EISCONN) { + LOG_INFO("connection is already connected\n"); + ret = 0; + break; + } else { + perror("connect failure"); + ret = -connection_errno; + break; + } + } + } + + if (ret < 0) { + if (ret == -ECONNREFUSED) { + LOG_INFO("socket connection is refused\n"); + set_eventcast_connection_status(CONNREFUSED); + } + LOG_INFO("close socket\n"); + end_eventcast_socket(sock); + sock = -1; + } + + return sock; +} + +static void end_eventcast_socket(int sockfd) +{ + int status = EVENTCAST__STATE__DISABLED; + + LOG_TRACE("enter: %s\n", __func__); + + if (closesocket(sockfd) < 0) { + perror("closesocket failure"); + return; + } + + eventcast_client->fd = -1; + + LOG_INFO("close eventcast socket\n"); + set_eventcast_connection_status(DISCONNECTED); + set_eventcast_sensor_status(status); + set_eventcast_touch_status(status); + + LOG_TRACE("leave: %s\n", __func__); +} + +#if 0 +static void set_eventcast_app_state(bool state) +{ + LOG_TRACE("set eventcast_app state: %d", state); + app_state = state; +} + +static bool get_eventcast_app_state(void) +{ + return app_state; +} +#endif + +// ecs <-> eventcast +int get_eventcast_connection_status(void) +{ + int status = 0; + + if (!eventcast_client) { + LOG_INFO("eventcast_client is null\n"); + LOG_INFO("tetherging connection status: %d\n", status); + return DISCONNECTED; + } + + qemu_mutex_lock(&eventcast_client->mutex); + status = eventcast_client->status; + qemu_mutex_unlock(&eventcast_client->mutex); + + LOG_INFO("tetherging connection status: %d\n", status); + + return status; +} + +int get_eventcast_connected_port(void) +{ + if (!eventcast_client) { + LOG_SEVERE("eventcast_client is null\n"); + return 0; + } + + LOG_TRACE("connected port: %d\n", eventcast_client->port); + return eventcast_client->port; +} + +const char *get_eventcast_connected_ipaddr(void) +{ + if (!eventcast_client) { + LOG_SEVERE("eventcast client is null\n"); + return NULL; + } + + LOG_TRACE("connected ip address: %s\n", eventcast_client->ipaddress); + return eventcast_client->ipaddress; +} + +static void set_eventcast_connection_status(int status) +{ + if (!eventcast_client) { + return; + } + + qemu_mutex_lock(&eventcast_client->mutex); + eventcast_client->status = status; + qemu_mutex_unlock(&eventcast_client->mutex); + + send_eventcast_connection_status_ecp(); +} + +static void eventcast_notify_exit(Notifier *notifier, void *data) +{ + LOG_INFO("eventcast_notify_exit\n"); + disconnect_eventcast_app(); +} +static Notifier eventcast_exit = { .notify = eventcast_notify_exit }; + +static void *initialize_eventcast_socket(void *opaque); + +int connect_eventcast_app(const char *ipaddress, int port) +{ + EventcastState *client = NULL; + int ipaddr_len = 0; + + client = g_malloc0(sizeof(EventcastState)); + if (!client) { + return -1; + } + + client->port = port; + + if (ipaddress) { + ipaddr_len = strlen(ipaddress); + client->type = WIFI; + } else { + ipaddr_len = strlen(loopback); + ipaddress = loopback; + client->type = USB; + } + + client->ipaddress = g_malloc0(ipaddr_len + 1); + if (!client->ipaddress) { + LOG_SEVERE("failed to allocate ipaddress buffer\n"); + g_free(client); + return -1; + } + g_strlcpy(client->ipaddress, ipaddress, ipaddr_len + 1); + LOG_INFO("connection info. ip %s, port %d type %d\n", + client->ipaddress, client->port, client->type); + + eventcast_client = client; + + qemu_mutex_init(&eventcast_client->mutex); + qemu_thread_create(&eventcast_client->thread, "eventcast-io-thread", + initialize_eventcast_socket, client, + QEMU_THREAD_DETACHED); + + return 0; +} + +int disconnect_eventcast_app(void) +{ + int sock = 0; + + LOG_INFO("disconnect app from ecp\n"); + if (!eventcast_client) { + LOG_SEVERE("eventcast client instance is NULL\n"); + return -1; + } + + sock = eventcast_client->fd; + if (sock < 0) { + LOG_SEVERE("eventcast socket is already terminated or not ready\n"); + return -1; + } else { + send_emul_state_msg(); + end_eventcast_socket(sock); + } + + return 0; +} + +static int eventcast_loop(int sockfd) +{ + int ret = 0; + fd_set readfds; + struct timeval timeout; + + FD_ZERO(&readfds); + FD_SET(sockfd, &readfds); + + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + ret = select(sockfd + 1, &readfds, NULL, NULL, &timeout); + LOG_TRACE("select timeout! result: %d\n", ret); + + if (ret > 0) { + LOG_TRACE("ready for read operation!!\n"); + eventcast_io_handler(socket); + } + + return ret; +} + +static void *initialize_eventcast_socket(void *opaque) +{ + EventcastState *client = (EventcastState *)opaque; + LOG_TRACE("callback function for eventcast_thread\n"); + + if (!client) { + LOG_SEVERE("EventcastState is NULL\n"); + return NULL; + } + + client->fd = start_eventcast_socket(client->ipaddress, client->port); + if (client->fd < 0) { + LOG_SEVERE("failed to start eventcast_socket\n"); + return NULL; + } + LOG_TRACE("eventcast_sock: %d\n", client->fd); + + reset_eventcast_recv_buf(&recv_buf); + send_handshake_req_msg(); + + emulator_add_exit_notifier(&eventcast_exit); + + while (1) { + qemu_mutex_lock(&client->mutex); + if (client->status == DISCONNECTED) { + qemu_mutex_unlock(&client->mutex); + LOG_INFO("disconnected socket. destroy this thread\n"); + break; + } + qemu_mutex_unlock(&client->mutex); + + eventcast_loop(client->fd); + } + + return client; +} diff --git a/tizen/src/eventcast/common.h b/tizen/src/eventcast/common.h new file mode 100644 index 0000000000..14229913d7 --- /dev/null +++ b/tizen/src/eventcast/common.h @@ -0,0 +1,53 @@ +/* + * emulator controller client + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * Kitae Kim + * JiHye Kim + * YeongKyoon Lee + * + * 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 + * + */ + +enum connection_status { + DISCONNECTED = 0, + CONNECTED, + CONNECTING, + CONNREFUSED, +}; + +enum touch_status { + RELEASED = 0, + PRESSED, +}; + +bool send_msg_to_controller(void *msg); + +int connect_eventcast_app(const char *ipaddress, int port); + +int disconnect_eventcast_app(void); + +int get_eventcast_connection_status(void); + +int get_eventcast_connected_port(void); + +const char *get_eventcast_connected_ipaddr(void); diff --git a/tizen/src/eventcast/encode_fb.c b/tizen/src/eventcast/encode_fb.c new file mode 100644 index 0000000000..c6391369ac --- /dev/null +++ b/tizen/src/eventcast/encode_fb.c @@ -0,0 +1,300 @@ +/* + * emulator controller client + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * Kitae Kim + * SangHo Park + * YeongKyoon Lee + * + * 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 + +#include "emulator_common.h" +#include "emul_state.h" +#include "skin/maruskin_operation.h" +#include "encode_fb.h" + +#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG) +#include +#endif +#ifdef CONFIG_WEBP +#include +#include +#endif + +#include "util/new_debug_ch.h" + +DECLARE_DEBUG_CHANNEL(app_tethering); + +#ifdef CONFIG_WEBP +/* + * webp functions + */ +static void *encode_webp(void) +{ + int width = 0, height = 0, image_stride = 0; + size_t ret = 0; + + struct encode_mem *container = NULL; + uint8_t *surface = NULL; + uint32_t surface_size = 0; + + container = g_malloc(sizeof(struct encode_mem)); + if (!container) { + LOG_SEVERE("failed to allocate encode_mem\n"); + return NULL; + } + + container->buffer = NULL; + container->length = 0; + + width = get_emul_resolution_width(); + height = get_emul_resolution_height(); + + image_stride = width * 4; + LOG_TRACE("width %d, height %d, stride %d, raw image %d\n", + width, height, image_stride, (image_stride * height)); + + surface_size = width * height * 4; + + surface = g_malloc0(surface_size); + if (!surface) { + LOG_SEVERE("failed to allocate framebuffer\n"); + return NULL; + } + + if (!maru_extract_framebuffer(surface)) { + LOG_SEVERE("failed to extract framebuffer\n"); + g_free(surface); + return NULL; + } + + container = g_malloc(sizeof(struct encode_mem)); + if (!container) { + LOG_SEVERE("failed to allocate encode_mem\n"); + g_free(surface); + return NULL; + } + + container->buffer = NULL; + container->length = 0; + + ret = WebPEncodeLosslessBGRA((const uint8_t *)surface, width, + height, image_stride, &container->buffer); + LOG_TRACE("lossless encode framebuffer via webp. result %zu\n", ret); + + container->length = (int)ret; + + g_free(surface); + + return container; +} +#endif + +#ifdef CONFIG_PNG +/* + * png functions + */ +static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t len) +{ + struct encode_mem *p = (struct encode_mem *)png_get_io_ptr(png_ptr); + size_t nsize = p->length + len; + + if (p->buffer) { + p->buffer = g_realloc(p->buffer, nsize); + } else { + p->buffer = g_malloc(nsize); + } + + if (!p->buffer) { + LOG_SEVERE("failed to allocate \n"); + } else { + memcpy(p->buffer + p->length, data, len); + p->length += len; + } +} + +static void user_flush_data(png_structp png_ptr) +{ +} + +static void *encode_png(void) +{ + int width = 0, height = 0, image_stride = 0; + int row_index; + /* + * bit_depth: depending on color type + * in case of RGB_ALPHA, 8 or 16 + */ + int bit_depth = 8; + struct encode_mem *container = NULL; + uint8_t *surface = NULL; + uint32_t surface_size = 0; + + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + png_bytepp row_pointers = NULL; + + width = get_emul_resolution_width(); + height = get_emul_resolution_height(); + + image_stride = width * 4; + LOG_TRACE("width %d, height %d, stride %d, raw image %d\n", + width, height, image_stride, (image_stride * height)); + + surface_size = width * height * 4; + + surface = g_malloc0(surface_size); + if (!surface) { + LOG_SEVERE("failed to allocate framebuffer\n"); + return NULL; + } + + if (!maru_extract_framebuffer(surface)) { + LOG_SEVERE("failed to extract framebuffer\n"); + g_free(surface); + return NULL; + } + + LOG_TRACE("png_create_write_struct\n"); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!png_ptr) { + LOG_SEVERE("png_create_write_struct failure\n"); + g_free(surface); + return NULL; + } + + LOG_TRACE("png_create_info_struct\n"); + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) { + LOG_SEVERE("png_create_info_struct failure\n"); + g_free(surface); + png_destroy_write_struct(&png_ptr, &info_ptr); + return NULL; + } + + LOG_TRACE("try png_jmpbuf\n"); + if (setjmp(png_jmpbuf(png_ptr))) { + LOG_SEVERE("png_jmpbuf failure\n"); + g_free(surface); + png_destroy_write_struct(&png_ptr, &info_ptr); + png_destroy_info_struct(png_ptr, &info_ptr); + return NULL; + } + + LOG_TRACE("png_init_io\n"); + container = g_malloc(sizeof(struct encode_mem)); + if (!container) { + LOG_SEVERE("failed to allocate encode_mem\n"); + g_free(surface); + png_destroy_write_struct(&png_ptr, &info_ptr); + png_destroy_info_struct(png_ptr, &info_ptr); + return NULL; + } + + container->buffer = NULL; + container->length = 0; + + png_set_write_fn(png_ptr, container, user_write_data, user_flush_data); + + // set image attributes + png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, + PNG_COLOR_TYPE_RGB_ALPHA, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr, info_ptr); + + // Filp BGR pixels to RGB + png_set_bgr(png_ptr); + + row_pointers = png_malloc(png_ptr, sizeof(png_bytep) * height); + if (row_pointers == NULL) { + LOG_SEVERE("failed to allocate png memory\n"); + g_free(surface); + png_destroy_write_struct(&png_ptr, &info_ptr); + png_destroy_info_struct(png_ptr, &info_ptr); + return NULL; + } + + for (row_index = 0; row_index < height; row_index++) { + row_pointers[row_index] = surface + (row_index * image_stride); + } + + LOG_TRACE("png_write_image\n"); + png_write_image(png_ptr, row_pointers); + + LOG_TRACE("png_write_end\n"); + png_write_end(png_ptr, info_ptr); + + g_free(surface); + + LOG_TRACE("png image size %d\n", container->length); + png_destroy_write_struct(&png_ptr, &info_ptr); + png_destroy_info_struct(png_ptr, &info_ptr); + + return container; +} +#endif + +void *encode_framebuffer(int encoder) +{ + void *output = NULL; + +#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG) + struct timespec start, end; + + clock_gettime(CLOCK_MONOTONIC, &start); +#endif + +#ifdef CONFIG_PNG + output = encode_png(); +#endif + +#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG) + clock_gettime(CLOCK_MONOTONIC, &end); + + LOG_TRACE("encoding time: %.5f seconds\n", + ((double)end.tv_sec + (1.0e-9 * end.tv_nsec)) - + ((double)start.tv_sec + (1.0e-9 * start.tv_nsec))); +#endif + + LOG_TRACE("encode framebuffer: %p\n", output); + + return output; +} + +static bool display_dirty = false; + +void set_display_dirty(bool dirty) +{ + // LOG_TRACE("qemu display update: %d\n", display_dirty); + display_dirty = dirty; +} + +bool is_display_dirty(void) +{ + return display_dirty; +} diff --git a/tizen/src/eventcast/encode_fb.h b/tizen/src/eventcast/encode_fb.h new file mode 100644 index 0000000000..32a777f22f --- /dev/null +++ b/tizen/src/eventcast/encode_fb.h @@ -0,0 +1,42 @@ +/* + * emulator controller client + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * Kitae Kim + * JiHye Kim + * YeongKyoon Lee + * + * 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 + * + */ + +struct encode_mem { + uint8_t *buffer; + uint32_t length; +}; + +void *encode_framebuffer(int encoder); + +bool maru_extract_framebuffer(void *buffer); + +void set_display_dirty(bool dirty); + +bool is_display_dirty(void); diff --git a/tizen/src/eventcast/genmsg/eventcast.pb-c.c b/tizen/src/eventcast/genmsg/eventcast.pb-c.c new file mode 100644 index 0000000000..bfc55e8503 --- /dev/null +++ b/tizen/src/eventcast/genmsg/eventcast.pb-c.c @@ -0,0 +1,2314 @@ +/* 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 "eventcast.pb-c.h" +void eventcast__hand_shake_req__init + (Eventcast__HandShakeReq *message) +{ + static Eventcast__HandShakeReq init_value = EVENTCAST__HAND_SHAKE_REQ__INIT; + *message = init_value; +} +size_t eventcast__hand_shake_req__get_packed_size + (const Eventcast__HandShakeReq *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_req__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__hand_shake_req__pack + (const Eventcast__HandShakeReq *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_req__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__hand_shake_req__pack_to_buffer + (const Eventcast__HandShakeReq *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_req__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__HandShakeReq * + eventcast__hand_shake_req__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__HandShakeReq *) + protobuf_c_message_unpack (&eventcast__hand_shake_req__descriptor, + allocator, len, data); +} +void eventcast__hand_shake_req__free_unpacked + (Eventcast__HandShakeReq *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_req__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__hand_shake_ans__init + (Eventcast__HandShakeAns *message) +{ + static Eventcast__HandShakeAns init_value = EVENTCAST__HAND_SHAKE_ANS__INIT; + *message = init_value; +} +size_t eventcast__hand_shake_ans__get_packed_size + (const Eventcast__HandShakeAns *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_ans__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__hand_shake_ans__pack + (const Eventcast__HandShakeAns *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_ans__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__hand_shake_ans__pack_to_buffer + (const Eventcast__HandShakeAns *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_ans__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__HandShakeAns * + eventcast__hand_shake_ans__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__HandShakeAns *) + protobuf_c_message_unpack (&eventcast__hand_shake_ans__descriptor, + allocator, len, data); +} +void eventcast__hand_shake_ans__free_unpacked + (Eventcast__HandShakeAns *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_ans__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__emulator_state__init + (Eventcast__EmulatorState *message) +{ + static Eventcast__EmulatorState init_value = EVENTCAST__EMULATOR_STATE__INIT; + *message = init_value; +} +size_t eventcast__emulator_state__get_packed_size + (const Eventcast__EmulatorState *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__emulator_state__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__emulator_state__pack + (const Eventcast__EmulatorState *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__emulator_state__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__emulator_state__pack_to_buffer + (const Eventcast__EmulatorState *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__emulator_state__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__EmulatorState * + eventcast__emulator_state__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__EmulatorState *) + protobuf_c_message_unpack (&eventcast__emulator_state__descriptor, + allocator, len, data); +} +void eventcast__emulator_state__free_unpacked + (Eventcast__EmulatorState *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__emulator_state__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__app_state__init + (Eventcast__AppState *message) +{ + static Eventcast__AppState init_value = EVENTCAST__APP_STATE__INIT; + *message = init_value; +} +size_t eventcast__app_state__get_packed_size + (const Eventcast__AppState *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__app_state__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__app_state__pack + (const Eventcast__AppState *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__app_state__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__app_state__pack_to_buffer + (const Eventcast__AppState *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__app_state__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__AppState * + eventcast__app_state__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__AppState *) + protobuf_c_message_unpack (&eventcast__app_state__descriptor, + allocator, len, data); +} +void eventcast__app_state__free_unpacked + (Eventcast__AppState *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__app_state__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__start_req__init + (Eventcast__StartReq *message) +{ + static Eventcast__StartReq init_value = EVENTCAST__START_REQ__INIT; + *message = init_value; +} +size_t eventcast__start_req__get_packed_size + (const Eventcast__StartReq *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_req__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__start_req__pack + (const Eventcast__StartReq *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_req__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__start_req__pack_to_buffer + (const Eventcast__StartReq *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_req__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__StartReq * + eventcast__start_req__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__StartReq *) + protobuf_c_message_unpack (&eventcast__start_req__descriptor, + allocator, len, data); +} +void eventcast__start_req__free_unpacked + (Eventcast__StartReq *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_req__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__start_ans__init + (Eventcast__StartAns *message) +{ + static Eventcast__StartAns init_value = EVENTCAST__START_ANS__INIT; + *message = init_value; +} +size_t eventcast__start_ans__get_packed_size + (const Eventcast__StartAns *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_ans__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__start_ans__pack + (const Eventcast__StartAns *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_ans__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__start_ans__pack_to_buffer + (const Eventcast__StartAns *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_ans__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__StartAns * + eventcast__start_ans__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__StartAns *) + protobuf_c_message_unpack (&eventcast__start_ans__descriptor, + allocator, len, data); +} +void eventcast__start_ans__free_unpacked + (Eventcast__StartAns *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_ans__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__set_event_status__init + (Eventcast__SetEventStatus *message) +{ + static Eventcast__SetEventStatus init_value = EVENTCAST__SET_EVENT_STATUS__INIT; + *message = init_value; +} +size_t eventcast__set_event_status__get_packed_size + (const Eventcast__SetEventStatus *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_event_status__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__set_event_status__pack + (const Eventcast__SetEventStatus *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_event_status__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__set_event_status__pack_to_buffer + (const Eventcast__SetEventStatus *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_event_status__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__SetEventStatus * + eventcast__set_event_status__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__SetEventStatus *) + protobuf_c_message_unpack (&eventcast__set_event_status__descriptor, + allocator, len, data); +} +void eventcast__set_event_status__free_unpacked + (Eventcast__SetEventStatus *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_event_status__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__event_msg__init + (Eventcast__EventMsg *message) +{ + static Eventcast__EventMsg init_value = EVENTCAST__EVENT_MSG__INIT; + *message = init_value; +} +size_t eventcast__event_msg__get_packed_size + (const Eventcast__EventMsg *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_msg__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__event_msg__pack + (const Eventcast__EventMsg *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_msg__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__event_msg__pack_to_buffer + (const Eventcast__EventMsg *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_msg__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__EventMsg * + eventcast__event_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__EventMsg *) + protobuf_c_message_unpack (&eventcast__event_msg__descriptor, + allocator, len, data); +} +void eventcast__event_msg__free_unpacked + (Eventcast__EventMsg *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_msg__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__event_terminate__init + (Eventcast__EventTerminate *message) +{ + static Eventcast__EventTerminate init_value = EVENTCAST__EVENT_TERMINATE__INIT; + *message = init_value; +} +size_t eventcast__event_terminate__get_packed_size + (const Eventcast__EventTerminate *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_terminate__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__event_terminate__pack + (const Eventcast__EventTerminate *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_terminate__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__event_terminate__pack_to_buffer + (const Eventcast__EventTerminate *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_terminate__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__EventTerminate * + eventcast__event_terminate__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__EventTerminate *) + protobuf_c_message_unpack (&eventcast__event_terminate__descriptor, + allocator, len, data); +} +void eventcast__event_terminate__free_unpacked + (Eventcast__EventTerminate *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_terminate__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__set_sensor_status__init + (Eventcast__SetSensorStatus *message) +{ + static Eventcast__SetSensorStatus init_value = EVENTCAST__SET_SENSOR_STATUS__INIT; + *message = init_value; +} +size_t eventcast__set_sensor_status__get_packed_size + (const Eventcast__SetSensorStatus *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_sensor_status__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__set_sensor_status__pack + (const Eventcast__SetSensorStatus *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_sensor_status__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__set_sensor_status__pack_to_buffer + (const Eventcast__SetSensorStatus *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_sensor_status__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__SetSensorStatus * + eventcast__set_sensor_status__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__SetSensorStatus *) + protobuf_c_message_unpack (&eventcast__set_sensor_status__descriptor, + allocator, len, data); +} +void eventcast__set_sensor_status__free_unpacked + (Eventcast__SetSensorStatus *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_sensor_status__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__sensor_data__init + (Eventcast__SensorData *message) +{ + static Eventcast__SensorData init_value = EVENTCAST__SENSOR_DATA__INIT; + *message = init_value; +} +size_t eventcast__sensor_data__get_packed_size + (const Eventcast__SensorData *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_data__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__sensor_data__pack + (const Eventcast__SensorData *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_data__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__sensor_data__pack_to_buffer + (const Eventcast__SensorData *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_data__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__SensorData * + eventcast__sensor_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__SensorData *) + protobuf_c_message_unpack (&eventcast__sensor_data__descriptor, + allocator, len, data); +} +void eventcast__sensor_data__free_unpacked + (Eventcast__SensorData *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_data__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__sensor_msg__init + (Eventcast__SensorMsg *message) +{ + static Eventcast__SensorMsg init_value = EVENTCAST__SENSOR_MSG__INIT; + *message = init_value; +} +size_t eventcast__sensor_msg__get_packed_size + (const Eventcast__SensorMsg *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_msg__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__sensor_msg__pack + (const Eventcast__SensorMsg *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_msg__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__sensor_msg__pack_to_buffer + (const Eventcast__SensorMsg *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_msg__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__SensorMsg * + eventcast__sensor_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__SensorMsg *) + protobuf_c_message_unpack (&eventcast__sensor_msg__descriptor, + allocator, len, data); +} +void eventcast__sensor_msg__free_unpacked + (Eventcast__SensorMsg *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_msg__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__resolution__init + (Eventcast__Resolution *message) +{ + static Eventcast__Resolution init_value = EVENTCAST__RESOLUTION__INIT; + *message = init_value; +} +size_t eventcast__resolution__get_packed_size + (const Eventcast__Resolution *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__resolution__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__resolution__pack + (const Eventcast__Resolution *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__resolution__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__resolution__pack_to_buffer + (const Eventcast__Resolution *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__resolution__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__Resolution * + eventcast__resolution__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__Resolution *) + protobuf_c_message_unpack (&eventcast__resolution__descriptor, + allocator, len, data); +} +void eventcast__resolution__free_unpacked + (Eventcast__Resolution *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__resolution__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__display_msg__init + (Eventcast__DisplayMsg *message) +{ + static Eventcast__DisplayMsg init_value = EVENTCAST__DISPLAY_MSG__INIT; + *message = init_value; +} +size_t eventcast__display_msg__get_packed_size + (const Eventcast__DisplayMsg *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__display_msg__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__display_msg__pack + (const Eventcast__DisplayMsg *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__display_msg__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__display_msg__pack_to_buffer + (const Eventcast__DisplayMsg *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__display_msg__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__DisplayMsg * + eventcast__display_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__DisplayMsg *) + protobuf_c_message_unpack (&eventcast__display_msg__descriptor, + allocator, len, data); +} +void eventcast__display_msg__free_unpacked + (Eventcast__DisplayMsg *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__display_msg__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__touch_max_count__init + (Eventcast__TouchMaxCount *message) +{ + static Eventcast__TouchMaxCount init_value = EVENTCAST__TOUCH_MAX_COUNT__INIT; + *message = init_value; +} +size_t eventcast__touch_max_count__get_packed_size + (const Eventcast__TouchMaxCount *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_max_count__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__touch_max_count__pack + (const Eventcast__TouchMaxCount *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_max_count__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__touch_max_count__pack_to_buffer + (const Eventcast__TouchMaxCount *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_max_count__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__TouchMaxCount * + eventcast__touch_max_count__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__TouchMaxCount *) + protobuf_c_message_unpack (&eventcast__touch_max_count__descriptor, + allocator, len, data); +} +void eventcast__touch_max_count__free_unpacked + (Eventcast__TouchMaxCount *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_max_count__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__touch_data__init + (Eventcast__TouchData *message) +{ + static Eventcast__TouchData init_value = EVENTCAST__TOUCH_DATA__INIT; + *message = init_value; +} +size_t eventcast__touch_data__get_packed_size + (const Eventcast__TouchData *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_data__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__touch_data__pack + (const Eventcast__TouchData *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_data__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__touch_data__pack_to_buffer + (const Eventcast__TouchData *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_data__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__TouchData * + eventcast__touch_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__TouchData *) + protobuf_c_message_unpack (&eventcast__touch_data__descriptor, + allocator, len, data); +} +void eventcast__touch_data__free_unpacked + (Eventcast__TouchData *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_data__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__hwkey_msg__init + (Eventcast__HWKeyMsg *message) +{ + static Eventcast__HWKeyMsg init_value = EVENTCAST__HWKEY_MSG__INIT; + *message = init_value; +} +size_t eventcast__hwkey_msg__get_packed_size + (const Eventcast__HWKeyMsg *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hwkey_msg__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__hwkey_msg__pack + (const Eventcast__HWKeyMsg *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hwkey_msg__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__hwkey_msg__pack_to_buffer + (const Eventcast__HWKeyMsg *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hwkey_msg__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__HWKeyMsg * + eventcast__hwkey_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__HWKeyMsg *) + protobuf_c_message_unpack (&eventcast__hwkey_msg__descriptor, + allocator, len, data); +} +void eventcast__hwkey_msg__free_unpacked + (Eventcast__HWKeyMsg *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hwkey_msg__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__touch_msg__init + (Eventcast__TouchMsg *message) +{ + static Eventcast__TouchMsg init_value = EVENTCAST__TOUCH_MSG__INIT; + *message = init_value; +} +size_t eventcast__touch_msg__get_packed_size + (const Eventcast__TouchMsg *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_msg__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__touch_msg__pack + (const Eventcast__TouchMsg *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_msg__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__touch_msg__pack_to_buffer + (const Eventcast__TouchMsg *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_msg__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__TouchMsg * + eventcast__touch_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__TouchMsg *) + protobuf_c_message_unpack (&eventcast__touch_msg__descriptor, + allocator, len, data); +} +void eventcast__touch_msg__free_unpacked + (Eventcast__TouchMsg *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_msg__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void eventcast__event_cast_msg__init + (Eventcast__EventCastMsg *message) +{ + static Eventcast__EventCastMsg init_value = EVENTCAST__EVENT_CAST_MSG__INIT; + *message = init_value; +} +size_t eventcast__event_cast_msg__get_packed_size + (const Eventcast__EventCastMsg *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_cast_msg__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t eventcast__event_cast_msg__pack + (const Eventcast__EventCastMsg *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_cast_msg__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t eventcast__event_cast_msg__pack_to_buffer + (const Eventcast__EventCastMsg *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_cast_msg__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Eventcast__EventCastMsg * + eventcast__event_cast_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Eventcast__EventCastMsg *) + protobuf_c_message_unpack (&eventcast__event_cast_msg__descriptor, + allocator, len, data); +} +void eventcast__event_cast_msg__free_unpacked + (Eventcast__EventCastMsg *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_cast_msg__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor eventcast__hand_shake_req__field_descriptors[1] = +{ + { + "key", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__HandShakeReq, key), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__hand_shake_req__field_indices_by_name[] = { + 0, /* field[0] = key */ +}; +static const ProtobufCIntRange eventcast__hand_shake_req__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor eventcast__hand_shake_req__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.HandShakeReq", + "HandShakeReq", + "Eventcast__HandShakeReq", + "eventcast", + sizeof(Eventcast__HandShakeReq), + 1, + eventcast__hand_shake_req__field_descriptors, + eventcast__hand_shake_req__field_indices_by_name, + 1, eventcast__hand_shake_req__number_ranges, + (ProtobufCMessageInit) eventcast__hand_shake_req__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__hand_shake_ans__field_descriptors[1] = +{ + { + "result", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__HandShakeAns, result), + &eventcast__message_result__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__hand_shake_ans__field_indices_by_name[] = { + 0, /* field[0] = result */ +}; +static const ProtobufCIntRange eventcast__hand_shake_ans__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor eventcast__hand_shake_ans__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.HandShakeAns", + "HandShakeAns", + "Eventcast__HandShakeAns", + "eventcast", + sizeof(Eventcast__HandShakeAns), + 1, + eventcast__hand_shake_ans__field_descriptors, + eventcast__hand_shake_ans__field_indices_by_name, + 1, eventcast__hand_shake_ans__number_ranges, + (ProtobufCMessageInit) eventcast__hand_shake_ans__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__emulator_state__field_descriptors[1] = +{ + { + "state", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__EmulatorState, state), + &eventcast__connection_state__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__emulator_state__field_indices_by_name[] = { + 0, /* field[0] = state */ +}; +static const ProtobufCIntRange eventcast__emulator_state__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor eventcast__emulator_state__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.EmulatorState", + "EmulatorState", + "Eventcast__EmulatorState", + "eventcast", + sizeof(Eventcast__EmulatorState), + 1, + eventcast__emulator_state__field_descriptors, + eventcast__emulator_state__field_indices_by_name, + 1, eventcast__emulator_state__number_ranges, + (ProtobufCMessageInit) eventcast__emulator_state__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__app_state__field_descriptors[1] = +{ + { + "state", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__AppState, state), + &eventcast__connection_state__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__app_state__field_indices_by_name[] = { + 0, /* field[0] = state */ +}; +static const ProtobufCIntRange eventcast__app_state__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor eventcast__app_state__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.AppState", + "AppState", + "Eventcast__AppState", + "eventcast", + sizeof(Eventcast__AppState), + 1, + eventcast__app_state__field_descriptors, + eventcast__app_state__field_indices_by_name, + 1, eventcast__app_state__number_ranges, + (ProtobufCMessageInit) eventcast__app_state__init, + NULL,NULL,NULL /* reserved[123] */ +}; +#define eventcast__start_req__field_descriptors NULL +#define eventcast__start_req__field_indices_by_name NULL +#define eventcast__start_req__number_ranges NULL +const ProtobufCMessageDescriptor eventcast__start_req__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.StartReq", + "StartReq", + "Eventcast__StartReq", + "eventcast", + sizeof(Eventcast__StartReq), + 0, + eventcast__start_req__field_descriptors, + eventcast__start_req__field_indices_by_name, + 0, eventcast__start_req__number_ranges, + (ProtobufCMessageInit) eventcast__start_req__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__start_ans__field_descriptors[1] = +{ + { + "result", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__StartAns, result), + &eventcast__message_result__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__start_ans__field_indices_by_name[] = { + 0, /* field[0] = result */ +}; +static const ProtobufCIntRange eventcast__start_ans__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor eventcast__start_ans__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.StartAns", + "StartAns", + "Eventcast__StartAns", + "eventcast", + sizeof(Eventcast__StartAns), + 1, + eventcast__start_ans__field_descriptors, + eventcast__start_ans__field_indices_by_name, + 1, eventcast__start_ans__number_ranges, + (ProtobufCMessageInit) eventcast__start_ans__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__set_event_status__field_descriptors[2] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__SetEventStatus, type), + &eventcast__event_type__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "state", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__SetEventStatus, state), + &eventcast__state__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__set_event_status__field_indices_by_name[] = { + 1, /* field[1] = state */ + 0, /* field[0] = type */ +}; +static const ProtobufCIntRange eventcast__set_event_status__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor eventcast__set_event_status__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.SetEventStatus", + "SetEventStatus", + "Eventcast__SetEventStatus", + "eventcast", + sizeof(Eventcast__SetEventStatus), + 2, + eventcast__set_event_status__field_descriptors, + eventcast__set_event_status__field_indices_by_name, + 1, eventcast__set_event_status__number_ranges, + (ProtobufCMessageInit) eventcast__set_event_status__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue eventcast__event_msg__type__enum_values_by_number[4] = +{ + { "START_REQ", "EVENTCAST__EVENT_MSG__TYPE__START_REQ", 2 }, + { "START_ANS", "EVENTCAST__EVENT_MSG__TYPE__START_ANS", 3 }, + { "TERMINATE", "EVENTCAST__EVENT_MSG__TYPE__TERMINATE", 4 }, + { "EVENT_STATUS", "EVENTCAST__EVENT_MSG__TYPE__EVENT_STATUS", 5 }, +}; +static const ProtobufCIntRange eventcast__event_msg__type__value_ranges[] = { +{2, 0},{0, 4} +}; +const ProtobufCEnumValueIndex eventcast__event_msg__type__enum_values_by_name[4] = +{ + { "EVENT_STATUS", 3 }, + { "START_ANS", 1 }, + { "START_REQ", 0 }, + { "TERMINATE", 2 }, +}; +const ProtobufCEnumDescriptor eventcast__event_msg__type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.EventMsg.TYPE", + "TYPE", + "Eventcast__EventMsg__TYPE", + "eventcast", + 4, + eventcast__event_msg__type__enum_values_by_number, + 4, + eventcast__event_msg__type__enum_values_by_name, + 1, + eventcast__event_msg__type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor eventcast__event_msg__field_descriptors[5] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__EventMsg, type), + &eventcast__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(Eventcast__EventMsg, startreq), + &eventcast__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(Eventcast__EventMsg, startans), + &eventcast__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(Eventcast__EventMsg, terminate), + &eventcast__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(Eventcast__EventMsg, setstatus), + &eventcast__set_event_status__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__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 eventcast__event_msg__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 5 } +}; +const ProtobufCMessageDescriptor eventcast__event_msg__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.EventMsg", + "EventMsg", + "Eventcast__EventMsg", + "eventcast", + sizeof(Eventcast__EventMsg), + 5, + eventcast__event_msg__field_descriptors, + eventcast__event_msg__field_indices_by_name, + 1, eventcast__event_msg__number_ranges, + (ProtobufCMessageInit) eventcast__event_msg__init, + NULL,NULL,NULL /* reserved[123] */ +}; +#define eventcast__event_terminate__field_descriptors NULL +#define eventcast__event_terminate__field_indices_by_name NULL +#define eventcast__event_terminate__number_ranges NULL +const ProtobufCMessageDescriptor eventcast__event_terminate__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.EventTerminate", + "EventTerminate", + "Eventcast__EventTerminate", + "eventcast", + sizeof(Eventcast__EventTerminate), + 0, + eventcast__event_terminate__field_descriptors, + eventcast__event_terminate__field_indices_by_name, + 0, eventcast__event_terminate__number_ranges, + (ProtobufCMessageInit) eventcast__event_terminate__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__set_sensor_status__field_descriptors[2] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__SetSensorStatus, type), + &eventcast__sensor_type__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "state", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__SetSensorStatus, state), + &eventcast__state__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__set_sensor_status__field_indices_by_name[] = { + 1, /* field[1] = state */ + 0, /* field[0] = type */ +}; +static const ProtobufCIntRange eventcast__set_sensor_status__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor eventcast__set_sensor_status__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.SetSensorStatus", + "SetSensorStatus", + "Eventcast__SetSensorStatus", + "eventcast", + sizeof(Eventcast__SetSensorStatus), + 2, + eventcast__set_sensor_status__field_descriptors, + eventcast__set_sensor_status__field_indices_by_name, + 1, eventcast__set_sensor_status__number_ranges, + (ProtobufCMessageInit) eventcast__set_sensor_status__init, + NULL,NULL,NULL /* reserved[123] */ +}; +char eventcast__sensor_data__x__default_value[] = "0"; +char eventcast__sensor_data__y__default_value[] = "0"; +char eventcast__sensor_data__z__default_value[] = "0"; +static const ProtobufCFieldDescriptor eventcast__sensor_data__field_descriptors[4] = +{ + { + "sensor", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__SensorData, sensor), + &eventcast__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(Eventcast__SensorData, x), + NULL, + &eventcast__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(Eventcast__SensorData, y), + NULL, + &eventcast__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(Eventcast__SensorData, z), + NULL, + &eventcast__sensor_data__z__default_value, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__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 eventcast__sensor_data__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor eventcast__sensor_data__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.SensorData", + "SensorData", + "Eventcast__SensorData", + "eventcast", + sizeof(Eventcast__SensorData), + 4, + eventcast__sensor_data__field_descriptors, + eventcast__sensor_data__field_indices_by_name, + 1, eventcast__sensor_data__number_ranges, + (ProtobufCMessageInit) eventcast__sensor_data__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue eventcast__sensor_msg__type__enum_values_by_number[5] = +{ + { "START_REQ", "EVENTCAST__SENSOR_MSG__TYPE__START_REQ", 2 }, + { "START_ANS", "EVENTCAST__SENSOR_MSG__TYPE__START_ANS", 3 }, + { "TERMINATE", "EVENTCAST__SENSOR_MSG__TYPE__TERMINATE", 4 }, + { "SENSOR_STATUS", "EVENTCAST__SENSOR_MSG__TYPE__SENSOR_STATUS", 5 }, + { "SENSOR_DATA", "EVENTCAST__SENSOR_MSG__TYPE__SENSOR_DATA", 6 }, +}; +static const ProtobufCIntRange eventcast__sensor_msg__type__value_ranges[] = { +{2, 0},{0, 5} +}; +const ProtobufCEnumValueIndex eventcast__sensor_msg__type__enum_values_by_name[5] = +{ + { "SENSOR_DATA", 4 }, + { "SENSOR_STATUS", 3 }, + { "START_ANS", 1 }, + { "START_REQ", 0 }, + { "TERMINATE", 2 }, +}; +const ProtobufCEnumDescriptor eventcast__sensor_msg__type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.SensorMsg.Type", + "Type", + "Eventcast__SensorMsg__Type", + "eventcast", + 5, + eventcast__sensor_msg__type__enum_values_by_number, + 5, + eventcast__sensor_msg__type__enum_values_by_name, + 1, + eventcast__sensor_msg__type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor eventcast__sensor_msg__field_descriptors[6] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__SensorMsg, type), + &eventcast__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(Eventcast__SensorMsg, startreq), + &eventcast__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(Eventcast__SensorMsg, startans), + &eventcast__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(Eventcast__SensorMsg, terminate), + &eventcast__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(Eventcast__SensorMsg, setstatus), + &eventcast__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(Eventcast__SensorMsg, data), + &eventcast__sensor_data__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__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 eventcast__sensor_msg__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 6 } +}; +const ProtobufCMessageDescriptor eventcast__sensor_msg__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.SensorMsg", + "SensorMsg", + "Eventcast__SensorMsg", + "eventcast", + sizeof(Eventcast__SensorMsg), + 6, + eventcast__sensor_msg__field_descriptors, + eventcast__sensor_msg__field_indices_by_name, + 1, eventcast__sensor_msg__number_ranges, + (ProtobufCMessageInit) eventcast__sensor_msg__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__resolution__field_descriptors[2] = +{ + { + "width", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__Resolution, width), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "height", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__Resolution, height), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__resolution__field_indices_by_name[] = { + 1, /* field[1] = height */ + 0, /* field[0] = width */ +}; +static const ProtobufCIntRange eventcast__resolution__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor eventcast__resolution__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.Resolution", + "Resolution", + "Eventcast__Resolution", + "eventcast", + sizeof(Eventcast__Resolution), + 2, + eventcast__resolution__field_descriptors, + eventcast__resolution__field_indices_by_name, + 1, eventcast__resolution__number_ranges, + (ProtobufCMessageInit) eventcast__resolution__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__display_msg__field_descriptors[2] = +{ + { + "frameRate", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Eventcast__DisplayMsg, has_framerate), + PROTOBUF_C_OFFSETOF(Eventcast__DisplayMsg, framerate), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "imageData", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + PROTOBUF_C_OFFSETOF(Eventcast__DisplayMsg, has_imagedata), + PROTOBUF_C_OFFSETOF(Eventcast__DisplayMsg, imagedata), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__display_msg__field_indices_by_name[] = { + 0, /* field[0] = frameRate */ + 1, /* field[1] = imageData */ +}; +static const ProtobufCIntRange eventcast__display_msg__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor eventcast__display_msg__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.DisplayMsg", + "DisplayMsg", + "Eventcast__DisplayMsg", + "eventcast", + sizeof(Eventcast__DisplayMsg), + 2, + eventcast__display_msg__field_descriptors, + eventcast__display_msg__field_indices_by_name, + 1, eventcast__display_msg__number_ranges, + (ProtobufCMessageInit) eventcast__display_msg__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const int32_t eventcast__touch_max_count__max__default_value = 10; +static const ProtobufCFieldDescriptor eventcast__touch_max_count__field_descriptors[1] = +{ + { + "max", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Eventcast__TouchMaxCount, has_max), + PROTOBUF_C_OFFSETOF(Eventcast__TouchMaxCount, max), + NULL, + &eventcast__touch_max_count__max__default_value, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__touch_max_count__field_indices_by_name[] = { + 0, /* field[0] = max */ +}; +static const ProtobufCIntRange eventcast__touch_max_count__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor eventcast__touch_max_count__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.TouchMaxCount", + "TouchMaxCount", + "Eventcast__TouchMaxCount", + "eventcast", + sizeof(Eventcast__TouchMaxCount), + 1, + eventcast__touch_max_count__field_descriptors, + eventcast__touch_max_count__field_indices_by_name, + 1, eventcast__touch_max_count__number_ranges, + (ProtobufCMessageInit) eventcast__touch_max_count__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const int32_t eventcast__touch_data__index__default_value = 0; +static const float eventcast__touch_data__x_point__default_value = 0; +static const float eventcast__touch_data__y_point__default_value = 0; +static const ProtobufCFieldDescriptor eventcast__touch_data__field_descriptors[4] = +{ + { + "index", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Eventcast__TouchData, has_index), + PROTOBUF_C_OFFSETOF(Eventcast__TouchData, index), + NULL, + &eventcast__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(Eventcast__TouchData, has_xpoint), + PROTOBUF_C_OFFSETOF(Eventcast__TouchData, xpoint), + NULL, + &eventcast__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(Eventcast__TouchData, has_ypoint), + PROTOBUF_C_OFFSETOF(Eventcast__TouchData, ypoint), + NULL, + &eventcast__touch_data__y_point__default_value, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "state", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_ENUM, + PROTOBUF_C_OFFSETOF(Eventcast__TouchData, has_state), + PROTOBUF_C_OFFSETOF(Eventcast__TouchData, state), + &eventcast__touch_state__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__touch_data__field_indices_by_name[] = { + 0, /* field[0] = index */ + 3, /* field[3] = state */ + 1, /* field[1] = xPoint */ + 2, /* field[2] = yPoint */ +}; +static const ProtobufCIntRange eventcast__touch_data__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor eventcast__touch_data__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.TouchData", + "TouchData", + "Eventcast__TouchData", + "eventcast", + sizeof(Eventcast__TouchData), + 4, + eventcast__touch_data__field_descriptors, + eventcast__touch_data__field_indices_by_name, + 1, eventcast__touch_data__number_ranges, + (ProtobufCMessageInit) eventcast__touch_data__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor eventcast__hwkey_msg__field_descriptors[1] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__HWKeyMsg, type), + &eventcast__hwkey_type__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__hwkey_msg__field_indices_by_name[] = { + 0, /* field[0] = type */ +}; +static const ProtobufCIntRange eventcast__hwkey_msg__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor eventcast__hwkey_msg__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.HWKeyMsg", + "HWKeyMsg", + "Eventcast__HWKeyMsg", + "eventcast", + sizeof(Eventcast__HWKeyMsg), + 1, + eventcast__hwkey_msg__field_descriptors, + eventcast__hwkey_msg__field_indices_by_name, + 1, eventcast__hwkey_msg__number_ranges, + (ProtobufCMessageInit) eventcast__hwkey_msg__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue eventcast__touch_msg__type__enum_values_by_number[8] = +{ + { "START_REQ", "EVENTCAST__TOUCH_MSG__TYPE__START_REQ", 2 }, + { "START_ANS", "EVENTCAST__TOUCH_MSG__TYPE__START_ANS", 3 }, + { "TERMINATE", "EVENTCAST__TOUCH_MSG__TYPE__TERMINATE", 4 }, + { "MAX_COUNT", "EVENTCAST__TOUCH_MSG__TYPE__MAX_COUNT", 5 }, + { "TOUCH_DATA", "EVENTCAST__TOUCH_MSG__TYPE__TOUCH_DATA", 6 }, + { "RESOLUTION", "EVENTCAST__TOUCH_MSG__TYPE__RESOLUTION", 7 }, + { "DISPLAY_MSG", "EVENTCAST__TOUCH_MSG__TYPE__DISPLAY_MSG", 8 }, + { "HWKEY_MSG", "EVENTCAST__TOUCH_MSG__TYPE__HWKEY_MSG", 9 }, +}; +static const ProtobufCIntRange eventcast__touch_msg__type__value_ranges[] = { +{2, 0},{0, 8} +}; +const ProtobufCEnumValueIndex eventcast__touch_msg__type__enum_values_by_name[8] = +{ + { "DISPLAY_MSG", 6 }, + { "HWKEY_MSG", 7 }, + { "MAX_COUNT", 3 }, + { "RESOLUTION", 5 }, + { "START_ANS", 1 }, + { "START_REQ", 0 }, + { "TERMINATE", 2 }, + { "TOUCH_DATA", 4 }, +}; +const ProtobufCEnumDescriptor eventcast__touch_msg__type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.TouchMsg.Type", + "Type", + "Eventcast__TouchMsg__Type", + "eventcast", + 8, + eventcast__touch_msg__type__enum_values_by_number, + 8, + eventcast__touch_msg__type__enum_values_by_name, + 1, + eventcast__touch_msg__type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor eventcast__touch_msg__field_descriptors[9] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, type), + &eventcast__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(Eventcast__TouchMsg, startreq), + &eventcast__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(Eventcast__TouchMsg, startans), + &eventcast__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(Eventcast__TouchMsg, terminate), + &eventcast__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(Eventcast__TouchMsg, maxcount), + &eventcast__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(Eventcast__TouchMsg, touchdata), + &eventcast__touch_data__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "resolution", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, resolution), + &eventcast__resolution__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "display", + 8, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, display), + &eventcast__display_msg__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "hwkey", + 9, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, hwkey), + &eventcast__hwkey_msg__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__touch_msg__field_indices_by_name[] = { + 7, /* field[7] = display */ + 8, /* field[8] = hwkey */ + 4, /* field[4] = maxCount */ + 6, /* field[6] = resolution */ + 2, /* field[2] = startAns */ + 1, /* field[1] = startReq */ + 3, /* field[3] = terminate */ + 5, /* field[5] = touchData */ + 0, /* field[0] = type */ +}; +static const ProtobufCIntRange eventcast__touch_msg__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 9 } +}; +const ProtobufCMessageDescriptor eventcast__touch_msg__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.TouchMsg", + "TouchMsg", + "Eventcast__TouchMsg", + "eventcast", + sizeof(Eventcast__TouchMsg), + 9, + eventcast__touch_msg__field_descriptors, + eventcast__touch_msg__field_indices_by_name, + 1, eventcast__touch_msg__number_ranges, + (ProtobufCMessageInit) eventcast__touch_msg__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue eventcast__event_cast_msg__type__enum_values_by_number[7] = +{ + { "HANDSHAKE_REQ", "EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_REQ", 2 }, + { "HANDSHAKE_ANS", "EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_ANS", 3 }, + { "EMUL_STATE", "EVENTCAST__EVENT_CAST_MSG__TYPE__EMUL_STATE", 4 }, + { "APP_STATE", "EVENTCAST__EVENT_CAST_MSG__TYPE__APP_STATE", 5 }, + { "EVENT_MSG", "EVENTCAST__EVENT_CAST_MSG__TYPE__EVENT_MSG", 6 }, + { "SENSOR_MSG", "EVENTCAST__EVENT_CAST_MSG__TYPE__SENSOR_MSG", 7 }, + { "TOUCH_MSG", "EVENTCAST__EVENT_CAST_MSG__TYPE__TOUCH_MSG", 8 }, +}; +static const ProtobufCIntRange eventcast__event_cast_msg__type__value_ranges[] = { +{2, 0},{0, 7} +}; +const ProtobufCEnumValueIndex eventcast__event_cast_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 eventcast__event_cast_msg__type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.EventCastMsg.Type", + "Type", + "Eventcast__EventCastMsg__Type", + "eventcast", + 7, + eventcast__event_cast_msg__type__enum_values_by_number, + 7, + eventcast__event_cast_msg__type__enum_values_by_name, + 1, + eventcast__event_cast_msg__type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor eventcast__event_cast_msg__field_descriptors[8] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, type), + &eventcast__event_cast_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(Eventcast__EventCastMsg, handshakereq), + &eventcast__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(Eventcast__EventCastMsg, handshakeans), + &eventcast__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(Eventcast__EventCastMsg, emulstate), + &eventcast__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(Eventcast__EventCastMsg, appstate), + &eventcast__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(Eventcast__EventCastMsg, eventmsg), + &eventcast__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(Eventcast__EventCastMsg, sensormsg), + &eventcast__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(Eventcast__EventCastMsg, touchmsg), + &eventcast__touch_msg__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned eventcast__event_cast_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 eventcast__event_cast_msg__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 8 } +}; +const ProtobufCMessageDescriptor eventcast__event_cast_msg__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "eventcast.EventCastMsg", + "EventCastMsg", + "Eventcast__EventCastMsg", + "eventcast", + sizeof(Eventcast__EventCastMsg), + 8, + eventcast__event_cast_msg__field_descriptors, + eventcast__event_cast_msg__field_indices_by_name, + 1, eventcast__event_cast_msg__number_ranges, + (ProtobufCMessageInit) eventcast__event_cast_msg__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue eventcast__message_result__enum_values_by_number[3] = +{ + { "SUCCESS", "EVENTCAST__MESSAGE_RESULT__SUCCESS", 1 }, + { "FAILURE", "EVENTCAST__MESSAGE_RESULT__FAILURE", 2 }, + { "CANCEL", "EVENTCAST__MESSAGE_RESULT__CANCEL", 3 }, +}; +static const ProtobufCIntRange eventcast__message_result__value_ranges[] = { +{1, 0},{0, 3} +}; +const ProtobufCEnumValueIndex eventcast__message_result__enum_values_by_name[3] = +{ + { "CANCEL", 2 }, + { "FAILURE", 1 }, + { "SUCCESS", 0 }, +}; +const ProtobufCEnumDescriptor eventcast__message_result__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.MessageResult", + "MessageResult", + "Eventcast__MessageResult", + "eventcast", + 3, + eventcast__message_result__enum_values_by_number, + 3, + eventcast__message_result__enum_values_by_name, + 1, + eventcast__message_result__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +const ProtobufCEnumValue eventcast__connection_state__enum_values_by_number[3] = +{ + { "CONNECTED", "EVENTCAST__CONNECTION_STATE__CONNECTED", 1 }, + { "DISCONNECTED", "EVENTCAST__CONNECTION_STATE__DISCONNECTED", 2 }, + { "TERMINATED", "EVENTCAST__CONNECTION_STATE__TERMINATED", 3 }, +}; +static const ProtobufCIntRange eventcast__connection_state__value_ranges[] = { +{1, 0},{0, 3} +}; +const ProtobufCEnumValueIndex eventcast__connection_state__enum_values_by_name[3] = +{ + { "CONNECTED", 0 }, + { "DISCONNECTED", 1 }, + { "TERMINATED", 2 }, +}; +const ProtobufCEnumDescriptor eventcast__connection_state__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.ConnectionState", + "ConnectionState", + "Eventcast__ConnectionState", + "eventcast", + 3, + eventcast__connection_state__enum_values_by_number, + 3, + eventcast__connection_state__enum_values_by_name, + 1, + eventcast__connection_state__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +const ProtobufCEnumValue eventcast__event_type__enum_values_by_number[2] = +{ + { "SENSOR", "EVENTCAST__EVENT_TYPE__SENSOR", 1 }, + { "TOUCH", "EVENTCAST__EVENT_TYPE__TOUCH", 2 }, +}; +static const ProtobufCIntRange eventcast__event_type__value_ranges[] = { +{1, 0},{0, 2} +}; +const ProtobufCEnumValueIndex eventcast__event_type__enum_values_by_name[2] = +{ + { "SENSOR", 0 }, + { "TOUCH", 1 }, +}; +const ProtobufCEnumDescriptor eventcast__event_type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.EventType", + "EventType", + "Eventcast__EventType", + "eventcast", + 2, + eventcast__event_type__enum_values_by_number, + 2, + eventcast__event_type__enum_values_by_name, + 1, + eventcast__event_type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +const ProtobufCEnumValue eventcast__state__enum_values_by_number[2] = +{ + { "ENABLED", "EVENTCAST__STATE__ENABLED", 1 }, + { "DISABLED", "EVENTCAST__STATE__DISABLED", 2 }, +}; +static const ProtobufCIntRange eventcast__state__value_ranges[] = { +{1, 0},{0, 2} +}; +const ProtobufCEnumValueIndex eventcast__state__enum_values_by_name[2] = +{ + { "DISABLED", 1 }, + { "ENABLED", 0 }, +}; +const ProtobufCEnumDescriptor eventcast__state__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.State", + "State", + "Eventcast__State", + "eventcast", + 2, + eventcast__state__enum_values_by_number, + 2, + eventcast__state__enum_values_by_name, + 1, + eventcast__state__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +const ProtobufCEnumValue eventcast__sensor_type__enum_values_by_number[5] = +{ + { "ACCEL", "EVENTCAST__SENSOR_TYPE__ACCEL", 1 }, + { "MAGNETIC", "EVENTCAST__SENSOR_TYPE__MAGNETIC", 2 }, + { "GYROSCOPE", "EVENTCAST__SENSOR_TYPE__GYROSCOPE", 3 }, + { "PROXIMITY", "EVENTCAST__SENSOR_TYPE__PROXIMITY", 4 }, + { "LIGHT", "EVENTCAST__SENSOR_TYPE__LIGHT", 5 }, +}; +static const ProtobufCIntRange eventcast__sensor_type__value_ranges[] = { +{1, 0},{0, 5} +}; +const ProtobufCEnumValueIndex eventcast__sensor_type__enum_values_by_name[5] = +{ + { "ACCEL", 0 }, + { "GYROSCOPE", 2 }, + { "LIGHT", 4 }, + { "MAGNETIC", 1 }, + { "PROXIMITY", 3 }, +}; +const ProtobufCEnumDescriptor eventcast__sensor_type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.SensorType", + "SensorType", + "Eventcast__SensorType", + "eventcast", + 5, + eventcast__sensor_type__enum_values_by_number, + 5, + eventcast__sensor_type__enum_values_by_name, + 1, + eventcast__sensor_type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +const ProtobufCEnumValue eventcast__touch_state__enum_values_by_number[2] = +{ + { "PRESSED", "EVENTCAST__TOUCH_STATE__PRESSED", 1 }, + { "RELEASED", "EVENTCAST__TOUCH_STATE__RELEASED", 2 }, +}; +static const ProtobufCIntRange eventcast__touch_state__value_ranges[] = { +{1, 0},{0, 2} +}; +const ProtobufCEnumValueIndex eventcast__touch_state__enum_values_by_name[2] = +{ + { "PRESSED", 0 }, + { "RELEASED", 1 }, +}; +const ProtobufCEnumDescriptor eventcast__touch_state__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.TouchState", + "TouchState", + "Eventcast__TouchState", + "eventcast", + 2, + eventcast__touch_state__enum_values_by_number, + 2, + eventcast__touch_state__enum_values_by_name, + 1, + eventcast__touch_state__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +const ProtobufCEnumValue eventcast__hwkey_type__enum_values_by_number[6] = +{ + { "MENU", "EVENTCAST__HWKEY_TYPE__MENU", 1 }, + { "HOME", "EVENTCAST__HWKEY_TYPE__HOME", 2 }, + { "BACK", "EVENTCAST__HWKEY_TYPE__BACK", 3 }, + { "POWER", "EVENTCAST__HWKEY_TYPE__POWER", 4 }, + { "VOLUME_UP", "EVENTCAST__HWKEY_TYPE__VOLUME_UP", 5 }, + { "VOLUME_DOWN", "EVENTCAST__HWKEY_TYPE__VOLUME_DOWN", 6 }, +}; +static const ProtobufCIntRange eventcast__hwkey_type__value_ranges[] = { +{1, 0},{0, 6} +}; +const ProtobufCEnumValueIndex eventcast__hwkey_type__enum_values_by_name[6] = +{ + { "BACK", 2 }, + { "HOME", 1 }, + { "MENU", 0 }, + { "POWER", 3 }, + { "VOLUME_DOWN", 5 }, + { "VOLUME_UP", 4 }, +}; +const ProtobufCEnumDescriptor eventcast__hwkey_type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "eventcast.HWKeyType", + "HWKeyType", + "Eventcast__HWKeyType", + "eventcast", + 6, + eventcast__hwkey_type__enum_values_by_number, + 6, + eventcast__hwkey_type__enum_values_by_name, + 1, + eventcast__hwkey_type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; diff --git a/tizen/src/eventcast/genmsg/eventcast.pb-c.h b/tizen/src/eventcast/genmsg/eventcast.pb-c.h new file mode 100644 index 0000000000..92f55044bc --- /dev/null +++ b/tizen/src/eventcast/genmsg/eventcast.pb-c.h @@ -0,0 +1,798 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ + +#ifndef PROTOBUF_C_eventcast_2eproto__INCLUDED +#define PROTOBUF_C_eventcast_2eproto__INCLUDED + +#include + +PROTOBUF_C_BEGIN_DECLS + + +typedef struct _Eventcast__HandShakeReq Eventcast__HandShakeReq; +typedef struct _Eventcast__HandShakeAns Eventcast__HandShakeAns; +typedef struct _Eventcast__EmulatorState Eventcast__EmulatorState; +typedef struct _Eventcast__AppState Eventcast__AppState; +typedef struct _Eventcast__StartReq Eventcast__StartReq; +typedef struct _Eventcast__StartAns Eventcast__StartAns; +typedef struct _Eventcast__SetEventStatus Eventcast__SetEventStatus; +typedef struct _Eventcast__EventMsg Eventcast__EventMsg; +typedef struct _Eventcast__EventTerminate Eventcast__EventTerminate; +typedef struct _Eventcast__SetSensorStatus Eventcast__SetSensorStatus; +typedef struct _Eventcast__SensorData Eventcast__SensorData; +typedef struct _Eventcast__SensorMsg Eventcast__SensorMsg; +typedef struct _Eventcast__Resolution Eventcast__Resolution; +typedef struct _Eventcast__DisplayMsg Eventcast__DisplayMsg; +typedef struct _Eventcast__TouchMaxCount Eventcast__TouchMaxCount; +typedef struct _Eventcast__TouchData Eventcast__TouchData; +typedef struct _Eventcast__HWKeyMsg Eventcast__HWKeyMsg; +typedef struct _Eventcast__TouchMsg Eventcast__TouchMsg; +typedef struct _Eventcast__EventCastMsg Eventcast__EventCastMsg; + + +/* --- enums --- */ + +typedef enum _Eventcast__EventMsg__TYPE { + EVENTCAST__EVENT_MSG__TYPE__START_REQ = 2, + EVENTCAST__EVENT_MSG__TYPE__START_ANS = 3, + EVENTCAST__EVENT_MSG__TYPE__TERMINATE = 4, + EVENTCAST__EVENT_MSG__TYPE__EVENT_STATUS = 5 +} Eventcast__EventMsg__TYPE; +typedef enum _Eventcast__SensorMsg__Type { + EVENTCAST__SENSOR_MSG__TYPE__START_REQ = 2, + EVENTCAST__SENSOR_MSG__TYPE__START_ANS = 3, + EVENTCAST__SENSOR_MSG__TYPE__TERMINATE = 4, + EVENTCAST__SENSOR_MSG__TYPE__SENSOR_STATUS = 5, + EVENTCAST__SENSOR_MSG__TYPE__SENSOR_DATA = 6 +} Eventcast__SensorMsg__Type; +typedef enum _Eventcast__TouchMsg__Type { + EVENTCAST__TOUCH_MSG__TYPE__START_REQ = 2, + EVENTCAST__TOUCH_MSG__TYPE__START_ANS = 3, + EVENTCAST__TOUCH_MSG__TYPE__TERMINATE = 4, + EVENTCAST__TOUCH_MSG__TYPE__MAX_COUNT = 5, + EVENTCAST__TOUCH_MSG__TYPE__TOUCH_DATA = 6, + EVENTCAST__TOUCH_MSG__TYPE__RESOLUTION = 7, + EVENTCAST__TOUCH_MSG__TYPE__DISPLAY_MSG = 8, + EVENTCAST__TOUCH_MSG__TYPE__HWKEY_MSG = 9 +} Eventcast__TouchMsg__Type; +typedef enum _Eventcast__EventCastMsg__Type { + EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_REQ = 2, + EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_ANS = 3, + EVENTCAST__EVENT_CAST_MSG__TYPE__EMUL_STATE = 4, + EVENTCAST__EVENT_CAST_MSG__TYPE__APP_STATE = 5, + EVENTCAST__EVENT_CAST_MSG__TYPE__EVENT_MSG = 6, + EVENTCAST__EVENT_CAST_MSG__TYPE__SENSOR_MSG = 7, + EVENTCAST__EVENT_CAST_MSG__TYPE__TOUCH_MSG = 8 +} Eventcast__EventCastMsg__Type; +typedef enum _Eventcast__MessageResult { + EVENTCAST__MESSAGE_RESULT__SUCCESS = 1, + EVENTCAST__MESSAGE_RESULT__FAILURE = 2, + EVENTCAST__MESSAGE_RESULT__CANCEL = 3 +} Eventcast__MessageResult; +typedef enum _Eventcast__ConnectionState { + EVENTCAST__CONNECTION_STATE__CONNECTED = 1, + EVENTCAST__CONNECTION_STATE__DISCONNECTED = 2, + EVENTCAST__CONNECTION_STATE__TERMINATED = 3 +} Eventcast__ConnectionState; +typedef enum _Eventcast__EventType { + EVENTCAST__EVENT_TYPE__SENSOR = 1, + EVENTCAST__EVENT_TYPE__TOUCH = 2 +} Eventcast__EventType; +typedef enum _Eventcast__State { + EVENTCAST__STATE__ENABLED = 1, + EVENTCAST__STATE__DISABLED = 2 +} Eventcast__State; +typedef enum _Eventcast__SensorType { + EVENTCAST__SENSOR_TYPE__ACCEL = 1, + EVENTCAST__SENSOR_TYPE__MAGNETIC = 2, + EVENTCAST__SENSOR_TYPE__GYROSCOPE = 3, + EVENTCAST__SENSOR_TYPE__PROXIMITY = 4, + EVENTCAST__SENSOR_TYPE__LIGHT = 5 +} Eventcast__SensorType; +typedef enum _Eventcast__TouchState { + EVENTCAST__TOUCH_STATE__PRESSED = 1, + EVENTCAST__TOUCH_STATE__RELEASED = 2 +} Eventcast__TouchState; +typedef enum _Eventcast__HWKeyType { + EVENTCAST__HWKEY_TYPE__MENU = 1, + EVENTCAST__HWKEY_TYPE__HOME = 2, + EVENTCAST__HWKEY_TYPE__BACK = 3, + EVENTCAST__HWKEY_TYPE__POWER = 4, + EVENTCAST__HWKEY_TYPE__VOLUME_UP = 5, + EVENTCAST__HWKEY_TYPE__VOLUME_DOWN = 6 +} Eventcast__HWKeyType; + +/* --- messages --- */ + +struct _Eventcast__HandShakeReq +{ + ProtobufCMessage base; + int32_t key; +}; +#define EVENTCAST__HAND_SHAKE_REQ__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__hand_shake_req__descriptor) \ + , 0 } + + +struct _Eventcast__HandShakeAns +{ + ProtobufCMessage base; + Eventcast__MessageResult result; +}; +#define EVENTCAST__HAND_SHAKE_ANS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__hand_shake_ans__descriptor) \ + , 0 } + + +struct _Eventcast__EmulatorState +{ + ProtobufCMessage base; + Eventcast__ConnectionState state; +}; +#define EVENTCAST__EMULATOR_STATE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__emulator_state__descriptor) \ + , 0 } + + +struct _Eventcast__AppState +{ + ProtobufCMessage base; + Eventcast__ConnectionState state; +}; +#define EVENTCAST__APP_STATE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__app_state__descriptor) \ + , 0 } + + +struct _Eventcast__StartReq +{ + ProtobufCMessage base; +}; +#define EVENTCAST__START_REQ__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__start_req__descriptor) \ + } + + +struct _Eventcast__StartAns +{ + ProtobufCMessage base; + Eventcast__MessageResult result; +}; +#define EVENTCAST__START_ANS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__start_ans__descriptor) \ + , 0 } + + +struct _Eventcast__SetEventStatus +{ + ProtobufCMessage base; + Eventcast__EventType type; + Eventcast__State state; +}; +#define EVENTCAST__SET_EVENT_STATUS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__set_event_status__descriptor) \ + , 0, 0 } + + +struct _Eventcast__EventMsg +{ + ProtobufCMessage base; + Eventcast__EventMsg__TYPE type; + Eventcast__StartReq *startreq; + Eventcast__StartAns *startans; + Eventcast__EventTerminate *terminate; + Eventcast__SetEventStatus *setstatus; +}; +#define EVENTCAST__EVENT_MSG__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__event_msg__descriptor) \ + , 0, NULL, NULL, NULL, NULL } + + +struct _Eventcast__EventTerminate +{ + ProtobufCMessage base; +}; +#define EVENTCAST__EVENT_TERMINATE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__event_terminate__descriptor) \ + } + + +struct _Eventcast__SetSensorStatus +{ + ProtobufCMessage base; + Eventcast__SensorType type; + Eventcast__State state; +}; +#define EVENTCAST__SET_SENSOR_STATUS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__set_sensor_status__descriptor) \ + , 0, 0 } + + +struct _Eventcast__SensorData +{ + ProtobufCMessage base; + Eventcast__SensorType sensor; + char *x; + char *y; + char *z; +}; +extern char eventcast__sensor_data__x__default_value[]; +extern char eventcast__sensor_data__y__default_value[]; +extern char eventcast__sensor_data__z__default_value[]; +#define EVENTCAST__SENSOR_DATA__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__sensor_data__descriptor) \ + , 0, eventcast__sensor_data__x__default_value, eventcast__sensor_data__y__default_value, eventcast__sensor_data__z__default_value } + + +struct _Eventcast__SensorMsg +{ + ProtobufCMessage base; + Eventcast__SensorMsg__Type type; + Eventcast__StartReq *startreq; + Eventcast__StartAns *startans; + Eventcast__EventTerminate *terminate; + Eventcast__SetSensorStatus *setstatus; + Eventcast__SensorData *data; +}; +#define EVENTCAST__SENSOR_MSG__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__sensor_msg__descriptor) \ + , 0, NULL, NULL, NULL, NULL, NULL } + + +struct _Eventcast__Resolution +{ + ProtobufCMessage base; + int32_t width; + int32_t height; +}; +#define EVENTCAST__RESOLUTION__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__resolution__descriptor) \ + , 0, 0 } + + +struct _Eventcast__DisplayMsg +{ + ProtobufCMessage base; + protobuf_c_boolean has_framerate; + int32_t framerate; + protobuf_c_boolean has_imagedata; + ProtobufCBinaryData imagedata; +}; +#define EVENTCAST__DISPLAY_MSG__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__display_msg__descriptor) \ + , 0,0, 0,{0,NULL} } + + +struct _Eventcast__TouchMaxCount +{ + ProtobufCMessage base; + protobuf_c_boolean has_max; + int32_t max; +}; +#define EVENTCAST__TOUCH_MAX_COUNT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__touch_max_count__descriptor) \ + , 0,10 } + + +struct _Eventcast__TouchData +{ + 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_state; + Eventcast__TouchState state; +}; +#define EVENTCAST__TOUCH_DATA__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__touch_data__descriptor) \ + , 0,0, 0,0, 0,0, 0,0 } + + +struct _Eventcast__HWKeyMsg +{ + ProtobufCMessage base; + Eventcast__HWKeyType type; +}; +#define EVENTCAST__HWKEY_MSG__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__hwkey_msg__descriptor) \ + , 0 } + + +struct _Eventcast__TouchMsg +{ + ProtobufCMessage base; + Eventcast__TouchMsg__Type type; + Eventcast__StartReq *startreq; + Eventcast__StartAns *startans; + Eventcast__EventTerminate *terminate; + Eventcast__TouchMaxCount *maxcount; + Eventcast__TouchData *touchdata; + Eventcast__Resolution *resolution; + Eventcast__DisplayMsg *display; + Eventcast__HWKeyMsg *hwkey; +}; +#define EVENTCAST__TOUCH_MSG__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__touch_msg__descriptor) \ + , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } + + +struct _Eventcast__EventCastMsg +{ + ProtobufCMessage base; + Eventcast__EventCastMsg__Type type; + Eventcast__HandShakeReq *handshakereq; + Eventcast__HandShakeAns *handshakeans; + Eventcast__EmulatorState *emulstate; + Eventcast__AppState *appstate; + Eventcast__EventMsg *eventmsg; + Eventcast__SensorMsg *sensormsg; + Eventcast__TouchMsg *touchmsg; +}; +#define EVENTCAST__EVENT_CAST_MSG__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&eventcast__event_cast_msg__descriptor) \ + , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL } + + +/* Eventcast__HandShakeReq methods */ +void eventcast__hand_shake_req__init + (Eventcast__HandShakeReq *message); +size_t eventcast__hand_shake_req__get_packed_size + (const Eventcast__HandShakeReq *message); +size_t eventcast__hand_shake_req__pack + (const Eventcast__HandShakeReq *message, + uint8_t *out); +size_t eventcast__hand_shake_req__pack_to_buffer + (const Eventcast__HandShakeReq *message, + ProtobufCBuffer *buffer); +Eventcast__HandShakeReq * + eventcast__hand_shake_req__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__hand_shake_req__free_unpacked + (Eventcast__HandShakeReq *message, + ProtobufCAllocator *allocator); +/* Eventcast__HandShakeAns methods */ +void eventcast__hand_shake_ans__init + (Eventcast__HandShakeAns *message); +size_t eventcast__hand_shake_ans__get_packed_size + (const Eventcast__HandShakeAns *message); +size_t eventcast__hand_shake_ans__pack + (const Eventcast__HandShakeAns *message, + uint8_t *out); +size_t eventcast__hand_shake_ans__pack_to_buffer + (const Eventcast__HandShakeAns *message, + ProtobufCBuffer *buffer); +Eventcast__HandShakeAns * + eventcast__hand_shake_ans__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__hand_shake_ans__free_unpacked + (Eventcast__HandShakeAns *message, + ProtobufCAllocator *allocator); +/* Eventcast__EmulatorState methods */ +void eventcast__emulator_state__init + (Eventcast__EmulatorState *message); +size_t eventcast__emulator_state__get_packed_size + (const Eventcast__EmulatorState *message); +size_t eventcast__emulator_state__pack + (const Eventcast__EmulatorState *message, + uint8_t *out); +size_t eventcast__emulator_state__pack_to_buffer + (const Eventcast__EmulatorState *message, + ProtobufCBuffer *buffer); +Eventcast__EmulatorState * + eventcast__emulator_state__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__emulator_state__free_unpacked + (Eventcast__EmulatorState *message, + ProtobufCAllocator *allocator); +/* Eventcast__AppState methods */ +void eventcast__app_state__init + (Eventcast__AppState *message); +size_t eventcast__app_state__get_packed_size + (const Eventcast__AppState *message); +size_t eventcast__app_state__pack + (const Eventcast__AppState *message, + uint8_t *out); +size_t eventcast__app_state__pack_to_buffer + (const Eventcast__AppState *message, + ProtobufCBuffer *buffer); +Eventcast__AppState * + eventcast__app_state__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__app_state__free_unpacked + (Eventcast__AppState *message, + ProtobufCAllocator *allocator); +/* Eventcast__StartReq methods */ +void eventcast__start_req__init + (Eventcast__StartReq *message); +size_t eventcast__start_req__get_packed_size + (const Eventcast__StartReq *message); +size_t eventcast__start_req__pack + (const Eventcast__StartReq *message, + uint8_t *out); +size_t eventcast__start_req__pack_to_buffer + (const Eventcast__StartReq *message, + ProtobufCBuffer *buffer); +Eventcast__StartReq * + eventcast__start_req__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__start_req__free_unpacked + (Eventcast__StartReq *message, + ProtobufCAllocator *allocator); +/* Eventcast__StartAns methods */ +void eventcast__start_ans__init + (Eventcast__StartAns *message); +size_t eventcast__start_ans__get_packed_size + (const Eventcast__StartAns *message); +size_t eventcast__start_ans__pack + (const Eventcast__StartAns *message, + uint8_t *out); +size_t eventcast__start_ans__pack_to_buffer + (const Eventcast__StartAns *message, + ProtobufCBuffer *buffer); +Eventcast__StartAns * + eventcast__start_ans__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__start_ans__free_unpacked + (Eventcast__StartAns *message, + ProtobufCAllocator *allocator); +/* Eventcast__SetEventStatus methods */ +void eventcast__set_event_status__init + (Eventcast__SetEventStatus *message); +size_t eventcast__set_event_status__get_packed_size + (const Eventcast__SetEventStatus *message); +size_t eventcast__set_event_status__pack + (const Eventcast__SetEventStatus *message, + uint8_t *out); +size_t eventcast__set_event_status__pack_to_buffer + (const Eventcast__SetEventStatus *message, + ProtobufCBuffer *buffer); +Eventcast__SetEventStatus * + eventcast__set_event_status__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__set_event_status__free_unpacked + (Eventcast__SetEventStatus *message, + ProtobufCAllocator *allocator); +/* Eventcast__EventMsg methods */ +void eventcast__event_msg__init + (Eventcast__EventMsg *message); +size_t eventcast__event_msg__get_packed_size + (const Eventcast__EventMsg *message); +size_t eventcast__event_msg__pack + (const Eventcast__EventMsg *message, + uint8_t *out); +size_t eventcast__event_msg__pack_to_buffer + (const Eventcast__EventMsg *message, + ProtobufCBuffer *buffer); +Eventcast__EventMsg * + eventcast__event_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__event_msg__free_unpacked + (Eventcast__EventMsg *message, + ProtobufCAllocator *allocator); +/* Eventcast__EventTerminate methods */ +void eventcast__event_terminate__init + (Eventcast__EventTerminate *message); +size_t eventcast__event_terminate__get_packed_size + (const Eventcast__EventTerminate *message); +size_t eventcast__event_terminate__pack + (const Eventcast__EventTerminate *message, + uint8_t *out); +size_t eventcast__event_terminate__pack_to_buffer + (const Eventcast__EventTerminate *message, + ProtobufCBuffer *buffer); +Eventcast__EventTerminate * + eventcast__event_terminate__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__event_terminate__free_unpacked + (Eventcast__EventTerminate *message, + ProtobufCAllocator *allocator); +/* Eventcast__SetSensorStatus methods */ +void eventcast__set_sensor_status__init + (Eventcast__SetSensorStatus *message); +size_t eventcast__set_sensor_status__get_packed_size + (const Eventcast__SetSensorStatus *message); +size_t eventcast__set_sensor_status__pack + (const Eventcast__SetSensorStatus *message, + uint8_t *out); +size_t eventcast__set_sensor_status__pack_to_buffer + (const Eventcast__SetSensorStatus *message, + ProtobufCBuffer *buffer); +Eventcast__SetSensorStatus * + eventcast__set_sensor_status__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__set_sensor_status__free_unpacked + (Eventcast__SetSensorStatus *message, + ProtobufCAllocator *allocator); +/* Eventcast__SensorData methods */ +void eventcast__sensor_data__init + (Eventcast__SensorData *message); +size_t eventcast__sensor_data__get_packed_size + (const Eventcast__SensorData *message); +size_t eventcast__sensor_data__pack + (const Eventcast__SensorData *message, + uint8_t *out); +size_t eventcast__sensor_data__pack_to_buffer + (const Eventcast__SensorData *message, + ProtobufCBuffer *buffer); +Eventcast__SensorData * + eventcast__sensor_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__sensor_data__free_unpacked + (Eventcast__SensorData *message, + ProtobufCAllocator *allocator); +/* Eventcast__SensorMsg methods */ +void eventcast__sensor_msg__init + (Eventcast__SensorMsg *message); +size_t eventcast__sensor_msg__get_packed_size + (const Eventcast__SensorMsg *message); +size_t eventcast__sensor_msg__pack + (const Eventcast__SensorMsg *message, + uint8_t *out); +size_t eventcast__sensor_msg__pack_to_buffer + (const Eventcast__SensorMsg *message, + ProtobufCBuffer *buffer); +Eventcast__SensorMsg * + eventcast__sensor_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__sensor_msg__free_unpacked + (Eventcast__SensorMsg *message, + ProtobufCAllocator *allocator); +/* Eventcast__Resolution methods */ +void eventcast__resolution__init + (Eventcast__Resolution *message); +size_t eventcast__resolution__get_packed_size + (const Eventcast__Resolution *message); +size_t eventcast__resolution__pack + (const Eventcast__Resolution *message, + uint8_t *out); +size_t eventcast__resolution__pack_to_buffer + (const Eventcast__Resolution *message, + ProtobufCBuffer *buffer); +Eventcast__Resolution * + eventcast__resolution__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__resolution__free_unpacked + (Eventcast__Resolution *message, + ProtobufCAllocator *allocator); +/* Eventcast__DisplayMsg methods */ +void eventcast__display_msg__init + (Eventcast__DisplayMsg *message); +size_t eventcast__display_msg__get_packed_size + (const Eventcast__DisplayMsg *message); +size_t eventcast__display_msg__pack + (const Eventcast__DisplayMsg *message, + uint8_t *out); +size_t eventcast__display_msg__pack_to_buffer + (const Eventcast__DisplayMsg *message, + ProtobufCBuffer *buffer); +Eventcast__DisplayMsg * + eventcast__display_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__display_msg__free_unpacked + (Eventcast__DisplayMsg *message, + ProtobufCAllocator *allocator); +/* Eventcast__TouchMaxCount methods */ +void eventcast__touch_max_count__init + (Eventcast__TouchMaxCount *message); +size_t eventcast__touch_max_count__get_packed_size + (const Eventcast__TouchMaxCount *message); +size_t eventcast__touch_max_count__pack + (const Eventcast__TouchMaxCount *message, + uint8_t *out); +size_t eventcast__touch_max_count__pack_to_buffer + (const Eventcast__TouchMaxCount *message, + ProtobufCBuffer *buffer); +Eventcast__TouchMaxCount * + eventcast__touch_max_count__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__touch_max_count__free_unpacked + (Eventcast__TouchMaxCount *message, + ProtobufCAllocator *allocator); +/* Eventcast__TouchData methods */ +void eventcast__touch_data__init + (Eventcast__TouchData *message); +size_t eventcast__touch_data__get_packed_size + (const Eventcast__TouchData *message); +size_t eventcast__touch_data__pack + (const Eventcast__TouchData *message, + uint8_t *out); +size_t eventcast__touch_data__pack_to_buffer + (const Eventcast__TouchData *message, + ProtobufCBuffer *buffer); +Eventcast__TouchData * + eventcast__touch_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__touch_data__free_unpacked + (Eventcast__TouchData *message, + ProtobufCAllocator *allocator); +/* Eventcast__HWKeyMsg methods */ +void eventcast__hwkey_msg__init + (Eventcast__HWKeyMsg *message); +size_t eventcast__hwkey_msg__get_packed_size + (const Eventcast__HWKeyMsg *message); +size_t eventcast__hwkey_msg__pack + (const Eventcast__HWKeyMsg *message, + uint8_t *out); +size_t eventcast__hwkey_msg__pack_to_buffer + (const Eventcast__HWKeyMsg *message, + ProtobufCBuffer *buffer); +Eventcast__HWKeyMsg * + eventcast__hwkey_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__hwkey_msg__free_unpacked + (Eventcast__HWKeyMsg *message, + ProtobufCAllocator *allocator); +/* Eventcast__TouchMsg methods */ +void eventcast__touch_msg__init + (Eventcast__TouchMsg *message); +size_t eventcast__touch_msg__get_packed_size + (const Eventcast__TouchMsg *message); +size_t eventcast__touch_msg__pack + (const Eventcast__TouchMsg *message, + uint8_t *out); +size_t eventcast__touch_msg__pack_to_buffer + (const Eventcast__TouchMsg *message, + ProtobufCBuffer *buffer); +Eventcast__TouchMsg * + eventcast__touch_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__touch_msg__free_unpacked + (Eventcast__TouchMsg *message, + ProtobufCAllocator *allocator); +/* Eventcast__EventCastMsg methods */ +void eventcast__event_cast_msg__init + (Eventcast__EventCastMsg *message); +size_t eventcast__event_cast_msg__get_packed_size + (const Eventcast__EventCastMsg *message); +size_t eventcast__event_cast_msg__pack + (const Eventcast__EventCastMsg *message, + uint8_t *out); +size_t eventcast__event_cast_msg__pack_to_buffer + (const Eventcast__EventCastMsg *message, + ProtobufCBuffer *buffer); +Eventcast__EventCastMsg * + eventcast__event_cast_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void eventcast__event_cast_msg__free_unpacked + (Eventcast__EventCastMsg *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Eventcast__HandShakeReq_Closure) + (const Eventcast__HandShakeReq *message, + void *closure_data); +typedef void (*Eventcast__HandShakeAns_Closure) + (const Eventcast__HandShakeAns *message, + void *closure_data); +typedef void (*Eventcast__EmulatorState_Closure) + (const Eventcast__EmulatorState *message, + void *closure_data); +typedef void (*Eventcast__AppState_Closure) + (const Eventcast__AppState *message, + void *closure_data); +typedef void (*Eventcast__StartReq_Closure) + (const Eventcast__StartReq *message, + void *closure_data); +typedef void (*Eventcast__StartAns_Closure) + (const Eventcast__StartAns *message, + void *closure_data); +typedef void (*Eventcast__SetEventStatus_Closure) + (const Eventcast__SetEventStatus *message, + void *closure_data); +typedef void (*Eventcast__EventMsg_Closure) + (const Eventcast__EventMsg *message, + void *closure_data); +typedef void (*Eventcast__EventTerminate_Closure) + (const Eventcast__EventTerminate *message, + void *closure_data); +typedef void (*Eventcast__SetSensorStatus_Closure) + (const Eventcast__SetSensorStatus *message, + void *closure_data); +typedef void (*Eventcast__SensorData_Closure) + (const Eventcast__SensorData *message, + void *closure_data); +typedef void (*Eventcast__SensorMsg_Closure) + (const Eventcast__SensorMsg *message, + void *closure_data); +typedef void (*Eventcast__Resolution_Closure) + (const Eventcast__Resolution *message, + void *closure_data); +typedef void (*Eventcast__DisplayMsg_Closure) + (const Eventcast__DisplayMsg *message, + void *closure_data); +typedef void (*Eventcast__TouchMaxCount_Closure) + (const Eventcast__TouchMaxCount *message, + void *closure_data); +typedef void (*Eventcast__TouchData_Closure) + (const Eventcast__TouchData *message, + void *closure_data); +typedef void (*Eventcast__HWKeyMsg_Closure) + (const Eventcast__HWKeyMsg *message, + void *closure_data); +typedef void (*Eventcast__TouchMsg_Closure) + (const Eventcast__TouchMsg *message, + void *closure_data); +typedef void (*Eventcast__EventCastMsg_Closure) + (const Eventcast__EventCastMsg *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCEnumDescriptor eventcast__message_result__descriptor; +extern const ProtobufCEnumDescriptor eventcast__connection_state__descriptor; +extern const ProtobufCEnumDescriptor eventcast__event_type__descriptor; +extern const ProtobufCEnumDescriptor eventcast__state__descriptor; +extern const ProtobufCEnumDescriptor eventcast__sensor_type__descriptor; +extern const ProtobufCEnumDescriptor eventcast__touch_state__descriptor; +extern const ProtobufCEnumDescriptor eventcast__hwkey_type__descriptor; +extern const ProtobufCMessageDescriptor eventcast__hand_shake_req__descriptor; +extern const ProtobufCMessageDescriptor eventcast__hand_shake_ans__descriptor; +extern const ProtobufCMessageDescriptor eventcast__emulator_state__descriptor; +extern const ProtobufCMessageDescriptor eventcast__app_state__descriptor; +extern const ProtobufCMessageDescriptor eventcast__start_req__descriptor; +extern const ProtobufCMessageDescriptor eventcast__start_ans__descriptor; +extern const ProtobufCMessageDescriptor eventcast__set_event_status__descriptor; +extern const ProtobufCMessageDescriptor eventcast__event_msg__descriptor; +extern const ProtobufCEnumDescriptor eventcast__event_msg__type__descriptor; +extern const ProtobufCMessageDescriptor eventcast__event_terminate__descriptor; +extern const ProtobufCMessageDescriptor eventcast__set_sensor_status__descriptor; +extern const ProtobufCMessageDescriptor eventcast__sensor_data__descriptor; +extern const ProtobufCMessageDescriptor eventcast__sensor_msg__descriptor; +extern const ProtobufCEnumDescriptor eventcast__sensor_msg__type__descriptor; +extern const ProtobufCMessageDescriptor eventcast__resolution__descriptor; +extern const ProtobufCMessageDescriptor eventcast__display_msg__descriptor; +extern const ProtobufCMessageDescriptor eventcast__touch_max_count__descriptor; +extern const ProtobufCMessageDescriptor eventcast__touch_data__descriptor; +extern const ProtobufCMessageDescriptor eventcast__hwkey_msg__descriptor; +extern const ProtobufCMessageDescriptor eventcast__touch_msg__descriptor; +extern const ProtobufCEnumDescriptor eventcast__touch_msg__type__descriptor; +extern const ProtobufCMessageDescriptor eventcast__event_cast_msg__descriptor; +extern const ProtobufCEnumDescriptor eventcast__event_cast_msg__type__descriptor; + +PROTOBUF_C_END_DECLS + + +#endif /* PROTOBUF_eventcast_2eproto__INCLUDED */ diff --git a/tizen/src/eventcast/msg/eventcast.proto b/tizen/src/eventcast/msg/eventcast.proto new file mode 100644 index 0000000000..559458f486 --- /dev/null +++ b/tizen/src/eventcast/msg/eventcast.proto @@ -0,0 +1,214 @@ +package eventcast; + +option java_package = "device.eventcast.genmsg"; + +// protoc-c --c_out=../genmsg eventcast.proto + +// define value +enum MessageResult { + SUCCESS = 1; + FAILURE = 2; + CANCEL = 3; +} + +enum ConnectionState { + CONNECTED = 1; + DISCONNECTED = 2; + TERMINATED = 3; +} + +enum EventType { + SENSOR = 1; + TOUCH = 2; +} + +enum State { + ENABLED = 1; + DISABLED = 2; +} + +enum SensorType { + ACCEL = 1; + MAGNETIC = 2; + GYROSCOPE = 3; + PROXIMITY = 4; + LIGHT = 5; +} + +enum TouchState { + PRESSED = 1; + RELEASED = 2; +} + +// define messages +message HandShakeReq { + required int32 key = 1; +} + +message HandShakeAns { + required MessageResult result = 1; +} + +message EmulatorState { + required ConnectionState state = 1; +} + +message AppState { + required ConnectionState state = 1; +} + +message StartReq { + +} + +message StartAns { + required MessageResult result = 1; +} + +message SetEventStatus { + required EventType type = 1; + required State state = 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 { + +} + +message SetSensorStatus { + required SensorType type = 1; + required State state = 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 Resolution { + required int32 width = 1; + required int32 height = 2; +} + +/* +message DisplayMsg { + enum Type { + START_REQ = 2; + START_ANS = 3; + TERMINATE = 4; + FRAME_RATE = 5; + IMAGE_DATA = 6; + } + + required Type type = 1; + optional StartReq startReq= 2; + optional StartAns startAns= 3; + optional EventTerminate terminate = 4; + optional int32 frameRate = 5; + optional bytes imageData = 6; +} +*/ + +message DisplayMsg { + optional int32 frameRate = 1; + optional bytes imageData = 2; +} + +message TouchMaxCount { + optional int32 max = 1 [default = 10]; +} + +message TouchData { + optional int32 index = 1 [default = 0]; + optional float xPoint = 2 [default = 0.0]; + optional float yPoint = 3 [default = 0.0]; + optional TouchState state = 4; +} + +enum HWKeyType { + MENU = 1; + HOME = 2; + BACK = 3; + POWER = 4; + VOLUME_UP = 5; + VOLUME_DOWN = 6; +} + +message HWKeyMsg { + required HWKeyType type = 1; +} + +message TouchMsg { + enum Type { + START_REQ = 2; + START_ANS = 3; + TERMINATE = 4; + MAX_COUNT = 5; + TOUCH_DATA = 6; + RESOLUTION = 7; + DISPLAY_MSG = 8; + HWKEY_MSG = 9; + } + required Type type = 1; + optional StartReq startReq = 2; + optional StartAns startAns = 3; + optional EventTerminate terminate = 4; + optional TouchMaxCount maxCount = 5; + optional TouchData touchData = 6; + optional Resolution resolution = 7; + optional DisplayMsg display = 8; + optional HWKeyMsg hwkey = 9; +} + +message EventCastMsg { + 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 TouchMsg touchMsg = 8; +} diff --git a/tizen/src/eventcast/sensor.c b/tizen/src/eventcast/sensor.c new file mode 100644 index 0000000000..b69c48caf6 --- /dev/null +++ b/tizen/src/eventcast/sensor.c @@ -0,0 +1,266 @@ +/* + * emulator controller client + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * Kitae Kim + * JiHye Kim + * YeongKyoon Lee + * + * 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 + * + */ + +#if 0 +#ifndef __WIN32 +#include +#else +#define EISCONN WSAEISCONN +#endif + +#include "qemu/main-loop.h" +#include "qemu/sockets.h" +#include "ui/console.h" +#endif + +#include "emulator_common.h" +#include "emul_state.h" + +#include "sensor.h" +#include "common.h" +#include "ecs/ecs_eventcast.h" +#include "genmsg/eventcast.pb-c.h" + +#include "util/new_debug_ch.h" + +DECLARE_DEBUG_CHANNEL(app_tethering); + +typedef struct sensor_state { + bool is_sensor_event; + bool is_sensor_supported; + +} sensor_state; + +enum sensor_level { + level_accel = 1, + level_proxi = 2, + level_light = 3, + level_gyro = 4, + level_geo = 5, + level_tilt = 12, + level_magnetic = 13 +}; + +#define ACCEL_ADJUST 100000 +#define GYRO_ADJUST 17.50 + +static int sensor_device_status; + +// create a sensor message. +static bool build_sensor_msg(Eventcast__SensorMsg *sensor) +{ + bool ret = false; + Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__SENSOR_MSG; + msg.sensormsg = sensor; + + ret = send_msg_to_controller(&msg); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static bool send_sensor_start_ans_msg(Eventcast__MessageResult result) +{ + bool ret = false; + Eventcast__SensorMsg event = EVENTCAST__SENSOR_MSG__INIT; + Eventcast__StartAns start_ans = EVENTCAST__START_ANS__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + start_ans.result = result; + + event.type = EVENTCAST__SENSOR_MSG__TYPE__START_ANS; + event.startans = &start_ans; + + LOG_TRACE("send sensor_start_ans message\n"); + ret = build_sensor_msg(&event); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static bool send_set_sensor_status_msg(Eventcast__SensorType sensor_type, + Eventcast__State status) +{ + bool ret = false; + + Eventcast__SensorMsg sensor = EVENTCAST__SENSOR_MSG__INIT; + Eventcast__SetSensorStatus sensor_status = + EVENTCAST__SET_SENSOR_STATUS__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + sensor_status.type = sensor_type; + sensor_status.state = status; + + sensor.type = EVENTCAST__SENSOR_MSG__TYPE__SENSOR_STATUS; + sensor.setstatus = &sensor_status; + + LOG_TRACE("send sensor_set_event_status message\n"); + ret = build_sensor_msg(&sensor); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static void set_sensor_data(Eventcast__SensorData *data) +{ + /* + * data format for sensor device + * each value is classified by carriage return character + * sensor_type/param numbers/parameters + * ex) acceleration sensor: "level_accel\n3\nx\ny\nz\n" + */ + + switch(data->sensor) { + case EVENTCAST__SENSOR_TYPE__ACCEL: + { + char tmp[255] = {0}; + + sprintf(tmp, "%d\n%d\n%lf\n%lf\n%lf\n", + level_accel, 3, (atof(data->x) * ACCEL_ADJUST), + (atof(data->y) * ACCEL_ADJUST), (atof(data->z) * ACCEL_ADJUST)); + send_eventcast_sensor_data(tmp, strlen(tmp)); + + LOG_TRACE("sensor_accel x: %s, y: %s, z: %s\n", + data->x, data->y, data->z); + } + break; + case EVENTCAST__SENSOR_TYPE__MAGNETIC: + { + char tmp[255] = {0}; + + sprintf(tmp, "%d\n%d\n%s\n%s\n%s\n", + level_magnetic, 3, data->x, data->y, data->z); + send_eventcast_sensor_data(tmp, strlen(tmp)); + + LOG_TRACE("sensor_mag x: %s, y: %s, z: %s\n", + data->x, data->y, data->z); + } + break; + case EVENTCAST__SENSOR_TYPE__GYROSCOPE: + { + char tmp[255] = {0}; + + sprintf(tmp, "%d\n%d\n%lf\n%lf\n%lf\n", + level_gyro, 3, (atof(data->x) / GYRO_ADJUST), + (atof(data->y) / GYRO_ADJUST), (atof(data->z) / GYRO_ADJUST)); + send_eventcast_sensor_data(tmp, strlen(tmp)); + + LOG_TRACE("sensor_gyro x: %s, y: %s, z: %s\n", + data->x, data->y, data->z); + } + break; + case EVENTCAST__SENSOR_TYPE__PROXIMITY: + { + char tmp[255] = {0}; + double x = (double)(atoi(data->x)); + + sprintf(tmp, "%d\n%d\n%.1f\n", level_proxi, 1, x); + send_eventcast_sensor_data(tmp, strlen(tmp)); + + LOG_TRACE("sensor_proxi x: %.1f, %s\n", x, tmp); + } + break; + case EVENTCAST__SENSOR_TYPE__LIGHT: + { + char tmp[255] = {0}; + + sprintf(tmp, "%d\n%d\n%s%s\n", level_light, 2, data->x, data->y); + send_eventcast_sensor_data(tmp, strlen(tmp)); + + LOG_TRACE("sensor_light x: %s\n", data->x); + } + break; + default: + LOG_TRACE("invalid sensor data\n"); + break; + } +} + +bool msgproc_eventcast_sensor_msg(void *message) +{ + bool ret = true; + Eventcast__SensorMsg *msg = (Eventcast__SensorMsg *)message; + + switch(msg->type) { + case EVENTCAST__SENSOR_MSG__TYPE__START_REQ: + LOG_TRACE("SENSOR_MSG_TYPE_START_REQ\n"); + + // set sensor type. + send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__ACCEL, + EVENTCAST__STATE__ENABLED); + send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__MAGNETIC, + EVENTCAST__STATE__ENABLED); + send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__GYROSCOPE, + EVENTCAST__STATE__ENABLED); + send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__PROXIMITY, + EVENTCAST__STATE__ENABLED); + send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__LIGHT, + EVENTCAST__STATE__ENABLED); + + LOG_TRACE("SENSOR_MSG_TYPE_START_ANS\n"); + send_sensor_start_ans_msg(EVENTCAST__MESSAGE_RESULT__SUCCESS); + + break; + case EVENTCAST__SENSOR_MSG__TYPE__TERMINATE: + LOG_TRACE("SENSOR_MSG_TYPE_TERMINATE\n"); + break; + + case EVENTCAST__SENSOR_MSG__TYPE__SENSOR_DATA: + LOG_TRACE("SENSOR_MSG_TYPE_SENSOR_DATA\n"); + set_sensor_data(msg->data); + break; + default: + LOG_TRACE("invalid sensor_msg type"); + ret = false; + break; + } + + return ret; +} + +int get_eventcast_sensor_status(void) +{ + return sensor_device_status; +} + +void set_eventcast_sensor_status(int status) +{ + sensor_device_status = status; + send_eventcast_sensor_status_ecp(); +} diff --git a/tizen/src/eventcast/sensor.h b/tizen/src/eventcast/sensor.h new file mode 100644 index 0000000000..c20b6958f5 --- /dev/null +++ b/tizen/src/eventcast/sensor.h @@ -0,0 +1,35 @@ +/* + * emulator controller client + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * Kitae Kim + * JiHye Kim + * YeongKyoon Lee + * + * 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 + * + */ + +bool msgproc_eventcast_sensor_msg(void *msg); + +int get_eventcast_sensor_status(void); + +void set_eventcast_sensor_status(int status); diff --git a/tizen/src/eventcast/touch.c b/tizen/src/eventcast/touch.c new file mode 100644 index 0000000000..08887d6671 --- /dev/null +++ b/tizen/src/eventcast/touch.c @@ -0,0 +1,305 @@ +/* + * emulator controller client + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * Kitae Kim + * JiHye Kim + * YeongKyoon Lee + * + * 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 "emulator_common.h" +#include "emul_state.h" +#include "common.h" +#include "touch.h" +#include "encode_fb.h" +#include "genmsg/eventcast.pb-c.h" +#include "ecs/ecs_eventcast.h" +#include "util/new_debug_ch.h" + +DECLARE_DEBUG_CHANNEL(app_tethering); + +static int touch_device_status; +static bool send_display_image_data(void); + +#define HARD_KEY_MENU 169 +#define HARD_KEY_BACK 158 + +static bool build_touch_msg(Eventcast__TouchMsg *touch) +{ + bool ret = false; + Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__TOUCH_MSG; + msg.touchmsg = touch; + + LOG_TRACE("touch message size: %d\n", eventcast__event_cast_msg__get_packed_size(&msg)); + ret = send_msg_to_controller(&msg); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static bool send_touch_start_ans_msg(Eventcast__MessageResult result) +{ + bool ret = false; + + Eventcast__TouchMsg mt = EVENTCAST__TOUCH_MSG__INIT; + Eventcast__StartAns start_ans = EVENTCAST__START_ANS__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + start_ans.result = result; + + mt.type = EVENTCAST__TOUCH_MSG__TYPE__START_ANS; + mt.startans = &start_ans; + + ret = build_touch_msg(&mt); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static bool send_set_touch_max_count(void) +{ + bool ret = false; + + Eventcast__TouchMsg mt = EVENTCAST__TOUCH_MSG__INIT; + Eventcast__TouchMaxCount touch_cnt = + EVENTCAST__TOUCH_MAX_COUNT__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + touch_cnt.max = get_emul_max_touch_point(); + + mt.type = EVENTCAST__TOUCH_MSG__TYPE__MAX_COUNT; + mt.maxcount = &touch_cnt; + + LOG_TRACE("send touch max count: %d\n", touch_cnt.max); + ret = build_touch_msg(&mt); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static void set_touch_data(Eventcast__TouchData *data) +{ + float x = 0.0, y = 0.0; + int32_t index = 0, state = 0; + + switch(data->state) { + case EVENTCAST__TOUCH_STATE__PRESSED: + LOG_TRACE("touch pressed\n"); + index = data->index; + x = data->xpoint; + y = data->ypoint; + state = PRESSED; + break; + case EVENTCAST__TOUCH_STATE__RELEASED: + LOG_TRACE("touch released\n"); + index = data->index; + x = data->xpoint; + y = data->ypoint; + state = RELEASED; + break; + default: + LOG_TRACE("invalid touch data\n"); + break; + } + + LOG_TRACE("set touch_data. index: %d, x: %lf, y: %lf\n", index, x, y); + send_eventcast_touch_data(x, y, index, state); +} + +static bool send_set_touch_resolution(void) +{ + bool ret = false; + + Eventcast__TouchMsg mt = EVENTCAST__TOUCH_MSG__INIT; + Eventcast__Resolution resolution = EVENTCAST__RESOLUTION__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + resolution.width = get_emul_resolution_width(); + resolution.height = get_emul_resolution_height(); + + mt.type = EVENTCAST__TOUCH_MSG__TYPE__RESOLUTION; + mt.resolution = &resolution; + + LOG_TRACE("send touch resolution: %dx%d\n", + resolution.width, resolution.height); + ret = build_touch_msg(&mt); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + +static void set_hwkey_data(Eventcast__HWKeyMsg *msg) +{ + int32_t keycode = 0; + + switch (msg->type) { + case EVENTCAST__HWKEY_TYPE__MENU: + keycode = HARD_KEY_MENU; + break; + + case EVENTCAST__HWKEY_TYPE__HOME: + keycode = HARD_KEY_HOME; + break; + + case EVENTCAST__HWKEY_TYPE__BACK: + keycode = HARD_KEY_BACK; + break; + + case EVENTCAST__HWKEY_TYPE__POWER: + keycode = HARD_KEY_POWER; + break; + + case EVENTCAST__HWKEY_TYPE__VOLUME_UP: + keycode = HARD_KEY_VOL_UP; + break; + + case EVENTCAST__HWKEY_TYPE__VOLUME_DOWN: + keycode = HARD_KEY_VOL_DOWN; + break; + + default: + LOG_WARNING("undefined type: %d\n", msg->type); + } + + LOG_TRACE("convert hwkey msg to keycode: %d\n", keycode); + send_eventcast_hwkey_data(keycode); +} + +bool msgproc_eventcast_touch_msg(void *message) +{ + bool ret = true; + Eventcast__TouchMsg *msg = (Eventcast__TouchMsg *)message; + + switch(msg->type) { + case EVENTCAST__TOUCH_MSG__TYPE__START_REQ: + LOG_TRACE("TOUCH_MSG_TYPE_START\n"); + send_set_touch_max_count(); + send_set_touch_resolution(); + ret = send_touch_start_ans_msg(EVENTCAST__MESSAGE_RESULT__SUCCESS); + break; + case EVENTCAST__TOUCH_MSG__TYPE__TERMINATE: + LOG_TRACE("TOUCH_MSG_TYPE_TERMINATE\n"); + break; + + case EVENTCAST__TOUCH_MSG__TYPE__TOUCH_DATA: + LOG_TRACE("TOUCH_MSG_TYPE_TOUCH_DATA\n"); + set_touch_data(msg->touchdata); + break; + + case EVENTCAST__TOUCH_MSG__TYPE__DISPLAY_MSG: + LOG_TRACE("TOUCH_MSG_TYPE_DISPLAY_MSG\n"); + + if (is_display_dirty()) { + LOG_TRACE("display dirty status!! send the image\n"); + + send_display_image_data(); + set_display_dirty(false); + } + break; + + case EVENTCAST__TOUCH_MSG__TYPE__HWKEY_MSG: + LOG_TRACE("TOUCH_MSG_TYPE_HWKEY_MSG\n"); + set_hwkey_data(msg->hwkey); + break; + + default: + LOG_TRACE("invalid touch_msg\n"); + ret = false; + break; + } + + return ret; +} + +int get_eventcast_touch_status(void) +{ + return touch_device_status; +} + +void set_eventcast_touch_status(int status) +{ + touch_device_status = status; + send_eventcast_touch_status_ecp(); +} + +static void dump_display_image_data(struct encode_mem *image) +{ +#ifdef IMAGE_DUMP + FILE *fp = NULL; + + fp = fopen("display_image_dump.png", "wb"); + if (fp != NULL) { + fwrite(image->buffer, 1, image->length, fp); + fclose(fp); + } +#endif +} + +static bool send_display_image_data(void) +{ + bool ret = false; + struct encode_mem *image = NULL; + + Eventcast__TouchMsg touch = EVENTCAST__TOUCH_MSG__INIT; + Eventcast__DisplayMsg display = EVENTCAST__DISPLAY_MSG__INIT; + + LOG_TRACE("enter: %s\n", __func__); + + image = (struct encode_mem *)encode_framebuffer(ENCODE_PNG); + if (!image) { + LOG_SEVERE("failed to encode framebuffer\n"); + return false; + } + + dump_display_image_data(image); + + LOG_TRACE("image data size %d\n", image->length); + display.has_imagedata = true; + display.imagedata.len = image->length; + display.imagedata.data = image->buffer; + + touch.type = EVENTCAST__TOUCH_MSG__TYPE__DISPLAY_MSG; + touch.display = &display; + + ret = build_touch_msg(&touch); + LOG_TRACE("send display message: %d\n", ret); + + g_free(image->buffer); + g_free(image); + + LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} diff --git a/tizen/src/eventcast/touch.h b/tizen/src/eventcast/touch.h new file mode 100644 index 0000000000..0d754e1cf6 --- /dev/null +++ b/tizen/src/eventcast/touch.h @@ -0,0 +1,40 @@ +/* + * emulator controller client + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: + * Kitae Kim + * JiHye Kim + * YeongKyoon Lee + * + * 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 + * + */ + +enum { + ENCODE_WEBP = 0, + ENCODE_PNG, +}; + +bool msgproc_eventcast_touch_msg(void *message); + +int get_eventcast_touch_status(void); + +void set_eventcast_touch_status(int status); diff --git a/tizen/src/tethering/Makefile.objs b/tizen/src/tethering/Makefile.objs deleted file mode 100644 index 9aa4799ed4..0000000000 --- a/tizen/src/tethering/Makefile.objs +++ /dev/null @@ -1,7 +0,0 @@ -obj-y += genmsg/tethering.pb-c.o # protobuf-c.o -obj-y += common.o -obj-y += sensor.o -obj-y += touch.o -obj-y += encode_fb.o - -encode_fb.o-cflags := $(LIBPNG_CFLAGS) diff --git a/tizen/src/tethering/common.c b/tizen/src/tethering/common.c deleted file mode 100644 index 60ede59f28..0000000000 --- a/tizen/src/tethering/common.c +++ /dev/null @@ -1,870 +0,0 @@ -/* - * emulator controller client - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * Kitae Kim - * JiHye Kim - * YeongKyoon Lee - * - * 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 - * - */ - -#ifndef __WIN32 -#include -#else -#define EISCONN WSAEISCONN -#define EALREADY WSAEALREADY -#endif - -#include "qemu-common.h" -#include "qemu/main-loop.h" -#include "qemu/sockets.h" -#include "ui/console.h" - -#include "emulator.h" -#include "common.h" -#include "sensor.h" -#include "touch.h" -#include "emul_state.h" -#include "ecs/ecs_tethering.h" -#include "genmsg/tethering.pb-c.h" - -#include "util/new_debug_ch.h" - -DECLARE_DEBUG_CHANNEL(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 - -#define SEND_BUF_MAX_SIZE 4096 -static const char *loopback = "127.0.0.1"; - -enum connection_type { - NONE = 0, - USB, - WIFI, -}; - -typedef struct tethering_recv_buf { - uint32_t len; - uint32_t stack_size; - char data[MSG_BUF_SIZE]; -} tethering_recv_buf; - -typedef struct _TetheringState { - int fd; - - // server address - int port; - gchar *ipaddress; - - // connection state - int status; - int type; - - // receiver handling thread - QemuThread thread; - QemuMutex mutex; - - tethering_recv_buf recv_buf; - - // device state - QTAILQ_HEAD(device, input_device_list) device; - int device_node_cnt; - -} TetheringState; - -static TetheringState *tethering_client = NULL; -static tethering_recv_buf recv_buf; - -static void end_tethering_socket(int sockfd); -static void set_tethering_connection_status(int status); -#if 0 -static bool app_state = false; - -static void set_tethering_app_state(bool state); -static bool get_tethering_app_state(void); -#endif - -// create master message -static void *build_tethering_msg(Tethering__TetheringMsg* msg, int *payloadsize) -{ - void *buf = NULL; - int msg_packed_size = 0; - - msg_packed_size = tethering__tethering_msg__get_packed_size(msg); - *payloadsize = msg_packed_size + MSG_LEN_SIZE; - - LOG_TRACE("create tethering_msg. msg_packed_size %d, payloadsize %d\n", msg_packed_size, *payloadsize); - - buf = g_malloc(*payloadsize); - if (!buf) { - LOG_SEVERE("failed to allocate memory\n"); - return NULL; - } - - tethering__tethering_msg__pack(msg, buf + MSG_LEN_SIZE); - - LOG_TRACE("msg_packed_size 1 %x\n", msg_packed_size); - msg_packed_size = htonl(msg_packed_size); - LOG_TRACE("msg_packed_size 2 %x\n", msg_packed_size); - - memcpy(buf, &msg_packed_size, MSG_LEN_SIZE); - - return buf; -} - -bool send_msg_to_controller(void *msg) -{ - Tethering__TetheringMsg * tetheringMsg = (Tethering__TetheringMsg *)msg; - - void *buf = NULL; - int payload_size = 0, sent_size = 0; - int total_buf_size = 0; - int sockfd = 0; - bool ret = true; - uint32_t buf_offset = 0; - - buf = build_tethering_msg(tetheringMsg, &payload_size); - if (!buf) { - return false; - } - - if (!tethering_client) { - LOG_SEVERE("TetheringState is NULL\n"); - g_free(buf); - return false; - } - sockfd = tethering_client->fd; - - total_buf_size = payload_size; - do { - LOG_TRACE("sending a buffer as many as this size: %d\n", total_buf_size); - - sent_size = - qemu_sendto(sockfd, buf + buf_offset, total_buf_size, 0, NULL, 0); - if (sent_size < 0) { - perror("failed to send a packet"); - if (errno == EAGAIN) { - fd_set writefds; - struct timeval timeout; - int result = 0; - - FD_ZERO(&writefds); - FD_SET(sockfd, &writefds); - - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - result = select(sockfd + 1, NULL, &writefds, NULL, &timeout); - if (result < 0) { - LOG_INFO("not possible to send data\n"); - ret = false; - break; - } - LOG_TRACE("possible to send data\n"); - continue; - } - - LOG_SEVERE("failed to send a message. sent_size: %d\n", sent_size); - ret = false; - break; - } - - LOG_TRACE("sent size: %d\n", sent_size); - buf_offset += sent_size; - total_buf_size -= sent_size; - } while (total_buf_size > 0); - - LOG_TRACE("sent packets: %d, payload_size %d\n", (payload_size - total_buf_size), payload_size); - g_free(buf); - - return ret; -} - -static bool send_handshake_req_msg(void) -{ - Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT; - Tethering__HandShakeReq req = TETHERING__HAND_SHAKE_REQ__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - req.key = TETHERING_MSG_HANDSHAKE_KEY; - - msg.type = TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_REQ; - msg.handshakereq = &req; - - LOG_TRACE("send handshake_req message\n"); - send_msg_to_controller(&msg); - - LOG_TRACE("leave: %s\n", __func__); - - return true; -} - -static bool send_emul_state_msg(void) -{ - Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT; - Tethering__EmulatorState emul_state = TETHERING__EMULATOR_STATE__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - emul_state.state = TETHERING__CONNECTION_STATE__DISCONNECTED; - - msg.type = TETHERING__TETHERING_MSG__TYPE__EMUL_STATE; - msg.emulstate = &emul_state; - - LOG_INFO("send emulator_state message\n"); - send_msg_to_controller(&msg); - - LOG_TRACE("leave: %s\n", __func__); - - return true; -} - -// event messages -static bool build_event_msg(Tethering__EventMsg *event) -{ - bool ret = false; - Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - msg.type = TETHERING__TETHERING_MSG__TYPE__EVENT_MSG; - msg.eventmsg = event; - - ret = send_msg_to_controller(&msg); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static bool send_event_start_ans_msg(Tethering__MessageResult result) -{ - bool ret = false; - Tethering__EventMsg event = TETHERING__EVENT_MSG__INIT; - Tethering__StartAns start_ans = TETHERING__START_ANS__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - start_ans.result = result; - - event.type = TETHERING__EVENT_MSG__TYPE__START_ANS; - event.startans = &start_ans; - - LOG_TRACE("send event_start_ans message\n"); - ret = build_event_msg(&event); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static bool send_set_event_status_msg(Tethering__EventType event_type, - Tethering__State status) -{ - bool ret = false; - Tethering__EventMsg event = TETHERING__EVENT_MSG__INIT; - Tethering__SetEventStatus event_status = TETHERING__SET_EVENT_STATUS__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - event_status.type = event_type; - event_status.state = status; - - event.type = TETHERING__EVENT_MSG__TYPE__EVENT_STATUS; - event.setstatus = &event_status; - - LOG_TRACE("send event_set_event_status message\n"); - ret = build_event_msg(&event); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -// message handlers -static void msgproc_tethering_handshake_ans(Tethering__HandShakeAns *msg) -{ - // handle handshake answer -} - -static void msgproc_app_state_msg(Tethering__AppState *msg) -{ - int status = TETHERING__STATE__DISABLED; - - if (msg->state == TETHERING__CONNECTION_STATE__TERMINATED) { - LOG_INFO("app is terminated\n"); - - // set_tethering_app_state(false); - set_tethering_sensor_status(status); - set_tethering_touch_status(status); - - disconnect_tethering_app(); - } -} - -static bool msgproc_tethering_event_msg(Tethering__EventMsg *msg) -{ - bool ret = true; - - switch(msg->type) { - case TETHERING__EVENT_MSG__TYPE__START_REQ: - { - int touch_status = 0; - - LOG_TRACE("EVENT_MSG_TYPE_START_REQ\n"); - send_set_event_status_msg(TETHERING__EVENT_TYPE__SENSOR, - TETHERING__STATE__ENABLED); - - // TODO: check sensor device whether it exists or not - set_tethering_sensor_status(TETHERING__STATE__ENABLED); - - if (is_emul_input_touch_enable()) { - touch_status = TETHERING__STATE__ENABLED; - } else { - touch_status = TETHERING__STATE__DISABLED; - } - set_tethering_touch_status(touch_status); - - LOG_TRACE("send touch event_status msg: %d\n", touch_status); - send_set_event_status_msg(TETHERING__EVENT_TYPE__TOUCH, touch_status); - - LOG_TRACE("send event_start_ans msg: %d\n", touch_status); - send_event_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS); - } - break; - case TETHERING__EVENT_MSG__TYPE__TERMINATE: - break; - - default: - LOG_WARNING("invalid event_msg type\n"); - ret = false; - break; - } - - return ret; -} - -static bool handle_tethering_msg_from_controller(char *data, int len) -{ - Tethering__TetheringMsg *tethering = NULL; - bool ret = true; - - tethering = tethering__tethering_msg__unpack(NULL, (size_t)len, - (const uint8_t *)data); - - if (!tethering) { - LOG_SEVERE("no tethering massage\n"); - return false; - } - - switch (tethering->type) { - case TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_ANS: - { - // TODO: set the result of handshake_ans to - Tethering__HandShakeAns *msg = tethering->handshakeans; - if (!msg) { - ret = false; - } else { - msgproc_tethering_handshake_ans(msg); - LOG_TRACE("receive handshake answer\n"); - - set_tethering_connection_status(CONNECTED); - } - } - break; - case TETHERING__TETHERING_MSG__TYPE__APP_STATE: - { - Tethering__AppState *msg = tethering->appstate; - - LOG_TRACE("receive app_state msg\n"); - if (!msg) { - ret = false; - } else { - msgproc_app_state_msg(msg); - } - } - break; - case TETHERING__TETHERING_MSG__TYPE__EVENT_MSG: - { - Tethering__EventMsg *msg = tethering->eventmsg; - - LOG_TRACE("receive event_msg\n"); - if (!msg) { - ret = false; - } else { - msgproc_tethering_event_msg(msg); - } - } - break; - case TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG: - { - Tethering__SensorMsg *msg = tethering->sensormsg; - - LOG_TRACE("receive sensor_msg\n"); - if (!msg) { - ret = false; - } else { - msgproc_tethering_sensor_msg(msg); - } - } - break; - case TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG: - { - Tethering__TouchMsg *msg = tethering->touchmsg; - - LOG_TRACE("receive touch_msg\n"); - if (!msg) { - ret = false; - } else { - msgproc_tethering_touch_msg(msg); - } - } - break; - - default: - LOG_WARNING("invalid type message\n"); - ret = false; - break; - } - - tethering__tethering_msg__free_unpacked(tethering, 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 payloadsize = 0, read_size = 0; - int to_read_bytes = 0; - int sockfd = 0, ret = 0; - - if (!tethering_client) { - return; - } - sockfd = tethering_client->fd; - -#ifndef CONFIG_WIN32 - ret = ioctl(sockfd, FIONREAD, &to_read_bytes); - if (ret < 0) { - perror("invalid ioctl opertion\n"); - disconnect_tethering_app(); - return; - } - -#else - unsigned long to_read_bytes_long = 0; - ret = ioctlsocket(sockfd, FIONREAD, &to_read_bytes_long); - if (ret < 0) { - perror("invalid ioctl opertion\n"); - disconnect_tethering_app(); - return; - } - - to_read_bytes = (int)to_read_bytes_long; -#endif - - LOG_TRACE("ioctl: ret: %d, FIONREAD: %d\n", ret, to_read_bytes); - if (to_read_bytes == 0) { - LOG_INFO("there is no read data\n"); - disconnect_tethering_app(); - return; - } - - // TODO: why this conditional is used?? - if (recv_buf.len == 0) { - ret = qemu_recv(sockfd, &payloadsize, sizeof(payloadsize), 0); - if (ret < sizeof(payloadsize)) { - return; - } - - payloadsize = ntohl(payloadsize); - LOG_TRACE("payload size: %d\n", payloadsize); - -#if 0 - if (payloadsize > to_read_bytes) { - LOG_INFO("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(sockfd, (char *)(recv_buf.data + recv_buf.stack_size), - to_read_bytes, 0); - if (read_size == 0) { - LOG_SEVERE("failed to read data\n"); - disconnect_tethering_app(); - return; - } - - 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); - if (!snd_buf) { - return; - } else { - memcpy(snd_buf, recv_buf.data, recv_buf.stack_size); - handle_tethering_msg_from_controller(snd_buf, recv_buf.stack_size); - g_free(snd_buf); - reset_tethering_recv_buf(&recv_buf); - } - } -} - -// socket functions -static int start_tethering_socket(const char *ipaddress, int port) -{ - struct sockaddr_in addr; - int sock = -1, ret = 0; - - addr.sin_family = AF_INET; - addr.sin_port = htons(port); // i.e. 1234 - - LOG_INFO("server ip address: %s, port: %d\n", ipaddress, port); - ret = inet_aton(ipaddress, &addr.sin_addr); - if (ret == 0) { - perror("inet_aton failure\n"); - return -1; - } - - sock = qemu_socket(PF_INET, SOCK_STREAM, 0); - if (sock < 0) { - // set_tethering_connection_status(DISCONNECTED); - LOG_SEVERE("tethering socket creation is failed\n", sock); - return -1; - } - LOG_INFO("tethering socket is created: %d\n", sock); - - qemu_set_nonblock(sock); - - set_tethering_connection_status(CONNECTING); - - while (1) { - ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr)); - - if (ret == 0) { - LOG_INFO("tethering socket is connected.\n"); - break; - } else { - int connection_errno = socket_error(); - - if (connection_errno == EINPROGRESS) { - fd_set writefds; - struct timeval timeout; - - LOG_INFO("connection is progressing\n"); - - FD_ZERO(&writefds); - FD_SET(sock, &writefds); - - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - if (select(sock + 1, NULL, &writefds, NULL, &timeout) > 0) { - int opt; - socklen_t opt_size = sizeof(opt); - - qemu_getsockopt(sock, SOL_SOCKET, SO_ERROR, &opt, &opt_size); - if (opt) { - LOG_SEVERE("error in connection %d - %s\n", opt, strerror(opt)); - } else { - LOG_INFO("timeout or error is %d - %s\n", opt, strerror(opt)); - } - } else { - LOG_INFO("error connection %d - %s\n", errno, strerror(errno)); - } - continue; - } else if (connection_errno == EALREADY) { - LOG_INFO("a previous connection has not yet been completed\n"); - ret = 0; - continue; - } else if (connection_errno == EISCONN) { - LOG_INFO("connection is already connected\n"); - ret = 0; - break; - } else { - perror("connect failure"); - ret = -connection_errno; - break; - } - } - } - - if (ret < 0) { - if (ret == -ECONNREFUSED) { - LOG_INFO("socket connection is refused\n"); - set_tethering_connection_status(CONNREFUSED); - } - LOG_TRACE("close socket\n"); - end_tethering_socket(sock); - sock = -1; - } - - return sock; -} - -static void end_tethering_socket(int sockfd) -{ - int status = TETHERING__STATE__DISABLED; - - LOG_TRACE("enter: %s\n", __func__); - - if (closesocket(sockfd) < 0) { - perror("closesocket failure"); - return; - } - - tethering_client->fd = -1; - - LOG_INFO("close tethering socket\n"); - set_tethering_connection_status(DISCONNECTED); - set_tethering_sensor_status(status); - set_tethering_touch_status(status); - - LOG_TRACE("leave: %s\n", __func__); -} - -#if 0 -static void set_tethering_app_state(bool state) -{ - LOG_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) -{ - int status = 0; - - if (!tethering_client) { - LOG_INFO("tethering_client is null\n"); - LOG_INFO("tetherging connection status: %d\n", status); - return DISCONNECTED; - } - - qemu_mutex_lock(&tethering_client->mutex); - status = tethering_client->status; - qemu_mutex_unlock(&tethering_client->mutex); - - LOG_INFO("tetherging connection status: %d\n", status); - - return status; -} - -int get_tethering_connected_port(void) -{ - if (!tethering_client) { - LOG_SEVERE("tethering_client is null\n"); - return 0; - } - - LOG_TRACE("connected port: %d\n", tethering_client->port); - return tethering_client->port; -} - -const char *get_tethering_connected_ipaddr(void) -{ - if (!tethering_client) { - LOG_SEVERE("tethering client is null\n"); - return NULL; - } - - LOG_TRACE("connected ip address: %s\n", tethering_client->ipaddress); - return tethering_client->ipaddress; -} - -static void set_tethering_connection_status(int status) -{ - if (!tethering_client) { - return; - } - - qemu_mutex_lock(&tethering_client->mutex); - tethering_client->status = status; - qemu_mutex_unlock(&tethering_client->mutex); - - send_tethering_connection_status_ecp(); -} - -static void tethering_notify_exit(Notifier *notifier, void *data) -{ - LOG_INFO("tethering_notify_exit\n"); - disconnect_tethering_app(); -} -static Notifier tethering_exit = { .notify = tethering_notify_exit }; - -static void *initialize_tethering_socket(void *opaque); - -int connect_tethering_app(const char *ipaddress, int port) -{ - TetheringState *client = NULL; - int ipaddr_len = 0; - - client = g_malloc0(sizeof(TetheringState)); - if (!client) { - return -1; - } - - client->port = port; - - if (ipaddress) { - ipaddr_len = strlen(ipaddress); - client->type = WIFI; - } else { - ipaddr_len = strlen(loopback); - ipaddress = loopback; - client->type = USB; - } - - client->ipaddress = g_malloc0(ipaddr_len + 1); - if (!client->ipaddress) { - LOG_SEVERE("failed to allocate ipaddress buffer\n"); - g_free(client); - return -1; - } - - g_strlcpy(client->ipaddress, ipaddress, ipaddr_len + 1); - LOG_INFO("connection info. ip %s, port %d type %d\n", - client->ipaddress, client->port, client->type); - - tethering_client = client; - - qemu_mutex_init(&tethering_client->mutex); - qemu_thread_create(&tethering_client->thread, "tethering-io-thread", - initialize_tethering_socket, client, - QEMU_THREAD_DETACHED); - - return 0; -} - -int disconnect_tethering_app(void) -{ - int sock = 0; - - LOG_TRACE("disconnect app from ecp\n"); - if (!tethering_client) { - LOG_SEVERE("tethering client instance is NULL\n"); - return -1; - } - - sock = tethering_client->fd; - if (sock < 0) { - LOG_SEVERE("tethering socket is already terminated or not ready\n"); - return -1; - } else { - send_emul_state_msg(); - end_tethering_socket(sock); - } - - return 0; -} - -static int tethering_loop(int sockfd) -{ - int ret = 0; - fd_set readfds; - struct timeval timeout; - - FD_ZERO(&readfds); - FD_SET(sockfd, &readfds); - - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - ret = select(sockfd + 1, &readfds, NULL, NULL, &timeout); - LOG_TRACE("select timeout! result: %d\n", ret); - - if (ret > 0) { - LOG_TRACE("ready for read operation!!\n"); - tethering_io_handler(socket); - } - - return ret; -} - -static void *initialize_tethering_socket(void *opaque) -{ - TetheringState *client = (TetheringState *)opaque; - LOG_TRACE("callback function for tethering_thread\n"); - - if (!client) { - LOG_SEVERE("TetheringState is NULL\n"); - return NULL; - } - - client->fd = start_tethering_socket(client->ipaddress, client->port); - if (client->fd < 0) { - LOG_SEVERE("failed to start tethering_socket\n"); - // tethering_sock = -1; - return NULL; - } - LOG_TRACE("tethering_sock: %d\n", client->fd); - - reset_tethering_recv_buf(&recv_buf); - send_handshake_req_msg(); - - emulator_add_exit_notifier(&tethering_exit); - - while (1) { - qemu_mutex_lock(&client->mutex); - if (client->status == DISCONNECTED) { - qemu_mutex_unlock(&client->mutex); - LOG_INFO("disconnected socket. destroy this thread\n"); - break; - } - qemu_mutex_unlock(&client->mutex); - - tethering_loop(client->fd); - } - - return client; -} diff --git a/tizen/src/tethering/common.h b/tizen/src/tethering/common.h deleted file mode 100644 index a75fa7074f..0000000000 --- a/tizen/src/tethering/common.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * emulator controller client - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * Kitae Kim - * JiHye Kim - * YeongKyoon Lee - * - * 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 - * - */ - -enum connection_status { - DISCONNECTED = 0, - CONNECTED, - CONNECTING, - CONNREFUSED, -}; - -enum touch_status { - RELEASED = 0, - PRESSED, -}; - -bool send_msg_to_controller(void *msg); - -int connect_tethering_app(const char *ipaddress, int port); - -int disconnect_tethering_app(void); - -int get_tethering_connection_status(void); - -int get_tethering_connected_port(void); - -const char *get_tethering_connected_ipaddr(void); diff --git a/tizen/src/tethering/encode_fb.c b/tizen/src/tethering/encode_fb.c deleted file mode 100644 index 022fba13f5..0000000000 --- a/tizen/src/tethering/encode_fb.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * emulator controller client - * - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * Kitae Kim - * SangHo Park - * YeongKyoon Lee - * - * 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 - -#include "emulator_common.h" -#include "emul_state.h" -#include "skin/maruskin_operation.h" -#include "encode_fb.h" - -#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG) -#include -#endif -#ifdef CONFIG_WEBP -#include -#include -#endif - -#include "util/new_debug_ch.h" - -DECLARE_DEBUG_CHANNEL(app_tethering); - -#ifdef CONFIG_WEBP -/* - * webp functions - */ -static void *encode_webp(void) -{ - int width = 0, height = 0, image_stride = 0; - size_t ret = 0; - - struct encode_mem *container = NULL; - uint8_t *surface = NULL; - uint32_t surface_size = 0; - - container = g_malloc(sizeof(struct encode_mem)); - if (!container) { - LOG_SEVERE("failed to allocate encode_mem\n"); - return NULL; - } - - container->buffer = NULL; - container->length = 0; - - width = get_emul_resolution_width(); - height = get_emul_resolution_height(); - - image_stride = width * 4; - LOG_TRACE("width %d, height %d, stride %d, raw image %d\n", - width, height, image_stride, (image_stride * height)); - - surface_size = width * height * 4; - - surface = g_malloc0(surface_size); - if (!surface) { - LOG_SEVERE("failed to allocate framebuffer\n"); - return NULL; - } - - if (!maru_extract_framebuffer(surface)) { - LOG_SEVERE("failed to extract framebuffer\n"); - g_free(surface); - return NULL; - } - - container = g_malloc(sizeof(struct encode_mem)); - if (!container) { - LOG_SEVERE("failed to allocate encode_mem\n"); - g_free(surface); - return NULL; - } - - container->buffer = NULL; - container->length = 0; - - ret = WebPEncodeLosslessBGRA((const uint8_t *)surface, width, - height, image_stride, &container->buffer); - LOG_TRACE("lossless encode framebuffer via webp. result %zu\n", ret); - - container->length = (int)ret; - - g_free(surface); - - return container; -} -#endif - -#ifdef CONFIG_PNG -/* - * png functions - */ -static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t len) -{ - struct encode_mem *p = (struct encode_mem *)png_get_io_ptr(png_ptr); - size_t nsize = p->length + len; - - if (p->buffer) { - p->buffer = g_realloc(p->buffer, nsize); - } else { - p->buffer = g_malloc(nsize); - } - - if (!p->buffer) { - LOG_SEVERE("failed to allocate \n"); - } else { - memcpy(p->buffer + p->length, data, len); - p->length += len; - } -} - -static void user_flush_data(png_structp png_ptr) -{ -} - -static void *encode_png(void) -{ - int width = 0, height = 0, image_stride = 0; - int row_index; - /* - * bit_depth: depending on color type - * in case of RGB_ALPHA, 8 or 16 - */ - int bit_depth = 8; - struct encode_mem *container = NULL; - uint8_t *surface = NULL; - uint32_t surface_size = 0; - - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; - png_bytepp row_pointers = NULL; - - width = get_emul_resolution_width(); - height = get_emul_resolution_height(); - - image_stride = width * 4; - LOG_TRACE("width %d, height %d, stride %d, raw image %d\n", - width, height, image_stride, (image_stride * height)); - - surface_size = width * height * 4; - - surface = g_malloc0(surface_size); - if (!surface) { - LOG_SEVERE("failed to allocate framebuffer\n"); - return NULL; - } - - if (!maru_extract_framebuffer(surface)) { - LOG_SEVERE("failed to extract framebuffer\n"); - g_free(surface); - return NULL; - } - - LOG_TRACE("png_create_write_struct\n"); - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (!png_ptr) { - LOG_SEVERE("png_create_write_struct failure\n"); - g_free(surface); - return NULL; - } - - LOG_TRACE("png_create_info_struct\n"); - info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) { - LOG_SEVERE("png_create_info_struct failure\n"); - g_free(surface); - png_destroy_write_struct(&png_ptr, &info_ptr); - return NULL; - } - - LOG_TRACE("try png_jmpbuf\n"); - if (setjmp(png_jmpbuf(png_ptr))) { - LOG_SEVERE("png_jmpbuf failure\n"); - g_free(surface); - png_destroy_write_struct(&png_ptr, &info_ptr); - png_destroy_info_struct(png_ptr, &info_ptr); - return NULL; - } - - LOG_TRACE("png_init_io\n"); - container = g_malloc(sizeof(struct encode_mem)); - if (!container) { - LOG_SEVERE("failed to allocate encode_mem\n"); - g_free(surface); - png_destroy_write_struct(&png_ptr, &info_ptr); - png_destroy_info_struct(png_ptr, &info_ptr); - return NULL; - } - - container->buffer = NULL; - container->length = 0; - - png_set_write_fn(png_ptr, container, user_write_data, user_flush_data); - - // set image attributes - png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, - PNG_COLOR_TYPE_RGB_ALPHA, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); - - png_write_info(png_ptr, info_ptr); - - // Filp BGR pixels to RGB - png_set_bgr(png_ptr); - - row_pointers = png_malloc(png_ptr, sizeof(png_bytep) * height); - if (row_pointers == NULL) { - LOG_SEVERE("failed to allocate png memory\n"); - g_free(surface); - png_destroy_write_struct(&png_ptr, &info_ptr); - png_destroy_info_struct(png_ptr, &info_ptr); - return NULL; - } - - for (row_index = 0; row_index < height; row_index++) { - row_pointers[row_index] = surface + (row_index * image_stride); - } - - LOG_TRACE("png_write_image\n"); - png_write_image(png_ptr, row_pointers); - - LOG_TRACE("png_write_end\n"); - png_write_end(png_ptr, info_ptr); - - g_free(surface); - - LOG_TRACE("png image size %d\n", container->length); - png_destroy_write_struct(&png_ptr, &info_ptr); - png_destroy_info_struct(png_ptr, &info_ptr); - - return container; -} -#endif - -void *encode_framebuffer(int encoder) -{ - void *output = NULL; - -#ifdef CONFIG_PNG -#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG) - struct timespec start, end; - - clock_gettime(CLOCK_MONOTONIC, &start); -#endif - - output = encode_png(); - -#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG) - clock_gettime(CLOCK_MONOTONIC, &end); - - LOG_TRACE("encoding time: %.5f seconds\n", - ((double)end.tv_sec + (1.0e-9 * end.tv_nsec)) - - ((double)start.tv_sec + (1.0e-9 * start.tv_nsec))); -#endif -#endif - - return output; -} - -static bool display_dirty = false; - -void set_display_dirty(bool dirty) -{ - LOG_TRACE("qemu display update: %d\n", display_dirty); - display_dirty = dirty; -} - -bool is_display_dirty(void) -{ - return display_dirty; -} diff --git a/tizen/src/tethering/encode_fb.h b/tizen/src/tethering/encode_fb.h deleted file mode 100644 index 32a777f22f..0000000000 --- a/tizen/src/tethering/encode_fb.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * emulator controller client - * - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * Kitae Kim - * JiHye Kim - * YeongKyoon Lee - * - * 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 - * - */ - -struct encode_mem { - uint8_t *buffer; - uint32_t length; -}; - -void *encode_framebuffer(int encoder); - -bool maru_extract_framebuffer(void *buffer); - -void set_display_dirty(bool dirty); - -bool is_display_dirty(void); diff --git a/tizen/src/tethering/genmsg/tethering.pb-c.c b/tizen/src/tethering/genmsg/tethering.pb-c.c deleted file mode 100644 index 1b4a7e0c36..0000000000 --- a/tizen/src/tethering/genmsg/tethering.pb-c.c +++ /dev/null @@ -1,2314 +0,0 @@ -/* 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 tethering__hand_shake_req__init - (Tethering__HandShakeReq *message) -{ - static Tethering__HandShakeReq init_value = TETHERING__HAND_SHAKE_REQ__INIT; - *message = init_value; -} -size_t tethering__hand_shake_req__get_packed_size - (const Tethering__HandShakeReq *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_req__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__hand_shake_req__pack - (const Tethering__HandShakeReq *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_req__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__hand_shake_req__pack_to_buffer - (const Tethering__HandShakeReq *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_req__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__HandShakeReq * - tethering__hand_shake_req__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__HandShakeReq *) - protobuf_c_message_unpack (&tethering__hand_shake_req__descriptor, - allocator, len, data); -} -void tethering__hand_shake_req__free_unpacked - (Tethering__HandShakeReq *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_req__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__hand_shake_ans__init - (Tethering__HandShakeAns *message) -{ - static Tethering__HandShakeAns init_value = TETHERING__HAND_SHAKE_ANS__INIT; - *message = init_value; -} -size_t tethering__hand_shake_ans__get_packed_size - (const Tethering__HandShakeAns *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_ans__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__hand_shake_ans__pack - (const Tethering__HandShakeAns *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_ans__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__hand_shake_ans__pack_to_buffer - (const Tethering__HandShakeAns *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_ans__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__HandShakeAns * - tethering__hand_shake_ans__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__HandShakeAns *) - protobuf_c_message_unpack (&tethering__hand_shake_ans__descriptor, - allocator, len, data); -} -void tethering__hand_shake_ans__free_unpacked - (Tethering__HandShakeAns *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_ans__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__emulator_state__init - (Tethering__EmulatorState *message) -{ - static Tethering__EmulatorState init_value = TETHERING__EMULATOR_STATE__INIT; - *message = init_value; -} -size_t tethering__emulator_state__get_packed_size - (const Tethering__EmulatorState *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__emulator_state__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__emulator_state__pack - (const Tethering__EmulatorState *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__emulator_state__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__emulator_state__pack_to_buffer - (const Tethering__EmulatorState *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__emulator_state__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__EmulatorState * - tethering__emulator_state__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__EmulatorState *) - protobuf_c_message_unpack (&tethering__emulator_state__descriptor, - allocator, len, data); -} -void tethering__emulator_state__free_unpacked - (Tethering__EmulatorState *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__emulator_state__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__app_state__init - (Tethering__AppState *message) -{ - static Tethering__AppState init_value = TETHERING__APP_STATE__INIT; - *message = init_value; -} -size_t tethering__app_state__get_packed_size - (const Tethering__AppState *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__app_state__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__app_state__pack - (const Tethering__AppState *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__app_state__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__app_state__pack_to_buffer - (const Tethering__AppState *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__app_state__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__AppState * - tethering__app_state__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__AppState *) - protobuf_c_message_unpack (&tethering__app_state__descriptor, - allocator, len, data); -} -void tethering__app_state__free_unpacked - (Tethering__AppState *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__app_state__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__start_req__init - (Tethering__StartReq *message) -{ - static Tethering__StartReq init_value = TETHERING__START_REQ__INIT; - *message = init_value; -} -size_t tethering__start_req__get_packed_size - (const Tethering__StartReq *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_req__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__start_req__pack - (const Tethering__StartReq *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_req__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__start_req__pack_to_buffer - (const Tethering__StartReq *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_req__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__StartReq * - tethering__start_req__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__StartReq *) - protobuf_c_message_unpack (&tethering__start_req__descriptor, - allocator, len, data); -} -void tethering__start_req__free_unpacked - (Tethering__StartReq *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_req__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__start_ans__init - (Tethering__StartAns *message) -{ - static Tethering__StartAns init_value = TETHERING__START_ANS__INIT; - *message = init_value; -} -size_t tethering__start_ans__get_packed_size - (const Tethering__StartAns *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_ans__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__start_ans__pack - (const Tethering__StartAns *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_ans__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__start_ans__pack_to_buffer - (const Tethering__StartAns *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_ans__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__StartAns * - tethering__start_ans__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__StartAns *) - protobuf_c_message_unpack (&tethering__start_ans__descriptor, - allocator, len, data); -} -void tethering__start_ans__free_unpacked - (Tethering__StartAns *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_ans__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__set_event_status__init - (Tethering__SetEventStatus *message) -{ - static Tethering__SetEventStatus init_value = TETHERING__SET_EVENT_STATUS__INIT; - *message = init_value; -} -size_t tethering__set_event_status__get_packed_size - (const Tethering__SetEventStatus *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_event_status__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__set_event_status__pack - (const Tethering__SetEventStatus *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_event_status__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__set_event_status__pack_to_buffer - (const Tethering__SetEventStatus *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_event_status__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__SetEventStatus * - tethering__set_event_status__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__SetEventStatus *) - protobuf_c_message_unpack (&tethering__set_event_status__descriptor, - allocator, len, data); -} -void tethering__set_event_status__free_unpacked - (Tethering__SetEventStatus *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_event_status__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__event_msg__init - (Tethering__EventMsg *message) -{ - static Tethering__EventMsg init_value = TETHERING__EVENT_MSG__INIT; - *message = init_value; -} -size_t tethering__event_msg__get_packed_size - (const Tethering__EventMsg *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_msg__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__event_msg__pack - (const Tethering__EventMsg *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_msg__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__event_msg__pack_to_buffer - (const Tethering__EventMsg *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_msg__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__EventMsg * - tethering__event_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__EventMsg *) - protobuf_c_message_unpack (&tethering__event_msg__descriptor, - allocator, len, data); -} -void tethering__event_msg__free_unpacked - (Tethering__EventMsg *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_msg__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__event_terminate__init - (Tethering__EventTerminate *message) -{ - static Tethering__EventTerminate init_value = TETHERING__EVENT_TERMINATE__INIT; - *message = init_value; -} -size_t tethering__event_terminate__get_packed_size - (const Tethering__EventTerminate *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_terminate__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__event_terminate__pack - (const Tethering__EventTerminate *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_terminate__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__event_terminate__pack_to_buffer - (const Tethering__EventTerminate *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_terminate__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__EventTerminate * - tethering__event_terminate__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__EventTerminate *) - protobuf_c_message_unpack (&tethering__event_terminate__descriptor, - allocator, len, data); -} -void tethering__event_terminate__free_unpacked - (Tethering__EventTerminate *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_terminate__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__set_sensor_status__init - (Tethering__SetSensorStatus *message) -{ - static Tethering__SetSensorStatus init_value = TETHERING__SET_SENSOR_STATUS__INIT; - *message = init_value; -} -size_t tethering__set_sensor_status__get_packed_size - (const Tethering__SetSensorStatus *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_sensor_status__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__set_sensor_status__pack - (const Tethering__SetSensorStatus *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_sensor_status__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__set_sensor_status__pack_to_buffer - (const Tethering__SetSensorStatus *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_sensor_status__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__SetSensorStatus * - tethering__set_sensor_status__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__SetSensorStatus *) - protobuf_c_message_unpack (&tethering__set_sensor_status__descriptor, - allocator, len, data); -} -void tethering__set_sensor_status__free_unpacked - (Tethering__SetSensorStatus *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_sensor_status__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__sensor_data__init - (Tethering__SensorData *message) -{ - static Tethering__SensorData init_value = TETHERING__SENSOR_DATA__INIT; - *message = init_value; -} -size_t tethering__sensor_data__get_packed_size - (const Tethering__SensorData *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_data__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__sensor_data__pack - (const Tethering__SensorData *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_data__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__sensor_data__pack_to_buffer - (const Tethering__SensorData *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_data__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__SensorData * - tethering__sensor_data__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__SensorData *) - protobuf_c_message_unpack (&tethering__sensor_data__descriptor, - allocator, len, data); -} -void tethering__sensor_data__free_unpacked - (Tethering__SensorData *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_data__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__sensor_msg__init - (Tethering__SensorMsg *message) -{ - static Tethering__SensorMsg init_value = TETHERING__SENSOR_MSG__INIT; - *message = init_value; -} -size_t tethering__sensor_msg__get_packed_size - (const Tethering__SensorMsg *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_msg__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__sensor_msg__pack - (const Tethering__SensorMsg *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_msg__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__sensor_msg__pack_to_buffer - (const Tethering__SensorMsg *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_msg__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__SensorMsg * - tethering__sensor_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__SensorMsg *) - protobuf_c_message_unpack (&tethering__sensor_msg__descriptor, - allocator, len, data); -} -void tethering__sensor_msg__free_unpacked - (Tethering__SensorMsg *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_msg__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__resolution__init - (Tethering__Resolution *message) -{ - static Tethering__Resolution init_value = TETHERING__RESOLUTION__INIT; - *message = init_value; -} -size_t tethering__resolution__get_packed_size - (const Tethering__Resolution *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__resolution__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__resolution__pack - (const Tethering__Resolution *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__resolution__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__resolution__pack_to_buffer - (const Tethering__Resolution *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__resolution__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__Resolution * - tethering__resolution__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__Resolution *) - protobuf_c_message_unpack (&tethering__resolution__descriptor, - allocator, len, data); -} -void tethering__resolution__free_unpacked - (Tethering__Resolution *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__resolution__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__display_msg__init - (Tethering__DisplayMsg *message) -{ - static Tethering__DisplayMsg init_value = TETHERING__DISPLAY_MSG__INIT; - *message = init_value; -} -size_t tethering__display_msg__get_packed_size - (const Tethering__DisplayMsg *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__display_msg__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__display_msg__pack - (const Tethering__DisplayMsg *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__display_msg__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__display_msg__pack_to_buffer - (const Tethering__DisplayMsg *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__display_msg__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__DisplayMsg * - tethering__display_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__DisplayMsg *) - protobuf_c_message_unpack (&tethering__display_msg__descriptor, - allocator, len, data); -} -void tethering__display_msg__free_unpacked - (Tethering__DisplayMsg *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__display_msg__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__touch_max_count__init - (Tethering__TouchMaxCount *message) -{ - static Tethering__TouchMaxCount init_value = TETHERING__TOUCH_MAX_COUNT__INIT; - *message = init_value; -} -size_t tethering__touch_max_count__get_packed_size - (const Tethering__TouchMaxCount *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_max_count__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__touch_max_count__pack - (const Tethering__TouchMaxCount *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_max_count__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__touch_max_count__pack_to_buffer - (const Tethering__TouchMaxCount *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_max_count__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__TouchMaxCount * - tethering__touch_max_count__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__TouchMaxCount *) - protobuf_c_message_unpack (&tethering__touch_max_count__descriptor, - allocator, len, data); -} -void tethering__touch_max_count__free_unpacked - (Tethering__TouchMaxCount *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_max_count__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__touch_data__init - (Tethering__TouchData *message) -{ - static Tethering__TouchData init_value = TETHERING__TOUCH_DATA__INIT; - *message = init_value; -} -size_t tethering__touch_data__get_packed_size - (const Tethering__TouchData *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_data__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__touch_data__pack - (const Tethering__TouchData *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_data__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__touch_data__pack_to_buffer - (const Tethering__TouchData *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_data__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__TouchData * - tethering__touch_data__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__TouchData *) - protobuf_c_message_unpack (&tethering__touch_data__descriptor, - allocator, len, data); -} -void tethering__touch_data__free_unpacked - (Tethering__TouchData *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_data__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__hwkey_msg__init - (Tethering__HWKeyMsg *message) -{ - static Tethering__HWKeyMsg init_value = TETHERING__HWKEY_MSG__INIT; - *message = init_value; -} -size_t tethering__hwkey_msg__get_packed_size - (const Tethering__HWKeyMsg *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hwkey_msg__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__hwkey_msg__pack - (const Tethering__HWKeyMsg *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hwkey_msg__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__hwkey_msg__pack_to_buffer - (const Tethering__HWKeyMsg *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hwkey_msg__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__HWKeyMsg * - tethering__hwkey_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__HWKeyMsg *) - protobuf_c_message_unpack (&tethering__hwkey_msg__descriptor, - allocator, len, data); -} -void tethering__hwkey_msg__free_unpacked - (Tethering__HWKeyMsg *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hwkey_msg__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__touch_msg__init - (Tethering__TouchMsg *message) -{ - static Tethering__TouchMsg init_value = TETHERING__TOUCH_MSG__INIT; - *message = init_value; -} -size_t tethering__touch_msg__get_packed_size - (const Tethering__TouchMsg *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_msg__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__touch_msg__pack - (const Tethering__TouchMsg *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_msg__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__touch_msg__pack_to_buffer - (const Tethering__TouchMsg *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_msg__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__TouchMsg * - tethering__touch_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__TouchMsg *) - protobuf_c_message_unpack (&tethering__touch_msg__descriptor, - allocator, len, data); -} -void tethering__touch_msg__free_unpacked - (Tethering__TouchMsg *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_msg__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void tethering__tethering_msg__init - (Tethering__TetheringMsg *message) -{ - static Tethering__TetheringMsg init_value = TETHERING__TETHERING_MSG__INIT; - *message = init_value; -} -size_t tethering__tethering_msg__get_packed_size - (const Tethering__TetheringMsg *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__tethering_msg__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t tethering__tethering_msg__pack - (const Tethering__TetheringMsg *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__tethering_msg__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t tethering__tethering_msg__pack_to_buffer - (const Tethering__TetheringMsg *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__tethering_msg__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Tethering__TetheringMsg * - tethering__tethering_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Tethering__TetheringMsg *) - protobuf_c_message_unpack (&tethering__tethering_msg__descriptor, - allocator, len, data); -} -void tethering__tethering_msg__free_unpacked - (Tethering__TetheringMsg *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__tethering_msg__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -static const ProtobufCFieldDescriptor tethering__hand_shake_req__field_descriptors[1] = -{ - { - "key", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_INT32, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__HandShakeReq, key), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__hand_shake_req__field_indices_by_name[] = { - 0, /* field[0] = key */ -}; -static const ProtobufCIntRange tethering__hand_shake_req__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor tethering__hand_shake_req__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.HandShakeReq", - "HandShakeReq", - "Tethering__HandShakeReq", - "tethering", - sizeof(Tethering__HandShakeReq), - 1, - tethering__hand_shake_req__field_descriptors, - tethering__hand_shake_req__field_indices_by_name, - 1, tethering__hand_shake_req__number_ranges, - (ProtobufCMessageInit) tethering__hand_shake_req__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__hand_shake_ans__field_descriptors[1] = -{ - { - "result", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__HandShakeAns, result), - &tethering__message_result__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__hand_shake_ans__field_indices_by_name[] = { - 0, /* field[0] = result */ -}; -static const ProtobufCIntRange tethering__hand_shake_ans__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor tethering__hand_shake_ans__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.HandShakeAns", - "HandShakeAns", - "Tethering__HandShakeAns", - "tethering", - sizeof(Tethering__HandShakeAns), - 1, - tethering__hand_shake_ans__field_descriptors, - tethering__hand_shake_ans__field_indices_by_name, - 1, tethering__hand_shake_ans__number_ranges, - (ProtobufCMessageInit) tethering__hand_shake_ans__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__emulator_state__field_descriptors[1] = -{ - { - "state", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__EmulatorState, state), - &tethering__connection_state__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__emulator_state__field_indices_by_name[] = { - 0, /* field[0] = state */ -}; -static const ProtobufCIntRange tethering__emulator_state__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor tethering__emulator_state__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.EmulatorState", - "EmulatorState", - "Tethering__EmulatorState", - "tethering", - sizeof(Tethering__EmulatorState), - 1, - tethering__emulator_state__field_descriptors, - tethering__emulator_state__field_indices_by_name, - 1, tethering__emulator_state__number_ranges, - (ProtobufCMessageInit) tethering__emulator_state__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__app_state__field_descriptors[1] = -{ - { - "state", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__AppState, state), - &tethering__connection_state__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__app_state__field_indices_by_name[] = { - 0, /* field[0] = state */ -}; -static const ProtobufCIntRange tethering__app_state__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor tethering__app_state__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.AppState", - "AppState", - "Tethering__AppState", - "tethering", - sizeof(Tethering__AppState), - 1, - tethering__app_state__field_descriptors, - tethering__app_state__field_indices_by_name, - 1, tethering__app_state__number_ranges, - (ProtobufCMessageInit) tethering__app_state__init, - NULL,NULL,NULL /* reserved[123] */ -}; -#define tethering__start_req__field_descriptors NULL -#define tethering__start_req__field_indices_by_name NULL -#define tethering__start_req__number_ranges NULL -const ProtobufCMessageDescriptor tethering__start_req__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.StartReq", - "StartReq", - "Tethering__StartReq", - "tethering", - sizeof(Tethering__StartReq), - 0, - tethering__start_req__field_descriptors, - tethering__start_req__field_indices_by_name, - 0, tethering__start_req__number_ranges, - (ProtobufCMessageInit) tethering__start_req__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__start_ans__field_descriptors[1] = -{ - { - "result", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__StartAns, result), - &tethering__message_result__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__start_ans__field_indices_by_name[] = { - 0, /* field[0] = result */ -}; -static const ProtobufCIntRange tethering__start_ans__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor tethering__start_ans__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.StartAns", - "StartAns", - "Tethering__StartAns", - "tethering", - sizeof(Tethering__StartAns), - 1, - tethering__start_ans__field_descriptors, - tethering__start_ans__field_indices_by_name, - 1, tethering__start_ans__number_ranges, - (ProtobufCMessageInit) tethering__start_ans__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__set_event_status__field_descriptors[2] = -{ - { - "type", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__SetEventStatus, type), - &tethering__event_type__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "state", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__SetEventStatus, state), - &tethering__state__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__set_event_status__field_indices_by_name[] = { - 1, /* field[1] = state */ - 0, /* field[0] = type */ -}; -static const ProtobufCIntRange tethering__set_event_status__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor tethering__set_event_status__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.SetEventStatus", - "SetEventStatus", - "Tethering__SetEventStatus", - "tethering", - sizeof(Tethering__SetEventStatus), - 2, - tethering__set_event_status__field_descriptors, - tethering__set_event_status__field_indices_by_name, - 1, tethering__set_event_status__number_ranges, - (ProtobufCMessageInit) tethering__set_event_status__init, - NULL,NULL,NULL /* reserved[123] */ -}; -const ProtobufCEnumValue tethering__event_msg__type__enum_values_by_number[4] = -{ - { "START_REQ", "TETHERING__EVENT_MSG__TYPE__START_REQ", 2 }, - { "START_ANS", "TETHERING__EVENT_MSG__TYPE__START_ANS", 3 }, - { "TERMINATE", "TETHERING__EVENT_MSG__TYPE__TERMINATE", 4 }, - { "EVENT_STATUS", "TETHERING__EVENT_MSG__TYPE__EVENT_STATUS", 5 }, -}; -static const ProtobufCIntRange tethering__event_msg__type__value_ranges[] = { -{2, 0},{0, 4} -}; -const ProtobufCEnumValueIndex tethering__event_msg__type__enum_values_by_name[4] = -{ - { "EVENT_STATUS", 3 }, - { "START_ANS", 1 }, - { "START_REQ", 0 }, - { "TERMINATE", 2 }, -}; -const ProtobufCEnumDescriptor tethering__event_msg__type__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.EventMsg.TYPE", - "TYPE", - "Tethering__EventMsg__TYPE", - "tethering", - 4, - tethering__event_msg__type__enum_values_by_number, - 4, - tethering__event_msg__type__enum_values_by_name, - 1, - tethering__event_msg__type__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -static const ProtobufCFieldDescriptor tethering__event_msg__field_descriptors[5] = -{ - { - "type", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__EventMsg, type), - &tethering__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(Tethering__EventMsg, startreq), - &tethering__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(Tethering__EventMsg, startans), - &tethering__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(Tethering__EventMsg, terminate), - &tethering__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(Tethering__EventMsg, setstatus), - &tethering__set_event_status__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__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 tethering__event_msg__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 5 } -}; -const ProtobufCMessageDescriptor tethering__event_msg__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.EventMsg", - "EventMsg", - "Tethering__EventMsg", - "tethering", - sizeof(Tethering__EventMsg), - 5, - tethering__event_msg__field_descriptors, - tethering__event_msg__field_indices_by_name, - 1, tethering__event_msg__number_ranges, - (ProtobufCMessageInit) tethering__event_msg__init, - NULL,NULL,NULL /* reserved[123] */ -}; -#define tethering__event_terminate__field_descriptors NULL -#define tethering__event_terminate__field_indices_by_name NULL -#define tethering__event_terminate__number_ranges NULL -const ProtobufCMessageDescriptor tethering__event_terminate__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.EventTerminate", - "EventTerminate", - "Tethering__EventTerminate", - "tethering", - sizeof(Tethering__EventTerminate), - 0, - tethering__event_terminate__field_descriptors, - tethering__event_terminate__field_indices_by_name, - 0, tethering__event_terminate__number_ranges, - (ProtobufCMessageInit) tethering__event_terminate__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__set_sensor_status__field_descriptors[2] = -{ - { - "type", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__SetSensorStatus, type), - &tethering__sensor_type__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "state", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__SetSensorStatus, state), - &tethering__state__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__set_sensor_status__field_indices_by_name[] = { - 1, /* field[1] = state */ - 0, /* field[0] = type */ -}; -static const ProtobufCIntRange tethering__set_sensor_status__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor tethering__set_sensor_status__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.SetSensorStatus", - "SetSensorStatus", - "Tethering__SetSensorStatus", - "tethering", - sizeof(Tethering__SetSensorStatus), - 2, - tethering__set_sensor_status__field_descriptors, - tethering__set_sensor_status__field_indices_by_name, - 1, tethering__set_sensor_status__number_ranges, - (ProtobufCMessageInit) tethering__set_sensor_status__init, - NULL,NULL,NULL /* reserved[123] */ -}; -char tethering__sensor_data__x__default_value[] = "0"; -char tethering__sensor_data__y__default_value[] = "0"; -char tethering__sensor_data__z__default_value[] = "0"; -static const ProtobufCFieldDescriptor tethering__sensor_data__field_descriptors[4] = -{ - { - "sensor", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__SensorData, sensor), - &tethering__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(Tethering__SensorData, x), - NULL, - &tethering__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(Tethering__SensorData, y), - NULL, - &tethering__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(Tethering__SensorData, z), - NULL, - &tethering__sensor_data__z__default_value, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__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 tethering__sensor_data__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 4 } -}; -const ProtobufCMessageDescriptor tethering__sensor_data__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.SensorData", - "SensorData", - "Tethering__SensorData", - "tethering", - sizeof(Tethering__SensorData), - 4, - tethering__sensor_data__field_descriptors, - tethering__sensor_data__field_indices_by_name, - 1, tethering__sensor_data__number_ranges, - (ProtobufCMessageInit) tethering__sensor_data__init, - NULL,NULL,NULL /* reserved[123] */ -}; -const ProtobufCEnumValue tethering__sensor_msg__type__enum_values_by_number[5] = -{ - { "START_REQ", "TETHERING__SENSOR_MSG__TYPE__START_REQ", 2 }, - { "START_ANS", "TETHERING__SENSOR_MSG__TYPE__START_ANS", 3 }, - { "TERMINATE", "TETHERING__SENSOR_MSG__TYPE__TERMINATE", 4 }, - { "SENSOR_STATUS", "TETHERING__SENSOR_MSG__TYPE__SENSOR_STATUS", 5 }, - { "SENSOR_DATA", "TETHERING__SENSOR_MSG__TYPE__SENSOR_DATA", 6 }, -}; -static const ProtobufCIntRange tethering__sensor_msg__type__value_ranges[] = { -{2, 0},{0, 5} -}; -const ProtobufCEnumValueIndex tethering__sensor_msg__type__enum_values_by_name[5] = -{ - { "SENSOR_DATA", 4 }, - { "SENSOR_STATUS", 3 }, - { "START_ANS", 1 }, - { "START_REQ", 0 }, - { "TERMINATE", 2 }, -}; -const ProtobufCEnumDescriptor tethering__sensor_msg__type__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.SensorMsg.Type", - "Type", - "Tethering__SensorMsg__Type", - "tethering", - 5, - tethering__sensor_msg__type__enum_values_by_number, - 5, - tethering__sensor_msg__type__enum_values_by_name, - 1, - tethering__sensor_msg__type__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -static const ProtobufCFieldDescriptor tethering__sensor_msg__field_descriptors[6] = -{ - { - "type", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__SensorMsg, type), - &tethering__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(Tethering__SensorMsg, startreq), - &tethering__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(Tethering__SensorMsg, startans), - &tethering__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(Tethering__SensorMsg, terminate), - &tethering__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(Tethering__SensorMsg, setstatus), - &tethering__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(Tethering__SensorMsg, data), - &tethering__sensor_data__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__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 tethering__sensor_msg__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 6 } -}; -const ProtobufCMessageDescriptor tethering__sensor_msg__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.SensorMsg", - "SensorMsg", - "Tethering__SensorMsg", - "tethering", - sizeof(Tethering__SensorMsg), - 6, - tethering__sensor_msg__field_descriptors, - tethering__sensor_msg__field_indices_by_name, - 1, tethering__sensor_msg__number_ranges, - (ProtobufCMessageInit) tethering__sensor_msg__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__resolution__field_descriptors[2] = -{ - { - "width", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_INT32, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__Resolution, width), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "height", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_INT32, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__Resolution, height), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__resolution__field_indices_by_name[] = { - 1, /* field[1] = height */ - 0, /* field[0] = width */ -}; -static const ProtobufCIntRange tethering__resolution__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor tethering__resolution__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.Resolution", - "Resolution", - "Tethering__Resolution", - "tethering", - sizeof(Tethering__Resolution), - 2, - tethering__resolution__field_descriptors, - tethering__resolution__field_indices_by_name, - 1, tethering__resolution__number_ranges, - (ProtobufCMessageInit) tethering__resolution__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__display_msg__field_descriptors[2] = -{ - { - "frameRate", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_INT32, - PROTOBUF_C_OFFSETOF(Tethering__DisplayMsg, has_framerate), - PROTOBUF_C_OFFSETOF(Tethering__DisplayMsg, framerate), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "imageData", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_BYTES, - PROTOBUF_C_OFFSETOF(Tethering__DisplayMsg, has_imagedata), - PROTOBUF_C_OFFSETOF(Tethering__DisplayMsg, imagedata), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__display_msg__field_indices_by_name[] = { - 0, /* field[0] = frameRate */ - 1, /* field[1] = imageData */ -}; -static const ProtobufCIntRange tethering__display_msg__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor tethering__display_msg__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.DisplayMsg", - "DisplayMsg", - "Tethering__DisplayMsg", - "tethering", - sizeof(Tethering__DisplayMsg), - 2, - tethering__display_msg__field_descriptors, - tethering__display_msg__field_indices_by_name, - 1, tethering__display_msg__number_ranges, - (ProtobufCMessageInit) tethering__display_msg__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const int32_t tethering__touch_max_count__max__default_value = 10; -static const ProtobufCFieldDescriptor tethering__touch_max_count__field_descriptors[1] = -{ - { - "max", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_INT32, - PROTOBUF_C_OFFSETOF(Tethering__TouchMaxCount, has_max), - PROTOBUF_C_OFFSETOF(Tethering__TouchMaxCount, max), - NULL, - &tethering__touch_max_count__max__default_value, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__touch_max_count__field_indices_by_name[] = { - 0, /* field[0] = max */ -}; -static const ProtobufCIntRange tethering__touch_max_count__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor tethering__touch_max_count__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.TouchMaxCount", - "TouchMaxCount", - "Tethering__TouchMaxCount", - "tethering", - sizeof(Tethering__TouchMaxCount), - 1, - tethering__touch_max_count__field_descriptors, - tethering__touch_max_count__field_indices_by_name, - 1, tethering__touch_max_count__number_ranges, - (ProtobufCMessageInit) tethering__touch_max_count__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const int32_t tethering__touch_data__index__default_value = 0; -static const float tethering__touch_data__x_point__default_value = 0; -static const float tethering__touch_data__y_point__default_value = 0; -static const ProtobufCFieldDescriptor tethering__touch_data__field_descriptors[4] = -{ - { - "index", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_INT32, - PROTOBUF_C_OFFSETOF(Tethering__TouchData, has_index), - PROTOBUF_C_OFFSETOF(Tethering__TouchData, index), - NULL, - &tethering__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(Tethering__TouchData, has_xpoint), - PROTOBUF_C_OFFSETOF(Tethering__TouchData, xpoint), - NULL, - &tethering__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(Tethering__TouchData, has_ypoint), - PROTOBUF_C_OFFSETOF(Tethering__TouchData, ypoint), - NULL, - &tethering__touch_data__y_point__default_value, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "state", - 4, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_ENUM, - PROTOBUF_C_OFFSETOF(Tethering__TouchData, has_state), - PROTOBUF_C_OFFSETOF(Tethering__TouchData, state), - &tethering__touch_state__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__touch_data__field_indices_by_name[] = { - 0, /* field[0] = index */ - 3, /* field[3] = state */ - 1, /* field[1] = xPoint */ - 2, /* field[2] = yPoint */ -}; -static const ProtobufCIntRange tethering__touch_data__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 4 } -}; -const ProtobufCMessageDescriptor tethering__touch_data__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.TouchData", - "TouchData", - "Tethering__TouchData", - "tethering", - sizeof(Tethering__TouchData), - 4, - tethering__touch_data__field_descriptors, - tethering__touch_data__field_indices_by_name, - 1, tethering__touch_data__number_ranges, - (ProtobufCMessageInit) tethering__touch_data__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor tethering__hwkey_msg__field_descriptors[1] = -{ - { - "type", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__HWKeyMsg, type), - &tethering__hwkey_type__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__hwkey_msg__field_indices_by_name[] = { - 0, /* field[0] = type */ -}; -static const ProtobufCIntRange tethering__hwkey_msg__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor tethering__hwkey_msg__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.HWKeyMsg", - "HWKeyMsg", - "Tethering__HWKeyMsg", - "tethering", - sizeof(Tethering__HWKeyMsg), - 1, - tethering__hwkey_msg__field_descriptors, - tethering__hwkey_msg__field_indices_by_name, - 1, tethering__hwkey_msg__number_ranges, - (ProtobufCMessageInit) tethering__hwkey_msg__init, - NULL,NULL,NULL /* reserved[123] */ -}; -const ProtobufCEnumValue tethering__touch_msg__type__enum_values_by_number[8] = -{ - { "START_REQ", "TETHERING__TOUCH_MSG__TYPE__START_REQ", 2 }, - { "START_ANS", "TETHERING__TOUCH_MSG__TYPE__START_ANS", 3 }, - { "TERMINATE", "TETHERING__TOUCH_MSG__TYPE__TERMINATE", 4 }, - { "MAX_COUNT", "TETHERING__TOUCH_MSG__TYPE__MAX_COUNT", 5 }, - { "TOUCH_DATA", "TETHERING__TOUCH_MSG__TYPE__TOUCH_DATA", 6 }, - { "RESOLUTION", "TETHERING__TOUCH_MSG__TYPE__RESOLUTION", 7 }, - { "DISPLAY_MSG", "TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG", 8 }, - { "HWKEY_MSG", "TETHERING__TOUCH_MSG__TYPE__HWKEY_MSG", 9 }, -}; -static const ProtobufCIntRange tethering__touch_msg__type__value_ranges[] = { -{2, 0},{0, 8} -}; -const ProtobufCEnumValueIndex tethering__touch_msg__type__enum_values_by_name[8] = -{ - { "DISPLAY_MSG", 6 }, - { "HWKEY_MSG", 7 }, - { "MAX_COUNT", 3 }, - { "RESOLUTION", 5 }, - { "START_ANS", 1 }, - { "START_REQ", 0 }, - { "TERMINATE", 2 }, - { "TOUCH_DATA", 4 }, -}; -const ProtobufCEnumDescriptor tethering__touch_msg__type__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.TouchMsg.Type", - "Type", - "Tethering__TouchMsg__Type", - "tethering", - 8, - tethering__touch_msg__type__enum_values_by_number, - 8, - tethering__touch_msg__type__enum_values_by_name, - 1, - tethering__touch_msg__type__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -static const ProtobufCFieldDescriptor tethering__touch_msg__field_descriptors[9] = -{ - { - "type", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, type), - &tethering__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(Tethering__TouchMsg, startreq), - &tethering__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(Tethering__TouchMsg, startans), - &tethering__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(Tethering__TouchMsg, terminate), - &tethering__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(Tethering__TouchMsg, maxcount), - &tethering__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(Tethering__TouchMsg, touchdata), - &tethering__touch_data__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "resolution", - 7, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, resolution), - &tethering__resolution__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "display", - 8, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, display), - &tethering__display_msg__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "hwkey", - 9, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, hwkey), - &tethering__hwkey_msg__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__touch_msg__field_indices_by_name[] = { - 7, /* field[7] = display */ - 8, /* field[8] = hwkey */ - 4, /* field[4] = maxCount */ - 6, /* field[6] = resolution */ - 2, /* field[2] = startAns */ - 1, /* field[1] = startReq */ - 3, /* field[3] = terminate */ - 5, /* field[5] = touchData */ - 0, /* field[0] = type */ -}; -static const ProtobufCIntRange tethering__touch_msg__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 9 } -}; -const ProtobufCMessageDescriptor tethering__touch_msg__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.TouchMsg", - "TouchMsg", - "Tethering__TouchMsg", - "tethering", - sizeof(Tethering__TouchMsg), - 9, - tethering__touch_msg__field_descriptors, - tethering__touch_msg__field_indices_by_name, - 1, tethering__touch_msg__number_ranges, - (ProtobufCMessageInit) tethering__touch_msg__init, - NULL,NULL,NULL /* reserved[123] */ -}; -const ProtobufCEnumValue tethering__tethering_msg__type__enum_values_by_number[7] = -{ - { "HANDSHAKE_REQ", "TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_REQ", 2 }, - { "HANDSHAKE_ANS", "TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_ANS", 3 }, - { "EMUL_STATE", "TETHERING__TETHERING_MSG__TYPE__EMUL_STATE", 4 }, - { "APP_STATE", "TETHERING__TETHERING_MSG__TYPE__APP_STATE", 5 }, - { "EVENT_MSG", "TETHERING__TETHERING_MSG__TYPE__EVENT_MSG", 6 }, - { "SENSOR_MSG", "TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG", 7 }, - { "TOUCH_MSG", "TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG", 8 }, -}; -static const ProtobufCIntRange tethering__tethering_msg__type__value_ranges[] = { -{2, 0},{0, 7} -}; -const ProtobufCEnumValueIndex tethering__tethering_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 tethering__tethering_msg__type__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.TetheringMsg.Type", - "Type", - "Tethering__TetheringMsg__Type", - "tethering", - 7, - tethering__tethering_msg__type__enum_values_by_number, - 7, - tethering__tethering_msg__type__enum_values_by_name, - 1, - tethering__tethering_msg__type__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -static const ProtobufCFieldDescriptor tethering__tethering_msg__field_descriptors[8] = -{ - { - "type", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, type), - &tethering__tethering_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(Tethering__TetheringMsg, handshakereq), - &tethering__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(Tethering__TetheringMsg, handshakeans), - &tethering__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(Tethering__TetheringMsg, emulstate), - &tethering__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(Tethering__TetheringMsg, appstate), - &tethering__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(Tethering__TetheringMsg, eventmsg), - &tethering__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(Tethering__TetheringMsg, sensormsg), - &tethering__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(Tethering__TetheringMsg, touchmsg), - &tethering__touch_msg__descriptor, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned tethering__tethering_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 tethering__tethering_msg__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 8 } -}; -const ProtobufCMessageDescriptor tethering__tethering_msg__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "tethering.TetheringMsg", - "TetheringMsg", - "Tethering__TetheringMsg", - "tethering", - sizeof(Tethering__TetheringMsg), - 8, - tethering__tethering_msg__field_descriptors, - tethering__tethering_msg__field_indices_by_name, - 1, tethering__tethering_msg__number_ranges, - (ProtobufCMessageInit) tethering__tethering_msg__init, - NULL,NULL,NULL /* reserved[123] */ -}; -const ProtobufCEnumValue tethering__message_result__enum_values_by_number[3] = -{ - { "SUCCESS", "TETHERING__MESSAGE_RESULT__SUCCESS", 1 }, - { "FAILURE", "TETHERING__MESSAGE_RESULT__FAILURE", 2 }, - { "CANCEL", "TETHERING__MESSAGE_RESULT__CANCEL", 3 }, -}; -static const ProtobufCIntRange tethering__message_result__value_ranges[] = { -{1, 0},{0, 3} -}; -const ProtobufCEnumValueIndex tethering__message_result__enum_values_by_name[3] = -{ - { "CANCEL", 2 }, - { "FAILURE", 1 }, - { "SUCCESS", 0 }, -}; -const ProtobufCEnumDescriptor tethering__message_result__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.MessageResult", - "MessageResult", - "Tethering__MessageResult", - "tethering", - 3, - tethering__message_result__enum_values_by_number, - 3, - tethering__message_result__enum_values_by_name, - 1, - tethering__message_result__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -const ProtobufCEnumValue tethering__connection_state__enum_values_by_number[3] = -{ - { "CONNECTED", "TETHERING__CONNECTION_STATE__CONNECTED", 1 }, - { "DISCONNECTED", "TETHERING__CONNECTION_STATE__DISCONNECTED", 2 }, - { "TERMINATED", "TETHERING__CONNECTION_STATE__TERMINATED", 3 }, -}; -static const ProtobufCIntRange tethering__connection_state__value_ranges[] = { -{1, 0},{0, 3} -}; -const ProtobufCEnumValueIndex tethering__connection_state__enum_values_by_name[3] = -{ - { "CONNECTED", 0 }, - { "DISCONNECTED", 1 }, - { "TERMINATED", 2 }, -}; -const ProtobufCEnumDescriptor tethering__connection_state__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.ConnectionState", - "ConnectionState", - "Tethering__ConnectionState", - "tethering", - 3, - tethering__connection_state__enum_values_by_number, - 3, - tethering__connection_state__enum_values_by_name, - 1, - tethering__connection_state__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -const ProtobufCEnumValue tethering__event_type__enum_values_by_number[2] = -{ - { "SENSOR", "TETHERING__EVENT_TYPE__SENSOR", 1 }, - { "TOUCH", "TETHERING__EVENT_TYPE__TOUCH", 2 }, -}; -static const ProtobufCIntRange tethering__event_type__value_ranges[] = { -{1, 0},{0, 2} -}; -const ProtobufCEnumValueIndex tethering__event_type__enum_values_by_name[2] = -{ - { "SENSOR", 0 }, - { "TOUCH", 1 }, -}; -const ProtobufCEnumDescriptor tethering__event_type__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.EventType", - "EventType", - "Tethering__EventType", - "tethering", - 2, - tethering__event_type__enum_values_by_number, - 2, - tethering__event_type__enum_values_by_name, - 1, - tethering__event_type__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -const ProtobufCEnumValue tethering__state__enum_values_by_number[2] = -{ - { "ENABLED", "TETHERING__STATE__ENABLED", 1 }, - { "DISABLED", "TETHERING__STATE__DISABLED", 2 }, -}; -static const ProtobufCIntRange tethering__state__value_ranges[] = { -{1, 0},{0, 2} -}; -const ProtobufCEnumValueIndex tethering__state__enum_values_by_name[2] = -{ - { "DISABLED", 1 }, - { "ENABLED", 0 }, -}; -const ProtobufCEnumDescriptor tethering__state__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.State", - "State", - "Tethering__State", - "tethering", - 2, - tethering__state__enum_values_by_number, - 2, - tethering__state__enum_values_by_name, - 1, - tethering__state__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -const ProtobufCEnumValue tethering__sensor_type__enum_values_by_number[5] = -{ - { "ACCEL", "TETHERING__SENSOR_TYPE__ACCEL", 1 }, - { "MAGNETIC", "TETHERING__SENSOR_TYPE__MAGNETIC", 2 }, - { "GYROSCOPE", "TETHERING__SENSOR_TYPE__GYROSCOPE", 3 }, - { "PROXIMITY", "TETHERING__SENSOR_TYPE__PROXIMITY", 4 }, - { "LIGHT", "TETHERING__SENSOR_TYPE__LIGHT", 5 }, -}; -static const ProtobufCIntRange tethering__sensor_type__value_ranges[] = { -{1, 0},{0, 5} -}; -const ProtobufCEnumValueIndex tethering__sensor_type__enum_values_by_name[5] = -{ - { "ACCEL", 0 }, - { "GYROSCOPE", 2 }, - { "LIGHT", 4 }, - { "MAGNETIC", 1 }, - { "PROXIMITY", 3 }, -}; -const ProtobufCEnumDescriptor tethering__sensor_type__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.SensorType", - "SensorType", - "Tethering__SensorType", - "tethering", - 5, - tethering__sensor_type__enum_values_by_number, - 5, - tethering__sensor_type__enum_values_by_name, - 1, - tethering__sensor_type__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -const ProtobufCEnumValue tethering__touch_state__enum_values_by_number[2] = -{ - { "PRESSED", "TETHERING__TOUCH_STATE__PRESSED", 1 }, - { "RELEASED", "TETHERING__TOUCH_STATE__RELEASED", 2 }, -}; -static const ProtobufCIntRange tethering__touch_state__value_ranges[] = { -{1, 0},{0, 2} -}; -const ProtobufCEnumValueIndex tethering__touch_state__enum_values_by_name[2] = -{ - { "PRESSED", 0 }, - { "RELEASED", 1 }, -}; -const ProtobufCEnumDescriptor tethering__touch_state__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.TouchState", - "TouchState", - "Tethering__TouchState", - "tethering", - 2, - tethering__touch_state__enum_values_by_number, - 2, - tethering__touch_state__enum_values_by_name, - 1, - tethering__touch_state__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -const ProtobufCEnumValue tethering__hwkey_type__enum_values_by_number[6] = -{ - { "MENU", "TETHERING__HWKEY_TYPE__MENU", 1 }, - { "HOME", "TETHERING__HWKEY_TYPE__HOME", 2 }, - { "BACK", "TETHERING__HWKEY_TYPE__BACK", 3 }, - { "POWER", "TETHERING__HWKEY_TYPE__POWER", 4 }, - { "VOLUME_UP", "TETHERING__HWKEY_TYPE__VOLUME_UP", 5 }, - { "VOLUME_DOWN", "TETHERING__HWKEY_TYPE__VOLUME_DOWN", 6 }, -}; -static const ProtobufCIntRange tethering__hwkey_type__value_ranges[] = { -{1, 0},{0, 6} -}; -const ProtobufCEnumValueIndex tethering__hwkey_type__enum_values_by_name[6] = -{ - { "BACK", 2 }, - { "HOME", 1 }, - { "MENU", 0 }, - { "POWER", 3 }, - { "VOLUME_DOWN", 5 }, - { "VOLUME_UP", 4 }, -}; -const ProtobufCEnumDescriptor tethering__hwkey_type__descriptor = -{ - PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, - "tethering.HWKeyType", - "HWKeyType", - "Tethering__HWKeyType", - "tethering", - 6, - tethering__hwkey_type__enum_values_by_number, - 6, - tethering__hwkey_type__enum_values_by_name, - 1, - tethering__hwkey_type__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; diff --git a/tizen/src/tethering/genmsg/tethering.pb-c.h b/tizen/src/tethering/genmsg/tethering.pb-c.h deleted file mode 100644 index c2049b36bf..0000000000 --- a/tizen/src/tethering/genmsg/tethering.pb-c.h +++ /dev/null @@ -1,798 +0,0 @@ -/* 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 _Tethering__HandShakeReq Tethering__HandShakeReq; -typedef struct _Tethering__HandShakeAns Tethering__HandShakeAns; -typedef struct _Tethering__EmulatorState Tethering__EmulatorState; -typedef struct _Tethering__AppState Tethering__AppState; -typedef struct _Tethering__StartReq Tethering__StartReq; -typedef struct _Tethering__StartAns Tethering__StartAns; -typedef struct _Tethering__SetEventStatus Tethering__SetEventStatus; -typedef struct _Tethering__EventMsg Tethering__EventMsg; -typedef struct _Tethering__EventTerminate Tethering__EventTerminate; -typedef struct _Tethering__SetSensorStatus Tethering__SetSensorStatus; -typedef struct _Tethering__SensorData Tethering__SensorData; -typedef struct _Tethering__SensorMsg Tethering__SensorMsg; -typedef struct _Tethering__Resolution Tethering__Resolution; -typedef struct _Tethering__DisplayMsg Tethering__DisplayMsg; -typedef struct _Tethering__TouchMaxCount Tethering__TouchMaxCount; -typedef struct _Tethering__TouchData Tethering__TouchData; -typedef struct _Tethering__HWKeyMsg Tethering__HWKeyMsg; -typedef struct _Tethering__TouchMsg Tethering__TouchMsg; -typedef struct _Tethering__TetheringMsg Tethering__TetheringMsg; - - -/* --- enums --- */ - -typedef enum _Tethering__EventMsg__TYPE { - TETHERING__EVENT_MSG__TYPE__START_REQ = 2, - TETHERING__EVENT_MSG__TYPE__START_ANS = 3, - TETHERING__EVENT_MSG__TYPE__TERMINATE = 4, - TETHERING__EVENT_MSG__TYPE__EVENT_STATUS = 5 -} Tethering__EventMsg__TYPE; -typedef enum _Tethering__SensorMsg__Type { - TETHERING__SENSOR_MSG__TYPE__START_REQ = 2, - TETHERING__SENSOR_MSG__TYPE__START_ANS = 3, - TETHERING__SENSOR_MSG__TYPE__TERMINATE = 4, - TETHERING__SENSOR_MSG__TYPE__SENSOR_STATUS = 5, - TETHERING__SENSOR_MSG__TYPE__SENSOR_DATA = 6 -} Tethering__SensorMsg__Type; -typedef enum _Tethering__TouchMsg__Type { - TETHERING__TOUCH_MSG__TYPE__START_REQ = 2, - TETHERING__TOUCH_MSG__TYPE__START_ANS = 3, - TETHERING__TOUCH_MSG__TYPE__TERMINATE = 4, - TETHERING__TOUCH_MSG__TYPE__MAX_COUNT = 5, - TETHERING__TOUCH_MSG__TYPE__TOUCH_DATA = 6, - TETHERING__TOUCH_MSG__TYPE__RESOLUTION = 7, - TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG = 8, - TETHERING__TOUCH_MSG__TYPE__HWKEY_MSG = 9 -} Tethering__TouchMsg__Type; -typedef enum _Tethering__TetheringMsg__Type { - TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_REQ = 2, - TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_ANS = 3, - TETHERING__TETHERING_MSG__TYPE__EMUL_STATE = 4, - TETHERING__TETHERING_MSG__TYPE__APP_STATE = 5, - TETHERING__TETHERING_MSG__TYPE__EVENT_MSG = 6, - TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG = 7, - TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG = 8 -} Tethering__TetheringMsg__Type; -typedef enum _Tethering__MessageResult { - TETHERING__MESSAGE_RESULT__SUCCESS = 1, - TETHERING__MESSAGE_RESULT__FAILURE = 2, - TETHERING__MESSAGE_RESULT__CANCEL = 3 -} Tethering__MessageResult; -typedef enum _Tethering__ConnectionState { - TETHERING__CONNECTION_STATE__CONNECTED = 1, - TETHERING__CONNECTION_STATE__DISCONNECTED = 2, - TETHERING__CONNECTION_STATE__TERMINATED = 3 -} Tethering__ConnectionState; -typedef enum _Tethering__EventType { - TETHERING__EVENT_TYPE__SENSOR = 1, - TETHERING__EVENT_TYPE__TOUCH = 2 -} Tethering__EventType; -typedef enum _Tethering__State { - TETHERING__STATE__ENABLED = 1, - TETHERING__STATE__DISABLED = 2 -} Tethering__State; -typedef enum _Tethering__SensorType { - TETHERING__SENSOR_TYPE__ACCEL = 1, - TETHERING__SENSOR_TYPE__MAGNETIC = 2, - TETHERING__SENSOR_TYPE__GYROSCOPE = 3, - TETHERING__SENSOR_TYPE__PROXIMITY = 4, - TETHERING__SENSOR_TYPE__LIGHT = 5 -} Tethering__SensorType; -typedef enum _Tethering__TouchState { - TETHERING__TOUCH_STATE__PRESSED = 1, - TETHERING__TOUCH_STATE__RELEASED = 2 -} Tethering__TouchState; -typedef enum _Tethering__HWKeyType { - TETHERING__HWKEY_TYPE__MENU = 1, - TETHERING__HWKEY_TYPE__HOME = 2, - TETHERING__HWKEY_TYPE__BACK = 3, - TETHERING__HWKEY_TYPE__POWER = 4, - TETHERING__HWKEY_TYPE__VOLUME_UP = 5, - TETHERING__HWKEY_TYPE__VOLUME_DOWN = 6 -} Tethering__HWKeyType; - -/* --- messages --- */ - -struct _Tethering__HandShakeReq -{ - ProtobufCMessage base; - int32_t key; -}; -#define TETHERING__HAND_SHAKE_REQ__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__hand_shake_req__descriptor) \ - , 0 } - - -struct _Tethering__HandShakeAns -{ - ProtobufCMessage base; - Tethering__MessageResult result; -}; -#define TETHERING__HAND_SHAKE_ANS__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__hand_shake_ans__descriptor) \ - , 0 } - - -struct _Tethering__EmulatorState -{ - ProtobufCMessage base; - Tethering__ConnectionState state; -}; -#define TETHERING__EMULATOR_STATE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__emulator_state__descriptor) \ - , 0 } - - -struct _Tethering__AppState -{ - ProtobufCMessage base; - Tethering__ConnectionState state; -}; -#define TETHERING__APP_STATE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__app_state__descriptor) \ - , 0 } - - -struct _Tethering__StartReq -{ - ProtobufCMessage base; -}; -#define TETHERING__START_REQ__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__start_req__descriptor) \ - } - - -struct _Tethering__StartAns -{ - ProtobufCMessage base; - Tethering__MessageResult result; -}; -#define TETHERING__START_ANS__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__start_ans__descriptor) \ - , 0 } - - -struct _Tethering__SetEventStatus -{ - ProtobufCMessage base; - Tethering__EventType type; - Tethering__State state; -}; -#define TETHERING__SET_EVENT_STATUS__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__set_event_status__descriptor) \ - , 0, 0 } - - -struct _Tethering__EventMsg -{ - ProtobufCMessage base; - Tethering__EventMsg__TYPE type; - Tethering__StartReq *startreq; - Tethering__StartAns *startans; - Tethering__EventTerminate *terminate; - Tethering__SetEventStatus *setstatus; -}; -#define TETHERING__EVENT_MSG__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__event_msg__descriptor) \ - , 0, NULL, NULL, NULL, NULL } - - -struct _Tethering__EventTerminate -{ - ProtobufCMessage base; -}; -#define TETHERING__EVENT_TERMINATE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__event_terminate__descriptor) \ - } - - -struct _Tethering__SetSensorStatus -{ - ProtobufCMessage base; - Tethering__SensorType type; - Tethering__State state; -}; -#define TETHERING__SET_SENSOR_STATUS__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__set_sensor_status__descriptor) \ - , 0, 0 } - - -struct _Tethering__SensorData -{ - ProtobufCMessage base; - Tethering__SensorType sensor; - char *x; - char *y; - char *z; -}; -extern char tethering__sensor_data__x__default_value[]; -extern char tethering__sensor_data__y__default_value[]; -extern char tethering__sensor_data__z__default_value[]; -#define TETHERING__SENSOR_DATA__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__sensor_data__descriptor) \ - , 0, tethering__sensor_data__x__default_value, tethering__sensor_data__y__default_value, tethering__sensor_data__z__default_value } - - -struct _Tethering__SensorMsg -{ - ProtobufCMessage base; - Tethering__SensorMsg__Type type; - Tethering__StartReq *startreq; - Tethering__StartAns *startans; - Tethering__EventTerminate *terminate; - Tethering__SetSensorStatus *setstatus; - Tethering__SensorData *data; -}; -#define TETHERING__SENSOR_MSG__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__sensor_msg__descriptor) \ - , 0, NULL, NULL, NULL, NULL, NULL } - - -struct _Tethering__Resolution -{ - ProtobufCMessage base; - int32_t width; - int32_t height; -}; -#define TETHERING__RESOLUTION__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__resolution__descriptor) \ - , 0, 0 } - - -struct _Tethering__DisplayMsg -{ - ProtobufCMessage base; - protobuf_c_boolean has_framerate; - int32_t framerate; - protobuf_c_boolean has_imagedata; - ProtobufCBinaryData imagedata; -}; -#define TETHERING__DISPLAY_MSG__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__display_msg__descriptor) \ - , 0,0, 0,{0,NULL} } - - -struct _Tethering__TouchMaxCount -{ - ProtobufCMessage base; - protobuf_c_boolean has_max; - int32_t max; -}; -#define TETHERING__TOUCH_MAX_COUNT__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__touch_max_count__descriptor) \ - , 0,10 } - - -struct _Tethering__TouchData -{ - 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_state; - Tethering__TouchState state; -}; -#define TETHERING__TOUCH_DATA__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__touch_data__descriptor) \ - , 0,0, 0,0, 0,0, 0,0 } - - -struct _Tethering__HWKeyMsg -{ - ProtobufCMessage base; - Tethering__HWKeyType type; -}; -#define TETHERING__HWKEY_MSG__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__hwkey_msg__descriptor) \ - , 0 } - - -struct _Tethering__TouchMsg -{ - ProtobufCMessage base; - Tethering__TouchMsg__Type type; - Tethering__StartReq *startreq; - Tethering__StartAns *startans; - Tethering__EventTerminate *terminate; - Tethering__TouchMaxCount *maxcount; - Tethering__TouchData *touchdata; - Tethering__Resolution *resolution; - Tethering__DisplayMsg *display; - Tethering__HWKeyMsg *hwkey; -}; -#define TETHERING__TOUCH_MSG__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__touch_msg__descriptor) \ - , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } - - -struct _Tethering__TetheringMsg -{ - ProtobufCMessage base; - Tethering__TetheringMsg__Type type; - Tethering__HandShakeReq *handshakereq; - Tethering__HandShakeAns *handshakeans; - Tethering__EmulatorState *emulstate; - Tethering__AppState *appstate; - Tethering__EventMsg *eventmsg; - Tethering__SensorMsg *sensormsg; - Tethering__TouchMsg *touchmsg; -}; -#define TETHERING__TETHERING_MSG__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&tethering__tethering_msg__descriptor) \ - , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL } - - -/* Tethering__HandShakeReq methods */ -void tethering__hand_shake_req__init - (Tethering__HandShakeReq *message); -size_t tethering__hand_shake_req__get_packed_size - (const Tethering__HandShakeReq *message); -size_t tethering__hand_shake_req__pack - (const Tethering__HandShakeReq *message, - uint8_t *out); -size_t tethering__hand_shake_req__pack_to_buffer - (const Tethering__HandShakeReq *message, - ProtobufCBuffer *buffer); -Tethering__HandShakeReq * - tethering__hand_shake_req__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__hand_shake_req__free_unpacked - (Tethering__HandShakeReq *message, - ProtobufCAllocator *allocator); -/* Tethering__HandShakeAns methods */ -void tethering__hand_shake_ans__init - (Tethering__HandShakeAns *message); -size_t tethering__hand_shake_ans__get_packed_size - (const Tethering__HandShakeAns *message); -size_t tethering__hand_shake_ans__pack - (const Tethering__HandShakeAns *message, - uint8_t *out); -size_t tethering__hand_shake_ans__pack_to_buffer - (const Tethering__HandShakeAns *message, - ProtobufCBuffer *buffer); -Tethering__HandShakeAns * - tethering__hand_shake_ans__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__hand_shake_ans__free_unpacked - (Tethering__HandShakeAns *message, - ProtobufCAllocator *allocator); -/* Tethering__EmulatorState methods */ -void tethering__emulator_state__init - (Tethering__EmulatorState *message); -size_t tethering__emulator_state__get_packed_size - (const Tethering__EmulatorState *message); -size_t tethering__emulator_state__pack - (const Tethering__EmulatorState *message, - uint8_t *out); -size_t tethering__emulator_state__pack_to_buffer - (const Tethering__EmulatorState *message, - ProtobufCBuffer *buffer); -Tethering__EmulatorState * - tethering__emulator_state__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__emulator_state__free_unpacked - (Tethering__EmulatorState *message, - ProtobufCAllocator *allocator); -/* Tethering__AppState methods */ -void tethering__app_state__init - (Tethering__AppState *message); -size_t tethering__app_state__get_packed_size - (const Tethering__AppState *message); -size_t tethering__app_state__pack - (const Tethering__AppState *message, - uint8_t *out); -size_t tethering__app_state__pack_to_buffer - (const Tethering__AppState *message, - ProtobufCBuffer *buffer); -Tethering__AppState * - tethering__app_state__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__app_state__free_unpacked - (Tethering__AppState *message, - ProtobufCAllocator *allocator); -/* Tethering__StartReq methods */ -void tethering__start_req__init - (Tethering__StartReq *message); -size_t tethering__start_req__get_packed_size - (const Tethering__StartReq *message); -size_t tethering__start_req__pack - (const Tethering__StartReq *message, - uint8_t *out); -size_t tethering__start_req__pack_to_buffer - (const Tethering__StartReq *message, - ProtobufCBuffer *buffer); -Tethering__StartReq * - tethering__start_req__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__start_req__free_unpacked - (Tethering__StartReq *message, - ProtobufCAllocator *allocator); -/* Tethering__StartAns methods */ -void tethering__start_ans__init - (Tethering__StartAns *message); -size_t tethering__start_ans__get_packed_size - (const Tethering__StartAns *message); -size_t tethering__start_ans__pack - (const Tethering__StartAns *message, - uint8_t *out); -size_t tethering__start_ans__pack_to_buffer - (const Tethering__StartAns *message, - ProtobufCBuffer *buffer); -Tethering__StartAns * - tethering__start_ans__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__start_ans__free_unpacked - (Tethering__StartAns *message, - ProtobufCAllocator *allocator); -/* Tethering__SetEventStatus methods */ -void tethering__set_event_status__init - (Tethering__SetEventStatus *message); -size_t tethering__set_event_status__get_packed_size - (const Tethering__SetEventStatus *message); -size_t tethering__set_event_status__pack - (const Tethering__SetEventStatus *message, - uint8_t *out); -size_t tethering__set_event_status__pack_to_buffer - (const Tethering__SetEventStatus *message, - ProtobufCBuffer *buffer); -Tethering__SetEventStatus * - tethering__set_event_status__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__set_event_status__free_unpacked - (Tethering__SetEventStatus *message, - ProtobufCAllocator *allocator); -/* Tethering__EventMsg methods */ -void tethering__event_msg__init - (Tethering__EventMsg *message); -size_t tethering__event_msg__get_packed_size - (const Tethering__EventMsg *message); -size_t tethering__event_msg__pack - (const Tethering__EventMsg *message, - uint8_t *out); -size_t tethering__event_msg__pack_to_buffer - (const Tethering__EventMsg *message, - ProtobufCBuffer *buffer); -Tethering__EventMsg * - tethering__event_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__event_msg__free_unpacked - (Tethering__EventMsg *message, - ProtobufCAllocator *allocator); -/* Tethering__EventTerminate methods */ -void tethering__event_terminate__init - (Tethering__EventTerminate *message); -size_t tethering__event_terminate__get_packed_size - (const Tethering__EventTerminate *message); -size_t tethering__event_terminate__pack - (const Tethering__EventTerminate *message, - uint8_t *out); -size_t tethering__event_terminate__pack_to_buffer - (const Tethering__EventTerminate *message, - ProtobufCBuffer *buffer); -Tethering__EventTerminate * - tethering__event_terminate__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__event_terminate__free_unpacked - (Tethering__EventTerminate *message, - ProtobufCAllocator *allocator); -/* Tethering__SetSensorStatus methods */ -void tethering__set_sensor_status__init - (Tethering__SetSensorStatus *message); -size_t tethering__set_sensor_status__get_packed_size - (const Tethering__SetSensorStatus *message); -size_t tethering__set_sensor_status__pack - (const Tethering__SetSensorStatus *message, - uint8_t *out); -size_t tethering__set_sensor_status__pack_to_buffer - (const Tethering__SetSensorStatus *message, - ProtobufCBuffer *buffer); -Tethering__SetSensorStatus * - tethering__set_sensor_status__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__set_sensor_status__free_unpacked - (Tethering__SetSensorStatus *message, - ProtobufCAllocator *allocator); -/* Tethering__SensorData methods */ -void tethering__sensor_data__init - (Tethering__SensorData *message); -size_t tethering__sensor_data__get_packed_size - (const Tethering__SensorData *message); -size_t tethering__sensor_data__pack - (const Tethering__SensorData *message, - uint8_t *out); -size_t tethering__sensor_data__pack_to_buffer - (const Tethering__SensorData *message, - ProtobufCBuffer *buffer); -Tethering__SensorData * - tethering__sensor_data__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__sensor_data__free_unpacked - (Tethering__SensorData *message, - ProtobufCAllocator *allocator); -/* Tethering__SensorMsg methods */ -void tethering__sensor_msg__init - (Tethering__SensorMsg *message); -size_t tethering__sensor_msg__get_packed_size - (const Tethering__SensorMsg *message); -size_t tethering__sensor_msg__pack - (const Tethering__SensorMsg *message, - uint8_t *out); -size_t tethering__sensor_msg__pack_to_buffer - (const Tethering__SensorMsg *message, - ProtobufCBuffer *buffer); -Tethering__SensorMsg * - tethering__sensor_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__sensor_msg__free_unpacked - (Tethering__SensorMsg *message, - ProtobufCAllocator *allocator); -/* Tethering__Resolution methods */ -void tethering__resolution__init - (Tethering__Resolution *message); -size_t tethering__resolution__get_packed_size - (const Tethering__Resolution *message); -size_t tethering__resolution__pack - (const Tethering__Resolution *message, - uint8_t *out); -size_t tethering__resolution__pack_to_buffer - (const Tethering__Resolution *message, - ProtobufCBuffer *buffer); -Tethering__Resolution * - tethering__resolution__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__resolution__free_unpacked - (Tethering__Resolution *message, - ProtobufCAllocator *allocator); -/* Tethering__DisplayMsg methods */ -void tethering__display_msg__init - (Tethering__DisplayMsg *message); -size_t tethering__display_msg__get_packed_size - (const Tethering__DisplayMsg *message); -size_t tethering__display_msg__pack - (const Tethering__DisplayMsg *message, - uint8_t *out); -size_t tethering__display_msg__pack_to_buffer - (const Tethering__DisplayMsg *message, - ProtobufCBuffer *buffer); -Tethering__DisplayMsg * - tethering__display_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__display_msg__free_unpacked - (Tethering__DisplayMsg *message, - ProtobufCAllocator *allocator); -/* Tethering__TouchMaxCount methods */ -void tethering__touch_max_count__init - (Tethering__TouchMaxCount *message); -size_t tethering__touch_max_count__get_packed_size - (const Tethering__TouchMaxCount *message); -size_t tethering__touch_max_count__pack - (const Tethering__TouchMaxCount *message, - uint8_t *out); -size_t tethering__touch_max_count__pack_to_buffer - (const Tethering__TouchMaxCount *message, - ProtobufCBuffer *buffer); -Tethering__TouchMaxCount * - tethering__touch_max_count__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__touch_max_count__free_unpacked - (Tethering__TouchMaxCount *message, - ProtobufCAllocator *allocator); -/* Tethering__TouchData methods */ -void tethering__touch_data__init - (Tethering__TouchData *message); -size_t tethering__touch_data__get_packed_size - (const Tethering__TouchData *message); -size_t tethering__touch_data__pack - (const Tethering__TouchData *message, - uint8_t *out); -size_t tethering__touch_data__pack_to_buffer - (const Tethering__TouchData *message, - ProtobufCBuffer *buffer); -Tethering__TouchData * - tethering__touch_data__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__touch_data__free_unpacked - (Tethering__TouchData *message, - ProtobufCAllocator *allocator); -/* Tethering__HWKeyMsg methods */ -void tethering__hwkey_msg__init - (Tethering__HWKeyMsg *message); -size_t tethering__hwkey_msg__get_packed_size - (const Tethering__HWKeyMsg *message); -size_t tethering__hwkey_msg__pack - (const Tethering__HWKeyMsg *message, - uint8_t *out); -size_t tethering__hwkey_msg__pack_to_buffer - (const Tethering__HWKeyMsg *message, - ProtobufCBuffer *buffer); -Tethering__HWKeyMsg * - tethering__hwkey_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__hwkey_msg__free_unpacked - (Tethering__HWKeyMsg *message, - ProtobufCAllocator *allocator); -/* Tethering__TouchMsg methods */ -void tethering__touch_msg__init - (Tethering__TouchMsg *message); -size_t tethering__touch_msg__get_packed_size - (const Tethering__TouchMsg *message); -size_t tethering__touch_msg__pack - (const Tethering__TouchMsg *message, - uint8_t *out); -size_t tethering__touch_msg__pack_to_buffer - (const Tethering__TouchMsg *message, - ProtobufCBuffer *buffer); -Tethering__TouchMsg * - tethering__touch_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__touch_msg__free_unpacked - (Tethering__TouchMsg *message, - ProtobufCAllocator *allocator); -/* Tethering__TetheringMsg methods */ -void tethering__tethering_msg__init - (Tethering__TetheringMsg *message); -size_t tethering__tethering_msg__get_packed_size - (const Tethering__TetheringMsg *message); -size_t tethering__tethering_msg__pack - (const Tethering__TetheringMsg *message, - uint8_t *out); -size_t tethering__tethering_msg__pack_to_buffer - (const Tethering__TetheringMsg *message, - ProtobufCBuffer *buffer); -Tethering__TetheringMsg * - tethering__tethering_msg__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void tethering__tethering_msg__free_unpacked - (Tethering__TetheringMsg *message, - ProtobufCAllocator *allocator); -/* --- per-message closures --- */ - -typedef void (*Tethering__HandShakeReq_Closure) - (const Tethering__HandShakeReq *message, - void *closure_data); -typedef void (*Tethering__HandShakeAns_Closure) - (const Tethering__HandShakeAns *message, - void *closure_data); -typedef void (*Tethering__EmulatorState_Closure) - (const Tethering__EmulatorState *message, - void *closure_data); -typedef void (*Tethering__AppState_Closure) - (const Tethering__AppState *message, - void *closure_data); -typedef void (*Tethering__StartReq_Closure) - (const Tethering__StartReq *message, - void *closure_data); -typedef void (*Tethering__StartAns_Closure) - (const Tethering__StartAns *message, - void *closure_data); -typedef void (*Tethering__SetEventStatus_Closure) - (const Tethering__SetEventStatus *message, - void *closure_data); -typedef void (*Tethering__EventMsg_Closure) - (const Tethering__EventMsg *message, - void *closure_data); -typedef void (*Tethering__EventTerminate_Closure) - (const Tethering__EventTerminate *message, - void *closure_data); -typedef void (*Tethering__SetSensorStatus_Closure) - (const Tethering__SetSensorStatus *message, - void *closure_data); -typedef void (*Tethering__SensorData_Closure) - (const Tethering__SensorData *message, - void *closure_data); -typedef void (*Tethering__SensorMsg_Closure) - (const Tethering__SensorMsg *message, - void *closure_data); -typedef void (*Tethering__Resolution_Closure) - (const Tethering__Resolution *message, - void *closure_data); -typedef void (*Tethering__DisplayMsg_Closure) - (const Tethering__DisplayMsg *message, - void *closure_data); -typedef void (*Tethering__TouchMaxCount_Closure) - (const Tethering__TouchMaxCount *message, - void *closure_data); -typedef void (*Tethering__TouchData_Closure) - (const Tethering__TouchData *message, - void *closure_data); -typedef void (*Tethering__HWKeyMsg_Closure) - (const Tethering__HWKeyMsg *message, - void *closure_data); -typedef void (*Tethering__TouchMsg_Closure) - (const Tethering__TouchMsg *message, - void *closure_data); -typedef void (*Tethering__TetheringMsg_Closure) - (const Tethering__TetheringMsg *message, - void *closure_data); - -/* --- services --- */ - - -/* --- descriptors --- */ - -extern const ProtobufCEnumDescriptor tethering__message_result__descriptor; -extern const ProtobufCEnumDescriptor tethering__connection_state__descriptor; -extern const ProtobufCEnumDescriptor tethering__event_type__descriptor; -extern const ProtobufCEnumDescriptor tethering__state__descriptor; -extern const ProtobufCEnumDescriptor tethering__sensor_type__descriptor; -extern const ProtobufCEnumDescriptor tethering__touch_state__descriptor; -extern const ProtobufCEnumDescriptor tethering__hwkey_type__descriptor; -extern const ProtobufCMessageDescriptor tethering__hand_shake_req__descriptor; -extern const ProtobufCMessageDescriptor tethering__hand_shake_ans__descriptor; -extern const ProtobufCMessageDescriptor tethering__emulator_state__descriptor; -extern const ProtobufCMessageDescriptor tethering__app_state__descriptor; -extern const ProtobufCMessageDescriptor tethering__start_req__descriptor; -extern const ProtobufCMessageDescriptor tethering__start_ans__descriptor; -extern const ProtobufCMessageDescriptor tethering__set_event_status__descriptor; -extern const ProtobufCMessageDescriptor tethering__event_msg__descriptor; -extern const ProtobufCEnumDescriptor tethering__event_msg__type__descriptor; -extern const ProtobufCMessageDescriptor tethering__event_terminate__descriptor; -extern const ProtobufCMessageDescriptor tethering__set_sensor_status__descriptor; -extern const ProtobufCMessageDescriptor tethering__sensor_data__descriptor; -extern const ProtobufCMessageDescriptor tethering__sensor_msg__descriptor; -extern const ProtobufCEnumDescriptor tethering__sensor_msg__type__descriptor; -extern const ProtobufCMessageDescriptor tethering__resolution__descriptor; -extern const ProtobufCMessageDescriptor tethering__display_msg__descriptor; -extern const ProtobufCMessageDescriptor tethering__touch_max_count__descriptor; -extern const ProtobufCMessageDescriptor tethering__touch_data__descriptor; -extern const ProtobufCMessageDescriptor tethering__hwkey_msg__descriptor; -extern const ProtobufCMessageDescriptor tethering__touch_msg__descriptor; -extern const ProtobufCEnumDescriptor tethering__touch_msg__type__descriptor; -extern const ProtobufCMessageDescriptor tethering__tethering_msg__descriptor; -extern const ProtobufCEnumDescriptor tethering__tethering_msg__type__descriptor; - -PROTOBUF_C_END_DECLS - - -#endif /* PROTOBUF_tethering_2eproto__INCLUDED */ diff --git a/tizen/src/tethering/msg/tethering.proto b/tizen/src/tethering/msg/tethering.proto deleted file mode 100644 index 01988bc394..0000000000 --- a/tizen/src/tethering/msg/tethering.proto +++ /dev/null @@ -1,214 +0,0 @@ -package tethering; - -option java_package = "device.tethering.genmsg"; - -// protoc-c --c_out=../genmsg tethering.proto - -// define value -enum MessageResult { - SUCCESS = 1; - FAILURE = 2; - CANCEL = 3; -} - -enum ConnectionState { - CONNECTED = 1; - DISCONNECTED = 2; - TERMINATED = 3; -} - -enum EventType { - SENSOR = 1; - TOUCH = 2; -} - -enum State { - ENABLED = 1; - DISABLED = 2; -} - -enum SensorType { - ACCEL = 1; - MAGNETIC = 2; - GYROSCOPE = 3; - PROXIMITY = 4; - LIGHT = 5; -} - -enum TouchState { - PRESSED = 1; - RELEASED = 2; -} - -// define messages -message HandShakeReq { - required int32 key = 1; -} - -message HandShakeAns { - required MessageResult result = 1; -} - -message EmulatorState { - required ConnectionState state = 1; -} - -message AppState { - required ConnectionState state = 1; -} - -message StartReq { - -} - -message StartAns { - required MessageResult result = 1; -} - -message SetEventStatus { - required EventType type = 1; - required State state = 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 { - -} - -message SetSensorStatus { - required SensorType type = 1; - required State state = 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 Resolution { - required int32 width = 1; - required int32 height = 2; -} - -/* -message DisplayMsg { - enum Type { - START_REQ = 2; - START_ANS = 3; - TERMINATE = 4; - FRAME_RATE = 5; - IMAGE_DATA = 6; - } - - required Type type = 1; - optional StartReq startReq= 2; - optional StartAns startAns= 3; - optional EventTerminate terminate = 4; - optional int32 frameRate = 5; - optional bytes imageData = 6; -} -*/ - -message DisplayMsg { - optional int32 frameRate = 1; - optional bytes imageData = 2; -} - -message TouchMaxCount { - optional int32 max = 1 [default = 10]; -} - -message TouchData { - optional int32 index = 1 [default = 0]; - optional float xPoint = 2 [default = 0.0]; - optional float yPoint = 3 [default = 0.0]; - optional TouchState state = 4; -} - -enum HWKeyType { - MENU = 1; - HOME = 2; - BACK = 3; - POWER = 4; - VOLUME_UP = 5; - VOLUME_DOWN = 6; -} - -message HWKeyMsg { - required HWKeyType type = 1; -} - -message TouchMsg { - enum Type { - START_REQ = 2; - START_ANS = 3; - TERMINATE = 4; - MAX_COUNT = 5; - TOUCH_DATA = 6; - RESOLUTION = 7; - DISPLAY_MSG = 8; - HWKEY_MSG = 9; - } - required Type type = 1; - optional StartReq startReq = 2; - optional StartAns startAns = 3; - optional EventTerminate terminate = 4; - optional TouchMaxCount maxCount = 5; - optional TouchData touchData = 6; - optional Resolution resolution = 7; - optional DisplayMsg display = 8; - optional HWKeyMsg hwkey = 9; -} - -message TetheringMsg { - 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 TouchMsg touchMsg = 8; -} diff --git a/tizen/src/tethering/sensor.c b/tizen/src/tethering/sensor.c deleted file mode 100644 index 902637caec..0000000000 --- a/tizen/src/tethering/sensor.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * emulator controller client - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * Kitae Kim - * JiHye Kim - * YeongKyoon Lee - * - * 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 - * - */ - -#if 0 -#ifndef __WIN32 -#include -#else -#define EISCONN WSAEISCONN -#endif - -#include "qemu/main-loop.h" -#include "qemu/sockets.h" -#include "ui/console.h" -#endif - -#include "emulator_common.h" -#include "emul_state.h" - -#include "sensor.h" -#include "common.h" -#include "ecs/ecs_tethering.h" -#include "genmsg/tethering.pb-c.h" - -#include "util/new_debug_ch.h" - -DECLARE_DEBUG_CHANNEL(app_tethering); - -typedef struct sensor_state { - bool is_sensor_event; - bool is_sensor_supported; - -} sensor_state; - -enum sensor_level { - level_accel = 1, - level_proxi = 2, - level_light = 3, - level_gyro = 4, - level_geo = 5, - level_tilt = 12, - level_magnetic = 13 -}; - -#define ACCEL_ADJUST 100000 -#define GYRO_ADJUST 17.50 - -static int sensor_device_status; - -// create a sensor message. -static bool build_sensor_msg(Tethering__SensorMsg *sensor) -{ - bool ret = false; - Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - msg.type = TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG; - msg.sensormsg = sensor; - - ret = send_msg_to_controller(&msg); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static bool send_sensor_start_ans_msg(Tethering__MessageResult result) -{ - bool ret = false; - Tethering__SensorMsg event = TETHERING__SENSOR_MSG__INIT; - Tethering__StartAns start_ans = TETHERING__START_ANS__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - start_ans.result = result; - - event.type = TETHERING__SENSOR_MSG__TYPE__START_ANS; - event.startans = &start_ans; - - LOG_TRACE("send sensor_start_ans message\n"); - ret = build_sensor_msg(&event); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static bool send_set_sensor_status_msg(Tethering__SensorType sensor_type, - Tethering__State status) -{ - bool ret = false; - - Tethering__SensorMsg sensor = TETHERING__SENSOR_MSG__INIT; - Tethering__SetSensorStatus sensor_status = - TETHERING__SET_SENSOR_STATUS__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - sensor_status.type = sensor_type; - sensor_status.state = status; - - sensor.type = TETHERING__SENSOR_MSG__TYPE__SENSOR_STATUS; - sensor.setstatus = &sensor_status; - - LOG_TRACE("send sensor_set_event_status message\n"); - ret = build_sensor_msg(&sensor); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static void set_sensor_data(Tethering__SensorData *data) -{ - /* - * data format for sensor device - * each value is classified by carriage return character - * sensor_type/param numbers/parameters - * ex) acceleration sensor: "level_accel\n3\nx\ny\nz\n" - */ - - switch(data->sensor) { - case TETHERING__SENSOR_TYPE__ACCEL: - { - char tmp[255] = {0}; - - sprintf(tmp, "%d\n%d\n%lf\n%lf\n%lf\n", - level_accel, 3, (atof(data->x) * ACCEL_ADJUST), - (atof(data->y) * ACCEL_ADJUST), (atof(data->z) * ACCEL_ADJUST)); - send_tethering_sensor_data(tmp, strlen(tmp)); - - LOG_TRACE("sensor_accel x: %s, y: %s, z: %s\n", - data->x, data->y, data->z); - } - break; - case TETHERING__SENSOR_TYPE__MAGNETIC: - { - char tmp[255] = {0}; - - sprintf(tmp, "%d\n%d\n%s\n%s\n%s\n", - level_magnetic, 3, data->x, data->y, data->z); - send_tethering_sensor_data(tmp, strlen(tmp)); - - LOG_TRACE("sensor_mag x: %s, y: %s, z: %s\n", - data->x, data->y, data->z); - } - break; - case TETHERING__SENSOR_TYPE__GYROSCOPE: - { - char tmp[255] = {0}; - - sprintf(tmp, "%d\n%d\n%lf\n%lf\n%lf\n", - level_gyro, 3, (atof(data->x) / GYRO_ADJUST), - (atof(data->y) / GYRO_ADJUST), (atof(data->z) / GYRO_ADJUST)); - send_tethering_sensor_data(tmp, strlen(tmp)); - - LOG_TRACE("sensor_gyro x: %s, y: %s, z: %s\n", - data->x, data->y, data->z); - } - break; - case TETHERING__SENSOR_TYPE__PROXIMITY: - { - char tmp[255] = {0}; - double x = (double)(atoi(data->x)); - - sprintf(tmp, "%d\n%d\n%.1f\n", level_proxi, 1, x); - send_tethering_sensor_data(tmp, strlen(tmp)); - - LOG_TRACE("sensor_proxi x: %.1f, %s\n", x, tmp); - } - break; - case TETHERING__SENSOR_TYPE__LIGHT: - { - char tmp[255] = {0}; - - sprintf(tmp, "%d\n%d\n%s%s\n", level_light, 2, data->x, data->y); - send_tethering_sensor_data(tmp, strlen(tmp)); - - LOG_TRACE("sensor_light x: %s\n", data->x); - } - break; - default: - LOG_TRACE("invalid sensor data\n"); - break; - } -} - -bool msgproc_tethering_sensor_msg(void *message) -{ - bool ret = true; - Tethering__SensorMsg *msg = (Tethering__SensorMsg *)message; - - switch(msg->type) { - case TETHERING__SENSOR_MSG__TYPE__START_REQ: - LOG_TRACE("SENSOR_MSG_TYPE_START_REQ\n"); - - // set sensor type. - send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__ACCEL, - TETHERING__STATE__ENABLED); - send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__MAGNETIC, - TETHERING__STATE__ENABLED); - send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__GYROSCOPE, - TETHERING__STATE__ENABLED); - send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__PROXIMITY, - TETHERING__STATE__ENABLED); - send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__LIGHT, - TETHERING__STATE__ENABLED); - - LOG_TRACE("SENSOR_MSG_TYPE_START_ANS\n"); - send_sensor_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS); - - break; - case TETHERING__SENSOR_MSG__TYPE__TERMINATE: - LOG_TRACE("SENSOR_MSG_TYPE_TERMINATE\n"); - break; - - case TETHERING__SENSOR_MSG__TYPE__SENSOR_DATA: - LOG_TRACE("SENSOR_MSG_TYPE_SENSOR_DATA\n"); - set_sensor_data(msg->data); - break; - default: - LOG_TRACE("invalid sensor_msg type"); - ret = false; - break; - } - - return ret; -} - -int get_tethering_sensor_status(void) -{ - return sensor_device_status; -} - -void set_tethering_sensor_status(int status) -{ - sensor_device_status = status; - send_tethering_sensor_status_ecp(); -} diff --git a/tizen/src/tethering/sensor.h b/tizen/src/tethering/sensor.h deleted file mode 100644 index 42ece22b9c..0000000000 --- a/tizen/src/tethering/sensor.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * emulator controller client - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * Kitae Kim - * JiHye Kim - * YeongKyoon Lee - * - * 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 - * - */ - -bool msgproc_tethering_sensor_msg(void *msg); - -int get_tethering_sensor_status(void); - -void set_tethering_sensor_status(int status); diff --git a/tizen/src/tethering/touch.c b/tizen/src/tethering/touch.c deleted file mode 100644 index 30a0b3a09d..0000000000 --- a/tizen/src/tethering/touch.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * emulator controller client - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * Kitae Kim - * JiHye Kim - * YeongKyoon Lee - * - * 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 "emulator_common.h" -#include "emul_state.h" -#include "common.h" -#include "touch.h" -#include "encode_fb.h" -#include "genmsg/tethering.pb-c.h" -#include "ecs/ecs_tethering.h" -#include "util/new_debug_ch.h" - -DECLARE_DEBUG_CHANNEL(app_tethering); - -static int touch_device_status; -static bool send_display_image_data(void); - -#define HARD_KEY_MENU 169 -#define HARD_KEY_BACK 158 - -static bool build_touch_msg(Tethering__TouchMsg *touch) -{ - bool ret = false; - Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - msg.type = TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG; - msg.touchmsg = touch; - - LOG_TRACE("touch message size: %d\n", tethering__tethering_msg__get_packed_size(&msg)); - ret = send_msg_to_controller(&msg); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static bool send_touch_start_ans_msg(Tethering__MessageResult result) -{ - bool ret = false; - - Tethering__TouchMsg mt = TETHERING__TOUCH_MSG__INIT; - Tethering__StartAns start_ans = TETHERING__START_ANS__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - start_ans.result = result; - - mt.type = TETHERING__TOUCH_MSG__TYPE__START_ANS; - mt.startans = &start_ans; - - ret = build_touch_msg(&mt); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static bool send_set_touch_max_count(void) -{ - bool ret = false; - - Tethering__TouchMsg mt = TETHERING__TOUCH_MSG__INIT; - Tethering__TouchMaxCount touch_cnt = - TETHERING__TOUCH_MAX_COUNT__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - touch_cnt.max = get_emul_max_touch_point(); - - mt.type = TETHERING__TOUCH_MSG__TYPE__MAX_COUNT; - mt.maxcount = &touch_cnt; - - LOG_TRACE("send touch max count: %d\n", touch_cnt.max); - ret = build_touch_msg(&mt); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static void set_touch_data(Tethering__TouchData *data) -{ - float x = 0.0, y = 0.0; - int32_t index = 0, state = 0; - - switch(data->state) { - case TETHERING__TOUCH_STATE__PRESSED: - LOG_TRACE("touch pressed\n"); - index = data->index; - x = data->xpoint; - y = data->ypoint; - state = PRESSED; - break; - case TETHERING__TOUCH_STATE__RELEASED: - LOG_TRACE("touch released\n"); - index = data->index; - x = data->xpoint; - y = data->ypoint; - state = RELEASED; - break; - default: - LOG_TRACE("invalid touch data\n"); - break; - } - - LOG_TRACE("set touch_data. index: %d, x: %lf, y: %lf\n", index, x, y); - send_tethering_touch_data(x, y, index, state); -} - -static bool send_set_touch_resolution(void) -{ - bool ret = false; - - Tethering__TouchMsg mt = TETHERING__TOUCH_MSG__INIT; - Tethering__Resolution resolution = TETHERING__RESOLUTION__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - resolution.width = get_emul_resolution_width(); - resolution.height = get_emul_resolution_height(); - - mt.type = TETHERING__TOUCH_MSG__TYPE__RESOLUTION; - mt.resolution = &resolution; - - LOG_TRACE("send touch resolution: %dx%d\n", - resolution.width, resolution.height); - ret = build_touch_msg(&mt); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - - return ret; -} - -static void set_hwkey_data(Tethering__HWKeyMsg *msg) -{ - int32_t keycode = 0; - - switch (msg->type) { - case TETHERING__HWKEY_TYPE__MENU: - keycode = HARD_KEY_MENU; - break; - - case TETHERING__HWKEY_TYPE__HOME: - keycode = HARD_KEY_HOME; - break; - - case TETHERING__HWKEY_TYPE__BACK: - keycode = HARD_KEY_BACK; - break; - - case TETHERING__HWKEY_TYPE__POWER: - keycode = HARD_KEY_POWER; - break; - - case TETHERING__HWKEY_TYPE__VOLUME_UP: - keycode = HARD_KEY_VOL_UP; - break; - - case TETHERING__HWKEY_TYPE__VOLUME_DOWN: - keycode = HARD_KEY_VOL_DOWN; - break; - - default: - LOG_WARNING("undefined type: %d\n", msg->type); - } - - LOG_TRACE("convert hwkey msg to keycode: %d\n", keycode); - send_tethering_hwkey_data(keycode); -} - -bool msgproc_tethering_touch_msg(void *message) -{ - bool ret = true; - Tethering__TouchMsg *msg = (Tethering__TouchMsg *)message; - - switch(msg->type) { - case TETHERING__TOUCH_MSG__TYPE__START_REQ: - LOG_TRACE("TOUCH_MSG_TYPE_START\n"); - send_set_touch_max_count(); - send_set_touch_resolution(); - ret = send_touch_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS); - break; - case TETHERING__TOUCH_MSG__TYPE__TERMINATE: - LOG_TRACE("TOUCH_MSG_TYPE_TERMINATE\n"); - break; - - case TETHERING__TOUCH_MSG__TYPE__TOUCH_DATA: - LOG_TRACE("TOUCH_MSG_TYPE_TOUCH_DATA\n"); - set_touch_data(msg->touchdata); - break; - - case TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG: - LOG_TRACE("TOUCH_MSG_TYPE_DISPLAY_MSG\n"); - - if (is_display_dirty()) { - LOG_TRACE("display dirty status!! send the image\n"); - - send_display_image_data(); - set_display_dirty(false); - } - break; - - case TETHERING__TOUCH_MSG__TYPE__HWKEY_MSG: - LOG_TRACE("TOUCH_MSG_TYPE_HWKEY_MSG\n"); - set_hwkey_data(msg->hwkey); - break; - - default: - LOG_TRACE("invalid touch_msg\n"); - ret = false; - break; - } - - return ret; -} - -int get_tethering_touch_status(void) -{ - return touch_device_status; -} - -void set_tethering_touch_status(int status) -{ - touch_device_status = status; - send_tethering_touch_status_ecp(); -} - -static void dump_display_image_data(struct encode_mem *image) -{ -#ifdef IMAGE_DUMP - FILE *fp = NULL; - - fp = fopen("display_image_dump.png", "wb"); - if (fp != NULL) { - fwrite(image->buffer, 1, image->length, fp); - fclose(fp); - } -#endif -} - -static bool send_display_image_data(void) -{ - bool ret = false; - struct encode_mem *image = NULL; - - Tethering__TouchMsg touch = TETHERING__TOUCH_MSG__INIT; - Tethering__DisplayMsg display = TETHERING__DISPLAY_MSG__INIT; - - LOG_TRACE("enter: %s\n", __func__); - - image = (struct encode_mem *)encode_framebuffer(ENCODE_PNG); - if (!image) { - LOG_SEVERE("failed to encode framebuffer\n"); - return false; - } - - dump_display_image_data(image); - - LOG_TRACE("image data size %d\n", image->length); - display.has_imagedata = true; - display.imagedata.len = image->length; - display.imagedata.data = image->buffer; - - touch.type = TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG; - touch.display = &display; - - ret = build_touch_msg(&touch); - LOG_TRACE("send display message: %d\n", ret); - - g_free(image->buffer); - g_free(image); - - LOG_TRACE("leave: %s, ret: %d\n", __func__, ret); - return ret; -} diff --git a/tizen/src/tethering/touch.h b/tizen/src/tethering/touch.h deleted file mode 100644 index cb29c9b804..0000000000 --- a/tizen/src/tethering/touch.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * emulator controller client - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved - * - * Contact: - * Kitae Kim - * JiHye Kim - * YeongKyoon Lee - * - * 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 - * - */ - -enum { - ENCODE_WEBP = 0, - ENCODE_PNG, -}; - -bool msgproc_tethering_touch_msg(void *message); - -int get_tethering_touch_status(void); - -void set_tethering_touch_status(int status);