Open Lighting Architecture  0.9.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | List of all members
ola::plugin::artnet::ArtNetNodeImpl Class Reference

Classes

struct  DMXSource
class  InputPort
struct  OutputPort

Public Member Functions

 ArtNetNodeImpl (const ola::network::Interface &iface, ola::io::SelectServerInterface *ss, const ArtNetNodeOptions &options, ola::network::UDPSocketInterface *socket=NULL)
 Create a new node.
virtual ~ArtNetNodeImpl ()
 Cleanup.
bool Start ()
 Start this node. The port modifying functions can be called before this.
bool Stop ()
 Stop this node.
bool EnterConfigurationMode ()
 Start the configuration transaction.
bool ExitConfigurationMode ()
 End the configuration transaction.
bool SetShortName (const std::string &name)
 Set the short name.
std::string ShortName () const
bool SetLongName (const std::string &name)
 Set the long name.
std::string LongName () const
bool SetNetAddress (uint8_t net_address)
 Set the the net address for this node.
uint8_t NetAddress () const
bool SetSubnetAddress (uint8_t subnet_address)
 Set the the subnet address for this node.
uint8_t SubnetAddress () const
uint8_t InputPortCount () const
bool SetInputPortUniverse (uint8_t port_id, uint8_t universe_id)
uint8_t GetInputPortUniverse (uint8_t port_id) const
 Get an input port universe address.
void DisableInputPort (uint8_t port_id)
 Disable an input port.
bool InputPortState (uint8_t port_id) const
 Check the state of an input port.
bool SetOutputPortUniverse (uint8_t port_id, uint8_t universe_id)
 Set the universe for an output port.
uint8_t GetOutputPortUniverse (uint8_t port_id)
void DisableOutputPort (uint8_t port_id)
 Disable an output port.
bool OutputPortState (uint8_t port_id) const
 Check the state of an output port.
void SetBroadcastThreshold (unsigned int threshold)
bool SetMergeMode (uint8_t port_id, artnet_merge_mode merge_mode)
 Set the merge mode for an output port.
bool SendPoll ()
 Send an ArtPoll if any of the ports are sending data.
bool SendDMX (uint8_t port_id, const ola::DmxBuffer &buffer)
 Send some DMX data.
void RunFullDiscovery (uint8_t port_id, ola::rdm::RDMDiscoveryCallback *callback)
 Flush the TOD and force a full discovery.
void RunIncrementalDiscovery (uint8_t port_id, ola::rdm::RDMDiscoveryCallback *callback)
 Run an 'incremental' discovery. This just involves fetching the TOD from all nodes.
void SendRDMRequest (uint8_t port_id, ola::rdm::RDMRequest *request, ola::rdm::RDMCallback *on_complete)
 Send an RDMRequest on this port.
bool SetUnsolicitedUIDSetHandler (uint8_t port_id, ola::Callback1< void, const ola::rdm::UIDSet & > *on_tod)
 Set the RDM handlers for an Input port.
void GetSubscribedNodes (uint8_t port_id, std::vector< ola::network::IPV4Address > *node_addresses)
 Get the nodes listening to the universe a port is sending.
bool SetDMXHandler (uint8_t port_id, DmxBuffer *buffer, ola::Callback0< void > *handler)
 Set the closure to be called when we receive data for this universe.
bool SendTod (uint8_t port_id, const ola::rdm::UIDSet &uid_set)
 Send an set of UIDs in one of more ArtTod packets.
bool SetOutputPortRDMHandlers (uint8_t port_id, ola::Callback0< void > *on_discover, ola::Callback0< void > *on_flush, ola::Callback2< void, ola::rdm::RDMRequest *, ola::rdm::RDMCallback * > *on_rdm_request)
 Set the RDM handlers for an Output port.
bool SendTimeCode (const ola::timecode::TimeCode &timecode)
 Send a timecode packet.

Constructor & Destructor Documentation

