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)) {
52 if (!m_ch->read_sync(msg, false)) {
60 void channel_event_handler::connected(channel *ch)
63 m_handler->connected(ch);
66 void channel_event_handler::disconnected(channel *ch)
69 m_handler->disconnected(ch);
72 void channel_event_handler::read(channel *ch, message &msg)
75 m_handler->read(ch, msg);
78 void channel_event_handler::read_complete(channel *ch)
81 m_handler->read_complete(ch);
84 void channel_event_handler::error_caught(channel *ch, int error)
87 m_handler->error_caught(ch, error);