Open Lighting Architecture
0.9.5
|
Keeps track of OLA's devices.
Devices can be identified in one of two ways, by device-id or by alias. device-ids are strings and are persistent across restarting olad and reload the plugins. device-ids are the keys used in preference containers to identify devices.
Device aliases are unsigned integers and are only valid for the lifetime of the DeviceManager object. Device aliases are used by users when patching / controlling a device. since '1' is easier to understand / type than 5-02050016. If a device is registered, then unregistered, then registered again, it'll have the same device alias.
Public Member Functions | |
DeviceManager (PreferencesFactory *prefs_factory, class PortManager *port_manager) | |
Create a new DeviceManager. | |
~DeviceManager () | |
Destructor. | |
bool | RegisterDevice (AbstractDevice *device) |
Register a device. | |
bool | UnregisterDevice (const std::string &device_id) |
Unregister a device by id. | |
bool | UnregisterDevice (const AbstractDevice *device) |
Unregister a device by pointer. | |
unsigned int | DeviceCount () const |
Return the number of devices. | |
std::vector< device_alias_pair > | Devices () const |
Return a list of all devices and their aliases. | |
AbstractDevice * | GetDevice (unsigned int alias) const |
Lookup a device using the device alias. | |
device_alias_pair | GetDevice (const std::string &unique_id) const |
Lookup a device using the device id. | |
void | UnregisterAllDevices () |
Remove all devices. | |
void | SendTimeCode (const ola::timecode::TimeCode &timecode) |
Send timecode to all ports which support timecode. |
Static Public Attributes | |
static const unsigned int | MISSING_DEVICE_ALIAS = 0 |
ola::DeviceManager::DeviceManager | ( | PreferencesFactory * | prefs_factory, |
class PortManager * | port_manager | ||
) |
Create a new DeviceManager.
prefs_factory | the PreferencesFactory to use, ownership is not transferred. |
port_manager | the PortManager to use, ownership is not transferred. |
unsigned int ola::DeviceManager::DeviceCount | ( | ) | const |
Return the number of devices.
vector< device_alias_pair > ola::DeviceManager::Devices | ( | ) | const |
Return a list of all devices and their aliases.
AbstractDevice * ola::DeviceManager::GetDevice | ( | unsigned int | alias | ) | const |
Lookup a device using the device alias.
device_alias_pair ola::DeviceManager::GetDevice | ( | const std::string & | unique_id | ) | const |
Lookup a device using the device id.
unique_id | the device id of the device. |
bool ola::DeviceManager::RegisterDevice | ( | AbstractDevice * | device | ) |
Register a device.
device | The device to register, ownership is not transferred. |
During registration, any saved port patchings for this device are restored.
void ola::DeviceManager::SendTimeCode | ( | const ola::timecode::TimeCode & | timecode | ) |
Send timecode to all ports which support timecode.
timecode | the TimeCode information. |
bool ola::DeviceManager::UnregisterDevice | ( | const std::string & | device_id | ) |
Unregister a device by id.
device_id | the id of the device to remove |
bool ola::DeviceManager::UnregisterDevice | ( | const AbstractDevice * | device | ) |
Unregister a device by pointer.
device | a pointer to the device. |