sensord: clean up the code detected by style checker 43/68943/4
authorkibak.yoon <kibak.yoon@samsung.com>
Tue, 10 May 2016 12:22:45 +0000 (21:22 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Tue, 10 May 2016 12:48:24 +0000 (21:48 +0900)
- [LNE_R_TWS] Redundant blank line at the start of a code block should be deleted.
- [SPC_M_SEP] Missing space after ,
- [SPC_M_SEP] Missing space before ( in while(
- [SPC_M_SEP] Extra space after (
- [SPC_M_OPR] Missing spaces around <
- ...

Change-Id: I238c4c0be773ef2b9f0067a09b35049ed322cacd
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
73 files changed:
src/client/client.cpp
src/client/client_common.h
src/client/command_channel.cpp
src/client/sensor_client_info.cpp
src/client/sensor_client_info.h
src/client/sensor_event_listener.cpp
src/client/sensor_event_listener.h
src/client/sensor_handle_info.cpp
src/client/sensor_handle_info.h
src/client/sensor_info_manager.cpp
src/client/sensor_info_manager.h
src/client/sensor_internal.h
src/client/sensor_internal_deprecated.h
src/hal/sensor_hal_types.h
src/sensor/accel/accel_sensor.cpp
src/sensor/auto_rotation/auto_rotation_alg.h
src/sensor/auto_rotation/auto_rotation_alg_emul.h
src/sensor/auto_rotation/auto_rotation_sensor.cpp
src/sensor/fusion/fusion_sensor.cpp
src/sensor/fusion_util.cpp
src/sensor/gravity/gravity_sensor.cpp
src/sensor/hrm/hrm_sensor.cpp
src/sensor/orientation/orientation_sensor.cpp
src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.cpp
src/sensor/rotation_vector/rv/rv_sensor.cpp
src/sensor/sensor_fusion/euler_angles.cpp
src/sensor/sensor_fusion/orientation_filter.cpp
src/sensor/sensor_fusion/rotation_matrix.cpp
src/sensor/sensor_fusion/sensor_data.h
src/sensor/sensor_fusion/test/orientation_sensor.cpp
src/sensor/sensor_fusion/test/test_projects/euler_angles_test/euler_angles_main.cpp
src/sensor/sensor_fusion/test/test_projects/gravity_sensor_test/gravity_sensor_main.cpp
src/sensor/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/linear_acceleration_sensor_main.cpp
src/sensor/sensor_fusion/test/test_projects/matrix_test/matrix_main.cpp
src/sensor/sensor_fusion/test/test_projects/orientation_sensor_test/orientation_sensor_main.cpp
src/sensor/sensor_fusion/test/test_projects/quaternion_test/quaternion_main.cpp
src/sensor/sensor_fusion/test/test_projects/sensor_data_test/sensor_data_main.cpp
src/sensor/sensor_fusion/test/test_projects/vector_test/vector_main.cpp
src/sensor/sensor_fusion/vector.cpp
src/sensor/sensor_fusion/vector.h
src/sensor/tilt/tilt_sensor.cpp
src/server/client_info_manager.cpp
src/server/client_info_manager.h
src/server/client_sensor_record.cpp
src/server/command_worker.cpp
src/server/command_worker.h
src/server/device_config.cpp
src/server/physical_sensor.cpp
src/server/sensor_event_dispatcher.cpp
src/server/sensor_event_queue.cpp
src/server/sensor_fusion.cpp
src/server/sensor_fusion.h
src/server/sensor_info_list.h
src/server/sensor_loader.h
src/server/sensor_usage.cpp
src/server/server.cpp
src/server/virtual_sensor.cpp
src/server/virtual_sensor_config.cpp
src/server/virtual_sensor_config.h
src/server/worker_thread.cpp
src/server/worker_thread.h
src/shared/cbase_lock.cpp
src/shared/cbase_lock.h
src/shared/cmutex.cpp
src/shared/command_common.h
src/shared/cpacket.cpp
src/shared/csocket.cpp
src/shared/csocket.h
src/shared/poller.cpp
src/shared/sensor_info.cpp
src/shared/sensor_log.h
src/test/src/check-sensor.c
src/test/src/multi-thread-performance-test.c

index a884b40..73f4180 100644 (file)
@@ -110,7 +110,7 @@ void clean_up(void)
        }
 }
 
-static int get_power_save_state (void)
+static int get_power_save_state(void)
 {
        int state = 0;
        int pm_state;
@@ -155,7 +155,6 @@ static void power_save_state_cb(keynode_t *node, void *data)
        }
 }
 
-
 void restore_session(void)
 {
        AUTOLOCK(lock);
@@ -178,7 +177,7 @@ void restore_session(void)
 
        while (it_sensor != sensors.end()) {
                cmd_channel = new(std::nothrow) command_channel();
-               retm_if (!cmd_channel, "Failed to allocate memory");
+               retm_if(!cmd_channel, "Failed to allocate memory");
 
                if (!cmd_channel->create_channel()) {
                        _E("%s failed to create command channel for %s", get_client_name(), get_sensor_name(*it_sensor));
@@ -240,7 +239,6 @@ static bool get_events_diff(event_type_vector &a_vec, event_type_vector &b_vec,
        return !(add_vec.empty() && del_vec.empty());
 }
 
-
 static bool change_sensor_rep(sensor_id_t sensor_id, sensor_rep &prev_rep, sensor_rep &cur_rep)
 {
        int client_id;
@@ -253,7 +251,7 @@ static bool change_sensor_rep(sensor_id_t sensor_id, sensor_rep &prev_rep, senso
        }
 
        client_id = sensor_client_info::get_instance().get_client_id();
-       retvm_if ((client_id < 0), false, "Invalid client id : %d, %s, %s", client_id, get_sensor_name(sensor_id), get_client_name());
+       retvm_if((client_id < 0), false, "Invalid client id : %d, %s, %s", client_id, get_sensor_name(sensor_id), get_client_name());
 
        get_events_diff(prev_rep.event_types, cur_rep.event_types, add_event_types, del_event_types);
 
@@ -278,7 +276,6 @@ static bool change_sensor_rep(sensor_id_t sensor_id, sensor_rep &prev_rep, senso
                                return false;
                        }
                }
-
        }
 
        if (prev_rep.active && !del_event_types.empty()) {
@@ -336,7 +333,7 @@ static bool get_sensor_list(void)
 
 API int sensord_get_sensors(sensor_type_t type, sensor_t **list, int *sensor_count)
 {
-       retvm_if (!get_sensor_list(), -EPERM, "Fail to get sensor list from server");
+       retvm_if(!get_sensor_list(), -EPERM, "Fail to get sensor list from server");
 
        vector<sensor_info *> sensor_infos = sensor_info_manager::get_instance().get_infos(type);
 
@@ -363,7 +360,7 @@ API int sensord_get_sensors(sensor_type_t type, sensor_t **list, int *sensor_cou
 
 API int sensord_get_default_sensor(sensor_type_t type, sensor_t *sensor)
 {
-       retvm_if (!get_sensor_list(), -EPERM, "Fail to get sensor list from server");
+       retvm_if(!get_sensor_list(), -EPERM, "Fail to get sensor list from server");
 
        const sensor_info *info;
 
@@ -398,7 +395,7 @@ API bool sensord_get_type(sensor_t sensor, sensor_type_t *type)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !type,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !type,
                NULL, "Invalid param: sensor (%p), type(%p)", sensor, type);
 
        *type = info->get_type();
@@ -410,7 +407,7 @@ API const char* sensord_get_name(sensor_t sensor)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info),
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info),
                NULL, "Invalid param: sensor (%p)", sensor);
 
        return info->get_name();
@@ -420,7 +417,7 @@ API const char* sensord_get_vendor(sensor_t sensor)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info),
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info),
                NULL, "Invalid param: sensor (%p)", sensor);
 
        return info->get_vendor();
@@ -430,7 +427,7 @@ API bool sensord_get_privilege(sensor_t sensor, sensor_privilege_t *privilege)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !privilege,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !privilege,
                false, "Invalid param: sensor (%p), privilege(%p)", sensor, privilege);
 
        *privilege = info->get_privilege();
@@ -442,7 +439,7 @@ API bool sensord_get_min_range(sensor_t sensor, float *min_range)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !min_range,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !min_range,
                false, "Invalid param: sensor (%p), min_range(%p)", sensor, min_range);
 
        *min_range = info->get_min_range();
@@ -454,7 +451,7 @@ API bool sensord_get_max_range(sensor_t sensor, float *max_range)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !max_range,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !max_range,
                false, "Invalid param: sensor (%p), max_range(%p)", sensor, max_range);
 
        *max_range = info->get_max_range();
@@ -466,7 +463,7 @@ API bool sensord_get_resolution(sensor_t sensor, float *resolution)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !resolution,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !resolution,
                false, "Invalid param: sensor (%p), resolution(%p)", sensor, resolution);
 
        *resolution = info->get_resolution();
@@ -478,7 +475,7 @@ API bool sensord_get_min_interval(sensor_t sensor, int *min_interval)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !min_interval,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !min_interval,
                false, "Invalid param: sensor (%p), min_interval(%p)", sensor, min_interval);
 
        *min_interval = info->get_min_interval();
@@ -490,7 +487,7 @@ API bool sensord_get_fifo_count(sensor_t sensor, int *fifo_count)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !fifo_count,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !fifo_count,
                false, "Invalid param: sensor (%p), fifo_count(%p)", sensor, fifo_count);
 
        *fifo_count = info->get_fifo_count();
@@ -502,7 +499,7 @@ API bool sensord_get_max_batch_count(sensor_t sensor, int *max_batch_count)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !max_batch_count,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !max_batch_count,
                false, "Invalid param: sensor (%p), max_batch_count(%p)", sensor, max_batch_count);
 
        *max_batch_count = info->get_max_batch_count();
@@ -514,7 +511,7 @@ API bool sensord_get_supported_event_types(sensor_t sensor, unsigned int **event
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !event_types || !count,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !event_types || !count,
                false, "Invalid param: sensor (%p), event_types(%p), count(%p)", sensor, event_types, count);
 
        unsigned int event_type;
@@ -533,7 +530,7 @@ API bool sensord_is_supported_event_type(sensor_t sensor, unsigned int event_typ
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !event_type || !supported,
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info) || !event_type || !supported,
                false, "Invalid param: sensor (%p), event_type(%p), supported(%p)", sensor, event_type, supported);
 
        *supported = info->is_supported_event(event_type);
@@ -545,7 +542,7 @@ API bool sensord_is_wakeup_supported(sensor_t sensor)
 {
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info),
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info),
                false, "Invalid param: sensor (%p)", sensor);
 
        return info->is_wakeup_supported();
@@ -561,7 +558,7 @@ API int sensord_connect(sensor_t sensor)
 
        sensor_info* info = sensor_to_sensor_info(sensor);
 
-       retvm_if (!sensor_info_manager::get_instance().is_valid(info),
+       retvm_if(!sensor_info_manager::get_instance().is_valid(info),
                OP_ERROR, "Invalid param: sensor (%p)", sensor);
 
        sensor_id_t sensor_id = info->get_id();
@@ -663,7 +660,7 @@ API bool sensord_disconnect(int handle)
        }
 
        client_id = sensor_client_info::get_instance().get_client_id();
-       retvm_if ((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name());
+       retvm_if((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name());
 
        _I("%s disconnects with %s[%d]", get_client_name(), get_sensor_name(sensor_id), handle);
 
@@ -697,14 +694,13 @@ API bool sensord_disconnect(int handle)
        return true;
 }
 
-
 static bool register_event(int handle, unsigned int event_type, unsigned int interval, int max_batch_latency, void* cb, void *user_data)
 {
        sensor_id_t sensor_id;
        sensor_rep prev_rep, cur_rep;
        bool ret;
 
-       retvm_if (!cb, false, "callback is NULL");
+       retvm_if(!cb, false, "callback is NULL");
 
        AUTOLOCK(lock);
 
@@ -760,7 +756,7 @@ API bool sensord_unregister_event(int handle, unsigned int event_type)
 
        if (!sensor_client_info::get_instance().unregister_event(handle, event_type)) {
                _E("%s try to unregister non registered event %s[%#x] for sensor %s[%d]",
-                       get_client_name(),get_event_name(event_type), event_type, get_sensor_name(sensor_id), handle);
+                       get_client_name(), get_event_name(event_type), event_type, get_sensor_name(sensor_id), handle);
                return false;
        }
 
@@ -771,15 +767,13 @@ API bool sensord_unregister_event(int handle, unsigned int event_type)
                sensor_client_info::get_instance().register_event(handle, event_type, prev_interval, prev_latency, prev_cb, prev_user_data);
 
        return ret;
-
 }
 
-
 API bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t cb, void *user_data)
 {
        sensor_id_t sensor_id;
 
-       retvm_if (!cb, false, "callback is NULL");
+       retvm_if(!cb, false, "callback is NULL");
 
        AUTOLOCK(lock);
 
@@ -788,14 +782,12 @@ API bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t c
                return false;
        }
 
-
        _I("%s registers accuracy_changed_cb for sensor %s[%d] with cb: %#x, user_data: %#x",
                get_client_name(), get_sensor_name(sensor_id), handle, cb, user_data);
 
        sensor_client_info::get_instance().register_accuracy_cb(handle, cb , user_data);
 
        return true;
-
 }
 
 API bool sensord_unregister_accuracy_cb(int handle)
@@ -809,7 +801,6 @@ API bool sensord_unregister_accuracy_cb(int handle)
                return false;
        }
 
-
        _I("%s unregisters accuracy_changed_cb for sensor %s[%d]",
                get_client_name(), get_sensor_name(sensor_id), handle);
 
@@ -818,7 +809,6 @@ API bool sensord_unregister_accuracy_cb(int handle)
        return true;
 }
 
-
 API bool sensord_start(int handle, int option)
 {
        sensor_id_t sensor_id;
@@ -833,7 +823,7 @@ API bool sensord_start(int handle, int option)
                return false;
        }
 
-       retvm_if ((option < 0) || (option >= SENSOR_OPTION_END), false, "Invalid option value : %d, handle: %d, %s, %s",
+       retvm_if((option < 0) || (option >= SENSOR_OPTION_END), false, "Invalid option value : %d, handle: %d, %s, %s",
                option, handle, get_sensor_name(sensor_id), get_client_name());
 
        _I("%s starts %s[%d], with option: %d, power save state: %d", get_client_name(), get_sensor_name(sensor_id),
@@ -874,10 +864,9 @@ API bool sensord_stop(int handle)
                return false;
        }
 
-       retvm_if ((sensor_state == SENSOR_STATE_STOPPED), true, "%s already stopped with %s[%d]",
+       retvm_if((sensor_state == SENSOR_STATE_STOPPED), true, "%s already stopped with %s[%d]",
                get_client_name(), get_sensor_name(sensor_id), handle);
 
-
        _I("%s stops sensor %s[%d]", get_client_name(), get_sensor_name(sensor_id), handle);
 
        sensor_client_info::get_instance().get_sensor_rep(sensor_id, prev_rep);
@@ -893,7 +882,6 @@ API bool sensord_stop(int handle)
        return ret;
 }
 
-
 static bool change_event_batch(int handle, unsigned int event_type, unsigned int interval, unsigned int latency)
 {
        sensor_id_t sensor_id;
@@ -982,10 +970,9 @@ API bool sensord_set_option(int handle, int option)
                return false;
        }
 
-       retvm_if ((option < 0) || (option >= SENSOR_OPTION_END), false, "Invalid option value : %d, handle: %d, %s, %s",
+       retvm_if((option < 0) || (option >= SENSOR_OPTION_END), false, "Invalid option value : %d, handle: %d, %s, %s",
                option, handle, get_sensor_name(sensor_id), get_client_name());
 
-
        sensor_client_info::get_instance().get_sensor_rep(sensor_id, prev_rep);
        sensor_client_info::get_instance().get_sensor_params(handle, prev_state, prev_option);
 
@@ -1004,7 +991,6 @@ API bool sensord_set_option(int handle, int option)
                sensor_client_info::get_instance().set_sensor_option(handle, prev_option);
 
        return ret;
-
 }
 
 API int sensord_set_attribute_int(int handle, int attribute, int value)
@@ -1026,7 +1012,7 @@ API int sensord_set_attribute_int(int handle, int attribute, int value)
        }
 
        client_id = sensor_client_info::get_instance().get_client_id();
