Open Lighting Architecture  Latest Git
UartDmxDevice.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  * UartDmxDevice.h
17  * The DMX through a UART plugin for ola
18  * Copyright (C) 2011 Rui Barreiros
19  * Copyright (C) 2014 Richard Ash
20  */
21 
22 #ifndef PLUGINS_UARTDMX_UARTDMXDEVICE_H_
23 #define PLUGINS_UARTDMX_UARTDMXDEVICE_H_
24 
25 #include <string>
26 #include <sstream>
27 #include <memory>
28 #include "ola/DmxBuffer.h"
29 #include "olad/Device.h"
30 #include "olad/Preferences.h"
31 #include "plugins/uartdmx/UartWidget.h"
32 
33 namespace ola {
34 namespace plugin {
35 namespace uartdmx {
36 
37 class UartDmxDevice : public Device {
38  public:
40  class Preferences *preferences,
41  const std::string &name,
42  const std::string &path);
43  ~UartDmxDevice();
44 
45  std::string DeviceId() const { return m_path; }
46  UartWidget* GetWidget() { return m_widget.get(); }
47 
48  protected:
49  bool StartHook();
50 
51  private:
52  // Per device options
53  std::string DeviceBreakKey() const;
54  std::string DeviceMalfKey() const;
55  void SetDefaults();
56 
57  std::auto_ptr<UartWidget> m_widget;
58  class Preferences *m_preferences;
59  const std::string m_name;
60  const std::string m_path;
61  unsigned int m_breakt;
62  unsigned int m_malft;
63 
64  static const unsigned int DEFAULT_MALF;
65  static const char K_MALF[];
66  static const unsigned int DEFAULT_BREAK;
67  static const char K_BREAK[];
68 
70 };
71 } // namespace uartdmx
72 } // namespace plugin
73 } // namespace ola
74 #endif // PLUGINS_UARTDMX_UARTDMXDEVICE_H_
Definition: UartDmxDevice.h:37
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
Definition: Device.h:95
bool StartHook()
Called during Start().
Definition: UartDmxDevice.cpp:69
A class used to hold a single universe of DMX data.
Definition: Preferences.h:147
Definition: UartWidget.h:46
std::string DeviceId() const
The device ID.
Definition: UartDmxDevice.h:45
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Definition: Plugin.h:38