sensor: fix dummy implements to pass tct on common/tv profiles
[platform/core/api/sensor.git] / src / sensor_recorder_dummy.cpp
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <stdlib.h>
18 #include <sensor.h>
19 #include <sensor_log.h>
20
21 int sensor_recorder_is_supported(sensor_type_e type, bool *supported)
22 {
23         _D("Called : sensor[%#x]", type);
24
25         if (type <= SENSOR_ALL)
26                 return SENSOR_ERROR_INVALID_PARAMETER;
27         if (!supported)
28                 return SENSOR_ERROR_INVALID_PARAMETER;
29
30         *supported = false;
31
32         return SENSOR_ERROR_NONE;
33 }
34
35 int sensor_recorder_start(sensor_type_e type, sensor_recorder_option_h option)
36 {
37         _D("Called : sensor[%#x] with option[%d]", type, option);
38
39         if (type <= SENSOR_ALL)
40                 return SENSOR_ERROR_INVALID_PARAMETER;
41
42         return SENSOR_ERROR_NOT_SUPPORTED;
43 }
44
45 int sensor_recorder_stop(sensor_type_e type)
46 {
47         _D("Called : sensor[%#x]", type);
48
49         if (type <= SENSOR_ALL)
50                 return SENSOR_ERROR_INVALID_PARAMETER;
51
52         return SENSOR_ERROR_NOT_SUPPORTED;
53 }
54
55 int sensor_recorder_create_option(sensor_recorder_option_h *option)
56 {
57         _D("Called : option[%#x]", *option);
58
59         if (!option)
60                 return SENSOR_ERROR_INVALID_PARAMETER;
61
62         *option = (sensor_recorder_option_h)malloc(sizeof(sensor_recorder_option_h));
63         if (!*option)
64                 return SENSOR_ERROR_OUT_OF_MEMORY;
65
66         return SENSOR_ERROR_NONE;
67 }
68
69 int sensor_recorder_destroy_option(sensor_recorder_option_h option)
70 {
71         _D("Called : option[%#x]", option);
72
73         if (!option)
74                 return SENSOR_ERROR_INVALID_PARAMETER;
75
76         return SENSOR_ERROR_NONE;
77 }
78
79 int sensor_recorder_option_set_int(sensor_recorder_option_h option, sensor_recorder_option_e attribute, int value)
80 {
81         _D("Called : attribute[%d] with value[%d] to option[%#x]", attribute, value, option);
82
83         if (!option)
84                 return SENSOR_ERROR_INVALID_PARAMETER;
85         if (attribute < 0)
86                 return SENSOR_ERROR_INVALID_PARAMETER;
87
88         return SENSOR_ERROR_NONE;
89 }
90
91 int sensor_recorder_create_query(sensor_recorder_query_h *query)
92 {
93         _D("Called : query[%#x]", *query);
94
95         if (!query)
96                 return SENSOR_ERROR_INVALID_PARAMETER;
97
98         *query = (sensor_recorder_query_h)malloc(sizeof(sensor_recorder_query_h));
99         if (!*query)
100                 return SENSOR_ERROR_OUT_OF_MEMORY;
101
102         return SENSOR_ERROR_NONE;
103 }
104
105 int sensor_recorder_destroy_query(sensor_recorder_query_h query)
106 {
107         _D("Called : query[%#x]", query);
108
109         if (!query)
110                 return SENSOR_ERROR_INVALID_PARAMETER;
111
112         return SENSOR_ERROR_NONE;
113 }
114
115 int sensor_recorder_query_set_int(sensor_recorder_query_h query, sensor_recorder_query_e attribute, int value)
116 {
117         _D("Called : attribute[%d] with value[%d] to query[%#x]", attribute, value, query);
118
119         if (!query)
120                 return SENSOR_ERROR_INVALID_PARAMETER;
121         if (attribute < 0)
122                 return SENSOR_ERROR_INVALID_PARAMETER;
123
124         return SENSOR_ERROR_NONE;
125 }
126
127 int sensor_recorder_query_set_time(sensor_recorder_query_h query, sensor_recorder_query_e attribute, time_t t)
128 {
129         _D("Called : attribute[%d] with time[%d] to query[%#x]", attribute, time(&t), query);
130
131         if (!query)
132                 return SENSOR_ERROR_INVALID_PARAMETER;
133         if (attribute < 0)
134                 return SENSOR_ERROR_INVALID_PARAMETER;
135         if (t < 0)
136                 return SENSOR_ERROR_INVALID_PARAMETER;
137
138         return SENSOR_ERROR_NONE;
139 }
140
141 int sensor_recorder_read(sensor_type_e type, sensor_recorder_query_h query, sensor_recorder_data_cb cb, void *user_data)
142 {
143         _D("Called : query[%#x]", query);
144
145         if (type <= SENSOR_ALL)
146                 return SENSOR_ERROR_INVALID_PARAMETER;
147         if (!query || !cb)
148                 return SENSOR_ERROR_INVALID_PARAMETER;
149
150         return SENSOR_ERROR_NONE;
151 }
152
153 int sensor_recorder_read_sync(sensor_type_e type, sensor_recorder_query_h query, sensor_recorder_data_cb cb, void *user_data)
154 {
155         _D("Called : query[%#x]", query);
156
157         if (type <= SENSOR_ALL)
158                 return SENSOR_ERROR_INVALID_PARAMETER;
159         if (!query || !cb)
160                 return SENSOR_ERROR_INVALID_PARAMETER;
161
162         return SENSOR_ERROR_NONE;
163 }
164
165 int sensor_recorder_data_get_time(sensor_recorder_data_h data, time_t *start_time, time_t *end_time)
166 {
167         _D("Called : data[%#x]", data);
168
169         if (!data || !start_time || !end_time)
170                 return SENSOR_ERROR_INVALID_PARAMETER;
171
172         return SENSOR_ERROR_NONE;
173 }
174
175 int sensor_recorder_data_get_int(sensor_recorder_data_h data, sensor_recorder_data_e key, int *value)
176 {
177         _D("Called : key[%d], data[%#x]", key, data);
178
179         if (!data || !value)
180                 return SENSOR_ERROR_INVALID_PARAMETER;
181         if (key < 0)
182                 return SENSOR_ERROR_INVALID_PARAMETER;
183
184         return SENSOR_ERROR_NONE;
185 }
186
187 int sensor_recorder_data_get_double(sensor_recorder_data_h data, sensor_recorder_data_e key, double *value)
188 {
189         _D("Called : key[%d], data[%#x]", key, data);
190
191         if (!data || !value)
192                 return SENSOR_ERROR_INVALID_PARAMETER;
193         if (key < 0)
194                 return SENSOR_ERROR_INVALID_PARAMETER;
195
196         return SENSOR_ERROR_NONE;
197 }