21 #ifndef PLUGINS_OSC_OSCNODE_H_ 22 #define PLUGINS_OSC_OSCNODE_H_ 29 #include <ola/io/SelectServerInterface.h> 36 #include "plugins/osc/OSCTarget.h" 76 FORMAT_INT_INDIVIDUAL,
78 FORMAT_FLOAT_INDIVIDUAL,
102 bool SendData(
unsigned int group, DataFormat data_format,
106 bool RegisterAddress(
const std::string &osc_address, DMXCallback *callback);
109 void SetUniverse(
const std::string &osc_address,
const uint8_t *data,
111 void SetSlot(
const std::string &osc_address, uint16_t slot, uint8_t value);
117 class NodeOSCTarget {
119 explicit NodeOSCTarget(
const OSCTarget &target);
122 bool operator==(
const NodeOSCTarget &other)
const {
123 return (socket_address == other.socket_address &&
124 osc_address == other.osc_address);
127 bool operator==(
const OSCTarget &other)
const {
128 return (socket_address == other.socket_address &&
129 osc_address == other.osc_address);
133 std::string osc_address;
134 lo_address liblo_address;
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);
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
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
Definition: OSCTarget.h:31
A container for the exported variables.
Definition: ExportMap.h:324
~OSCNode()
Definition: OSCNode.cpp:227
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
uint16_t ListeningPort() const
Definition: OSCNode.cpp:472
An IPv4 SocketAddress.
Definition: SocketAddress.h:78
void Stop()
Definition: OSCNode.cpp:274
A 1 argument callback which can be called multiple times.
Definition: Callback.h:992