Open Lighting Architecture  Latest Git
SynchronizedWidgetObserver.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  * SynchronizedWidgetObserver.h
17  * Transfers widget add/remove events to another thread.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef PLUGINS_USBDMX_SYNCHRONIZEDWIDGETOBSERVER_H_
22 #define PLUGINS_USBDMX_SYNCHRONIZEDWIDGETOBSERVER_H_
23 
24 #include "plugins/usbdmx/WidgetFactory.h"
25 
26 #include "ola/io/SelectServerInterface.h"
27 #include "ola/thread/Future.h"
28 #include "ola/thread/Thread.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace usbdmx {
33 
41  public:
49 
50  bool NewWidget(class AnymauDMX *widget) {
51  return DispatchNewWidget(widget);
52  }
53 
54  bool NewWidget(class AVLdiyD512 *widget) {
55  return DispatchNewWidget(widget);
56  }
57 
58  bool NewWidget(class DMXCProjectsNodleU1 *widget) {
59  return DispatchNewWidget(widget);
60  }
61 
62  bool NewWidget(class DMXCreator512Basic *widget) {
63  return DispatchNewWidget(widget);
64  }
65 
66  bool NewWidget(class EurolitePro *widget) {
67  return DispatchNewWidget(widget);
68  }
69 
71  return DispatchNewWidget(widget);
72  }
73 
74  bool NewWidget(class ScanlimeFadecandy *widget) {
75  return DispatchNewWidget(widget);
76  }
77 
78  bool NewWidget(class ShowJockeyDMXU1 *widget) {
79  return DispatchNewWidget(widget);
80  }
81 
82  bool NewWidget(class Sunlite *widget) {
83  return DispatchNewWidget(widget);
84  }
85 
86  bool NewWidget(class VellemanK8062 *widget) {
87  return DispatchNewWidget(widget);
88  }
89 
90  private:
92 
93  WidgetObserver* const m_observer;
95  const ola::thread::ThreadId m_main_thread_id;
96 
97  template<typename WidgetClass>
98  bool DispatchNewWidget(WidgetClass *widget);
99 
100  template<typename WidgetClass>
101  void HandleNewWidget(WidgetClass *widget, AddFuture *f);
102 
103  DISALLOW_COPY_AND_ASSIGN(SynchronizedWidgetObserver);
104 };
105 } // namespace usbdmx
106 } // namespace plugin
107 } // namespace ola
108 #endif // PLUGINS_USBDMX_SYNCHRONIZEDWIDGETOBSERVER_H_
The interface for the Nodle Widgets.
Definition: DMXCProjectsNodleU1.h:43
The EurolitePro Widget.
Definition: EurolitePro.h:42
A Ja Rule hardware device (widget).
Definition: JaRuleWidget.h:57
bool NewWidget(class VellemanK8062 *widget)
Called when a new VellemanK8062 is added.
Definition: SynchronizedWidgetObserver.h:86
bool NewWidget(class ScanlimeFadecandy *widget)
Called when a new ScanlimeFadecandy is added.
Definition: SynchronizedWidgetObserver.h:74
bool NewWidget(class DMXCreator512Basic *widget)
Called when a new DMXCreator512Basic is added.
Definition: SynchronizedWidgetObserver.h:62
The interface for the Fadecandy Widgets.
Definition: ScanlimeFadecandy.h:49
The interface for the SelectServer.
Definition: SelectServerInterface.h:42
bool NewWidget(class EurolitePro *widget)
Called when a new EurolitePro is added.
Definition: SynchronizedWidgetObserver.h:66
The interface for the Sunlite Widgets.
Definition: Sunlite.h:40
bool NewWidget(class AnymauDMX *widget)
Called when a new AnymauDMX is added.
Definition: SynchronizedWidgetObserver.h:50
SynchronizedWidgetObserver(WidgetObserver *observer, ola::io::SelectServerInterface *ss)
Create a new SynchronizedWidgetObserver.
Definition: SynchronizedWidgetObserver.cpp:31
Transfers widget add/remove events to another thread.
Definition: SynchronizedWidgetObserver.h:40
The base class for AVLdiy Widgets.
Definition: AVLdiyD512.h:41
bool NewWidget(class Sunlite *widget)
Called when a new Sunlite is added.
Definition: SynchronizedWidgetObserver.h:82
The interface for the Velleman Widgets.
Definition: VellemanK8062.h:41
The ShowJockey-DMX-U1 Widget.
Definition: ShowJockeyDMXU1.h:54
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Receives notifications when Widgets are added or removed.
Definition: WidgetFactory.h:49
bool NewWidget(class DMXCProjectsNodleU1 *widget)
Called when a new DMXCProjects Nodle U1 widget is added.
Definition: SynchronizedWidgetObserver.h:58
The base class for DMXCreator512Basic Widgets.
Definition: DMXCreator512Basic.h:41
bool NewWidget(ola::usb::JaRuleWidget *widget)
Called when a new Ja Rule widget is added.
Definition: SynchronizedWidgetObserver.h:70
bool NewWidget(class ShowJockeyDMXU1 *widget)
Called when a new ShowJockeyDMXU1 is added.
Definition: SynchronizedWidgetObserver.h:78
bool NewWidget(class AVLdiyD512 *widget)
Called when a new AVLdiyD512 is added.
Definition: SynchronizedWidgetObserver.h:54
The base class for Anyma Widgets.
Definition: AnymauDMX.h:41
Definition: Future.h:33