OpenTera WebRTC API (C++) 1.2.5
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
opentera::WebrtcClient Class Referenceabstract

Represents the base class of DataChannelClient and StreamClient. More...

#include <WebrtcClient.h>

Inheritance diagram for opentera::WebrtcClient:
opentera::DataChannelClient opentera::StreamClient

Public Member Functions

 WebrtcClient (SignalingServerConfiguration &&signalingServerConfiguration, WebrtcConfiguration &&webrtcConfiguration, VideoStreamConfiguration &&videoStreamConfiguration)
 
 DECLARE_NOT_COPYABLE (WebrtcClient)
 
 DECLARE_NOT_MOVABLE (WebrtcClient)
 
void setTlsVerificationEnabled (bool isEnabled)
 
void connect ()
 Connects the client the signaling server.
 
void close ()
 Closes all client connections (asynchronous).
 
void closeSync ()
 Closes all client connections (synchronous).
 
void callAll ()
 Calls all room clients.
 
void callIds (const std::vector< std::string > &ids)
 Calls the specified clients. More...
 
void hangUpAll ()
 Hangs up all clients.
 
void closeAllRoomPeerConnections ()
 Closes all room peer connections.
 
bool isConnected ()
 Indicates if the client is connected to the signaling server. More...
 
bool isRtcConnected ()
 Indicates if the client is connected to at least one client (RTCPeerConnection). More...
 
std::string id ()
 Returns the client id. More...
 
std::vector< std::string > getConnectedRoomClientIds ()
 Returns the connected room client ids. More...
 
RoomClient getRoomClient (const std::string &id)
 Returns the room client that matches with the specified id. If no room client matches with the id, a default room client is returned. More...
 
std::vector< RoomClientgetRoomClients ()
 Returns the room clients. More...
 
void setOnSignalingConnectionOpened (const std::function< void()> &callback)
 Sets the callback that is called when the signaling connection opens. More...
 
void setOnSignalingConnectionClosed (const std::function< void()> &callback)
 Sets the callback that is called when the signaling connection closes. More...
 
void setOnSignalingConnectionError (const std::function< void(const std::string &)> &callback)
 Sets the callback that is called when a signaling connection error occurs. More...
 
void setOnRoomClientsChanged (const std::function< void(const std::vector< RoomClient > &)> &callback)
 Sets the callback that is called when the room client changes. More...
 
void setCallAcceptor (const std::function< bool(const Client &)> &callback)
 Sets the callback that is used to accept or reject a call. More...
 
void setOnCallRejected (const std::function< void(const Client &)> &callback)
 Sets the callback that is called when a call is rejected. More...
 
void setOnClientConnected (const std::function< void(const Client &)> &callback)
 Sets the callback that is called when a client peer connection opens. More...
 
void setOnClientDisconnected (const std::function< void(const Client &)> &callback)
 Sets the callback that is called when a client peer connection closes. More...
 
void setOnClientConnectionFailed (const std::function< void(const Client &)> &callback)
 Sets the callback that is called when a client peer connection fails. More...
 
void setOnError (const std::function< void(const std::string &error)> &callback)
 Sets the callback that is called when an error occurs. More...
 
void setLogger (const std::function< void(const std::string &message)> &callback)
 Sets the callback that is used to log information. More...
 

Protected Member Functions

template<class T , class... Types>
void invokeIfCallable (const std::function< T > &f, Types... args)
 
void log (const std::string &message)
 
virtual std::unique_ptr< PeerConnectionHandlercreatePeerConnectionHandler (const std::string &id, const Client &peerClient, bool isCaller)=0
 
std::function< void(const std::string &)> getOnErrorFunction ()
 
std::function< void(const Client &)> getOnClientConnectedFunction ()
 
std::function< void(const Client &)> getOnClientDisconnectedFunction ()
 
std::function< void(const Client &)> getOnClientConnectionFailedFunction ()
 
rtc::Thread * getInternalClientThread ()
 

Protected Attributes

std::unique_ptr< SignalingClientm_signalingClient
 
rtc::scoped_refptr< webrtc::PeerConnectionFactoryInterface > m_peerConnectionFactory
 
std::map< std::string, std::unique_ptr< PeerConnectionHandler > > m_peerConnectionHandlersById
 
rtc::scoped_refptr< OpenteraAudioDeviceModulem_audioDeviceModule
 
rtc::scoped_refptr< webrtc::AudioProcessing > m_audioProcessing
 

Detailed Description

Represents the base class of DataChannelClient and StreamClient.

Member Function Documentation

◆ callIds()

void WebrtcClient::callIds ( const std::vector< std::string > &  ids)

