aboutsummaryrefslogtreecommitdiffstats
path: root/meta-application-manager/recipes-others/sensord/files/0004-Removing-redundant-auto_rotation-events.patch
blob: 16c64b001985cb6424a7800396a17854c8fbacf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
From a6689f5545620ae9c050db2de30f432838fb9354 Mon Sep 17 00:00:00 2001
From: Ankur <ankur29.garg@samsung.com>
Date: Thu, 26 Feb 2015 17:30:27 +0530
Subject: [PATCH] Removing redundant auto_rotation events

AUTO_ROTATION_BASE_DATA_SET and AUTO_ROTATION_EVENT_CHANGE_STATE were the same
AUTO_ROTATION_BASE_DATA_SET has been removed.

AUTO_ROTATION_BASE_DATA_SET was used for polling events and AUTO_ROTATION__EVENT_CHANGE_STATE was used for event driven
Since both these represent the same auto_rotation sensor event, DATA_SET type has been removed.

And AUTO_ROTATION_EVENT_CHANGE_STATE has been renamed to AUTO_ROTATION_CHANGE_STATE_EVENT to make it simpler.

Change-Id: I8523af6c00dd2919bb6b9f0606c48d5df37ff0c9
---
 src/auto_rotation/auto_rotation_sensor.cpp | 6 +++---
 src/libsensord/client_common.cpp           | 5 ++---
 src/libsensord/sensor_auto_rotation.h      | 6 +-----
 src/libsensord/sensor_deprecated.h         | 3 +++
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/auto_rotation/auto_rotation_sensor.cpp b/src/auto_rotation/auto_rotation_sensor.cpp
index cdf7609..381e861 100755
--- a/src/auto_rotation/auto_rotation_sensor.cpp
+++ b/src/auto_rotation/auto_rotation_sensor.cpp
@@ -49,7 +49,7 @@ auto_rotation_sensor::auto_rotation_sensor()
 {
 	m_name = string(SENSOR_NAME);
 
-	register_supported_event(AUTO_ROTATION_EVENT_CHANGE_STATE);
+	register_supported_event(AUTO_ROTATION_CHANGE_STATE_EVENT);
 }
 
 auto_rotation_sensor::~auto_rotation_sensor()
