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.

enable

bool enable;

lossless

bool lossless;

componentId

std::vector<std::string> componentId;

Public Member Function Documentation

Following is the detailed documentation of the public methods declared under the MediaElementType class.

MediaElementType

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.

audio

MediaElementType audio;

video

MediaElementType video;

data

MediaElementType data;

control

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.

initiator

bool initiator;

connectionType

std::string connectionType;

natType

std::string natType;

endpointUuid

    // endpointUuid is the remote Endpoint identifier
    com::anyconnect::access::Endpoint endpointUuid;

connectionUuid

// connectionUuid is the unique connection identifier for each connection,
std::string connectionUuid;

sessionDescription

    // 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

    // state indicates current state of connection (ConnectionTransitionState).
    ConnectionTransitionState state;

connectionUuid

    // 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

// 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.

~Connect

virtual ~Connect(){}

offerConnection

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;
MemberDatatypeDefinition
endpointUuidconst com::anyconnect::access::Endpoint &Remote endpoint to connect to
sessionDescriptionconst SessionDescription &Session details and function pointer to get Connection description.
callbackConnectionDescriptionHandlerCallback handler function for connection description. ConnectionDescriptionHandler will provide the detail properties of the offered connection.

Return Value: bool, true on success.

signalOnDemandMediaRelayState

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;
MemberDatatypeDefinition
endpointUuidconst com::anyconnect::access::Endpoint &Remote endpoint ID to start the On-Demand MediaRelay

Return Value: bool, true on success.

onMediaRelayStateChange

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;

onOnDemandMediaRelaySignal

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;

setMediaRelayState

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;
MemberDatatypeDefinition
sessionIdstd::stringID of the MediaRelay session. ID would be choosen by the API caller.
mediaRelayTypeconst MediaRelayTypeMedia Relay type
stateconst boolindicates if it needs to start MediaRelay or stop it.

Return Value: bool, true on success.

onConnectionEstablished

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;
MemberDatatypeDefinition
callbackConnectionDescriptionHandlerCallback handler function for connection description. ConnectionDescriptionHandler will provide the detail properties of the established connection.

onConnectionOffered

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;
MemberDatatypeDefinition
callbackbConnectionDescriptionHandlerCallback handler function for connection description.

onConnectionClosed

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;
MemberDatatypeDefinition
callbackConnectionUuidHandlerCallback handler for the Connection UUID. ConnectionUuidHandler will have the corresponding connection uuid.

onConnectionChange

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;
MemberDatatypeDefinition
callbackConnectionTransitionDescriptionHandlerCallback handler function for connection description. ConnectionTransitionDescriptionHandler will provide the detail properties of the corresponding connection.

send

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;
MemberDatatypeDefinition
connectionUuidconst std::string &Connection unique universal identifier.
componentIdconst std::string &Component identifier. Use intended MediaElement component type from MediaElementType
dataconst char*Data payload.
lengthuint32_tPayload length.

Return Value: int32_t number of bytes sent, the size of successfully sent data. -1 indicates failure.

onDataReceived

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;
MemberDatatypeDefinition
connectionUuidconst std::string &Connection unique universal identifier.
componentIdconst std::string &Component identifier.
callbackDataReceivedHandlerCallback function handler for received data. DataReceivedHandler will have the received data and corresponding length.

closeConnection

Close an existing connection. If the provided connectionuuid is invalid then API returns false.

virtual bool closeConnection(const std::string &connectionUuid) = 0;
MemberDatatypeDefinition
connectionUuidconst std::string &Connection unique universal identifier.

getActiveConnectionList

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.

start

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;
MemberDatatypeDefinition
callbackstartNotifiercom::anyconnect::connect::startNotifier function invoked when Connect has configured and running.

stop

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;
MemberDatatypeDefinition
callbackstopHandlercom::anyconnect::connect::stopHandler function invoked when Connect has fully stopped. No callbacks will be invoked after stopHandler is called.

getAccess

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.

Ptr

// 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.

access

com::anyconnect::access::Access::Ptr access;

maxNetworkWaitTime

// 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

ConnectBuilder(const ConnectBuilder &rhs) = delete;

Public Member Function Documentation

Following is the detailed documentation of the public methods declared under the ConnectBuilder class.

ConnectBuilder

ConnectBuilder();

setAccess

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; }
MemberDatatypeDefinition
accesscom::anyconnect::access::Access::PtrAnyConnect Access object.

getAccess

com::anyconnect::access::Access::Ptr getAccess() const { return access; }

Return Value: Access object.

setMaxNetworkChangeTime

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;}
MemberDatatypeDefinition
msTimeuint32_tTime to wait for a new network path in milliseconds.

getMaxNetworkChangeTime

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

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.

ConnectionTransitionState

// \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
};

MediaRelayType

// 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

ConnectionDescriptionHandler

typedef std::function<void(const ConnectionDescription &connectionDescription)> ConnectionDescriptionHandler;

Handler function for connection description.

MediaRelayStateChangeHandler

typedef std::function<void(const bool &state, const ConnectionDescription &connectionDescription)> MediaRelayStateChangeHandler;

Handler function for MediaRelay state change.

OnDemandMediaRelaySignalHandler

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.

ConnectionTransitionDescriptionHandler

typedef std::function<void(const ConnectionTransitionDescription &connectionTransitionDescription)> ConnectionTransitionDescriptionHandler;

Handler function for connection transition.

bConnectionDescriptionHandler

typedef std::function<bool(const ConnectionDescription &connectionDescription)> bConnectionDescriptionHandler;

Handler function for boolean connection description.

ConnectionUuidHandler

typedef std::function<void(const std::string &connectionUuid)> ConnectionUuidHandler;

Handler function for Connection UUID.

DataReceivedHandler

typedef std::function<void(char* data, uint32_t length)> DataReceivedHandler;

Handler function for received data.

stopHandler

typedef std::function<void()> stopHandler;

Handler function for stopping Connect API session.

startNotifier

typedef std::function<void()> startNotifier;

Handler function to notify start of CONNECT.