From b1f948963a0af894e608175d52a4ac8a5f43983b Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Fri, 18 Dec 2015 10:30:46 +0900 Subject: [PATCH] Revert "sensord: extra data embedding" This reverts commit 8baf020bc0e5ecff210e01a362560111edbefd4c. Signed-off-by: kibak.yoon Change-Id: I8ad082398dac42728e1ea321972527ab663e4804 --- src/client/csensor_event_listener.cpp | 3 --- src/server/csensor_event_dispatcher.cpp | 16 ++-------------- src/shared/sensor_common.h | 7 ------- src/shared/sensor_logs.cpp | 3 --- 4 files changed, 2 insertions(+), 27 deletions(-) mode change 100644 => 100755 src/server/csensor_event_dispatcher.cpp mode change 100644 => 100755 src/shared/sensor_common.h diff --git a/src/client/csensor_event_listener.cpp b/src/client/csensor_event_listener.cpp index 053ae17..aad9c89 100644 --- a/src/client/csensor_event_listener.cpp +++ b/src/client/csensor_event_listener.cpp @@ -196,9 +196,6 @@ void csensor_event_listener::handle_events(void* event) event_data.event_data = &(sensor_event->data); event_data.event_data_size = sizeof(sensor_event->data); } - - if (sensor_event->data.extra_data_size > 0) - sensor_event->data.extra_data = (void *)event + sizeof(sensor_event_t); } { /* scope for the lock */ diff --git a/src/server/csensor_event_dispatcher.cpp b/src/server/csensor_event_dispatcher.cpp old mode 100644 new mode 100755 index e82b6e2..605b9e7 --- a/src/server/csensor_event_dispatcher.cpp +++ b/src/server/csensor_event_dispatcher.cpp @@ -227,22 +227,10 @@ void csensor_event_dispatcher::send_sensor_events(void* events, int event_cnt, b bool ret; - if (is_hub_event) { + if (is_hub_event) ret = (client_socket.send(sensor_hub_events + i, sizeof(sensorhub_event_t)) > 0); - } else if (sensor_events[i].data.extra_data_size > 0) { - void *extended_event; - int extended_size = sizeof(sensor_event_t) + sensor_events[i].data.extra_data_size; - - extended_event = (void *)malloc(extended_size); - memcpy(extended_event, sensor_events + i, sizeof(sensor_event_t)); - memcpy(extended_event + sizeof(sensor_event_t), sensor_events[i].data.extra_data, sensor_events[i].data.extra_data_size); - - ret = (client_socket.send(extended_event, extended_size) > 0); - - free(extended_event); - } else { + else ret = (client_socket.send(sensor_events + i, sizeof(sensor_event_t)) > 0); - } if (ret) DBG("Event[0x%x] sent to %s on socket[%d]", event_type, client_info_manager.get_client_info(*it_client_id), client_socket.get_socket_fd()); diff --git a/src/shared/sensor_common.h b/src/shared/sensor_common.h old mode 100644 new mode 100755 index 170c26e..02cbfd3 --- a/src/shared/sensor_common.h +++ b/src/shared/sensor_common.h @@ -82,13 +82,6 @@ typedef struct sensor_data_t { }; float values[SENSOR_DATA_VALUE_SIZE]; - -/* - * If extra_data_size > 0, - * then use extra_data. - */ - int extra_data_size; - void *extra_data; } sensor_data_t; #define SENSOR_HUB_DATA_SIZE 4096 diff --git a/src/shared/sensor_logs.cpp b/src/shared/sensor_logs.cpp index 28e19bb..4be987f 100644 --- a/src/shared/sensor_logs.cpp +++ b/src/shared/sensor_logs.cpp @@ -185,9 +185,6 @@ void copy_sensor_data(sensor_data_t *dest, sensor_data_t *src) { memcpy(dest, src, offsetof(sensor_data_t, values)); memcpy(dest->values, src->values, src->value_count * sizeof(src->values[0])); - - dest->extra_data_size = src->extra_data_size; - dest->extra_data = src->extra_data; } void copy_sensorhub_data(sensorhub_data_t *dest, sensorhub_data_t *src) -- 2.7.4