21 #ifndef PLUGINS_OSC_OSCNODE_H_
22 #define PLUGINS_OSC_OSCNODE_H_
28 #include <ola/io/SelectServerInterface.h>
35 #include "plugins/osc/OSCTarget.h"
75 FORMAT_INT_INDIVIDUAL,
77 FORMAT_FLOAT_INDIVIDUAL,
101 bool SendData(
unsigned int group, DataFormat data_format,
105 bool RegisterAddress(
const std::string &osc_address, DMXCallback *callback);
108 void SetUniverse(
const std::string &osc_address,
const uint8_t *data,
110 void SetSlot(
const std::string &osc_address, uint16_t slot, uint8_t value);
116 class NodeOSCTarget {
118 explicit NodeOSCTarget(
const OSCTarget &target);
121 bool operator==(
const NodeOSCTarget &other)
const {
122 return (socket_address == other.socket_address &&
123 osc_address == other.osc_address);
126 bool operator==(
const OSCTarget &other)
const {
127 return (socket_address == other.socket_address &&
128 osc_address == other.osc_address);
132 std::string osc_address;
133 lo_address liblo_address;
136 NodeOSCTarget(
const NodeOSCTarget&);
137 NodeOSCTarget& operator=(
const NodeOSCTarget&);
140 typedef std::vector<NodeOSCTarget*> OSCTargetVector;
142 struct OSCOutputGroup {
143 OSCTargetVector targets;
147 struct OSCInputGroup {
148 explicit OSCInputGroup(DMXCallback *callback) : callback(callback) {}
151 std::auto_ptr<DMXCallback> callback;
154 typedef std::map<unsigned int, OSCOutputGroup*> OutputGroupMap;
155 typedef std::map<std::string, OSCInputGroup*> InputUniverseMap;
163 const uint16_t m_listen_port;
164 std::auto_ptr<ola::io::UnmanagedFileDescriptor> m_descriptor;
165 lo_server m_osc_server;
166 OutputGroupMap m_output_map;
167 InputUniverseMap m_input_map;
169 void DescriptorReady();
170 bool SendBlob(
const DmxBuffer &data,
const OSCTargetVector &targets);
171 bool SendIndividualFloats(
const DmxBuffer &data,
172 OSCOutputGroup *group);
173 bool SendIndividualInts(
const DmxBuffer &data,
174 OSCOutputGroup *group);
175 bool SendIntArray(
const DmxBuffer &data,
176 const OSCTargetVector &targets);
177 bool SendFloatArray(
const DmxBuffer &data,
178 const OSCTargetVector &targets);
179 bool SendMessageToTargets(lo_message message,
180 const OSCTargetVector &targets);
181 bool SendIndividualMessages(
const DmxBuffer &data,
182 OSCOutputGroup *group,
183 const std::string &osc_type);
185 static const uint16_t DEFAULT_OSC_PORT = 7770;
186 static const char OSC_PORT_VARIABLE[];
191 #endif // PLUGINS_OSC_OSCNODE_H_
Represents Socket Addresses.
bool RemoveTarget(unsigned int group, const OSCTarget &target)
Definition: OSCNode.cpp:342
Definition: OSCTarget.h:31
A container for the exported variables.
Definition: ExportMap.h:324
~OSCNode()
Definition: OSCNode.cpp:227
uint16_t ListeningPort() const
Definition: OSCNode.cpp:472
bool RegisterAddress(const std::string &osc_address, DMXCallback *callback)
Definition: OSCNode.cpp:408
Used to hold a single universe of DMX data.
Definition: DmxBuffer.h:49
Export variables on the http server.
void SetUniverse(const std::string &osc_address, const uint8_t *data, unsigned int size)
Definition: OSCNode.cpp:438
A class used to hold a single universe of DMX data.
The interface for the SelectServer.
Definition: SelectServerInterface.h:42
OSCNode(ola::io::SelectServerInterface *ss, ola::ExportMap *export_map, const OSCNodeOptions &options)
Definition: OSCNode.cpp:209
void SetSlot(const std::string &osc_address, uint16_t slot, uint8_t value)
Definition: OSCNode.cpp:456
void AddTarget(unsigned int group, const OSCTarget &target)
Definition: OSCNode.cpp:309
bool SendData(unsigned int group, DataFormat data_format, const ola::DmxBuffer &data)
Definition: OSCNode.cpp:371
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
An IPv4 SocketAddress.
Definition: SocketAddress.h:77
void Stop()
Definition: OSCNode.cpp:274
A 1 argument callback which can be called multiple times.
Definition: Callback.h:992