MBED implementation of JAudioStream
JAudioStream.h@0:6f03883f9b43, 2015-08-12 (annotated)
- Committer:
- ollie8
- Date:
- Wed Aug 12 13:19:20 2015 +0000
- Revision:
- 0:6f03883f9b43
- Child:
- 1:b49a6e72f353
Mbed implementation of JAudioStream
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ollie8 | 0:6f03883f9b43 | 1 | #ifndef JAUDIO_STREAM_H |
ollie8 | 0:6f03883f9b43 | 2 | #define JAUDIO_STREAM_H |
ollie8 | 0:6f03883f9b43 | 3 | |
ollie8 | 0:6f03883f9b43 | 4 | #include "mbed.h" |
ollie8 | 0:6f03883f9b43 | 5 | #include "EthernetNetIf.h" |
ollie8 | 0:6f03883f9b43 | 6 | #include "UDPSocket.h" |
ollie8 | 0:6f03883f9b43 | 7 | |
ollie8 | 0:6f03883f9b43 | 8 | #define MAX_PACKT 24 |
ollie8 | 0:6f03883f9b43 | 9 | #define MESSAGE_SIZE 8 |
ollie8 | 0:6f03883f9b43 | 10 | #define MESSAGE_COMP_SIZE 4 |
ollie8 | 0:6f03883f9b43 | 11 | #define REQUEST_RESPONSE_MODE 1 |
ollie8 | 0:6f03883f9b43 | 12 | #define PORT 7777 |
ollie8 | 0:6f03883f9b43 | 13 | |
ollie8 | 0:6f03883f9b43 | 14 | class JAudioStream { |
ollie8 | 0:6f03883f9b43 | 15 | private: |
ollie8 | 0:6f03883f9b43 | 16 | // use DHCP |
ollie8 | 0:6f03883f9b43 | 17 | EthernetNetIf eth; |
ollie8 | 0:6f03883f9b43 | 18 | UDPSocket udp; |
ollie8 | 0:6f03883f9b43 | 19 | char* remoteIp; |
ollie8 | 0:6f03883f9b43 | 20 | short remotePort; |
ollie8 | 0:6f03883f9b43 | 21 | volatile bool connected; |
ollie8 | 0:6f03883f9b43 | 22 | volatile bool inTransmission; |
ollie8 | 0:6f03883f9b43 | 23 | void buildMeassge(const char*, char, char*); |
ollie8 | 0:6f03883f9b43 | 24 | void buildMeassge(const char*, char, char*, char*); |
ollie8 | 0:6f03883f9b43 | 25 | void intTocharArr(char, char*); |
ollie8 | 0:6f03883f9b43 | 26 | void send(char*, short); |
ollie8 | 0:6f03883f9b43 | 27 | char* nowPlaying; |
ollie8 | 0:6f03883f9b43 | 28 | void onUDPSocketEvent(UDPSocketEvent e); |
ollie8 | 0:6f03883f9b43 | 29 | public: |
ollie8 | 0:6f03883f9b43 | 30 | JAudioStream(); |
ollie8 | 0:6f03883f9b43 | 31 | void begin(char *, char *, short); |
ollie8 | 0:6f03883f9b43 | 32 | bool connect(char *, short, char *); |
ollie8 | 0:6f03883f9b43 | 33 | bool read(char*, short, short); |
ollie8 | 0:6f03883f9b43 | 34 | bool isConnected(); |
ollie8 | 0:6f03883f9b43 | 35 | char* getNowPlaying(); |
ollie8 | 0:6f03883f9b43 | 36 | void request(char); |
ollie8 | 0:6f03883f9b43 | 37 | void disconnect(); |
ollie8 | 0:6f03883f9b43 | 38 | bool available(); |
ollie8 | 0:6f03883f9b43 | 39 | }; |
ollie8 | 0:6f03883f9b43 | 40 | |
ollie8 | 0:6f03883f9b43 | 41 | #endif |