Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DmxterDevice.h
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  * DmxterDevice.h
17  * The Goddard Design Dmxter RDM and miniDmxter
18  * Copyright (C) 2010 Simon Newton
19  */
20 
21 #ifndef PLUGINS_USBPRO_DMXTERDEVICE_H_
22 #define PLUGINS_USBPRO_DMXTERDEVICE_H_
23 
24 #include <string>
25 #include "ola/DmxBuffer.h"
26 #include "plugins/usbpro/DmxterWidget.h"
27 #include "plugins/usbpro/UsbSerialDevice.h"
28 
29 namespace ola {
30 namespace plugin {
31 namespace usbpro {
32 
33 /*
34  * An DMXter Device
35  */
37  public:
39  const string &name,
40  DmxterWidget *widget,
41  uint16_t esta_id,
42  uint16_t device_id,
43  uint32_t serial);
44  string DeviceId() const { return m_device_id; }
45 
46  private:
47  string m_device_id;
48 };
49 
50 
51 /*
52  * A single Output port per device
53  */
55  public:
57  : BasicOutputPort(parent, 0, true, true),
58  m_widget(widget) {}
59 
60  bool WriteDMX(const DmxBuffer &buffer, uint8_t priority) {
61  // this device can't output DMX
62  return true;
63  (void) priority;
64  (void) buffer;
65  }
66 
67  void SendRDMRequest(const ola::rdm::RDMRequest *request,
68  ola::rdm::RDMCallback *callback) {
69  m_widget->SendRDMRequest(request, callback);
70  }
71 
72  void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *on_complete) {
73  m_widget->RunFullDiscovery(on_complete);
74  }
75 
76  void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *on_complete) {
77  m_widget->RunIncrementalDiscovery(on_complete);
78  }
79 
80  string Description() const { return "RDM Only"; }
81 
82  private:
83  DmxterWidget *m_widget;
84 };
85 } // namespace usbpro
86 } // namespace plugin
87 } // namespace ola
88 #endif // PLUGINS_USBPRO_DMXTERDEVICE_H_