diff options
author | daiyoung kim <daiyoung777.kim@samsung.com> | 2013-10-17 18:57:28 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.vlan103.tizen.org> | 2013-10-17 18:57:28 -0700 |
commit | 769b915065e4030b9ecca78c87e11b616a373435 (patch) | |
tree | b2ad6c8ea374a3f2c472f2e31df94fafa23f4452 /tizen | |
parent | cb2223b663cdbc2d46b066a8d2c46e605d1e2f0a (diff) | |
parent | 0032f6c6ac43f01a95e6cd8de3841ca567160694 (diff) | |
download | qemu-769b915065e4030b9ecca78c87e11b616a373435.tar.gz qemu-769b915065e4030b9ecca78c87e11b616a373435.tar.bz2 qemu-769b915065e4030b9ecca78c87e11b616a373435.zip |
Merge "nfc: arrange message format" into tizen
Diffstat (limited to 'tizen')
-rw-r--r-- | tizen/src/ecs/ecs.c | 12 | ||||
-rw-r--r-- | tizen/src/ecs/ecs.h | 1 | ||||
-rw-r--r-- | tizen/src/ecs/ecs_msg.c | 11 |
3 files changed, 20 insertions, 4 deletions
diff --git a/tizen/src/ecs/ecs.c b/tizen/src/ecs/ecs.c index e83bad52cc..1a2a1a2d32 100644 --- a/tizen/src/ecs/ecs.c +++ b/tizen/src/ecs/ecs.c @@ -208,6 +208,18 @@ bool ntf_to_monitor(const char* data, const int len) { return true; } +void print_binary(const char* data, const int len) { + int i; + printf("[DATA: "); + for(i = 0; i < len; i++) { + if(i == len - 1) { + printf("%02x]\n", data[i]); + } else { + printf("%02x,", data[i]); + } + } +} + void ecs_make_header(QDict* obj, type_length length, type_group group, type_action action) { qdict_put(obj, "length", qint_from_int((int64_t )length)); diff --git a/tizen/src/ecs/ecs.h b/tizen/src/ecs/ecs.h index a4c200cfa9..8f874cc5bc 100644 --- a/tizen/src/ecs/ecs.h +++ b/tizen/src/ecs/ecs.h @@ -185,6 +185,7 @@ void ecs_make_header(QDict* obj, type_length length, type_group group, type_acti void read_val_short(const char* data, unsigned short* ret_val); void read_val_char(const char* data, unsigned char* ret_val); void read_val_str(const char* data, char* ret_val, int len); +void print_binary(const char* data, const int len); bool msgproc_injector_req(ECS_Client* ccli, ECS__InjectorReq* msg); bool msgproc_monitor_req(ECS_Client *ccli, ECS__MonitorReq* msg); diff --git a/tizen/src/ecs/ecs_msg.c b/tizen/src/ecs/ecs_msg.c index ee128b6703..2f1b095c6c 100644 --- a/tizen/src/ecs/ecs_msg.c +++ b/tizen/src/ecs/ecs_msg.c @@ -316,6 +316,8 @@ bool msgproc_nfc_req(ECS_Client* ccli, ECS__NfcReq* msg) if (msg->has_data && msg->data.len > 0) { data = (char*)msg->data.data; + printf("recv from nfc injector: "); + print_binary(data, data[1] + 2); } if (!strncmp(cmd, MSG_TYPE_NFC, 3)) { @@ -509,9 +511,9 @@ bool send_nfc_ntf(const char* data, const int len) read_val_str(data, cat, catsize); - const char* ijdata = (data + catsize + 2); + const char* ijdata = data + catsize; - LOG("<< header cat = %s", cat); + LOG("header category = %s", cat); ECS__Master master = ECS__MASTER__INIT; ECS__NfcNtf ntf = ECS__NFC_NTF__INIT; @@ -525,8 +527,9 @@ bool send_nfc_ntf(const char* data, const int len) ntf.data.len = MAX_BUF_SIZE; memcpy(ntf.data.data, ijdata, MAX_BUF_SIZE); - LOG("data = %s, length = %d", ijdata, len); - + LOG("length = %d", len); + printf("send to nfc injector: "); + print_binary(ijdata, ijdata[1] + 2); master.type = ECS__MASTER__TYPE__NFC_NTF; master.nfc_ntf = &ntf; |