Calls the specified clients.

Parameters
idsThe client ids to call

◆ getConnectedRoomClientIds()

vector< string > WebrtcClient::getConnectedRoomClientIds ( )

Returns the connected room client ids.

Returns
The connected room client ids

◆ getRoomClient()

RoomClient opentera::WebrtcClient::getRoomClient ( const std::string &  id)
inline

Returns the room client that matches with the specified id. If no room client matches with the id, a default room client is returned.

Parameters
idThe room client id
Returns
The room client that matches with the specified id

◆ getRoomClients()

vector< RoomClient > WebrtcClient::getRoomClients ( )

Returns the room clients.

Returns
The room clients

◆ id()

std::string opentera::WebrtcClient::id ( )
inline

Returns the client id.

Returns
The client id

◆ isConnected()

bool opentera::WebrtcClient::isConnected ( )
inline

Indicates if the client is connected to the signaling server.

Returns
true if the client is connected to the signaling server

◆ isRtcConnected()

bool opentera::WebrtcClient::isRtcConnected ( )
inline

Indicates if the client is connected to at least one client (RTCPeerConnection).

Returns
true if the client is connected to at least one client (RTCPeerConnection)

◆ setCallAcceptor()

void opentera::WebrtcClient::setCallAcceptor ( const std::function< bool(const Client &)> &  callback)
inline

Sets the callback that is used to accept or reject a call.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:

  • client: The client the call is from

Callback return value:

  • true to accept the call, false to reject the call
Parameters
callbackThe callback

◆ setLogger()

void opentera::WebrtcClient::setLogger ( const std::function< void(const std::string &message)> &  callback)
inline

Sets the callback that is used to log information.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:
  • message: The message
Parameters
callbackThe callback

◆ setOnCallRejected()

void opentera::WebrtcClient::setOnCallRejected ( const std::function< void(const Client &)> &  callback)
inline

Sets the callback that is called when a call is rejected.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:
  • client: The client that rejects the call
Parameters
callbackThe callback

◆ setOnClientConnected()

void opentera::WebrtcClient::setOnClientConnected ( const std::function< void(const Client &)> &  callback)
inline

Sets the callback that is called when a client peer connection opens.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:
  • client: The client that is connected
Parameters
callbackThe callback

◆ setOnClientConnectionFailed()

void opentera::WebrtcClient::setOnClientConnectionFailed ( const std::function< void(const Client &)> &  callback)
inline

Sets the callback that is called when a client peer connection fails.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:
  • client: The client that has a connection failure
Parameters
callbackThe callback

◆ setOnClientDisconnected()

void opentera::WebrtcClient::setOnClientDisconnected ( const std::function< void(const Client &)> &  callback)
inline

Sets the callback that is called when a client peer connection closes.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:
  • client: The client that is disconnected
Parameters
callbackThe callback

◆ setOnError()

void opentera::WebrtcClient::setOnError ( const std::function< void(const std::string &error)> &  callback)
inline

Sets the callback that is called when an error occurs.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:
  • error: The error message
Parameters
callbackThe callback

◆ setOnRoomClientsChanged()

void opentera::WebrtcClient::setOnRoomClientsChanged ( const std::function< void(const std::vector< RoomClient > &)> &  callback)
inline

Sets the callback that is called when the room client changes.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:
  • roomClients: The room clients
Parameters
callbackThe callback

◆ setOnSignalingConnectionClosed()

void opentera::WebrtcClient::setOnSignalingConnectionClosed ( const std::function< void()> &  callback)
inline

Sets the callback that is called when the signaling connection closes.

The callback is called from the internal client thread. The callback should not block.

Parameters
callbackThe callback

◆ setOnSignalingConnectionError()

void opentera::WebrtcClient::setOnSignalingConnectionError ( const std::function< void(const std::string &)> &  callback)
inline

Sets the callback that is called when a signaling connection error occurs.

The callback is called from the internal client thread. The callback should not block.

Callback parameters:
  • error: The error message
Parameters
callbackThe callback

◆ setOnSignalingConnectionOpened()

void opentera::WebrtcClient::setOnSignalingConnectionOpened ( const std::function< void()> &  callback)
inline

Sets the callback that is called when the signaling connection opens.

The callback is called from the internal client thread. The callback should not block.

Parameters
callbackThe callback

◆ setTlsVerificationEnabled()

void WebrtcClient::setTlsVerificationEnabled ( bool  isEnabled)

Enable or disable the TLS verification. By default, the TLS verification is enabled.

Parameters
isEnabled

The documentation for this class was generated from the following files: