NAP
Public Types | Public Member Functions | Protected Member Functions | List of all members
ArtNetService Class Reference

#include <artnetservice.h>

Public Types

using ByteChannelData = std::vector< uint8 >
 
using FloatChannelData = std::vector< float >
 

Public Member Functions

 ArtNetService (ServiceConfiguration *configuration)
 
virtual ~ArtNetService ()
 
 ArtNetService (const ArtNetService &rhs)=delete
 
ArtNetServiceoperator= (const ArtNetService &rhs)=delete
 
- Public Member Functions inherited from Service
UNPREFIXED_MODULE_NAME_INPUTCASE Service (ServiceConfiguration *configuration)
 
virtual void getDependentServices (std::vector< rtti::TypeInfo > &dependencies) override
 
virtual bool init (nap::utility::ErrorState &errorState) override
 
virtual void shutdown () override
 
 Service (ServiceConfiguration *configuration)
 
virtual ~Service ()
 
CoregetCore ()
 
const CoregetCore () const
 
std::string getTypeName () const
 
const ModulegetModule () const
 
 Service (Service &)=delete
 
Serviceoperator= (const Service &)=delete
 
 Service (Service &&)=delete
 
Serviceoperator= (Service &&)=delete
 

Protected Member Functions

virtual void registerObjectCreators (rtti::Factory &factory) override
 
virtual void update (double deltaTime) override
 
- Protected Member Functions inherited from Service
virtual void getDependentServices (std::vector< rtti::TypeInfo > &dependencies)
 
virtual void created ()
 
virtual bool init (utility::ErrorState &error)
 
virtual void preUpdate (double deltaTime)
 
virtual void postUpdate (double deltaTime)
 
virtual void preShutdown ()
 
virtual void shutdown ()
 
virtual void preResourcesLoaded ()
 
virtual void postResourcesLoaded ()
 
template<typename SERVICE_CONFIG >
SERVICE_CONFIG * getConfiguration ()
 
template<typename SERVICE_CONFIG >
const SERVICE_CONFIG * getConfiguration () const
 
std::string getIniFilePath () const
 
std::string getIniFilePath (const std::string &appendix) const
 

Description

Service for sending and receiving data over Artnet. Data is natively sent using bytes values, but the service provides a convenience function to send data using normalized float values. When calling one of the send functions, the data is not sent directly, this is deferred to the update() call, where the service can control the frequence of sending data and where it can make sure that data is resent when needed. Because of this, updating universes partially and incrementally using multiple send calls does not impact functionality or performance of the system.

To send data, create an ArtNetController and specify the subnet and universe for the controller. Then call send on it, this will redirect the send call to this service.

Each ArtNetController determines the amount of channels they want to send. By default this is 512, but it can range from 2-512 as per the Art-Net specs. When a send call is made that addresses channels outside range of what is configured for the controller, the function will assert.

To receive data, first create an ArtNetReceiver and specify the port to listen on for receiving ArtDmx packets. Then add an ArtNetInputComponent and specify whether to filter on ArtDmx packets by Net, SubNet and Universe or to receive all packets. Connect to the input component's packetReceived slot for handling the incoming events.

Note: in the current sending implementation, only subnet and universe can be addressed. A correct implementation should include the full 16 bits and be able to address net(7 bits) - subnet(4 bits) - universe (4 bits). As we are using a library that doesn't support this correctly, we cannot address multiple nets. Now we are using 8 bits for the address, this should change as soon as we have more control over the implementation.

Inheritance diagram for ArtNetService:
[legend]
Collaboration diagram for ArtNetService:
[legend]

Member Typedef Documentation

◆ ByteChannelData

using ByteChannelData = std::vector<uint8>

◆ FloatChannelData

using FloatChannelData = std::vector<float>

Constructor & Destructor Documentation

◆ ArtNetService() [1/2]

ArtNetService ( ServiceConfiguration configuration)

◆ ~ArtNetService()

virtual ~ArtNetService ( )
virtual

◆ ArtNetService() [2/2]

ArtNetService ( const ArtNetService rhs)
delete

Member Function Documentation

◆ operator=()

ArtNetService& operator= ( const ArtNetService rhs)
delete

◆ registerObjectCreators()

virtual void registerObjectCreators ( rtti::Factory factory)
overrideprotectedvirtual

Register specific object creators

Reimplemented from Service.

◆ update()

virtual void update ( double  deltaTime)
overrideprotectedvirtual

Makes sure that data that is sent using the various send functions is transmitted over the network and consume incoming ArtDmx packet events from Art-Net Receivers.

Reimplemented from Service.