Open Lighting Architecture
Latest Git
|
Handles async client operations.
Since some client operations such as RDM commands are asynchronous, we can run into problems if the client disconnects while the operation is in progress. This is because the completion callback will hold a pointer to a client which has been deleted.
The ClientBroker acts as an in-between by holding a list of active clients and proxying RDM calls. When the RDM call returns, if the client responsible for the call has been deleted, we delete the callback rather then executing it.
Public Member Functions | |
void | AddClient (const Client *client) |
Add a client to the broker. More... | |
void | RemoveClient (const Client *client) |
Remove a client from the broker. More... | |
void | SendRDMRequest (const Client *client, Universe *universe, ola::rdm::RDMRequest *request, ola::rdm::RDMCallback *callback) |
Make an RDM call. More... | |
void | RunRDMDiscovery (const Client *client, Universe *universe, bool full_discovery, ola::rdm::RDMDiscoveryCallback *callback) |
Make an RDM call. More... | |
void ola::ClientBroker::AddClient | ( | const Client * | client | ) |
Add a client to the broker.
client | the Client to add. Ownership is not transferred. |
void ola::ClientBroker::RemoveClient | ( | const Client * | client | ) |
Remove a client from the broker.
client | The Client to remove. |
void ola::ClientBroker::RunRDMDiscovery | ( | const Client * | client, |
Universe * | universe, | ||
bool | full_discovery, | ||
ola::rdm::RDMDiscoveryCallback * | callback | ||
) |
Make an RDM call.
client | the Client responsible for making the call. |
universe | the universe to send the RDM request on. |
full_discovery | true for full discovery, false for incremental. |
callback | the callback to run when the request completes. Ownership is transferred. |
void ola::ClientBroker::SendRDMRequest | ( | const Client * | client, |
Universe * | universe, | ||
ola::rdm::RDMRequest * | request, | ||
ola::rdm::RDMCallback * | callback | ||
) |
Make an RDM call.
client | the Client responsible for making the call. |
universe | the universe to send the RDM request on. |
request | the RDM request. |
callback | the callback to run when the request completes. Ownership is transferred. |