ola::plugin::artnet::ArtNetNodeImpl::ArtNetNodeImpl ( const ola::network::Interface iface,
ola::io::SelectServerInterface ss,
const ArtNetNodeOptions options,
ola::network::UDPSocketInterface socket = NULL 
)

Create a new node.

Parameters
ifacethe interface to use.
ssa pointer to a SelectServerInterface to use
optionsthe ArtNetNodeOptions for the node.
socketa pointer to a UDPSocketInterface to use

Member Function Documentation

void ola::plugin::artnet::ArtNetNodeImpl::DisableInputPort ( uint8_t  port_id)

Disable an input port.

Parameters
port_ida port id between 0 and ARTNET_MAX_PORTS - 1
void ola::plugin::artnet::ArtNetNodeImpl::DisableOutputPort ( uint8_t  port_id)

Disable an output port.

Parameters
port_ida port id between 0 and ARTNET_MAX_PORTS - 1
bool ola::plugin::artnet::ArtNetNodeImpl::EnterConfigurationMode ( )

Start the configuration transaction.

Configuration mode allows the caller to make changes without triggering an ArtPoll or ArtPollReply per change. e.g.

Example
node.EnterConfigurationMode()
node.SetShortName()
node.SetInputPortUniverse()
node.SetOutputPortUniverse()
// The poll / poll reply is sent here
node.ExitConfigurationMode()
Returns
false if there is already a transaction pending.
bool ola::plugin::artnet::ArtNetNodeImpl::ExitConfigurationMode ( )

End the configuration transaction.

Returns
false if we weren't in a transaction.
See Also
EnterConfigurationMode
uint8_t ola::plugin::artnet::ArtNetNodeImpl::GetInputPortUniverse ( uint8_t  port_id) const

Get an input port universe address.

Return the 8bit universe address for a port. This does not include the ArtNet III net-address.

Parameters
port_ida port id between 0 and ARTNET_MAX_PORTS - 1
Returns
The universe address for the port. Invalid port_ids return 0.
uint8_t ola::plugin::artnet::ArtNetNodeImpl::GetOutputPortUniverse ( uint8_t  port_id)

Return the current universe address for an output port

Parameters
port_ida port id between 0 and ARTNET_MAX_PORTS - 1
Returns
the universe address for the port
void ola::plugin::artnet::ArtNetNodeImpl::GetSubscribedNodes ( uint8_t  port_id,
std::vector< ola::network::IPV4Address > *  node_addresses 
)

Get the nodes listening to the universe a port is sending.

Populate the vector with a list of IP addresses that are known to be listening for the universe that this port is sending

Parameters
port_idthe id of the port to fetch nodes for
[out]node_addressesa vector of nodes listening to the port
uint8_t ola::plugin::artnet::ArtNetNodeImpl::InputPortCount ( ) const

Get the number of input ports

Returns
the number of input ports
bool ola::plugin::artnet::ArtNetNodeImpl::InputPortState ( uint8_t  port_id) const

Check the state of an input port.

Parameters
port_ida port id between 0 and ARTNET_MAX_PORTS - 1
Returns
the state (enabled or disabled) of an input port. An invalid port_id returns false.
bool ola::plugin::artnet::ArtNetNodeImpl::OutputPortState ( uint8_t  port_id) const

Check the state of an output port.

Parameters
port_ida port id between 0 and ARTNET_MAX_PORTS - 1
Returns
the state (enabled or disabled) of an output port. An invalid port_id returns false.
void ola::plugin::artnet::ArtNetNodeImpl::RunFullDiscovery ( uint8_t  port_id,
ola::rdm::RDMDiscoveryCallback callback 
)

Flush the TOD and force a full discovery.

The DiscoverableQueueingRDMController ensures this is only called one at a time.

Parameters
port_idport to discover on
callbackthe RDMDiscoveryCallback to run when discovery completes
void ola::plugin::artnet::ArtNetNodeImpl::RunIncrementalDiscovery ( uint8_t  port_id,
ola::rdm::RDMDiscoveryCallback callback 
)

