Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SPIDMXDevice.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  * SPIDMXDevice.h
17  * This represents a device and manages thread, widget and input/output ports.
18  * Copyright (C) 2017 Florian Edelmann
19  */
20 
21 #ifndef PLUGINS_SPIDMX_SPIDMXDEVICE_H_
22 #define PLUGINS_SPIDMX_SPIDMXDEVICE_H_
23 
24 #include <string>
25 #include <sstream>
26 #include <memory>
27 #include "ola/DmxBuffer.h"
28 #include "olad/Device.h"
29 #include "olad/Preferences.h"
30 #include "plugins/spidmx/SPIDMXWidget.h"
31 #include "plugins/spidmx/SPIDMXThread.h"
32 
33 namespace ola {
34 namespace plugin {
35 namespace spidmx {
36 
37 class SPIDMXDevice : public Device {
38  public:
40  class Preferences *preferences,
41  PluginAdaptor *plugin_adaptor,
42  const std::string &name,
43  const std::string &path);
44  ~SPIDMXDevice();
45 
46  std::string DeviceId() const { return m_path; }
47  SPIDMXWidget* GetWidget() { return m_widget.get(); }
48 
49  protected:
50  bool StartHook();
51 
52  private:
53  // Per device options
54  std::string DeviceBlocklength() const;
55  void SetDefaults();
56 
57 
58  std::auto_ptr<SPIDMXWidget> m_widget;
59  std::auto_ptr<SPIDMXThread> m_thread;
60  class Preferences *m_preferences;
61  PluginAdaptor *m_plugin_adaptor;
62  const std::string m_name;
63  const std::string m_path;
64  unsigned int m_blocklength;
65 
66  static const unsigned int PREF_BLOCKLENGTH_DEFAULT;
67  static const char PREF_BLOCKLENGTH_KEY[];
68 
69  DISALLOW_COPY_AND_ASSIGN(SPIDMXDevice);
70 };
71 
72 } // namespace spidmx
73 } // namespace plugin
74 } // namespace ola
75 #endif // PLUGINS_SPIDMX_SPIDMXDEVICE_H_
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
Definition: SPIDMXWidget.h:38
Definition: Device.h:95
A class used to hold a single universe of DMX data.
Definition: PluginAdaptor.h:41
bool StartHook()
Called during Start().
Definition: SPIDMXDevice.cpp:68
Definition: Preferences.h:147
std::string DeviceId() const
The device ID.
Definition: SPIDMXDevice.h:46
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Definition: Plugin.h:38
Definition: SPIDMXDevice.h:37