capi-sensor: change sensor-recorder implementations for migration
[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         if (type <= SENSOR_ALL)
24                 return SENSOR_ERROR_INVALID_PARAMETER;
25         if (!supported)
26                 return SENSOR_ERROR_INVALID_PARAMETER;
27
28         *supported = false;
29
30         return SENSOR_ERROR_NONE;
31 }
32
33 int sensor_recorder_start(sensor_type_e type, sensor_recorder_option_h option)
34 {
35         if (type <= SENSOR_ALL)
36                 return SENSOR_ERROR_INVALID_PARAMETER;
37
38         return SENSOR_ERROR_NOT_SUPPORTED;
39 }
40
41 int sensor_recorder_stop(sensor_type_e type)
42 {
43         if (type <= SENSOR_ALL)
44                 return SENSOR_ERROR_INVALID_PARAMETER;
45
46         return SENSOR_ERROR_NOT_SUPPORTED;
47 }
48
49 int sensor_recorder_create_option(sensor_recorder_option_h *option)
50 {
51         if (!option)
52                 return SENSOR_ERROR_INVALID_PARAMETER;
53
54         *option = (sensor_recorder_option_h)malloc(sizeof(sensor_recorder_option_h));
55         if (!*option)
56                 return SENSOR_ERROR_OUT_OF_MEMORY;
57
58         return SENSOR_ERROR_NONE;
59 }
60
61 int sensor_recorder_destroy_option(sensor_recorder_option_h option)
62 {
63         if (!option)
64                 return SENSOR_ERROR_INVALID_PARAMETER;
65
66         return SENSOR_ERROR_NONE;
67 }
68
69 int sensor_recorder_option_set_int(sensor_recorder_option_h option, sensor_recorder_option_e attribute, int value)
70 {
71         if (!option)
72                 return SENSOR_ERROR_INVALID_PARAMETER;
73         if (attribute < 0)
74                 return SENSOR_ERROR_INVALID_PARAMETER;
75
76         return SENSOR_ERROR_NONE;
77 }
78
79 int sensor_recorder_create_query(sensor_recorder_query_h *query)
80 {
81         if (!query)
82                 return SENSOR_ERROR_INVALID_PARAMETER;
83
84         *query = (sensor_recorder_query_h)malloc(sizeof(sensor_recorder_query_h));
85         if (!*query)
86                 return SENSOR_ERROR_OUT_OF_MEMORY;
87
88         return SENSOR_ERROR_NONE;
89 }
90
91 int sensor_recorder_destroy_query(sensor_recorder_query_h query)
92 {
93         if (!query)
94                 return SENSOR_ERROR_INVALID_PARAMETER;
95
96         return SENSOR_ERROR_NONE;
97 }
98
99 int sensor_recorder_query_set_int(sensor_recorder_query_h query, sensor_recorder_query_e attribute, int value)
100 {
101         if (!query)
102                 return SENSOR_ERROR_INVALID_PARAMETER;
103         if (attribute < 0)
104                 return SENSOR_ERROR_INVALID_PARAMETER;
105
106         return SENSOR_ERROR_NONE;
107 }
108
109 int sensor_recorder_query_set_time(sensor_recorder_query_h query, sensor_recorder_query_e attribute, time_t t)
110 {
111         if (!query)
112                 return SENSOR_ERROR_INVALID_PARAMETER;
113         if (attribute < 0)
114                 return SENSOR_ERROR_INVALID_PARAMETER;
115         if (t < 0)
116                 return SENSOR_ERROR_INVALID_PARAMETER;
117
118         return SENSOR_ERROR_NONE;
119 }
120
121 int sensor_recorder_read(sensor_type_e type, sensor_recorder_query_h query, sensor_recorder_data_cb cb, void *user_data)
122 {
123         if (type <= SENSOR_ALL)
124                 return SENSOR_ERROR_INVALID_PARAMETER;
125         if (!query || !cb)
126                 return SENSOR_ERROR_INVALID_PARAMETER;
127
128         return SENSOR_ERROR_NONE;
129 }
130
131 int sensor_recorder_read_sync(sensor_type_e type, sensor_recorder_query_h query, sensor_recorder_data_cb cb, void *user_data)
132 {
133         if (type <= SENSOR_ALL)
134                 return SENSOR_ERROR_INVALID_PARAMETER;
135         if (!query || !cb)
136                 return SENSOR_ERROR_INVALID_PARAMETER;
137
138         return SENSOR_ERROR_NONE;
139 }
140
141 int sensor_recorder_data_get_time(sensor_recorder_data_h data, time_t *start_time, time_t *end_time)
142 {
143         if (!data || !start_time || !end_time)
144                 return SENSOR_ERROR_INVALID_PARAMETER;
145
146         return SENSOR_ERROR_NONE;
147 }
148
149 int sensor_recorder_data_get_int(sensor_recorder_data_h data, sensor_recorder_data_e key, int *value)
150 {
151         if (!data || !value)
152                 return SENSOR_ERROR_INVALID_PARAMETER;
153         if (key < 0)
154                 return SENSOR_ERROR_INVALID_PARAMETER;
155
156         return SENSOR_ERROR_NONE;
157 }
158
159 int sensor_recorder_data_get_double(sensor_recorder_data_h data, sensor_recorder_data_e key, double *value)
160 {
161         if (!data || !value)
162                 return SENSOR_ERROR_INVALID_PARAMETER;
163         if (key < 0)
164                 return SENSOR_ERROR_INVALID_PARAMETER;
165
166         return SENSOR_ERROR_NONE;
167 }