MBED implementation of JAudioStream
JAudioStream.h@8:65d8e8882907, 2015-08-20 (annotated)
- Committer:
- ollie8
- Date:
- Thu Aug 20 07:17:51 2015 +0000
- Revision:
- 8:65d8e8882907
- Parent:
- 6:7e366261cd93
Add stream call back function. Internal workings of stream now contained.
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 | 8:65d8e8882907 | 22 | typedef void (*OnStream)(char*); |
ollie8 | 8:65d8e8882907 | 23 | void (*streamCallback) (char*); |
ollie8 | 8:65d8e8882907 | 24 | int bufferSize; |
ollie8 | 8:65d8e8882907 | 25 | int requestCount; |
ollie8 | 1:b49a6e72f353 | 26 | EthernetInterface eth; |
ollie8 | 3:51a66c975910 | 27 | UDPSocket socket; |
ollie8 | 1:b49a6e72f353 | 28 | Endpoint endPoint; |
ollie8 | 0:6f03883f9b43 | 29 | char* remoteIp; |
ollie8 | 0:6f03883f9b43 | 30 | short remotePort; |
ollie8 | 0:6f03883f9b43 | 31 | volatile bool connected; |
ollie8 | 0:6f03883f9b43 | 32 | volatile bool inTransmission; |
ollie8 | 6:7e366261cd93 | 33 | void buildMeassge(const char*, int, char*); |
ollie8 | 6:7e366261cd93 | 34 | void buildMeassge(const char*, int, char*, char*); |
ollie8 | 1:b49a6e72f353 | 35 | void intTocharArr(int, char*); |
ollie8 | 3:51a66c975910 | 36 | void send(char*, int); |
ollie8 | 8:65d8e8882907 | 37 | void request(char); |
ollie8 | 8:65d8e8882907 | 38 | bool read(char*, int); |
ollie8 | 0:6f03883f9b43 | 39 | char* nowPlaying; |
ollie8 | 0:6f03883f9b43 | 40 | public: |
ollie8 | 8:65d8e8882907 | 41 | JAudioStream(OnStream, int); |
ollie8 | 8:65d8e8882907 | 42 | bool connect(char *, int, char *); |
ollie8 | 0:6f03883f9b43 | 43 | bool isConnected(); |
ollie8 | 0:6f03883f9b43 | 44 | char* getNowPlaying(); |
ollie8 | 0:6f03883f9b43 | 45 | void disconnect(); |
ollie8 | 8:65d8e8882907 | 46 | int loop(); |
ollie8 | 0:6f03883f9b43 | 47 | }; |
ollie8 | 0:6f03883f9b43 | 48 | |
ollie8 | 0:6f03883f9b43 | 49 | #endif |