Add the 'webutil' feature into the Server
[apps/native/position-finder-server.git] / inc / webutil.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Contact: Jin Yoon <jinny.yoon@samsung.com>
5  *          Geunsun Lee <gs86.lee@samsung.com>
6  *          Eunyoung Lee <ey928.lee@samsung.com>
7  *          Junkyu Han <junkyu.han@samsung.com>
8  *          Jeonghoon Park <jh1979.park@samsung.com>
9  *
10  * Licensed under the Flora License, Version 1.1 (the License);
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://floralicense.org/license/
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an AS IS BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22
23
24 #ifndef __POSITION_FINDER_WEBUTIL_H__
25 #define __POSITION_FINDER_WEBUTIL_H__
26
27 typedef enum {
28         WEB_UTIL_SENSOR_NONE = 0,
29         WEB_UTIL_SENSOR_MOTION = (1 << 0), /* IR motion sensor */
30         WEB_UTIL_SENSOR_FLAME = (1 << 1), /* flame sensor */
31         WEB_UTIL_SENSOR_HUMIDITY = (1 << 2), /* humidity sensor */
32         WEB_UTIL_SENSOR_TEMPERATURE = (1 << 3), /* temperature sensor */
33         WEB_UTIL_SENSOR_VIB = (1 << 4), /* vibration sensor */
34         WEB_UTIL_SENSOR_CO2 = (1 << 5), /* CO2 sensor */
35         WEB_UTIL_SENSOR_SOUND = (1 << 6), /* noise sensor */
36 } web_util_sensor_type_e;
37
38 typedef struct _web_util_sensor_data_s web_util_sensor_data_s;
39 struct _web_util_sensor_data_s {
40         int motion;
41         int flame;
42         double humidity;
43         double temperature;
44         int virbration;
45         double co2;
46         int soundlevel;
47         web_util_sensor_type_e enabled_sensor;
48         char *hash;
49 };
50
51 int web_util_noti_init(void);
52 void web_util_noti_fini(void);
53 int web_util_noti_post(const char *resource, const char *json_data);
54
55 int web_util_json_init(void);
56 int web_util_json_fini(void);
57 int web_util_json_data_array_begin(void);
58 int web_util_json_data_array_end(void);
59 int web_util_json_add_sensor_data(const char* sensorpi_id, web_util_sensor_data_s *sensor_data);
60 char *web_util_get_json_string(void);
61
62 #endif /* __POSITION_FINDER_WEBUTIL_H__ */