4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #include <sensor_common.h>
21 #include <command_common.h>
22 #include <sensor_loader.h>
23 #include <sensor_info.h>
24 #include <sensor_log.h>
29 #include <permission_checker.h>
30 #include <command_worker.h>
32 #define WAIT_TIME(X) ((1 << ((X) < 4 ? (X) : 4)) * 10000) /* 20, 40, 80, 160, 160ms, ... */
38 command_worker::cmd_handler_t command_worker::m_cmd_handlers[];
39 sensor_raw_data_map command_worker::m_sensor_raw_data_map;
40 cpacket command_worker::m_sensor_list;
41 cmutex command_worker::m_shared_mutex;
43 command_worker::command_worker(const csocket& socket)
44 : m_client_id(CLIENT_ID_INVALID)
45 , m_permission(SENSOR_PERMISSION_NONE)
48 , m_sensor_id(UNKNOWN_SENSOR)
50 static bool init = false;
52 AUTOLOCK(m_shared_mutex);
60 m_worker.set_context(this);
61 m_worker.set_working(working);
62 m_worker.set_stopped(stopped);
65 command_worker::~command_worker()
70 bool command_worker::start(void)
72 return m_worker.start();
75 void command_worker::init_cmd_handlers(void)
77 m_cmd_handlers[CMD_GET_ID] = &command_worker::cmd_get_id;
78 m_cmd_handlers[CMD_GET_SENSOR_LIST] = &command_worker::cmd_get_sensor_list;
79 m_cmd_handlers[CMD_HELLO] = &command_worker::cmd_hello;
80 m_cmd_handlers[CMD_BYEBYE] = &command_worker::cmd_byebye;
81 m_cmd_handlers[CMD_START] = &command_worker::cmd_start;
82 m_cmd_handlers[CMD_STOP] = &command_worker::cmd_stop;
83 m_cmd_handlers[CMD_REG] = &command_worker::cmd_register_event;
84 m_cmd_handlers[CMD_UNREG] = &command_worker::cmd_unregister_event;
85 m_cmd_handlers[CMD_SET_PAUSE_POLICY] = &command_worker::cmd_set_pause_policy;
86 m_cmd_handlers[CMD_SET_BATCH] = &command_worker::cmd_set_batch;
87 m_cmd_handlers[CMD_UNSET_BATCH] = &command_worker::cmd_unset_batch;
88 m_cmd_handlers[CMD_GET_DATA] = &command_worker::cmd_get_data;
89 m_cmd_handlers[CMD_SET_ATTRIBUTE_INT] = &command_worker::cmd_set_attribute_int;
90 m_cmd_handlers[CMD_SET_ATTRIBUTE_STR] = &command_worker::cmd_set_attribute_str;
91 m_cmd_handlers[CMD_FLUSH] = &command_worker::cmd_flush;
94 size_t command_worker::create_sensor_raw_list(int client_perms, std::vector<raw_data_t *> &raw_list)
96 size_t total_raw_data_size = 0;
97 vector<sensor_base *> sensors;
98 vector<sensor_type_t> types;
102 types = sensor_loader::get_instance().get_sensor_types();
104 for (auto it_type = types.begin(); it_type != types.end(); ++it_type) {
105 sensor_type_t type = *it_type;
106 sensors = sensor_loader::get_instance().get_sensors(type);
108 for (auto it_sensor = sensors.begin(); it_sensor != sensors.end(); ++it_sensor) {
109 (*it_sensor)->get_sensor_info(info);
110 permission = (*it_sensor)->get_permission();
111 permission = (client_perms & permission);
115 info.set_id((sensor_id_t)-EACCES);
119 raw_data_t *raw_data = new(std::nothrow) raw_data_t();
120 retvm_if(!raw_data, -1, "Failed to allocated memory");
121 info.get_raw_data(*raw_data);
123 total_raw_data_size += raw_data->size();
124 raw_list.push_back(raw_data);
130 return total_raw_data_size;
133 void command_worker::get_sensor_list(int client_perms, cpacket &sensor_list)
135 size_t total_raw_data_size = 0;
136 vector<raw_data_t *> raw_list;
140 total_raw_data_size = create_sensor_raw_list(client_perms, raw_list);
142 sensor_cnt = raw_list.size();
144 sensor_list.set_payload_size(sizeof(cmd_get_sensor_list_done_t) + (sizeof(size_t) * sensor_cnt) + total_raw_data_size);
145 sensor_list.set_cmd(CMD_GET_SENSOR_LIST);
147 cmd_get_sensor_list_done_t *cmd_get_sensor_list_done;
149 cmd_get_sensor_list_done = (cmd_get_sensor_list_done_t*)sensor_list.data();
150 cmd_get_sensor_list_done->sensor_cnt = sensor_cnt;
151 size_t* size_field = (size_t *) cmd_get_sensor_list_done->data;
153 for (int i = 0; i < sensor_cnt; ++i)
154 size_field[i] = raw_list[i]->size();
156 char* raw_data_field = cmd_get_sensor_list_done->data + (sizeof(size_t) * sensor_cnt);
158 for (int i = 0; i < sensor_cnt; ++i) {
159 copy(raw_list[i]->begin(), raw_list[i]->end(), raw_data_field + idx);
160 idx += raw_list[i]->size();
163 for (auto it = raw_list.begin(); it != raw_list.end(); ++it)
167 bool command_worker::working(void *ctx)
170 command_worker *inst = (command_worker *)ctx;
172 packet_header header;
175 if (inst->m_socket.recv(&header, sizeof(header)) <= 0) {
177 inst->get_info(info);
178 _D("%s failed to receive header", info.c_str());
182 if (header.size > 0) {
183 payload = new(std::nothrow) char[header.size];
184 retvm_if(!payload, false, "Failed to allocate memory");
186 if (inst->m_socket.recv(payload, header.size) <= 0) {
188 inst->get_info(info);
189 _D("%s failed to receive data of packet", info.c_str());
197 ret = inst->dispatch_command(header.cmd, payload);
205 bool command_worker::stopped(void *ctx)
208 command_worker *inst = (command_worker *)ctx;
210 inst->get_info(info);
211 _I("%s is stopped", info.c_str());
213 if ((inst->m_module) && (inst->m_client_id != CLIENT_ID_INVALID)) {
214 if (get_client_info_manager().is_started(inst->m_client_id, inst->m_sensor_id)) {
215 _W("Does not receive cmd_stop before connection broken for [%s]!!", inst->m_module->get_name());
216 inst->m_module->delete_interval(inst->m_client_id, false);
217 inst->m_module->delete_batch(inst->m_client_id);
218 inst->m_module->delete_attribute(inst->m_client_id);
219 inst->m_module->stop();
222 if (inst->m_sensor_id > UNKNOWN_SENSOR) {
223 if (get_client_info_manager().has_sensor_record(inst->m_client_id, inst->m_sensor_id)) {
224 _I("Removing sensor[%#llx] record for client_id[%d]", inst->m_sensor_id, inst->m_client_id);
225 get_client_info_manager().remove_sensor_record(inst->m_client_id, inst->m_sensor_id);
234 bool command_worker::dispatch_command(int cmd, void* payload)
238 if (!(cmd > 0 && cmd < CMD_CNT)) {
239 _E("Unknown command: %d", cmd);
241 cmd_handler_t cmd_handler;
242 cmd_handler = command_worker::m_cmd_handlers[cmd];
244 ret = (this->*cmd_handler)(payload);
250 bool command_worker::send_cmd_done(long value)
253 cmd_done_t *cmd_done;
255 ret_packet = new(std::nothrow) cpacket(sizeof(cmd_done_t));
256 retvm_if(!ret_packet, false, "Failed to allocate memory");
258 ret_packet->set_cmd(CMD_DONE);
260 cmd_done = (cmd_done_t*)ret_packet->data();
261 cmd_done->value = value;
263 if (m_socket.send(ret_packet->packet(), ret_packet->size()) <= 0) {
264 _E("Failed to send a cmd_done to client_id [%d] with value [%ld]", m_client_id, value);
273 bool command_worker::send_cmd_get_id_done(int client_id)
276 cmd_get_id_done_t *cmd_get_id_done;
278 ret_packet = new(std::nothrow) cpacket(sizeof(cmd_get_id_done_t));
279 retvm_if(!ret_packet, false, "Failed to allocate memory");
281 ret_packet->set_cmd(CMD_GET_ID);
283 cmd_get_id_done = (cmd_get_id_done_t*)ret_packet->data();
284 cmd_get_id_done->client_id = client_id;
286 if (m_socket.send(ret_packet->packet(), ret_packet->size()) <= 0) {
287 _E("Failed to send a cmd_get_id_done with client_id [%d]", client_id);
296 bool command_worker::send_cmd_get_data_done(int state, sensor_data_t *data)
299 cmd_get_data_done_t *cmd_get_data_done;
301 ret_packet = new(std::nothrow) cpacket(sizeof(cmd_get_data_done_t));
302 retvm_if(!ret_packet, false, "Failed to allocate memory");
304 ret_packet->set_cmd(CMD_GET_DATA);
306 cmd_get_data_done = (cmd_get_data_done_t*)ret_packet->data();
307 cmd_get_data_done->state = state;
310 memcpy(&cmd_get_data_done->base_data, data, sizeof(sensor_data_t));
312 if (m_socket.send(ret_packet->packet(), ret_packet->size()) <= 0) {
313 _E("Failed to send a cmd_get_data_done");
324 bool command_worker::send_cmd_get_sensor_list_done(void)
328 int permission = get_permission();
330 _I("permission = %#x", permission);
332 get_sensor_list(permission, sensor_list);
334 if (m_socket.send(sensor_list.packet(), sensor_list.size()) <= 0) {
335 _E("Failed to send a cmd_get_sensor_list_done");
340 * TODO: get_sensor_list() command is processed on one-time connection in the current architecture.
341 * but it doesn't need to use one-time connection.
348 bool command_worker::cmd_get_id(void *payload)
353 socklen_t opt_len = sizeof(cr);
355 _D("CMD_GET_ID Handler invoked\n");
356 cmd = (cmd_get_id_t*)payload;
358 if (getsockopt(m_socket.get_socket_fd(), SOL_SOCKET, SO_PEERCRED, &cr, &opt_len)) {
359 _E("Failed to get socket option with SO_PEERCRED");
363 client_id = get_client_info_manager().create_client_record();
365 get_client_info_manager().set_client_info(client_id, cr.pid, cmd->name);
367 m_permission = get_permission();
369 get_client_info_manager().set_permission(client_id, m_permission);
371 _I("New client id [%d] created", client_id);
373 if (!send_cmd_get_id_done(client_id))
374 _E("Failed to send cmd_done to a client");
379 bool command_worker::cmd_get_sensor_list(void *payload)
381 _D("CMD_GET_SENSOR_LIST Handler invoked\n");
383 if (!send_cmd_get_sensor_list_done())
384 _E("Failed to send cmd_get_sensor_list_done to a client");
389 bool command_worker::cmd_hello(void *payload)
392 long ret_value = OP_ERROR;
394 _D("CMD_HELLO Handler invoked\n");
395 cmd = (cmd_hello_t*)payload;
397 m_sensor_id = cmd->sensor;
398 m_client_id = cmd->client_id;
400 if (m_permission == SENSOR_PERMISSION_NONE)
401 get_client_info_manager().get_permission(m_client_id, m_permission);
403 m_module = (sensor_base *)sensor_loader::get_instance().get_sensor(cmd->sensor);
406 _W("Sensor type[%d] is not supported", cmd->sensor);
407 if (!get_client_info_manager().has_sensor_record(m_client_id))
408 get_client_info_manager().remove_client_record(m_client_id);
410 ret_value = OP_ERROR;
414 if (!is_permission_allowed()) {
415 _E("Permission denied to connect sensor[%#llx] for client [%d]", m_sensor_id, m_client_id);
416 ret_value = OP_ERROR;
420 _D("Hello sensor [%#llx], client id [%d]", m_sensor_id, m_client_id);
421 get_client_info_manager().create_sensor_record(m_client_id, m_sensor_id);
422 _I("New sensor record created for sensor [%#llx], sensor name [%s] on client id [%d]\n", m_sensor_id, m_module->get_name(), m_client_id);
423 ret_value = OP_SUCCESS;
425 if (!send_cmd_done(ret_value))
426 _E("Failed to send cmd_done to a client");
431 bool command_worker::cmd_byebye(void *payload)
433 long ret_value = OP_ERROR;
435 if (!is_permission_allowed()) {
436 _E("Permission denied to stop sensor[%#llx] for client [%d]", m_sensor_id, m_client_id);
437 ret_value = OP_ERROR;
441 _D("CMD_BYEBYE for client [%d], sensor [%#llx]", m_client_id, m_sensor_id);
443 if (!get_client_info_manager().remove_sensor_record(m_client_id, m_sensor_id)) {
444 _E("Error removing sensor_record for client [%d]", m_client_id);
445 ret_value = OP_ERROR;
449 m_client_id = CLIENT_ID_INVALID;
450 ret_value = OP_SUCCESS;
453 if (!send_cmd_done(ret_value))
454 _E("Failed to send cmd_done to a client");
456 if (ret_value == OP_SUCCESS)
462 bool command_worker::cmd_start(void *payload)
464 long ret_value = OP_ERROR;
466 if (!is_permission_allowed()) {
467 _E("Permission denied to start sensor[%#llx] for client [%d]", m_sensor_id, m_client_id);
468 ret_value = OP_ERROR;
472 _D("START Sensor [%#llx], called from client [%d]", m_sensor_id, m_client_id);
474 if (m_module->start()) {
475 get_client_info_manager().set_start(m_client_id, m_sensor_id, true);
477 * Rotation could be changed even LCD is off by pop sync rotation
478 * and a client listening rotation event with always-on option.
479 * To reflect the last rotation state, request it to event dispatcher.
481 get_event_dispathcher().request_last_event(m_client_id, m_sensor_id);
482 ret_value = OP_SUCCESS;
484 _E("Failed to start sensor [%#llx] for client [%d]", m_sensor_id, m_client_id);
485 ret_value = OP_ERROR;
489 if (!send_cmd_done(ret_value))
490 _E("Failed to send cmd_done to a client");
495 bool command_worker::cmd_stop(void *payload)
497 long ret_value = OP_ERROR;
499 if (!is_permission_allowed()) {
500 _E("Permission denied to stop sensor[%#llx] for client [%d]", m_sensor_id, m_client_id);
501 ret_value = OP_ERROR;
505 _D("STOP Sensor [%#llx], called from client [%d]", m_sensor_id, m_client_id);
507 if (m_module->stop()) {
508 get_client_info_manager().set_start(m_client_id, m_sensor_id, false);
509 m_module->delete_attribute(m_client_id);
510 ret_value = OP_SUCCESS;
512 _E("Failed to stop sensor [%#llx] for client [%d]", m_sensor_id, m_client_id);
513 ret_value = OP_ERROR;
517 if (!send_cmd_done(ret_value))
518 _E("Failed to send cmd_done to a client");
523 bool command_worker::cmd_register_event(void *payload)
526 long ret_value = OP_ERROR;
528 cmd = (cmd_reg_t*)payload;
530 if (!is_permission_allowed()) {
531 _E("Permission denied to register event [%#x] for client [%d] to client info manager",
532 cmd->event_type, m_client_id);
533 ret_value = OP_ERROR;
537 if (!get_client_info_manager().register_event(m_client_id, m_sensor_id, cmd->event_type)) {
538 _I("Failed to register event [%#x] for client [%d] to client info manager",
539 cmd->event_type, m_client_id);
540 ret_value = OP_ERROR;
544 ret_value = OP_SUCCESS;
545 _D("Registering Event [%#x] is done for client [%d]", cmd->event_type, m_client_id);
548 if (!send_cmd_done(ret_value))
549 _E("Failed to send cmd_done to a client");
554 bool command_worker::cmd_unregister_event(void *payload)
557 long ret_value = OP_ERROR;
559 cmd = (cmd_unreg_t*)payload;
561 if (!is_permission_allowed()) {
562 _E("Permission denied to unregister event [%#x] for client [%d] to client info manager",
563 cmd->event_type, m_client_id);
564 ret_value = OP_ERROR;
568 if (!get_client_info_manager().unregister_event(m_client_id, m_sensor_id, cmd->event_type)) {
569 _E("Failed to unregister event [%#x] for client [%d] from client info manager",
570 cmd->event_type, m_client_id);
571 ret_value = OP_ERROR;
575 ret_value = OP_SUCCESS;
576 _D("Unregistering Event [%#x] is done for client [%d]",
577 cmd->event_type, m_client_id);
580 if (!send_cmd_done(ret_value))
581 _E("Failed to send cmd_done to a client");
586 bool command_worker::cmd_set_batch(void *payload)
588 cmd_set_batch_t *cmd;
589 long ret_value = OP_ERROR;
591 cmd = (cmd_set_batch_t*)payload;
593 if (!is_permission_allowed()) {
594 _E("Permission denied to set batch for client [%d], for sensor [%#llx] with batch [%d, %d] to client info manager",
595 m_client_id, m_sensor_id, cmd->interval, cmd->latency);
596 ret_value = OP_ERROR;
600 if (!get_client_info_manager().set_batch(m_client_id, m_sensor_id, cmd->interval, cmd->latency)) {
601 _E("Failed to set batch for client [%d], for sensor [%#llx] with batch [%d, %d] to client info manager",
602 m_client_id, m_sensor_id, cmd->interval, cmd->latency);
603 ret_value = OP_ERROR;
607 if (!m_module->add_interval(m_client_id, cmd->interval, false)) {
608 _E("Failed to set interval for client [%d], for sensor [%#llx] with interval [%d]",
609 m_client_id, m_sensor_id, cmd->interval);
610 ret_value = OP_ERROR;
614 if (!m_module->add_batch(m_client_id, cmd->latency)) {
615 _E("Failed to set latency for client [%d], for sensor [%#llx] with latency [%d]",
616 m_client_id, m_sensor_id, cmd->latency);
617 ret_value = OP_ERROR;
621 ret_value = OP_SUCCESS;
624 if (!send_cmd_done(ret_value))
625 _E("Failed to send cmd_done to a client");
630 bool command_worker::cmd_unset_batch(void *payload)
632 long ret_value = OP_ERROR;
634 if (!is_permission_allowed()) {
635 _E("Permission denied to unset batch for client [%d], for sensor [%#llx] to client info manager",
636 m_client_id, m_sensor_id);
637 ret_value = OP_ERROR;
641 if (!get_client_info_manager().set_batch(m_client_id, m_sensor_id, 0, 0)) {
642 _E("Failed to unset batch for client [%d], for sensor [%#llx] to client info manager",
643 m_client_id, m_sensor_id);
644 ret_value = OP_ERROR;
648 if (!m_module->delete_interval(m_client_id, false)) {
649 _E("Failed to delete interval for client [%d]", m_client_id);
650 ret_value = OP_ERROR;
654 if (!m_module->delete_batch(m_client_id)) {
655 _E("Failed to delete latency for client [%d]", m_client_id);
656 ret_value = OP_ERROR;
660 ret_value = OP_SUCCESS;
663 if (!send_cmd_done(ret_value))
664 _E("Failed to send cmd_done to a client");
669 bool command_worker::cmd_set_pause_policy(void *payload)
671 cmd_set_pause_policy_t *cmd;
672 long ret_value = OP_ERROR;
674 cmd = (cmd_set_pause_policy_t*)payload;
676 if (!is_permission_allowed()) {
677 _E("Permission denied to set interval for client [%d], for sensor [%#llx] with pause_policy [%d] to client info manager",
678 m_client_id, m_sensor_id, cmd->pause_policy);
679 ret_value = OP_ERROR;
683 if (!get_client_info_manager().set_pause_policy(m_client_id, m_sensor_id, cmd->pause_policy)) {
684 _E("Failed to set pause_policy for client [%d], for sensor [%#llx] with pause_policy [%d] to client info manager",
685 m_client_id, m_sensor_id, cmd->pause_policy);
686 ret_value = OP_ERROR;
690 ret_value = OP_SUCCESS;
692 if (!send_cmd_done(ret_value))
693 _E("Failed to send cmd_done to a client");
698 bool command_worker::cmd_get_data(void *payload)
700 const unsigned int GET_DATA_MIN_INTERVAL = 10;
702 bool adjusted = false;
704 sensor_data_t *data = NULL;
706 _D("CMD_GET_VALUE Handler invoked\n");
708 if (!is_permission_allowed()) {
709 _E("Permission denied to get data for client [%d], for sensor [%#llx]",
710 m_client_id, m_sensor_id);
715 state = m_module->get_cache(&data);
717 /* if there is no cached data, wait short time and retry to get data again */
718 if (state == -ENODATA) {
719 const int RETRY_CNT = 10;
722 unsigned int interval = m_module->get_interval(m_client_id, false);
724 /* 1. change interval to 10ms. */
725 if (interval > GET_DATA_MIN_INTERVAL) {
726 m_module->add_interval(m_client_id, GET_DATA_MIN_INTERVAL, false);
730 /* 2. try to get sensor data increasing the waited time(20ms, 40ms, 80ms, 160ms, 160ms...) */
731 /* 3. if data cannot be found in 10 times, stop it. */
732 while ((state == -ENODATA) && (retry++ < RETRY_CNT)) {
733 _I("Wait sensor[%#llx] data updated for client [%d] #%d", m_sensor_id, m_client_id, retry);
734 usleep(WAIT_TIME(retry));
735 state = m_module->get_cache(&data);
738 /* 4. revert to original interval */
740 m_module->add_interval(m_client_id, interval, false);
744 _E("Failed to get data for client [%d], for sensor [%#llx]",
745 m_client_id, m_sensor_id);
749 send_cmd_get_data_done(state < 0 ? OP_ERROR : OP_SUCCESS, data);
754 bool command_worker::cmd_set_attribute_int(void *payload)
756 cmd_set_attribute_int_t *cmd;
757 long ret_value = OP_ERROR;
759 _D("CMD_SET_COMMAND Handler invoked\n");
761 cmd = (cmd_set_attribute_int_t*)payload;
763 if (!is_permission_allowed()) {
764 _E("Permission denied to set attribute for client [%d], for sensor [%#llx] with attribute [%d]",
765 m_client_id, m_sensor_id, cmd->attribute);
766 ret_value = OP_ERROR;
770 ret_value = m_module->add_attribute(m_client_id, cmd->attribute, cmd->value);
773 if (!send_cmd_done(ret_value))
774 _E("Failed to send cmd_done to a client");
779 bool command_worker::cmd_set_attribute_str(void *payload)
781 cmd_set_attribute_str_t *cmd;
782 long ret_value = OP_ERROR;
784 _D("CMD_SEND_SENSORHUB_DATA Handler invoked");
786 cmd = (cmd_set_attribute_str_t*)payload;
788 if (!is_permission_allowed()) {
789 _E("Permission denied to set attribute for client [%d], for sensor [%#llx]",
790 m_client_id, m_sensor_id);
791 ret_value = OP_ERROR;
795 ret_value = m_module->add_attribute(m_client_id, cmd->attribute, cmd->value, cmd->len);
798 if (!send_cmd_done(ret_value))
799 _E("Failed to send cmd_done to a client");
804 bool command_worker::cmd_flush(void *payload)
806 long ret_value = OP_ERROR;
808 _D("CMD_FLUSH Handler invoked");
810 if (!is_permission_allowed()) {
811 _E("Permission denied to flush sensor data for client [%d], for sensor [%#llx]",
812 m_client_id, m_sensor_id);
813 ret_value = OP_ERROR;
817 if (!m_module->flush()) {
818 _E("Failed to flush sensor_data [%d]", m_client_id);
819 ret_value = OP_ERROR;
823 ret_value = OP_SUCCESS;
826 if (!send_cmd_done(ret_value))
827 _E("Failed to send cmd_done to a client");
832 void command_worker::get_info(string &info)
834 const char *client_info = NULL;
835 const char *sensor_info = NULL;
837 if (m_client_id != CLIENT_ID_INVALID)
838 client_info = get_client_info_manager().get_client_info(m_client_id);
841 sensor_info = m_module->get_name();
843 info = string("Command worker for ") + (client_info ? client_info : "Unknown") + "'s "
844 + (sensor_info ? sensor_info : "Unknown");
847 int command_worker::get_permission(void)
849 return permission_checker::get_instance().get_permission(m_socket.get_socket_fd());
852 bool command_worker::is_permission_allowed(void)
857 if (m_module->get_permission() & m_permission)
863 client_info_manager& command_worker::get_client_info_manager(void)
865 return client_info_manager::get_instance();
868 sensor_event_dispatcher& command_worker::get_event_dispathcher(void)
870 return sensor_event_dispatcher::get_instance();