if (inst->m_sensor_id) {
if (get_client_info_manager().has_sensor_record(inst->m_client_id, inst->m_sensor_id)) {
- INFO("Removing sensor[0x%x] record for client_id[%d]", inst->m_sensor_id, inst->m_client_id);
+ INFO("Removing sensor[0x%llx] record for client_id[%d]", inst->m_sensor_id, inst->m_client_id);
get_client_info_manager().remove_sensor_record(inst->m_client_id, inst->m_sensor_id);
}
}
}
if (!is_permission_allowed()) {
- ERR("Permission denied to connect sensor[0x%x] for client [%d]", m_sensor_id, m_client_id);
+ ERR("Permission denied to connect sensor[0x%llx] for client [%d]", m_sensor_id, m_client_id);
ret_value = OP_ERROR;
goto out;
}
- DBG("Hello sensor [0x%x], client id [%d]", m_sensor_id, m_client_id);
+ DBG("Hello sensor [0x%llx], client id [%d]", m_sensor_id, m_client_id);
get_client_info_manager().create_sensor_record(m_client_id, m_sensor_id);
- INFO("New sensor record created for sensor [0x%x], sensor name [%s] on client id [%d]\n", m_sensor_id, m_module->get_name(), m_client_id);
+ INFO("New sensor record created for sensor [0x%llx], sensor name [%s] on client id [%d]\n", m_sensor_id, m_module->get_name(), m_client_id);
ret_value = OP_SUCCESS;
out:
if (!send_cmd_done(ret_value))
long ret_value = OP_ERROR;
if (!is_permission_allowed()) {
- ERR("Permission denied to stop sensor[0x%x] for client [%d]", m_sensor_id, m_client_id);
+ ERR("Permission denied to stop sensor[0x%llx] for client [%d]", m_sensor_id, m_client_id);
ret_value = OP_ERROR;
goto out;
}
- DBG("CMD_BYEBYE for client [%d], sensor [0x%x]", m_client_id, m_sensor_id);
+ DBG("CMD_BYEBYE for client [%d], sensor [0x%llx]", m_client_id, m_sensor_id);
if (!get_client_info_manager().remove_sensor_record(m_client_id, m_sensor_id)) {
ERR("Error removing sensor_record for client [%d]", m_client_id);
long ret_value = OP_ERROR;
if (!is_permission_allowed()) {
- ERR("Permission denied to start sensor[0x%x] for client [%d]", m_sensor_id, m_client_id);
+ ERR("Permission denied to start sensor[0x%llx] for client [%d]", m_sensor_id, m_client_id);
ret_value = OP_ERROR;
goto out;
}
- DBG("START Sensor [0x%x], called from client [%d]", m_sensor_id, m_client_id);
+ DBG("START Sensor [0x%llx], called from client [%d]", m_sensor_id, m_client_id);
if (m_module->start()) {
get_client_info_manager().set_start(m_client_id, m_sensor_id, true);
get_event_dispathcher().request_last_event(m_client_id, m_sensor_id);
ret_value = OP_SUCCESS;
} else {
- ERR("Failed to start sensor [0x%x] for client [%d]", m_sensor_id, m_client_id);
+ ERR("Failed to start sensor [0x%llx] for client [%d]", m_sensor_id, m_client_id);
ret_value = OP_ERROR;
}
long ret_value = OP_ERROR;
if (!is_permission_allowed()) {
- ERR("Permission denied to stop sensor[0x%x] for client [%d]", m_sensor_id, m_client_id);
+ ERR("Permission denied to stop sensor[0x%llx] for client [%d]", m_sensor_id, m_client_id);
ret_value = OP_ERROR;
goto out;
}
- DBG("STOP Sensor [0x%x], called from client [%d]", m_sensor_id, m_client_id);
+ DBG("STOP Sensor [0x%llx], called from client [%d]", m_sensor_id, m_client_id);
if (m_module->stop()) {
get_client_info_manager().set_start(m_client_id, m_sensor_id, false);
ret_value = OP_SUCCESS;
} else {
- ERR("Failed to stop sensor [0x%x] for client [%d]", m_sensor_id, m_client_id);
+ ERR("Failed to stop sensor [0x%llx] for client [%d]", m_sensor_id, m_client_id);
ret_value = OP_ERROR;
}
cmd = (cmd_set_batch_t*)payload;
if (!is_permission_allowed()) {
- ERR("Permission denied to set batch for client [%d], for sensor [0x%x] with batch [%d, %d] to client info manager",
+ ERR("Permission denied to set batch for client [%d], for sensor [0x%llx] with batch [%d, %d] to client info manager",
m_client_id, m_sensor_id, cmd->interval, cmd->latency);
ret_value = OP_ERROR;
goto out;
}
if (!get_client_info_manager().set_batch(m_client_id, m_sensor_id, cmd->interval, cmd->latency)) {
- ERR("Failed to set batch for client [%d], for sensor [0x%x] with batch [%d, %d] to client info manager",
+ ERR("Failed to set batch for client [%d], for sensor [0x%llx] with batch [%d, %d] to client info manager",
m_client_id, m_sensor_id, cmd->interval, cmd->latency);
ret_value = OP_ERROR;
goto out;
}
if (!m_module->add_interval(m_client_id, cmd->interval, false)) {
- ERR("Failed to set interval for client [%d], for sensor [0x%x] with interval [%d]",
+ ERR("Failed to set interval for client [%d], for sensor [0x%llx] with interval [%d]",
m_client_id, m_sensor_id, cmd->interval);
ret_value = OP_ERROR;
goto out;
}
if (!m_module->add_batch(m_client_id, cmd->latency)) {
- ERR("Failed to set latency for client [%d], for sensor [0x%x] with latency [%d]",
+ ERR("Failed to set latency for client [%d], for sensor [0x%llx] with latency [%d]",
m_client_id, m_sensor_id, cmd->latency);
ret_value = OP_ERROR;
goto out;
long ret_value = OP_ERROR;
if (!is_permission_allowed()) {
- ERR("Permission denied to unset batch for client [%d], for sensor [0x%x] to client info manager",
+ ERR("Permission denied to unset batch for client [%d], for sensor [0x%llx] to client info manager",
m_client_id, m_sensor_id);
ret_value = OP_ERROR;
goto out;
}
if (!get_client_info_manager().set_batch(m_client_id, m_sensor_id, 0, 0)) {
- ERR("Failed to unset batch for client [%d], for sensor [0x%x] to client info manager",
+ ERR("Failed to unset batch for client [%d], for sensor [0x%llx] to client info manager",
m_client_id, m_sensor_id);
ret_value = OP_ERROR;
goto out;
cmd = (cmd_set_option_t*)payload;
if (!is_permission_allowed()) {
- ERR("Permission denied to set interval for client [%d], for sensor [0x%x] with option [%d] to client info manager",
+ ERR("Permission denied to set interval for client [%d], for sensor [0x%llx] with option [%d] to client info manager",
m_client_id, m_sensor_id, cmd->option);
ret_value = OP_ERROR;
goto out;
}
if (!get_client_info_manager().set_option(m_client_id, m_sensor_id, cmd->option)) {
- ERR("Failed to set option for client [%d], for sensor [0x%x] with option [%d] to client info manager",
+ ERR("Failed to set option for client [%d], for sensor [0x%llx] with option [%d] to client info manager",
m_client_id, m_sensor_id, cmd->option);
ret_value = OP_ERROR;
goto out;
cmd = (cmd_set_wakeup_t*)payload;
if (!is_permission_allowed()) {
- ERR("Permission denied to set wakeup for client [%d], for sensor [0x%x] with wakeup [%d] to client info manager",
+ ERR("Permission denied to set wakeup for client [%d], for sensor [0x%llx] with wakeup [%d] to client info manager",
m_client_id, m_sensor_id, cmd->wakeup);
ret_value = OP_ERROR;
goto out;
}
if (!get_client_info_manager().set_wakeup(m_client_id, m_sensor_id, cmd->wakeup)) {
- ERR("Failed to set wakeup for client [%d], for sensor [0x%x] with wakeup [%d] to client info manager",
+ ERR("Failed to set wakeup for client [%d], for sensor [0x%llx] with wakeup [%d] to client info manager",
m_client_id, m_sensor_id, cmd->wakeup);
ret_value = OP_ERROR;
goto out;
cmd = (cmd_set_command_t*)payload;
if (!is_permission_allowed()) {
- ERR("Permission denied to set command for client [%d], for sensor [0x%x] with cmd [%d]",
+ ERR("Permission denied to set command for client [%d], for sensor [0x%llx] with cmd [%d]",
m_client_id, m_sensor_id, cmd->cmd);
ret_value = OP_ERROR;
goto out;
DBG("CMD_GET_VALUE Handler invoked\n");
if (!is_permission_allowed()) {
- ERR("Permission denied to get data for client [%d], for sensor [0x%x]",
+ ERR("Permission denied to get data for client [%d], for sensor [0x%llx]",
m_client_id, m_sensor_id);
state = OP_ERROR;
goto out;
}
while (!state && !data.timestamp && (retry++ < RETRY_CNT)) {
- INFO("Wait sensor[0x%x] data updated for client [%d] #%d", m_sensor_id, m_client_id, retry);
+ INFO("Wait sensor[0x%llx] data updated for client [%d] #%d", m_sensor_id, m_client_id, retry);
usleep((retry == 1) ? INIT_WAIT_TIME : WAIT_TIME);
state = m_module->get_sensor_data(data);
}
state = OP_ERROR;
if (state) {
- ERR("Failed to get data for client [%d], for sensor [0x%x]",
+ ERR("Failed to get data for client [%d], for sensor [0x%llx]",
m_client_id, m_sensor_id);
}
cmd = (cmd_send_sensorhub_data_t*)payload;
if (!is_permission_allowed()) {
- ERR("Permission denied to send sensorhub_data for client [%d], for sensor [0x%x]",
+ ERR("Permission denied to send sensorhub_data for client [%d], for sensor [0x%llx]",
m_client_id, m_sensor_id);
ret_value = OP_ERROR;
goto out;
cur_min = m_plugin_info_list.get_min_interval();
if (cur_min != prev_min) {
- INFO("Min interval for sensor[0x%x] is changed from %dms to %dms"
+ INFO("Min interval for sensor[0x%llx] is changed from %dms to %dms"
" by%sclient[%d] adding interval",
get_id(), prev_min, cur_min,
is_processor ? " processor " : " ", client_id);
cur_min = m_plugin_info_list.get_min_interval();
if (!cur_min) {
- INFO("No interval for sensor[0x%x] by%sclient[%d] deleting interval, "
+ INFO("No interval for sensor[0x%llx] by%sclient[%d] deleting interval, "
"so set to default %dms",
get_id(), is_processor ? " processor " : " ",
client_id, POLL_1HZ_MS);
set_interval(POLL_1HZ_MS);
} else if (cur_min != prev_min) {
- INFO("Min interval for sensor[0x%x] is changed from %dms to %dms"
+ INFO("Min interval for sensor[0x%llx] is changed from %dms to %dms"
" by%sclient[%d] deleting interval",
get_id(), prev_min, cur_min,
is_processor ? " processor " : " ", client_id);
cur_max = m_plugin_info_list.get_max_batch();
if (cur_max != prev_max) {
- INFO("Max latency for sensor[0x%x] is changed from %dms to %dms by client[%d] adding latency",
+ INFO("Max latency for sensor[0x%llx] is changed from %dms to %dms by client[%d] adding latency",
get_id(), prev_max, cur_max, client_id);
set_batch(cur_max);
}
cur_max = m_plugin_info_list.get_max_batch();
if (!cur_max) {
- INFO("No latency for sensor[0x%x] by client[%d] deleting latency, so set to default 0 ms",
+ INFO("No latency for sensor[0x%llx] by client[%d] deleting latency, so set to default 0 ms",
get_id(), client_id);
set_batch(0);
} else if (cur_max != prev_max) {
- INFO("Max latency for sensor[0x%x] is changed from %dms to %dms by client[%d] deleting latency",
+ INFO("Max latency for sensor[0x%llx] is changed from %dms to %dms by client[%d] deleting latency",
get_id(), prev_max, cur_max, client_id);
set_batch(cur_max);
cur_wakeup = m_plugin_info_list.is_wakeup_on();
if ((cur_wakeup == SENSOR_WAKEUP_ON) && (prev_wakeup < SENSOR_WAKEUP_ON)) {
- INFO("Wakeup for sensor[0x%x] is changed from %d to %d by client[%d] adding wakeup",
+ INFO("Wakeup for sensor[0x%llx] is changed from %d to %d by client[%d] adding wakeup",
get_id(), prev_wakeup, cur_wakeup, client_id);
set_wakeup(SENSOR_WAKEUP_ON);
}
cur_wakeup = m_plugin_info_list.is_wakeup_on();
if ((cur_wakeup < SENSOR_WAKEUP_ON) && (prev_wakeup == SENSOR_WAKEUP_ON)) {
- INFO("Wakeup for sensor[0x%x] is changed from %d to %d by client[%d] deleting wakeup",
+ INFO("Wakeup for sensor[0x%llx] is changed from %d to %d by client[%d] deleting wakeup",
get_id(), prev_wakeup, cur_wakeup, client_id);
set_wakeup(SENSOR_WAKEUP_OFF);
}
void sensor_info::get_raw_data(raw_data_t &data)
{
- put(data, (int)m_type);
- put(data, (int) m_id);
+ put(data, (int) m_type);
+ put(data, (int64_t) (m_id));
put(data, (int) m_privilege);
put(data, m_name);
put(data, m_vendor);
auto it_r_data = raw_data.begin();
- int type, id, privilege;
+ int type, privilege;
+ int64_t id;
it_r_data = get(it_r_data, type);
m_type = (sensor_type_t) type;
void sensor_info::show(void)
{
INFO("Type = %d", m_type);
- INFO("ID = 0x%x", (int)m_id);
+ INFO("ID = 0x%llx", (uint64_t)m_id);
INFO("Privilege = %d", (int)m_privilege);
INFO("Name = %s", m_name.c_str());
INFO("Vendor = %s", m_vendor.c_str());
copy(&buffer[0], &buffer[sizeof(buffer)], back_inserter(data));
}
+void sensor_info::put(raw_data_t &data, int64_t value)
+{
+ char buffer[sizeof(value)];
+
+ int64_t *temp = (int64_t *) buffer;
+ *temp = value;
+
+ copy(&buffer[0], &buffer[sizeof(buffer)], back_inserter(data));
+}
+
void sensor_info::put(raw_data_t &data, float value)
{
char buffer[sizeof(value)];
return it + sizeof(value);
}
+raw_data_iterator sensor_info::get(raw_data_iterator it, int64_t &value)
+{
+ copy(it, it + sizeof(value), (char*) &value);
+
+ return it + sizeof(value);
+}
+
raw_data_iterator sensor_info::get(raw_data_iterator it, float &value)
{
copy(it, it + sizeof(value), (char*) &value);