4 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef __SENSOR_INFO_H__
21 #define __SENSOR_INFO_H__
26 #include <hal/hal-sensor-types.h>
27 #include <sensor_types.h>
31 typedef std::vector<char> raw_data_t;
32 typedef raw_data_t::iterator raw_data_iterator;
38 sensor_info(const sensor_info &info);
39 sensor_info(const sensor_info_t &info);
40 sensor_info(const sensor_info2_t &info);
42 /* TODO: it would be better to return type(URI) */
43 sensor_type_t get_type(void);
44 std::string &get_uri(void);
45 std::string &get_model(void);
46 std::string &get_vendor(void);
47 float get_min_range(void);
48 float get_max_range(void);
49 float get_resolution(void);
50 int get_min_interval(void);
51 int get_max_batch_count(void);
52 bool is_wakeup_supported(void);
53 std::string &get_privilege(void);
55 void set_type(sensor_type_t type);
56 void set_uri(const char *name);
57 void set_model(const char *name);
58 void set_vendor(const char *vendor);
59 void set_min_range(float min_range);
60 void set_max_range(float max_range);
61 void set_resolution(float resolution);
62 void set_min_interval(int min_interval);
63 void set_max_batch_count(int max_batch_count);
64 void set_wakeup_supported(bool supported);
65 void set_privilege(const char *privilege);
66 void add_privilege(const char *privilege);
70 void serialize(raw_data_t &data);
71 void deserialize(const char *data, int data_len);
83 int m_max_batch_count;
84 bool m_wakeup_supported;
85 std::string m_privilege;
87 /* TODO: use template */
88 void put(raw_data_t &data, int value);
89 void put(raw_data_t &data, unsigned int value);
90 void put(raw_data_t &data, int64_t value);
91 void put(raw_data_t &data, float value);
92 void put(raw_data_t &data, std::string &value);
93 void put(raw_data_t &data, bool value);
95 /* TODO: use template */
96 raw_data_iterator get(raw_data_iterator it, int &value);
97 raw_data_iterator get(raw_data_iterator it, unsigned int &value);
98 raw_data_iterator get(raw_data_iterator it, int64_t &value);
99 raw_data_iterator get(raw_data_iterator it, float &value);
100 raw_data_iterator get(raw_data_iterator it, std::string &value);
101 raw_data_iterator get(raw_data_iterator it, bool &value);
106 #endif /* __SENSOR_INFO_H__ */