diff options
Diffstat (limited to 'src/components/include/connection_handler/connection_handler.h')
-rw-r--r-- | src/components/include/connection_handler/connection_handler.h | 83 |
1 files changed, 68 insertions, 15 deletions
diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index 1fcf5e4477..bfaacf5fc1 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -40,6 +40,7 @@ #include "connection_handler/connection.h" #include "connection_handler/devices_discovery_starter.h" #include "utils/macro.h" +#include "utils/data_accessor.h" /** * \namespace connection_handler @@ -51,6 +52,14 @@ enum CloseSessionReason { kCommon = 0, kFlood, kMalformed, kUnauthorizedApp }; class ConnectionHandlerObserver; +// The SessionConnectionMap keeps track of the primary and secondary transports +// associated with a session ID +typedef struct { + transport_manager::ConnectionUID primary_transport; + transport_manager::ConnectionUID secondary_transport; +} SessionTransports; +typedef std::map<uint8_t, SessionTransports> SessionConnectionMap; + /** * \class ConnectionHandler * \brief SmartDeviceLink ConnectionHandler interface class @@ -183,21 +192,6 @@ class ConnectionHandler { connection_handler::DeviceHandle* device_id) const = 0; /** - * DEPRECATED - * \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 - */ - DEPRECATED 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. * @@ -217,6 +211,43 @@ class ConnectionHandler { virtual DevicesDiscoveryStarter& get_device_discovery_starter() = 0; /** + * \brief Add a session. This is meant to be called from Connection class. + * \param primary_transport_id the primary connection ID to associate with the + * newly created session + * \return new session id, or 0 if failed + **/ + virtual uint32_t AddSession( + const transport_manager::ConnectionUID primary_transport_id) = 0; + + /** + * \brief Remove a session. This is meant to be called from Connection class. + * \param session_id ID of the session to remove + * \return true if successful, false otherwise + **/ + virtual bool RemoveSession(uint8_t session_id) = 0; + + virtual DataAccessor<SessionConnectionMap> session_connection_map() = 0; + + /** + * \brief Associate a secondary transport ID with a session + * \param session_id the session ID + * \param connection_id the new secondary connection ID to associate with the + * session + * \return the SessionTransports (newly) associated with the session + **/ + virtual SessionTransports SetSecondaryTransportID( + uint8_t session_id, + transport_manager::ConnectionUID secondary_transport_id) = 0; + + /** + * \brief Retrieve the session transports associated with a session + * \param session_id the session ID + * \return the SessionTransports associated with the session + **/ + virtual const SessionTransports GetSessionTransports( + uint8_t session_id) const = 0; + + /** * \brief Invoked when observer's OnServiceStartedCallback is completed * \param session_key the key of started session passed to * OnServiceStartedCallback(). @@ -232,6 +263,28 @@ class ConnectionHandler { bool result, std::vector<std::string>& rejected_params) = 0; + /** + * \brief Called when secondary transport with given session ID is established + * \param primary_connection_handle Set to identifier of primary connection + * \param secondary_connection_handle Identifier of secondary connection + * \param session_id session ID taken from Register Secondary Transport frame + * \return true if successful + **/ + virtual bool OnSecondaryTransportStarted( + transport_manager::ConnectionUID& primary_connection_handle, + const transport_manager::ConnectionUID secondary_connection_handle, + const uint8_t session_id) = 0; + + /** + * \brief Called when secondary transport shuts down + * \param primary_connection_handle Identifier of primary connection + * \param secondary_connection_handle Identifier of secondary connection + * transport + **/ + virtual void OnSecondaryTransportEnded( + const transport_manager::ConnectionUID primary_connection_handle, + const transport_manager::ConnectionUID secondary_connection_handle) = 0; + protected: /** * \brief Destructor |