Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SyncronizedWidgetObserver.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  * SyncronizedWidgetObserver.h
17  * Transfers widget add/remove events to another thread.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef PLUGINS_USBDMX_SYNCRONIZEDWIDGETOBSERVER_H_
22 #define PLUGINS_USBDMX_SYNCRONIZEDWIDGETOBSERVER_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 DMXCProjectsNodleU1 *widget) {
55  return DispatchNewWidget(widget);
56  }
57 
58  bool NewWidget(class EurolitePro *widget) {
59  return DispatchNewWidget(widget);
60  }
61 
63  return DispatchNewWidget(widget);
64  }
65 
66  bool NewWidget(class ScanlimeFadecandy *widget) {
67  return DispatchNewWidget(widget);
68  }
69 
70  bool NewWidget(class Sunlite *widget) {
71  return DispatchNewWidget(widget);
72  }
73 
74  bool NewWidget(class VellemanK8062 *widget) {
75  return DispatchNewWidget(widget);
76  }
77 
78  private:
79  typedef ola::thread::Future<bool> AddFuture;
80 
81  WidgetObserver* const m_observer;
83  const ola::thread::ThreadId m_main_thread_id;
84 
85  template<typename WidgetClass>
86  bool DispatchNewWidget(WidgetClass *widget);
87 
88  template<typename WidgetClass>
89  void HandleNewWidget(WidgetClass *widget, AddFuture *f);
90 
91  DISALLOW_COPY_AND_ASSIGN(SyncronizedWidgetObserver);
92 };
93 } // namespace usbdmx
94 } // namespace plugin
95 } // namespace ola
96 #endif // PLUGINS_USBDMX_SYNCRONIZEDWIDGETOBSERVER_H_
The interface for the Nodle Widgets.
Definition: DMXCProjectsNodleU1.h:43
The EurolitePro Widget.
Definition: EurolitePro.h:42
bool NewWidget(ola::usb::JaRuleWidget *widget)
Called when a new Ja Rule widget is added.
Definition: SyncronizedWidgetObserver.h:62
SyncronizedWidgetObserver(WidgetObserver *observer, ola::io::SelectServerInterface *ss)
Create a new SyncronizedWidgetObserver.
Definition: SyncronizedWidgetObserver.cpp:31
bool NewWidget(class EurolitePro *widget)
Called when a new EurolitePro is added.
Definition: SyncronizedWidgetObserver.h:58
A Ja Rule hardware device (widget).
Definition: JaRuleWidget.h:57
bool NewWidget(class VellemanK8062 *widget)
Called when a new VellemanK8062 is added.
Definition: SyncronizedWidgetObserver.h:74
bool NewWidget(class AnymauDMX *widget)
Called when a new AnymauDMX is added.
Definition: SyncronizedWidgetObserver.h:50
bool NewWidget(class DMXCProjectsNodleU1 *widget)
Called when a new DMXCProjects Nodle U1 widget is added.
Definition: SyncronizedWidgetObserver.h:54
The interface for the Fadecandy Widgets.
Definition: ScanlimeFadecandy.h:49
The interface for the SelectServer.
Definition: SelectServerInterface.h:42
The interface for the Sunlite Widgets.
Definition: Sunlite.h:40
Transfers widget add/remove events to another thread.
Definition: SyncronizedWidgetObserver.h:40
bool NewWidget(class Sunlite *widget)
Called when a new Sunlite is added.
Definition: SyncronizedWidgetObserver.h:70
The interface for the Velleman Widgets.
Definition: VellemanK8062.h:41
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 ScanlimeFadecandy *widget)
Called when a new ScanlimeFadecandy is added.
Definition: SyncronizedWidgetObserver.h:66
The base class for Anyma Widgets.
Definition: AnymauDMX.h:41
Definition: Future.h:33