Open Lighting Architecture: plugins/kinet/KiNetNode.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
KiNetNode.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 * KiNetNode.h
17 * Header file for the KiNetNode class.
18 * Copyright (C) 2013 Simon Newton
19 */
20
21#ifndef PLUGINS_KINET_KINETNODE_H_
22#define PLUGINS_KINET_KINETNODE_H_
23
24#include <memory>
25
26#include "ola/DmxBuffer.h"
27#include "ola/io/BigEndianStream.h"
28#include "ola/io/IOQueue.h"
29#include "ola/io/SelectServerInterface.h"
30#include "ola/network/IPV4Address.h"
31#include "ola/network/Socket.h"
32
33namespace ola {
34namespace plugin {
35namespace kinet {
36
37 class KiNetNode {
38 public:
39 KiNetNode(ola::io::SelectServerInterface *ss,
40 ola::network::UDPSocketInterface *socket = NULL);
41 virtual ~KiNetNode();
42
43 bool Start();
44 bool Stop();
45
46 // The following apply to Input Ports (those which send data)
47 bool SendDMX(const ola::network::IPV4Address &target,
48 const ola::DmxBuffer &buffer);
49
50 private:
51 bool m_running;
52 ola::io::SelectServerInterface *m_ss;
53 ola::io::IOQueue m_output_queue;
54 ola::io::BigEndianOutputStream m_output_stream;
55 ola::network::Interface m_interface;
56 std::auto_ptr<ola::network::UDPSocketInterface> m_socket;
57
58 KiNetNode(const KiNetNode&);
59 KiNetNode& operator=(const KiNetNode&);
60
61 void SocketReady();
62 void PopulatePacketHeader(uint16_t msg_type);
63 bool InitNetwork();
64
65 static const uint16_t KINET_PORT = 6038;
66 static const uint32_t KINET_MAGIC_NUMBER = 0x0401dc4a;
67 static const uint16_t KINET_VERSION_ONE = 0x0100;
68 static const uint16_t KINET_DMX_MSG = 0x0101;
69};
70} // namespace kinet
71} // namespace plugin
72} // namespace ola
73#endif // PLUGINS_KINET_KINETNODE_H_
DmxBuffer.h
A class used to hold a single universe of DMX data.
IPV4Address.h
Represents an IPv4 Address.
ola::DmxBuffer
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
ola::io::BigEndianOutputStream
Definition BigEndianStream.h:169
ola::io::IOQueue
Definition IOQueue.h:41
ola::io::SelectServerInterface
The interface for the SelectServer.
Definition SelectServerInterface.h:42
ola::network::IPV4Address
Represents a IPv4 Address.
Definition IPV4Address.h:55
ola::network::Interface
Definition Interface.h:35
ola::network::UDPSocketInterface
The interface for UDPSockets.
Definition Socket.h:48
ola::plugin::kinet
Code for the Kinet protocol.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44