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 #include "channel_event_handler.h"
23 #include "channel_handler.h"
24 #include "sensor_log.h"
28 channel_event_handler::channel_event_handler(channel *ch, channel_handler *handler)
34 channel_event_handler::~channel_event_handler()
40 bool channel_event_handler::handle(int fd, event_condition condition)
44 if (!m_ch || !m_ch->is_connected())
47 if (condition & (EVENT_HUP)) {
54 if (!m_ch->read_sync(msg)) {
64 void channel_event_handler::connected(channel *ch)
67 m_handler->connected(ch);
70 void channel_event_handler::disconnected(channel *ch)
73 m_handler->disconnected(ch);
76 void channel_event_handler::read(channel *ch, message &msg)
79 m_handler->read(ch, msg);
82 void channel_event_handler::read_complete(channel *ch)
85 m_handler->read_complete(ch);
88 void channel_event_handler::error_caught(channel *ch, int error)
91 m_handler->error_caught(ch, error);