Add Camera Module
[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_TILT = (1 << 7), /* tilt sensor */
37         WEB_UTIL_SENSOR_LIGHT = (1 << 8), /* light sensor */
38         WEB_UTIL_SENSOR_COLLISION = (1 << 9), /* collision sensor */
39         WEB_UTIL_SENSOR_OBSTACLE = (1 << 10), /* obstacle avoidance sensor */
40         WEB_UTIL_SENSOR_ULTRASONIC_DISTANCE = (1 << 11), /* ultrasonic distance sensor */
41         WEB_UTIL_SENSOR_RAIN = (1 << 12), /* rain sensor */
42         WEB_UTIL_SENSOR_TOUCH = (1 << 13), /* touch sensor */
43         WEB_UTIL_SENSOR_GAS = (1 << 14), /* gas sensor */
44 } web_util_sensor_type_e;
45
46 typedef struct _web_util_sensor_data_s web_util_sensor_data_s;
47 struct _web_util_sensor_data_s {
48         int motion;
49         int flame;
50         double humidity;
51         double temperature;
52         int virbration;
53         double co2;
54         int soundlevel;
55         int tilt;
56         int light;
57         int collision;
58         int obstacle;
59         double distance;
60         int rain;
61         int touch;
62         int gas;
63         web_util_sensor_type_e enabled_sensor;
64         const char *hash;
65         const char *ip_addr;
66 };
67
68 int web_util_noti_init(void);
69 void web_util_noti_fini(void);
70 int web_util_noti_post(const char *resource, const char *json_data);
71 int web_util_noti_post_image_data(const char *url, const char *device_id,
72         const void *image_data, unsigned int image_size);
73 int web_util_noti_get(const char *resource, char **res);
74
75 int web_util_json_init(void);
76 int web_util_json_fini(void);
77 int web_util_json_begin(void);
78 int web_util_json_end(void);
79 int web_util_json_data_array_begin(void);
80 int web_util_json_data_array_end(void);
81 int web_util_json_add_int(const char* key, long long int value);
82 int web_util_json_add_double(const char* key, double value);
83 int web_util_json_add_boolean(const char* key, bool value);
84 int web_util_json_add_string(const char* key, const char *value);
85 int web_util_json_add_sensor_data(const char* sensorpi_id, web_util_sensor_data_s *sensor_data);
86 char *web_util_get_json_string(void);
87
88 #endif /* __POSITION_FINDER_WEBUTIL_H__ */