MBED implementation of JAudioStream

Committer:
ollie8
Date:
Thu Aug 13 16:19:50 2015 +0000
Revision:
2:22ee01f24346
Parent:
1:b49a6e72f353
Child:
3:51a66c975910
Now talking to server and responds with heartbeats

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 0:6f03883f9b43 7 #define MAX_PACKT 24
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 #define PORT 7777
ollie8 0:6f03883f9b43 12
ollie8 0:6f03883f9b43 13 class JAudioStream {
ollie8 0:6f03883f9b43 14 private:
ollie8 2:22ee01f24346 15 char* cont;
ollie8 2:22ee01f24346 16 char* cond;
ollie8 2:22ee01f24346 17 char* dcon;
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 0:6f03883f9b43 23 UDPSocket udp;
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 0:6f03883f9b43 32 void send(char*, short);
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 2:22ee01f24346 37 bool read(char*);
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 0:6f03883f9b43 42 bool available();
ollie8 2:22ee01f24346 43 void receive();
ollie8 0:6f03883f9b43 44 };
ollie8 0:6f03883f9b43 45
ollie8 0:6f03883f9b43 46 #endif