Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | List of all members
ola::plugin::usbdmx::BaseWidgetFactory< WidgetType > Class Template Reference

Detailed Description

template<typename WidgetType>
class ola::plugin::usbdmx::BaseWidgetFactory< WidgetType >

A partial implementation of WidgetFactory.

This handles the mapping of libusb_devices to widgets and notifying the observer when widgets are added or removed.

Inheritance diagram for ola::plugin::usbdmx::BaseWidgetFactory< WidgetType >:
ola::plugin::usbdmx::WidgetFactory

Public Member Functions

void DeviceRemoved (WidgetObserver *observer, libusb_device *device)
 Called when a USB device is removed.
- Public Member Functions inherited from ola::plugin::usbdmx::WidgetFactory
virtual bool DeviceAdded (WidgetObserver *observer, libusb_device *usb_device, const struct libusb_device_descriptor &descriptor)=0
 Called when a new USB device is added.

Protected Member Functions

bool HasDevice (libusb_device *usb_device)
 Check if this factory is already using this device.
bool AddWidget (WidgetObserver *observer, libusb_device *usb_device, WidgetType *widget)
 Initialize a widget and notify the observer.

Member Function Documentation

template<typename WidgetType>
bool ola::plugin::usbdmx::BaseWidgetFactory< WidgetType >::AddWidget ( WidgetObserver observer,
libusb_device *  usb_device,
WidgetType *  widget 
)
protected

Initialize a widget and notify the observer.

Parameters
observerThe WidgetObserver to notify of the new widget.
usb_devicethe libusb_device associated with the widget.
widgetthe new Widget, ownership is transferred.
Returns
True if the widget was added, false otherwise.
template<typename WidgetType >
void ola::plugin::usbdmx::BaseWidgetFactory< WidgetType >::DeviceRemoved ( WidgetObserver observer,
libusb_device *  usb_device 
)
virtual

Called when a USB device is removed.

Parameters
observerThe WidgetObserver to notify if this action results in a widget removal.
usb_devicethe libusb_device that was removed.

Implements ola::plugin::usbdmx::WidgetFactory.

Reimplemented in ola::plugin::usbdmx::SunliteFactory.

template<typename WidgetType>
bool ola::plugin::usbdmx::BaseWidgetFactory< WidgetType >::HasDevice ( libusb_device *  usb_device)
inlineprotected

Check if this factory is already using this device.

Parameters
usb_deviceThe libusb_device to check for.
Returns
true if we already have a widget registered for this device, false otherwise.

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