#include <artnetcontroller.h>
Public Types | |
using | ByteChannelData = std::vector< uint8 > |
using | FloatChannelData = std::vector< float > |
using | Address = uint8 |
Public Member Functions | |
ArtNetController ()=default | |
ArtNetController (ArtNetService &service) | |
virtual bool | start (nap::utility::ErrorState &errorState) override |
virtual void | stop () override |
void | send (const FloatChannelData &channelData, int channelOffset=0) |
void | send (float channelData, int channel) |
void | send (const ByteChannelData &channelData, int channelOffset=0) |
void | send (uint8 channelData, int channel) |
void | clear () |
Address | getAddress () const |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual bool | init (utility::ErrorState &errorState) |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Static Public Member Functions | |
static Address | createAddress (uint8 subnet, uint8 universe) |
static void | convertAddress (Address address, uint8 &subnet, uint8 &universe) |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Public Attributes | |
uint8 | mSubnet = 0 |
Property: 'Subnet' range from 0 - 15. More... | |
uint8 | mUniverse = 0 |
Property: 'Universe' range from 0 - 15. More... | |
int | mUpdateFrequency = artnet::refreshRate |
Property: 'Frequency' artnet refresh rate, the default is the maximum refresh rate. More... | |
float | mWaitTime = 2.0f |
Property: 'WaitTime' number of seconds before the control data is sent regardless of changes. More... | |
EArtnetMode | mMode = EArtnetMode::Broadcast |
Property: 'Mode' artnet message mode, Broadcast or Unicast. More... | |
int | mUnicastLimit = 10 |
Property: 'UnicastLimit' allowed number of unicast nodes before switching to broadcast mode. Only has effect when mode = Unicast. More... | |
bool | mVerbose = false |
Property: 'Verbose' prints artnet network traffic information to the console. More... | |
float | mReadTimeout = 2.0f |
Property: 'Timeout' poll network node read timeout, only used when mode is set to Unicast. More... | |
std::string | mIpAddress = "" |
Property: 'IP Address' this controller's IP Address, when left empty the first available ethernet adapter is chosen. More... | |
uint16 | mChannelCount = 512 |
Property: 'ChannelCount' the amount of channels included in each packet, must be between 2 and 512. More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Creates an ArtNet controller node. A controller node is used to convert dmx data into artnet data that is sent over the network. Every controller node has a subnet and universe associated with it. See comments in ArtNetService on addressing on how data is eventually sent over the network.
using ByteChannelData = std::vector<uint8> |
using FloatChannelData = std::vector<float> |
|
default |
ArtNetController | ( | ArtNetService & | service | ) |
void clear | ( | ) |
Clears all the data associated with this controller, ie: sets their values to 0
Converts a nap artnet address in to a subnet and universe
address | the artnet address to convert |
subnet | the subnet part of the address |
universe | the universe part of the address; |
Creates a unique artnet address based on a subnet and universe
subnet | the artnet subnet address |
universe | the artnet universe address |
Address getAddress | ( | ) | const |
void send | ( | const ByteChannelData & | channelData, |
int | channelOffset = 0 |
||
) |
Sends byte channel data over the artnet network. The actual sending is deferred until the update of the service, where data is sent when needed.
channelData | data in unsigned bytes (0 - 255) |
channelOffset | defines where to insert the data in the array. If the channel offset plus the size of the channelData exceeds the maximum amount of channels per universe (mChannelCount), the function will assert. |
void send | ( | const FloatChannelData & | channelData, |
int | channelOffset = 0 |
||
) |
Sends normalized float channel data (ranging from 0.0 to 1.0) over the artnet network. Internally, the float data is converted to bytes. The actual sending is deferred until the update within the service, where data is sent when needed.
channelData | data to send in normalized floats (0.0 to 1.0) |
channelOffset | defines where to insert the data in the array. If the channel offset plus the size of the channelData exceeds the maximum amount of channels per universe (mChannelCount), the function will assert. |
void send | ( | float | channelData, |
int | channel | ||
) |
Sends normalized float channel data (ranging from 0.0 to 1.0) over the artnet network. Internally, the float data is converted to bytes. The actual sending is deferred until the update, where data is sent when needed.
channelData | Channel data in normalized floats (0.0 to 1.0) |
channel | The target channel where channelData should be applied to. Must be between 0 and 511. |
void send | ( | uint8 | channelData, |
int | channel | ||
) |
Sends byte channel data over the artnet network. The actual sending is deferred until the update, where data is sent when needed.
channelData | Channel data in unsigned bytes (0 - 255) |
channel | The target channel where channelData should be applied to. Must be between 0 and 511. |
|
overridevirtual |
Creates a mapping to the subnet and address.
errorState | Contains error information in case the function returns false. |
Reimplemented from Device.
|
overridevirtual |
Removes the controller from the service and destroys the managed artnet node
Reimplemented from Device.
uint16 mChannelCount = 512 |
Property: 'ChannelCount' the amount of channels included in each packet, must be between 2 and 512.
std::string mIpAddress = "" |
Property: 'IP Address' this controller's IP Address, when left empty the first available ethernet adapter is chosen.
EArtnetMode mMode = EArtnetMode::Broadcast |
Property: 'Mode' artnet message mode, Broadcast or Unicast.
float mReadTimeout = 2.0f |
Property: 'Timeout' poll network node read timeout, only used when mode is set to Unicast.
uint8 mSubnet = 0 |
Property: 'Subnet' range from 0 - 15.
int mUnicastLimit = 10 |
Property: 'UnicastLimit' allowed number of unicast nodes before switching to broadcast mode. Only has effect when mode = Unicast.
uint8 mUniverse = 0 |
Property: 'Universe' range from 0 - 15.
int mUpdateFrequency = artnet::refreshRate |
Property: 'Frequency' artnet refresh rate, the default is the maximum refresh rate.
bool mVerbose = false |
Property: 'Verbose' prints artnet network traffic information to the console.
float mWaitTime = 2.0f |
Property: 'WaitTime' number of seconds before the control data is sent regardless of changes.