-       retvm_if ((client_id < 0), -EPERM,
+       retvm_if((client_id < 0), -EPERM,
                        "Invalid client id : %d, handle: %d, %s, %s",
                        client_id, handle, get_sensor_name(sensor_id), get_client_name());
 
@@ -1063,7 +1049,7 @@ API int sensord_set_attribute_str(int handle, int attribute, const char *value,
                        value_len, value, handle, get_sensor_name(sensor_id), get_client_name());
 
        client_id = sensor_client_info::get_instance().get_client_id();
-       retvm_if ((client_id < 0), -EPERM,
+       retvm_if((client_id < 0), -EPERM,
                        "Invalid client id : %d, handle: %d, %s, %s",
                        client_id, handle, get_sensor_name(sensor_id), get_client_name());
 
@@ -1093,7 +1079,7 @@ API bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* senso
        int sensor_state;
        int client_id;
 
-       retvm_if ((!sensor_data), false, "sensor_data is NULL");
+       retvm_if((!sensor_data), false, "sensor_data is NULL");
 
        AUTOLOCK(lock);
 
@@ -1109,7 +1095,7 @@ API bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* senso
        }
 
        client_id = sensor_client_info::get_instance().get_client_id();
-       retvm_if ((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name());
+       retvm_if((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name());
 
        if (sensor_state != SENSOR_STATE_STARTED) {
                _E("Sensor %s is not started for client %s with handle: %d, sensor_state: %d", get_sensor_name(sensor_id), get_client_name(), handle, sensor_state);
@@ -1145,7 +1131,7 @@ API bool sensord_flush(int handle)
        }
 
        client_id = sensor_client_info::get_instance().get_client_id();
-       retvm_if ((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name());
+       retvm_if((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name());
 
        if (sensor_state != SENSOR_STATE_STARTED) {
                _E("Sensor %s is not started for client %s with handle: %d, sensor_state: %d", get_sensor_name(sensor_id), get_client_name(), handle, sensor_state);
index 3d68883..77e71f7 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef _CLIENT_COMMON_H_
 #define _CLIENT_COMMON_H_
 
-/*header for each sensor type*/
 #include <sensor_internal.h>
 #include <sensor_handle_info.h>
 #include <reg_event_info.h>
index 7724278..e4486b2 100644 (file)
@@ -28,8 +28,8 @@ command_channel::command_channel()
 : m_client_id(CLIENT_ID_INVALID)
 , m_sensor_id(UNKNOWN_SENSOR)
 {
-
 }
+
 command_channel::~command_channel()
 {
        if (m_command_socket.is_valid())
@@ -180,7 +180,6 @@ bool command_channel::cmd_get_sensor_list(void)
        return true;
 }
 
-
 bool command_channel::cmd_hello(sensor_id_t sensor)
 {
        cpacket *packet;
@@ -258,7 +257,6 @@ bool command_channel::cmd_byebye(void)
        if (m_command_socket.is_valid())
                m_command_socket.close();
 
-
        m_client_id = CLIENT_ID_INVALID;
        m_sensor_id = UNKNOWN_SENSOR;
 
@@ -413,7 +411,6 @@ bool command_channel::cmd_register_event(unsigned int event_type)
        return true;
 }
 
-
 bool command_channel::cmd_register_events(event_type_vector &event_vec)
 {
        auto it_event = event_vec.begin();
@@ -467,7 +464,6 @@ bool command_channel::cmd_unregister_event(unsigned int event_type)
        return true;
 }
 
-
 bool command_channel::cmd_unregister_events(event_type_vector &event_vec)
 {
        auto it_event = event_vec.begin();
index d34df17..a7dbf7e 100644 (file)
@@ -36,14 +36,12 @@ sensor_client_info::~sensor_client_info()
 {
 }
 
-
 sensor_client_info& sensor_client_info::get_instance(void)
 {
        static sensor_client_info inst;
        return inst;
 }
 
-
 int sensor_client_info::create_handle(sensor_id_t sensor)
 {
        sensor_handle_info handle_info;
@@ -67,7 +65,7 @@ int sensor_client_info::create_handle(sensor_id_t sensor)
        handle_info.m_accuracy_cb = NULL;
        handle_info.m_accuracy_user_data = NULL;
 
-       m_sensor_handle_infos.insert(pair<int,sensor_handle_info> (handle, handle_info));
+       m_sensor_handle_infos.insert(pair<int, sensor_handle_info>(handle, handle_info));
 
        return handle;
 }
@@ -87,7 +85,6 @@ bool sensor_client_info::delete_handle(int handle)
        return true;
 }
 
-
 bool sensor_client_info::is_active()
 {
        AUTOLOCK(m_handle_info_lock);
@@ -299,7 +296,6 @@ bool sensor_client_info::get_event_info(int handle, unsigned int event_type, uns
        if (!event_info)
                return NULL;
 
-
        interval = event_info->m_interval;
        cb = event_info->m_cb;
        user_data = event_info->m_user_data;
@@ -308,7 +304,6 @@ bool sensor_client_info::get_event_info(int handle, unsigned int event_type, uns
        return true;
 }
 
-
 void sensor_client_info::get_listening_sensors(sensor_id_vector &sensors)
 {
        AUTOLOCK(m_handle_info_lock);
@@ -321,7 +316,7 @@ void sensor_client_info::get_listening_sensors(sensor_id_vector &sensors)
        }
 
        sort(sensors.begin(), sensors.end());
-       unique(sensors.begin(),sensors.end());
+       unique(sensors.begin(), sensors.end());
 }
 
 void sensor_client_info::get_sensor_rep(sensor_id_t sensor, sensor_rep& rep) {
@@ -346,11 +341,11 @@ bool sensor_client_info::add_command_channel(sensor_id_t sensor, command_channel
                return false;
        }
 
-       m_command_channels.insert(pair<sensor_id_t, command_channel *> (sensor, cmd_channel));
+       m_command_channels.insert(pair<sensor_id_t, command_channel *>(sensor, cmd_channel));
 
        return true;
-
 }
+
 bool sensor_client_info::get_command_channel(sensor_id_t sensor, command_channel **cmd_channel)
 {
        auto it_channel = m_command_channels.find(sensor);
@@ -365,7 +360,6 @@ bool sensor_client_info::get_command_channel(sensor_id_t sensor, command_channel
        return true;
 }
 
-
 bool sensor_client_info::close_command_channel(void)
 {
        auto it_channel = m_command_channels.begin();
@@ -528,10 +522,8 @@ void sensor_client_info::get_active_event_types(sensor_id_t sensor, event_type_v
        sort(event_types.begin(), event_types.end());
 
        unique_copy(event_types.begin(), event_types.end(), back_inserter(active_event_types));
-
 }
 
-
 void sensor_client_info::get_all_handles(handle_vector &handles)
 {
        AUTOLOCK(m_handle_info_lock);
@@ -544,29 +536,28 @@ void sensor_client_info::get_all_handles(handle_vector &handles)
        }
 }
 
-void sensor_client_info::get_sensor_handle_info(sensor_id_t sensor, sensor_handle_info_map &handles_info) {
-
+void sensor_client_info::get_sensor_handle_info(sensor_id_t sensor, sensor_handle_info_map &handles_info)
+{
        AUTOLOCK(m_handle_info_lock);
 
        auto it_handle = m_sensor_handle_infos.begin();
 
        while (it_handle != m_sensor_handle_infos.end()) {
-               if (it_handle->second.m_sensor_id == sensor) {
-                       handles_info.insert(pair<int,sensor_handle_info> (it_handle->first, it_handle->second));
-               }
+               if (it_handle->second.m_sensor_id == sensor)
+                       handles_info.insert(pair<int, sensor_handle_info>(it_handle->first, it_handle->second));
 
                ++it_handle;
        }
 }
 
-void sensor_client_info::get_all_handle_info(sensor_handle_info_map &handles_info) {
-
+void sensor_client_info::get_all_handle_info(sensor_handle_info_map &handles_info)
+{
        AUTOLOCK(m_handle_info_lock);
 
        auto it_handle = m_sensor_handle_infos.begin();
 
        while (it_handle != m_sensor_handle_infos.end()) {
-               handles_info.insert(pair<int,sensor_handle_info> (it_handle->first, it_handle->second));
+               handles_info.insert(pair<int, sensor_handle_info>(it_handle->first, it_handle->second));
                ++it_handle;
        }
 }
index f6383bc..275e674 100644 (file)
@@ -48,8 +48,8 @@ using std::condition_variable;
 
 typedef vector<unsigned int> handle_vector;
 typedef vector<sensor_id_t> sensor_id_vector;
-typedef unordered_map<int,sensor_handle_info> sensor_handle_info_map;
-typedef unordered_map<sensor_id_t, command_channel*> sensor_command_channel_map;
+typedef unordered_map<int, sensor_handle_info> sensor_handle_info_map;
+typedef unordered_map<sensor_id_t, command_channel *> sensor_command_channel_map;
 
 typedef struct sensor_rep {
        bool active;
@@ -120,4 +120,5 @@ private:
 
        cmutex m_handle_info_lock;
 };
+
 #endif /* _SENSOR_CLIENT_INFO_H_ */
index 63e51d9..56cbfef 100644 (file)
@@ -82,13 +82,11 @@ void sensor_event_listener::operate_sensor(sensor_id_t sensor, int power_save_st
                if ((it_handle->second.m_sensor_state == SENSOR_STATE_STARTED) &&
                        power_save_state &&
                        !(it_handle->second.m_sensor_option & power_save_state)) {
-
                        m_client_info.set_sensor_state(it_handle->first, SENSOR_STATE_PAUSED);
                        _I("%s's %s[%d] is paused", get_client_name(), get_sensor_name(sensor), it_handle->first);
 
                } else if ((it_handle->second.m_sensor_state == SENSOR_STATE_PAUSED) &&
                        (!power_save_state || (it_handle->second.m_sensor_option & power_save_state))) {
-
                        m_client_info.set_sensor_state(it_handle->first, SENSOR_STATE_STARTED);
                        _I("%s's %s[%d] is resumed", get_client_name(), get_sensor_name(sensor), it_handle->first);
                }
@@ -159,7 +157,6 @@ void sensor_event_listener::handle_events(void* event)
                m_client_info.get_all_handle_info(handles_info);
 
                for (auto it_handle = handles_info.begin(); it_handle != handles_info.end(); ++it_handle) {
-
                        sensor_handle_info &sensor_handle_info = it_handle->second;
 
                        event_info = sensor_handle_info.get_reg_event_info(event_type);
@@ -213,7 +210,7 @@ client_callback_info* sensor_event_listener::get_callback_info(sensor_id_t senso
        client_callback_info* callback_info;
 
        callback_info = new(std::nothrow)client_callback_info;
-       retvm_if (!callback_info, NULL, "Failed to allocate memory");
+       retvm_if(!callback_info, NULL, "Failed to allocate memory");
 
        callback_info->sensor = sensor_info_to_sensor(sensor_info_manager::get_instance().get_info(sensor_id));
        callback_info->event_id = event_info->m_id;
@@ -348,7 +345,6 @@ void sensor_event_listener::listen_events(void)
                if (m_hup_observer)
                        m_hup_observer();
        }
-
 }
 
 bool sensor_event_listener::create_event_channel(void)
@@ -394,13 +390,11 @@ bool sensor_event_listener::create_event_channel(void)
        return true;
 }
 
-
 void sensor_event_listener::close_event_channel(void)
 {
        m_event_socket.close();
 }
 
-
 void sensor_event_listener::stop_event_listener(void)
 {
        const int THREAD_TERMINATING_TIMEOUT = 2;
@@ -434,7 +428,6 @@ void sensor_event_listener::clear(void)
        m_client_info.set_client_id(CLIENT_ID_INVALID);
 }
 
-
 void sensor_event_listener::set_hup_observer(hup_observer_t observer)
 {
        m_hup_observer = observer;
@@ -450,7 +443,7 @@ bool sensor_event_listener::start_event_listener(void)
        m_event_socket.set_transfer_mode();
 
        m_poller = new(std::nothrow) poller(m_event_socket.get_socket_fd());
-       retvm_if (!m_poller, false, "Failed to allocate memory");
+       retvm_if(!m_poller, false, "Failed to allocate memory");
 
        set_thread_state(THREAD_STATE_START);
 
index 5199d83..1c94475 100644 (file)
@@ -44,7 +44,7 @@
 
 typedef std::vector<unsigned int> handle_vector;
 typedef std::vector<sensor_id_t> sensor_id_vector;
-typedef std::unordered_map<int,sensor_handle_info> sensor_handle_info_map;
+typedef std::unordered_map<int, sensor_handle_info> sensor_handle_info_map;
 typedef std::unordered_map<sensor_id_t, command_channel*> sensor_command_channel_map;
 
 typedef struct {
@@ -122,4 +122,5 @@ private:
 
        void set_thread_state(thread_state state);
 };
+
 #endif /* _SENSOR_EVENT_LISTENER_H_ */
index 6a58cb7..99647d7 100644 (file)
@@ -35,7 +35,6 @@ sensor_handle_info::sensor_handle_info()
 , m_accuracy_cb(NULL)
 , m_accuracy_user_data(NULL)
 {
-
 }
 
 sensor_handle_info::~sensor_handle_info()
@@ -82,7 +81,7 @@ bool sensor_handle_info::add_reg_event_info(unsigned int event_type, unsigned in
        event_info.m_cb = cb;
        event_info.m_user_data = user_data;
 
-       m_reg_event_infos.insert(pair<unsigned int,reg_event_info> (event_type, event_info));
+       m_reg_event_infos.insert(pair<unsigned int, reg_event_info> (event_type, event_info));
 
        return true;
 }
@@ -106,7 +105,6 @@ void sensor_handle_info::clear_all_events(void)
        m_reg_event_infos.clear();
 }
 
-
 unsigned long long sensor_handle_info::renew_event_id(void)
 {
        return m_event_id++;
@@ -162,4 +160,3 @@ unsigned int sensor_handle_info::get_reg_event_count(void)
 {
        return m_reg_event_infos.size();
 }
-
index 1836194..00eba28 100644 (file)
@@ -26,7 +26,7 @@
 #include <string.h>
 #include <unordered_map>
 
-typedef std::unordered_map<unsigned int,reg_event_info> event_info_map;
+typedef std::unordered_map<unsigned int, reg_event_info> event_info_map;
 
 class sensor_handle_info {
 public:
@@ -59,5 +59,4 @@ private:
        static unsigned long long m_event_id;
 };
 
-
 #endif /* _SENSOR_HANDLE_INFO_H_ */
index 530eddd..a7a7810 100644 (file)
@@ -34,7 +34,6 @@ sensor_info_manager::~sensor_info_manager()
        auto it_info = m_sensor_infos.begin();
 
        while (it_info != m_sensor_infos.end()) {
-
                delete it_info->second;
                ++it_info;
        }
@@ -74,9 +73,8 @@ vector<sensor_info *> sensor_info_manager::get_infos(sensor_type_t type)
        else
                ret = m_sensor_infos.equal_range(type);
 
-       for (auto it_info = ret.first; it_info != ret.second; ++it_info) {
+       for (auto it_info = ret.first; it_info != ret.second; ++it_info)
                sensor_infos.push_back(it_info->second);
-       }
 
        return sensor_infos;
 }
@@ -91,7 +89,6 @@ const sensor_info* sensor_info_manager::get_info(sensor_id_t id)
        return it_info->second;
 }
 
-
 bool sensor_info_manager::is_valid(sensor_info* info)
 {
        auto it_info = m_info_set.find(info);
index e36acc9..86fa8fe 100644 (file)
@@ -50,4 +50,5 @@ private:
        id_to_info_map m_id_to_info_map;
        info_set m_info_set;
 };
+
 #endif /* _SENSOR_INFO_MANAGER_H_ */
index 7a0a3e1..c4c3fce 100644 (file)
@@ -174,7 +174,6 @@ bool sensord_get_fifo_count(sensor_t sensor, int *fifo_count);
  */
 bool sensord_get_max_batch_count(sensor_t sensor, int *max_batch_count);
 
-
 /**
  * @brief Get the supported event types of this sensor.
  *
@@ -185,7 +184,6 @@ bool sensord_get_max_batch_count(sensor_t sensor, int *max_batch_count);
  */
 bool sensord_get_supported_event_types(sensor_t sensor, unsigned int **event_types, int *count);
 
-
 /**
  * @brief Check a given event type is supporeted by this sensor.
  *
@@ -284,7 +282,6 @@ bool sensord_unregister_accuracy_cb(int handle);
  *                                with SENSOR_OPTION_ALWAYS_ON, it continues to listening events even when LCD is off or in power save mode.
  * @return true on success, otherwise false.
  */
-
 bool sensord_start(int handle, int option);
 
 /**
@@ -397,5 +394,4 @@ bool sensord_external_post(int handle, unsigned long long timestamp, const float
 }
 #endif
 
-
 #endif
index 469b8da..31496db 100644 (file)
@@ -75,7 +75,7 @@ typedef struct {
        float sensor_resolution;
 } sensor_data_properties_t;
 
-DEPRECATED int sf_is_sensor_event_available(sensor_type_t sensor_type , unsigned int event_type);
+DEPRECATED int sf_is_sensor_event_available(sensor_type_t sensor_type, unsigned int event_type);
 
 DEPRECATED int sf_get_data_properties(unsigned int data_id, sensor_data_properties_t *return_data_properties);
 
@@ -87,7 +87,7 @@ DEPRECATED int sf_check_rotation(unsigned long *rotation);
  * @fn int sf_connect(sensor_type_t sensor)
  * @brief  This API connects a sensor type to respective sensor. The application calls with the type of the sensor (ex. ACCELEROMETER_SENSOR) and on basis of that server takes decision of which plug-in to be connected. Once sensor connected application can proceed for data processing. This API returns a positive handle which should be used by application to communicate on sensor type.
  * @param[in] sensor_type your desired sensor type
- * @return if it succeed, it return handle value( >=0 ) , otherwise negative value return
+ * @return if it succeed, it return handle value( >=0 ), otherwise negative value return
  */
 DEPRECATED int sf_connect(sensor_type_t sensor_type);
 
@@ -95,57 +95,57 @@ DEPRECATED int sf_connect(sensor_type_t sensor_type);
  * @fn int sf_disconnect(int handle)
  * @brief This API disconnects an attached sensor from an application. Application must use the handle retuned after attaching the sensor. After detaching, the corresponding handle will be released.
  * @param[in] handle received handle value by sf_connect()
- * @return if it succeed, it return zero value , otherwise negative value return
+ * @return if it succeed, it return zero value, otherwise negative value return
  */
 DEPRECATED int sf_disconnect(int handle);
 
 /**
- * @fn int sf_start(int handle , int option)
+ * @fn int sf_start(int handle, int option)
  * @brief This API sends a start command to sensor server. This intimates server that the client side is ready to handle data and start processing. The parameter option should be '0' for current usages.
  * @param[in] handle received handle value by sf_connect()
  * @param[in] option With SENSOR_OPTION_DEFAULT, it stops to sense when LCD is off, and with SENSOR_OPTION_ALWAYS_ON, it continues to sense even when LCD is off
- * @return if it succeed, it return zero value , otherwise negative value return
+ * @return if it succeed, it return zero value, otherwise negative value return
  */
-DEPRECATED int sf_start(int handle , int option);
+DEPRECATED int sf_start(int handle, int option);
 
 /**
  * @fn int sf_stop(int handle)
  * @brief This API sends a stop command to the Sensor server indicating that the data processing is stopped from application side for this time.
  * @param[in] handle received handle value by sf_connect()
- * @return if it succeed, it return zero value , otherwise negative value return
+ * @return if it succeed, it return zero value, otherwise negative value return
  */
 DEPRECATED int sf_stop(int handle);
 
 /**
- * @fn int sf_register_event(int handle , unsigned int event_type , event_conditon_t *event_condition , sensor_callback_func_t cb , void *user_data )
+ * @fn int sf_register_event(int handle, unsigned int event_type, event_conditon_t *event_condition, sensor_callback_func_t cb, void *user_data )
  * @brief This API registers a user defined callback function with a connected sensor for a particular event. This callback function will be called when there is a change in the state of respective sensor. user_data will be the parameter used during the callback call. Callback interval can be adjusted using even_contion_t argument.
  * @param[in] handle received handle value by sf_connect()
  * @param[in] event_type your desired event_type to register it
  * @param[in] event_condition input event_condition for special event. if you want to register without event_condition, just use a NULL value
  * @param[in] cb your define callback function
  * @param[in] user_data        your option data that will be send when your define callback function called. if you don't have any option data, just use a NULL value
- * @return if it succeed, it return zero value , otherwise negative value return
+ * @return if it succeed, it return zero value, otherwise negative value return
  */
-DEPRECATED int sf_register_event(int handle , unsigned int event_type , event_condition_t *event_condition , sensor_callback_func_t cb , void *user_data );
+DEPRECATED int sf_register_event(int handle, unsigned int event_type, event_condition_t *event_condition, sensor_callback_func_t cb, void *user_data);
 
 /**
  * @fn int sf_unregister_event(int handle, unsigned int event_type)
  * @brief This API de-registers a user defined callback function with a sensor registered with the specified handle. After unsubscribe, no event will be sent to the application.
  * @param[in] handle received handle value by sf_connect()
  * @param[in] event_type your desired event_type that you want to unregister event
- * @return if it succeed, it return zero value , otherwise negative value return
+ * @return if it succeed, it return zero value, otherwise negative value return
  */
 DEPRECATED int sf_unregister_event(int handle, unsigned int event_type);
 
 /**
- * @fn int sf_get_data(int handle , unsigned int data_id , sensor_data_t* values)
+ * @fn int sf_get_data(int handle, unsigned int data_id, sensor_data_t* values)
  * @brief This API gets raw data from a sensor with connecting the sensor-server. The type of sensor is supplied and return data is stored in the output parameter values [].
  * @param[in] handle received handle value by sf_connect()
- * @param[in] data_id predefined data_ID as every sensor in own header - sensor_xxx.h , enum xxx_data_id {}
+ * @param[in] data_id predefined data_ID as every sensor in own header - sensor_xxx.h, enum xxx_data_id {}
  * @param[out] values return values
- * @return if it succeed, it return zero value , otherwise negative value return
+ * @return if it succeed, it return zero value, otherwise negative value return
  */
-DEPRECATED int sf_get_data(int handle , unsigned int data_id , sensor_data_t* values);
+DEPRECATED int sf_get_data(int handle, unsigned int data_id, sensor_data_t* values);
 
 /**
  * @fn int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition)
@@ -153,7 +153,7 @@ DEPRECATED int sf_get_data(int handle , unsigned int data_id , sensor_data_t* va
  * @param[in] handle received handle value by sf_connect()
  * @param[in] event_type your desired event_type that you want to unregister event
  * @param[in] event_condition your desired event condition that you want to change event
- * @return if it succeed, it return zero value , otherwise negative value return
+ * @return if it succeed, it return zero value, otherwise negative value return
  */
 DEPRECATED int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition);
 
@@ -162,7 +162,7 @@ DEPRECATED int sf_change_event_condition(int handle, unsigned int event_type, ev
  * @brief This API change sensor option .
  * @param[in] handle received handle value by sf_connect()
  * @param[in] option your desired option that you want to turn on sensor during LCD OFF
- * @return if it succeed, it return zero value , otherwise negative value return
+ * @return if it succeed, it return zero value, otherwise negative value return
  */
 
 DEPRECATED int sf_change_sensor_option(int handle, int option);
@@ -177,10 +177,8 @@ DEPRECATED int sf_change_sensor_option(int handle, int option);
  */
 DEPRECATED int sf_send_sensorhub_data(int handle, const char* data, int data_len);
 
-
 #ifdef __cplusplus
 }
 #endif
 
-
 #endif
index 0e73602..91630c4 100644 (file)
@@ -113,7 +113,6 @@ typedef enum {
        SENSOR_DEVICE_STRESS_MONITOR,
        SENSOR_DEVICE_AUTOSESSION_EXERCISE,
        SENSOR_DEVICE_STAIR_TRACKER,
-
 } sensor_device_type;
 
 /*
@@ -138,7 +137,7 @@ typedef struct sensor_info_t {
 enum sensor_accuracy_t {
        SENSOR_ACCURACY_UNDEFINED = -1,
        SENSOR_ACCURACY_BAD = 0,
-       SENSOR_ACCURACY_NORMAL =1,
+       SENSOR_ACCURACY_NORMAL = 1,
        SENSOR_ACCURACY_GOOD = 2,
        SENSOR_ACCURACY_VERYGOOD = 3
 };
index 90fd8bd..3470850 100644 (file)
@@ -28,7 +28,6 @@ accel_sensor::accel_sensor()
 
 accel_sensor::~accel_sensor()
 {
-
 }
 
 sensor_type_t accel_sensor::get_type(void)
index ab280a2..cfcc72d 100644 (file)
@@ -31,4 +31,5 @@ public:
        virtual bool stop(void);
        virtual bool get_rotation(float acc[3], unsigned long long timestamp, int prev_rotation, int &rotation) = 0;
 };
+
 #endif /* _AUTO_ROTATION_ALG_H_ */
index 953d11d..1c9357c 100644 (file)
@@ -32,4 +32,5 @@ public:
 private:
        int convert_rotation(int prev_rotation, float acc_pitch, float acc_theta);
 };
+
 #endif /* _AUTO_ROTATION_ALG_EMUL_H_ */
index e1d90f1..335d41e 100644 (file)
@@ -155,7 +155,6 @@ void auto_rotation_sensor::synthesize(const sensor_event_t& event)
        push(rotation_event);
 
        _D("Rotation: %d, ACC[0]: %f, ACC[1]: %f, ACC[2]: %f", rotation, event.data->values[0], event.data->values[1], event.data->values[2]);
-       return;
 }
 
 int auto_rotation_sensor::get_data(sensor_data_t **data, int *length)
index 0a90e58..ff56ead 100644 (file)
@@ -110,7 +110,7 @@ fusion_sensor::fusion_sensor()
 
        _I("m_accel_static_bias = (%f, %f, %f)", m_accel_static_bias[0], m_accel_static_bias[1], m_accel_static_bias[2]);
 
-       if (!config.get(SENSOR_TYPE_FUSION, ELEMENT_GYRO_STATIC_BIAS, m_gyro_static_bias,3)) {
+       if (!config.get(SENSOR_TYPE_FUSION, ELEMENT_GYRO_STATIC_BIAS, m_gyro_static_bias, 3)) {
                _E("[GYRO_STATIC_BIAS] is empty\n");
                throw ENXIO;
        }
@@ -304,8 +304,6 @@ void fusion_sensor::synthesize(const sensor_event_t &event, vector<sensor_event_
 
                m_orientation_filter.get_device_orientation(m_accel_ptr, m_gyro_ptr, m_magnetic_ptr);
 
-
-
                if (m_enable_fusion == GYROSCOPE_UNCAL_ENABLED && sensor_base::is_supported(FUSION_GYROSCOPE_UNCAL_ENABLED)) {
                        m_time = get_timestamp();
                        fusion_event.sensor_id = get_id();
@@ -340,7 +338,6 @@ void fusion_sensor::synthesize(const sensor_event_t &event, vector<sensor_event_
                }
 
                m_enable_fusion = 0;
-
                m_accel_ptr = m_gyro_ptr = m_magnetic_ptr = NULL;
        }
 
@@ -411,8 +408,7 @@ int fusion_sensor::get_sensor_data(const unsigned int event_type, sensor_data_t
                data.values[0] = m_orientation_filter_poll.m_gyro_bias.m_vec[0];
                data.values[1] = m_orientation_filter_poll.m_gyro_bias.m_vec[1];
                data.values[2] = m_orientation_filter_poll.m_gyro_bias.m_vec[2];
-       }
-       else if (event_type == FUSION_ORIENTATION_ENABLED ||
+       } else if (event_type == FUSION_ORIENTATION_ENABLED ||
                        event_type == FUSION_ROTATION_VECTOR_ENABLED ||
                        event_type == FUSION_GAMING_ROTATION_VECTOR_ENABLED ||
                        event_type == FUSION_TILT_ENABLED ||
index 1f2692d..c02c263 100644 (file)
@@ -53,4 +53,3 @@ int quat_to_matrix(const float *quat, float *R)
 
        return 0;
 }
-
index 10bde5f..8b41fc5 100644 (file)
@@ -51,7 +51,7 @@
 
 #define DEG2RAD(x) ((x) * M_PI / 180.0)
 #define NORM(x, y, z) sqrt((x)*(x) + (y)*(y) + (z)*(z))
-#define ARCTAN(x, y) ((x) == 0 ? 0 : (y) != 0 ? atan2((x),(y)) : (x) > 0 ? M_PI/2.0 : -M_PI/2.0)
+#define ARCTAN(x, y) ((x) == 0 ? 0 : (y) != 0 ? atan2((x), (y)) : (x) > 0 ? M_PI/2.0 : -M_PI/2.0)
 
 gravity_sensor::gravity_sensor()
 : m_fusion(NULL)
index 0425226..aa48965 100644 (file)
@@ -30,5 +30,4 @@ hrm_sensor::hrm_sensor()
 
 hrm_sensor::~hrm_sensor()
 {
-
 }
index 091cb12..32e3ef7 100644 (file)
@@ -248,8 +248,7 @@ void orientation_sensor::synthesize(const sensor_event_t &event, vector<sensor_e
                if(m_raw_data_unit == "DEGREES") {
                        euler = rad2deg(euler);
                        azimuth_offset = AZIMUTH_OFFSET_DEGREES;
-               }
-               else {
+               } else {
                        azimuth_offset = AZIMUTH_OFFSET_RADIANS;
                }
 
@@ -294,8 +293,7 @@ int orientation_sensor::get_sensor_data(const unsigned int event_type, sensor_da
        if(m_raw_data_unit == "DEGREES") {
                euler = rad2deg(euler);
                azimuth_offset = AZIMUTH_OFFSET_DEGREES;
-       }
-       else {
+       } else {
                azimuth_offset = AZIMUTH_OFFSET_RADIANS;
        }
 
@@ -321,8 +319,7 @@ bool orientation_sensor::get_properties(sensor_type_t sensor_type, sensor_proper
        if(m_raw_data_unit == "DEGREES") {
                properties.min_range = -180;
                properties.max_range = 360;
-       }
-       else {
+       } else {
                properties.min_range = -PI;
                properties.max_range = 2 * PI;
        }
index b2d4e99..bfccfaf 100644 (file)
@@ -97,7 +97,7 @@ gaming_rv_sensor::gaming_rv_sensor()
 
        _I("m_accel_static_bias = (%f, %f, %f)", m_accel_static_bias[0], m_accel_static_bias[1], m_accel_static_bias[2]);
 
-       if (!config.get(SENSOR_TYPE_GAMING_RV, ELEMENT_GYRO_STATIC_BIAS, m_gyro_static_bias,3)) {
+       if (!config.get(SENSOR_TYPE_GAMING_RV, ELEMENT_GYRO_STATIC_BIAS, m_gyro_static_bias, 3)) {
                _E("[GYRO_STATIC_BIAS] is empty\n");
                throw ENXIO;
        }
index 1008ed3..1f784e7 100644 (file)
@@ -257,4 +257,3 @@ bool rv_sensor::get_properties(sensor_type_t sensor_type, sensor_properties_s &p
 
        return true;
 }
-
index c3bfbe5..e028c65 100644 (file)
@@ -52,7 +52,6 @@ euler_angles<TYPE>::euler_angles(const euler_angles<TYPE>& e)
 template <typename TYPE>
 euler_angles<TYPE>::~euler_angles()
 {
-
 }
 
 template <typename TYPE>
index 5af46ff..7e1cd8d 100644 (file)
@@ -228,8 +228,8 @@ inline void orientation_filter<TYPE>::time_update()
 
        m_pred_cov = (m_tran_mat * m_pred_cov * tran(m_tran_mat)) + m_driv_cov;
 
-       for (int j=0; j<M6X6C; ++j) {
-               for (int i=0; i<M6X6R; ++i)     {
+       for (int j = 0; j < M6X6C; ++j) {
+               for (int i = 0; i < M6X6R; ++i) {
                        if (ABS(m_pred_cov.m_mat[i][j]) < NEGLIGIBLE_VAL)
                                m_pred_cov.m_mat[i][j] = NEGLIGIBLE_VAL;
                }
@@ -248,8 +248,7 @@ inline void orientation_filter<TYPE>::time_update()
        m_quat_driv = (m_quat_driv * quat_eu_er) * (TYPE) PI;
        m_quat_driv.quat_normalize();
 
-       if (is_initialized(m_state_new))
-       {
+       if (is_initialized(m_state_new)) {
                m_state_error.m_vec[0] = m_euler_error.m_ang.m_vec[0];
                m_state_error.m_vec[1] = m_euler_error.m_ang.m_vec[1];
                m_state_error.m_vec[2] = m_euler_error.m_ang.m_vec[2];
@@ -288,12 +287,9 @@ inline void orientation_filter<TYPE>::time_update_gaming_rv()
        euler_aid = quat2euler(m_quat_aid);
        euler_driv = quat2euler(m_quat_output);
 
-       if ((SQUARE(m_accel.m_data.m_vec[1]) < ACCEL_THRESHOLD) && (SQUARE(m_gyro.m_data.m_vec[0]) < GYRO_THRESHOLD))
-       {
-               if ((SQUARE(m_accel.m_data.m_vec[0]) < ACCEL_THRESHOLD) && (SQUARE(m_gyro.m_data.m_vec[1]) < GYRO_THRESHOLD))
-               {
-                       if (SQUARE(m_gyro.m_data.m_vec[2]) < GYRO_THRESHOLD)
-                       {
+       if ((SQUARE(m_accel.m_data.m_vec[1]) < ACCEL_THRESHOLD) && (SQUARE(m_gyro.m_data.m_vec[0]) < GYRO_THRESHOLD)) {
+               if ((SQUARE(m_accel.m_data.m_vec[0]) < ACCEL_THRESHOLD) && (SQUARE(m_gyro.m_data.m_vec[1]) < GYRO_THRESHOLD)) {
+                       if (SQUARE(m_gyro.m_data.m_vec[2]) < GYRO_THRESHOLD) {
                                euler_angles<TYPE> euler_gaming_rv(euler_aid.m_ang.m_vec[0], euler_aid.m_ang.m_vec[1],
                                                euler_driv.m_ang.m_vec[2]);
                                m_quat_gaming_rv = euler2quat(euler_gaming_rv);
@@ -319,22 +315,22 @@ inline void orientation_filter<TYPE>::measurement_update()
        iden.m_mat[0][0] = iden.m_mat[1][1] = iden.m_mat[2][2] = 1;
        iden.m_mat[3][3] = iden.m_mat[4][4] = iden.m_mat[5][5] = 1;
 
-       for (int j=0; j<M6X6C; ++j) {
-               for (int i=0; i<M6X6R; ++i) {
+       for (int j = 0; j < M6X6C; ++j) {
+               for (int i = 0; i < M6X6R; ++i) {
                        gain.m_mat[i][j] = m_pred_cov.m_mat[j][i] / (m_pred_cov.m_mat[j][j] + m_aid_cov.m_mat[j][j]);
                        m_state_new.m_vec[i] = m_state_new.m_vec[i] + gain.m_mat[i][j] * m_state_error.m_vec[j];
                }
 
                matrix<TYPE, M6X6R, M6X6C> temp = iden;
 
-               for (int i=0; i<M6X6R; ++i)
+               for (int i = 0; i < M6X6R; ++i)
                        temp.m_mat[i][j] = iden.m_mat[i][j] - (gain.m_mat[i][j] * m_measure_mat.m_mat[j][i]);
 
                m_pred_cov = temp * m_pred_cov;
        }
 
-       for (int j=0; j<M6X6C; ++j) {
-               for (int i=0; i<M6X6R; ++i) {
+       for (int j = 0; j < M6X6C; ++j) {
+               for (int i = 0; i < M6X6R; ++i) {
                        if (ABS(m_pred_cov.m_mat[i][j]) < NEGLIGIBLE_VAL)
                                m_pred_cov.m_mat[i][j] = NEGLIGIBLE_VAL;
                }
@@ -357,39 +353,22 @@ void orientation_filter<TYPE>::get_device_orientation(const sensor_data<TYPE> *a
        initialize_sensor_data(accel, gyro, magnetic);
 
        if (gyro != NULL && magnetic != NULL) {
-
                orientation_triad_algorithm();
-
                compute_covariance();
-
                time_update();
-
                measurement_update();
-
                m_quaternion = m_quat_9axis;
-
        } else if (!gyro && !magnetic) {
-
                compute_accel_orientation();
-
                m_quaternion = m_quat_aid;
-
        } else if (!gyro) {
-
                orientation_triad_algorithm();
-
                m_quaternion = m_quat_aid;
-
        } else if (!magnetic) {
-
                compute_accel_orientation();
-
                compute_covariance();
-
                time_update_gaming_rv();
-
                measurement_update();
-
                m_quaternion = m_quat_gaming_rv;
        }
 }
index fd3e6b5..fa89881 100644 (file)
@@ -29,7 +29,6 @@ template <typename T> T get_sign(T val)
 template <typename TYPE>
 rotation_matrix<TYPE>::rotation_matrix() : m_rot_mat()
 {
-
 }
 
 template <typename TYPE>
@@ -54,7 +53,6 @@ rotation_matrix<TYPE>::rotation_matrix(const rotation_matrix<TYPE>& rm)
 template <typename TYPE>
 rotation_matrix<TYPE>::~rotation_matrix()
 {
-
 }
 
 template <typename TYPE>
index 1fa3c5c..6841369 100644 (file)
@@ -51,7 +51,6 @@ public:
                        const vect<T, REF_VEC_SIZE> ref_vec);
        template<typename T> friend void pre_process_data(sensor_data<T> &data_out,
                        const T *data_in, T *bias, int *sign, int scale);
-
 };
 
 #include "sensor_data.cpp"
index 477b4db..a67627e 100644 (file)
@@ -50,7 +50,6 @@ void orientation_sensor::get_device_orientation(sensor_data<float> *accel_data,
        }
 
        orien_filter.get_device_orientation(accel_data, gyro_data, magnetic_data);
-
 }
 
-#endif
+#endif /* _ORIENTATION_SENSOR_H_ */
index 4a3104d..fc69bd5 100644 (file)
@@ -26,10 +26,10 @@ int main()
        float arr2[4] = {0.6, 0.6, -.18, -.44};
        float arr3[4] = {-0.5, -0.36, .43, .03};
 
-       vect<float,3> v0(arr0);
-       vect<float,3> v1(arr1);
-       vect<float,4> v2(arr2);
-       vect<float,4> v3(arr3);
+       vect<float, 3> v0(arr0);
+       vect<float, 3> v1(arr1);
+       vect<float, 4> v2(arr2);
+       vect<float, 4> v3(arr3);
 
        quaternion<float> q1(v2);
        quaternion<float> q2(v3);
index a9f801c..3525c32 100644 (file)
@@ -52,7 +52,7 @@ int main()
                sdata[0] = strtof(line_accel.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> accel_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Accel Data\t" << accel_data.m_data << "\t Time Stamp\t" << accel_data.m_time_stamp << "\n\n";
@@ -61,7 +61,7 @@ int main()
                sdata[0] = strtof(line_gyro.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> gyro_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Gyro Data\t" << gyro_data.m_data << "\t Time Stamp\t" << gyro_data.m_time_stamp << "\n\n";
@@ -70,7 +70,7 @@ int main()
                sdata[0] = strtof(line_magnetic.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> magnetic_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Magnetic Data\t" << magnetic_data.m_data << "\t Time Stamp\t" << magnetic_data.m_time_stamp << "\n\n";
index 302affa..958559a 100644 (file)
@@ -52,7 +52,7 @@ int main()
                sdata[0] = strtof(line_accel.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> accel_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Accel Data\t" << accel_data.m_data << "\t Time Stamp\t" << accel_data.m_time_stamp << "\n\n";
@@ -61,7 +61,7 @@ int main()
                sdata[0] = strtof(line_gyro.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> gyro_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Gyro Data\t" << gyro_data.m_data << "\t Time Stamp\t" << gyro_data.m_time_stamp << "\n\n";
@@ -70,7 +70,7 @@ int main()
                sdata[0] = strtof(line_magnetic.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> magnetic_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Magnetic Data\t" << magnetic_data.m_data << "\t Time Stamp\t" << magnetic_data.m_time_stamp << "\n\n";
index 8227c3a..05b1743 100644 (file)
@@ -21,8 +21,8 @@
 
 int main()
 {
-       float arr0[2][2] = {{-2.243, 2.57},{3.56, -3.02}};
-       float arr1[2][2] = {{2.2, 2.5},{3.5, 3.0}};
+       float arr0[2][2] = {{-2.243, 2.57}, {3.56, -3.02}};
+       float arr1[2][2] = {{2.2, 2.5}, {3.5, 3.0}};
        float arr5[3][2] = {{0.22, 4.56}, {3.652, 5.86}, {1.430, 0.45}};
        float arr11[1][3] = {{2.0, 3.0, 4.0}};
        float arr12[3][1] = {{2.0}, {1.0}, {3.0}};
@@ -46,83 +46,83 @@ int main()
        matrix<float, 2, 3> m22(arr15);
        matrix<float, 3, 3> m9(arr9);
 
-       cout<< "Constructor Test\n";
-       cout<< "\n" << m6;
+       cout << "Constructor Test\n";
+       cout << "\n" << m6;
 
-       cout<<"\n\nAddition\n";
+       cout << "\n\nAddition\n";
        m6 = m10 + m15;
        m13 = m11 + m11;
-       cout<< "\n" << m10 <<"\n"<< m15;
-       cout<< "\nSum:\n" << m6 << endl;
-       cout<< "\n" << m11 << "\n"<< m11;
-       cout<< "\nSum:\n" << m13 << endl;
+       cout << "\n" << m10 << "\n" << m15;
+       cout << "\nSum:\n" << m6 << endl;
+       cout << "\n" << m11 << "\n" << m11;
+       cout << "\nSum:\n" << m13 << endl;
 
-       cout<< "\n\n\nSubtraction\n";
+       cout << "\n\n\nSubtraction\n";
        m6 = m10 - m12;
-       cout<< "\n" << m10 << "\n" << m12;
-       cout<< "\nDifference:\n" << m6 << endl;
+       cout << "\n" << m10 << "\n" << m12;
+       cout << "\nDifference:\n" << m6 << endl;
 
-       cout<< "\n\n\nMultiplication\n";
+       cout << "\n\n\nMultiplication\n";
        m6 = m10 * m12;
        m3 = m1 * m2;
        matrix<float, 1, 1> m7;
        m7 = m20 * m21;
-       cout<< "\n" << m10 << "\n" << m12;
-       cout<< "\nProduct:\n" << m6 << endl;
-       cout<< "\n" << m1 << "\n" << m2;
-       cout<< "\nProduct:\n" << m3 << endl;
-       cout<< "\n" << m20 << "\n" << m21;
-       cout<< "\nProduct:\n" << m7 << endl;
-       cout<< "\n" << m9 << "\n" << m21;
+       cout << "\n" << m10 << "\n" << m12;
+       cout << "\nProduct:\n" << m6 << endl;
+       cout << "\n" << m1 << "\n" << m2;
+       cout << "\nProduct:\n" << m3 << endl;
+       cout << "\n" << m20 << "\n" << m21;
+       cout << "\nProduct:\n" << m7 << endl;
+       cout << "\n" << m9 << "\n" << m21;
        m21 = m9 * m21;
-       cout<< "\nProduct:\n" << m21 << endl;
+       cout << "\nProduct:\n" << m21 << endl;
 
-       cout<< "\n\n\nDivision\n";
+       cout << "\n\n\nDivision\n";
        m3 = m1 / (float)2.5;
-       cout<< "\n" << m1 << "\n" << "2.5";
-       cout<< "\nResult:\n" << m3 << endl;
+       cout << "\n" << m1 << "\n" << "2.5";
+       cout << "\nResult:\n" << m3 << endl;
        m6 = m12 / (float)0.125;
-       cout<< "\n" << m12 << "\n" << ".125";
-       cout<< "\nResult:\n" << m6 << endl;
+       cout << "\n" << m12 << "\n" << ".125";
+       cout << "\nResult:\n" << m6 << endl;
 
        float num = 5.5650;
        float num1 = -2.32;
-       cout<< "\n\n\nScalar addition\n";
+       cout << "\n\n\nScalar addition\n";
        m3 = m2 + num;
        m6 = m10 + num1;
-       cout<< "\nNumber added:" << num;
-       cout<< "\n\n" << m2;
-       cout<< "\nResult:\n\n" << m3;
-       cout<< "\nNumber added:" << num1;
-       cout<< "\n\n" << m10;
-       cout<< "\nResult:\n\n" << m6;
+       cout << "\nNumber added:" << num;
+       cout << "\n\n" << m2;
+       cout << "\nResult:\n\n" << m3;
+       cout << "\nNumber added:" << num1;
+       cout << "\n\n" << m10;
+       cout << "\nResult:\n\n" << m6;
 
        float x = 4.0;
        float x1 = -2.5;
-       cout<< "\n\n\nScalar subtraction\n";
+       cout << "\n\n\nScalar subtraction\n";
        m13 = m11 - x;
        m6 = m10 - x1;
-       cout<< "\nNumber Subtracted:" << x;
-       cout<< "\n\n" << m11;
-       cout<< "\nResult:\n\n" << m13;
-       cout<< "\nNumber Subtracted:" << x1;
-       cout<< "\n\n" << m10;
-       cout<< "\nResult:\n\n" << m6;
+       cout << "\nNumber Subtracted:" << x;
+       cout << "\n\n" << m11;
+       cout << "\nResult:\n\n" << m13;
+       cout << "\nNumber Subtracted:" << x1;
+       cout << "\n\n" << m10;
+       cout << "\nResult:\n\n" << m6;
 
        float z = 3.50;
        float z1 = -5.567;
-       cout<< "\n\n\nScalar multiplication\n";
+       cout << "\n\n\nScalar multiplication\n";
        m3 = m1 * z;
        m6 = m12 * z1;
-       cout<< "\nNumber Multiplied:"<< z;
-       cout<< "\n\n" << m1;
-       cout<< "\nResult:\n\n" << m3;
-       cout<< "\nNumber Multiplied:" << z1;
-       cout<< "\n\n" << m12;
-       cout<< "\nResult:\n\n" << m6;
+       cout << "\nNumber Multiplied:" << z;
+       cout << "\n\n" << m1;
+       cout << "\nResult:\n\n" << m3;
+       cout << "\nNumber Multiplied:" << z1;
+       cout << "\n\n" << m12;
+       cout << "\nResult:\n\n" << m6;
 
        m6 = tran(m15);
-       cout<< "\n\n\nTranspose:";
+       cout << "\n\n\nTranspose:";
        cout << "\n\n" << m15;
        cout << "\nResult:\n\n" << m6;
 
@@ -147,9 +147,8 @@ int main()
        cout << (m6 != m1);
 
 
-       cout<< "\n\nAssignment\n";
+       cout << "\n\nAssignment\n";
        matrix<float, 3, 3> m30 = m12;
-       cout<< "Input \n" << m12;
-       cout<< "\nOutput:\n" << m30 << endl;
-
+       cout << "Input \n" << m12;
+       cout << "\nOutput:\n" << m30 << endl;
 }
index feb7e77..d0a41fd 100644 (file)
@@ -59,7 +59,7 @@ int main()
                sdata[0] = strtof(line_accel.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> accel_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Accel Data\t" << accel_data.m_data << "\t Time Stamp\t" << accel_data.m_time_stamp << "\n\n";
@@ -68,7 +68,7 @@ int main()
                sdata[0] = strtof(line_gyro.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> gyro_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Gyro Data\t" << gyro_data.m_data << "\t Time Stamp\t" << gyro_data.m_time_stamp << "\n\n";
@@ -77,7 +77,7 @@ int main()
                sdata[0] = strtof(line_magnetic.c_str(), &token);
                sdata[1] = strtof(token, &token);
                sdata[2] = strtof(token, &token);
-               time_stamp = strtoull (token, NULL, 10);
+               time_stamp = strtoull(token, NULL, 10);
                sensor_data<float> magnetic_data(sdata[0], sdata[1], sdata[2], time_stamp);
 
                cout << "Magnetic Data\t" << magnetic_data.m_data << "\t Time Stamp\t" << magnetic_data.m_time_stamp << "\n\n";
index 09f980f..f437d6c 100644 (file)
@@ -73,6 +73,5 @@ int main()
        quaternion<float> q11 = axis2quat(v2, ang1);
        cout << "output\t" << q11.m_quat << "\n\n";
        cout << endl;
-
 }
 
index 4477daa..526bda4 100644 (file)
@@ -23,8 +23,8 @@ int main()
 {
        float arr1[3] = {1.04, -4.678, -2.34};
        float arr2[3] = {0, 0, 1};
-       vect<float,3> v1(arr1);
-       vect<float,3> v2(arr2);
+       vect<float, 3> v1(arr1);
+       vect<float, 3> v2(arr2);
 
        sensor_data<float> sd1(2.0, 3.0, 4.0, 140737488355328);
        sensor_data<float> sd2(1.04, -4.678, -2.34, 0);
@@ -39,31 +39,31 @@ int main()
        cout << "input\t" << v1 << "\n";
        cout << "output\t" << sd2.m_data << "\t" << sd2.m_time_stamp << "\n\n";
 
-       cout<< "Addition:\n";
+       cout << "Addition:\n";
        sensor_data<float> sd4 = sd1 + sd2;
-       cout<< "\n" << sd1.m_data << "\n" << sd2.m_data;
-       cout<< "\nSum:\n" << sd4.m_data << endl;
+       cout << "\n" << sd1.m_data << "\n" << sd2.m_data;
+       cout << "\nSum:\n" << sd4.m_data << endl;
        sensor_data<float> sd9 = sd1 + sd10;
-       cout<< "\n" << sd1.m_data << "\n" << sd10.m_data;
-       cout<< "\nSum:\n" << sd9.m_data << endl;
+       cout << "\n" << sd1.m_data << "\n" << sd10.m_data;
+       cout << "\nSum:\n" << sd9.m_data << endl;
 
-       cout<< "\n\n\nNormalization:\n";
-       cout<< "\n" << sd3.m_data;
+       cout << "\n\n\nNormalization:\n";
+       cout << "\n" << sd3.m_data;
        normalize(sd3);
-       cout<< "\nResult:\n" << sd3.m_data << endl;
-       cout<< "\n" << sd2.m_data;
+       cout << "\nResult:\n" << sd3.m_data << endl;
+       cout << "\n" << sd2.m_data;
        normalize(sd2);
-       cout<< "\nResult:\n" << sd2.m_data << endl;
+       cout << "\nResult:\n" << sd2.m_data << endl;
 
        float xx = 2.5;
-       cout<<"\n\n\nScale data:\n";
+       cout << "\n\n\nScale data:\n";
        sensor_data<float> sd8 = scale_data(sd2, xx);
-       cout<< "\n" << sd2.m_data << "\n" << xx;
-       cout<< "\nResult:\n" << sd8.m_data << endl;
+       cout << "\n" << sd2.m_data << "\n" << xx;
+       cout << "\nResult:\n" << sd8.m_data << endl;
 
-       cout<<"\n\n\nConvert Sensor Data to Quaternion:\n";
+       cout << "\n\n\nConvert Sensor Data to Quaternion:\n";
        quaternion<float> q = sensor_data2quat(sd11, v2);
-       cout<< "\n" << sd11.m_data << "\n" << v2;
-       cout<< "\nResult:\n" << q.m_quat << endl;
+       cout << "\n" << sd11.m_data << "\n" << v2;
+       cout << "\nResult:\n" << q.m_quat << endl;
 }
 
index bca9d2d..2a81f83 100644 (file)
 
 int main()
 {
-       float arr2[3] = {0.056,2.34,-65.76};
-       float arr15[3] = {1.04,-4.678,-2.34};
-       float arr3[4] = {1.03,2.345,6.78,5.55};
-       float arr4[4] = {-6.78,-45.213,-7.89,-3.456};
-       float arr8[5] = {0.0123,5.678,2.345,0.345,8.956};
-       float arr0[5] = {2344.98,345.24,456.12,98.33,144.67};
-       float arr1[6] = {1.234,4.5,6.8987,3.33,5.66,77.695};
-       float arr43[6] = {2.3454,-0.0384,-8.90,3.455,6.785,21.345};
-       float arr5[5] = {0.2,-0.4,0.6,-0.8,1.0};
-
-       vect<float,5> v1(arr0);
-       vect<float,5> v2(arr8);
-       vect<float,4> v10(arr3);
-       vect<float,4> v12(arr4);
-       vect<float,6> v15(arr1);
-       vect<float,6> v20(arr43);
-       vect<float,3> v21(arr2);
-       vect<float,3> v22(arr15);
-       vect<float,5> v31(arr0);
-       vect<float,3> v3;
-       vect<float,2> vn;
-       vect<float,4> v61(arr4);
-       vect<float,3> v6;
-       vect<float,4> vm;
-       vect<float,5> v13;
-       vect<float,6> v95;
-       vect<float,5> v35(arr5);
-       vect<float,5> vl;
-       vect<float,4> vp;
-       vect<float,4> vr(arr4);
-       vect<float,3> vf;
+       float arr2[3] = {0.056, 2.34, -65.76};
+       float arr15[3] = {1.04, -4.678, -2.34};
+       float arr3[4] = {1.03, 2.345, 6.78, 5.55};
+       float arr4[4] = {-6.78, -45.213, -7.89, -3.456};
+       float arr8[5] = {0.0123, 5.678, 2.345, 0.345, 8.956};
+       float arr0[5] = {2344.98, 345.24, 456.12, 98.33, 144.67};
+       float arr1[6] = {1.234, 4.5, 6.8987, 3.33, 5.66, 77.695};
+       float arr43[6] = {2.3454, -0.0384, -8.90, 3.455, 6.785, 21.345};
+       float arr5[5] = {0.2, -0.4, 0.6, -0.8, 1.0};
+
+       vect<float, 5> v1(arr0);
+       vect<float, 5> v2(arr8);
+       vect<float, 4> v10(arr3);
+       vect<float, 4> v12(arr4);
+       vect<float, 6> v15(arr1);
+       vect<float, 6> v20(arr43);
+       vect<float, 3> v21(arr2);
+       vect<float, 3> v22(arr15);
+       vect<float, 5> v31(arr0);
+       vect<float, 3> v3;
+       vect<float, 2> vn;
+       vect<float, 4> v61(arr4);
+       vect<float, 3> v6;
+       vect<float, 4> vm;
+       vect<float, 5> v13;
+       vect<float, 6> v95;
+       vect<float, 5> v35(arr5);
+       vect<float, 5> vl;
+       vect<float, 4> vp;
+       vect<float, 4> vr(arr4);
+       vect<float, 3> vf;
 
        float arr57[3][3] = {{2.24, 0.5, 0.023}, {3.675, 5.32, 0.556}, {1.023, 45.75, 621.6}};
-       matrix<float,3 ,3> m12(arr57);
+       matrix<float, 3, 3> m12(arr57);
        float arr67[3][1] = {{2.0}, {3.0}, {4.0}};
-       matrix<float,3,1> m32(arr67);
+       matrix<float, 3, 1> m32(arr67);
 
-       cout<< "Constructor Test\n";
-       cout<< "\n" << v3;
+       cout << "Constructor Test\n";
+       cout << "\n" << v3;
 
-       cout<< "\n\nAddition\n";
+       cout << "\n\nAddition\n";
        v3 = v21 + v22;
        v95 = v15 + v20;
-       cout<< "\n\nNumbers added\n";
-       cout<< "\n" << v21 << "\n" << v22;
-       cout<< "\nSum:\n" << v3 << endl;
-       cout<< "\n\nNumbers added\n";
-       cout<< "\n" << v15 << "\n" << v20;
-       cout<< "\nSum:\n" << v95 << endl;
+       cout << "\n\nNumbers added\n";
+       cout << "\n" << v21 << "\n" << v22;
+       cout << "\nSum:\n" << v3 << endl;
+       cout << "\n\nNumbers added\n";
+       cout << "\n" << v15 << "\n" << v20;
+       cout << "\nSum:\n" << v95 << endl;
 
        float num = 5.5650;
        float num1 = -2.32;
-       cout<< "\n\n\nScalar addition\n";
+       cout << "\n\n\nScalar addition\n";
        vl = v2 + num;
        vm = v10 + num1;
-       cout<< "\nNumber added:" << num;
-       cout<< "\n\n" << v2;
-       cout<< "\nResult:\n\n" << vl;
-       cout<< "\nNumber added:"<< num1;
-       cout<< "\n\n" << v10;
-       cout<< "\nResult:\n\n"<< vm;
-
-       cout<< "\n\n\nSubtraction\n";
+       cout << "\nNumber added:" << num;
+       cout << "\n\n" << v2;
+       cout << "\nResult:\n\n" << vl;
+       cout << "\nNumber added:" << num1;
+       cout << "\n\n" << v10;
+       cout << "\nResult:\n\n" << vm;
+
+       cout << "\n\n\nSubtraction\n";
        vp = v10 - v12;
-       cout<< "\n" << v10 << "\n" << v12;
-       cout<< "\nDifference:\n" << vp << endl;
+       cout << "\n" << v10 << "\n" << v12;
+       cout << "\nDifference:\n" << vp << endl;
 
        float x = 4.0;
        float x1 = -2.5;
-       cout<< "\n\n\nScalar subtraction\n";
+       cout << "\n\n\nScalar subtraction\n";
        v13 = v1 - x;
        vp = v10 - x1;
-       cout<< "\nNumber Subtracted:" << x;
-       cout<< "\n\n" << v1;
-       cout<< "\nResult:\n\n" << v13;
-       cout<< "\nNumber Subtracted:" << x1;
-       cout<< "\n\n" << v10;
-       cout<< "\nResult:\n\n" << vp;
+       cout << "\nNumber Subtracted:" << x;
+       cout << "\n\n" << v1;
+       cout << "\nResult:\n\n" << v13;
+       cout << "\nNumber Subtracted:" << x1;
+       cout << "\n\n" << v10;
+       cout << "\nResult:\n\n" << vp;
 
        float xx = 7.2;
-       cout<<"\n\n\nMultiplication\n";
+       cout << "\n\n\nMultiplication\n";
        v13 = v2 * xx;
-       cout<< "\n" << v2 <<"\n"<< xx;
-       cout<< "\nProduct:\n" << v13 << endl;
+       cout << "\n" << v2 << "\n" << xx;
+       cout << "\nProduct:\n" << v13 << endl;
 
-       cout<< "\n\n\nMultiplication matrix x vector:\n";
-       matrix<float,3,3> m102 = m32 * v22;
-       cout<< "\n" << m32 <<"\n"<< v22;
-       cout<< "\nProduct:\n"<< m102 << endl;
+       cout << "\n\n\nMultiplication matrix x vector:\n";
+       matrix<float, 3, 3> m102 = m32 * v22;
+       cout << "\n" << m32 << "\n" << v22;
+       cout << "\nProduct:\n" << m102 << endl;
 
-       cout<< "\n\n\nVector x Multiplication matrix:\n";
-       vect<float,3> v102 = (v22 * m12);
-       cout<< "\n" << v22 << "\n" << m12;
-       cout<< "\nProduct:\n" << v102 << endl;
+       cout << "\n\n\nVector x Multiplication matrix:\n";
+       vect<float, 3> v102 = (v22 * m12);
+       cout << "\n" << v22 << "\n" << m12;
+       cout << "\nProduct:\n" << v102 << endl;
 
        float z = 3.50;
        float z1 = -5.567;
-       cout<< "\n\n\nScalar multiplication\n";
+       cout << "\n\n\nScalar multiplication\n";
        v13 = v1 * z;
        v61 = v12 * z1;
-       cout<< "\nNumber Multiplied:" << z;
-       cout<< "\n\n" << v1;
-       cout<< "\nResult:\n\n" << v13;
-       cout<< "\nNumber Multiplied:" << z1;
-       cout<< "\n\n" << v12;
-       cout<< "\nResult:\n\n" << v6;
+       cout << "\nNumber Multiplied:" << z;
+       cout << "\n\n" << v1;
+       cout << "\nResult:\n\n" << v13;
+       cout << "\nNumber Multiplied:" << z1;
+       cout << "\n\n" << v12;
+       cout << "\nResult:\n\n" << v6;
 
        float num2 = 5.5;
-       cout<< "\n\n\nDivision\n";
+       cout << "\n\n\nDivision\n";
        v31 = v1 / num2;
-       cout<< "\n" << v1 << "\n" << num2;
-       cout<< "\nResult:\n" << v3 << endl;
+       cout << "\n" << v1 << "\n" << num2;
+       cout << "\nResult:\n" << v3 << endl;
 
-       cout<< "\n\n\nTranspose:";
+       cout << "\n\n\nTranspose:";
        cout << "\n\n" << v20;
        cout << "\nResult:\n\n";
-       matrix<float,6,1> m101 = transpose(v20);
+       matrix<float, 6, 1> m101 = transpose(v20);
        cout << m101;
        cout << "\n\n" << m101;
        cout << "\nResult:\n\n";
@@ -164,18 +164,18 @@ int main()
        cout << "\n\n\nv15 != v15 :";
        cout << (v15 != v15);
 
-       cout<< "\n\nAssignment\n";
+       cout << "\n\nAssignment\n";
        v3 = vf;
-       cout<< "Input \n" << v1;
-       cout<< "\nOutput:\n" << v3 << endl;
+       cout << "Input \n" << v1;
+       cout << "\nOutput:\n" << v3 << endl;
 
-       vect<float,3> v111 = cross(v21, v22);
-       cout<< "\n\n\nCross Product:";
+       vect<float, 3> v111 = cross(v21, v22);
+       cout << "\n\n\nCross Product:";
        cout << "\n\n" << v21 << "\n\n" << v22;
        cout << "\nResult:\n\n" << v111;
 
        float val = dot(v21, v22);
-       cout<< "\n\n\nDot Product:";
+       cout << "\n\n\nDot Product:";
        cout << "\n\n" << v21 << "\n\n" << v22;
        cout << "\nResult:\n\n" << val;
 
index 5174035..432cb66 100644 (file)
@@ -27,7 +27,6 @@ TYPE_SIZE vect<TYPE, SIZE>::vect(void)
 
 TYPE_SIZE vect<TYPE, SIZE>::vect(TYPE vec_data[SIZE])
 {
-
        for (int j = 0; j < SIZE; j++)
                m_vec[j] = vec_data[j];
 }
@@ -109,7 +108,7 @@ T_S_R_C matrix<T, R, S> operator *(const matrix<T, R, C> m, const vect<T, S> v)
        assert(R == S);
        assert(C == 1);
 
-       matrix<T,R,S> m1;
+       matrix<T, R, S> m1;
 
        for (int i = 0; i < R; i++)
                for (int j = 0; j < S; j++)
@@ -122,7 +121,7 @@ T_S_R_C vect<T, S> operator *(const vect<T, S> v, const matrix<T, R, C> m)
 {
        assert(R == S);
        assert(C != 1);
-       vect<T,C> v1;
+       vect<T, C> v1;
 
        for (int j = 0; j < C; j++)
        {
@@ -156,7 +155,7 @@ T_S vect<T, S> operator /(const vect<T, S> v, const T val)
 
 T_S1_S2 bool operator ==(const vect<T, S1> v1, const vect<T, S2> v2)
 {
-       if (S1==S2)
+       if (S1 == S2)
        {
                for (int i = 0; i < S1; i++)
                        if (v1.m_vec[i] != v2.m_vec[i])
index c976ecc..4753984 100644 (file)
@@ -40,12 +40,12 @@ public:
        T_S friend ostream& operator << (ostream& dout, vect<T, S>& v);
        T_S friend vect<T, S> operator +(const vect<T, S> v1, const vect<T, S> v2);
        T_S friend vect<T, S> operator +(const vect<T, S> v, const T val);
-       T_S friend vect<T, S> operator -(const vect<T,S> v1, const vect<T,S> v2);
-       T_S friend vect<T, S> operator -(const vect<T,S> v, const T val);
+       T_S friend vect<T, S> operator -(const vect<T, S> v1, const vect<T, S> v2);
+       T_S friend vect<T, S> operator -(const vect<T, S> v, const T val);
        T_S_R_C friend matrix<T, R, S> operator *(const matrix<T, R, C> v1, const vect<T, S> v2);
        T_S_R_C friend vect<T, S> operator *(const vect<T, S> v, const matrix<T, R, C> m);
        T_S friend vect<T, S> operator *(const vect<T, S> v, const T val);
-       T_S friend vect<T, S> operator /(const vect<T,S> v1, const T val);
+       T_S friend vect<T, S> operator /(const vect<T, S> v1, const T val);
        T_S1_S2 friend bool operator ==(const vect<T, S1> v1, const vect<T, S2> v2);
        T_S1_S2 friend bool operator !=(const vect<T, S1> v1, const vect<T, S2> v2);
 
index d236350..b60f337 100644 (file)
@@ -50,8 +50,6 @@ using std::vector;
 #define ELEMENT_PITCH_ROTATION_COMPENSATION                                            "PITCH_ROTATION_COMPENSATION"
 #define ELEMENT_ROLL_ROTATION_COMPENSATION                                             "ROLL_ROTATION_COMPENSATION"
 
-
-
 tilt_sensor::tilt_sensor()
 : m_accel_sensor(NULL)
 , m_fusion_sensor(NULL)
@@ -98,7 +96,6 @@ tilt_sensor::tilt_sensor()
        _I("m_roll_rotation_compensation = %d", m_roll_rotation_compensation);
 
        m_interval = m_default_sampling_time * MS_TO_US;
-
 }
 
 tilt_sensor::~tilt_sensor()
@@ -189,7 +186,6 @@ void tilt_sensor::synthesize(const sensor_event_t &event, vector<sensor_event_t>
        unsigned long long diff_time;
 
        if (event.event_type == FUSION_EVENT) {
-
                diff_time = event.data.timestamp - m_time;
 
                if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR))
@@ -257,8 +253,7 @@ bool tilt_sensor::get_properties(sensor_type_t sensor_type, sensor_properties_s
        if(m_raw_data_unit == "DEGREES") {
                properties.min_range = -180;
                properties.max_range = 180;
-       }
-       else {
+       } else {
                properties.min_range = -PI;
                properties.max_range = PI;
        }
index 536f164..b61bdf1 100644 (file)
@@ -28,6 +28,7 @@ using std::string;
 client_info_manager::client_info_manager()
 {
 }
+
 client_info_manager::~client_info_manager()
 {
        m_clients.clear();
@@ -56,7 +57,6 @@ bool client_info_manager::get_registered_events(int client_id, sensor_id_t senso
        return true;
 }
 
-
 bool client_info_manager::register_event(int client_id, sensor_id_t sensor_id, unsigned int event_type)
 {
        AUTOLOCK(m_mutex);
@@ -136,7 +136,6 @@ bool client_info_manager::set_option(int client_id, sensor_id_t sensor_id, int o
        return true;
 }
 
-
 bool client_info_manager::set_start(int client_id, sensor_id_t sensor_id, bool start)
 {
        AUTOLOCK(m_mutex);
@@ -152,7 +151,6 @@ bool client_info_manager::set_start(int client_id, sensor_id_t sensor_id, bool s
                return false;
 
        return true;
-
 }
 
 bool client_info_manager::is_started(int client_id, sensor_id_t sensor_id)
@@ -187,12 +185,11 @@ int client_info_manager::create_client_record(void)
 
        client_record.set_client_id(client_id);
 
-       m_clients.insert(pair<int,client_sensor_record> (client_id, client_record));
+       m_clients.insert(pair<int, client_sensor_record> (client_id, client_record));
 
        return client_id;
 }
 
-
 bool client_info_manager::remove_client_record(int client_id)
 {
        AUTOLOCK(m_mutex);
@@ -211,7 +208,6 @@ bool client_info_manager::remove_client_record(int client_id)
        return true;
 }
 
-
 bool client_info_manager::has_client_record(int client_id)
 {
        AUTOLOCK(m_mutex);
@@ -221,7 +217,6 @@ bool client_info_manager::has_client_record(int client_id)
        return (it_record != m_clients.end());
 }
 
-
 void client_info_manager::set_client_info(int client_id, pid_t pid, const string &name)
 {
        AUTOLOCK(m_mutex);
@@ -318,7 +313,6 @@ bool client_info_manager::remove_sensor_record(int client_id, sensor_id_t sensor
        return true;
 }
 
-
 bool client_info_manager::has_sensor_record(int client_id, sensor_id_t sensor_id)
 {
        AUTOLOCK(m_mutex);
@@ -387,7 +381,6 @@ bool client_info_manager::get_event_socket(int client_id, csocket &socket)
 
 bool client_info_manager::set_event_socket(int client_id, const csocket &socket)
 {
-
        AUTOLOCK(m_mutex);
 
        auto it_record = m_clients.find(client_id);
index e790534..bed4471 100644 (file)
@@ -26,7 +26,7 @@
 #include <cmutex.h>
 #include <vector>
 
-typedef std::unordered_map<int,client_sensor_record> client_id_sensor_record_map;
+typedef std::unordered_map<int, client_sensor_record> client_id_sensor_record_map;
 typedef std::vector<int> client_id_vec;
 
 class client_info_manager {
index 95001bb..e2e647e 100644 (file)
@@ -28,7 +28,6 @@ client_sensor_record::client_sensor_record()
 , m_pid(-1)
 , m_permission(SENSOR_PERMISSION_NONE)
 {
-
 }
 
 client_sensor_record::~client_sensor_record()
@@ -44,7 +43,7 @@ bool client_sensor_record::register_event(sensor_id_t sensor_id, unsigned int ev
        if (it_usage == m_sensor_usages.end()) {
                sensor_usage usage;
                usage.register_event(event_type);
-               m_sensor_usages.insert(pair<sensor_id_t,sensor_usage>(sensor_id, usage));
+               m_sensor_usages.insert(pair<sensor_id_t, sensor_usage>(sensor_id, usage));
                return true;
        }
 
@@ -88,7 +87,6 @@ bool client_sensor_record::set_option(sensor_id_t sensor_id, int option)
        return true;
 }
 
-
 bool client_sensor_record::set_start(sensor_id_t sensor_id, bool start)
 {
        auto it_usage = m_sensor_usages.find(sensor_id);
@@ -169,7 +167,7 @@ bool client_sensor_record::add_sensor_usage(sensor_id_t sensor_id)
        }
 
        sensor_usage usage;
-       m_sensor_usages.insert(pair<sensor_id_t,sensor_usage> (sensor_id, usage));
+       m_sensor_usages.insert(pair<sensor_id_t, sensor_usage>(sensor_id, usage));
        return true;
 }
 
@@ -193,7 +191,6 @@ bool client_sensor_record::has_sensor_usage(void)
        return true;
 }
 
-
 bool client_sensor_record::has_sensor_usage(sensor_id_t sensor_id)
 {
        auto it_usage = m_sensor_usages.find(sensor_id);
@@ -206,7 +203,6 @@ bool client_sensor_record::has_sensor_usage(sensor_id_t sensor_id)
        return true;
 }
 
-
 bool client_sensor_record::get_registered_events(sensor_id_t sensor_id, event_type_vector &event_vec)
 {
        auto it_usage = m_sensor_usages.find(sensor_id);
@@ -219,7 +215,6 @@ bool client_sensor_record::get_registered_events(sensor_id_t sensor_id, event_ty
        copy(it_usage->second.m_reg_events.begin(), it_usage->second.m_reg_events.end(), back_inserter(event_vec));
 
        return true;
-
 }
 
 void client_sensor_record::set_client_id(int client_id)
@@ -251,7 +246,6 @@ int client_sensor_record::get_permission(void)
        return  m_permission;
 }
 
-
 void client_sensor_record::set_event_socket(const csocket &socket)
 {
        m_event_socket = socket;
@@ -262,7 +256,6 @@ void client_sensor_record::get_event_socket(csocket &socket)
        socket = m_event_socket;
 }
 
-
 bool client_sensor_record::close_event_socket(void)
 {
        return m_event_socket.close();
index 83c3f8b..89b569e 100644 (file)
@@ -67,7 +67,6 @@ command_worker::~command_worker()
        m_socket.close();
 }
 
-
 bool command_worker::start(void)
 {
        return m_worker.start();
@@ -181,7 +180,6 @@ bool command_worker::working(void *ctx)
        }
 
        if (header.size > 0) {
-
                payload = new(std::nothrow) char[header.size];
                retvm_if(!payload, false, "Failed to allocate memory");
 
@@ -204,7 +202,6 @@ bool command_worker::working(void *ctx)
        return ret;
 }
 
-
 bool command_worker::stopped(void *ctx)
 {
        string info;
@@ -269,10 +266,8 @@ bool command_worker::send_cmd_done(long value)
 
        delete ret_packet;
        return true;
-
 }
 
-
 bool command_worker::send_cmd_get_id_done(int client_id)
 {
        cpacket* ret_packet;
@@ -324,7 +319,6 @@ bool command_worker::send_cmd_get_data_done(int state, sensor_data_t *data)
        return true;
 }
 
-
 bool command_worker::send_cmd_get_sensor_list_done(void)
 {
        cpacket sensor_list;
@@ -373,7 +367,6 @@ bool command_worker::cmd_get_id(void *payload)
        return true;
 }
 
-
 bool command_worker::cmd_get_sensor_list(void *payload)
 {
        _D("CMD_GET_SENSOR_LIST Handler invoked\n");
@@ -860,7 +853,6 @@ bool command_worker::is_permission_allowed(void)
        return false;
 }
 
-
 client_info_manager& command_worker::get_client_info_manager(void)
 {
        return client_info_manager::get_instance();
index cd5c336..78661ad 100644 (file)
@@ -91,7 +91,6 @@ public:
        virtual ~command_worker();
 
        bool start(void);
-
 };
 
 #endif /* _COMMAND_WORKER_H_ */
index ac7a7bd..082b6d6 100644 (file)
@@ -27,12 +27,10 @@ using std::istringstream;
 
 device_config::device_config(void)
 {
-
 }
 
 device_config::~device_config(void)
 {
-
 }
 
 bool device_config::get_device_id(void)
index f7135ee..689ffed 100644 (file)
@@ -215,4 +215,3 @@ bool physical_sensor::get_sensor_info(sensor_info &info)
 
        return true;
 }
-
index 52c65d9..a8247fc 100644 (file)
@@ -33,8 +33,9 @@ sensor_event_dispatcher::sensor_event_dispatcher()
 {
 }
 
-sensor_event_dispatcher::~sensor_event_dispatcher() { }
-
+sensor_event_dispatcher::~sensor_event_dispatcher()
+{
+}
 
 sensor_event_dispatcher& sensor_event_dispatcher::get_instance()
 {
@@ -139,7 +140,6 @@ void sensor_event_dispatcher::dispatch_event(void)
        }
 }
 
-
 void sensor_event_dispatcher::send_sensor_events(vector<void *> &events)
 {
        sensor_event_t *sensor_event = NULL;
@@ -222,7 +222,6 @@ bool sensor_event_dispatcher::has_active_virtual_sensor(virtual_sensor *sensor)
        return (it_v_sensor != m_active_virtual_sensors.end());
 }
 
-
 virtual_sensors sensor_event_dispatcher::get_active_virtual_sensors(void)
 {
        AUTOLOCK(m_active_virtual_sensors_mutex);
index 300808e..b49880d 100644 (file)
@@ -34,8 +34,9 @@ void sensor_event_queue::push_internal(void *event)
        if (m_queue.size() >= QUEUE_FULL_SIZE) {
                _E("Queue is full, drop it!");
                free(event);
-       } else
+       } else {
                m_queue.push(event);
+       }
 
        if (wake)
                m_cond_var.notify_one();
index b6379f1..c82e152 100644 (file)
 
 sensor_fusion::sensor_fusion()
 {
-
 }
 
 sensor_fusion::~sensor_fusion()
 {
-
 }
 
 bool sensor_fusion::is_fusion(void)
index ec9701d..c8a8a11 100644 (file)
@@ -29,7 +29,7 @@ enum fusion_event_type {
        FUSION_EVENT_AGM = (FUSION_SENSOR << 16) | 0x0004,
 };
 
-typedef std::array<std::array<float,3> ,3> arr33_t;
+typedef std::array<std::array<float, 3>, 3> arr33_t;
 
 class sensor_fusion : public sensor_base {
 public:
@@ -56,4 +56,4 @@ public:
        virtual bool get_orientation(float &azimuth, float &pitch, float &roll, int &accuracy);
 };
 
-#endif
+#endif /* _SENSOR_FUSION_H_ */
index 0edb0fa..7e90743 100644 (file)
@@ -63,4 +63,5 @@ private:
        std::list<interval_info> m_interval_info_list;
        std::list<batch_info> m_batch_info_list;
 };
+
 #endif /* _SENSOR_INFO_LIST_H_ */
index b303301..ef659e3 100644 (file)
@@ -67,4 +67,5 @@ public:
        std::vector<sensor_base *> get_sensors(sensor_type_t type);
        std::vector<sensor_base *> get_virtual_sensors(void);
 };
+
 #endif /* _SENSOR_LOADER_H_ */
index 77d2cce..142ec4b 100644 (file)
@@ -28,8 +28,8 @@ sensor_usage::sensor_usage()
 , m_option(SENSOR_OPTION_DEFAULT)
 , m_start(false)
 {
-
 }
+
 sensor_usage::~sensor_usage()
 {
        m_reg_events.clear();
@@ -53,7 +53,7 @@ bool sensor_usage::unregister_event(unsigned int event_type)
        auto it_event = find(m_reg_events.begin(), m_reg_events.end(), event_type);
 
        if (it_event == m_reg_events.end()) {
-               _E("Event[%#x] is not found",event_type);
+               _E("Event[%#x] is not found", event_type);
                return false;
        }
 
@@ -64,10 +64,10 @@ bool sensor_usage::unregister_event(unsigned int event_type)
 
 bool sensor_usage::is_event_registered(unsigned int event_type)
 {
-       auto it_event = find (m_reg_events.begin(), m_reg_events.end(), event_type);
+       auto it_event = find(m_reg_events.begin(), m_reg_events.end(), event_type);
 
        if (it_event == m_reg_events.end()){
-               _D("Event[%#x] is not registered",event_type);
+               _D("Event[%#x] is not registered", event_type);
                return false;
        }
 
index 5e902bb..7a5e416 100644 (file)
@@ -33,7 +33,6 @@ using std::thread;
 server::server()
 : m_mainloop(NULL)
 {
-
 }
 
 server::~server()
index 6701642..0d297b3 100644 (file)
 #include <virtual_sensor.h>
 #include <sensor_event_dispatcher.h>
 
-
 virtual_sensor::virtual_sensor()
 {
-
 }
 
 virtual_sensor::~virtual_sensor()
 {
-
 }
 
 bool virtual_sensor::init(void)
index bc59fb7..46562a5 100644 (file)
@@ -64,24 +64,24 @@ bool virtual_sensor_config::load_config(const string& config_path)
        xmlDocPtr doc;
        xmlNodePtr cur;
 
-       _D("virtual_sensor_config::load_config(\"%s\") is called!\n",config_path.c_str());
+       _D("virtual_sensor_config::load_config(\"%s\") is called!\n", config_path.c_str());
 
        doc = xmlParseFile(config_path.c_str());
 
        if (doc == NULL) {
-               _E("There is no %s\n",config_path.c_str());
+               _E("There is no %s\n", config_path.c_str());
                return false;
        }
 
        cur = xmlDocGetRootElement(doc);
        if(cur == NULL) {
-               _E("There is no root element in %s\n",config_path.c_str());
+               _E("There is no root element in %s\n", config_path.c_str());
                xmlFreeDoc(doc);
                return false;
        }
 
        if(xmlStrcmp(cur->name, (const xmlChar *)ROOT_ELEMENT)) {
-               _E("Wrong type document: there is no [%s] root element in %s\n",ROOT_ELEMENT,config_path.c_str());
+               _E("Wrong type document: there is no [%s] root element in %s\n", ROOT_ELEMENT, config_path.c_str());
                xmlFreeDoc(doc);
                return false;
        }
@@ -95,57 +95,55 @@ bool virtual_sensor_config::load_config(const string& config_path)
        device_node_ptr = cur->xmlChildrenNode;
        while (device_node_ptr != NULL){
                //skip garbage element, [text]
-               if (!xmlStrcmp(device_node_ptr->name,(const xmlChar *)TEXT_ELEMENT)) {
+               if (!xmlStrcmp(device_node_ptr->name, (const xmlChar *)TEXT_ELEMENT)) {
                        device_node_ptr = device_node_ptr->next;
                        continue;
                }
 
-
                string device_type;
-               prop = (char*)xmlGetProp(device_node_ptr,(const xmlChar*)DEVICE_TYPE_ATTR);
+               prop = (char*)xmlGetProp(device_node_ptr, (const xmlChar*)DEVICE_TYPE_ATTR);
                device_type = prop;
                free(prop);
 
                //insert device to device_list
                m_virtual_sensor_configs[device_type];
-               _D("<type=\"%s\">\n",device_type.c_str());
+               _D("<type=\"%s\">\n", device_type.c_str());
 
                virtual_sensor_node_ptr = device_node_ptr->xmlChildrenNode;
 
                while (virtual_sensor_node_ptr != NULL) {
                        //skip garbage element, [text]
-                       if (!xmlStrcmp(virtual_sensor_node_ptr->name,(const xmlChar *)TEXT_ELEMENT)) {
+                       if (!xmlStrcmp(virtual_sensor_node_ptr->name, (const xmlChar *)TEXT_ELEMENT)) {
                                virtual_sensor_node_ptr = virtual_sensor_node_ptr->next;
                                continue;
                        }
 
                        m_virtual_sensor_configs[device_type][(const char*)virtual_sensor_node_ptr->name];
-                       _D("<type=\"%s\"><%s>\n",device_type.c_str(),(const char*)virtual_sensor_node_ptr->name);
+                       _D("<type=\"%s\"><%s>\n", device_type.c_str(), (const char*)virtual_sensor_node_ptr->name);
 
                        element_node_ptr = virtual_sensor_node_ptr->xmlChildrenNode;
                        while (element_node_ptr != NULL) {
                                //skip garbage element, [text]
-                               if (!xmlStrcmp(element_node_ptr->name,(const xmlChar *)TEXT_ELEMENT)) {
+                               if (!xmlStrcmp(element_node_ptr->name, (const xmlChar *)TEXT_ELEMENT)) {
                                        element_node_ptr = element_node_ptr->next;
                                        continue;
                                }
 
                                //insert Element to Model
                                m_virtual_sensor_configs[device_type][(const char*)virtual_sensor_node_ptr->name][(const char*)element_node_ptr->name];
-                               _D("<type=\"%s\"><%s><%s>\n",device_type.c_str(),(const char*)virtual_sensor_node_ptr->name,(const char*)element_node_ptr->name);
+                               _D("<type=\"%s\"><%s><%s>\n", device_type.c_str(), (const char*)virtual_sensor_node_ptr->name, (const char*)element_node_ptr->name);
 
                                attr_ptr = element_node_ptr->properties;
                                while (attr_ptr != NULL) {
-
-                                       string key,value;
+                                       string key, value;
                                        key = (char*)attr_ptr->name;
-                                       prop = (char*)xmlGetProp(element_node_ptr,attr_ptr->name);
+                                       prop = (char*)xmlGetProp(element_node_ptr, attr_ptr->name);
                                        value = prop;
                                        free(prop);
 
                                        //insert attribute to Element
-                                       m_virtual_sensor_configs[device_type][(const char*)virtual_sensor_node_ptr->name][(const char*)element_node_ptr->name][key]=value;
-                                       _D("<type=\"%s\"><%s><%s \"%s\"=\"%s\">\n",device_type.c_str(),(const char*)virtual_sensor_node_ptr->name,(const char*)element_node_ptr->name,key.c_str(),value.c_str());
+                                       m_virtual_sensor_configs[device_type][(const char*)virtual_sensor_node_ptr->name][(const char*)element_node_ptr->name][key] = value;
+                                       _D("<type=\"%s\"><%s><%s \"%s\"=\"%s\">\n", device_type.c_str(), (const char*)virtual_sensor_node_ptr->name, (const char*)element_node_ptr->name, key.c_str(), value.c_str());
                                        attr_ptr = attr_ptr->next;
                                }
 
@@ -168,7 +166,7 @@ bool virtual_sensor_config::get(const string& sensor_type, const string& element
        auto it_device_list = m_virtual_sensor_configs.find(m_device_id);
 
        if (it_device_list == m_virtual_sensor_configs.end())   {
-               _E("There is no <%s> device\n",m_device_id.c_str());
+               _E("There is no <%s> device\n", m_device_id.c_str());
 
                m_device_id = DEFAULT_DEVICE;
                it_device_list = m_virtual_sensor_configs.find(m_device_id);
@@ -184,21 +182,21 @@ bool virtual_sensor_config::get(const string& sensor_type, const string& element
        auto it_virtual_sensor_list = it_device_list->second.find(sensor_type);
 
        if (it_virtual_sensor_list == it_device_list->second.end())     {
-               _E("There is no <%s> sensor\n",sensor_type.c_str());
+               _E("There is no <%s> sensor\n", sensor_type.c_str());
                return false;
        }
 
        auto it_element = it_virtual_sensor_list->second.find(element);
 
        if (it_element == it_virtual_sensor_list->second.end()) {
-               _E("There is no <%s><%s> element\n",sensor_type.c_str(),element.c_str());
+               _E("There is no <%s><%s> element\n", sensor_type.c_str(), element.c_str());
                return false;
        }
 
        auto it_attr = it_element->second.find(attr);
 
        if (it_attr == it_element->second.end()) {
-               _D("There is no <%s><%s \"%s\">\n",sensor_type.c_str(),element.c_str(),attr.c_str());
+               _D("There is no <%s><%s \"%s\">\n", sensor_type.c_str(), element.c_str(), attr.c_str());
                return false;
        }
 
@@ -211,7 +209,7 @@ bool virtual_sensor_config::get(const string& sensor_type, const string& element
 {
        string str_value;
 
-       if (get(sensor_type,element,attr,str_value) == false)
+       if (get(sensor_type, element, attr, str_value) == false)
                return false;
 
        stringstream str_stream(str_value);
@@ -225,7 +223,7 @@ bool virtual_sensor_config::get(const string& sensor_type, const string& element
 {
        string str_value;
 
-       if (get(sensor_type,element,attr,str_value) == false)
+       if (get(sensor_type, element, attr, str_value) == false)
                return false;
 
        stringstream str_stream(str_value);
@@ -245,13 +243,12 @@ bool virtual_sensor_config::get(const string& sensor_type, const string& element
 
 bool virtual_sensor_config::get(const string& sensor_type, const string& element, float *value, int count)
 {
-       if (count == 1)
-       {
+       if (count == 1) {
                if (get(sensor_type, element, DEFAULT_ATTR, value))
                        return true;
        }
-       else if (count == 3)
-       {
+
+       if (count == 3) {
                if (!get(sensor_type, element, DEFAULT_ATTR1, value))
                        return false;
 
@@ -267,23 +264,20 @@ bool virtual_sensor_config::get(const string& sensor_type, const string& element
 
                return true;
        }
-       else
-       {
-               _D("Count value not supported.\n");
-       }
+
+       _D("Count value not supported.\n");
 
        return false;
 }
 
 bool virtual_sensor_config::get(const string& sensor_type, const string& element, int *value, int count)
 {
-       if (count == 1)
-       {
+       if (count == 1) {
                if (get(sensor_type, element, DEFAULT_ATTR, value))
                        return true;
        }
-       else if (count == 3)
-       {
+
+       if (count == 3) {
                if (!get(sensor_type, element, DEFAULT_ATTR1, value))
                        return false;
 
@@ -299,10 +293,8 @@ bool virtual_sensor_config::get(const string& sensor_type, const string& element
 
                return true;
        }
-       else
-       {
-               _D("Count value not supported.\n");
-       }
+
+       _D("Count value not supported.\n");
 
        return false;
 }
@@ -321,4 +313,3 @@ bool virtual_sensor_config::is_supported(const string& sensor_type)
 
        return true;
 }
-
index 37d9fd7..949d840 100644 (file)
 
 #define VIRTUAL_SENSOR_CONFIG_FILE_PATH "/usr/etc/virtual_sensors.xml"
 
-typedef std::unordered_map<std::string,std::string> Element;
+typedef std::unordered_map<std::string, std::string> Element;
 /*
 * an Element  is a group of attributes
 * <Element value1 = "10.0", value2 =  "20.0"/>
 *
 */
 
-typedef std::unordered_map<std::string,Element> Virtual_sensor;
+typedef std::unordered_map<std::string, Element> Virtual_sensor;
 /*
 * a Virtual_sensor is a group of elements to consist of one virtual sensor's configuration
 *      <ORIENTATION>
@@ -40,7 +40,7 @@ typedef std::unordered_map<std::string,Element> Virtual_sensor;
 *              ...
 */
 
-typedef std::unordered_map<std::string,Virtual_sensor> virtual_sensor_configs;
+typedef std::unordered_map<std::string, Virtual_sensor> virtual_sensor_configs;
 /*
 * a Virtual_sensor_config represents virtual_sensors.xml
 * <ORIENTATION/>
@@ -49,7 +49,7 @@ typedef std::unordered_map<std::string,Virtual_sensor> virtual_sensor_configs;
 *
 */
 
-typedef std::unordered_map<std::string,virtual_sensor_configs> virtual_sensor_device_configs;
+typedef std::unordered_map<std::string, virtual_sensor_configs> virtual_sensor_device_configs;
 /*
 * a virtual_sensor_device_config represents virtual_sensors.xml
 * <emulator/>
@@ -60,7 +60,6 @@ typedef std::unordered_map<std::string,virtual_sensor_configs> virtual_sensor_de
 class virtual_sensor_config : public device_config {
 private:
        virtual_sensor_config();
-       virtual_sensor_config(virtual_sensor_config const&) {};
        virtual_sensor_config& operator=(virtual_sensor_config const&);
 
        bool load_config(const std::string& config_path);
@@ -75,7 +74,7 @@ public:
        bool get(const std::string& sensor_type, const std::string& element, const std::string& attr, int *value);
 
        bool get(const std::string& sensor_type, const std::string& element, std::string& value);
-       bool get(const std::string& sensor_type, const std::string& element, float *value, int count =1);
+       bool get(const std::string& sensor_type, const std::string& element, float *value, int count = 1);
        bool get(const std::string& sensor_type, const std::string& element, int *value, int count = 1);
 
        bool is_supported(const std::string &sensor_type);
index bf3320c..23cd6ff 100644 (file)
@@ -55,7 +55,6 @@ worker_thread::worker_state_t worker_thread::get_state(void)
        return m_state;
 }
 
-
 bool worker_thread::start(void)
 {
        lock l(m_mutex);
@@ -73,7 +72,9 @@ bool worker_thread::start(void)
                        th.detach();
                }
                return true;
-       } else if (m_state == WORKER_STATE_PAUSED) {
+       }
+
+       if (m_state == WORKER_STATE_PAUSED) {
                m_state = WORKER_STATE_WORKING;
                m_cond_working.notify_one();
                return true;
@@ -94,7 +95,6 @@ bool worker_thread::stop(void)
        }
 
        if ((m_state == WORKER_STATE_WORKING) || (m_state == WORKER_STATE_PAUSED)) {
-
                if (m_state == WORKER_STATE_PAUSED)
                        m_cond_working.notify_one();
 
@@ -123,7 +123,6 @@ bool worker_thread::pause(void)
        _E("Failed to pause, because current state(%d) is not for PAUSE", m_state);
 
        return false;
-
 }
 
 bool worker_thread::resume(void)
@@ -145,7 +144,6 @@ bool worker_thread::resume(void)
        return false;
 }
 
-
 /*
  * After state changed to STOPPED, it should not access member fields,
     because some transition funciton of STOPPED delete this pointer
index 2f5acab..0aeff29 100644 (file)
@@ -17,7 +17,6 @@
  *
  */
 
-
 #ifndef _WORKER_THREAD_H_
 #define _WORKER_THREAD_H_
 
index e7bcc95..38f2f84 100644 (file)
@@ -43,7 +43,6 @@ void cbase_lock::lock(lock_type type, const char* expr, const char *module, cons
        unsigned long long lock_acquired_time = 0;
        unsigned long long waiting_time = 0;
 
-
        snprintf(m_curent_info, OWNER_INFO_LEN, "%s:%s(%d)", module, func, line);
 
        if (type == LOCK_TYPE_MUTEX)
@@ -68,7 +67,6 @@ void cbase_lock::lock(lock_type type, const char* expr, const char *module, cons
                m_curent_info, expr, this, m_owner_info);
        pthread_mutex_unlock(&m_history_mutex);
 
-
        if (type == LOCK_TYPE_MUTEX)
                lock_impl();
        else if (type == LOCK_TYPE_READ)
@@ -88,7 +86,6 @@ void cbase_lock::lock(lock_type type, const char* expr, const char *module, cons
        pthread_mutex_unlock(&m_history_mutex);
 }
 
-
 void cbase_lock::lock(lock_type type)
 {
        if (type == LOCK_TYPE_MUTEX)
@@ -104,7 +101,6 @@ void cbase_lock::unlock(void)
        unlock_impl();
 }
 
-
 int cbase_lock::lock_impl(void)
 {
        return 0;
index 5a6b5e5..ad57562 100644 (file)
@@ -29,24 +29,23 @@ enum lock_type {
 };
 
 #ifdef _LOCK_DEBUG
-#define AUTOLOCK(x) Autolock x##_autolock((x),LOCK_TYPE_MUTEX, #x, __MODULE__, __func__, __LINE__)
-#define AUTOLOCK_R(x) Autolock x##_autolock_r((x),LOCK_TYPE_READ, #x,  __MODULE__, __func__, __LINE__)
-#define AUTOLOCK_W(x) Autolock x##_autolock_w((x),LOCK_TYPE_WRITE, #x, __MODULE__, __func__, __LINE__)
+#define AUTOLOCK(x) Autolock x##_autolock((x), LOCK_TYPE_MUTEX, #x, __MODULE__, __func__, __LINE__)
+#define AUTOLOCK_R(x) Autolock x##_autolock_r((x), LOCK_TYPE_READ, #x,  __MODULE__, __func__, __LINE__)
+#define AUTOLOCK_W(x) Autolock x##_autolock_w((x), LOCK_TYPE_WRITE, #x, __MODULE__, __func__, __LINE__)
 #define LOCK(x)                (x).lock(#x, __MODULE__, __func__, __LINE__)
 #define LOCK_R(x)      (x).lock(LOCK_TYPE_READ, #x, __MODULE__, __func__, __LINE__)
 #define LOCK_W(x)      (x).lock(LOCK_TYPE_WRITE, #x, __MODULE__, __func__, __LINE__)
 #define UNLOCK(x)      (x).unlock()
 #else
-#define AUTOLOCK(x) Autolock x##_autolock((x),LOCK_TYPE_MUTEX)
-#define AUTOLOCK_R(x) Autolock x##_autolock_r((x),LOCK_TYPE_READ)
-#define AUTOLOCK_W(x) Autolock x##_autolock_w((x),LOCK_TYPE_WRITE)
+#define AUTOLOCK(x) Autolock x##_autolock((x), LOCK_TYPE_MUTEX)
+#define AUTOLOCK_R(x) Autolock x##_autolock_r((x), LOCK_TYPE_READ)
+#define AUTOLOCK_W(x) Autolock x##_autolock_w((x), LOCK_TYPE_WRITE)
 #define LOCK(x)                (x).lock()
 #define LOCK_R(x)      (x).lock(LOCK_TYPE_READ)
 #define LOCK_W(x)      (x).lock(LOCK_TYPE_WRITE)
 #define UNLOCK(x)      (x).unlock()
 #endif
 
-
 class cbase_lock {
 public:
        cbase_lock();
index a033061..7f46633 100644 (file)
@@ -56,7 +56,6 @@ int cmutex::lock_impl(void)
 int cmutex::try_lock_impl(void)
 {
        return pthread_mutex_trylock(&m_mutex);
-
 }
 
 int cmutex::unlock_impl()
index 4a73f1d..3346654 100644 (file)
@@ -65,7 +65,6 @@ typedef struct {
 typedef struct {
 } cmd_byebye_t;
 
-
 typedef struct {
        unsigned int type;
 } cmd_get_data_t;
@@ -74,7 +73,6 @@ typedef struct {
        long value;
 } cmd_done_t;
 
-
 typedef struct {
        int client_id;
 } cmd_get_id_done_t;
@@ -115,7 +113,6 @@ typedef struct {
        int option;
 } cmd_set_option_t;
 
-
 typedef struct  {
        int attribute;
        int value;
index fc908a4..a2ce0e0 100644 (file)
@@ -96,7 +96,7 @@ void cpacket::set_payload_size(size_t size)
        }
 
        m_packet = (packet_header*) new(std::nothrow) char[size + sizeof(packet_header)];
-       retm_if (!m_packet, "Failed to allocate memory");
+       retm_if(!m_packet, "Failed to allocate memory");
        m_packet->size = size;
 
        if (prev_cmd != CMD_NONE)
index 6aa33b6..0dc07ce 100644 (file)
@@ -32,7 +32,6 @@ csocket::csocket()
        memset(&m_addr, 0, sizeof(m_addr));
 }
 
-
 csocket::csocket(int sock_fd)
 : m_sock_fd(-1)
 , m_sock_type(SOCK_STREAM)
@@ -44,7 +43,6 @@ csocket::csocket(int sock_fd)
        memset(&m_addr, 0, sizeof(m_addr));
 }
 
-
 csocket::csocket(const csocket &sock)
 : m_sock_fd(-1)
 , m_sock_type(SOCK_STREAM)
@@ -78,7 +76,7 @@ bool csocket::create(int sock_type)
        return true;
 }
 
-bool csocket::bind (const char *sock_path)
+bool csocket::bind(const char *sock_path)
 {
        int length;
        mode_t socket_mode;
@@ -104,7 +102,7 @@ bool csocket::bind (const char *sock_path)
                return false;
        }
 
-       socket_mode = ( S_IRWXU | S_IRWXG | S_IRWXO );
+       socket_mode = (S_IRWXU | S_IRWXG | S_IRWXO);
        if (chmod(sock_path, socket_mode) < 0) {
                _ERRNO(errno, _E, "Failed to chmod for socket[%d]", m_sock_fd);
                close();
@@ -198,7 +196,6 @@ ssize_t csocket::recv_for_seqpacket(void* buffer, size_t size) const
     return err == 0 ? len : -err;
 }
 
-
 ssize_t csocket::send_for_stream(const void *buffer, size_t size) const
 {
        ssize_t len;
@@ -277,7 +274,6 @@ ssize_t csocket::recv_for_stream(void* buffer, size_t size) const
        return err == 0 ? total_recv_size : -err;
 }
 
-
 ssize_t csocket::send(const void *buffer, size_t size) const
 {
        if (!is_valid()) {
@@ -327,7 +323,7 @@ bool csocket::connect(const char *sock_path)
 
        addr_len = strlen(m_addr.sun_path) + sizeof(m_addr.sun_family);
 
-       if (::connect(m_sock_fd,(sockaddr *) &m_addr, addr_len) < 0) {
+       if (::connect(m_sock_fd, (sockaddr *) &m_addr, addr_len) < 0) {
                _ERRNO(errno, _E, "Failed to connect sock_fd: %d for %s",
                                m_sock_fd, get_client_name());
                return false;
@@ -408,7 +404,6 @@ bool csocket::set_blocking_mode(bool blocking)
        return true;
 }
 
-
 bool csocket::set_sock_type(void)
 {
        socklen_t opt_len;
@@ -487,7 +482,6 @@ bool csocket::is_blocking_mode(void)
        return !(flags & O_NONBLOCK);
 }
 
-
 bool csocket::is_valid(void) const
 {
        return (m_sock_fd >= 0);
index 474c38d..55582cf 100644 (file)
@@ -37,7 +37,7 @@ public:
 
        //Server
        bool create(int sock_type);
-       bool bind (const char *sock_path);
+       bool bind(const char *sock_path);
        bool listen(const int max_connections);
        bool accept(csocket& client_socket) const;
 
index 45e5936..b1a3ded 100644 (file)
@@ -88,7 +88,6 @@ bool poller::fill_event_queue(void)
        return true;
 }
 
-
 bool poller::poll(struct epoll_event &event)
 {
        while (true) {
index f7c241a..2a2ca83 100644 (file)
@@ -225,7 +225,6 @@ void sensor_info::show(void)
        _I("Wakeup_supported = %d", m_wakeup_supported);
 }
 
-
 void sensor_info::clear(void)
 {
        m_type = UNKNOWN_SENSOR;
@@ -243,7 +242,6 @@ void sensor_info::clear(void)
        m_wakeup_supported = false;
 }
 
-
 void sensor_info::put(raw_data_t &data, int value)
 {
        char buffer[sizeof(value)];
index bcbe921..236eb1d 100644 (file)
 #endif
 #define LOG_TAG        "SENSOR"
 
-#define LOG_DUMP(fp, fmt, arg...) do { if (fp) fprintf(fp, fmt, ##arg); else _E(fmt, ##arg); } while(0)
+#define LOG_DUMP(fp, fmt, arg...) do { if (fp) fprintf(fp, fmt, ##arg); else _E(fmt, ##arg); } while (0)
 
 #ifdef _DEBUG
 #define DBG SLOGD
 #else
-#define DBG(...) do{} while(0)
+#define DBG(...) do {} while (0)
 #endif
 
 #define ERR SLOGE
index d9cd3ba..406008a 100644 (file)
@@ -27,8 +27,6 @@
 #include <string.h>
 #include "check-sensor.h"
 
-
-
 void printpollinglogs(sensor_type_t type,sensor_data_t data)
 {
        switch(type) {
@@ -299,7 +297,6 @@ int polling_sensor(sensor_type_t sensor_type, unsigned int event)
        handle = sensord_connect(sensor);
        result = sensord_start(handle, 1);
 
-
        if (!result) {
                printf("Can't start the sensor\n");
                printf("Error\n\n\n\n");
@@ -308,7 +305,7 @@ int polling_sensor(sensor_type_t sensor_type, unsigned int event)
 
        sensor_data_t data;
 
-       while(1) {
+       while (1) {
                result = sensord_get_data(handle, event, &data);
                printpollinglogs(sensor_type, data);
                usleep(100000);
index 7b0bb1b..9130d47 100644 (file)
@@ -27,7 +27,6 @@
 #include <pthread.h>
 #include "check-sensor.h"
 
-
 void usage()
 {
        printf("Usage : ./multi-sensor <TIMEOUT> <interval>(optional)\n\n");
@@ -84,7 +83,6 @@ int main(int argc, char **argv)
                }
        }
 
-
        int MAX = 6, j = 0, k = 0;
        struct pthread_arguments arg[MAX];
        int t = 0;
@@ -102,17 +100,13 @@ int main(int argc, char **argv)
        arg[5].sensor_type = LIGHT_SENSOR;
        arg[5].event = LIGHT_LUX_DATA_EVENT;
 
-       for(t = 0; t < MAX; t++)
-       {
+       for (t = 0; t < MAX; t++)
                arg[t].interval = interval;
-       }
 
        pthread_t thread_id[MAX];
 
-       for(j = 0; j < MAX; j++)
-       {
+       for (j = 0; j < MAX; j++)
                pthread_create(&thread_id[j], NULL, check_sensor, (void*)&arg[j]);
-       }
 
        sleep(TIMEOUT);
        return 0;