Integrate internal fixes
[platform/core/system/sensord.git] / src / client / sensor_provider_channel_handler.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2017 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 __SENSOR_PROVIDER_CHANNEL_HANDLER__
21 #define __SENSOR_PROVIDER_CHANNEL_HANDLER__
22
23 #include <channel_handler.h>
24 #include <sensor_internal.h>
25 #include "sensor_provider.h"
26
27 namespace sensor {
28
29 class sensor_provider::channel_handler : public ipc::channel_handler
30 {
31 public:
32         channel_handler(sensor_provider *provider);
33
34         void connected(ipc::channel *ch);
35         void disconnected(ipc::channel *ch);
36         void read(ipc::channel *ch, ipc::message &msg);
37
38         void read_complete(ipc::channel *ch);
39         void error_caught(ipc::channel *ch, int error);
40
41         void set_start_cb(sensord_provider_start_cb cb, void *user_data);
42         void set_stop_cb(sensord_provider_stop_cb cb, void *user_data);
43         void set_interval_cb(sensord_provider_interval_changed_cb cb, void *user_data);
44         void set_attribute_str_cb(sensord_provider_attribute_str_cb cb, void *user_data);
45
46 private:
47         sensor_provider *m_provider;
48
49         sensord_provider_start_cb m_start_cb;
50         sensord_provider_stop_cb m_stop_cb;
51         sensord_provider_interval_changed_cb m_interval_changed_cb;
52         sensord_provider_attribute_str_cb m_attribute_str_cb;
53
54         void *m_start_user_data;
55         void *m_stop_user_data;
56         void *m_interval_changed_user_data;
57         void *m_attribute_str_user_data;
58 };
59
60 }
61
62 #endif /* __SENSOR_PROVIDER_CHANNEL_HANDLER__ */