summaryrefslogtreecommitdiff
path: root/src/components/connection_handler/include/connection_handler/connection_handler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/connection_handler/include/connection_handler/connection_handler.h')
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler.h87
1 files changed, 57 insertions, 30 deletions
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler.h b/src/components/connection_handler/include/connection_handler/connection_handler.h
index 4a79658878..cb22b87bbb 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
#define SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
+#include "connection_handler/connection_handler_settings.h"
#include "transport_manager/transport_manager_listener.h"
#include "protocol_handler/session_observer.h"
#include "connection_handler/device.h"
@@ -45,14 +46,9 @@
*/
namespace connection_handler {
- enum CloseSessionReason {
- kCommon = 0,
- kFlood,
- kMalformed,
- kUnauthorizedApp
- };
+enum CloseSessionReason { kCommon = 0, kFlood, kMalformed, kUnauthorizedApp };
- class ConnectionHandlerObserver;
+class ConnectionHandlerObserver;
/**
* \class ConnectionHandler
@@ -65,14 +61,7 @@ class ConnectionHandler {
* \param observer Pointer to observer object.
**/
virtual void set_connection_handler_observer(
- ConnectionHandlerObserver *observer) = 0;
-
- /**
- * \brief Sets pointer to TransportManager.
- * \param transportManager Pointer to TransportManager object.
- **/
- virtual void set_transport_manager(
- transport_manager::TransportManager *transport_manager) = 0;
+ ConnectionHandlerObserver* observer) = 0;
virtual void StartTransportManager() = 0;
@@ -88,7 +77,8 @@ class ConnectionHandler {
virtual void CloseRevokedConnection(uint32_t connection_key) = 0;
/**
- * \brief Close all associated sessions and close the connection pointed by handle
+ * \brief Close all associated sessions and close the connection pointed by
+ * handle
*/
virtual void CloseConnection(ConnectionHandle connection_handle) = 0;
@@ -103,8 +93,8 @@ class ConnectionHandler {
* @param mac_address
* @return true if successfully
*/
- virtual bool GetDeviceID(const std::string &mac_address,
- DeviceHandle *device_handle) = 0;
+ virtual bool GetDeviceID(const std::string& mac_address,
+ DeviceHandle* device_handle) = 0;
/**
* Close session associated with the key
@@ -118,13 +108,13 @@ class ConnectionHandler {
uint8_t session_id,
CloseSessionReason close_reason) = 0;
- /**
- * @brief SendEndService allows to end up specific service.
- *
- * @param key application identifier whose service should be closed.
- *
- * @param service_type the service that should be closed.
- */
+ /**
+ * @brief SendEndService allows to end up specific service.
+ *
+ * @param key application identifier whose service should be closed.
+ *
+ * @param service_type the service that should be closed.
+ */
virtual void SendEndService(uint32_t key, uint8_t service_type) = 0;
/**
@@ -138,15 +128,22 @@ class ConnectionHandler {
* \brief Send heartbeat to mobile app
*/
virtual void SendHeartBeat(ConnectionHandle connection_handle,
- uint8_t session_id) = 0;
+ uint8_t session_id) = 0;
/**
* Sets heart beat timeout for specified session
* @param connection_key pair of connection and session id
- * @param timeout in seconds
+ * @param timeout in milliseconds
*/
virtual void SetHeartBeatTimeout(uint32_t connection_key,
- int32_t timeout) = 0;
+ uint32_t timeout) = 0;
+
+ /**
+ * \brief Keep connection associated with the key from being closed by
+ * heartbeat monitor
+ */
+ virtual void KeepConnectionAlive(uint32_t connection_key,
+ uint8_t session_id) = 0;
/**
* \brief binds protocol version with session
@@ -158,12 +155,42 @@ class ConnectionHandler {
virtual void BindProtocolVersionWithSession(uint32_t connection_key,
uint8_t protocol_version) = 0;
+ /**
+ * \brief information about given Connection Key.
+ * \param key Unique key used by other components as session identifier
+ * \param app_id Returned: ApplicationID
+ * \param sessions_list Returned: List of session keys
+ * \param device_id Returned: DeviceID
+ * \return int32_t -1 in case of error or 0 in case of success
+ */
+ virtual int32_t GetDataOnSessionKey(uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ uint32_t* device_id) const = 0;
+ /**
+ * @brief GetConnectedDevicesMAC allows to obtain MAC adresses for all
+ * currently connected devices.
+ *
+ * @param device_macs collection of MAC adresses for connected devices.
+ */
+ virtual void GetConnectedDevicesMAC(
+ std::vector<std::string>& device_macs) const = 0;
+
+ /**
+ * \brief Connection handler settings getter
+ * \return pointer to connection handler settings class
+ */
+ virtual const ConnectionHandlerSettings& get_settings() const = 0;
+
+ virtual const protocol_handler::SessionObserver& get_session_observer() = 0;
+
+ virtual DevicesDiscoveryStarter& get_device_discovery_starter() = 0;
+
protected:
/**
* \brief Destructor
*/
- virtual ~ConnectionHandler() {
- }
+ virtual ~ConnectionHandler() {}
};
} // namespace connection_handler