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
37 public:
39
50 const std::string &widget_path,
51 DisconnectCallback *disconnect_cb);
52
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
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_
A class used to hold a single universe of DMX data.
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
A 0 arg, single use callback that returns void.
Definition Callback.h:157
A 0 argument callback which deletes itself after it's run.
Definition Callback.h:141
A BidirectionalFileDescriptor that also generates notifications when closed.
Definition Descriptor.h:283
The interface for the SelectServer.
Definition SelectServerInterface.h:42
Definition StageProfiWidget.h:36
std::string GetPath() const
Return the path for this widget.
Definition StageProfiWidget.h:62
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
~StageProfiWidget()
Destructor.
Definition StageProfiWidget.cpp:72
void * timeout_id
A timeout handle which can later be used to cancel a timeout.
Definition SchedulerInterface.h:34
The namespace containing all OLA symbols.
Definition Credentials.cpp:44