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
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;
}
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;
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;
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:
#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);
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;
QDict *input, *args;
const mon_cmd_t *cmd;
const char *cmd_name;
+ const char *type_name;
Monitor *mon = cur_mon;
ECS_Client *clii = opaque;
goto err_out;
}
+ type_name = qdict_get_str(qobject_to_qdict(obj), COMMANDS_TYPE);
+
obj = qdict_get(input, "arguments");
if (!obj) {
args = qdict_new();
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;
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)
{
(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",
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 */
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 =
{
"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] */
};
#ifndef PROTOBUF_C_ecs_2eproto__INCLUDED
#define PROTOBUF_C_ecs_2eproto__INCLUDED
+//#include <google/protobuf-c/protobuf-c.h>
#include "../../../distrib/protobuf/protobuf-c.h"
PROTOBUF_C_BEGIN_DECLS
typedef struct _ECS__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;
, 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;
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 */
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);
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);
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
+++ /dev/null
-/* Generated by the protocol buffer compiler. DO NOT EDIT! */
-
-/* Do not generate deprecated warnings for self */
-#ifndef PROTOBUF_C_NO_DEPRECATED
-#define PROTOBUF_C_NO_DEPRECATED
-#endif
-
-#include "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] */
-};
+++ /dev/null
-/* 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 */
package ECS;
-
option java_package = "org.tizen.ecp.msg.genmsg.ecs";
+// ======= Messages =======
message CheckVersionReq {
required string version_str = 1;
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;
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;
}
+++ /dev/null
-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;
-}
-
-
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)
{