sensord: fix incorrect return type
[platform/core/system/sensord.git] / src / server / external_sensor.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2015 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 _EXTERNAL_SENSOR_H_
21 #define _EXTERNAL_SENSOR_H_
22
23 #include <sensor_base.h>
24 #include <sensor_common.h>
25 #include <cmutex.h>
26 #include <string>
27
28 class external_sensor : public sensor_base {
29 public:
30         external_sensor();
31         virtual ~external_sensor();
32         int send_data(const char* data, int data_cnt);
33         std::string get_key(void);
34         bool set_source_connected(bool connected);
35         bool get_source_connected(void);
36         virtual void on_receive(unsigned long long timestamp, const float* data, int data_cnt) = 0;
37         virtual int set_attribute(int32_t attribute, char *value, int value_size);
38 protected:
39         bool register_key(const std::string &key);
40 private:
41         bool unregister_key(void);
42
43         std::string m_key;
44         bool m_source_connected;
45         cmutex m_source_mutex;
46 };
47 #endif /* _EXTERNAL_SENSOR_H_ */