Fork of, triyin to rewrite for mbed 5. WIP not yet finished but working. ----------------------- 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

Revision:
10:936c3afce828
Parent:
9:e4528f622bcc
Child:
16:36d28d8e5491
--- a/OSCData.cpp	Tue Dec 04 02:16:19 2018 +0100
+++ b/OSCData.cpp	Tue Dec 04 19:58:14 2018 +0100
@@ -10,7 +10,7 @@
 	set the type flag, the size (in bytes), and the data
 =============================================================================*/
 
-/*
+
 OSCData::OSCData(const char * s){
 	error = OSC_OK;
 	type = 's';
@@ -25,7 +25,7 @@
 	}
 }
 
-*/
+
 
 
 OSCData::OSCData(int i){
@@ -40,14 +40,14 @@
 	bytes = 4;
 	data.i = i;
 }
-/*
+
 OSCData::OSCData(unsigned int i){
 	error = OSC_OK;
 	type = 'i';
 	bytes = 4;
 	data.i = i;
 }
-*/
+
 
 OSCData::OSCData(float f){
 	error = OSC_OK;
@@ -77,7 +77,7 @@
 	}
 }
 
-/*
+
 OSCData::OSCData(uint8_t * b, int len){
 	error = OSC_OK;
 	type = 'b';
@@ -105,7 +105,7 @@
     else
         data.b = 0;
 }
-*/
+
 OSCData::OSCData (OSCData * datum){
 	error = OSC_OK;
 	type = datum->type;
@@ -115,7 +115,7 @@
         )
     {
 		data = datum->data;
-	} /* else if ((type == 's') || (type == 'b')){
+	}  else if ((type == 's') || (type == 'b')){
 		//allocate a new piece of memory
         uint8_t * mem = (uint8_t * ) malloc(bytes);
         if (mem == NULL){
@@ -125,12 +125,12 @@
             memcpy(mem, datum->data.b, bytes);
             data.b = mem;
         }
-	} */
+	}
 }
 
 //DESTRUCTOR
 OSCData::~OSCData(){
-	/*
+
     //if there are no bytes, there is nothing to free
     if (bytes>0){
         //if the data is of type 's' or 'b', need to free that memory
@@ -140,7 +140,7 @@
             free(data.b);
         }
     }
-    */
+
 }
 
 //sets just the type as a message placeholder
@@ -178,11 +178,7 @@
     if (type == 'd'){
         return data.d;
     } else {
-    #ifndef ESPxx
-        return (double)NULL;
-    #else
         return -1;
-    #endif
     }
 }
 bool OSCData::getBoolean(){
@@ -190,13 +186,11 @@
         return true;
     } else if (type=='F'){
         return false;
+    }else{
+    	return -1;
     }
-    else
-    #ifndef ESPxx
-        return NULL;
-    #else
-        return -1;
-    #endif
+
+
 }
 
 
@@ -207,11 +201,7 @@
         strncpy(strBuffer, data.s, bytes);
         return bytes;
     } else {
-    #ifndef ESPxx
-        return (int)NULL;
-    #else
         return -1;
-    #endif
     }
 }
 
@@ -222,11 +212,7 @@
         strncpy(strBuffer, data.s, bytes);
         return bytes;
     } else {
-    #ifndef ESPxx
-        return (int)NULL;
-    #else
         return -1;
-    #endif
     }
 }
 
@@ -236,14 +222,10 @@
         strncpy(strBuffer, data.s + offset, size);
         return size;
     } else {
-    #ifndef ESPxx
-        return (int)NULL;
-    #else
         return -1;
-    #endif
     }
 }
-/*
+
 // no-safety-check straightforward way to fill the passed buffer
 // with the contents of the received blob
 int OSCData::getBlob(uint8_t * blobBuffer){
@@ -254,11 +236,7 @@
         memcpy(blobBuffer, data.b + 4, blobLength);
         return blobLength;
     } else {
-    #ifndef ESPxx
-        return (int)NULL;
-    #else
         return -1;
-    #endif
     }
 }
 
@@ -271,11 +249,7 @@
         memcpy(blobBuffer, data.b + 4, blobLength);
         return blobLength;
     } else {
-    #ifndef ESPxx
-        return (int)NULL;
-    #else
         return -1;
-    #endif
     }
 }
 
@@ -287,11 +261,7 @@
         memcpy(blobBuffer, data.b + 4 + offset, size);
         return size;
     } else {
-    #ifndef ESPxx
-        return (int)NULL;
-    #else
         return -1;
-    #endif
     }
 }
 
@@ -304,4 +274,4 @@
   }
   return -1;
 }
-*/
+