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 */
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());
};
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
{
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)