Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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_