Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FtdiDmxPort.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15  *
16  * FtdiDmxPort.h
17  * The FTDI usb chipset DMX plugin for ola
18  * Copyright (C) 2011 Rui Barreiros
19  *
20  * Additional modifications to enable support for multiple outputs and
21  * additional device ids did change the original structure.
22  *
23  * by E.S. Rosenberg a.k.a. Keeper of the Keys 5774/2014
24  */
25 
26 #ifndef PLUGINS_FTDIDMX_FTDIDMXPORT_H_
27 #define PLUGINS_FTDIDMX_FTDIDMXPORT_H_
28 
29 #include <string>
30 
31 #include "ola/DmxBuffer.h"
32 #include "olad/Port.h"
33 #include "olad/Preferences.h"
34 #include "plugins/ftdidmx/FtdiDmxDevice.h"
35 #include "plugins/ftdidmx/FtdiWidget.h"
36 #include "plugins/ftdidmx/FtdiDmxThread.h"
37 
38 namespace ola {
39 namespace plugin {
40 namespace ftdidmx {
41 
43  public:
45  FtdiInterface *interface,
46  unsigned int id,
47  unsigned int freq)
48  : BasicOutputPort(parent, id),
49  m_interface(interface),
50  m_thread(interface, freq) {
51  m_thread.Start();
52  }
54  m_thread.Stop();
55  delete m_interface;
56  }
57 
58  bool WriteDMX(const ola::DmxBuffer &buffer, uint8_t) {
59  return m_thread.WriteDMX(buffer);
60  }
61 
62  std::string Description() const { return m_interface->Description(); }
63 
64  private:
65  FtdiInterface *m_interface;
66  FtdiDmxThread m_thread;
67 };
68 } // namespace ftdidmx
69 } // namespace plugin
70 } // namespace ola
71 #endif // PLUGINS_FTDIDMX_FTDIDMXPORT_H_
std::string Description() const
Fetch the string description for a Port.
Definition: FtdiDmxPort.h:62
Used to hold a single universe of DMX data.
Definition: DmxBuffer.h:49
BasicOutputPort(AbstractDevice *parent, unsigned int port_id, bool start_rdm_discovery_on_patch=false, bool supports_rdm=false)
Create a new BasicOutputPort.
Definition: Port.cpp:120
bool WriteDMX(const ola::DmxBuffer &buffer, uint8_t)
Write DMX data to this port.
Definition: FtdiDmxPort.h:58
A class used to hold a single universe of DMX data.
Definition: FtdiDmxThread.h:36
bool WriteDMX(const DmxBuffer &buffer)
Copy a DMXBuffer to the output thread.
Definition: FtdiDmxThread.cpp:68
virtual bool Start()
Start the thread and wait for the thread to be running.
Definition: Thread.cpp:84
Definition: FtdiDmxPort.h:42
bool Stop()
Stop this thread.
Definition: FtdiDmxThread.cpp:56
Definition: FtdiDmxDevice.h:40
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Definition: Port.h:282
Definition: FtdiWidget.h:174