An Open Sound Control library for the mbed, created to be compatible with Recotana's OSCClass library (http://recotana.com) for the Arduino with Ethernet shield. It also uses parts of the OSC Transceiver(Sender/Receiver) code by xshige written by: Alvaro Cassinelli, October 2011 tweaked by: Toby Harris / *spark audio-visual, March 2012

Dependencies:   NetServices mbed

Committer:
tobyspark
Date:
Sun Apr 15 15:05:19 2012 +0000
Revision:
11:853a9e887023
Parent:
10:b4cc0df203b7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tobyspark 2:acfd0090c8e7 1 /* mbed OSC Library
tobyspark 2:acfd0090c8e7 2 This is an Open Sound Control library for the mbed, created to be compatible with Recotana's OSCClass library (http://recotana.com) for the
tobyspark 11:853a9e887023 3 Arduino with Ethernet shield. It also uses parts of the OSC Transceiver(Sender/Receiver) code by xshige
tobyspark 11:853a9e887023 4 written by: Alvaro Cassinelli, October 2011
tobyspark 11:853a9e887023 5 tweaked by: Toby Harris / *spark audio-visual, March 2012
tobyspark 0:49cdaebd52d5 6
tobyspark 0:49cdaebd52d5 7 This library is free software; you can redistribute it and/or
tobyspark 0:49cdaebd52d5 8 modify it under the terms of the GNU Lesser General Public
tobyspark 0:49cdaebd52d5 9 License version 2.1 as published by the Free Software Foundation.
tobyspark 0:49cdaebd52d5 10 Open Sound Control http://opensoundcontrol.org/
tobyspark 0:49cdaebd52d5 11 */
tobyspark 0:49cdaebd52d5 12
tobyspark 0:49cdaebd52d5 13 #ifndef mbedOSC_h
tobyspark 0:49cdaebd52d5 14 #define mbedOSC_h
tobyspark 0:49cdaebd52d5 15
tobyspark 0:49cdaebd52d5 16 #include "mbed.h"
tobyspark 0:49cdaebd52d5 17 #include "EthernetNetIf.h"
tobyspark 0:49cdaebd52d5 18 #include "UDPSocket.h"
tobyspark 0:49cdaebd52d5 19
tobyspark 0:49cdaebd52d5 20 // setup IP of destination (computer):
tobyspark 0:49cdaebd52d5 21 #define DEFAULT_SEND_PORT 12000
tobyspark 0:49cdaebd52d5 22 //Host sendHost(IpAddr(10, 0, 0, 1), DEFAULT_SEND_PORT, NULL); // Send Port
tobyspark 0:49cdaebd52d5 23 // set IP of origin of UDP packets - the mbed acts as a SERVER here, and needs to bind the socket to the "client" (the computer)
tobyspark 0:49cdaebd52d5 24 #define DEFAULT_RECEIVE_PORT 57130
tobyspark 0:49cdaebd52d5 25 //Host recHost(IpAddr(10, 0, 0, 1), DEFAULT_RECEIVE_PORT, NULL); // Receive Port
tobyspark 0:49cdaebd52d5 26 //UDPSocket udpRec,udpSend;
tobyspark 0:49cdaebd52d5 27
tobyspark 0:49cdaebd52d5 28
tobyspark 0:49cdaebd52d5 29 #define MAX_ADDRESS 2
tobyspark 0:49cdaebd52d5 30 #define MAX_ARG 2
tobyspark 0:49cdaebd52d5 31
tobyspark 0:49cdaebd52d5 32 #define TYPE_INT 1
tobyspark 0:49cdaebd52d5 33 #define TYPE_FLOAT 2
tobyspark 0:49cdaebd52d5 34
tobyspark 0:49cdaebd52d5 35
tobyspark 9:b37b68fdd9a4 36 /** Container class for OSC messages (receiving or sending)
tobyspark 10:b4cc0df203b7 37 @note mbedOSC version 0.1 Specification (similar to Recotana's OSCClass library)
tobyspark 10:b4cc0df203b7 38 Example of an OSC message: "/mbed/test1, if 50 32.4"
tobyspark 10:b4cc0df203b7 39 ie. "Address TypeTag Args"
tobyspark 9:b37b68fdd9a4 40 Address : max 2
tobyspark 10:b4cc0df203b7 41 "/ard"
tobyspark 10:b4cc0df203b7 42 "/ard/output"
tobyspark 10:b4cc0df203b7 43 --address[0]="/ard" :max 15character
tobyspark 10:b4cc0df203b7 44 --address[1]="/output" :max 15character
tobyspark 10:b4cc0df203b7 45 TypeTag : max 2
tobyspark 10:b4cc0df203b7 46 "i" - long or unsigned long
tobyspark 10:b4cc0df203b7 47 "f" - double
tobyspark 9:b37b68fdd9a4 48 arg : max 2
tobyspark 10:b4cc0df203b7 49 (Note: The byte string as seen here is not sent as UDP packet directly - there are no spaces, and arguments are in binary, BIG ENDIAN)
tobyspark 9:b37b68fdd9a4 50 */
tobyspark 0:49cdaebd52d5 51 class OSCMessage{
tobyspark 0:49cdaebd52d5 52
tobyspark 0:49cdaebd52d5 53 private:
tobyspark 0:49cdaebd52d5 54
tobyspark 0:49cdaebd52d5 55 char *address[MAX_ADDRESS]; // these are strings (as char*)
tobyspark 0:49cdaebd52d5 56 uint8_t addressNum; // current number of addresses in the message (ex: "/ard/test" --> the number of the addresses is 2)
tobyspark 0:49cdaebd52d5 57
tobyspark 0:49cdaebd52d5 58 char typeTag[MAX_ARG];
tobyspark 0:49cdaebd52d5 59
tobyspark 0:49cdaebd52d5 60 void *arg[MAX_ARG];
tobyspark 0:49cdaebd52d5 61 uint8_t argNum;
tobyspark 0:49cdaebd52d5 62
tobyspark 0:49cdaebd52d5 63 // Information about the connection:
tobyspark 0:49cdaebd52d5 64 //uint8_t ip[4];
tobyspark 0:49cdaebd52d5 65 //uint16_t port;
tobyspark 0:49cdaebd52d5 66 Host host;
tobyspark 0:49cdaebd52d5 67
tobyspark 0:49cdaebd52d5 68 public:
tobyspark 3:2b56849146d8 69 /** Create a container for an OSC message to be received or sent */
tobyspark 0:49cdaebd52d5 70 OSCMessage();
tobyspark 1:ab7dc9550de6 71
tobyspark 1:ab7dc9550de6 72 /** Return the IpAddr object */
tobyspark 1:ab7dc9550de6 73 const IpAddr& getIp();
tobyspark 1:ab7dc9550de6 74 /** Return the port */
tobyspark 1:ab7dc9550de6 75 const int& getPort();
tobyspark 0:49cdaebd52d5 76
tobyspark 2:acfd0090c8e7 77 /** Gets the address string of the OSC message
tobyspark 2:acfd0090c8e7 78 *
tobyspark 8:06a5e78d6821 79 * @param[in] _index The index of the address string (byte)
tobyspark 7:090b23c0a504 80 * @return pointer of the address string (char *)
tobyspark 2:acfd0090c8e7 81 * @note ex. "/ard/test"<br>
tobyspark 2:acfd0090c8e7 82 * getAddress(0) = "/ard"<br>
tobyspark 2:acfd0090c8e7 83 * getAddress(1) = "/test"
tobyspark 2:acfd0090c8e7 84 * @attention It is maximum number of the addresses is 2<br>
tobyspark 2:acfd0090c8e7 85 * In this case "/ard/test1/test2"<br>
tobyspark 2:acfd0090c8e7 86 * ignore it after "/test2"
tobyspark 1:ab7dc9550de6 87 */
tobyspark 0:49cdaebd52d5 88 char *getAddress(uint8_t _index); //retturn address
tobyspark 1:ab7dc9550de6 89
tobyspark 2:acfd0090c8e7 90 /** Gets the TopAddress string of the OSC message (this is just the address with index 0)
tobyspark 7:090b23c0a504 91 @return pointer of the TopAddress string (char *), i.e. address[0]
tobyspark 1:ab7dc9550de6 92 Example: In the case "/ard/test", getTopAddress() = "/ard" (WITH the slash "/")
tobyspark 1:ab7dc9550de6 93 */
tobyspark 0:49cdaebd52d5 94 char *getTopAddress(); //return address[0] :"/ard"
tobyspark 1:ab7dc9550de6 95
tobyspark 2:acfd0090c8e7 96 /**
tobyspark 1:ab7dc9550de6 97 Gets the "SubAddress" string of the OSC message (this is just the address with index 1)
tobyspark 7:090b23c0a504 98 @return pointer of the SubAddress string (char *), i.e. address[1]
tobyspark 1:ab7dc9550de6 99 Example: in the case "/ard/test", getSubAddress() = "/test" (WITH the slash "/")
tobyspark 1:ab7dc9550de6 100 */
tobyspark 0:49cdaebd52d5 101 char *getSubAddress(); //return address[1] :"/test"
tobyspark 1:ab7dc9550de6 102
tobyspark 2:acfd0090c8e7 103 /**
tobyspark 1:ab7dc9550de6 104 Gets the number of the OSC message address
tobyspark 7:090b23c0a504 105 @return number of the OSC message address (byte)
tobyspark 1:ab7dc9550de6 106 Examples: "/ard" --> the number of the addresses is 1
tobyspark 1:ab7dc9550de6 107 "/ard/test" --> the number of the addresses is 2
tobyspark 1:ab7dc9550de6 108 Attention: the maximum number of addresses is 2 (MAX_ADDRESS)
tobyspark 1:ab7dc9550de6 109 */
tobyspark 0:49cdaebd52d5 110 uint8_t getAddressNum(); //return 2
tobyspark 0:49cdaebd52d5 111
tobyspark 2:acfd0090c8e7 112 /**
tobyspark 1:ab7dc9550de6 113 Gets the TypeTag string (with index) of the OSC message
tobyspark 8:06a5e78d6821 114 @param[in] _index The index of the TypeTag string (byte)
tobyspark 7:090b23c0a504 115 @return: TypeTag char (char)
tobyspark 1:ab7dc9550de6 116 Example: in the case of a total typetag string equal to "if", getTypeTag(0) = 'i' and getTypeTag(1) = 'f'
tobyspark 1:ab7dc9550de6 117 Attention: MAX_ARG is maximum number of the args, if the index argument is larger, it will be constrained to this max.
tobyspark 1:ab7dc9550de6 118 */
tobyspark 0:49cdaebd52d5 119 char getTypeTag(uint8_t _index); //_index=0 ->'i'
tobyspark 0:49cdaebd52d5 120 //_index=1 ->'f'
tobyspark 0:49cdaebd52d5 121
tobyspark 2:acfd0090c8e7 122 /**
tobyspark 1:ab7dc9550de6 123 Gets the number of the OSC message args
tobyspark 7:090b23c0a504 124 @return number of the args (byte)
tobyspark 1:ab7dc9550de6 125 Example: "i" 123 --> number of the OSC message args is 1
tobyspark 1:ab7dc9550de6 126 "if" 123 54.24 --> number of the OSC message args is 2
tobyspark 1:ab7dc9550de6 127 Attention: the maximum number of args is 2 (MAX_ARG)
tobyspark 1:ab7dc9550de6 128 */
tobyspark 0:49cdaebd52d5 129 uint8_t getArgNum(); //return 2
tobyspark 0:49cdaebd52d5 130
tobyspark 2:acfd0090c8e7 131 /**
tobyspark 1:ab7dc9550de6 132 Get the args of the OSC message with an integer value
tobyspark 8:06a5e78d6821 133 @param[in] _index An int or uint8_t corresponding to the index of the args (byte)
tobyspark 7:090b23c0a504 134 @return: integer value (long, or int32_t)
tobyspark 1:ab7dc9550de6 135 Example: in the case "if" 123 54.24, getArgInt(0) = 123
tobyspark 1:ab7dc9550de6 136 Noe: "i" is integer, but the return type is "long"
tobyspark 1:ab7dc9550de6 137 Note: When a index is bigger than the number of the args, it is set to the number of the args
tobyspark 1:ab7dc9550de6 138 */
tobyspark 0:49cdaebd52d5 139 int32_t getArgInt(uint8_t _index); //_index=0 -> 123
tobyspark 1:ab7dc9550de6 140
tobyspark 2:acfd0090c8e7 141 /**
tobyspark 1:ab7dc9550de6 142 Get the args of the OSC message with a float value
tobyspark 8:06a5e78d6821 143 @param[in] _index The index of the args
tobyspark 7:090b23c0a504 144 @return: float value (double)
tobyspark 1:ab7dc9550de6 145 note: In this case "if" 123 54.24, getArgFloat(1) = 54.24
tobyspark 1:ab7dc9550de6 146 attention: arg declared as float, but return value cast as "double"
tobyspark 1:ab7dc9550de6 147 attention: When index is bigger than the number of the args, it is set to the number of the args
tobyspark 1:ab7dc9550de6 148 */
tobyspark 0:49cdaebd52d5 149 double getArgFloat(uint8_t _index); //_index=1 -> 54.21
tobyspark 0:49cdaebd52d5 150
tobyspark 0:49cdaebd52d5 151
tobyspark 2:acfd0090c8e7 152 /**
tobyspark 1:ab7dc9550de6 153 Set TopAddress string of OSC Message
tobyspark 8:06a5e78d6821 154 @param[in] _address A string pointer for the TopAddress String (char *). NOTE: is this a good idea? why not pass as const, and do allocation here?
tobyspark 1:ab7dc9550de6 155 Example: if the complete address string is "/ard/test", we set the topaddress as follows: char top[]="/ard" (allocation done here!), then setTopAddress(top)
tobyspark 1:ab7dc9550de6 156 */
tobyspark 0:49cdaebd52d5 157 void setTopAddress(char *_address); //set address[0]
tobyspark 1:ab7dc9550de6 158
tobyspark 2:acfd0090c8e7 159 /**
tobyspark 1:ab7dc9550de6 160 Set SubAddress string of the OSC Message
tobyspark 8:06a5e78d6821 161 @param[in] _address A string pointer for the SubAddress String (char *)
tobyspark 1:ab7dc9550de6 162 Example: if the complete address string is "/ard/test", we set the subaddress as follows: char sub[]="/test" (allocation done here!), then setSubAddress(sub)
tobyspark 1:ab7dc9550de6 163 Attention: we should call first setTopAddress, and then setSubAddress. The order is important. This does not seems like a good idea...
tobyspark 1:ab7dc9550de6 164 */
tobyspark 0:49cdaebd52d5 165 void setSubAddress(char *_address); //set address[1]
tobyspark 1:ab7dc9550de6 166
tobyspark 2:acfd0090c8e7 167 /**
tobyspark 1:ab7dc9550de6 168 Set the complete Address string of the OSC Message (top and sub addresses)
tobyspark 8:06a5e78d6821 169 @param[in] _topAddress, _subAddress The string pointers to top and sub addresses (char *)
tobyspark 1:ab7dc9550de6 170 Example: in the case "/ard/test", we need to do: char top[]="/ard", char sub[]="/test", and then setAddress(top,sub)
tobyspark 1:ab7dc9550de6 171 Reminder: in this implementation, the maximum number of addresses is MAX_ADDRESS=2
tobyspark 1:ab7dc9550de6 172 */
tobyspark 0:49cdaebd52d5 173 void setAddress(char *_topAddress,
tobyspark 0:49cdaebd52d5 174 char *_subAddress);
tobyspark 1:ab7dc9550de6 175
tobyspark 2:acfd0090c8e7 176 /**
tobyspark 1:ab7dc9550de6 177 Set address string using index (here 0 or 1)
tobyspark 1:ab7dc9550de6 178 Example: "/ard/test", char adr[]="/ard", setAddress(0,adr), char adr2[]="/test", setAddress(1,adr)
tobyspark 1:ab7dc9550de6 179 */
tobyspark 0:49cdaebd52d5 180 void setAddress(uint8_t _index, //set 0,address[0]
tobyspark 0:49cdaebd52d5 181 char *_address);
tobyspark 0:49cdaebd52d5 182 //set 1,address[1]
tobyspark 1:ab7dc9550de6 183
tobyspark 2:acfd0090c8e7 184 /**
tobyspark 1:ab7dc9550de6 185 Set IP Address of the OSC Message (for SENDING messages - for receiving this will be done when receiving something )
tobyspark 8:06a5e78d6821 186 @param[in] _ip Pointer of IP Address array (byte *)
tobyspark 1:ab7dc9550de6 187 Example: IP=192.168.0.99, then we have to do: ip[]={192,168,0,1}, then setIp(ip)
tobyspark 1:ab7dc9550de6 188 */
tobyspark 0:49cdaebd52d5 189 void setIp( uint8_t *_ip ); //set ip
tobyspark 1:ab7dc9550de6 190
tobyspark 4:f365c577b3c6 191 /**
tobyspark 1:ab7dc9550de6 192 Set IP Address to the OSC Message container (not through pointer)
tobyspark 1:ab7dc9550de6 193 Example: IP=192.168.0.99 => setIp(192,168,0,99)
tobyspark 1:ab7dc9550de6 194 */
tobyspark 0:49cdaebd52d5 195 void setIp(uint8_t _ip1, //set(192,
tobyspark 0:49cdaebd52d5 196 uint8_t _ip2, // 168,
tobyspark 0:49cdaebd52d5 197 uint8_t _ip3, // 0,
tobyspark 0:49cdaebd52d5 198 uint8_t _ip4); // 100)
tobyspark 1:ab7dc9550de6 199
tobyspark 1:ab7dc9550de6 200 /*
tobyspark 1:ab7dc9550de6 201 Set PortNo for the OSC Message
tobyspark 1:ab7dc9550de6 202 @param[in] _port PortNo (unsigned int)
tobyspark 1:ab7dc9550de6 203 @return None
tobyspark 1:ab7dc9550de6 204 */
tobyspark 0:49cdaebd52d5 205 void setPort( uint16_t _port );
tobyspark 0:49cdaebd52d5 206
tobyspark 4:f365c577b3c6 207 /**
tobyspark 1:ab7dc9550de6 208 Set TypeTag and args to the OSC Message container
tobyspark 1:ab7dc9550de6 209 @param[in] types TypeTag string "i"(integer) or"f"(float) (char *)
tobyspark 1:ab7dc9550de6 210 @param[in] ... Pointer of the Args(variable argument) ..
tobyspark 1:ab7dc9550de6 211 @Example:
tobyspark 1:ab7dc9550de6 212 (1) integer 123: (NOTE: integers are LONG)
tobyspark 1:ab7dc9550de6 213 long v1=123; sendMes.setArgs("i",&v1)
tobyspark 1:ab7dc9550de6 214 (2)integer:123 and float:52.14
tobyspark 1:ab7dc9550de6 215 long v1=123; double v2=52.14; sendMes.setArgs("if",&v1,&v2)
tobyspark 1:ab7dc9550de6 216 Attention: in this implementation, the maximum number of the args is 2
tobyspark 1:ab7dc9550de6 217 (if setArgs("iff",&v1,&v2,&v3), data is ignored after &v3)
tobyspark 1:ab7dc9550de6 218 */
tobyspark 0:49cdaebd52d5 219 void setArgs( char *types , ... ); //set ("if",&v1,&v2)
tobyspark 0:49cdaebd52d5 220
tobyspark 0:49cdaebd52d5 221 friend class OSCClass;
tobyspark 0:49cdaebd52d5 222
tobyspark 0:49cdaebd52d5 223 };
tobyspark 0:49cdaebd52d5 224
tobyspark 0:49cdaebd52d5 225
tobyspark 0:49cdaebd52d5 226
tobyspark 0:49cdaebd52d5 227 /* ==================================== OSCClass for sending and receiving OSC messages using UDP protocol ===================================== */
tobyspark 0:49cdaebd52d5 228
tobyspark 0:49cdaebd52d5 229 #include "UDPSocket.h"
tobyspark 0:49cdaebd52d5 230
tobyspark 3:2b56849146d8 231 /** Wraps the UDP functions to send and receive OSC messages */
tobyspark 0:49cdaebd52d5 232 class OSCClass {
tobyspark 0:49cdaebd52d5 233
tobyspark 0:49cdaebd52d5 234 private:
tobyspark 0:49cdaebd52d5 235
tobyspark 0:49cdaebd52d5 236 UDPSocket udpRec,udpSend;
tobyspark 0:49cdaebd52d5 237 char rcvBuff[256]; // raw buffer for UDP packets (udpRec.recvfrom( buf, 256, &host ) ))
tobyspark 0:49cdaebd52d5 238 int buflength;
tobyspark 0:49cdaebd52d5 239
tobyspark 0:49cdaebd52d5 240 OSCMessage *receiverMessage;
tobyspark 0:49cdaebd52d5 241 OSCMessage *sendContainer;
tobyspark 0:49cdaebd52d5 242
tobyspark 0:49cdaebd52d5 243 char tempAddress[MAX_ADDRESS][16];
tobyspark 0:49cdaebd52d5 244 uint8_t tempArg[MAX_ARG][4];
tobyspark 0:49cdaebd52d5 245
tobyspark 11:853a9e887023 246 void onUDPSocketEvent(UDPSocketEvent e);
tobyspark 11:853a9e887023 247
tobyspark 0:49cdaebd52d5 248 void decodePacket( OSCMessage *_mes); // makes OSC message from packet
tobyspark 0:49cdaebd52d5 249
tobyspark 0:49cdaebd52d5 250 public:
tobyspark 0:49cdaebd52d5 251
tobyspark 11:853a9e887023 252 friend class UDPSocket;
tobyspark 11:853a9e887023 253
tobyspark 3:2b56849146d8 254 /** Create an object to send and receive OSC messages */
tobyspark 0:49cdaebd52d5 255 OSCClass();
tobyspark 1:ab7dc9550de6 256
tobyspark 4:f365c577b3c6 257 /**
tobyspark 1:ab7dc9550de6 258 This sets "binds" the received message to the receiver container of the communication object
tobyspark 8:06a5e78d6821 259 @param[in] _mes A pointer to the "receiveing" OSC message (OSCMessage *)
tobyspark 1:ab7dc9550de6 260 */
tobyspark 0:49cdaebd52d5 261 OSCClass(OSCMessage *_mes); // set the receiver message container
tobyspark 0:49cdaebd52d5 262
tobyspark 4:f365c577b3c6 263 /**
tobyspark 8:06a5e78d6821 264 This initializes the OSC communication object with default receiving port (DEFAULT_REC_PORT)
tobyspark 1:ab7dc9550de6 265 */
tobyspark 0:49cdaebd52d5 266 void begin();
tobyspark 1:ab7dc9550de6 267
tobyspark 4:f365c577b3c6 268 /**
tobyspark 1:ab7dc9550de6 269 Initialize an OSC object with arbitrary listening port
tobyspark 8:06a5e78d6821 270 @param[in] _recievePort The listening ("receiving") Port No (unsigned int)
tobyspark 1:ab7dc9550de6 271 */
tobyspark 0:49cdaebd52d5 272 void begin(uint16_t _recievePort);
tobyspark 1:ab7dc9550de6 273
tobyspark 4:f365c577b3c6 274 /**
tobyspark 1:ab7dc9550de6 275 Stop OSC communication (in fact, only the receiver - the server side)
tobyspark 1:ab7dc9550de6 276 */
tobyspark 0:49cdaebd52d5 277 void stop();
tobyspark 0:49cdaebd52d5 278
tobyspark 9:b37b68fdd9a4 279 /**
tobyspark 11:853a9e887023 280 Returns whether there is new OSC data in the receiver message container.
tobyspark 9:b37b68fdd9a4 281 */
tobyspark 0:49cdaebd52d5 282 bool newMessage;
tobyspark 0:49cdaebd52d5 283
tobyspark 4:f365c577b3c6 284 /**
tobyspark 1:ab7dc9550de6 285 Set a OSC receive message container
tobyspark 8:06a5e78d6821 286 @param[in] _mes Pointer to the OSC receive message container (OSCMessage *)
tobyspark 1:ab7dc9550de6 287 */
tobyspark 0:49cdaebd52d5 288 void setReceiveMessage( OSCMessage *_mes ); //set receive OSCmessage container (note: the message has a "host" object from which we get the upd packets)
tobyspark 1:ab7dc9550de6 289
tobyspark 4:f365c577b3c6 290 /**
tobyspark 1:ab7dc9550de6 291 Get the received OSC message (note: this is another way to access the message directly from the OSCClass object).
tobyspark 1:ab7dc9550de6 292 The advantage is that we will signal that we read the message, and will be able to query if a NEW message arrived
tobyspark 1:ab7dc9550de6 293 (Alternatively, one could have a function pointer to pass to the OSC object, that will be called each time a new packet is received: TO DO)
tobyspark 1:ab7dc9550de6 294 */
tobyspark 0:49cdaebd52d5 295 OSCMessage *getMessage(); //return received OSCmessage
tobyspark 0:49cdaebd52d5 296
tobyspark 4:f365c577b3c6 297 /**
tobyspark 1:ab7dc9550de6 298 Send an OSC Message (message contain the host ip and port where the message data has to be sent)
tobyspark 8:06a5e78d6821 299 @param[in] _mes Pointer to the OSC message container (OSCMessage *)
tobyspark 1:ab7dc9550de6 300 */
tobyspark 0:49cdaebd52d5 301 void sendOsc( OSCMessage *_mes ); //set&send OSCmessage (note: it will be sent to the host defined in the message container)
tobyspark 0:49cdaebd52d5 302
tobyspark 9:b37b68fdd9a4 303 /**
tobyspark 9:b37b68fdd9a4 304 A function pointer to be set by host program that will be called on receipt of an OSC message
tobyspark 9:b37b68fdd9a4 305 @code
tobyspark 9:b37b68fdd9a4 306 osc.messageReceivedCallback.attach(&processOSC);
tobyspark 9:b37b68fdd9a4 307 @endcode
tobyspark 9:b37b68fdd9a4 308 */
tobyspark 0:49cdaebd52d5 309 FunctionPointer messageReceivedCallback;
tobyspark 0:49cdaebd52d5 310 };
tobyspark 0:49cdaebd52d5 311
tobyspark 0:49cdaebd52d5 312 #endif