Open Lighting Architecture: plugins/stageprofi/StageProfiWidget.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
StageProfiWidget.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 * StageProfiWidget.h
17 * This is the base widget class
18 * Copyright (C) 2006 Simon Newton
19 */
20
21#ifndef PLUGINS_STAGEPROFI_STAGEPROFIWIDGET_H_
22#define PLUGINS_STAGEPROFI_STAGEPROFIWIDGET_H_
23
24#include <memory>
25#include <string>
26#include "ola/DmxBuffer.h"
27#include "ola/Callback.h"
28#include "ola/io/Descriptor.h"
29#include "ola/io/SelectServerInterface.h"
30
31namespace ola {
32namespace plugin {
33namespace stageprofi {
34
35
36 class StageProfiWidget {
37 public:
38 typedef ola::SingleUseCallback0<void> DisconnectCallback;
39
48 StageProfiWidget(ola::io::SelectServerInterface *ss,
49 ola::io::ConnectedDescriptor *descriptor,
50 const std::string &widget_path,
51 DisconnectCallback *disconnect_cb);
52
56 ~StageProfiWidget();
57
62 std::string GetPath() const { return m_widget_path; }
63
64 bool SendDmx(const DmxBuffer &buffer);
65
66 private:
67 enum { DMX_MSG_LEN = 255 };
68 enum { DMX_HEADER_SIZE = 4};
69
70 ola::io::SelectServerInterface *m_ss;
71 std::auto_ptr<ola::io::ConnectedDescriptor> m_descriptor;
72 const std::string m_widget_path;
73 DisconnectCallback *m_disconnect_cb;
74 ola::thread::timeout_id m_timeout_id;
75 bool m_got_response;
76
77 void SocketReady();
78 void DiscoveryTimeout();
79 bool Send255(uint16_t start, const uint8_t *buf, unsigned int len) const;
80 void SendQueryPacket();
81 void RunDisconnectHandler();
82};
83} // namespace stageprofi
84} // namespace plugin
85} // namespace ola
86#endif // PLUGINS_STAGEPROFI_STAGEPROFIWIDGET_H_
Callback.h
DmxBuffer.h
A class used to hold a single universe of DMX data.
ola::DmxBuffer
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
ola::SingleUseCallback0
A 0 argument callback which deletes itself after it's run.
Definition Callback.h:141
ola::io::ConnectedDescriptor
A BidirectionalFileDescriptor that also generates notifications when closed.
Definition Descriptor.h:283
ola::io::SelectServerInterface
The interface for the SelectServer.
Definition SelectServerInterface.h:42
ola::plugin::stageprofi::StageProfiWidget::GetPath
std::string GetPath() const
Return the path for this widget.
Definition StageProfiWidget.h:62
ola::plugin::stageprofi::StageProfiWidget::StageProfiWidget
StageProfiWidget(ola::io::SelectServerInterface *ss, ola::io::ConnectedDescriptor *descriptor, const std::string &widget_path, DisconnectCallback *disconnect_cb)
Create a new StageProfiWidget.
Definition StageProfiWidget.cpp:53
ola::plugin::stageprofi::StageProfiWidget::~StageProfiWidget
~StageProfiWidget()
Destructor.
Definition StageProfiWidget.cpp:72
Descriptor.h
ola::plugin::stageprofi
Code for Stageprofi devices.
ola::plugin
Code for supported devices and protocols.
ola::thread::timeout_id
void * timeout_id
A timeout handle which can later be used to cancel a timeout.
Definition SchedulerInterface.h:34
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44