Lumiverse  2.5
A framework for creating lighting control applications
Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Lumiverse::OscPatch Class Reference
Inheritance diagram for Lumiverse::OscPatch:
Inheritance graph
[legend]
Collaboration diagram for Lumiverse::OscPatch:
Collaboration graph
[legend]

Public Member Functions

 OscPatch (string address, int port, OscFormat mode=PREFIXED_ADDR, string pattern="lumiverse")
 
 OscPatch (JSONNode data)
 
virtual void init () override
 Initializes settings for the patch. More...
 
virtual void update (set< Device * > devices) override
 Grabs values from list of Devices, translates them to proper format for the given network, and outputs the values to the network if the device is patched. More...
 
virtual void close () override
 Prepares for patch shutdown.
 
virtual JSONNode toJSON () override
 Returns a JSON node representing the patch. More...
 
virtual void deleteDevice (string id) override
 Called when a device is deleted from the Rig. More...
 
virtual string getType ()
 Gets the type of the patch as a string. More...
 
void changeAddress (string address, int port)
 
void changeInPort (int port)
 
string getAddress ()
 
int getPort ()
 
int getInPort ()
 
bool isRunning ()
 
bool sync (const set< Device * > devices)
 Only active in ETC_EOS mode. Synchronizes device values with what's in EOS. More...
 
set< int > getEosSelection ()
 Returns the selected device channels from Eos.
 
- Public Member Functions inherited from Lumiverse::Patch
virtual ~Patch ()
 Virtual destructor.
 

Public Attributes

OscFormat _mode
 Determines how the OSC messages are sent Under PREFIXED_ADDR the OSC packet will be arranged as follows: /[pattern]/[id] {params} Under PER_DEVICE_ADDR the OSC packet will be arranged as follows: /[id] {params} User ETC_EOS the OSC packet will send Eos commands to the corresponding channel number.
 
string _pattern
 In fixed mode, the pattern to which messages are sent.
 

Protected Member Functions

virtual void ProcessMessage (const osc::ReceivedMessage &m, const IpEndpointName &remote)
 

Private Member Functions

void deviceToOsc (osc::OutboundPacketStream &p, Device *d)
 Converts a device to OSC and places the conversion in the outbound packet stream.
 
void deviceToEos (Device *d)
 Outputs a series of ETC Eos commands to update the state. More...
 
void newEosCmd ()
 Resets the Eos command line.
 
void loadJSON (JSONNode data)
 Loads a patch from JSON data.
 
void processSelection (string chans)
 Processes an Eos selection string.
 

Private Attributes

string _address
 
int _port
 
int _inPort
 
bool _running
 
UdpTransmitSocket * _t
 
Device_syncDevice
 
bool _syncReady
 
set< string > _syncParams
 
set< int > _syncChan
 

Member Function Documentation

void Lumiverse::OscPatch::deleteDevice ( string  id)
overridevirtual

Called when a device is deleted from the Rig.

Patches should clean up information about the device in question.

Implements Lumiverse::Patch.

void Lumiverse::OscPatch::deviceToEos ( Device d)
private

Outputs a series of ETC Eos commands to update the state.

Note that this function operates on specified device paramter names. If the paramter names don't match, nothing will be transmitted.

virtual string Lumiverse::OscPatch::getType ( )
inlinevirtual

Gets the type of the patch as a string.

This function should be hardcoded to return a string. This allows each object to be uniquely identified by a single string and allows the user to then do more detailed manipulation of the Patch.

Returns
String representing the type of the Patch

Implements Lumiverse::Patch.

void Lumiverse::OscPatch::init ( )
overridevirtual

Initializes settings for the patch.

This can be starting up serial interfaces, network configuration, etc.

See also
Rig::init()

Implements Lumiverse::Patch.

bool Lumiverse::OscPatch::sync ( const set< Device * >  devices)

Only active in ETC_EOS mode. Synchronizes device values with what's in EOS.

Returns
true on success, false on failure

Requires starting up an OSC receiver

JSONNode Lumiverse::OscPatch::toJSON ( )
overridevirtual

Returns a JSON node representing the patch.

This is necessary for proper serialization of the Patch when the Rig is serialied. If you don't want your Patch to be serializable for some reason, you can return an empty JSONNode

Returns
JSONNode containing the data for the Patch
See also
Rig::loadPatches(), Rig::save()

Implements Lumiverse::Patch.

void Lumiverse::OscPatch::update ( set< Device * >  devices)
overridevirtual

Grabs values from list of Devices, translates them to proper format for the given network, and outputs the values to the network if the device is patched.

Each Patch will get the full list of Devices from the Rig. The Patch implementation is responsible for finding the Devices that it needs, and then transmitting the apropriate data over the network. Each Patch may do this differently depending on the needs of the network.

Implements Lumiverse::Patch.


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