MBED implementation of JAudioStream

Committer:
ollie8
Date:
Thu Aug 13 13:32:51 2015 +0000
Revision:
1:b49a6e72f353
Parent:
0:6f03883f9b43
Child:
2:22ee01f24346
updated library for mbed.

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 1:b49a6e72f353 13 const char* cont = "cont";
ollie8 1:b49a6e72f353 14 const char* cond = "cond";
ollie8 1:b49a6e72f353 15 const char* dcon = "dcon";
ollie8 1:b49a6e72f353 16 const char* rqst = "rqst";
ollie8 1:b49a6e72f353 17 const char* begn = "begn";
ollie8 1:b49a6e72f353 18 const char* comt = "comt";
ollie8 1:b49a6e72f353 19
ollie8 0:6f03883f9b43 20 class JAudioStream {
ollie8 0:6f03883f9b43 21 private:
ollie8 0:6f03883f9b43 22 // use DHCP
ollie8 1:b49a6e72f353 23 EthernetInterface eth;
ollie8 0:6f03883f9b43 24 UDPSocket udp;
ollie8 1:b49a6e72f353 25 Endpoint endPoint;
ollie8 0:6f03883f9b43 26 char* remoteIp;
ollie8 0:6f03883f9b43 27 short remotePort;
ollie8 0:6f03883f9b43 28 volatile bool connected;
ollie8 0:6f03883f9b43 29 volatile bool inTransmission;
ollie8 1:b49a6e72f353 30 void buildMeassge(const char*, int, char*);
ollie8 1:b49a6e72f353 31 void buildMeassge(const char*, int, char*, char*);
ollie8 1:b49a6e72f353 32 void intTocharArr(int, char*);
ollie8 0:6f03883f9b43 33 void send(char*, short);
ollie8 0:6f03883f9b43 34 char* nowPlaying;
ollie8 0:6f03883f9b43 35 public:
ollie8 0:6f03883f9b43 36 JAudioStream();
ollie8 0:6f03883f9b43 37 void begin(char *, char *, short);
ollie8 0:6f03883f9b43 38 bool connect(char *, short, char *);
ollie8 0:6f03883f9b43 39 bool read(char*, short, short);
ollie8 0:6f03883f9b43 40 bool isConnected();
ollie8 0:6f03883f9b43 41 char* getNowPlaying();
ollie8 0:6f03883f9b43 42 void request(char);
ollie8 0:6f03883f9b43 43 void disconnect();
ollie8 0:6f03883f9b43 44 bool available();
ollie8 0:6f03883f9b43 45 };
ollie8 0:6f03883f9b43 46
ollie8 0:6f03883f9b43 47 #endif