MBED implementation of JAudioStream
JAudioStream.h@6:7e366261cd93, 2015-08-19 (annotated)
- Committer:
- ollie8
- Date:
- Wed Aug 19 09:04:41 2015 +0000
- Revision:
- 6:7e366261cd93
- Parent:
- 4:ebdd1cf0c9f7
- Child:
- 8:65d8e8882907
Changed message string to constants
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 | #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 | 6:7e366261cd93 | 14 | const char* cont; |
ollie8 | 6:7e366261cd93 | 15 | const char* cond; |
ollie8 | 6:7e366261cd93 | 16 | const char* dcon; |
ollie8 | 6:7e366261cd93 | 17 | const char* dctd; |
ollie8 | 6:7e366261cd93 | 18 | const char* rqst; |
ollie8 | 6:7e366261cd93 | 19 | const char* begn; |
ollie8 | 6:7e366261cd93 | 20 | const char* comt; |
ollie8 | 6:7e366261cd93 | 21 | const 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 | 6:7e366261cd93 | 29 | void buildMeassge(const char*, int, char*); |
ollie8 | 6:7e366261cd93 | 30 | void buildMeassge(const 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 |