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 <command_worker.h>
21 #include <sensor_plugin_loader.h>
22 #include <sensor_info.h>
23 #include <sensor_accel.h>
24 #include <sensor_gyro.h>
25 #include <sensor_geomag.h>
26 #include <sensor_orientation.h>
27 #include <sensor_linear_accel.h>
28 #include <sensor_gravity.h>
32 #include <permission_checker.h>
39 command_worker::cmd_handler_t command_worker::m_cmd_handlers[];
40 sensor_raw_data_map command_worker::m_sensor_raw_data_map;
41 cpacket command_worker::m_sensor_list;
43 set<unsigned int> priority_list;
45 command_worker::command_worker(const csocket& socket)
46 : m_client_id(CLIENT_ID_INVALID)
47 , m_permission(SENSOR_PERMISSION_NONE)
51 static bool init = false;
55 make_sensor_raw_data_map();
60 m_worker.set_context(this);
61 m_worker.set_working(working);
62 m_worker.set_stopped(stopped);
65 command_worker::~command_worker()
71 bool command_worker::start(void)
73 return m_worker.start();
76 void command_worker::init_cmd_handlers(void)
78 m_cmd_handlers[CMD_GET_ID] = &command_worker::cmd_get_id;
79 m_cmd_handlers[CMD_GET_SENSOR_LIST] = &command_worker::cmd_get_sensor_list;
80 m_cmd_handlers[CMD_HELLO] = &command_worker::cmd_hello;
81 m_cmd_handlers[CMD_BYEBYE] = &command_worker::cmd_byebye;
82 m_cmd_handlers[CMD_START] = &command_worker::cmd_start;
83 m_cmd_handlers[CMD_STOP] = &command_worker::cmd_stop;
84 m_cmd_handlers[CMD_REG] = &command_worker::cmd_register_event;
85 m_cmd_handlers[CMD_UNREG] = &command_worker::cmd_unregister_event;
86 m_cmd_handlers[CMD_SET_OPTION] = &command_worker::cmd_set_option;
87 m_cmd_handlers[CMD_SET_INTERVAL] = &command_worker::cmd_set_interval;
88 m_cmd_handlers[CMD_UNSET_INTERVAL] = &command_worker::cmd_unset_interval;
89 m_cmd_handlers[CMD_SET_COMMAND] = &command_worker::cmd_set_command;
90 m_cmd_handlers[CMD_GET_DATA] = &command_worker::cmd_get_data;
91 m_cmd_handlers[CMD_SEND_SENSORHUB_DATA] = &command_worker::cmd_send_sensorhub_data;
94 void command_worker::get_sensor_list(int permissions, cpacket &sensor_list)
96 const int PERMISSION_COUNT = sizeof(permissions) * 8;
97 vector<raw_data_t *> sensor_raw_vec;
98 size_t total_raw_data_size = 0;
100 for (int i = 0; i < PERMISSION_COUNT; ++i) {
101 int perm = (permissions & (1 << i));
104 auto range = m_sensor_raw_data_map.equal_range(perm);
106 sensor_raw_data_map::iterator it_raw_data;
108 for (it_raw_data = range.first; it_raw_data != range.second; ++it_raw_data) {
109 total_raw_data_size += it_raw_data->second.size();
110 sensor_raw_vec.push_back(&(it_raw_data->second));
117 sensor_cnt = sensor_raw_vec.size();
119 sensor_list.set_payload_size(sizeof(cmd_get_sensor_list_done_t) + (sizeof(size_t) * sensor_cnt) + total_raw_data_size);
120 sensor_list.set_cmd(CMD_GET_SENSOR_LIST);
122 cmd_get_sensor_list_done_t *cmd_get_sensor_list_done;
124 cmd_get_sensor_list_done = (cmd_get_sensor_list_done_t*)sensor_list.data();
125 cmd_get_sensor_list_done->sensor_cnt = sensor_cnt;
126 size_t* size_field = (size_t *) cmd_get_sensor_list_done->data;
129 for (int i = 0; i < sensor_cnt; ++i)
130 size_field[i] = sensor_raw_vec[i]->size();
132 char* raw_data_field = cmd_get_sensor_list_done->data + (sizeof(size_t) * sensor_cnt);
135 for (int i = 0; i < sensor_cnt; ++i) {
136 copy(sensor_raw_vec[i]->begin(), sensor_raw_vec[i]->end(), raw_data_field + idx);
137 idx += sensor_raw_vec[i]->size();
142 void command_worker::make_sensor_raw_data_map(void)
144 vector<sensor_base *> sensors;
148 sensors = sensor_plugin_loader::get_instance().get_sensors(ALL_SENSOR);
150 auto it_sensor = sensors.begin();
152 while (it_sensor != sensors.end()) {
153 (*it_sensor)->get_sensor_info(info);
154 permission = (*it_sensor)->get_permission();
156 sensor_raw_data_map::iterator it_sensor_raw_data;
157 it_sensor_raw_data = m_sensor_raw_data_map.insert(std::make_pair(permission, raw_data_t()));
159 info.get_raw_data(it_sensor_raw_data->second);
165 bool command_worker::working(void *ctx)
168 command_worker *inst = (command_worker *)ctx;
170 packet_header header;
173 if (inst->m_socket.recv(&header, sizeof(header)) <= 0) {
175 inst->get_info(info);
176 DBG("%s failed to receive header", info.c_str());
180 if (header.size > 0) {
182 payload = new(std::nothrow) char[header.size];
183 retvm_if(!payload, false, "Failed to allocate memory");
185 if (inst->m_socket.recv(payload, header.size) <= 0) {
187 inst->get_info(info);
188 DBG("%s failed to receive data of packet", info.c_str());
196 ret = inst->dispatch_command(header.cmd, payload);
205 bool command_worker::stopped(void *ctx)
208 event_type_vector event_vec;
209 command_worker *inst = (command_worker *)ctx;
211 inst->get_info(info);
212 INFO("%s is stopped", info.c_str());
214 if ((inst->m_module) && (inst->m_client_id != CLIENT_ID_INVALID)) {
216 get_client_info_manager().get_registered_events(inst->m_client_id, inst->m_module->get_id(), event_vec);
218 auto it_event = event_vec.begin();
220 while (it_event != event_vec.end()) {
221 WARN("Does not unregister event[0x%x] before connection broken for [%s]!!", *it_event, inst->m_module->get_name());
222 if (!inst->m_module->delete_client(*it_event))
223 ERR("Unregistering event[0x%x] failed", *it_event);
228 if (get_client_info_manager().is_started(inst->m_client_id, inst->m_module->get_id())) {
229 WARN("Does not receive cmd_stop before connection broken for [%s]!!", inst->m_module->get_name());
230 inst->m_module->delete_interval(inst->m_client_id, false);
231 inst->m_module->stop();
234 if (inst->m_module->get_id()) {
235 if (get_client_info_manager().has_sensor_record(inst->m_client_id, inst->m_module->get_id())) {
236 INFO("Removing sensor[0x%x] record for client_id[%d]", inst->m_module->get_id(), inst->m_client_id);
237 get_client_info_manager().remove_sensor_record(inst->m_client_id, inst->m_module->get_id());
246 bool command_worker::dispatch_command(int cmd, void* payload)
250 if (!(cmd > 0 && cmd < CMD_CNT)) {
251 ERR("Unknown command: %d", cmd);
253 cmd_handler_t cmd_handler;
254 cmd_handler = command_worker::m_cmd_handlers[cmd];
256 ret = (this->*cmd_handler)(payload);
262 bool command_worker::send_cmd_done(long value)
265 cmd_done_t *cmd_done;
267 ret_packet = new(std::nothrow) cpacket(sizeof(cmd_done_t));
268 retvm_if(!ret_packet, false, "Failed to allocate memory");
270 ret_packet->set_cmd(CMD_DONE);
272 cmd_done = (cmd_done_t*)ret_packet->data();
273 cmd_done->value = value;
275 if (m_socket.send(ret_packet->packet(), ret_packet->size()) <= 0) {
276 ERR("Failed to send a cmd_done to client_id [%d] with value [%ld]", m_client_id, value);
287 bool command_worker::send_cmd_get_id_done(int client_id)
290 cmd_get_id_done_t *cmd_get_id_done;
292 ret_packet = new(std::nothrow) cpacket(sizeof(cmd_get_id_done_t));
293 retvm_if(!ret_packet, false, "Failed to allocate memory");
295 ret_packet->set_cmd(CMD_GET_ID);
297 cmd_get_id_done = (cmd_get_id_done_t*)ret_packet->data();
298 cmd_get_id_done->client_id = client_id;
300 if (m_socket.send(ret_packet->packet(), ret_packet->size()) <= 0) {
301 ERR("Failed to send a cmd_get_id_done with client_id [%d]", client_id);
310 bool command_worker::send_cmd_get_data_done(int state, sensor_data_t *data)
314 cmd_get_data_done_t *cmd_get_data_done;
316 ret_packet = new(std::nothrow) cpacket(sizeof(cmd_get_data_done_t));
317 retvm_if(!ret_packet, false, "Failed to allocate memory");
319 ret_packet->set_cmd(CMD_GET_DATA);
321 cmd_get_data_done = (cmd_get_data_done_t*)ret_packet->data();
322 cmd_get_data_done->state = state;
324 memcpy(&cmd_get_data_done->base_data , data, sizeof(sensor_data_t));
326 if (m_socket.send(ret_packet->packet(), ret_packet->size()) <= 0) {
327 ERR("Failed to send a cmd_get_data_done");
337 bool command_worker::send_cmd_get_sensor_list_done(void)
341 int permission = get_permission();
343 INFO("permission = 0x%x", permission);
345 get_sensor_list(permission, sensor_list);
347 if (m_socket.send(sensor_list.packet(), sensor_list.size()) <= 0) {
348 ERR("Failed to send a cmd_get_sensor_list_done");
355 bool command_worker::cmd_get_id(void *payload)
360 DBG("CMD_GET_ID Handler invoked\n");
361 cmd = (cmd_get_id_t*)payload;
363 client_id = get_client_info_manager().create_client_record();
364 get_client_info_manager().set_client_info(client_id, cmd->pid);
366 m_permission = get_permission();
367 get_client_info_manager().set_permission(client_id, m_permission);
369 INFO("New client id [%d] created", client_id);
371 if (!send_cmd_get_id_done(client_id))
372 ERR("Failed to send cmd_done to a client");
378 bool command_worker::cmd_get_sensor_list(void *payload)
380 DBG("CMD_GET_SENSOR_LIST Handler invoked\n");
382 if (!send_cmd_get_sensor_list_done())
383 ERR("Failed to send cmd_get_sensor_list_done to a client");
388 bool command_worker::cmd_hello(void *payload)
391 long ret_value = OP_ERROR;
393 DBG("CMD_HELLO Handler invoked\n");
394 cmd = (cmd_hello_t*)payload;
396 m_client_id = cmd->client_id;
398 if (m_permission == SENSOR_PERMISSION_NONE)
399 get_client_info_manager().get_permission(m_client_id, m_permission);
401 m_module = (sensor_base *)sensor_plugin_loader::get_instance().get_sensor(cmd->sensor);
404 ERR("Sensor type[%d] is not supported", cmd->sensor);
405 if (!get_client_info_manager().has_sensor_record(m_client_id))
406 get_client_info_manager().remove_client_record(m_client_id);
408 ret_value = OP_ERROR;
412 if (!is_permission_allowed()) {
413 ERR("Permission denied to connect sensor[0x%x] for client [%d]", m_module->get_id(), m_client_id);
414 ret_value = OP_ERROR;
418 DBG("Hello sensor [0x%x], client id [%d]", m_module->get_id(), m_client_id);
419 get_client_info_manager().create_sensor_record(m_client_id, m_module->get_id());
420 INFO("New sensor record created for sensor [0x%x], sensor name [%s] on client id [%d]\n", m_module->get_id(), m_module->get_name(), m_client_id);
421 ret_value = OP_SUCCESS;
423 if (!send_cmd_done(ret_value))
424 ERR("Failed to send cmd_done to a client");
429 bool command_worker::cmd_byebye(void *payload)
431 long ret_value = OP_ERROR;
433 if (!is_permission_allowed()) {
434 ERR("Permission denied to stop sensor[0x%x] for client [%d]", m_module? m_module->get_id() : -1, m_client_id);
435 ret_value = OP_ERROR;
439 DBG("CMD_BYEBYE for client [%d], sensor [0x%x]", m_client_id, m_module->get_id());
441 if (!get_client_info_manager().remove_sensor_record(m_client_id, m_module->get_id())) {
442 ERR("Error removing sensor_record for client [%d]", m_client_id);
443 ret_value = OP_ERROR;
447 m_client_id = CLIENT_ID_INVALID;
448 ret_value = OP_SUCCESS;
451 if (!send_cmd_done(ret_value))
452 ERR("Failed to send cmd_done to a client");
454 if (ret_value == OP_SUCCESS)
460 bool command_worker::cmd_start(void *payload)
462 long ret_value = OP_ERROR;
464 if (!is_permission_allowed()) {
465 ERR("Permission denied to start sensor[0x%x] for client [%d]", m_module? m_module->get_id() : -1, m_client_id);
466 ret_value = OP_ERROR;
470 DBG("START Sensor [0x%x], called from client [%d]", m_module->get_id(), m_client_id);
472 if (m_module->start()) {
473 get_client_info_manager().set_start(m_client_id, m_module->get_id(), true);
475 * Rotation could be changed even LCD is off by pop sync rotation
476 * and a client listening rotation event with always-on option.
477 * To reflect the last rotation state, request it to event dispatcher.
479 get_event_dispathcher().request_last_event(m_client_id, m_module->get_id());
480 ret_value = OP_SUCCESS;
482 ERR("Failed to start sensor [0x%x] for client [%d]", m_module->get_id(), m_client_id);
483 ret_value = OP_ERROR;
487 if (!send_cmd_done(ret_value))
488 ERR("Failed to send cmd_done to a client");
493 bool command_worker::cmd_stop(void *payload)
495 long ret_value = OP_ERROR;
497 if (!is_permission_allowed()) {
498 ERR("Permission denied to stop sensor[0x%x] for client [%d]", m_module? m_module->get_id() : -1, m_client_id);
499 ret_value = OP_ERROR;
503 DBG("STOP Sensor [0x%x], called from client [%d]", m_module->get_id(), m_client_id);
505 if (m_module->stop()) {
506 get_client_info_manager().set_start(m_client_id, m_module->get_id(), false);
507 ret_value = OP_SUCCESS;
509 ERR("Failed to stop sensor [0x%x] for client [%d]", m_module->get_id(), m_client_id);
510 ret_value = OP_ERROR;
514 if (!send_cmd_done(ret_value))
515 ERR("Failed to send cmd_done to a client");
520 bool command_worker::cmd_register_event(void *payload)
523 long ret_value = OP_ERROR;
525 cmd = (cmd_reg_t*)payload;
527 if (!is_permission_allowed()) {
528 ERR("Permission denied to register event [0x%x] for client [%d] to client info manager",
529 cmd->event_type, m_client_id);
530 ret_value = OP_ERROR;
534 if (!get_client_info_manager().register_event(m_client_id, m_module? m_module->get_id() : -1, cmd->event_type)) {
535 INFO("Failed to register event [0x%x] for client [%d] to client info manager",
536 cmd->event_type, m_client_id);
537 ret_value = OP_ERROR;
541 insert_priority_list(cmd->event_type);
542 m_module->add_client(cmd->event_type);
544 ret_value = OP_SUCCESS;
545 DBG("Registering Event [0x%x] is done for client [%d]", cmd->event_type, m_client_id);
548 if (!send_cmd_done(ret_value))
549 ERR("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 ERR("Permission denied to unregister event [0x%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_module->get_id(), cmd->event_type)) {
569 ERR("Failed to unregister event [0x%x] for client [%d] from client info manager",
570 cmd->event_type, m_client_id);
571 ret_value = OP_ERROR;
575 if (!m_module->delete_client(cmd->event_type)) {
576 ERR("Failed to unregister event [0x%x] for client [%d]",
577 cmd->event_type, m_client_id);
578 ret_value = OP_ERROR;
582 ret_value = OP_SUCCESS;
583 DBG("Unregistering Event [0x%x] is done for client [%d]",
584 cmd->event_type, m_client_id);
587 if (!send_cmd_done(ret_value))
588 ERR("Failed to send cmd_done to a client");
593 bool command_worker::cmd_set_interval(void *payload)
595 cmd_set_interval_t *cmd;
596 long ret_value = OP_ERROR;
598 cmd = (cmd_set_interval_t*)payload;
600 if (!is_permission_allowed()) {
601 ERR("Permission denied to register interval for client [%d], for sensor [0x%x] with interval [%d] to client info manager",
602 m_client_id, m_module? m_module->get_id() : -1, cmd->interval);
603 ret_value = OP_ERROR;
607 if (!get_client_info_manager().set_interval(m_client_id, m_module->get_id(), cmd->interval)) {
608 ERR("Failed to register interval for client [%d], for sensor [0x%x] with interval [%d] to client info manager",
609 m_client_id, m_module->get_id(), cmd->interval);
610 ret_value = OP_ERROR;
614 if (!m_module->add_interval(m_client_id, cmd->interval, false)) {
615 ERR("Failed to set interval for client [%d], for sensor [0x%x] with interval [%d]",
616 m_client_id, m_module->get_id(), cmd->interval);
617 ret_value = OP_ERROR;
621 ret_value = OP_SUCCESS;
624 if (!send_cmd_done(ret_value))
625 ERR("Failed to send cmd_done to a client");
630 bool command_worker::cmd_unset_interval(void *payload)
632 long ret_value = OP_ERROR;
634 if (!is_permission_allowed()) {
635 ERR("Permission denied to unregister interval for client [%d], for sensor [0x%x] to client info manager",
636 m_client_id, m_module? m_module->get_id() : -1);
637 ret_value = OP_ERROR;
641 if (!get_client_info_manager().set_interval(m_client_id, m_module->get_id(), 0)) {
642 ERR("Failed to unregister interval for client [%d], for sensor [0x%x] to client info manager",
643 m_client_id, m_module->get_id());
644 ret_value = OP_ERROR;
648 if (!m_module->delete_interval(m_client_id, false)) {
649 ERR("Failed to delete interval for client [%d]", m_client_id);
650 ret_value = OP_ERROR;
654 ret_value = OP_SUCCESS;
657 if (!send_cmd_done(ret_value))
658 ERR("Failed to send cmd_done to a client");
663 bool command_worker::cmd_set_option(void *payload)
665 cmd_set_option_t *cmd;
666 long ret_value = OP_ERROR;
668 cmd = (cmd_set_option_t*)payload;
670 if (!is_permission_allowed()) {
671 ERR("Permission denied to set interval for client [%d], for sensor [0x%x] with option [%d] to client info manager",
672 m_client_id, m_module? m_module->get_id() : -1, cmd->option);
673 ret_value = OP_ERROR;
677 if (!get_client_info_manager().set_option(m_client_id, m_module->get_id(), cmd->option)) {
678 ERR("Failed to set option for client [%d], for sensor [0x%x] with option [%d] to client info manager",
679 m_client_id, m_module->get_id(), cmd->option);
680 ret_value = OP_ERROR;
684 ret_value = OP_SUCCESS;
686 if (!send_cmd_done(ret_value))
687 ERR("Failed to send cmd_done to a client");
692 bool command_worker::cmd_set_command(void *payload)
694 cmd_set_command_t *cmd;
695 long ret_value = OP_ERROR;
697 DBG("CMD_SET_COMMAND Handler invoked\n");
699 cmd = (cmd_set_command_t*)payload;
701 if (!is_permission_allowed()) {
702 ERR("Permission denied to set command for client [%d], for sensor [0x%x] with cmd [%d]",
703 m_client_id, m_module? m_module->get_id() : -1, cmd->cmd);
704 ret_value = OP_ERROR;
708 ret_value = m_module->set_command(cmd->cmd, cmd->value);
711 if (!send_cmd_done(ret_value))
712 ERR("Failed to send cmd_done to a client");
717 bool command_worker::cmd_get_data(void *payload)
719 const int GET_DATA_MIN_INTERVAL = 10;
721 int state = OP_ERROR;
722 bool adjusted = false;
726 DBG("CMD_GET_VALUE Handler invoked\n");
728 cmd = (cmd_get_data_t*)payload;
730 if (!is_permission_allowed()) {
731 ERR("Permission denied to get data for client [%d], for sensor [0x%x]",
732 m_client_id, m_module? m_module->get_id() : -1);
737 state = m_module->get_sensor_data(cmd->type, data);
739 // In case of not getting sensor data, wait short time and retry again
740 // 1. changing interval to be less than 10ms
741 // 2. In case of first time, wait for INIT_WAIT_TIME
742 // 3. at another time, wait for WAIT_TIME
743 // 4. retrying to get data
744 // 5. repeat 2 ~ 4 operations RETRY_CNT times
745 // 6. reverting back to original interval
746 if (!state && !data.timestamp) {
747 const int RETRY_CNT = 3;
748 const unsigned long long INIT_WAIT_TIME = 20000; //20ms
749 const unsigned long WAIT_TIME = 100000; //100ms
752 unsigned int interval = m_module->get_interval(m_client_id, false);
754 if (interval > GET_DATA_MIN_INTERVAL) {
755 m_module->add_interval(m_client_id, GET_DATA_MIN_INTERVAL, false);
759 while (!state && !data.timestamp && (retry++ < RETRY_CNT)) {
760 INFO("Wait sensor[0x%x] data updated for client [%d] #%d", m_module->get_id(), m_client_id, retry);
761 usleep((retry == 1) ? INIT_WAIT_TIME : WAIT_TIME);
762 state = m_module->get_sensor_data(cmd->type, data);
766 m_module->add_interval(m_client_id, interval, false);
773 ERR("Failed to get data for client [%d], for sensor [0x%x]",
774 m_client_id, m_module->get_id());
778 send_cmd_get_data_done(state, &data);
783 bool command_worker::cmd_send_sensorhub_data(void *payload)
785 cmd_send_sensorhub_data_t *cmd;
786 long ret_value = OP_ERROR;
788 DBG("CMD_SEND_SENSORHUB_DATA Handler invoked");
790 cmd = (cmd_send_sensorhub_data_t*)payload;
792 if (!is_permission_allowed()) {
793 ERR("Permission denied to send sensorhub_data for client [%d], for sensor [0x%x]",
794 m_client_id, m_module? m_module->get_id() : -1);
795 ret_value = OP_ERROR;
799 ret_value = m_module->send_sensorhub_data(cmd->data, cmd->data_len);
802 if (!send_cmd_done(ret_value))
803 ERR("Failed to send cmd_done to a client");
808 void command_worker::get_info(string &info)
810 const char *client_info = NULL;
811 const char *sensor_info = NULL;
813 if (m_client_id != CLIENT_ID_INVALID)
814 client_info = get_client_info_manager().get_client_info(m_client_id);
817 sensor_info = m_module->get_name();
819 info = string("Command worker for ") + (client_info ? client_info : "Unknown") + "'s "
820 + (sensor_info ? sensor_info : "Unknown");
823 int command_worker::get_permission(void)
825 return permission_checker::get_instance().get_permission(m_socket.get_socket_fd());
828 bool command_worker::is_permission_allowed(void)
833 if (m_module->get_permission() & m_permission)
840 cclient_info_manager& command_worker::get_client_info_manager(void)
842 return cclient_info_manager::get_instance();
845 csensor_event_dispatcher& command_worker::get_event_dispathcher(void)
847 return csensor_event_dispatcher::get_instance();
850 void insert_priority_list(unsigned int event_type)
852 if (event_type == ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME ||
853 event_type == LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME ||
854 event_type == GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME ||
855 event_type == ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME) {
856 priority_list.insert(ACCELEROMETER_RAW_DATA_EVENT);
857 priority_list.insert(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME);
858 priority_list.insert(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME);
861 if (event_type == GEOMAGNETIC_RV_EVENT_RAW_DATA_REPORT_ON_TIME) {
862 priority_list.insert(ACCELEROMETER_RAW_DATA_EVENT);
863 priority_list.insert(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME);