Connect Library - Class List
Following is the description of classes presented in the Stream Library.
MediaElementType
Media Element Type
Defines properties of a media element. Default value is as media type disabled.
Contain attributes of a media type including IDs to access the specific component.
For audio/video, componentId vector will have two entry. One for the rest.
Public Attributes
<li><a href = "#MediaElementType@enable">enable</a></li>
<li><a href = "#MediaElementType@lossless">lossless</a></li>
<li><a href = "#MediaElementType@componentId">componentId</a></li>
Public Methods
<li><a href = "#MediaElementType@MediaElementType">MediaElementType</a></li>
Public Member Data Documentation
Following is the detailed documentation of the public variables declared under the MediaElementType class.
bool enable;
bool lossless;
std::vector<std::string> componentId;
Public Member Function Documentation
Following is the detailed documentation of the public methods declared under the MediaElementType class.
MediaElementType (){};
SessionDescription
Session description of data and media types.
Indicates enabled/disabled media types for a connected session.
Public Attributes
<li><a href = "#SessionDescription@audio">audio</a></li>
<li><a href = "#SessionDescription@video">video</a></li>
<li><a href = "#SessionDescription@data">data</a></li>
<li><a href = "#SessionDescription@control">control</a></li>
Public Member Data Documentation
Following is the detailed documentation of the public variables declared under the SessionDescription class.
MediaElementType audio;
MediaElementType video;
MediaElementType data;
MediaElementType control;
ConnectionDescription
Connection description
Connection details.
Public Attributes
<li><a href = "#ConnectionDescription@initiator">initiator</a></li>
<li><a href = "#ConnectionDescription@connectionType">connectionType</a></li>
<li><a href = "#ConnectionDescription@natType">natType</a></li>
<li><a href = "#ConnectionDescription@endpointUuid">endpointUuid</a></li>
<li><a href = "#ConnectionDescription@connectionUuid">connectionUuid</a></li>
<li><a href = "#ConnectionDescription@sessionDescription">sessionDescription</a></li>
Public Member Data Documentation
Following is the detailed documentation of the public variables declared under the ConnectionDescription class.
bool initiator;
std::string connectionType;
std::string natType;
// endpointUuid is the remote Endpoint identifier
com::anyconnect::access::Endpoint endpointUuid;
// connectionUuid is the unique connection identifier for each connection,
std::string connectionUuid;
// sessionDescription contains the session media details.
SessionDescription sessionDescription;
ConnectionTransitionDescription
Connection transition details.
on stopped state, reflects ongoing connection details.
on other state, may reflect the updated connection details.
Public Attributes
<li><a href = "#ConnectionTransitionDescription@state">state</a></li>
<li><a href = "#ConnectionTransitionDescription@connectionUuid">connectionUuid</a></li>
<li><a href = "#ConnectionTransitionDescription@connectionDescription">connectionDescription</a></li>
Public Member Data Documentation
Following is the detailed documentation of the public variables declared under the ConnectionTransitionDescription class.
// state indicates current state of connection (ConnectionTransitionState).
ConnectionTransitionState state;
// connectionUUID indicates which ongoing connection is in transition. This will hold the old connectionUuid in case of restart of a connection.
std::string connectionUuid;
// connectionDescription indicates resultant connection details.
ConnectionDescription connectionDescription;
Connect
Connect
Connect interface definition for the Connect object. The public
interface for this class includes setting and getting Access as well
as connection event handlers.
Public Methods
<li><a href = "#Connect@~Connect">~Connect</a></li>
<li><a href = "#Connect@offerConnection">offerConnection</a></li>
<li><a href = "#Connect@signalOnDemandMediaRelayState">signalOnDemandMediaRelayState</a></li>
<li><a href = "#Connect@onMediaRelayStateChange">onMediaRelayStateChange</a></li>
<li><a href = "#Connect@onOnDemandMediaRelaySignal">onOnDemandMediaRelaySignal</a></li>
<li><a href = "#Connect@setMediaRelayState">setMediaRelayState</a></li>
<li><a href = "#Connect@onConnectionEstablished">onConnectionEstablished</a></li>
<li><a href = "#Connect@onConnectionOffered">onConnectionOffered</a></li>
<li><a href = "#Connect@onConnectionClosed">onConnectionClosed</a></li>
<li><a href = "#Connect@onConnectionChange">onConnectionChange</a></li>
<li><a href = "#Connect@send">send</a></li>
<li><a href = "#Connect@onDataReceived">onDataReceived</a></li>
<li><a href = "#Connect@closeConnection">closeConnection</a></li>
<li><a href = "#Connect@getActiveConnectionList">getActiveConnectionList</a></li>
<li><a href = "#Connect@start">start</a></li>
<li><a href = "#Connect@stop">stop</a></li>
<li><a href = "#Connect@getAccess">getAccess</a></li>
Typedefs
<li><a href = "#Connect@Ptr">Ptr</a></li>
Public Member Function Documentation
Following is the detailed documentation of the public methods declared under the Connect class.
virtual ~Connect(){}
Initiates a connection offer using provided session description to the Endpoint.
virtual bool offerConnection(const com::anyconnect::access::Endpoint &endpointUuid, const SessionDescription &sessionDescription, ConnectionDescriptionHandler callback) = 0;
Member | Datatype | Definition |
---|---|---|
endpointUuid | const com::anyconnect::access::Endpoint & | Remote endpoint to connect to |
sessionDescription | const SessionDescription & | Session details and function pointer to get Connection description. |
callback | ConnectionDescriptionHandler | Callback handler function for connection description. ConnectionDescriptionHandler will provide the detail properties of the offered connection. |
Return Value: bool, true on success.
Initiates a MediaRelay request using provided state to the Endpoint. This is to be done from the app side. state - indicates if it needs to start MediaRelay or stop it.
virtual bool signalOnDemandMediaRelayState(const com::anyconnect::access::Endpoint &endpointUuid, const bool enable) = 0;
Member | Datatype | Definition |
---|---|---|
endpointUuid | const com::anyconnect::access::Endpoint & | Remote endpoint ID to start the On-Demand MediaRelay |
Return Value: bool, true on success.
Event handler when MediaRelay state is changed. Camera will keep listening to this. This must be registered to be notified for MediaRelay state change.
virtual void onMediaRelayStateChange(MediaRelayStateChangeHandler callback) = 0;
Event handler when On-Demand MediaRelay signal is received. Camera will keep listening to this. This must be registered to be notified for on-demand MediaRelay request from the app.
virtual void onOnDemandMediaRelaySignal(OnDemandMediaRelaySignalHandler callback) = 0;
This is to enable MediaRelay from the camera end upon some motion detection or event based in the camera.
virtual bool setMediaRelayState(std::string sessionId, const MediaRelayType mediaRelayType, const bool state, std::string inputSource, uint32_t referenceTime, uint32_t actionTime, uint32_t duration) = 0;
Member | Datatype | Definition |
---|---|---|
sessionId | std::string | ID of the MediaRelay session. ID would be choosen by the API caller. |
mediaRelayType | const MediaRelayType | Media Relay type |
state | const bool | indicates if it needs to start MediaRelay or stop it. |
Return Value: bool, true on success.
Event handler when offerer/answerer endpoint accepts the connection. Called for both the offerer and answerer. This must be registered to be notified for any successful connection. Recommended to register before starting Connect object.
virtual void onConnectionEstablished(ConnectionDescriptionHandler callback) = 0;
Member | Datatype | Definition |
---|---|---|
callback | ConnectionDescriptionHandler | Callback handler function for connection description. ConnectionDescriptionHandler will provide the detail properties of the established connection. |
Event handler when answerer receives a connection offer from offerer endpoint. ConnectionDescriptionHandler will provide the detail properties of the offered connection. The implementation of the callback should return true to accept an offered connection, false to decline. This must be registered to be notified for any connection attempt from offerer end. Recommended to register before starting Connect object.
virtual void onConnectionOffered(bConnectionDescriptionHandler callback) = 0;
Member | Datatype | Definition |
---|---|---|
callback | bConnectionDescriptionHandler | Callback handler function for connection description. |
Event handler when connection gets closed implicitly. This must be registered to be notified for any implicit connection close. Recommended to register before starting Connect object.
virtual void onConnectionClosed(ConnectionUuidHandler callback) = 0;
Member | Datatype | Definition |
---|---|---|
callback | ConnectionUuidHandler | Callback handler for the Connection UUID. ConnectionUuidHandler will have the corresponding connection uuid. |
Event handler when connection's underlying transport has either stopped or restarted. This must be registered to be notified for any changes to an existing connected session. Recommended to register before starting Connect object.
virtual void onConnectionChange(ConnectionTransitionDescriptionHandler callback) = 0;
Member | Datatype | Definition |
---|---|---|
callback | ConnectionTransitionDescriptionHandler | Callback handler function for connection description. ConnectionTransitionDescriptionHandler will provide the detail properties of the corresponding connection. |
Send data to remote connected Endpoint.
virtual int32_t send(const std::string &connectionUuid, const std::string &componentId, const char* data, uint32_t length) = 0;
Member | Datatype | Definition |
---|---|---|
connectionUuid | const std::string & | Connection unique universal identifier. |
componentId | const std::string & | Component identifier. Use intended MediaElement component type from MediaElementType |
data | const char* | Data payload. |
length | uint32_t | Payload length. |
Return Value: int32_t number of bytes sent, the size of successfully sent data. -1 indicates failure.
Event handler for incoming data. This must be registered to receive any incoming data from the connected peer Endpoint. Register this callback for each components of a connection. Can be registered upon receiving onConnectionEstablished callback both offerer & answerer end. OR upon receiving onConnectionOffered for answerer end upon receiving callback of offerConnection for offerer end.
virtual void onDataReceived(const std::string &connectionUuid, const std::string &componentId, DataReceivedHandler callback) = 0;
Member | Datatype | Definition |
---|---|---|
connectionUuid | const std::string & | Connection unique universal identifier. |
componentId | const std::string & | Component identifier. |
callback | DataReceivedHandler | Callback function handler for received data. DataReceivedHandler will have the received data and corresponding length. |
Close an existing connection. If the provided connectionuuid is invalid then API returns false.
virtual bool closeConnection(const std::string &connectionUuid) = 0;
Member | Datatype | Definition |
---|---|---|
connectionUuid | const std::string & | Connection unique universal identifier. |
Retrieve active connection list. connections - Connection list represented as a vector of com::anyconnect::connect::ConnectionDescription
virtual uint32_t getActiveConnectionList(std::vector<ConnectionDescription> &connections) = 0;
Return Value: uint32_t number of active connections.
Starts the connect Library and keeps running. Must be invoked after creating the connect object through builder to be able to use any Connect object.
virtual void start(startNotifier callback) = 0;
Member | Datatype | Definition |
---|---|---|
callback | startNotifier | com::anyconnect::connect::startNotifier function invoked when Connect has configured and running. |
stop releases all the resources allocated to Connect object. Invoking start following a stop will not resume the Connect. Connect needs to be rebuild and start again.
virtual void stop(stopHandler callback) = 0;
Member | Datatype | Definition |
---|---|---|
callback | stopHandler | com::anyconnect::connect::stopHandler function invoked when Connect has fully stopped. No callbacks will be invoked after stopHandler is called. |
virtual com::anyconnect::access::Access::Ptr getAccess() const = 0;
Return Value: Access object.
Typedefs Documentation
Following is the detailed documentation of the typedefs declared under the Connect class.
// Definition of a shared pointer to Connect
typedef std::shared_ptr<Connect> Ptr;
ConnectBuilder
ConnectBuilder builds a Connect object. It will return to
the caller an object which implements the Connect interface.
Private Attributes
<li><a href = "#ConnectBuilder@access">access</a></li>
<li><a href = "#ConnectBuilder@maxNetworkWaitTime">maxNetworkWaitTime</a></li>
Private Methods
<li><a href = "#ConnectBuilder@ConnectBuilder">ConnectBuilder</a></li>
Public Methods
<li><a href = "#ConnectBuilder@ConnectBuilder">ConnectBuilder</a></li>
<li><a href = "#ConnectBuilder@setAccess">setAccess</a></li>
<li><a href = "#ConnectBuilder@getAccess">getAccess</a></li>
<li><a href = "#ConnectBuilder@setMaxNetworkChangeTime">setMaxNetworkChangeTime</a></li>
<li><a href = "#ConnectBuilder@getMaxNetworkChangeTime">getMaxNetworkChangeTime</a></li>
<li><a href = "#ConnectBuilder@build">build</a></li>
Private Member Data Documentation
Following is the detailed documentation of the private variables declared under the ConnectBuilder class.
com::anyconnect::access::Access::Ptr access;
// Default value is 15 seconds (15,000 milliseconds) for reconnection waiting time due to network change.
// To override this value use setMaxNetworkChangeTime.
// To disable, configure as 0, meaning that loss of network results in immediate close of connection.
std::uint32_t maxNetworkWaitTime;
Private Member Function Documentation
Following is the detailed documentation of the private methods declared under the ConnectBuilder class.
ConnectBuilder(const ConnectBuilder &rhs) = delete;
Public Member Function Documentation
Following is the detailed documentation of the public methods declared under the ConnectBuilder class.
ConnectBuilder();
Set Access object. Mandatory value to be configured to build a Connect object. Invalid Access object will result as failure to build Connect.
void setAccess(com::anyconnect::access::Access::Ptr access) { this->access = access; }
Member | Datatype | Definition |
---|---|---|
access | com::anyconnect::access::Access::Ptr | AnyConnect Access object. |
com::anyconnect::access::Access::Ptr getAccess() const { return access; }
Return Value: Access object.
Set the time that Connect will keep a connection open without an underlying path to get to the endpoint. (For example, if this value is greater than the time it takes to move from WiFi to Cellular, then the connection will not close.) The default value is 15,000ms.
void setMaxNetworkChangeTime(uint32_t msTime) {maxNetworkWaitTime = msTime;}
Member | Datatype | Definition |
---|---|---|
msTime | uint32_t | Time to wait for a new network path in milliseconds. |
Get the max time that Connect will keep a connection open without an underlying path to reach the endpoint.
uint32_t getMaxNetworkChangeTime() const {return maxNetworkWaitTime;}
Return Value: uint32_t - Time to wait in milliseconds.
build() will return to the caller a Connect object that contains the set properties. There are required properties that must be set and this method will throw an exception if required properties are not set.
Connect::Ptr build();
Return Value: a shared pointer to a Connect object.
Enum Class Documentation
Following is the description of the enum classes.
// \brief Connection transition state.
// Indicates stopped/restarted/restart-failed/retrying state of a connected session.
// STOPPED: Indicates a running session has been stopped, starts the timer internally to attempt recovery
// RECOVERING: Indicates started recovering.
// RESTARTED: restarted the stopped session
// RESTART_FAILED: Failed to restart, either due to timeout or failed for some other region
// RETRYING: Indicates an attempted session is failed and retrying to connect.
enum ConnectionTransitionState{
STOPPED = 0,
RECOVERING,
RESTARTED,
RESTART_FAILED,
RETRYING
};
// On Demand Media Relay Type
// These are the types to indicate what the purpose of the data streaming to Media Service.
enum MediaRelayType{
RECORDING,
HLSSTREAMING
};
Global Typedefs Documentation
Following is the detailed documentation of the Typedefs which do not belong to any structur class
typedef std::function<void(const ConnectionDescription &connectionDescription)> ConnectionDescriptionHandler;
Handler function for connection description.
typedef std::function<void(const bool &state, const ConnectionDescription &connectionDescription)> MediaRelayStateChangeHandler;
Handler function for MediaRelay state change.
typedef std::function<void(const com::anyconnect::access::Endpoint &endpointId, const bool signal, const MediaRelayType mediaRelayType)> OnDemandMediaRelaySignalHandler;
Handler function for On-Demand MediaRelay Signal. Indicates to enable or disable.
typedef std::function<void(const ConnectionTransitionDescription &connectionTransitionDescription)> ConnectionTransitionDescriptionHandler;
Handler function for connection transition.
typedef std::function<bool(const ConnectionDescription &connectionDescription)> bConnectionDescriptionHandler;
Handler function for boolean connection description.
typedef std::function<void(const std::string &connectionUuid)> ConnectionUuidHandler;
Handler function for Connection UUID.
typedef std::function<void(char* data, uint32_t length)> DataReceivedHandler;
Handler function for received data.
typedef std::function<void()> stopHandler;
Handler function for stopping Connect API session.
typedef std::function<void()> startNotifier;
Handler function to notify start of CONNECT.
Updated over 2 years ago