@@ -146,7 +146,7 @@ void auto_rotation_sensor::synthesize(const sensor_event_t& event, vector<sensor
 		INFO("Rotation: %d, ACC[0]: %f, ACC[1]: %f, ACC[2]: %f", rotation, event.data.values[0], event.data.values[1], event.data.values[2]);
 		rotation_event.sensor_id = get_id();
 		rotation_event.data.accuracy = SENSOR_ACCURACY_GOOD;
-		rotation_event.event_type = AUTO_ROTATION_EVENT_CHANGE_STATE;
+		rotation_event.event_type = AUTO_ROTATION_CHANGE_STATE_EVENT;
 		rotation_event.data.timestamp = event.data.timestamp;
 		rotation_event.data.values[0] = rotation;
 		rotation_event.data.value_count = 1;
@@ -161,7 +161,7 @@ void auto_rotation_sensor::synthesize(const sensor_event_t& event, vector<sensor
 
 int auto_rotation_sensor::get_sensor_data(unsigned int data_id, sensor_data_t &data)
 {
-	if (data_id != AUTO_ROTATION_BASE_DATA_SET)
+	if (data_id != AUTO_ROTATION_CHANGE_STATE_EVENT)
 		return -1;
 
 	AUTOLOCK(m_value_mutex);
diff --git a/src/libsensord/client_common.cpp b/src/libsensord/client_common.cpp
index 361351b..6e5bfe7 100755
--- a/src/libsensord/client_common.cpp
+++ b/src/libsensord/client_common.cpp
@@ -48,7 +48,7 @@ log_element g_log_elements[] = {
 	FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_EVENT_STATE_REPORT_ON_TIME, 0, 10),
 	FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_EVENT_DISTANCE_DATA_REPORT_ON_TIME, 0, 10),
 	FILL_LOG_ELEMENT(LOG_ID_EVENT, CONTEXT_EVENT_REPORT, 0, 1),
-	FILL_LOG_ELEMENT(LOG_ID_EVENT, AUTO_ROTATION_EVENT_CHANGE_STATE, 0, 1),
+	FILL_LOG_ELEMENT(LOG_ID_EVENT, AUTO_ROTATION_CHANGE_STATE_EVENT, 0, 1),
 	FILL_LOG_ELEMENT(LOG_ID_EVENT, ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
 	FILL_LOG_ELEMENT(LOG_ID_EVENT, GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
 	FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
@@ -71,7 +71,6 @@ log_element g_log_elements[] = {
 	FILL_LOG_ELEMENT(LOG_ID_DATA, LIGHT_BASE_DATA_SET, 0, 25),
 	FILL_LOG_ELEMENT(LOG_ID_DATA, LIGHT_LUX_DATA_SET, 0, 25),
 	FILL_LOG_ELEMENT(LOG_ID_DATA, CONTEXT_BASE_DATA_SET, 0, 25),
-	FILL_LOG_ELEMENT(LOG_ID_DATA, AUTO_ROTATION_BASE_DATA_SET, 0, 25),
 	FILL_LOG_ELEMENT(LOG_ID_DATA, GRAVITY_BASE_DATA_SET, 0, 25),
 	FILL_LOG_ELEMENT(LOG_ID_DATA, LINEAR_ACCEL_BASE_DATA_SET, 0, 25),
 	FILL_LOG_ELEMENT(LOG_ID_DATA, ORIENTATION_BASE_DATA_SET, 0, 25),
@@ -180,7 +179,7 @@ bool is_single_state_event(unsigned int event_type)
 	case GEOMAGNETIC_EVENT_CALIBRATION_NEEDED:
 	case LIGHT_EVENT_CHANGE_LEVEL:
 	case PROXIMITY_EVENT_CHANGE_STATE:
-	case AUTO_ROTATION_EVENT_CHANGE_STATE:
+	case AUTO_ROTATION_CHANGE_STATE_EVENT:
 		return true;
 		break;
 	}
diff --git a/src/libsensord/sensor_auto_rotation.h b/src/libsensord/sensor_auto_rotation.h
index 752f13d..1f717c5 100755
--- a/src/libsensord/sensor_auto_rotation.h
+++ b/src/libsensord/sensor_auto_rotation.h
@@ -36,12 +36,8 @@ extern "C"
  * @{
  */
 
-enum auto_rotation_data_id {
-	AUTO_ROTATION_BASE_DATA_SET	= (AUTO_ROTATION_SENSOR << 16) | 0x0001,
-};
-
 enum auto_rotation_event_type {
-	AUTO_ROTATION_EVENT_CHANGE_STATE = (AUTO_ROTATION_SENSOR << 16) | 0x0001,
+	AUTO_ROTATION_CHANGE_STATE_EVENT = (AUTO_ROTATION_SENSOR << 16) | 0x0001,
 };
 
 enum auto_rotation_state {
diff --git a/src/libsensord/sensor_deprecated.h b/src/libsensord/sensor_deprecated.h
index 7237789..da7fd94 100644
--- a/src/libsensord/sensor_deprecated.h
+++ b/src/libsensord/sensor_deprecated.h
@@ -64,6 +64,9 @@ extern "C"
 #define GEOMAGNETIC_EVENT_CALIBRATION_NEEDED GEOMAGNETIC_CALIBRATION_NEEDED_EVENT
 #define GEOMAGNETIC_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME GEOMAGNETIC_UNPROCESSED_DATA_EVENT
 
+#define AUTO_ROTATION_BASE_DATA_SET AUTO_ROTATION_CHANGE_STATE_EVENT
+#define AUTO_ROTATION_EVENT_CHANGE_STATE AUTO_ROTATION_CHANGE_STATE_EVENT
+
 enum accelerometer_rotate_state {
 	ROTATION_UNKNOWN = 0,
 	ROTATION_LANDSCAPE_LEFT = 1,
-- 
2.1.4