MBED implementation of JAudioStream

Files at this revision

API Documentation at this revision

Comitter:
ollie8
Date:
Wed Aug 19 09:04:41 2015 +0000
Parent:
5:77a5d031f270
Child:
7:9dfba830a0c8
Commit message:
Changed message string to constants

Changed in this revision

JAudioStream.cpp Show annotated file Show diff for this revision Revisions of this file
JAudioStream.h Show annotated file Show diff for this revision Revisions of this file
--- a/JAudioStream.cpp	Tue Aug 18 11:53:05 2015 +0000
+++ b/JAudioStream.cpp	Wed Aug 19 09:04:41 2015 +0000
@@ -29,6 +29,7 @@
 }
 
 bool JAudioStream::read(char *buffer, int size) {
+    TRACE("Received %s", buffer);
     socket.receiveFrom(endPoint, buffer, size);
     return true;
 }
@@ -49,7 +50,7 @@
     send(message, MESSAGE_SIZE);
 }
 
-void JAudioStream::buildMeassge(char* cmd, int param, char* message) {
+void JAudioStream::buildMeassge(const char* cmd, int param, char* message) {
     char bParam[MESSAGE_COMP_SIZE];
     intTocharArr(param, bParam);
     char i;
@@ -61,7 +62,7 @@
     }
 }
 
-void JAudioStream::buildMeassge(char* cmd, int param, char* data, char* message) {
+void JAudioStream::buildMeassge(const char* cmd, int param, char* data, char* message) {
     char bParam[MESSAGE_COMP_SIZE];
     char i;
     for (i=0; i<MESSAGE_COMP_SIZE; i++) {
@@ -85,6 +86,7 @@
 }
 
 void JAudioStream::send(char* data, int size ) {
+    TRACE("Sending %s", data);
     socket.sendTo(endPoint, data, size);
 }
 
--- a/JAudioStream.h	Tue Aug 18 11:53:05 2015 +0000
+++ b/JAudioStream.h	Wed Aug 19 09:04:41 2015 +0000
@@ -11,14 +11,14 @@
 
 class JAudioStream {
     private:
-        char* cont;
-        char* cond;
-        char* dcon;
-        char* dctd;
-        char* rqst;
-        char* begn;
-        char* comt;
-        char* hrbt;
+        const char* cont;
+        const char* cond;
+        const char* dcon;
+        const char* dctd;
+        const char* rqst;
+        const char* begn;
+        const char* comt;
+        const char* hrbt;
         EthernetInterface eth;
         UDPSocket socket;
         Endpoint endPoint;
@@ -26,8 +26,8 @@
         short remotePort;
         volatile bool connected;
         volatile bool inTransmission;
-        void buildMeassge(char*, int, char*);
-        void buildMeassge(char*, int, char*, char*);
+        void buildMeassge(const char*, int, char*);
+        void buildMeassge(const char*, int, char*, char*);
         void intTocharArr(int, char*);
         void send(char*, int);
         char* nowPlaying;