sensor: check if the event value is NaN
[platform/core/system/sensord.git] / src / shared / command_types.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __COMMAND_TYPES_H__
21 #define __COMMAND_TYPES_H__
22
23 #include <sensor_types.h>
24 #include "sensor_info.h"
25
26 #define SENSOR_CHANNEL_PATH             "/run/.sensord.socket"
27 #define MAX_BUF_SIZE 4096
28
29 /* TODO: OOP - create serializer interface */
30 enum cmd_type_e {
31         CMD_DONE = -1,
32         CMD_NONE = 0,
33
34         /* Manager */
35         CMD_MANAGER_CONNECT = 0x100,
36         CMD_MANAGER_SENSOR_LIST,
37         CMD_MANAGER_SENSOR_ADDED,
38         CMD_MANAGER_SENSOR_REMOVED,
39
40         /* Listener */
41         CMD_LISTENER_EVENT = 0x200,
42         CMD_LISTENER_ACC_EVENT,
43         CMD_LISTENER_CONNECT,
44         CMD_LISTENER_START,
45         CMD_LISTENER_STOP,
46         CMD_LISTENER_ATTR_INT,
47         CMD_LISTENER_ATTR_STR,
48         CMD_LISTENER_GET_DATA,
49
50         /* Provider */
51         CMD_PROVIDER_CONNECT = 0x300,
52         CMD_PROVIDER_START,
53         CMD_PROVIDER_STOP,
54         CMD_PROVIDER_ATTR_INT,
55         CMD_PROVIDER_PUBLISH,
56
57         /* Etc */
58         CMD_HAS_PRIVILEGE = 0x1000,
59
60         CMD_CNT,
61 };
62
63 typedef struct {
64         int sensor_cnt;
65         char data[0];
66 } cmd_manager_sensor_list_t;
67
68 typedef struct {
69         int listener_id;
70         char sensor[NAME_MAX];
71 } cmd_listener_connect_t;
72
73 typedef struct {
74         int listener_id;
75 } cmd_listener_start_t;
76
77 typedef struct {
78         int listener_id;
79 } cmd_listener_stop_t;
80
81 typedef struct  {
82         int listener_id;
83         int attribute;
84         int value;
85 } cmd_listener_attr_int_t;
86
87 typedef struct  {
88         int listener_id;
89         int attribute;
90         int len;
91         char value[0];
92 } cmd_listener_attr_str_t;
93
94 typedef struct {
95         int listener_id;
96         int len;
97         sensor_data_t data;
98 } cmd_listener_get_data_t;
99
100 typedef struct {
101         char info[0];
102 } cmd_provider_connect_t;
103
104 typedef struct {
105         sensor_data_t data;
106 } cmd_provider_publish_t;
107
108 typedef struct  {
109         int attribute;
110         int value;
111 } cmd_provider_attr_int_t;
112
113 typedef struct {
114         char sensor[NAME_MAX];
115 } cmd_has_privilege_t ;
116
117 #endif /* __COMMAND_TYPES_H__ */