To create an LLRP manager instance, use the llrp_manager_create() function in C, or instantiate an rdmnet::LlrpManager and call its Startup() function in C++.
The LLRP manager API is an asynchronous, callback-oriented API. Part of the initial configuration for an LLRP manager instance is a set of function pointers (or abstract interface) for the library to use as callbacks. Callbacks are dispatched from the background thread that is started when the RDMnet library is initialized.
LLRP managers operate on a single network interface at a time. Network interfaces are tracked by OS-specific index (see the EtcPal doc page on Network Interface Indexes).
// At this point, the manager is no longer running and its handle is no longer valid. It can be
// started again (with a new handle) by calling Startup() again.
Discovering Targets
Start the LLRP discovery process using the functions in the snippet examples below. LLRP discovery continues in the background and typically takes a few seconds, but could take up to a minute or two in systems with large numbers of LLRP targets present.
LLRP has a filter bitfield with some options that can be used to limit the types of LLRP targets that respond to discovery.
// Or, to limit discovery to targets that are not currently connected to a broker via RDMnet...
etcpal::Error result = manager.StartDiscovery(LLRP_FILTERVAL_CLIENT_CONN_INACTIVE);
// Or, to limit discovery to RDMnet brokers...
etcpal::Error result = manager.StartDiscovery(LLRP_FILTERVAL_BROKERS_ONLY);
if (result)
{
// Discovery is now ongoing and the associated callbacks will indicate when targets are discovered
// and when discovery is finished.
}
During discovery, callbacks will indicate when new LLRP targets are discovered and when discovery has finished. LLRP discovery finishes automatically after a timeout, but you can also call the relevant API function at any time to stop discovery early.
Once one or more LLRP targets have been discovered, an LLRP manager can send RDM commands addressed to them. LLRP targets must be tracked and addressed by a combination of RDM UID and CID; see Roles and Addressing and Low-Level Recovery Protocol (LLRP) for more information on this. The DiscoveredTarget structure contains both of these addressing identifiers for each discovered target, and the DestinationAddr structure takes them to form an LLRP destination address.
After sending a command, the library will provide a sequence number that will be echoed in the corresponding RDM response. This sequence number should be saved.
// Assuming we have an LlrpDiscoveredTarget structure named 'target'...
Responses to commands you send will be delivered asynchronously through the "RDM response" callback.
Note that response callbacks reference data buffers owned by the library, which will be invalid when the callback returns. See Data Ownership Paradigms in the RDMnet Library for more information.