Run an 'incremental' discovery. This just involves fetching the TOD from all nodes.

The DiscoverableQueueingRDMController ensures only one discovery process is running per port at any time.

Parameters
port_idport to send on
callbackthe RDMDiscoveryCallback to run when discovery completes
bool ola::plugin::artnet::ArtNetNodeImpl::SendDMX ( uint8_t  port_id,
const ola::DmxBuffer buffer 
)

Send some DMX data.

Parameters
port_idport to send on
bufferthe DMX data
Returns
true if it was send successfully, false otherwise
bool ola::plugin::artnet::ArtNetNodeImpl::SendPoll ( )

Send an ArtPoll if any of the ports are sending data.

This should be called periodically if we're sending data.

void ola::plugin::artnet::ArtNetNodeImpl::SendRDMRequest ( uint8_t  port_id,
ola::rdm::RDMRequest request,
ola::rdm::RDMCallback on_complete 
)

Send an RDMRequest on this port.

This may defer the sending if there are other outstanding messages in the queue.

Parameters
port_idthe id of the port to send the request on
requestthe RDMRequest object
on_completethe RDMCallback to run

Because this is wrapped in the QueueingRDMController this will only be called one-at-a-time (per port)

bool ola::plugin::artnet::ArtNetNodeImpl::SendTod ( uint8_t  port_id,
const ola::rdm::UIDSet uid_set 
)

Send an set of UIDs in one of more ArtTod packets.

Parameters
port_idthe id of the port to send on
uid_setthe UIDSet to send
bool ola::plugin::artnet::ArtNetNodeImpl::SetDMXHandler ( uint8_t  port_id,
DmxBuffer buffer,
ola::Callback0< void > *  handler 
)

Set the closure to be called when we receive data for this universe.

Parameters
port_idthe id of the port to register the handler for
buffera pointer to the DmxBuffer
handlerthe Callback0 to call when there is data for this universe. Ownership of the closure is transferred to the node.
bool ola::plugin::artnet::ArtNetNodeImpl::SetInputPortUniverse ( uint8_t  port_id,
uint8_t  universe_id 
)

Set the universe address of an input port

bool ola::plugin::artnet::ArtNetNodeImpl::SetLongName ( const std::string &  name)

Set the long name.

Parameters
namethe long node name
bool ola::plugin::artnet::ArtNetNodeImpl::SetMergeMode ( uint8_t  port_id,
artnet_merge_mode  merge_mode 
)

Set the merge mode for an output port.

Parameters
port_ida port id between 0 and ARTNET_MAX_PORTS - 1
merge_modethe artnet_merge_mode
bool ola::plugin::artnet::ArtNetNodeImpl::SetNetAddress ( uint8_t  net_address)

Set the the net address for this node.

Parameters
net_addressthe ArtNet 'net' address
bool ola::plugin::artnet::ArtNetNodeImpl::SetOutputPortUniverse ( uint8_t  port_id,
uint8_t  universe_id 
)

Set the universe for an output port.

Parameters
port_ida port id between 0 and ARTNET_MAX_PORTS - 1
universe_idthe new universe id.
bool ola::plugin::artnet::ArtNetNodeImpl::SetShortName ( const std::string &  name)

Set the short name.

Parameters
namethe short node name
bool ola::plugin::artnet::ArtNetNodeImpl::SetSubnetAddress ( uint8_t  subnet_address)

Set the the subnet address for this node.

Parameters
subnet_addressthe ArtNet 'subnet' address, 4 bits.
bool ola::plugin::artnet::ArtNetNodeImpl::SetUnsolicitedUIDSetHandler ( uint8_t  port_id,
ola::Callback1< void, const ola::rdm::UIDSet & > *  on_tod 
)

Set the RDM handlers for an Input port.

Parameters
port_idthe id of the port to set the handlers for
on_todthe callback to be invoked when a ArtTod message is received, and the RDM process isn't running.

The documentation for this class was generated from the following files: