21 #ifndef PLUGINS_OSC_OSCNODE_H_
22 #define PLUGINS_OSC_OSCNODE_H_
27 #include <ola/io/Descriptor.h>
28 #include <ola/io/SelectServerInterface.h>
29 #include <ola/network/SocketAddress.h>
35 #include "plugins/osc/OSCTarget.h"
83 FORMAT_INT_INDIVIDUAL,
85 FORMAT_FLOAT_INDIVIDUAL,
109 bool SendData(
unsigned int group, DataFormat data_format,
116 void SetUniverse(
const string &osc_address,
const uint8_t *data,
118 void SetSlot(
const string &osc_address, uint16_t slot, uint8_t value);
124 class NodeOSCTarget {
126 explicit NodeOSCTarget(
const OSCTarget &target);
129 bool operator==(
const NodeOSCTarget &other)
const {
130 return (socket_address == other.socket_address &&
131 osc_address == other.osc_address);
134 bool operator==(
const OSCTarget &other)
const {
135 return (socket_address == other.socket_address &&
136 osc_address == other.osc_address);
141 lo_address liblo_address;
144 NodeOSCTarget(
const NodeOSCTarget&);
145 NodeOSCTarget& operator=(
const NodeOSCTarget&);
148 typedef vector<NodeOSCTarget*> OSCTargetVector;
150 struct OSCOutputGroup {
151 OSCTargetVector targets;
155 struct OSCInputGroup {
156 explicit OSCInputGroup(DMXCallback *callback) : callback(callback) {}
159 auto_ptr<DMXCallback> callback;
162 typedef map<unsigned int, OSCOutputGroup*> OutputGroupMap;
163 typedef map<string, OSCInputGroup*> InputUniverseMap;
170 SelectServerInterface *m_ss;
171 const uint16_t m_listen_port;
172 auto_ptr<ola::io::UnmanagedFileDescriptor> m_descriptor;
173 lo_server m_osc_server;
174 OutputGroupMap m_output_map;
175 InputUniverseMap m_input_map;
177 void DescriptorReady();
178 bool SendBlob(
const DmxBuffer &data,
const OSCTargetVector &targets);
179 bool SendIndividualFloats(
const DmxBuffer &data,
180 OSCOutputGroup *group);
181 bool SendIndividualInts(
const DmxBuffer &data,
182 OSCOutputGroup *group);
183 bool SendIntArray(
const DmxBuffer &data,
184 const OSCTargetVector &targets);
185 bool SendFloatArray(
const DmxBuffer &data,
186 const OSCTargetVector &targets);
187 bool SendMessageToTargets(lo_message message,
188 const OSCTargetVector &targets);
189 bool SendIndividualMessages(
const DmxBuffer &data,
190 OSCOutputGroup *group,
191 const string &osc_type);
193 static const uint16_t DEFAULT_OSC_PORT = 7770;
194 static const char OSC_PORT_VARIABLE[];
199 #endif // PLUGINS_OSC_OSCNODE_H_