TSDuck Version 3.20-1669 (TSDuck - The MPEG Transport Stream Toolkit)
ts::EMMGClient Class Reference

A DVB-EMMG client which connects to any MUX to inject data. More...

Inheritance diagram for ts::EMMGClient:
Collaboration diagram for ts::EMMGClient:

Public Member Functions

 EMMGClient ()
 Constructor.
 
 ~EMMGClient ()
 Destructor.
 
uint16_t allocatedBandwidth ()
 Get the last allocated bandwidth as returned by the MUX. More...
 
bool connect (const SocketAddress &mux, const SocketAddress &udp, uint32_t client_id, uint16_t data_channel_id, uint16_t data_stream_id, uint16_t data_id, uint8_t data_type, bool section_format, emmgmux::ChannelStatus &channel_status, emmgmux::StreamStatus &stream_status, const AbortInterface *abort, const tlv::Logger &logger)
 Connect to a remote MUX. More...
 
bool dataProvision (const ByteBlockPtr &data)
 Send data provision. More...
 
bool dataProvision (const std::vector< ByteBlockPtr > &data)
 Send data provision. More...
 
bool dataProvision (const void *data, size_t size)
 Send data provision. More...
 
bool dataProvision (const SectionPtrVector &sections)
 Send data provision in section format. More...
 
bool disconnect ()
 Disconnect from remote MUX. More...
 
void getLastErrorResponse (std::vector< uint16_t > &error_status, std::vector< uint16_t > &error_information)
 Get the last error response. More...
 
bool isConnected () const
 Check if the EMMG is connected. More...
 
bool requestBandwidth (uint16_t bandwidth, bool synchronous=false)
 Send a bandwidth request. More...
 
void resetTotalBytes ()
 Reset the total number of data bytes which were sent so far.
 
uint64_t totalBytes () const
 Get the total number of data bytes which were sent so far. More...
 

Private Member Functions

void getAttributes (ThreadAttributes &attributes)
 Get a copy of the attributes of the thread. More...
 
UString getTypeName () const
 Get an implementation-specific name of the object class. More...
 
bool isCurrentThread () const
 Check if the caller is running in the context of this thread. More...
 
bool setAttributes (const ThreadAttributes &attributes)
 Set new attributes to the thread. More...
 
void setTypeName (const UString &name=UString())
 Set the type name. More...
 
bool start ()
 Start the thread. More...
 
bool waitForTermination ()
 Wait for thread termination. More...
 

Static Private Member Functions

static void Yield ()
 Yield execution of the current thread. More...
 

Detailed Description

A DVB-EMMG client which connects to any MUX to inject data.

Restriction: Only the TCP version of the EMMG/PDG <=> MUX protocol is supported here. The UDP version is currently unsupported.

See also
DVB standard ETSI TS 103.197 V1.4.1 for EMMG/PDG <=> MUX protocol.

Member Function Documentation

◆ connect()

bool ts::EMMGClient::connect ( const SocketAddress mux,
const SocketAddress udp,
uint32_t  client_id,
uint16_t  data_channel_id,
uint16_t  data_stream_id,
uint16_t  data_id,
uint8_t  data_type,
bool  section_format,
emmgmux::ChannelStatus channel_status,
emmgmux::StreamStatus stream_status,
const AbortInterface abort,
const tlv::Logger logger 
)

Connect to a remote MUX.

Perform all initial channel and stream negotiation.

Parameters
[in]muxIP address and TCP port of the MUX.
[in]udpIf port is specified, then send data_rovision messages using UDP instead of TCP. If the IP address is not specified, use the same one as mux.
[in]client_idClient id, see EMMG/PDG <=> MUX protocol.
[in]data_channel_idData_channel_id, see EMMG/PDG <=> MUX protocol.
[in]data_stream_idData_stream_id, see EMMG/PDG <=> MUX protocol.
[in]data_idData_id, see EMMG/PDG <=> MUX protocol.
[in]data_typeData_type, see EMMG/PDG <=> MUX protocol.
[in]section_formatIf true, send data in section format. If false, send data in TS packet format.
[out]channel_statusInitial response to channel_setup
[out]stream_statusInitial response to stream_setup
[in]abortAn interface to check if the application is interrupted.
[in]loggerWhere to report errors and messages.
Returns
True on success, false on error.

◆ requestBandwidth()

bool ts::EMMGClient::requestBandwidth ( uint16_t  bandwidth,
bool  synchronous = false 
)

Send a bandwidth request.

Parameters
[in]bandwidthRequested bandwidth in kbits/second.
[in]synchronousIf true, wait for the MUX to return either an error or a bandwidth allocation.
Returns
True on success, false on error.

◆ allocatedBandwidth()

uint16_t ts::EMMGClient::allocatedBandwidth ( )

Get the last allocated bandwidth as returned by the MUX.

Returns
The last allocated bandwidth in kbits/second or zero if there was none.

◆ getLastErrorResponse()

void ts::EMMGClient::getLastErrorResponse ( std::vector< uint16_t > &  error_status,
std::vector< uint16_t > &  error_information 
)

Get the last error response.

Parameters
[out]error_statusError code.
[out]error_informationError information.

◆ dataProvision() [1/4]

bool ts::EMMGClient::dataProvision ( const ByteBlockPtr data)

Send data provision.

Parameters
[in]dataData to send.
Returns
True on success, false on error.

◆ dataProvision() [2/4]

bool ts::EMMGClient::dataProvision ( const std::vector< ByteBlockPtr > &  data)

Send data provision.

Parameters
[in]dataData to send in several chunks.
Returns
True on success, false on error.

◆ dataProvision() [3/4]

bool ts::EMMGClient::dataProvision ( const void *  data,
size_t  size 
)

Send data provision.

Parameters
[in]dataAddress of data to send.
[in]sizeSize in bytes of data to send.
Returns
True on success, false on error.

◆ dataProvision() [4/4]

bool ts::EMMGClient::dataProvision ( const SectionPtrVector sections)

Send data provision in section format.

Parameters
[in]sectionsSections to send. If section_format was false during connect(), the sections are packetized first.
Returns
True on success, false on error.

◆ disconnect()

bool ts::EMMGClient::disconnect ( )

Disconnect from remote MUX.

Close stream and channel.

Returns
True on success, false on error.

◆ isConnected()

bool ts::EMMGClient::isConnected ( ) const
inline

Check if the EMMG is connected.

Returns
True if the EMMG is connected.

◆ totalBytes()

uint64_t ts::EMMGClient::totalBytes ( ) const
inline

Get the total number of data bytes which were sent so far.

Returns
The total number of data bytes which were sent so far.

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