summaryrefslogtreecommitdiff
path: root/inc/webutil.h
blob: d8c3ae2607ddc3e8f9d498d13884d6cb81671b0f (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
/*
 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
 *
 * Contact: Jin Yoon <jinny.yoon@samsung.com>
 *          Geunsun Lee <gs86.lee@samsung.com>
 *          Eunyoung Lee <ey928.lee@samsung.com>
 *          Junkyu Han <junkyu.han@samsung.com>
 *          Jeonghoon Park <jh1979.park@samsung.com>
 *
 * Licensed under the Flora License, Version 1.1 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://floralicense.org/license/
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#ifndef __POSITION_FINDER_WEBUTIL_H__
#define __POSITION_FINDER_WEBUTIL_H__

typedef enum {
	WEB_UTIL_SENSOR_NONE = 0,
	WEB_UTIL_SENSOR_MOTION = (1 << 0), /* IR motion sensor */
	WEB_UTIL_SENSOR_FLAME = (1 << 1), /* flame sensor */
	WEB_UTIL_SENSOR_HUMIDITY = (1 << 2), /* humidity sensor */
	WEB_UTIL_SENSOR_TEMPERATURE = (1 << 3), /* temperature sensor */
	WEB_UTIL_SENSOR_VIB = (1 << 4), /* vibration sensor */
	WEB_UTIL_SENSOR_CO2 = (1 << 5), /* CO2 sensor */
	WEB_UTIL_SENSOR_SOUND = (1 << 6), /* noise sensor */
	WEB_UTIL_SENSOR_TILT = (1 << 7), /* tilt sensor */
	WEB_UTIL_SENSOR_LIGHT = (1 << 8), /* light sensor */
	WEB_UTIL_SENSOR_COLLISION = (1 << 9), /* collision sensor */
	WEB_UTIL_SENSOR_OBSTACLE = (1 << 10), /* obstacle avoidance sensor */
	WEB_UTIL_SENSOR_ULTRASONIC_DISTANCE = (1 << 11), /* ultrasonic distance sensor */
	WEB_UTIL_SENSOR_RAIN = (1 << 12), /* rain sensor */
	WEB_UTIL_SENSOR_TOUCH = (1 << 13), /* touch sensor */
	WEB_UTIL_SENSOR_GAS = (1 << 14), /* gas sensor */
} web_util_sensor_type_e;

typedef struct _web_util_sensor_data_s web_util_sensor_data_s;
struct _web_util_sensor_data_s {
	int motion;
	int flame;
	double humidity;
	double temperature;
	int virbration;
	double co2;
	int soundlevel;
	int tilt;
	int light;
	int collision;
	int obstacle;
	double distance;
	int rain;
	int touch;
	int gas;
	web_util_sensor_type_e enabled_sensor;
	char *hash;
};

int web_util_noti_init(void);
void web_util_noti_fini(void);
int web_util_noti_post(const char *resource, const char *json_data);

int web_util_json_init(void);
int web_util_json_fini(void);
int web_util_json_data_array_begin(void);
int web_util_json_data_array_end(void);
int web_util_json_add_sensor_data(const char* sensorpi_id, web_util_sensor_data_s *sensor_data);
char *web_util_get_json_string(void);

#endif /* __POSITION_FINDER_WEBUTIL_H__ */