minimal Art-Net generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

72 lines
2.3 KiB

/*
* Copyright © 2017 Kevin Matz (kevin.matz@gmail.com)
*
* This file is part of afuzz (an Art-Net protocol utility).
*
* afuzz is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* afuzz is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with afuzz. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AFUZZ_H
#define AFUZZ_H
#include <QObject>
#include <QUdpSocket>
/**
* @brief The bare minimun to generate and send Art-Net
*/
class Node : public QObject
{
Q_OBJECT
public:
explicit Node(QObject *parent = 0);
private slots:
void sendDMX();
private:
QUdpSocket socket;
};
/**
* @brief A _minimal_ ARTNET protocol definition
*/
class ARTNET
{
public:
static const int PORT = 6454;
static const QString ID; // = "Art-Net";
static const quint16 VERSION = 14;
struct header {
char id[8]; //!< Array of 8 characters, the final character is a null termination.
quint16 opCode; //!< defines the class of data following ArtPoll within this UDP packet.
quint16 version; //!< the Art-Net protocol revision number. Current value 14.
} __attribute__((packed));
struct payload_DMX {
quint8 sequence; //!< The sequence number is used to ensure that ArtDmx packets are used in the correct order.
quint8 physical; //!< The physical input port from which DMX512 data was input.
quint8 subuni; //!< The low byte of the 15 bit Port-Address to which this packet is destined.
quint8 net; //!< The top 7 bits of the 15 bit Port-Address to which this packet is destined.
quint16 length; //!< The length of the DMX512 data array. This value should be an even number in the range 2 – 512.
} __attribute__((packed));
enum OpCodes {
OpDmx = 0x5000 //!< an ArtDmx data packet. It contains zero start code DMX512 information for a single Universe.
};
};
#endif // AFUZZ_H