2 * \file transport_manager_listener.h
3 * \brief TransportManagerListener class header file.
5 * Copyright (c) 2013, Ford Motor Company
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
11 * Redistributions of source code must retain the above copyright notice, this
12 * list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided with the
19 * Neither the name of the Ford Motor Company nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
36 #ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_
37 #define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_
39 #include "transport_manager/common.h"
40 #include "transport_manager/info.h"
41 #include "transport_manager/error.h"
43 namespace transport_manager {
45 class TransportManagerListener {
50 virtual ~TransportManagerListener() {
54 * @brief Reaction to the event, when the list of devices is updated.
56 * @param Container that holds information about devices.
58 virtual void OnDeviceListUpdated(const std::vector<DeviceInfo>&) = 0;
61 * @brief Reaction to the event, when the device is found.
63 * @param device_info Variable that hold information about device.
65 virtual void OnDeviceFound(const DeviceInfo &device_info) = 0;
66 virtual void OnDeviceAdded(const DeviceInfo &device_info) = 0;
67 virtual void OnDeviceRemoved(const DeviceInfo &device_info) = 0;
70 * @brief Reaction to the event, when scanning of devices is finished.
72 virtual void OnScanDevicesFinished() = 0;
75 * @brief Reaction to the event, when scanning of devices is failed.
77 * @param error Error information about possible reason of scanning of devices failure.
79 virtual void OnScanDevicesFailed(const SearchDeviceError& error) = 0;
82 * @brief Reaction to the event, when connection is established.
84 * @param devcie_info Variable that hold information about device.
85 * @param connection_id connection unique identifier.
87 virtual void OnConnectionEstablished(const DeviceInfo &device_info,
88 const ConnectionUID &connection_id) = 0;
91 * @brief Reaction to the event, when connection to the device is failed.
93 * @param device_info Variable that hold information about device.
94 * @param error Error information about possible reason of connect failure.
96 virtual void OnConnectionFailed(const DeviceInfo &device_info,
97 const ConnectError& error) = 0;
100 * @brief Reaction to the event, when connection is closed.
102 * @param connection_id Connection unique identifier.
104 virtual void OnConnectionClosed(ConnectionUID connection_id) = 0;
107 * @brief Called when connection is closed unexpectedly, i.e. disconnect was not requested
109 * @param connection_id Connection ID.
110 * @param error Error information.
112 virtual void OnUnexpectedDisconnect(ConnectionUID connection_id,
113 const CommunicationError& error) = 0;
116 * @brief Reaction to the event, when connection close is failed.
118 * @param connection_id Connection unique identifier.
119 * @param error Error information about possible reason of failure.
121 virtual void OnConnectionClosedFailure(ConnectionUID connection_id,
122 const DisconnectError& error) = 0;
125 * \brief Inform about losing connection with device.
126 * \param device Handle of device.
127 * \param error Error information about possible reason of loosing connection.
129 virtual void OnDeviceConnectionLost(const DeviceHandle& device,
130 const DisconnectDeviceError& error) = 0;
133 * \brief Inform about failure during DisconnectDevice procedure of transport manager.
134 * \param device Handle of device.
135 * \param error Error information about possible reason of disconnecting failure.
137 virtual void OnDisconnectFailed(const DeviceHandle& device,
138 const DisconnectDeviceError& error) = 0;
140 * @brief Notifies about recieving message from TM.
142 * @param message Recieved message
144 virtual void OnTMMessageReceived(const RawMessageSptr message) = 0;
147 * @brief Reaction to the event, when receiving of massage for transport manager is failed.
149 * @param connection_id connection unique identifier.
150 * @param error Error information about possible reason of failure.
152 virtual void OnTMMessageReceiveFailed(ConnectionUID connection_id,
153 const DataReceiveError& error) = 0;
156 * @brief Reaction to the event, when transport manager sent a massage.
158 virtual void OnTMMessageSend(const RawMessageSptr message) = 0;
161 * @brief Reaction to the event, when sending of massage by transport manager is failed.
163 * @param error Error information about possible reason of failure.
164 * @param message Smart pointer to the raw massage.
166 virtual void OnTMMessageSendFailed(const DataSendError& error,
167 const RawMessageSptr message) = 0;
169 } // namespace transport_manager
170 #endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER