From e638fc0bfece1da57df3fdedafd52bb884d2b80d Mon Sep 17 00:00:00 2001 From: Jinhyung Choi Date: Mon, 7 Oct 2013 14:42:35 +0900 Subject: [PATCH] qemu: cleanning ecs message up & added suspend message to sdb server Change-Id: I309782244c5417cb82c97e0a64d0a45a23274dda Signed-off-by: Jinhyung Choi --- tizen/src/ecs/Makefile.tizen | 2 - tizen/src/ecs/ecs.c | 29 +----- tizen/src/ecs/ecs_mon.c | 30 +++++- tizen/src/ecs/genmsg/ecs.pb-c.c | 225 +++++++++++++++++++++++++++++++++++++++- tizen/src/ecs/genmsg/ecs.pb-c.h | 77 +++++++++++++- tizen/src/ecs/genmsg/nfc.pb-c.c | 196 ---------------------------------- tizen/src/ecs/genmsg/nfc.pb-c.h | 103 ------------------ tizen/src/ecs/msg/ecs.proto | 19 +++- tizen/src/ecs/msg/nfc.proto | 21 ---- tizen/src/guest_server.c | 3 +- 10 files changed, 345 insertions(+), 360 deletions(-) delete mode 100644 tizen/src/ecs/genmsg/nfc.pb-c.c delete mode 100644 tizen/src/ecs/genmsg/nfc.pb-c.h delete mode 100644 tizen/src/ecs/msg/nfc.proto diff --git a/tizen/src/ecs/Makefile.tizen b/tizen/src/ecs/Makefile.tizen index 8d471a2..f43cadf 100644 --- a/tizen/src/ecs/Makefile.tizen +++ b/tizen/src/ecs/Makefile.tizen @@ -9,5 +9,3 @@ obj-y += ecs.pb-c.o ecs_ids.pb-c.o protobuf-c.o obj-y += ecs_msg.o ecs.o ecs_sensor.o obj-y += ecs_mon.o ecs-json-streamer.o -# NFC message extension -obj-y += nfc.pb-c.o diff --git a/tizen/src/ecs/ecs.c b/tizen/src/ecs/ecs.c index 2d5fe07..6840e4c 100644 --- a/tizen/src/ecs/ecs.c +++ b/tizen/src/ecs/ecs.c @@ -197,6 +197,7 @@ static void ecs_close(ECS_State *cs) { LOG("### Good bye! ECS ###"); if (0 <= cs->listen_fd) { + LOG("close listen_fd: %d", cs->listen_fd); closesocket(cs->listen_fd); cs->listen_fd = -1; } @@ -726,15 +727,7 @@ bool handle_protobuf_msg(ECS_Client* cli, char* data, int len) ECS__Master* master = ecs__master__unpack(NULL, (size_t)len, (const uint8_t*)data); if (!master) return false; -#if 0 - if (master->type == ECS__MASTER__TYPE__START_REQ) - { - ECS__StartReq* msg = master->start_req; - if (!msg) - goto fail; - msgproc_start_req(cli, msg); - } -#endif + if (master->type == ECS__MASTER__TYPE__INJECTOR_REQ) { ECS__InjectorReq* msg = master->injector_req; @@ -742,15 +735,6 @@ bool handle_protobuf_msg(ECS_Client* cli, char* data, int len) goto fail; msgproc_injector_req(cli, msg); } -#if 0 - else if (master->type == ECS__MASTER__TYPE__CONTROL_MSG) - { - ECS__ControlMsg* msg = master->control_msg; - if (!msg) - goto fail; - msgproc_control_msg(cli, msg); - } -#endif else if (master->type == ECS__MASTER__TYPE__MONITOR_REQ) { ECS__MonitorReq* msg = master->monitor_req; @@ -765,15 +749,6 @@ bool handle_protobuf_msg(ECS_Client* cli, char* data, int len) goto fail; msgproc_device_req(cli, msg); } -#if 0 - else if (master->type == ECS__MASTER__TYPE__SCREEN_DUMP_REQ) - { - ECS__ScreenDumpReq* msg = master->screen_dump_req; - if (!msg) - goto fail; - msgproc_screen_dump_req(cli, msg); - } -#endif ecs__master__free_unpacked(master, NULL); return true; fail: diff --git a/tizen/src/ecs/ecs_mon.c b/tizen/src/ecs/ecs_mon.c index 4f7323b..15a0d0f 100644 --- a/tizen/src/ecs/ecs_mon.c +++ b/tizen/src/ecs/ecs_mon.c @@ -96,11 +96,33 @@ void send_to_client(int fd, const char* data, const int len) #define QMP_ACCEPT_UNKNOWNS 1 +bool send_monitor_ntf(const char* data, int size) +{ + ECS__Master master = ECS__MASTER__INIT; + ECS__MonitorNtf ntf = ECS__MONITOR_NTF__INIT; + + LOG("data size : %d, data : %s", size, data); + + ntf.command = (char*) g_malloc(size + 1); + memcpy(ntf.command, data, size); + + master.type = ECS__MASTER__TYPE__MONITOR_NTF; + master.monitor_ntf = &ntf; + + send_to_ecp(&master); + + if (ntf.command) + g_free(ntf.command); + + return true; +} + static void ecs_monitor_flush(ECS_Client *clii, Monitor *mon) { int ret; if (clii && 0 < clii->client_fd && mon && mon->outbuf_index != 0) { - ret = ecs_write(clii->client_fd, mon->outbuf, mon->outbuf_index); + //ret = ecs_write(clii->client_fd, mon->outbuf, mon->outbuf_index); + ret = send_monitor_ntf((char*)mon->outbuf, mon->outbuf_index); mon->outbuf_index = 0; if (ret < -1) { ecs_client_close(clii); @@ -428,6 +450,7 @@ static QDict *qmp_check_input_obj(QObject *input_obj) { return NULL; } } else if (!strcmp(arg_name, "id")) { + } else if (!strcmp(arg_name, "type")) { } else { qerror_report(QERR_QMP_EXTRA_MEMBER, arg_name); return NULL; @@ -485,6 +508,7 @@ void handle_qmp_command(JSONMessageParser *parser, QList *tokens, QDict *input, *args; const mon_cmd_t *cmd; const char *cmd_name; + const char *type_name; Monitor *mon = cur_mon; ECS_Client *clii = opaque; @@ -512,6 +536,8 @@ void handle_qmp_command(JSONMessageParser *parser, QList *tokens, goto err_out; } + type_name = qdict_get_str(qobject_to_qdict(obj), COMMANDS_TYPE); + obj = qdict_get(input, "arguments"); if (!obj) { args = qdict_new(); @@ -532,7 +558,7 @@ void handle_qmp_command(JSONMessageParser *parser, QList *tokens, goto err_out; } } else { - ecs_qmp_call_cmd(clii, mon, NULL, cmd, args); + ecs_qmp_call_cmd(clii, mon, type_name, cmd, args); } goto out; diff --git a/tizen/src/ecs/genmsg/ecs.pb-c.c b/tizen/src/ecs/genmsg/ecs.pb-c.c index 7c85b22..b5a05d3 100644 --- a/tizen/src/ecs/genmsg/ecs.pb-c.c +++ b/tizen/src/ecs/genmsg/ecs.pb-c.c @@ -565,6 +565,92 @@ void ecs__monitor_ntf__free_unpacked PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__monitor_ntf__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } +void ecs__nfc_req__init + (ECS__NfcReq *message) +{ + static ECS__NfcReq init_value = ECS__NFC_REQ__INIT; + *message = init_value; +} +size_t ecs__nfc_req__get_packed_size + (const ECS__NfcReq *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_req__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t ecs__nfc_req__pack + (const ECS__NfcReq *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_req__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t ecs__nfc_req__pack_to_buffer + (const ECS__NfcReq *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_req__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ECS__NfcReq * + ecs__nfc_req__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ECS__NfcReq *) + protobuf_c_message_unpack (&ecs__nfc_req__descriptor, + allocator, len, data); +} +void ecs__nfc_req__free_unpacked + (ECS__NfcReq *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_req__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void ecs__nfc_ntf__init + (ECS__NfcNtf *message) +{ + static ECS__NfcNtf init_value = ECS__NFC_NTF__INIT; + *message = init_value; +} +size_t ecs__nfc_ntf__get_packed_size + (const ECS__NfcNtf *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t ecs__nfc_ntf__pack + (const ECS__NfcNtf *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t ecs__nfc_ntf__pack_to_buffer + (const ECS__NfcNtf *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ECS__NfcNtf * + ecs__nfc_ntf__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ECS__NfcNtf *) + protobuf_c_message_unpack (&ecs__nfc_ntf__descriptor, + allocator, len, data); +} +void ecs__nfc_ntf__free_unpacked + (ECS__NfcNtf *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} void ecs__master__init (ECS__Master *message) { @@ -1531,7 +1617,109 @@ const ProtobufCMessageDescriptor ecs__monitor_ntf__descriptor = (ProtobufCMessageInit) ecs__monitor_ntf__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor ecs__master__field_descriptors[14] = +static const ProtobufCFieldDescriptor ecs__nfc_req__field_descriptors[2] = +{ + { + "category", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(ECS__NfcReq, category), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "data", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + PROTOBUF_C_OFFSETOF(ECS__NfcReq, has_data), + PROTOBUF_C_OFFSETOF(ECS__NfcReq, data), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned ecs__nfc_req__field_indices_by_name[] = { + 0, /* field[0] = category */ + 1, /* field[1] = data */ +}; +static const ProtobufCIntRange ecs__nfc_req__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor ecs__nfc_req__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "ECS.NfcReq", + "NfcReq", + "ECS__NfcReq", + "ECS", + sizeof(ECS__NfcReq), + 2, + ecs__nfc_req__field_descriptors, + ecs__nfc_req__field_indices_by_name, + 1, ecs__nfc_req__number_ranges, + (ProtobufCMessageInit) ecs__nfc_req__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor ecs__nfc_ntf__field_descriptors[2] = +{ + { + "category", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(ECS__NfcNtf, category), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "data", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + PROTOBUF_C_OFFSETOF(ECS__NfcNtf, has_data), + PROTOBUF_C_OFFSETOF(ECS__NfcNtf, data), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned ecs__nfc_ntf__field_indices_by_name[] = { + 0, /* field[0] = category */ + 1, /* field[1] = data */ +}; +static const ProtobufCIntRange ecs__nfc_ntf__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor ecs__nfc_ntf__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "ECS.NfcNtf", + "NfcNtf", + "ECS__NfcNtf", + "ECS", + sizeof(ECS__NfcNtf), + 2, + ecs__nfc_ntf__field_descriptors, + ecs__nfc_ntf__field_indices_by_name, + 1, ecs__nfc_ntf__number_ranges, + (ProtobufCMessageInit) ecs__nfc_ntf__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor ecs__master__field_descriptors[16] = { { "type", @@ -1701,6 +1889,30 @@ static const ProtobufCFieldDescriptor ecs__master__field_descriptors[14] = 0, /* packed */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "nfc_req", + 101, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(ECS__Master, nfc_req), + &ecs__nfc_req__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "nfc_ntf", + 102, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(ECS__Master, nfc_ntf), + &ecs__nfc_ntf__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned ecs__master__field_indices_by_name[] = { 2, /* field[2] = checkversion_ans */ @@ -1716,12 +1928,15 @@ static const unsigned ecs__master__field_indices_by_name[] = { 12, /* field[12] = monitor_ans */ 13, /* field[13] = monitor_ntf */ 11, /* field[11] = monitor_req */ + 15, /* field[15] = nfc_ntf */ + 14, /* field[14] = nfc_req */ 0, /* field[0] = type */ }; -static const ProtobufCIntRange ecs__master__number_ranges[1 + 1] = +static const ProtobufCIntRange ecs__master__number_ranges[2 + 1] = { { 1, 0 }, - { 0, 14 } + { 101, 14 }, + { 0, 16 } }; const ProtobufCMessageDescriptor ecs__master__descriptor = { @@ -1731,10 +1946,10 @@ const ProtobufCMessageDescriptor ecs__master__descriptor = "ECS__Master", "ECS", sizeof(ECS__Master), - 14, + 16, ecs__master__field_descriptors, ecs__master__field_indices_by_name, - 1, ecs__master__number_ranges, + 2, ecs__master__number_ranges, (ProtobufCMessageInit) ecs__master__init, NULL,NULL,NULL /* reserved[123] */ }; diff --git a/tizen/src/ecs/genmsg/ecs.pb-c.h b/tizen/src/ecs/genmsg/ecs.pb-c.h index 97c52a3..a7ef93c 100644 --- a/tizen/src/ecs/genmsg/ecs.pb-c.h +++ b/tizen/src/ecs/genmsg/ecs.pb-c.h @@ -3,6 +3,7 @@ #ifndef PROTOBUF_C_ecs_2eproto__INCLUDED #define PROTOBUF_C_ecs_2eproto__INCLUDED +//#include #include "../../../distrib/protobuf/protobuf-c.h" PROTOBUF_C_BEGIN_DECLS @@ -22,6 +23,8 @@ typedef struct _ECS__DeviceNtf ECS__DeviceNtf; typedef struct _ECS__MonitorReq ECS__MonitorReq; 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__Master ECS__Master; @@ -201,6 +204,30 @@ struct _ECS__MonitorNtf , NULL, 0,{0,NULL} } +struct _ECS__NfcReq +{ + ProtobufCMessage base; + char *category; + protobuf_c_boolean has_data; + ProtobufCBinaryData data; +}; +#define ECS__NFC_REQ__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&ecs__nfc_req__descriptor) \ + , NULL, 0,{0,NULL} } + + +struct _ECS__NfcNtf +{ + ProtobufCMessage base; + char *category; + protobuf_c_boolean has_data; + ProtobufCBinaryData data; +}; +#define ECS__NFC_NTF__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&ecs__nfc_ntf__descriptor) \ + , NULL, 0,{0,NULL} } + + struct _ECS__Master { ProtobufCMessage base; @@ -218,10 +245,12 @@ struct _ECS__Master ECS__MonitorReq *monitor_req; ECS__MonitorAns *monitor_ans; ECS__MonitorNtf *monitor_ntf; + ECS__NfcReq *nfc_req; + ECS__NfcNtf *nfc_ntf; }; #define ECS__MASTER__INIT \ { PROTOBUF_C_MESSAGE_INIT (&ecs__master__descriptor) \ - , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } + , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } /* ECS__CheckVersionReq methods */ @@ -471,6 +500,44 @@ ECS__MonitorNtf * void ecs__monitor_ntf__free_unpacked (ECS__MonitorNtf *message, ProtobufCAllocator *allocator); +/* ECS__NfcReq methods */ +void ecs__nfc_req__init + (ECS__NfcReq *message); +size_t ecs__nfc_req__get_packed_size + (const ECS__NfcReq *message); +size_t ecs__nfc_req__pack + (const ECS__NfcReq *message, + uint8_t *out); +size_t ecs__nfc_req__pack_to_buffer + (const ECS__NfcReq *message, + ProtobufCBuffer *buffer); +ECS__NfcReq * + ecs__nfc_req__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void ecs__nfc_req__free_unpacked + (ECS__NfcReq *message, + ProtobufCAllocator *allocator); +/* ECS__NfcNtf methods */ +void ecs__nfc_ntf__init + (ECS__NfcNtf *message); +size_t ecs__nfc_ntf__get_packed_size + (const ECS__NfcNtf *message); +size_t ecs__nfc_ntf__pack + (const ECS__NfcNtf *message, + uint8_t *out); +size_t ecs__nfc_ntf__pack_to_buffer + (const ECS__NfcNtf *message, + ProtobufCBuffer *buffer); +ECS__NfcNtf * + ecs__nfc_ntf__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void ecs__nfc_ntf__free_unpacked + (ECS__NfcNtf *message, + ProtobufCAllocator *allocator); /* ECS__Master methods */ void ecs__master__init (ECS__Master *message); @@ -531,6 +598,12 @@ typedef void (*ECS__MonitorAns_Closure) typedef void (*ECS__MonitorNtf_Closure) (const ECS__MonitorNtf *message, void *closure_data); +typedef void (*ECS__NfcReq_Closure) + (const ECS__NfcReq *message, + void *closure_data); +typedef void (*ECS__NfcNtf_Closure) + (const ECS__NfcNtf *message, + void *closure_data); typedef void (*ECS__Master_Closure) (const ECS__Master *message, void *closure_data); @@ -553,6 +626,8 @@ extern const ProtobufCMessageDescriptor ecs__device_ntf__descriptor; extern const ProtobufCMessageDescriptor ecs__monitor_req__descriptor; 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__master__descriptor; PROTOBUF_C_END_DECLS diff --git a/tizen/src/ecs/genmsg/nfc.pb-c.c b/tizen/src/ecs/genmsg/nfc.pb-c.c deleted file mode 100644 index 5f4211c..0000000 --- a/tizen/src/ecs/genmsg/nfc.pb-c.c +++ /dev/null @@ -1,196 +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 "nfc.pb-c.h" -void ecs__nfc_req__init - (ECS__NfcReq *message) -{ - static ECS__NfcReq init_value = ECS__NFC_REQ__INIT; - *message = init_value; -} -size_t ecs__nfc_req__get_packed_size - (const ECS__NfcReq *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_req__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t ecs__nfc_req__pack - (const ECS__NfcReq *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_req__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t ecs__nfc_req__pack_to_buffer - (const ECS__NfcReq *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_req__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -ECS__NfcReq * - ecs__nfc_req__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (ECS__NfcReq *) - protobuf_c_message_unpack (&ecs__nfc_req__descriptor, - allocator, len, data); -} -void ecs__nfc_req__free_unpacked - (ECS__NfcReq *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_req__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void ecs__nfc_ntf__init - (ECS__NfcNtf *message) -{ - static ECS__NfcNtf init_value = ECS__NFC_NTF__INIT; - *message = init_value; -} -size_t ecs__nfc_ntf__get_packed_size - (const ECS__NfcNtf *message) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t ecs__nfc_ntf__pack - (const ECS__NfcNtf *message, - uint8_t *out) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t ecs__nfc_ntf__pack_to_buffer - (const ECS__NfcNtf *message, - ProtobufCBuffer *buffer) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -ECS__NfcNtf * - ecs__nfc_ntf__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (ECS__NfcNtf *) - protobuf_c_message_unpack (&ecs__nfc_ntf__descriptor, - allocator, len, data); -} -void ecs__nfc_ntf__free_unpacked - (ECS__NfcNtf *message, - ProtobufCAllocator *allocator) -{ - PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -static const ProtobufCFieldDescriptor ecs__nfc_req__field_descriptors[2] = -{ - { - "category", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__NfcReq, category), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "data", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_BYTES, - PROTOBUF_C_OFFSETOF(ECS__NfcReq, has_data), - PROTOBUF_C_OFFSETOF(ECS__NfcReq, data), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned ecs__nfc_req__field_indices_by_name[] = { - 0, /* field[0] = category */ - 1, /* field[1] = data */ -}; -static const ProtobufCIntRange ecs__nfc_req__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor ecs__nfc_req__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "ECS.NfcReq", - "NfcReq", - "ECS__NfcReq", - "ECS", - sizeof(ECS__NfcReq), - 2, - ecs__nfc_req__field_descriptors, - ecs__nfc_req__field_indices_by_name, - 1, ecs__nfc_req__number_ranges, - (ProtobufCMessageInit) ecs__nfc_req__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor ecs__nfc_ntf__field_descriptors[2] = -{ - { - "category", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - PROTOBUF_C_OFFSETOF(ECS__NfcNtf, category), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "data", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_BYTES, - PROTOBUF_C_OFFSETOF(ECS__NfcNtf, has_data), - PROTOBUF_C_OFFSETOF(ECS__NfcNtf, data), - NULL, - NULL, - 0, /* packed */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned ecs__nfc_ntf__field_indices_by_name[] = { - 0, /* field[0] = category */ - 1, /* field[1] = data */ -}; -static const ProtobufCIntRange ecs__nfc_ntf__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor ecs__nfc_ntf__descriptor = -{ - PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, - "ECS.NfcNtf", - "NfcNtf", - "ECS__NfcNtf", - "ECS", - sizeof(ECS__NfcNtf), - 2, - ecs__nfc_ntf__field_descriptors, - ecs__nfc_ntf__field_indices_by_name, - 1, ecs__nfc_ntf__number_ranges, - (ProtobufCMessageInit) ecs__nfc_ntf__init, - NULL,NULL,NULL /* reserved[123] */ -}; diff --git a/tizen/src/ecs/genmsg/nfc.pb-c.h b/tizen/src/ecs/genmsg/nfc.pb-c.h deleted file mode 100644 index b0ece62..0000000 --- a/tizen/src/ecs/genmsg/nfc.pb-c.h +++ /dev/null @@ -1,103 +0,0 @@ -/* Generated by the protocol buffer compiler. DO NOT EDIT! */ - -#ifndef PROTOBUF_C_nfc_2eproto__INCLUDED -#define PROTOBUF_C_nfc_2eproto__INCLUDED - -#include "../../../distrib/protobuf/protobuf-c.h" - -PROTOBUF_C_BEGIN_DECLS - -#include "ecs.pb-c.h" - -typedef struct _ECS__NfcReq ECS__NfcReq; -typedef struct _ECS__NfcNtf ECS__NfcNtf; - - -/* --- enums --- */ - - -/* --- messages --- */ - -struct _ECS__NfcReq -{ - ProtobufCMessage base; - char *category; - protobuf_c_boolean has_data; - ProtobufCBinaryData data; -}; -#define ECS__NFC_REQ__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&ecs__nfc_req__descriptor) \ - , NULL, 0,{0,NULL} } - - -struct _ECS__NfcNtf -{ - ProtobufCMessage base; - char *category; - protobuf_c_boolean has_data; - ProtobufCBinaryData data; -}; -#define ECS__NFC_NTF__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&ecs__nfc_ntf__descriptor) \ - , NULL, 0,{0,NULL} } - - -/* ECS__NfcReq methods */ -void ecs__nfc_req__init - (ECS__NfcReq *message); -size_t ecs__nfc_req__get_packed_size - (const ECS__NfcReq *message); -size_t ecs__nfc_req__pack - (const ECS__NfcReq *message, - uint8_t *out); -size_t ecs__nfc_req__pack_to_buffer - (const ECS__NfcReq *message, - ProtobufCBuffer *buffer); -ECS__NfcReq * - ecs__nfc_req__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void ecs__nfc_req__free_unpacked - (ECS__NfcReq *message, - ProtobufCAllocator *allocator); -/* ECS__NfcNtf methods */ -void ecs__nfc_ntf__init - (ECS__NfcNtf *message); -size_t ecs__nfc_ntf__get_packed_size - (const ECS__NfcNtf *message); -size_t ecs__nfc_ntf__pack - (const ECS__NfcNtf *message, - uint8_t *out); -size_t ecs__nfc_ntf__pack_to_buffer - (const ECS__NfcNtf *message, - ProtobufCBuffer *buffer); -ECS__NfcNtf * - ecs__nfc_ntf__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void ecs__nfc_ntf__free_unpacked - (ECS__NfcNtf *message, - ProtobufCAllocator *allocator); -/* --- per-message closures --- */ - -typedef void (*ECS__NfcReq_Closure) - (const ECS__NfcReq *message, - void *closure_data); -typedef void (*ECS__NfcNtf_Closure) - (const ECS__NfcNtf *message, - void *closure_data); - -/* --- services --- */ - - -/* --- descriptors --- */ - -extern const ProtobufCMessageDescriptor ecs__nfc_req__descriptor; -extern const ProtobufCMessageDescriptor ecs__nfc_ntf__descriptor; - -PROTOBUF_C_END_DECLS - - -#endif /* PROTOBUF_nfc_2eproto__INCLUDED */ diff --git a/tizen/src/ecs/msg/ecs.proto b/tizen/src/ecs/msg/ecs.proto index 461c8bb..974a696 100644 --- a/tizen/src/ecs/msg/ecs.proto +++ b/tizen/src/ecs/msg/ecs.proto @@ -2,9 +2,9 @@ import "ecs_ids.proto"; package ECS; - option java_package = "org.tizen.ecp.msg.genmsg.ecs"; +// ======= Messages ======= message CheckVersionReq { required string version_str = 1; @@ -92,6 +92,19 @@ message MonitorNtf { optional bytes data = 2; } +// ======= Extensions messages ======= + +message NfcReq { + required string category = 1; + optional bytes data = 2; +} + +message NfcNtf { + required string category = 1; + optional bytes data = 2; +} + +// ======= Main master message ======= message Master { required Master_Type type = 1; @@ -114,7 +127,9 @@ message Master { optional MonitorAns monitor_ans = 13; optional MonitorNtf monitor_ntf = 14; - extensions 101 to 150; + // Extensions 101 to 150; + optional NfcReq nfc_req = 101; + optional NfcNtf nfc_ntf = 102; } diff --git a/tizen/src/ecs/msg/nfc.proto b/tizen/src/ecs/msg/nfc.proto deleted file mode 100644 index 018c558..0000000 --- a/tizen/src/ecs/msg/nfc.proto +++ /dev/null @@ -1,21 +0,0 @@ -import "ecs.proto"; - -package ECS; - -message NfcReq { - required string category = 1; - optional bytes data = 2; -} - -message NfcNtf { - required string category = 1; - optional bytes data = 2; -} - - -extend Master { - optional NfcReq nfc_req = 101; - optional NfcNtf nfc_ntf = 102; -} - - diff --git a/tizen/src/guest_server.c b/tizen/src/guest_server.c index c8e0d53..98933a4 100644 --- a/tizen/src/guest_server.c +++ b/tizen/src/guest_server.c @@ -137,7 +137,8 @@ static void send_to_client(GS_Client* client, int state) memset(buf, 0, sizeof(buf)); - sprintf(buf, "%d\n", state); + // send message "[4 digit message length]host:sync:emulator-26101:[0|1]" + sprintf(buf, "0026host:sync:emulator-%d:%d", svr_port, state); if (sendto(s, buf, sizeof(buf), 0, (struct sockaddr*)&sock_addr, slen) == -1) { -- 2.7.4