MBED implementation of JAudioStream

Committer:
ollie8
Date:
Mon Aug 17 20:50:43 2015 +0000
Revision:
4:ebdd1cf0c9f7
Parent:
3:51a66c975910
Child:
6:7e366261cd93
added handlers for disconnect and commit messages.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ollie8 0:6f03883f9b43 1 #ifndef JAUDIO_STREAM_H
ollie8 0:6f03883f9b43 2 #define JAUDIO_STREAM_H
ollie8 0:6f03883f9b43 3 #include "mbed.h"
ollie8 1:b49a6e72f353 4 #include "EthernetInterface.h"
ollie8 0:6f03883f9b43 5 #include "UDPSocket.h"
ollie8 0:6f03883f9b43 6
ollie8 4:ebdd1cf0c9f7 7 #define MAX_PACKT 32
ollie8 0:6f03883f9b43 8 #define MESSAGE_SIZE 8
ollie8 0:6f03883f9b43 9 #define MESSAGE_COMP_SIZE 4
ollie8 0:6f03883f9b43 10 #define REQUEST_RESPONSE_MODE 1
ollie8 0:6f03883f9b43 11
ollie8 0:6f03883f9b43 12 class JAudioStream {
ollie8 0:6f03883f9b43 13 private:
ollie8 2:22ee01f24346 14 char* cont;
ollie8 2:22ee01f24346 15 char* cond;
ollie8 2:22ee01f24346 16 char* dcon;
ollie8 4:ebdd1cf0c9f7 17 char* dctd;
ollie8 2:22ee01f24346 18 char* rqst;
ollie8 2:22ee01f24346 19 char* begn;
ollie8 2:22ee01f24346 20 char* comt;
ollie8 2:22ee01f24346 21 char* hrbt;
ollie8 1:b49a6e72f353 22 EthernetInterface eth;
ollie8 3:51a66c975910 23 UDPSocket socket;
ollie8 1:b49a6e72f353 24 Endpoint endPoint;
ollie8 0:6f03883f9b43 25 char* remoteIp;
ollie8 0:6f03883f9b43 26 short remotePort;
ollie8 0:6f03883f9b43 27 volatile bool connected;
ollie8 0:6f03883f9b43 28 volatile bool inTransmission;
ollie8 2:22ee01f24346 29 void buildMeassge(char*, int, char*);
ollie8 2:22ee01f24346 30 void buildMeassge(char*, int, char*, char*);
ollie8 1:b49a6e72f353 31 void intTocharArr(int, char*);
ollie8 3:51a66c975910 32 void send(char*, int);
ollie8 0:6f03883f9b43 33 char* nowPlaying;
ollie8 0:6f03883f9b43 34 public:
ollie8 0:6f03883f9b43 35 JAudioStream();
ollie8 0:6f03883f9b43 36 bool connect(char *, short, char *);
ollie8 3:51a66c975910 37 bool read(char*, int);
ollie8 0:6f03883f9b43 38 bool isConnected();
ollie8 0:6f03883f9b43 39 char* getNowPlaying();
ollie8 0:6f03883f9b43 40 void request(char);
ollie8 0:6f03883f9b43 41 void disconnect();
ollie8 2:22ee01f24346 42 void receive();
ollie8 0:6f03883f9b43 43 };
ollie8 0:6f03883f9b43 44
ollie8 0:6f03883f9b43 45 #endif