Robot Raconteur Core C++ Library
Public Member Functions | List of all members
RobotRaconteur::BroadcastDownsampler Class Reference

Downsampler to manage rate of packets sent to client. More...

Inherits boost::enable_shared_from_this< BroadcastDownsampler >.

Public Member Functions

 BroadcastDownsampler ()
 Construct a new BroadcastDownsampler. More...
 
void Init (const boost::shared_ptr< ServerContext > &context, uint32_t default_downsample=0)
 Initialize the BroadcastDownsampler. More...
 
uint32_t GetClientDownsample (uint32_t ep)
 Get the downsample for the specified client. More...
 
void SetClientDownsample (uint32_t ep, uint32_t downsample)
 Set the downsample for the specified client. More...
 
void BeginStep ()
 Begin the update loop step. More...
 
void EndStep ()
 End the update loop step. More...
 
void AddPipeBroadcaster (const boost::shared_ptr< PipeBroadcasterBase > &broadcaster)
 Add a PipeBroadcaster to the downsampler. More...
 
void AddWireBroadcaster (const boost::shared_ptr< WireBroadcasterBase > &broadcaster)
 Add a WireBroadcaster to the downsampler. More...
 

Detailed Description

Downsampler to manage rate of packets sent to client.

PipeBroadcaster and WireBroadcaster by default sends packets to all clients when a pipe packet is sent or the wire value is changed. The updates typically happen within a sensor or control loop, with the rate set by the specific device producing the updates. Some clients may require less frequent data, and may run in to bandwidth or processing issues if the data is sent at the full update rate. The BroadcastDownsampler is used to implement broadcaster predicates that will drop packets. Clients specify how many packets they want dropped between each packet sent. For instance, a downsample of 0 means that no packets are dropped. A downsample of 1 will drop every other packet. A downsample of two will drop 2 packets between sending 1 packet, etc. The downsample level for each client is set using SetClientDownsample(). This should be made available to the client using a property member.

PipeBroadcaster and WireBroadcaster must be added to the downsampler using AddPipeBroadcaster() and AddWireBroadcaster(), respectively. It is recommended that these functions be called within an IRRServiceObject::RRServiceObjectInit() override.

BeginStep() and EndStep() must be called for each iteration of the broadcasting loop. Use BroadcastDownsamplerStep for automatic management in the loop.

See com.robotraconteur.isoch.IsochDevice for the standard use of downsampling.

Constructor & Destructor Documentation

◆ BroadcastDownsampler()

RobotRaconteur::BroadcastDownsampler::BroadcastDownsampler ( )

Construct a new BroadcastDownsampler.

Must use boost::make_shared<BroadcastDownsampler>()

Must call Init() after construction.

Member Function Documentation

◆ AddPipeBroadcaster()

void RobotRaconteur::BroadcastDownsampler::AddPipeBroadcaster ( const boost::shared_ptr< PipeBroadcasterBase > &  broadcaster)

Add a PipeBroadcaster to the downsampler.

Sets the predicate of the broadcaster to this downsampler

Parameters
broadcasterThe broadcaster to add

◆ AddWireBroadcaster()

void RobotRaconteur::BroadcastDownsampler::AddWireBroadcaster ( const boost::shared_ptr< WireBroadcasterBase > &  broadcaster)

Add a WireBroadcaster to the downsampler.

Sets the predicate of the broadcaster to this downsampler

Parameters
broadcasterThe broadcaster to add

◆ BeginStep()

void RobotRaconteur::BroadcastDownsampler::BeginStep ( )

Begin the update loop step.

Use BroadcastDownsamplerStep for automatic stepping

◆ EndStep()

void RobotRaconteur::BroadcastDownsampler::EndStep ( )

End the update loop step.

Use BroadcastDownsamplerStep for automatic stepping

◆ GetClientDownsample()

uint32_t RobotRaconteur::BroadcastDownsampler::GetClientDownsample ( uint32_t  ep)

Get the downsample for the specified client.

Parameters
epThe uint32_t endpoint ID of the client
Returns
uint32_t The downsample

◆ Init()

void RobotRaconteur::BroadcastDownsampler::Init ( const boost::shared_ptr< ServerContext > &  context,
uint32_t  default_downsample = 0 
)

Initialize the BroadcastDownsampler.

Parameters
contextThe ServerContext of the service
default_downsampleThe default downsample for clients

◆ SetClientDownsample()

void RobotRaconteur::BroadcastDownsampler::SetClientDownsample ( uint32_t  ep,
uint32_t  downsample 
)

Set the downsample for the specified client.

Parameters
epThe uint32_t endpoint ID of the client
downsampleThe desired downsample

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